milieu-cli 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/README.md +177 -76
  2. package/dist/bridges/context/agents-json.d.ts +0 -1
  3. package/dist/bridges/context/agents-json.js +21 -12
  4. package/dist/bridges/context/auth-clarity.d.ts +0 -1
  5. package/dist/bridges/context/auth-clarity.js +11 -9
  6. package/dist/bridges/context/auth-legibility.d.ts +2 -2
  7. package/dist/bridges/context/auth-legibility.js +67 -60
  8. package/dist/bridges/context/index.d.ts +1 -2
  9. package/dist/bridges/context/index.js +19 -40
  10. package/dist/bridges/context/oauth-metadata.d.ts +14 -0
  11. package/dist/bridges/context/oauth-metadata.js +127 -0
  12. package/dist/bridges/context/probe.d.ts +33 -0
  13. package/dist/bridges/context/probe.js +157 -0
  14. package/dist/bridges/context/rate-limits.d.ts +5 -2
  15. package/dist/bridges/context/rate-limits.js +27 -51
  16. package/dist/bridges/context/tos-contact.d.ts +13 -4
  17. package/dist/bridges/context/tos-contact.js +108 -46
  18. package/dist/bridges/context/versioning.d.ts +1 -2
  19. package/dist/bridges/context/versioning.js +42 -7
  20. package/dist/bridges/index.d.ts +0 -1
  21. package/dist/bridges/index.js +0 -1
  22. package/dist/bridges/reachability/crawler-policy.d.ts +30 -10
  23. package/dist/bridges/reachability/crawler-policy.js +41 -56
  24. package/dist/bridges/reachability/http-status.d.ts +3 -2
  25. package/dist/bridges/reachability/http-status.js +18 -3
  26. package/dist/bridges/reachability/https-check.d.ts +2 -2
  27. package/dist/bridges/reachability/https-check.js +6 -3
  28. package/dist/bridges/reachability/index.d.ts +1 -2
  29. package/dist/bridges/reachability/index.js +34 -43
  30. package/dist/bridges/reachability/meta-robots.d.ts +0 -13
  31. package/dist/bridges/reachability/meta-robots.js +89 -101
  32. package/dist/bridges/reachability/robots-parser.d.ts +7 -7
  33. package/dist/bridges/reachability/robots-parser.js +65 -15
  34. package/dist/bridges/reachability/robots-txt.d.ts +4 -2
  35. package/dist/bridges/reachability/robots-txt.js +33 -60
  36. package/dist/bridges/schema/descriptions.d.ts +2 -2
  37. package/dist/bridges/schema/descriptions.js +79 -44
  38. package/dist/bridges/schema/error-schemas.d.ts +2 -2
  39. package/dist/bridges/schema/error-schemas.js +31 -18
  40. package/dist/bridges/schema/index.d.ts +2 -2
  41. package/dist/bridges/schema/index.js +48 -30
  42. package/dist/bridges/schema/oas-types.d.ts +65 -26
  43. package/dist/bridges/schema/oas-types.js +37 -7
  44. package/dist/bridges/schema/operation-ids.d.ts +2 -2
  45. package/dist/bridges/schema/operation-ids.js +2 -3
  46. package/dist/bridges/schema/required-fields.d.ts +2 -2
  47. package/dist/bridges/schema/required-fields.js +12 -10
  48. package/dist/bridges/schema/schema-sources.d.ts +19 -0
  49. package/dist/bridges/schema/schema-sources.js +182 -0
  50. package/dist/bridges/schema/schema-types.d.ts +2 -2
  51. package/dist/bridges/schema/schema-types.js +20 -21
  52. package/dist/bridges/separation/api-presence.d.ts +3 -15
  53. package/dist/bridges/separation/api-presence.js +34 -85
  54. package/dist/bridges/separation/developer-docs.d.ts +6 -18
  55. package/dist/bridges/separation/developer-docs.js +100 -99
  56. package/dist/bridges/separation/docs-discovery.d.ts +28 -0
  57. package/dist/bridges/separation/docs-discovery.js +95 -0
  58. package/dist/bridges/separation/evidence-summary.d.ts +2 -0
  59. package/dist/bridges/separation/evidence-summary.js +67 -0
  60. package/dist/bridges/separation/index.d.ts +2 -19
  61. package/dist/bridges/separation/index.js +35 -39
  62. package/dist/bridges/separation/published-routes.d.ts +69 -0
  63. package/dist/bridges/separation/published-routes.js +271 -0
  64. package/dist/bridges/separation/sdk-references.d.ts +8 -3
  65. package/dist/bridges/separation/sdk-references.js +86 -61
  66. package/dist/bridges/separation/webhook-support.d.ts +3 -23
  67. package/dist/bridges/separation/webhook-support.js +61 -162
  68. package/dist/bridges/standards/a2a-agent-card.d.ts +0 -1
  69. package/dist/bridges/standards/a2a-agent-card.js +24 -9
  70. package/dist/bridges/standards/graphql.d.ts +3 -4
  71. package/dist/bridges/standards/graphql.js +70 -66
  72. package/dist/bridges/standards/index.d.ts +1 -2
  73. package/dist/bridges/standards/index.js +57 -47
  74. package/dist/bridges/standards/json-ld.d.ts +25 -11
  75. package/dist/bridges/standards/json-ld.js +114 -56
  76. package/dist/bridges/standards/llms-txt.d.ts +4 -2
  77. package/dist/bridges/standards/llms-txt.js +46 -32
  78. package/dist/bridges/standards/markdown-negotiation.d.ts +4 -1
  79. package/dist/bridges/standards/markdown-negotiation.js +16 -11
  80. package/dist/bridges/standards/mcp.d.ts +3 -12
  81. package/dist/bridges/standards/mcp.js +89 -132
  82. package/dist/bridges/standards/openapi.d.ts +7 -15
  83. package/dist/bridges/standards/openapi.js +657 -207
  84. package/dist/bridges/standards/probe-evidence.d.ts +30 -0
  85. package/dist/bridges/standards/probe-evidence.js +90 -0
  86. package/dist/bridges/standards/schema-org.d.ts +15 -9
  87. package/dist/bridges/standards/schema-org.js +38 -64
  88. package/dist/bridges/standards/sitemap.d.ts +2 -3
  89. package/dist/bridges/standards/sitemap.js +161 -169
  90. package/dist/bridges/standards/well-known.d.ts +3 -7
  91. package/dist/bridges/standards/well-known.js +28 -12
  92. package/dist/cli/index.d.ts +1 -1
  93. package/dist/cli/index.js +107 -22
  94. package/dist/cli/journey-commands.d.ts +3 -0
  95. package/dist/cli/journey-commands.js +35 -0
  96. package/dist/cli/read-report.d.ts +2 -0
  97. package/dist/cli/read-report.js +11 -0
  98. package/dist/core/bridge-output.d.ts +11 -0
  99. package/dist/core/bridge-output.js +86 -0
  100. package/dist/core/bridge-session.d.ts +28 -0
  101. package/dist/core/bridge-session.js +58 -0
  102. package/dist/core/bridge-worker.d.ts +1 -0
  103. package/dist/core/bridge-worker.js +66 -0
  104. package/dist/core/diff.d.ts +79 -0
  105. package/dist/core/diff.js +499 -0
  106. package/dist/core/explanations.d.ts +1 -3
  107. package/dist/core/explanations.js +36 -59
  108. package/dist/core/index.d.ts +4 -2
  109. package/dist/core/index.js +2 -3
  110. package/dist/core/scan-options.d.ts +0 -1
  111. package/dist/core/scan-options.js +14 -6
  112. package/dist/core/scan.d.ts +0 -1
  113. package/dist/core/scan.js +91 -41
  114. package/dist/core/scoring.d.ts +6 -0
  115. package/dist/core/scoring.js +27 -0
  116. package/dist/core/types.d.ts +97 -61
  117. package/dist/core/types.js +9 -3
  118. package/dist/core/validate-report.d.ts +5 -0
  119. package/dist/core/validate-report.js +95 -0
  120. package/dist/core/version.d.ts +0 -1
  121. package/dist/core/version.js +0 -1
  122. package/dist/index.d.ts +0 -1
  123. package/dist/index.js +0 -1
  124. package/dist/journey/body-worker.d.ts +27 -0
  125. package/dist/journey/body-worker.js +140 -0
  126. package/dist/journey/case.d.ts +74 -0
  127. package/dist/journey/case.js +187 -0
  128. package/dist/journey/cli.d.ts +14 -0
  129. package/dist/journey/cli.js +226 -0
  130. package/dist/journey/compare.d.ts +43 -0
  131. package/dist/journey/compare.js +83 -0
  132. package/dist/journey/contracts.d.ts +143 -0
  133. package/dist/journey/contracts.js +37 -0
  134. package/dist/journey/decision.d.ts +72 -0
  135. package/dist/journey/decision.js +121 -0
  136. package/dist/journey/demo.d.ts +36 -0
  137. package/dist/journey/demo.js +137 -0
  138. package/dist/journey/document.d.ts +8 -0
  139. package/dist/journey/document.js +113 -0
  140. package/dist/journey/excerpt.d.ts +6 -0
  141. package/dist/journey/excerpt.js +54 -0
  142. package/dist/journey/name-guidance.d.ts +2 -0
  143. package/dist/journey/name-guidance.js +41 -0
  144. package/dist/journey/providers.d.ts +34 -0
  145. package/dist/journey/providers.js +197 -0
  146. package/dist/journey/report-validation.d.ts +3 -0
  147. package/dist/journey/report-validation.js +457 -0
  148. package/dist/journey/runner.d.ts +12 -0
  149. package/dist/journey/runner.js +321 -0
  150. package/dist/journey/scope.d.ts +8 -0
  151. package/dist/journey/scope.js +50 -0
  152. package/dist/journey/transport.d.ts +3 -0
  153. package/dist/journey/transport.js +45 -0
  154. package/dist/journey/verify.d.ts +21 -0
  155. package/dist/journey/verify.js +213 -0
  156. package/dist/render/colors.d.ts +6 -7
  157. package/dist/render/colors.js +16 -25
  158. package/dist/render/discovery-guidance.d.ts +3 -0
  159. package/dist/render/discovery-guidance.js +66 -0
  160. package/dist/render/format-bridge.d.ts +1 -2
  161. package/dist/render/format-bridge.js +22 -17
  162. package/dist/render/format-diff.d.ts +2 -0
  163. package/dist/render/format-diff.js +169 -0
  164. package/dist/render/format-scan.d.ts +0 -1
  165. package/dist/render/format-scan.js +6 -4
  166. package/dist/render/format-verbose.d.ts +0 -1
  167. package/dist/render/format-verbose.js +7 -4
  168. package/dist/render/index.d.ts +0 -1
  169. package/dist/render/index.js +1 -2
  170. package/dist/render/oauth-observations.d.ts +4 -0
  171. package/dist/render/oauth-observations.js +27 -0
  172. package/dist/render/progress-bar.d.ts +1 -2
  173. package/dist/render/progress-bar.js +8 -6
  174. package/dist/render/robots-inventory.d.ts +3 -0
  175. package/dist/render/robots-inventory.js +38 -0
  176. package/dist/render/symbols.d.ts +4 -10
  177. package/dist/render/symbols.js +15 -17
  178. package/dist/render/terminal-text.d.ts +1 -3
  179. package/dist/render/terminal-text.js +1 -5
  180. package/dist/utils/analysis-worker-entry.d.ts +3 -0
  181. package/dist/utils/analysis-worker-entry.js +12 -0
  182. package/dist/utils/analysis-worker.d.ts +12 -0
  183. package/dist/utils/analysis-worker.js +54 -0
  184. package/dist/utils/html.d.ts +39 -0
  185. package/dist/utils/html.js +261 -0
  186. package/dist/utils/http-client.d.ts +24 -17
  187. package/dist/utils/http-client.js +166 -200
  188. package/dist/utils/http-types.d.ts +43 -0
  189. package/dist/utils/http-types.js +11 -0
  190. package/dist/utils/index.d.ts +0 -1
  191. package/dist/utils/index.js +0 -1
  192. package/dist/utils/package-registry.d.ts +11 -0
  193. package/dist/utils/package-registry.js +69 -0
  194. package/dist/utils/read-json-file.d.ts +3 -0
  195. package/dist/utils/read-json-file.js +41 -0
  196. package/dist/utils/record.d.ts +1 -0
  197. package/dist/utils/record.js +3 -0
  198. package/dist/utils/response-body.d.ts +7 -0
  199. package/dist/utils/response-body.js +71 -0
  200. package/dist/utils/ssrf.d.ts +11 -15
  201. package/dist/utils/ssrf.js +80 -44
  202. package/dist/utils/terminal-text.d.ts +2 -0
  203. package/dist/utils/terminal-text.js +4 -0
  204. package/dist/utils/url.d.ts +29 -1
  205. package/dist/utils/url.js +147 -17
  206. package/docs/examples/onboarding/account-claim.json +25 -0
  207. package/docs/examples/onboarding/pages/account-claim.html +3 -0
  208. package/docs/examples/onboarding/pages/production-activation.html +3 -0
  209. package/docs/examples/onboarding/pages/test-credential.html +3 -0
  210. package/docs/examples/onboarding/production-activation.json +25 -0
  211. package/docs/examples/onboarding/test-credential.json +25 -0
  212. package/docs/journey-qualification.md +46 -0
  213. package/docs/journeys.md +83 -0
  214. package/package.json +28 -8
  215. package/dist/bridges/context/agents-json.d.ts.map +0 -1
  216. package/dist/bridges/context/agents-json.js.map +0 -1
  217. package/dist/bridges/context/auth-clarity.d.ts.map +0 -1
  218. package/dist/bridges/context/auth-clarity.js.map +0 -1
  219. package/dist/bridges/context/auth-legibility.d.ts.map +0 -1
  220. package/dist/bridges/context/auth-legibility.js.map +0 -1
  221. package/dist/bridges/context/index.d.ts.map +0 -1
  222. package/dist/bridges/context/index.js.map +0 -1
  223. package/dist/bridges/context/rate-limits.d.ts.map +0 -1
  224. package/dist/bridges/context/rate-limits.js.map +0 -1
  225. package/dist/bridges/context/tos-contact.d.ts.map +0 -1
  226. package/dist/bridges/context/tos-contact.js.map +0 -1
  227. package/dist/bridges/context/versioning.d.ts.map +0 -1
  228. package/dist/bridges/context/versioning.js.map +0 -1
  229. package/dist/bridges/index.d.ts.map +0 -1
  230. package/dist/bridges/index.js.map +0 -1
  231. package/dist/bridges/reachability/crawler-policy.d.ts.map +0 -1
  232. package/dist/bridges/reachability/crawler-policy.js.map +0 -1
  233. package/dist/bridges/reachability/http-status.d.ts.map +0 -1
  234. package/dist/bridges/reachability/http-status.js.map +0 -1
  235. package/dist/bridges/reachability/https-check.d.ts.map +0 -1
  236. package/dist/bridges/reachability/https-check.js.map +0 -1
  237. package/dist/bridges/reachability/index.d.ts.map +0 -1
  238. package/dist/bridges/reachability/index.js.map +0 -1
  239. package/dist/bridges/reachability/meta-robots.d.ts.map +0 -1
  240. package/dist/bridges/reachability/meta-robots.js.map +0 -1
  241. package/dist/bridges/reachability/robots-parser.d.ts.map +0 -1
  242. package/dist/bridges/reachability/robots-parser.js.map +0 -1
  243. package/dist/bridges/reachability/robots-txt.d.ts.map +0 -1
  244. package/dist/bridges/reachability/robots-txt.js.map +0 -1
  245. package/dist/bridges/schema/descriptions.d.ts.map +0 -1
  246. package/dist/bridges/schema/descriptions.js.map +0 -1
  247. package/dist/bridges/schema/error-schemas.d.ts.map +0 -1
  248. package/dist/bridges/schema/error-schemas.js.map +0 -1
  249. package/dist/bridges/schema/index.d.ts.map +0 -1
  250. package/dist/bridges/schema/index.js.map +0 -1
  251. package/dist/bridges/schema/oas-types.d.ts.map +0 -1
  252. package/dist/bridges/schema/oas-types.js.map +0 -1
  253. package/dist/bridges/schema/operation-ids.d.ts.map +0 -1
  254. package/dist/bridges/schema/operation-ids.js.map +0 -1
  255. package/dist/bridges/schema/required-fields.d.ts.map +0 -1
  256. package/dist/bridges/schema/required-fields.js.map +0 -1
  257. package/dist/bridges/schema/schema-types.d.ts.map +0 -1
  258. package/dist/bridges/schema/schema-types.js.map +0 -1
  259. package/dist/bridges/separation/api-presence.d.ts.map +0 -1
  260. package/dist/bridges/separation/api-presence.js.map +0 -1
  261. package/dist/bridges/separation/developer-docs.d.ts.map +0 -1
  262. package/dist/bridges/separation/developer-docs.js.map +0 -1
  263. package/dist/bridges/separation/index.d.ts.map +0 -1
  264. package/dist/bridges/separation/index.js.map +0 -1
  265. package/dist/bridges/separation/sdk-references.d.ts.map +0 -1
  266. package/dist/bridges/separation/sdk-references.js.map +0 -1
  267. package/dist/bridges/separation/webhook-support.d.ts.map +0 -1
  268. package/dist/bridges/separation/webhook-support.js.map +0 -1
  269. package/dist/bridges/standards/a2a-agent-card.d.ts.map +0 -1
  270. package/dist/bridges/standards/a2a-agent-card.js.map +0 -1
  271. package/dist/bridges/standards/graphql.d.ts.map +0 -1
  272. package/dist/bridges/standards/graphql.js.map +0 -1
  273. package/dist/bridges/standards/index.d.ts.map +0 -1
  274. package/dist/bridges/standards/index.js.map +0 -1
  275. package/dist/bridges/standards/json-ld.d.ts.map +0 -1
  276. package/dist/bridges/standards/json-ld.js.map +0 -1
  277. package/dist/bridges/standards/llms-txt.d.ts.map +0 -1
  278. package/dist/bridges/standards/llms-txt.js.map +0 -1
  279. package/dist/bridges/standards/markdown-negotiation.d.ts.map +0 -1
  280. package/dist/bridges/standards/markdown-negotiation.js.map +0 -1
  281. package/dist/bridges/standards/mcp.d.ts.map +0 -1
  282. package/dist/bridges/standards/mcp.js.map +0 -1
  283. package/dist/bridges/standards/openapi.d.ts.map +0 -1
  284. package/dist/bridges/standards/openapi.js.map +0 -1
  285. package/dist/bridges/standards/schema-org.d.ts.map +0 -1
  286. package/dist/bridges/standards/schema-org.js.map +0 -1
  287. package/dist/bridges/standards/sitemap.d.ts.map +0 -1
  288. package/dist/bridges/standards/sitemap.js.map +0 -1
  289. package/dist/bridges/standards/well-known.d.ts.map +0 -1
  290. package/dist/bridges/standards/well-known.js.map +0 -1
  291. package/dist/cli/index.d.ts.map +0 -1
  292. package/dist/cli/index.js.map +0 -1
  293. package/dist/core/explanations.d.ts.map +0 -1
  294. package/dist/core/explanations.js.map +0 -1
  295. package/dist/core/index.d.ts.map +0 -1
  296. package/dist/core/index.js.map +0 -1
  297. package/dist/core/scan-options.d.ts.map +0 -1
  298. package/dist/core/scan-options.js.map +0 -1
  299. package/dist/core/scan.d.ts.map +0 -1
  300. package/dist/core/scan.js.map +0 -1
  301. package/dist/core/types.d.ts.map +0 -1
  302. package/dist/core/types.js.map +0 -1
  303. package/dist/core/version.d.ts.map +0 -1
  304. package/dist/core/version.js.map +0 -1
  305. package/dist/index.d.ts.map +0 -1
  306. package/dist/index.js.map +0 -1
  307. package/dist/render/colors.d.ts.map +0 -1
  308. package/dist/render/colors.js.map +0 -1
  309. package/dist/render/format-bridge.d.ts.map +0 -1
  310. package/dist/render/format-bridge.js.map +0 -1
  311. package/dist/render/format-scan.d.ts.map +0 -1
  312. package/dist/render/format-scan.js.map +0 -1
  313. package/dist/render/format-verbose.d.ts.map +0 -1
  314. package/dist/render/format-verbose.js.map +0 -1
  315. package/dist/render/index.d.ts.map +0 -1
  316. package/dist/render/index.js.map +0 -1
  317. package/dist/render/progress-bar.d.ts.map +0 -1
  318. package/dist/render/progress-bar.js.map +0 -1
  319. package/dist/render/symbols.d.ts.map +0 -1
  320. package/dist/render/symbols.js.map +0 -1
  321. package/dist/render/terminal-text.d.ts.map +0 -1
  322. package/dist/render/terminal-text.js.map +0 -1
  323. package/dist/utils/http-client.d.ts.map +0 -1
  324. package/dist/utils/http-client.js.map +0 -1
  325. package/dist/utils/index.d.ts.map +0 -1
  326. package/dist/utils/index.js.map +0 -1
  327. package/dist/utils/ssrf.d.ts.map +0 -1
  328. package/dist/utils/ssrf.js.map +0 -1
  329. package/dist/utils/url.d.ts.map +0 -1
  330. package/dist/utils/url.js.map +0 -1
@@ -1,57 +1,30 @@
1
1
  /** Static explanations for why each check matters for AI agent readiness */
2
- export const CHECK_EXPLANATIONS = {
2
+ const explanations = {
3
3
  // Bridge 1: Reachability
4
4
  https_available: "HTTPS is required for secure communication. AI agents refuse to interact with insecure endpoints.",
5
5
  http_status: {
6
6
  pass: "Your product surface returns a clean 200 response — agents can reach your content without issues.",
7
7
  fail: "Agents can't reach your content. Non-200 responses block automated workflows entirely.",
8
- partial: "Redirects add latency and may break automated agent workflows.",
8
+ partial: "Agents may not receive all of your content: the response was a redirect, a partial body, or too large to inspect.",
9
9
  default: "A non-200 status means agents can't reliably reach your content.",
10
10
  },
11
11
  robots_txt: {
12
- pass: "Your robots.txt gives AI agents clear crawling guidance.",
13
- fail: "Without robots.txt, AI agents have no guidance on what they can access — most default to cautious behavior and skip your product surface. Note: robots.txt is per-origin (RFC 9309), so a parent domain's robots.txt does not apply to subdomains.",
14
- partial: "Your robots.txt exists but may not provide clear guidance to AI agents. Note: robots.txt is per-origin (RFC 9309) — only the scanned domain's robots.txt is evaluated.",
15
- default: "robots.txt tells AI agents what they're allowed to crawl on your product surface.",
16
- },
17
- crawler_policy_gptbot: {
18
- pass: "GPTBot can access your content — it will be available to ChatGPT and OpenAI's APIs.",
19
- fail: "Blocking GPTBot prevents your content from being used by ChatGPT and OpenAI's APIs.",
20
- partial: "GPTBot has restricted access — some of your content may not reach ChatGPT and OpenAI's APIs.",
21
- default: "GPTBot is OpenAI's crawler. Its policy determines your visibility in the OpenAI ecosystem.",
22
- },
23
- crawler_policy_claudebot: {
24
- pass: "ClaudeBot can access your content — it will be available to Claude.",
25
- fail: "Blocking ClaudeBot prevents your content from being accessible to Claude.",
26
- partial: "ClaudeBot has restricted access — some of your content may not be accessible to Claude.",
27
- default: "ClaudeBot is Anthropic's crawler. Its policy determines your visibility to Claude.",
28
- },
29
- crawler_policy_ccbot: {
30
- pass: "CCBot can access your content — it will be included in the Common Crawl open dataset used to train AI models.",
31
- fail: "Blocking CCBot removes your content from the largest open web dataset used to train AI models.",
32
- partial: "CCBot has restricted access — some of your content may be excluded from AI training datasets.",
33
- default: "CCBot is Common Crawl's bot. Its policy affects whether your content appears in AI training data.",
34
- },
35
- crawler_policy_googlebot: {
36
- pass: "Googlebot can access your content — it will appear in Google Search and Gemini.",
37
- fail: "Blocking Googlebot removes your content from Google Search results and Gemini.",
38
- partial: "Googlebot has restricted access — some of your content may not appear in Google Search or Gemini.",
39
- default: "Googlebot powers Google Search and AI features. Its policy determines your Google visibility.",
40
- },
41
- crawler_policy_bingbot: {
42
- pass: "Bingbot can access your content — it will appear in Bing Search and Microsoft Copilot.",
43
- fail: "Blocking Bingbot removes your content from Bing Search and Microsoft Copilot.",
44
- partial: "Bingbot has restricted access — some of your content may not appear in Bing or Copilot.",
45
- default: "Bingbot powers Bing Search and Microsoft Copilot. Its policy determines your Microsoft AI visibility.",
46
- },
47
- crawler_policy_perplexitybot: {
48
- pass: "PerplexityBot can access your content — it will appear in Perplexity AI search answers.",
49
- fail: "Blocking PerplexityBot prevents your content from appearing in AI-powered search answers.",
50
- partial: "PerplexityBot has restricted access — some of your content may not appear in Perplexity answers.",
51
- default: "PerplexityBot powers Perplexity AI search. Its policy affects your visibility in AI search.",
52
- },
53
- meta_robots: "Meta robots tags can override robots.txt — preventing AI agents from indexing or following links even when crawling is allowed.",
54
- x_robots_tag: "X-Robots-Tag headers apply indexing restrictions at the server level, affecting all AI agents regardless of page content.",
12
+ pass: "This origin publishes crawling instructions in robots.txt.",
13
+ fail: "The response at /robots.txt did not contain a usable robots file. Check what this origin serves to crawlers.",
14
+ partial: "Crawlers may access an origin whose /robots.txt returns a 4xx or contains no rules. A readable file can specify different rules for individual crawlers.",
15
+ default: "Crawlers consult the robots.txt file on each origin for its crawling policy.",
16
+ },
17
+ crawler_policy_gptbot: "GPTBot collects content that may be used to improve OpenAI models. ChatGPT search and user-initiated retrieval use separate agents.",
18
+ crawler_policy_claudebot: "ClaudeBot gathers material for model development. Claude search and user-requested reads use separate agents.",
19
+ crawler_policy_ccbot: "CCBot collects pages for the Common Crawl dataset. Its robots rules govern which pages it may crawl.",
20
+ crawler_policy_google_extended: "Google-Extended controls use of crawled content for Gemini training and grounding in certain Google products.",
21
+ crawler_policy_applebot_extended: "Applebot-Extended controls use of crawled content for training Apple foundation models.",
22
+ crawler_policy_perplexitybot: "PerplexityBot crawls for search. Robots rules can restrict which pages it may retrieve.",
23
+ // Keep archived report IDs recognizable in offline comparisons.
24
+ crawler_policy_googlebot: "Googlebot crawls for Google Search.",
25
+ crawler_policy_bingbot: "Bingbot crawls for Bing Search.",
26
+ meta_robots: "Page-level robots directives tell supporting crawlers how to index a page or follow its links.",
27
+ x_robots_tag: "X-Robots-Tag delivers indexing and presentation directives with an HTTP response.",
55
28
  // Bridge 2: Standards
56
29
  markdown_negotiation: {
57
30
  pass: "Your server returns markdown via content negotiation — AI agents get clean, token-efficient content instead of parsing HTML.",
@@ -90,9 +63,9 @@ export const CHECK_EXPLANATIONS = {
90
63
  default: "llms-full.txt provides comprehensive product content that gives AI agents deep context beyond the llms.txt summary.",
91
64
  },
92
65
  mcp_endpoint: {
93
- pass: "Your MCP endpoint lets AI agents connect to your service as a tool — the emerging standard for AI-to-service integration.",
94
- fail: "Without an MCP endpoint, AI agents can't integrate with your service as a tool provider.",
95
- default: "MCP (Model Context Protocol) is the emerging standard for AI agents to connect with services as tools.",
66
+ pass: "A recognized MCP declaration advertises support. A client can use its connection instructions to verify protocol access.",
67
+ fail: "Inspect the declaration at /.well-known/mcp.json or publish a link to your supported MCP configuration.",
68
+ default: "This check reads a published declaration and records text references separately.",
96
69
  },
97
70
  json_ld: {
98
71
  pass: "Your JSON-LD lets AI agents extract structured entities, relationships, and attributes from your pages.",
@@ -112,23 +85,23 @@ export const CHECK_EXPLANATIONS = {
112
85
  },
113
86
  // Bridge 3: Separation
114
87
  api_presence: {
115
- pass: "AI agents can see that your product has a programmatic interface — they'll attempt to integrate with it.",
116
- fail: "Without API presence signals, AI agents treat your product surface as content-only — they won't attempt programmatic integration.",
88
+ pass: "The scan found evidence of an API. The Separation summary identifies the strongest observation.",
89
+ fail: "The checked sources gave an integrator no indication of an API.",
117
90
  default: "API presence signals tell AI agents your product has a programmatic interface, not just web pages.",
118
91
  },
119
92
  developer_docs: {
120
- pass: "Your developer documentation gives AI agents the information they need to build integrations with your product.",
121
- fail: "Without developer documentation, AI agents can't learn how to integrate with your product.",
93
+ pass: "The inventory identifies published documentation links and the pages verified at their destinations.",
94
+ fail: "The checked links and paths yielded no developer documentation.",
122
95
  default: "Developer documentation is where AI agents learn how to build integrations with your product.",
123
96
  },
124
97
  sdk_references: {
125
- pass: "AI agents can see which languages your API supports and how to install the client libraries.",
126
- fail: "Without SDK references, AI agents can't determine which languages you support or how to install your client libraries.",
98
+ pass: "A package registry reference or installation command gives an integrator a client library to investigate.",
99
+ fail: "The checked sources yielded no package registry references or installation commands.",
127
100
  default: "SDK and package references tell AI agents which languages your API supports and how to get started.",
128
101
  },
129
102
  webhook_support: {
130
- pass: "AI agents can see your webhook support — they'll build reactive workflows that respond to your events in real-time.",
131
- fail: "No webhook signals found in your OpenAPI spec, standards headers, or documentation — AI agents must poll your API for changes.",
103
+ pass: "The recorded signals identify where an integrator can look for event delivery support.",
104
+ fail: "The checked sources yielded no webhook evidence.",
132
105
  default: "Webhooks enable AI agents to receive real-time events instead of polling your API.",
133
106
  },
134
107
  // Bridge 4: Schema
@@ -138,7 +111,7 @@ export const CHECK_EXPLANATIONS = {
138
111
  default: "operationId is the machine-readable function name that AI agents use to call your API endpoints.",
139
112
  },
140
113
  schema_types_defined: {
141
- pass: "All request/response schemas have type or $ref — agents can construct valid payloads.",
114
+ pass: "The inspected request and successful-response schemas declare their types.",
142
115
  fail: "Schemas lack type definitions — agents cannot determine the shape of data to send or expect.",
143
116
  default: "Typed schemas tell AI agents exactly what data structures your API accepts and returns.",
144
117
  },
@@ -198,16 +171,20 @@ export const CHECK_EXPLANATIONS = {
198
171
  default: "agents.json at /.well-known/ defines policies for how AI agents should interact with your service.",
199
172
  },
200
173
  };
174
+ for (const entry of Object.values(explanations)) {
175
+ if (typeof entry === "object")
176
+ Object.freeze(entry);
177
+ }
178
+ export const CHECK_EXPLANATIONS = Object.freeze(explanations);
201
179
  /**
202
180
  * Resolve the explanation for a check given its ID and status.
203
181
  * Falls back: status-specific → "default" key → plain string → undefined.
204
182
  */
205
183
  export function resolveExplanation(checkId, status) {
206
- const entry = CHECK_EXPLANATIONS[checkId];
184
+ const entry = Object.hasOwn(CHECK_EXPLANATIONS, checkId) ? CHECK_EXPLANATIONS[checkId] : undefined;
207
185
  if (entry === undefined)
208
186
  return undefined;
209
187
  if (typeof entry === "string")
210
188
  return entry;
211
189
  return entry[status] ?? entry.default;
212
190
  }
213
- //# sourceMappingURL=explanations.js.map
@@ -1,6 +1,8 @@
1
- export * from "./types.js";
1
+ export type { BridgeId, BridgeName, BridgeResult, BridgeStatus, Check, CheckStatus, CliErrorKind, ContentSource, HttpError, HttpErrorKind, HttpFailure, HttpResponse, HttpSuccess, ScanContext, ScanErrorKind, ScanFailure, ScanOptions, ScanOutcome, ScanRequestSummary, ScanResult, } from "./types.js";
2
2
  export { scan } from "./scan.js";
3
+ export { compareReports } from "./diff.js";
4
+ export type { AuthSummary, Coverage, DiffFinding, DiffOptions, FindingEvidence, ReportDiff, RouteSummary } from "./diff.js";
5
+ export { parseScanReport, validateReport } from "./validate-report.js";
3
6
  export { getVersion } from "./version.js";
4
7
  export { resolveExplanation, CHECK_EXPLANATIONS } from "./explanations.js";
5
8
  export type { ExplanationEntry } from "./explanations.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,5 @@
1
- // Core barrel: public API surface (Phase 8 -- programmatic API contract)
2
- export * from "./types.js";
3
1
  export { scan } from "./scan.js";
2
+ export { compareReports } from "./diff.js";
3
+ export { parseScanReport, validateReport } from "./validate-report.js";
4
4
  export { getVersion } from "./version.js";
5
5
  export { resolveExplanation, CHECK_EXPLANATIONS } from "./explanations.js";
6
- //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
1
  import type { ScanOptions } from "./types.js";
2
2
  export declare function validateScanOptions(options: ScanOptions): string | undefined;
3
- //# sourceMappingURL=scan-options.d.ts.map
@@ -4,14 +4,22 @@ export function validateScanOptions(options) {
4
4
  if (!options || typeof options !== "object" || Array.isArray(options)) {
5
5
  return "Scan options must be an object";
6
6
  }
7
- const { timeout, maxConcurrency, maxRequests } = options;
8
- if (timeout !== undefined && (!Number.isInteger(timeout) || timeout < 1 || timeout > MAX_TIMEOUT_MS)) {
9
- return `--timeout requires an integer between 1 and ${MAX_TIMEOUT_MS} milliseconds`;
7
+ for (const key of ["timeout", "deadlineMs"]) {
8
+ const value = options[key];
9
+ if (value !== undefined && (!Number.isInteger(value) || value < 1 || value > MAX_TIMEOUT_MS)) {
10
+ return `${key} requires an integer between 1 and ${MAX_TIMEOUT_MS} milliseconds`;
11
+ }
10
12
  }
11
- for (const [flag, value] of [["--max-concurrency", maxConcurrency], ["--max-requests", maxRequests]]) {
13
+ for (const key of ["maxConcurrency", "maxRequests"]) {
14
+ const value = options[key];
12
15
  if (value !== undefined && (!Number.isSafeInteger(value) || value < 1)) {
13
- return `${flag} requires a positive safe integer`;
16
+ return `${key} requires a positive safe integer`;
14
17
  }
15
18
  }
19
+ if (options.signal !== undefined && !(options.signal instanceof AbortSignal))
20
+ return "signal must be an AbortSignal";
21
+ if (options.registryLookup !== undefined && typeof options.registryLookup !== "boolean")
22
+ return "registryLookup must be a boolean";
23
+ if (options.onProgress !== undefined && typeof options.onProgress !== "function")
24
+ return "onProgress must be a function";
16
25
  }
17
- //# sourceMappingURL=scan-options.js.map
@@ -1,3 +1,2 @@
1
1
  import type { ScanOutcome, ScanOptions } from "./types.js";
2
2
  export declare function scan(url: string, options?: ScanOptions): Promise<ScanOutcome>;
3
- //# sourceMappingURL=scan.d.ts.map
package/dist/core/scan.js CHANGED
@@ -1,9 +1,24 @@
1
- import ora from "ora";
1
+ import { checkCoverage, scoreLabel } from "./scoring.js";
2
+ import { BRIDGES } from "./types.js";
2
3
  import { normalizeUrl } from "../utils/index.js";
3
- import { runReachabilityBridge, runStandardsBridge, runSeparationBridge, runSchemaBridge, runContextBridge, } from "../bridges/index.js";
4
+ import { createBridgeRunner } from "./bridge-session.js";
5
+ import { AnalysisLimitError } from "../utils/analysis-worker.js";
4
6
  import { getVersion } from "./version.js";
7
+ import { resolveExplanation } from "./explanations.js";
5
8
  import { validateScanOptions } from "./scan-options.js";
6
9
  import { runWithScanRequestContext, getScanRequestStats } from "../utils/http-client.js";
10
+ function skipped(id, message) {
11
+ return { ...BRIDGES[id], status: "not_evaluated", score: null,
12
+ scoreLabel: null, checks: [], durationMs: 0, ...(message && { message }) };
13
+ }
14
+ async function runBridge(id, run) {
15
+ try {
16
+ return await run();
17
+ }
18
+ catch (error) {
19
+ return skipped(id, error instanceof Error ? error.message : "Bridge evaluation failed");
20
+ }
21
+ }
7
22
  export async function scan(url, options = {}) {
8
23
  const start = performance.now();
9
24
  const timestamp = new Date().toISOString();
@@ -13,57 +28,92 @@ export async function scan(url, options = {}) {
13
28
  }
14
29
  const optionError = validateScanOptions(options);
15
30
  if (optionError)
16
- return { ok: false, error: { kind: "scan_failed", message: optionError } };
31
+ return { ok: false, error: { kind: "invalid_options", message: optionError } };
17
32
  const { domain, baseUrl } = normalized;
18
- const ctx = { url, domain, baseUrl, options, shared: {} };
19
- const isSilent = options.silent ?? false;
20
- const spinner = ora({ text: "Scanning...", color: "cyan", isSilent }).start();
21
- return runWithScanRequestContext(options, async () => {
33
+ const deadline = options.deadlineMs === undefined ? undefined : AbortSignal.timeout(options.deadlineMs);
34
+ const signal = deadline && options.signal ? AbortSignal.any([deadline, options.signal]) : deadline ?? options.signal;
35
+ const ctx = { url, domain, baseUrl, options: { ...options, signal }, shared: {} };
36
+ // An observer must not decide the outcome, and a silent library has no channel to report its failure.
37
+ const progress = (stage) => {
22
38
  try {
23
- spinner.text = "Bridge 1: Reachability...";
24
- const bridge1 = await runReachabilityBridge(ctx);
25
- let bridge2;
26
- let bridge3;
27
- let bridge4;
28
- let bridge5;
29
- if (bridge1.abort) {
30
- spinner.text = "Scan aborted: " + (bridge1.abortReason ?? "unreachable");
31
- bridge2 = { id: 2, name: "Standards", status: "not_evaluated", score: 0, scoreLabel: "fail", checks: [], durationMs: 0 };
32
- bridge3 = { id: 3, name: "Separation", status: "not_evaluated", score: null, scoreLabel: null, checks: [], durationMs: 0 };
33
- bridge4 = { id: 4, name: "Schema", status: "not_evaluated", score: 0, scoreLabel: "fail", checks: [], durationMs: 0 };
34
- bridge5 = { id: 5, name: "Context", status: "not_evaluated", score: 0, scoreLabel: "fail", checks: [], durationMs: 0 };
39
+ Promise.resolve(options.onProgress?.(stage)).catch(() => { });
40
+ }
41
+ catch {
42
+ // Ignored, as above.
43
+ }
44
+ };
45
+ const cancelled = () => ({ ok: false, error: { kind: "scan_cancelled",
46
+ message: deadline?.aborted ? "Scan deadline exceeded" : "Scan cancelled" } });
47
+ try {
48
+ return await runWithScanRequestContext(ctx.options, async () => {
49
+ if (signal?.aborted)
50
+ return cancelled();
51
+ progress("Bridge 1: Reachability");
52
+ const evaluate = createBridgeRunner(ctx);
53
+ const first = await evaluate(1).catch((error) => {
54
+ if (error instanceof AnalysisLimitError)
55
+ return skipped(1, error.message);
56
+ throw error;
57
+ });
58
+ const bridges = [first, skipped(2), skipped(3), skipped(4), skipped(5)];
59
+ if (!first.abort && first.status === "evaluated") {
60
+ if (signal?.aborted)
61
+ return cancelled();
62
+ progress("Bridge 2: Standards");
63
+ bridges[1] = await runBridge(2, () => evaluate(2));
64
+ if (bridges[1].status === "evaluated") {
65
+ if (signal?.aborted)
66
+ return cancelled();
67
+ progress("Bridge 3: Separation");
68
+ bridges[2] = await runBridge(3, () => evaluate(3));
69
+ if (signal?.aborted)
70
+ return cancelled();
71
+ progress("Bridges 4 and 5: Schema and Context");
72
+ [bridges[3], bridges[4]] = await Promise.all([
73
+ runBridge(4, () => evaluate(4)), runBridge(5, () => evaluate(5)),
74
+ ]);
75
+ }
76
+ else {
77
+ for (const id of [3, 4, 5])
78
+ bridges[id - 1] = skipped(id, "Standards evidence unavailable");
79
+ }
35
80
  }
36
- else {
37
- spinner.text = "Bridge 2: Standards...";
38
- bridge2 = await runStandardsBridge(ctx);
39
- spinner.text = "Bridge 3: Separation...";
40
- bridge3 = await runSeparationBridge(ctx);
41
- spinner.text = "Bridges 4-5: Schema & Context...";
42
- [bridge4, bridge5] = await Promise.all([runSchemaBridge(ctx), runContextBridge(ctx)]);
81
+ if (first.status === "not_evaluated") {
82
+ for (const bridge of bridges.slice(1))
83
+ bridge.message = "Reachability evidence unavailable";
43
84
  }
44
- const scoredBridges = [bridge1, bridge2, bridge3, bridge4, bridge5].filter((b) => b.score !== null);
85
+ if (signal?.aborted)
86
+ return cancelled();
87
+ for (const bridge of bridges) {
88
+ if (bridge.status === "evaluated")
89
+ bridge.measurement = checkCoverage(bridge.checks);
90
+ for (const check of bridge.checks) {
91
+ check.why ??= resolveExplanation(check.id, check.status);
92
+ }
93
+ }
94
+ const scoredBridges = bridges.filter((b) => b.score !== null);
45
95
  const overallScore = scoredBridges.length > 0
46
96
  ? Math.round(scoredBridges.reduce((sum, b) => sum + b.score, 0) / scoredBridges.length)
47
97
  : 0;
48
- const overallScoreLabel = overallScore >= 80 ? "pass" : overallScore >= 40 ? "partial" : "fail";
98
+ const overallScoreLabel = scoreLabel(overallScore);
99
+ const requestContext = getScanRequestStats();
49
100
  const result = {
50
101
  ok: true,
51
102
  version: getVersion(), url, scannedOrigin: baseUrl, timestamp,
52
103
  durationMs: Math.round(performance.now() - start),
53
104
  overallScore, overallScoreLabel,
54
- incomplete: (getScanRequestStats()?.denied ?? 0) > 0,
55
- bridges: [bridge1, bridge2, bridge3, bridge4, bridge5],
105
+ incomplete: requestContext.denied > 0, requestContext,
106
+ bridges,
56
107
  };
57
- spinner.stop();
58
108
  return result;
59
- }
60
- catch (err) {
61
- // Bridges are built on a never-throwing HTTP client, so this is a
62
- // defensive backstop: surface it as a failure outcome, never a throw.
63
- spinner.fail("Scan failed");
64
- const message = err instanceof Error ? err.message : String(err);
65
- return { ok: false, error: { kind: "scan_failed", message } };
66
- }
67
- });
109
+ });
110
+ }
111
+ catch (err) {
112
+ // Bridges are built on a never-throwing HTTP client, so this is a
113
+ // defensive backstop: surface it as a failure outcome, never a throw.
114
+ if (signal?.aborted)
115
+ return cancelled();
116
+ const message = err instanceof Error ? err.message : String(err);
117
+ return { ok: false, error: { kind: "scan_failed", message } };
118
+ }
68
119
  }
69
- //# sourceMappingURL=scan.js.map
@@ -0,0 +1,6 @@
1
+ import type { Check, BridgeResult } from "./types.js";
2
+ export declare function scoreLabel(score: number, pass?: number, partial?: number): "pass" | "partial" | "fail";
3
+ /** Checks a policy skip leaves out are not eligible; an eligible check with status error is unmeasured. */
4
+ export declare function checkCoverage(checks: readonly Check[]): NonNullable<BridgeResult["measurement"]>;
5
+ /** Include measured, applicable checks only. Each bridge owns its weights and thresholds. */
6
+ export declare function scoreChecks(checks: readonly Check[], weights?: Readonly<Record<string, number>>, pass?: number, partial?: number): Pick<BridgeResult, "score" | "scoreLabel">;
@@ -0,0 +1,27 @@
1
+ export function scoreLabel(score, pass = 80, partial = 40) {
2
+ return score >= pass ? "pass" : score >= partial ? "partial" : "fail";
3
+ }
4
+ /** Checks a policy skip leaves out are not eligible; an eligible check with status error is unmeasured. */
5
+ export function checkCoverage(checks) {
6
+ const eligible = checks.filter(check => check.data?.policy !== "skip");
7
+ return { measured: eligible.filter(check => check.status !== "error").length, eligible: eligible.length };
8
+ }
9
+ /** Include measured, applicable checks only. Each bridge owns its weights and thresholds. */
10
+ export function scoreChecks(checks, weights = {}, pass = 80, partial = 40) {
11
+ let earned = 0;
12
+ let possible = 0;
13
+ for (const check of checks) {
14
+ if (check.status === "error" || check.data?.policy === "skip")
15
+ continue;
16
+ const weight = weights[check.id] ?? 1;
17
+ possible += weight;
18
+ if (check.status === "pass")
19
+ earned += weight;
20
+ if (check.status === "partial")
21
+ earned += weight / 2;
22
+ }
23
+ if (!possible)
24
+ return { score: null, scoreLabel: null };
25
+ const score = Math.round(100 * earned / possible);
26
+ return { score, scoreLabel: scoreLabel(score, pass, partial) };
27
+ }