ax 0.7.4 → 0.7.5

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 (4) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +62 -39
  3. package/dist/main.cjs +13 -13
  4. package/package.json +18 -4
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 era labs
3
+ Copyright (c) 2026 Era AI Labs
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,17 +1,35 @@
1
- # ax — the ora CLI
1
+ <p align="center">
2
+ <a href="https://ora.ai"><img src="https://raw.githubusercontent.com/ora/ax/main/.github/assets/ora-mark.svg" width="72" height="72" alt="ora" /></a>
3
+ </p>
2
4
 
3
- Score any site's agent readiness — and watch real AI agents navigate it. Powered by [ora](https://ora.ai)'s hosted APIs.
5
+ <h1 align="center">ax</h1>
6
+
7
+ <p align="center">Score any site's agent readiness from your terminal or CI — and watch real AI agents navigate it.<br />The open-source CLI for <a href="https://ora.ai">ora</a>.</p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/ax"><img src="https://img.shields.io/npm/v/ax?label=npm&color=14B8A6" alt="npm version" /></a>
11
+ <a href="https://www.npmjs.com/package/ax"><img src="https://img.shields.io/npm/dm/ax?color=14B8A6" alt="npm downloads" /></a>
12
+ <a href="https://github.com/ora/ax/actions/workflows/ci.yml"><img src="https://github.com/ora/ax/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" /></a>
13
+ <a href="https://www.npmjs.com/package/ax#provenance"><img src="https://img.shields.io/badge/npm-provenance-14B8A6" alt="npm provenance" /></a>
14
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-1A1A1A" alt="MIT license" /></a>
15
+ </p>
4
16
 
5
17
  ```
6
18
  npx ax audit https://stripe.com
7
19
  ```
8
20
 
21
+ **No account, no API key.** Everything below works out of the box — the one exception is [`journey`](#for-ora-partners), which drives ora's partner platform.
22
+
23
+ <p align="center">
24
+ <img src="https://raw.githubusercontent.com/ora/ax/main/.github/assets/demo.gif" width="880" alt="ax audit https://stripe.com — live progress, then the layered report and ora's ranked top fixes" />
25
+ </p>
26
+
9
27
  Five commands:
10
28
 
11
29
  - **`audit <url>`** — run ora's hosted agent-readiness audit against a site: live progress, then a layered report of what passed, what's broken, and ora's ranked list of the highest-impact fixes (or `--json` for the raw contract payload). No account or API key needed. Gate CI with `--min-score`.
12
30
  - **`webmcp-audit <url>`** — audit a page's `document.modelContext` tools in a real browser. Works on any http(s) URL, localhost included, so you can check a surface before you publish it. Measures the page the way ora's capture worker does and has ora score it; nothing is stored, published, or ranked.
13
31
  - **`deep-journey <url>`** — run a real AI agent at a site on one of ora's curated tasks through the public journey API: no key, no workspace. A partner API key unlocks free-text tasks (`--task`) and a larger allowance.
14
- - **`journey "<intent>"`** — send a real AI agent (claude-code, codex, …) at a site and watch its navigation live as a boxed node-graph, then get the scored insight, tokens, and cost. Requires an `ORA_API_KEY`.
32
+ - **`journey "<intent>"`** — send a real AI agent (claude-code, codex, …) at a site and watch its navigation live as a boxed node-graph, then get the scored insight, tokens, and cost. Partner-only: needs an `ORA_API_KEY` (see [For ora partners](#for-ora-partners)).
15
33
  - **`skill [name]`** — list, print, or install ora's agent skills, digest-verified from the public registry.
16
34
 
17
35
  ## audit
@@ -229,7 +247,41 @@ ax skill --json # the raw registry index
229
247
 
230
248
  Skills come from ora's public registry (`https://ora.ai/.well-known/agent-skills/`) and every byte is verified against the registry's sha256 digest before it is printed or installed. Skill content is never bundled into this package. `--dir <path>` overrides the install directory, and `--json` prints the registry index as JSON instead of the formatted list.
231
249
 
232
- ## journey
250
+ ## Library use
251
+
252
+ The same contract-typed client the CLI uses is importable:
253
+
254
+ ```ts
255
+ import { audit } from "ax";
256
+
257
+ const { result } = await audit("stripe.com");
258
+ console.log(result.score, result.grade, result.topFixes);
259
+ ```
260
+
261
+ `result` is the raw versioned audit payload (`AuditScanResult` / `AuditScoreResult`, generated from ora's OpenAPI spec). `fetchSkill` / `fetchSkillIndex` expose the digest-verified skill registry.
262
+
263
+ The public journey client is exported too — the same no-key path as `ax deep-journey`:
264
+
265
+ ```ts
266
+ import { deepJourney, fetchJourneyAgents } from "ax";
267
+
268
+ const { agents, defaultId } = await fetchJourneyAgents();
269
+ const agent = agents.find((a) => a.id === defaultId)!;
270
+ const { detail } = await deepJourney("stripe.com", {
271
+ intentId: "pricing",
272
+ harness: agent.harness,
273
+ model: agent.model,
274
+ });
275
+ console.log(detail.verdict, detail.step_count, detail.result?.insight.summary);
276
+ ```
277
+
278
+ `detail` is the contract's `JourneyRunDetail`; `fetchJourneyIntents` lists the curated intents. The same public caps apply — a capped target resolves with the most recent stored run (`cached: true` on the outcome), not an error.
279
+
280
+ ## For ora partners
281
+
282
+ Everything above runs without an account. The commands and flags in this section are for teams working with ora directly: they need an ora-issued API key, and there is no self-serve signup — keys are issued by ora (contact [hello@ora.ai](mailto:hello@ora.ai)). A partner key also lifts the anonymous rate limits on `audit`, `webmcp-audit`, and `deep-journey` via their `--api-key` flags.
283
+
284
+ ### journey
233
285
 
234
286
  ```
235
287
  ax journey "<intent>" [--domain d] [--harness h] [--model m] [--json]
@@ -279,7 +331,7 @@ Note: run-to-run variance is real — agents sometimes answer from search snippe
279
331
 
280
332
  Journey exit codes: `0` run outcome `success` · `1` non-success outcome · `2` any error.
281
333
 
282
- ### Setup
334
+ #### Setup
283
335
 
284
336
  `journey` needs an ora platform API key (scopes `runs:read` + `runs:write`):
285
337
 
@@ -290,36 +342,6 @@ ax journey "Find the pricing page" --domain example.com
290
342
 
291
343
  For local development, copy `.env.example` to `.env` — the CLI reads a `.env` in the working directory on startup (exported variables win over the file).
292
344
 
293
- ## Library use
294
-
295
- The same contract-typed client the CLI uses is importable:
296
-
297
- ```ts
298
- import { audit } from "ax";
299
-
300
- const { result } = await audit("stripe.com");
301
- console.log(result.score, result.grade, result.topFixes);
302
- ```
303
-
304
- `result` is the raw versioned audit payload (`AuditScanResult` / `AuditScoreResult`, generated from ora's OpenAPI spec). `fetchSkill` / `fetchSkillIndex` expose the digest-verified skill registry.
305
-
306
- The public journey client is exported too — the same no-key path as `ax deep-journey`:
307
-
308
- ```ts
309
- import { deepJourney, fetchJourneyAgents } from "ax";
310
-
311
- const { agents, defaultId } = await fetchJourneyAgents();
312
- const agent = agents.find((a) => a.id === defaultId)!;
313
- const { detail } = await deepJourney("stripe.com", {
314
- intentId: "pricing",
315
- harness: agent.harness,
316
- model: agent.model,
317
- });
318
- console.log(detail.verdict, detail.step_count, detail.result?.insight.summary);
319
- ```
320
-
321
- `detail` is the contract's `JourneyRunDetail`; `fetchJourneyIntents` lists the curated intents. The same public caps apply — a capped target resolves with the most recent stored run (`cached: true` on the outcome), not an error.
322
-
323
345
  ## Environment variables
324
346
 
325
347
  All configuration is environment-first: the consumer defines the variables, the CLI only reads them.
@@ -390,13 +412,14 @@ The webmcp mock replays the checked-in real ingest fixture, and takes a failure
390
412
  argument — `shim`, `rate`, `scoring` or `stream` — so every error branch is reachable without the
391
413
  live endpoint.
392
414
 
393
- To exercise the published-package experience locally: `npm pack`, then `npx ./ora-ai-ax-<version>.tgz audit https://example.com`, or `pnpm link --global` and use `ax` directly.
415
+ To exercise the published-package experience locally: `npm pack`, then `npx ./ax-<version>.tgz audit https://example.com`, or `pnpm link --global` and use `ax` directly.
394
416
 
395
417
  ## Releasing
396
418
 
397
- Publishing runs from GitHub Actions only — **Actions → Release → Run workflow**,
398
- pick a `patch`/`minor`/`major` bump. See [RELEASING.md](RELEASING.md) for the
399
- runbook, required setup, and failure recovery.
419
+ Publishing runs from GitHub Actions only. Every push to `main` updates a
420
+ release-please PR; merging it tags, creates the GitHub Release, and publishes
421
+ to npm with provenance. See [RELEASING.md](RELEASING.md) for the runbook,
422
+ required setup, and failure recovery.
400
423
 
401
424
  ## License
402
425
 
package/dist/main.cjs CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";var Jn=Object.create;var dt=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var Hn=Object.getOwnPropertyNames;var Gn=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty;var Kn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Vn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hn(t))!qn.call(e,o)&&o!==n&&dt(e,o,{get:()=>t[o],enumerable:!(r=Fn(t,o))||r.enumerable});return e};var U=(e,t,n)=>(n=e!=null?Jn(Gn(e)):{},Vn(t||!e||!e.__esModule?dt(n,"default",{value:e,enumerable:!0}):n,e));var D=Kn((ys,Me)=>{"use strict";var ge=process||{},vt=ge.argv||[],me=ge.env||{},ur=!(me.NO_COLOR||vt.includes("--no-color"))&&(!!me.FORCE_COLOR||vt.includes("--color")||ge.platform==="win32"||(ge.stdout||{}).isTTY&&me.TERM!=="dumb"||!!me.CI),dr=(e,t,n=e)=>r=>{let o=""+r,i=o.indexOf(t,e.length);return~i?e+pr(o,t,n,i)+t:e+o+t},pr=(e,t,n,r)=>{let o="",i=0;do o+=e.substring(i,r)+n,i=r+t.length,r=e.indexOf(t,i);while(~r);return o+e.substring(i)},St=(e=ur)=>{let t=e?dr:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};Me.exports=St();Me.exports.createColors=St});var Yn=/\d/,Xn=["-","_","/","."];function zn(e=""){if(!Yn.test(e))return e!==e.toLowerCase()}function pt(e,t){let n=t??Xn,r=[];if(!e||typeof e!="string")return r;let o="",i,s;for(let a of e){let c=n.includes(a);if(c===!0){r.push(o),o="",i=void 0;continue}let l=zn(a);if(s===!1){if(i===!1&&l===!0){r.push(o),o=a,i=l;continue}if(i===!0&&l===!1&&o.length>1){let u=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=u+a,i=l;continue}}o+=a,i=l,s=c}return r.push(o),r}function Qn(e){return e?e[0].toUpperCase()+e.slice(1):""}function Zn(e){return e?e[0].toLowerCase()+e.slice(1):""}function er(e,t){return e?(Array.isArray(e)?e:pt(e)).map(n=>Qn(t?.normalize?n.toLowerCase():n)).join(""):""}function ne(e,t){return Zn(er(e||"",t))}function ce(e,t){return e?(Array.isArray(e)?e:pt(e)).map(n=>n.toLowerCase()).join(t??"-"):""}function mt(e){return ce(e||"","_")}var ft=require("util");function re(e){return Array.isArray(e)?e:e===void 0?[]:[e]}function Ce(e,t=""){let n=[];for(let r of e)for(let[o,i]of r.entries())n[o]=Math.max(n[o]||0,i.length);return e.map(r=>r.map((o,i)=>t+o[i===0?"padStart":"padEnd"](n[i])).join(" ")).join(`
3
- `)}function E(e){return typeof e=="function"?e():e}var J=class extends Error{code;constructor(e,t){super(e),this.name="CLIError",this.code=t}};function tr(e=[],t={}){let n=new Set(t.boolean||[]),r=new Set(t.string||[]),o=t.alias||{},i=t.default||{},s=new Map,a=new Map;for(let[m,y]of Object.entries(o)){let $=y;for(let C of $)s.set(m,C),a.has(C)||a.set(C,[]),a.get(C).push(m),s.set(C,m),a.has(m)||a.set(m,[]),a.get(m).push(C)}let c={};function l(m){if(n.has(m))return"boolean";let y=a.get(m)||[];for(let $ of y)if(n.has($))return"boolean";return"string"}function u(m){if(r.has(m))return!0;let y=a.get(m)||[];for(let $ of y)if(r.has($))return!0;return!1}let d=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(i)]);for(let m of d)c[m]||(c[m]={type:l(m),default:i[m]});for(let[m,y]of s.entries())m.length===1&&c[y]&&!c[y].short&&(c[y].short=m);let g=[],p={};for(let m=0;m<e.length;m++){let y=e[m];if(y==="--"){g.push(...e.slice(m));break}if(y.startsWith("--no-")){let $=y.slice(5);p[$]=!0;continue}g.push(y)}let f;try{f=(0,ft.parseArgs)({args:g,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{f={values:{},positionals:g}}let h={_:[]};h._=f.positionals;for(let[m,y]of Object.entries(f.values)){let $=y;l(m)==="boolean"&&typeof y=="string"?$=y!=="false":u(m)&&typeof y=="boolean"&&($=""),h[m]=$}for(let[m]of Object.entries(p)){h[m]=!1;let y=s.get(m);y&&(h[y]=!1);let $=a.get(m);if($)for(let C of $)h[C]=!1}for(let[m,y]of s.entries())h[m]!==void 0&&h[y]===void 0&&(h[y]=h[m]),h[y]!==void 0&&h[m]===void 0&&(h[m]=h[y]),h[m]!==h[y]&&i[y]===h[y]&&(h[y]=h[m]);return h}var nr=(()=>{let e=globalThis.process?.env??{};return e.NO_COLOR==="1"||e.TERM==="dumb"||e.TEST||e.CI})(),pe=(e,t=39)=>n=>nr?n:`\x1B[${e}m${n}\x1B[${t}m`,le=pe(1,22),j=pe(36),de=pe(90),ue=pe(4,24);function rr(e,t){let n={boolean:[],string:[],alias:{},default:{}},r=yt(t);for(let a of r){if(a.type==="positional")continue;a.type==="string"||a.type==="enum"?n.string.push(a.name):a.type==="boolean"&&n.boolean.push(a.name),a.default!==void 0&&(n.default[a.name]=a.default),a.alias&&(n.alias[a.name]=a.alias);let c=ne(a.name),l=ce(a.name);if(c!==a.name||l!==a.name){let u=re(n.alias[a.name]||[]);c!==a.name&&!u.includes(c)&&u.push(c),l!==a.name&&!u.includes(l)&&u.push(l),u.length>0&&(n.alias[a.name]=u)}}let o=tr(e,n),[...i]=o._,s=new Proxy(o,{get(a,c){return a[c]??a[ne(c)]??a[ce(c)]}});for(let[,a]of r.entries())if(a.type==="positional"){let c=i.shift();if(c!==void 0)s[a.name]=c;else{if(a.default===void 0&&a.required!==!1)throw new J(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");s[a.name]=a.default}}else if(a.type==="enum"){let c=s[a.name],l=a.options||[];if(c!==void 0&&l.length>0&&!l.includes(c))throw new J(`Invalid value for argument: ${j(`--${a.name}`)} (${j(c)}). Expected one of: ${l.map(u=>j(u)).join(", ")}.`,"EARG")}else if(a.required&&s[a.name]===void 0)throw new J(`Missing required argument: --${a.name}`,"EARG");return s}function yt(e){let t=[];for(let[n,r]of Object.entries(e||{}))t.push({...r,name:n,alias:re(r.alias)});return t}async function or(e){return Promise.all(e.map(t=>E(t)))}async function Te(e,t){let n=await E(e.args||{}),r=rr(t.rawArgs,n),o={rawArgs:t.rawArgs,args:r,data:t.data,cmd:e},i=await or(e.plugins??[]),s,a;try{for(let u of i)await u.setup?.(o);typeof e.setup=="function"&&await e.setup(o);let l=await E(e.subCommands);if(l&&Object.keys(l).length>0){let u=bt(t.rawArgs,n),d=t.rawArgs[u];if(d){let g=await Ie(l,d);if(!g)throw new J(`Unknown command ${j(d)}`,"E_UNKNOWN_COMMAND");await Te(g,{rawArgs:t.rawArgs.slice(u+1)})}else{let g=await E(e.default);if(g){if(e.run)throw new J("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let p=await Ie(l,g);if(!p)throw new J(`Default sub command ${j(g)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await Te(p,{rawArgs:t.rawArgs})}else if(!e.run)throw new J("No command specified.","E_NO_COMMAND")}}typeof e.run=="function"&&(s=await e.run(o))}catch(l){a=l}let c=[];if(typeof e.cleanup=="function")try{await e.cleanup(o)}catch(l){c.push(l)}for(let l of[...i].reverse())try{await l.cleanup?.(o)}catch(u){c.push(u)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw new Error("Multiple cleanup errors",{cause:c});return{result:s}}async function Pe(e,t,n){let r=await E(e.subCommands);if(r&&Object.keys(r).length>0){let o=bt(t,await E(e.args||{})),i=t[o],s=await Ie(r,i);if(s)return Pe(s,t.slice(o+1),e)}return[e,n]}async function Ie(e,t){if(t in e)return E(e[t]);for(let n of Object.values(e)){let r=await E(n),o=await E(r?.meta);if(o?.alias&&re(o.alias).includes(t))return r}}function bt(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&ir(r,t)&&n++;continue}return n}return-1}function ir(e,t){let n=e.replace(/^-{1,2}/,""),r=ne(n);for(let[o,i]of Object.entries(t))if(!(i.type!=="string"&&i.type!=="enum")&&(r===ne(o)||(Array.isArray(i.alias)?i.alias:i.alias?[i.alias]:[]).includes(n)))return!0;return!1}async function sr(e,t){try{console.log(await cr(e,t)+`
4
- `)}catch(n){console.error(n)}}var ar=/^no[-A-Z]/;async function cr(e,t){let n=await E(e.meta||{}),r=yt(await E(e.args||{})),o=await E(t?.meta||{}),i=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),s=[],a=[],c=[],l=[];for(let p of r)if(p.type==="positional"){let f=p.name.toUpperCase(),h=p.required!==!1&&p.default===void 0;a.push([j(f+Ee(p)),gt(p,h)]),l.push(h?`<${f}>`:`[${f}]`)}else{let f=p.required===!0&&p.default===void 0,h=[...(p.alias||[]).map(m=>`-${m}`),`--${p.name}`].join(", ")+Ee(p);if(s.push([j(h),gt(p,f)]),p.type==="boolean"&&(p.default===!0||p.negativeDescription)&&!ar.test(p.name)){let m=[...(p.alias||[]).map(y=>`--no-${y}`),`--no-${p.name}`].join(", ");s.push([j(m),[p.negativeDescription,f?de("(Required)"):""].filter(Boolean).join(" ")])}f&&l.push(`--${p.name}`+Ee(p))}if(e.subCommands){let p=[],f=await E(e.subCommands);for(let[h,m]of Object.entries(f)){let y=await E((await E(m))?.meta);if(y?.hidden)continue;let $=re(y?.alias),C=[h,...$].join(", ");c.push([j(C),y?.description||""]),p.push(h,...$)}l.push(p.join("|"))}let u=[],d=n.version||o.version;u.push(de(`${n.description} (${i+(d?` v${d}`:"")})`),"");let g=s.length>0||a.length>0;return u.push(`${ue(le("USAGE"))} ${j(`${i}${g?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(u.push(ue(le("ARGUMENTS")),""),u.push(Ce(a," ")),u.push("")),s.length>0&&(u.push(ue(le("OPTIONS")),""),u.push(Ce(s," ")),u.push("")),c.length>0&&(u.push(ue(le("COMMANDS")),""),u.push(Ce(c," ")),u.push("",`Use ${j(`${i} <command> --help`)} for more information about a command.`)),u.filter(p=>typeof p=="string").join(`
3
+ `)}function E(e){return typeof e=="function"?e():e}var J=class extends Error{code;constructor(e,t){super(e),this.name="CLIError",this.code=t}};function tr(e=[],t={}){let n=new Set(t.boolean||[]),r=new Set(t.string||[]),o=t.alias||{},i=t.default||{},s=new Map,a=new Map;for(let[m,y]of Object.entries(o)){let A=y;for(let C of A)s.set(m,C),a.has(C)||a.set(C,[]),a.get(C).push(m),s.set(C,m),a.has(m)||a.set(m,[]),a.get(m).push(C)}let c={};function l(m){if(n.has(m))return"boolean";let y=a.get(m)||[];for(let A of y)if(n.has(A))return"boolean";return"string"}function u(m){if(r.has(m))return!0;let y=a.get(m)||[];for(let A of y)if(r.has(A))return!0;return!1}let d=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(i)]);for(let m of d)c[m]||(c[m]={type:l(m),default:i[m]});for(let[m,y]of s.entries())m.length===1&&c[y]&&!c[y].short&&(c[y].short=m);let g=[],p={};for(let m=0;m<e.length;m++){let y=e[m];if(y==="--"){g.push(...e.slice(m));break}if(y.startsWith("--no-")){let A=y.slice(5);p[A]=!0;continue}g.push(y)}let f;try{f=(0,ft.parseArgs)({args:g,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{f={values:{},positionals:g}}let h={_:[]};h._=f.positionals;for(let[m,y]of Object.entries(f.values)){let A=y;l(m)==="boolean"&&typeof y=="string"?A=y!=="false":u(m)&&typeof y=="boolean"&&(A=""),h[m]=A}for(let[m]of Object.entries(p)){h[m]=!1;let y=s.get(m);y&&(h[y]=!1);let A=a.get(m);if(A)for(let C of A)h[C]=!1}for(let[m,y]of s.entries())h[m]!==void 0&&h[y]===void 0&&(h[y]=h[m]),h[y]!==void 0&&h[m]===void 0&&(h[m]=h[y]),h[m]!==h[y]&&i[y]===h[y]&&(h[y]=h[m]);return h}var nr=(()=>{let e=globalThis.process?.env??{};return e.NO_COLOR==="1"||e.TERM==="dumb"||e.TEST||e.CI})(),pe=(e,t=39)=>n=>nr?n:`\x1B[${e}m${n}\x1B[${t}m`,le=pe(1,22),j=pe(36),de=pe(90),ue=pe(4,24);function rr(e,t){let n={boolean:[],string:[],alias:{},default:{}},r=yt(t);for(let a of r){if(a.type==="positional")continue;a.type==="string"||a.type==="enum"?n.string.push(a.name):a.type==="boolean"&&n.boolean.push(a.name),a.default!==void 0&&(n.default[a.name]=a.default),a.alias&&(n.alias[a.name]=a.alias);let c=ne(a.name),l=ce(a.name);if(c!==a.name||l!==a.name){let u=re(n.alias[a.name]||[]);c!==a.name&&!u.includes(c)&&u.push(c),l!==a.name&&!u.includes(l)&&u.push(l),u.length>0&&(n.alias[a.name]=u)}}let o=tr(e,n),[...i]=o._,s=new Proxy(o,{get(a,c){return a[c]??a[ne(c)]??a[ce(c)]}});for(let[,a]of r.entries())if(a.type==="positional"){let c=i.shift();if(c!==void 0)s[a.name]=c;else{if(a.default===void 0&&a.required!==!1)throw new J(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");s[a.name]=a.default}}else if(a.type==="enum"){let c=s[a.name],l=a.options||[];if(c!==void 0&&l.length>0&&!l.includes(c))throw new J(`Invalid value for argument: ${j(`--${a.name}`)} (${j(c)}). Expected one of: ${l.map(u=>j(u)).join(", ")}.`,"EARG")}else if(a.required&&s[a.name]===void 0)throw new J(`Missing required argument: --${a.name}`,"EARG");return s}function yt(e){let t=[];for(let[n,r]of Object.entries(e||{}))t.push({...r,name:n,alias:re(r.alias)});return t}async function or(e){return Promise.all(e.map(t=>E(t)))}async function Te(e,t){let n=await E(e.args||{}),r=rr(t.rawArgs,n),o={rawArgs:t.rawArgs,args:r,data:t.data,cmd:e},i=await or(e.plugins??[]),s,a;try{for(let u of i)await u.setup?.(o);typeof e.setup=="function"&&await e.setup(o);let l=await E(e.subCommands);if(l&&Object.keys(l).length>0){let u=bt(t.rawArgs,n),d=t.rawArgs[u];if(d){let g=await Ie(l,d);if(!g)throw new J(`Unknown command ${j(d)}`,"E_UNKNOWN_COMMAND");await Te(g,{rawArgs:t.rawArgs.slice(u+1)})}else{let g=await E(e.default);if(g){if(e.run)throw new J("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let p=await Ie(l,g);if(!p)throw new J(`Default sub command ${j(g)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await Te(p,{rawArgs:t.rawArgs})}else if(!e.run)throw new J("No command specified.","E_NO_COMMAND")}}typeof e.run=="function"&&(s=await e.run(o))}catch(l){a=l}let c=[];if(typeof e.cleanup=="function")try{await e.cleanup(o)}catch(l){c.push(l)}for(let l of[...i].reverse())try{await l.cleanup?.(o)}catch(u){c.push(u)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw new Error("Multiple cleanup errors",{cause:c});return{result:s}}async function Pe(e,t,n){let r=await E(e.subCommands);if(r&&Object.keys(r).length>0){let o=bt(t,await E(e.args||{})),i=t[o],s=await Ie(r,i);if(s)return Pe(s,t.slice(o+1),e)}return[e,n]}async function Ie(e,t){if(t in e)return E(e[t]);for(let n of Object.values(e)){let r=await E(n),o=await E(r?.meta);if(o?.alias&&re(o.alias).includes(t))return r}}function bt(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&ir(r,t)&&n++;continue}return n}return-1}function ir(e,t){let n=e.replace(/^-{1,2}/,""),r=ne(n);for(let[o,i]of Object.entries(t))if(!(i.type!=="string"&&i.type!=="enum")&&(r===ne(o)||(Array.isArray(i.alias)?i.alias:i.alias?[i.alias]:[]).includes(n)))return!0;return!1}async function sr(e,t){try{console.log(await cr(e,t)+`
4
+ `)}catch(n){console.error(n)}}var ar=/^no[-A-Z]/;async function cr(e,t){let n=await E(e.meta||{}),r=yt(await E(e.args||{})),o=await E(t?.meta||{}),i=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),s=[],a=[],c=[],l=[];for(let p of r)if(p.type==="positional"){let f=p.name.toUpperCase(),h=p.required!==!1&&p.default===void 0;a.push([j(f+Ee(p)),gt(p,h)]),l.push(h?`<${f}>`:`[${f}]`)}else{let f=p.required===!0&&p.default===void 0,h=[...(p.alias||[]).map(m=>`-${m}`),`--${p.name}`].join(", ")+Ee(p);if(s.push([j(h),gt(p,f)]),p.type==="boolean"&&(p.default===!0||p.negativeDescription)&&!ar.test(p.name)){let m=[...(p.alias||[]).map(y=>`--no-${y}`),`--no-${p.name}`].join(", ");s.push([j(m),[p.negativeDescription,f?de("(Required)"):""].filter(Boolean).join(" ")])}f&&l.push(`--${p.name}`+Ee(p))}if(e.subCommands){let p=[],f=await E(e.subCommands);for(let[h,m]of Object.entries(f)){let y=await E((await E(m))?.meta);if(y?.hidden)continue;let A=re(y?.alias),C=[h,...A].join(", ");c.push([j(C),y?.description||""]),p.push(h,...A)}l.push(p.join("|"))}let u=[],d=n.version||o.version;u.push(de(`${n.description} (${i+(d?` v${d}`:"")})`),"");let g=s.length>0||a.length>0;return u.push(`${ue(le("USAGE"))} ${j(`${i}${g?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(u.push(ue(le("ARGUMENTS")),""),u.push(Ce(a," ")),u.push("")),s.length>0&&(u.push(ue(le("OPTIONS")),""),u.push(Ce(s," ")),u.push("")),c.length>0&&(u.push(ue(le("COMMANDS")),""),u.push(Ce(c," ")),u.push("",`Use ${j(`${i} <command> --help`)} for more information about a command.`)),u.filter(p=>typeof p=="string").join(`
5
5
  `)}function Ee(e){let t=e.valueHint?`=<${e.valueHint}>`:"",n=t||`=<${mt(e.name)}>`;return!e.type||e.type==="positional"||e.type==="boolean"?t:e.type==="enum"&&e.options?.length?`=<${e.options.join("|")}>`:n}function gt(e,t){let n=t?de("(Required)"):"",r=e.default===void 0?"":de(`(Default: ${e.default})`);return[e.description,n,r].filter(Boolean).join(" ")}async function wt(e,t={}){let n=t.rawArgs||process.argv.slice(2),r=t.showUsage||sr;try{let o=await lr(e);if(o.help.length>0&&n.some(i=>o.help.includes(i)))await r(...await Pe(e,n)),process.exit(0);else if(n.length===1&&o.version.includes(n[0])){let i=typeof e.meta=="function"?await e.meta():await e.meta;if(!i?.version)throw new J("No version specified","E_NO_VERSION");console.log(i.version)}else await Te(e,{rawArgs:n})}catch(o){o instanceof J?(await r(...await Pe(e,n)),console.error(o.message)):console.error(o,`
6
- `),process.exit(1)}}async function lr(e){let t=await E(e.args||{}),n=new Set,r=new Set;for(let[o,i]of Object.entries(t)){n.add(o);for(let s of re(i.alias))r.add(s)}return{help:ht("help","h",n,r),version:ht("version","v",n,r)}}function ht(e,t,n,r){return n.has(e)||r.has(e)?[]:n.has(t)||r.has(t)?[`--${e}`]:[`--${e}`,`-${t}`]}var Re=U(D(),1);var Oe={name:"ax",version:"0.7.4",description:"Score any site's agent readiness and watch real AI agents navigate it \u2014 powered by ora",type:"module",packageManager:"pnpm@10.34.5",bin:{ax:"./dist/main.cjs"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"}},main:"./dist/index.cjs",types:"./dist/index.d.ts",files:["dist",".env.example"],engines:{node:">=22.4.0"},scripts:{build:"rm -rf dist && tsup && tsc -p tsconfig.lib.json","contract:gen":"node scripts/contract-gen.mjs",smoke:"node scripts/smoke.mjs","smoke:webmcp":"node scripts/smoke-webmcp.mjs","verify:pack":"node scripts/verify-pack.mjs",test:"vitest","test:ci":"vitest run --coverage","test:capture":"vitest run src/webmcp/capture.live.test.ts",lint:"biome check .","lint:fix":"biome check --write .",typecheck:"tsc --noEmit",prepublishOnly:"npm run build"},devDependencies:{"@biomejs/biome":"^2.5.7","@commitlint/cli":"^21.2.2","@commitlint/config-conventional":"^21.2.2","@types/node":"^26.2.0","@vitest/coverage-v8":"^3",citty:"^0.2.2","openapi-typescript":"^6.7.6",picocolors:"^1",tsup:"^8",typescript:"^7.0.2",vitest:"^3"},publishConfig:{access:"public"},pnpm:{onlyBuiltDependencies:["@biomejs/biome","esbuild"]},license:"MIT",homepage:"https://ora.ai",repository:{type:"git",url:"git+https://github.com/ora/ax.git"},keywords:["ai","agents","agent-readiness","agent-experience","llms.txt","ora","cli","scan"]};var Ne="1.24.0";function kt(e){let[t=0,n=0]=e.split(".").map(r=>Number.parseInt(r,10));return[t,n]}function gr(e){if(!e||!/^\d+\.\d+\.\d+$/.test(e))return!1;let[t,n]=kt(e),[r,o]=kt(Ne);return t>r||t===r&&n>o}var xt=!1;function oe(e){xt||!gr(e)||(xt=!0,process.stderr.write(`ora reports contract ${e}; this CLI was built against ${Ne}. Newer fields may be missing from the output - upgrade with: npm i -g ax@latest
7
- `))}function F(e){let t=new AbortController,n=!1,r,o=()=>{clearTimeout(r),r=setTimeout(()=>{n=!0,t.abort()},e)};return o(),{signal:t.signal,poke:o,disarm:()=>clearTimeout(r),tripped:()=>n}}async function H(e){try{let t=await e.json();return t.message||t.error||`HTTP ${e.status}`}catch{return`HTTP ${e.status}`}}var K=e=>new Promise(t=>setTimeout(t,e));var hr="https://ora.ai",fr=6e4,yr=2e3,br=45,je=14,O=class extends Error{};function $t(e){return e?{authorization:`Bearer ${e}`}:{}}async function At(e,t={}){let n=(t.baseUrl??process.env.ORA_API_URL??hr).replace(/\/+$/,"");t={...t,apiKey:t.apiKey||process.env.ORA_SCAN_API_KEY||void 0},t.progress?.(`Auditing ${e} with ora`);let r=await vr(n,e,t);oe(r.result.contractVersion);let o=r.result;return _t(o)&&(o=await xr(n,o,t)),{result:o,verdict:r.verdict}}function wr(e,t,n){let r=new URLSearchParams({domain:t,format:"audit"});return n.force&&r.set("force","1"),n.ephemeral&&r.set("ephemeral","1"),n.maxAgeSeconds!==void 0&&r.set("maxAgeSeconds",String(n.maxAgeSeconds)),`${e}/api/scan/stream?${r}`}async function vr(e,t,n){let r=n.idleMs??fr,o=F(r),i=()=>new O(`ora audit timed out \u2014 no progress for ${Math.round(r/1e3)}s`),s;try{s=await fetch(wr(e,t,n),{headers:{accept:"text/event-stream",...$t(n.apiKey)},signal:o.signal})}catch(g){if(o.disarm(),o.tripped())throw i();let p=g instanceof Error?g.message:String(g);throw new O(`ora audit request failed: ${p}`)}if(s.status===429){o.disarm();let g=s.headers.get("retry-after");throw new O(`ora rate limit exceeded${g?` \u2014 retry after ${g}s`:""} (burst: 10 scans/min/IP; daily: 30 scans + 6 force per 24h). An ora-issued scan API key lifts these limits: set ORA_SCAN_API_KEY or pass --api-key.`)}if(!s.ok||!s.body)throw o.disarm(),new O(`ora audit failed: ${await H(s)}`);let a=kr(),c=new TextDecoder,l="",u,d;try{e:for await(let g of s.body){o.poke(),l=`${l}${c.decode(g,{stream:!0})}`.replace(/\r\n?/g,`
6
+ `),process.exit(1)}}async function lr(e){let t=await E(e.args||{}),n=new Set,r=new Set;for(let[o,i]of Object.entries(t)){n.add(o);for(let s of re(i.alias))r.add(s)}return{help:ht("help","h",n,r),version:ht("version","v",n,r)}}function ht(e,t,n,r){return n.has(e)||r.has(e)?[]:n.has(t)||r.has(t)?[`--${e}`]:[`--${e}`,`-${t}`]}var Re=U(D(),1);var Oe={name:"ax",version:"0.7.5",description:"Score any site's agent readiness and watch real AI agents navigate it \u2014 powered by ora",type:"module",packageManager:"pnpm@10.34.5",bin:{ax:"./dist/main.cjs"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"}},main:"./dist/index.cjs",types:"./dist/index.d.ts",files:["dist",".env.example"],engines:{node:">=22.4.0"},scripts:{build:"rm -rf dist && tsup && tsc -p tsconfig.lib.json","contract:gen":"node scripts/contract-gen.mjs",smoke:"node scripts/smoke.mjs","smoke:webmcp":"node scripts/smoke-webmcp.mjs","verify:pack":"node scripts/verify-pack.mjs",test:"vitest","test:ci":"vitest run --coverage","test:capture":"vitest run src/webmcp/capture.live.test.ts",lint:"biome check .","lint:fix":"biome check --write .",typecheck:"tsc --noEmit",prepublishOnly:"npm run build"},devDependencies:{"@biomejs/biome":"^2.5.7","@commitlint/cli":"^21.2.2","@commitlint/config-conventional":"^21.2.2","@types/node":"^26.2.0","@vitest/coverage-v8":"^3",citty:"^0.2.2","openapi-typescript":"^6.7.6",picocolors:"^1",tsup:"^8",typescript:"^7.0.2",vitest:"^3"},publishConfig:{access:"public"},pnpm:{onlyBuiltDependencies:["@biomejs/biome","esbuild"],overrides:{"undici@<6.28.0":"^6.28.0"}},license:"MIT",author:{name:"Era AI Labs",url:"https://ora.ai"},homepage:"https://ora.ai/docs#cli",bugs:"https://github.com/ora/ax/issues",repository:{type:"git",url:"git+https://github.com/ora/ax.git"},keywords:["ai","agents","agent-readiness","agent-experience","llms.txt","ora","cli","scan"]};var Ne="1.24.0";function kt(e){let[t=0,n=0]=e.split(".").map(r=>Number.parseInt(r,10));return[t,n]}function gr(e){if(!e||!/^\d+\.\d+\.\d+$/.test(e))return!1;let[t,n]=kt(e),[r,o]=kt(Ne);return t>r||t===r&&n>o}var xt=!1;function oe(e){xt||!gr(e)||(xt=!0,process.stderr.write(`ora reports contract ${e}; this CLI was built against ${Ne}. Newer fields may be missing from the output - upgrade with: npm i -g ax@latest
7
+ `))}function F(e){let t=new AbortController,n=!1,r,o=()=>{clearTimeout(r),r=setTimeout(()=>{n=!0,t.abort()},e)};return o(),{signal:t.signal,poke:o,disarm:()=>clearTimeout(r),tripped:()=>n}}async function H(e){try{let t=await e.json();return t.message||t.error||`HTTP ${e.status}`}catch{return`HTTP ${e.status}`}}var K=e=>new Promise(t=>setTimeout(t,e));var hr="https://ora.ai",fr=6e4,yr=2e3,br=45,je=14,O=class extends Error{};function At(e){return e?{authorization:`Bearer ${e}`}:{}}async function $t(e,t={}){let n=(t.baseUrl??process.env.ORA_API_URL??hr).replace(/\/+$/,"");t={...t,apiKey:t.apiKey||process.env.ORA_SCAN_API_KEY||void 0},t.progress?.(`Auditing ${e} with ora`);let r=await vr(n,e,t);oe(r.result.contractVersion);let o=r.result;return _t(o)&&(o=await xr(n,o,t)),{result:o,verdict:r.verdict}}function wr(e,t,n){let r=new URLSearchParams({domain:t,format:"audit"});return n.force&&r.set("force","1"),n.ephemeral&&r.set("ephemeral","1"),n.maxAgeSeconds!==void 0&&r.set("maxAgeSeconds",String(n.maxAgeSeconds)),`${e}/api/scan/stream?${r}`}async function vr(e,t,n){let r=n.idleMs??fr,o=F(r),i=()=>new O(`ora audit timed out \u2014 no progress for ${Math.round(r/1e3)}s`),s;try{s=await fetch(wr(e,t,n),{headers:{accept:"text/event-stream",...At(n.apiKey)},signal:o.signal})}catch(g){if(o.disarm(),o.tripped())throw i();let p=g instanceof Error?g.message:String(g);throw new O(`ora audit request failed: ${p}`)}if(s.status===429){o.disarm();let g=s.headers.get("retry-after");throw new O(`ora rate limit exceeded${g?` \u2014 retry after ${g}s`:""} (burst: 10 scans/min/IP; daily: 30 scans + 6 force per 24h). An ora-issued scan API key lifts these limits: set ORA_SCAN_API_KEY or pass --api-key.`)}if(!s.ok||!s.body)throw o.disarm(),new O(`ora audit failed: ${await H(s)}`);let a=kr(),c=new TextDecoder,l="",u,d;try{e:for await(let g of s.body){o.poke(),l=`${l}${c.decode(g,{stream:!0})}`.replace(/\r\n?/g,`
8
8
  `);let p=l.indexOf(`
9
9
 
10
10
  `);for(;p!==-1;){let f=Sr(l.slice(0,p));if(l=l.slice(p+2),p=l.indexOf(`
11
11
 
12
12
  `),!f)continue;let h;try{h=JSON.parse(f)}catch{continue}let m=a(h);if(m&&n.progress?.(m),h.type==="error")throw new O(`ora audit failed: ${typeof h.message=="string"?h.message:"scan error"}`);if(h.type==="scan_complete"&&h.result?u=h.result:h.type==="summary_ready"&&typeof h.agenticSummary=="string"&&(d=h.agenticSummary),u&&d)break e}}}catch(g){if(o.tripped())throw i();if(g instanceof O)throw g;let p=g instanceof Error?g.message:String(g);throw new O(`ora audit stream error: ${p}`)}finally{o.disarm(),s.body.cancel().catch(()=>{})}if(!u)throw new O("ora audit stream ended before completing");return{result:u,verdict:d}}function Sr(e){let t=[];for(let n of e.split(`
13
13
  `))n.startsWith("data:")&&t.push(n.slice(5).replace(/^ /,""));return t.join(`
14
- `)}function kr(){let e=0,t=0,n="";return r=>{switch(r.type){case"kind_detecting":return"Detecting URL kind\u2026";case"kind_detected":return typeof r.kind=="string"?`Detected ${r.kind}, scanning\u2026`:void 0;case"scan_init":Array.isArray(r.checkRoster)&&(e=r.checkRoster.length);return;case"discovery_phase":return typeof r.label=="string"?r.label:void 0;case"check_complete":{if(t+=1,typeof r.checkName=="string"&&(n=r.checkName),e<=0)return`Running checks\u2026 (${t})`;let o=Math.min(t,e),i=Math.min(je,Math.max(0,Math.round(o/e*je)));return`${`${"\u2588".repeat(i)}${"\u2591".repeat(je-i)}`} ${o}/${e}${n?` \xB7 ${n}`:""}`}case"scan_complete":return"Finishing up\u2026";default:return}}}function _t(e){return e.analysisStatus==="complete"||e.analysisStatus==="stuck"?!1:e.analysisStatus==="partial"?!0:(e.pendingChecks?.length??0)>0}async function xr(e,t,n){let r=`${e}/api/score/${encodeURIComponent(t.domain)}?format=audit`,o=n.pollEveryMs??yr,i=n.pollLimit??br,s=t;for(let a=0;a<i&&_t(s);a++){let c=s.pendingChecks?.length??0;n.progress?.(c?`Analyzing\u2026 ${c} check${c===1?"":"s"} pending`:"Analyzing\u2026"),await K(o);try{let l=await fetch(r,{headers:{accept:"application/json",...$t(n.apiKey)},signal:AbortSignal.timeout(15e3)});l.ok&&(s=await l.json())}catch{}}return s}function $r(e,t){let n=t.filter(r=>!r.skipped);return{name:e,checks:t,passed:n.filter(r=>r.passed).length,total:n.length,skipped:t.length-n.length}}function Ar(e){let t=e.status==="pass",n=e.status==="na"||e.status==="pending",r={id:e.id,name:e.name,passed:t,status:e.status};return n&&(r.skipped=!0),n&&e.naReason?r.detail=e.naReason:e.details&&(r.detail=e.details),typeof e.estScoreGain=="number"&&(r.estScoreGain=e.estScoreGain),e.specUrl&&(r.specUrl=e.specUrl),!t&&!n&&e.recommendation&&(r.hint=e.recommendation),r}function Rt(e,t){let{result:n}=e,r=(n.layers??[]).map(s=>$r(s.name,(s.checks??[]).map(Ar))),o={target:n.domain||t,score:n.score,grade:n.grade,summary:e.verdict,sections:r,topFixes:n.topFixes??[],reportUrl:n.url,analysisStatus:n.analysisStatus},i=n;return i.servedFromCache&&typeof i.resultAgeSeconds=="number"&&(o.cacheAgeSeconds=i.resultAgeSeconds),n.mcpAuthRequired&&(o.mcpAuthRequired=!0),o}var v=U(D(),1),_r=80,Rr=120,he=10;function Cr(){return Math.min(Rr,Math.max(_r,process.stdout.columns??100))}function We(e,t){return e.length<t?e+" ".repeat(t-e.length):e}function Et(e,t){if(t<=0||e.length<=t)return[e];let n=[],r="";for(let o of e.split(/\s+/))for(r=r?`${r} ${o}`:o;r.length>t;){let i=r.lastIndexOf(" ");i>0&&r.length-i-1<=t?(n.push(r.slice(0,i)),r=r.slice(i+1)):(n.push(r.slice(0,t)),r=r.slice(t))}return r&&n.push(r),n.length?n:[""]}function Le(e,t){let n=(s,a,c)=>v.default.dim(s+e.map(l=>"\u2500".repeat(l.width+2)).join(a)+c),r=v.default.dim("\u2502"),o=(s,a)=>{let c=s.map((d,g)=>Et(typeof d=="string"?d:d[0],e[g].width)),l=Math.max(1,...c.map(d=>d.length)),u=[];for(let d=0;d<l;d++){let g=c.map((p,f)=>{let h=We(p[d]??"",e[f].width),m=a??(typeof s[f]=="string"?e[f].paint:s[f][1]);return` ${m?m(h):h} `});u.push(r+g.join(r)+r)}return u},i=[n("\u250C","\u252C","\u2510")];return i.push(...o(e.map(s=>s.title),v.default.bold)),i.push(n("\u251C","\u253C","\u2524")),t.forEach((s,a)=>{i.push(...o(s)),a<t.length-1&&i.push(n("\u251C","\u253C","\u2524"))}),i.push(n("\u2514","\u2534","\u2518")),i}function Er(e,t){let r=Math.max(46,e-4-13),o=14,i=Math.min(26,Math.max(5,...t.map(l=>l.length))),s=r-1-i;s<o*2&&(i=Math.max(12,i-(o*2-s)),s=r-1-i);let a=Math.max(o,Math.ceil(s/2)),c=Math.max(o,s-a);return[{title:"",width:1},{title:"Check",width:i,paint:v.default.bold},{title:"What's wrong",width:a},{title:"How to fix",width:c,paint:v.default.cyan}]}function Ct(e,t,n,r){let i=Math.max(40,e-4-7),s=Math.min(30,Math.max(n[0].length,...t.map(a=>a.length)));return[{title:n[0],width:s,paint:r},{title:n[1],width:Math.max(20,i-s),paint:r}]}function Tr(e,t){if(t<=0)return v.default.dim("\u2500".repeat(he));let n=Math.min(he,Math.max(0,Math.round(e/t*he)));return v.default.green("\u2588".repeat(n))+v.default.dim("\u2591".repeat(he-n))}function Pr(e,t,n,r){let o=[""],i=e.total>0?`${e.passed}/${e.total} passed`:"no applicable checks",s=e.skipped>0?` \xB7 ${e.skipped} skipped`:"";o.push(` ${v.default.bold(We(e.name,n))} ${Tr(e.passed,e.total)} ${v.default.dim(i+s)}`);let a=e.checks.filter(c=>!c.passed&&!c.skipped);if(a.length){o.push(` ${v.default.red("\u2717")} ${v.default.bold(`Issues (${a.length})`)}`);let c=Le(Er(t,a.map(u=>u.name)),a.map(u=>[u.status==="warning"?["\u26A0",v.default.yellow]:["\u2717",v.default.red],u.name,[u.detail??"",d=>d],u.hint??""]));o.push(...c.map(u=>` ${u}`));let l=a.filter(u=>u.specUrl);for(let u of l)o.push(v.default.dim(` \u21B3 ${u.id} spec: ${u.specUrl}`))}if(r.showPassing){let c=e.checks.filter(l=>l.passed&&!l.skipped);if(c.length){o.push(` ${v.default.green("\u2713")} ${v.default.bold(`Passed (${c.length})`)}`);let l=Le(Ct(t,c.map(u=>u.name),["Check","Details"]),c.map(u=>[u.name,u.detail??""]));o.push(...l.map(u=>` ${u}`))}}if(r.showSkipped){let c=e.checks.filter(l=>l.skipped);if(c.length){o.push(` ${v.default.dim(`\u25CB Skipped (${c.length})`)}`);let l=Le(Ct(t,c.map(u=>u.name),["Check","Reason"],v.default.dim),c.map(u=>[u.name,u.detail??""]));o.push(...l.map(u=>` ${u}`))}}return o}function Ir(e){if(!e.topFixes.length)return[];let t=["",` ${v.default.bold("Top fixes")} ${v.default.dim("(ranked by ora)")}`],n=e.topFixes.reduce((r,o)=>Math.max(r,o.id.length),0);return e.topFixes.forEach((r,o)=>{let i=typeof r.estScoreGain=="number"?v.default.green(`\u2248 +${r.estScoreGain} pts`):v.default.dim("\u2014"),s=r.bonus?v.default.dim(" (bonus)"):"";t.push(` ${o+1}. ${v.default.bold(We(r.id,n))} ${i}${s}`)}),t}function Mr(e){return e<90?`${e}s`:e<5400?`${Math.round(e/60)} min`:`${Math.round(e/3600)}h`}function Tt(e,t={}){let n=Cr(),r=e.sections.reduce((l,u)=>Math.max(l,u.name.length),0),o=[""],i=e.score>=70?v.default.green:e.score>=50?v.default.yellow:v.default.red;if(o.push(` ${v.default.bold(e.target)} ${i(v.default.bold(`${e.score}/100 ${e.grade}`))}`),t.tunnel&&o.push(v.default.dim(" tunnel audit \u2014 disposable result, excluded from rankings; off-site checks (registry listings, brand search) usually fail for a throwaway hostname")),e.mcpAuthRequired&&o.push(v.default.yellow(" \u26A0 MCP handshake requires credentials \u2014 target is unscored (0/F means could not evaluate, not failed everything)")),e.summary)for(let l of Et(e.summary,n-4))o.push(` ${v.default.dim(l)}`);for(let l of e.sections)o.push(...Pr(l,n,r,t));o.push(...Ir(e));let s=e.sections.reduce((l,u)=>l+u.passed,0),a=e.sections.reduce((l,u)=>l+u.skipped,0),c=[];if(!t.showPassing&&s>0&&c.push(` Run with --show-passing to list all ${s} passing checks`),!t.showSkipped&&a>0&&c.push(` ${a} check${a===1?"":"s"} skipped \u2014 run with --show-skipped to see them`),e.analysisStatus==="partial"?c.push(" Analysis still finishing \u2014 re-run shortly for the final score"):e.analysisStatus==="stuck"&&c.push(" Scan did not fully resolve \u2014 re-run with --force to complete it"),typeof e.cacheAgeSeconds=="number"&&c.push(` cached result (${Mr(e.cacheAgeSeconds)} old) \xB7 pass --force for a fresh scan`),e.reportUrl&&c.push(` Full report: ${e.reportUrl}`),c.length){o.push("");for(let l of c)o.push(v.default.dim(l))}return o.push(""),o}var Pt=require("child_process"),Q=class extends Error{},Or=3e4,Nr=9e4,jr=1e4;function De(e){try{let n=new URL(e.includes("://")?e:`http://${e}`).hostname;return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="[::1]"||n.endsWith(".local")||n.endsWith(".localhost")}catch{return!1}}function Lr(e){for(let t of e.matchAll(/https:\/\/[^\s"'|]+/g))try{let n=new URL(t[0]);if(n.pathname==="/"&&!n.search&&!De(n.hostname))return n.origin}catch{}}async function It(e,t=Or){let n=await Dr(e,t);try{await Wr(n.url,Nr)}catch(r){throw n.close(),r}return n}async function Wr(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(e,{redirect:"manual",signal:AbortSignal.timeout(jr)})).status<500)return}catch{}await new Promise(r=>setTimeout(r,5e3))}throw new Q([`tunnel opened but never became routable within ${Math.round(t/1e3)}s.`,"Some networks and DNS filters block tunnel vendors' domains entirely -","if this repeats, try another network, DNS resolver, or tunnel tool."].join(`
14
+ `)}function kr(){let e=0,t=0,n="";return r=>{switch(r.type){case"kind_detecting":return"Detecting URL kind\u2026";case"kind_detected":return typeof r.kind=="string"?`Detected ${r.kind}, scanning\u2026`:void 0;case"scan_init":Array.isArray(r.checkRoster)&&(e=r.checkRoster.length);return;case"discovery_phase":return typeof r.label=="string"?r.label:void 0;case"check_complete":{if(t+=1,typeof r.checkName=="string"&&(n=r.checkName),e<=0)return`Running checks\u2026 (${t})`;let o=Math.min(t,e),i=Math.min(je,Math.max(0,Math.round(o/e*je)));return`${`${"\u2588".repeat(i)}${"\u2591".repeat(je-i)}`} ${o}/${e}${n?` \xB7 ${n}`:""}`}case"scan_complete":return"Finishing up\u2026";default:return}}}function _t(e){return e.analysisStatus==="complete"||e.analysisStatus==="stuck"?!1:e.analysisStatus==="partial"?!0:(e.pendingChecks?.length??0)>0}async function xr(e,t,n){let r=`${e}/api/score/${encodeURIComponent(t.domain)}?format=audit`,o=n.pollEveryMs??yr,i=n.pollLimit??br,s=t;for(let a=0;a<i&&_t(s);a++){let c=s.pendingChecks?.length??0;n.progress?.(c?`Analyzing\u2026 ${c} check${c===1?"":"s"} pending`:"Analyzing\u2026"),await K(o);try{let l=await fetch(r,{headers:{accept:"application/json",...At(n.apiKey)},signal:AbortSignal.timeout(15e3)});l.ok&&(s=await l.json())}catch{}}return s}function Ar(e,t){let n=t.filter(r=>!r.skipped);return{name:e,checks:t,passed:n.filter(r=>r.passed).length,total:n.length,skipped:t.length-n.length}}function $r(e){let t=e.status==="pass",n=e.status==="na"||e.status==="pending",r={id:e.id,name:e.name,passed:t,status:e.status};return n&&(r.skipped=!0),n&&e.naReason?r.detail=e.naReason:e.details&&(r.detail=e.details),typeof e.estScoreGain=="number"&&(r.estScoreGain=e.estScoreGain),e.specUrl&&(r.specUrl=e.specUrl),!t&&!n&&e.recommendation&&(r.hint=e.recommendation),r}function Rt(e,t){let{result:n}=e,r=(n.layers??[]).map(s=>Ar(s.name,(s.checks??[]).map($r))),o={target:n.domain||t,score:n.score,grade:n.grade,summary:e.verdict,sections:r,topFixes:n.topFixes??[],reportUrl:n.url,analysisStatus:n.analysisStatus},i=n;return i.servedFromCache&&typeof i.resultAgeSeconds=="number"&&(o.cacheAgeSeconds=i.resultAgeSeconds),n.mcpAuthRequired&&(o.mcpAuthRequired=!0),o}var v=U(D(),1),_r=80,Rr=120,he=10;function Cr(){return Math.min(Rr,Math.max(_r,process.stdout.columns??100))}function We(e,t){return e.length<t?e+" ".repeat(t-e.length):e}function Et(e,t){if(t<=0||e.length<=t)return[e];let n=[],r="";for(let o of e.split(/\s+/))for(r=r?`${r} ${o}`:o;r.length>t;){let i=r.lastIndexOf(" ");i>0&&r.length-i-1<=t?(n.push(r.slice(0,i)),r=r.slice(i+1)):(n.push(r.slice(0,t)),r=r.slice(t))}return r&&n.push(r),n.length?n:[""]}function Le(e,t){let n=(s,a,c)=>v.default.dim(s+e.map(l=>"\u2500".repeat(l.width+2)).join(a)+c),r=v.default.dim("\u2502"),o=(s,a)=>{let c=s.map((d,g)=>Et(typeof d=="string"?d:d[0],e[g].width)),l=Math.max(1,...c.map(d=>d.length)),u=[];for(let d=0;d<l;d++){let g=c.map((p,f)=>{let h=We(p[d]??"",e[f].width),m=a??(typeof s[f]=="string"?e[f].paint:s[f][1]);return` ${m?m(h):h} `});u.push(r+g.join(r)+r)}return u},i=[n("\u250C","\u252C","\u2510")];return i.push(...o(e.map(s=>s.title),v.default.bold)),i.push(n("\u251C","\u253C","\u2524")),t.forEach((s,a)=>{i.push(...o(s)),a<t.length-1&&i.push(n("\u251C","\u253C","\u2524"))}),i.push(n("\u2514","\u2534","\u2518")),i}function Er(e,t){let r=Math.max(46,e-4-13),o=14,i=Math.min(26,Math.max(5,...t.map(l=>l.length))),s=r-1-i;s<o*2&&(i=Math.max(12,i-(o*2-s)),s=r-1-i);let a=Math.max(o,Math.ceil(s/2)),c=Math.max(o,s-a);return[{title:"",width:1},{title:"Check",width:i,paint:v.default.bold},{title:"What's wrong",width:a},{title:"How to fix",width:c,paint:v.default.cyan}]}function Ct(e,t,n,r){let i=Math.max(40,e-4-7),s=Math.min(30,Math.max(n[0].length,...t.map(a=>a.length)));return[{title:n[0],width:s,paint:r},{title:n[1],width:Math.max(20,i-s),paint:r}]}function Tr(e,t){if(t<=0)return v.default.dim("\u2500".repeat(he));let n=Math.min(he,Math.max(0,Math.round(e/t*he)));return v.default.green("\u2588".repeat(n))+v.default.dim("\u2591".repeat(he-n))}function Pr(e,t,n,r){let o=[""],i=e.total>0?`${e.passed}/${e.total} passed`:"no applicable checks",s=e.skipped>0?` \xB7 ${e.skipped} skipped`:"";o.push(` ${v.default.bold(We(e.name,n))} ${Tr(e.passed,e.total)} ${v.default.dim(i+s)}`);let a=e.checks.filter(c=>!c.passed&&!c.skipped);if(a.length){o.push(` ${v.default.red("\u2717")} ${v.default.bold(`Issues (${a.length})`)}`);let c=Le(Er(t,a.map(u=>u.name)),a.map(u=>[u.status==="warning"?["\u26A0",v.default.yellow]:["\u2717",v.default.red],u.name,[u.detail??"",d=>d],u.hint??""]));o.push(...c.map(u=>` ${u}`));let l=a.filter(u=>u.specUrl);for(let u of l)o.push(v.default.dim(` \u21B3 ${u.id} spec: ${u.specUrl}`))}if(r.showPassing){let c=e.checks.filter(l=>l.passed&&!l.skipped);if(c.length){o.push(` ${v.default.green("\u2713")} ${v.default.bold(`Passed (${c.length})`)}`);let l=Le(Ct(t,c.map(u=>u.name),["Check","Details"]),c.map(u=>[u.name,u.detail??""]));o.push(...l.map(u=>` ${u}`))}}if(r.showSkipped){let c=e.checks.filter(l=>l.skipped);if(c.length){o.push(` ${v.default.dim(`\u25CB Skipped (${c.length})`)}`);let l=Le(Ct(t,c.map(u=>u.name),["Check","Reason"],v.default.dim),c.map(u=>[u.name,u.detail??""]));o.push(...l.map(u=>` ${u}`))}}return o}function Ir(e){if(!e.topFixes.length)return[];let t=["",` ${v.default.bold("Top fixes")} ${v.default.dim("(ranked by ora)")}`],n=e.topFixes.reduce((r,o)=>Math.max(r,o.id.length),0);return e.topFixes.forEach((r,o)=>{let i=typeof r.estScoreGain=="number"?v.default.green(`\u2248 +${r.estScoreGain} pts`):v.default.dim("\u2014"),s=r.bonus?v.default.dim(" (bonus)"):"";t.push(` ${o+1}. ${v.default.bold(We(r.id,n))} ${i}${s}`)}),t}function Mr(e){return e<90?`${e}s`:e<5400?`${Math.round(e/60)} min`:`${Math.round(e/3600)}h`}function Tt(e,t={}){let n=Cr(),r=e.sections.reduce((l,u)=>Math.max(l,u.name.length),0),o=[""],i=e.score>=70?v.default.green:e.score>=50?v.default.yellow:v.default.red;if(o.push(` ${v.default.bold(e.target)} ${i(v.default.bold(`${e.score}/100 ${e.grade}`))}`),t.tunnel&&o.push(v.default.dim(" tunnel audit \u2014 disposable result, excluded from rankings; off-site checks (registry listings, brand search) usually fail for a throwaway hostname")),e.mcpAuthRequired&&o.push(v.default.yellow(" \u26A0 MCP handshake requires credentials \u2014 target is unscored (0/F means could not evaluate, not failed everything)")),e.summary)for(let l of Et(e.summary,n-4))o.push(` ${v.default.dim(l)}`);for(let l of e.sections)o.push(...Pr(l,n,r,t));o.push(...Ir(e));let s=e.sections.reduce((l,u)=>l+u.passed,0),a=e.sections.reduce((l,u)=>l+u.skipped,0),c=[];if(!t.showPassing&&s>0&&c.push(` Run with --show-passing to list all ${s} passing checks`),!t.showSkipped&&a>0&&c.push(` ${a} check${a===1?"":"s"} skipped \u2014 run with --show-skipped to see them`),e.analysisStatus==="partial"?c.push(" Analysis still finishing \u2014 re-run shortly for the final score"):e.analysisStatus==="stuck"&&c.push(" Scan did not fully resolve \u2014 re-run with --force to complete it"),typeof e.cacheAgeSeconds=="number"&&c.push(` cached result (${Mr(e.cacheAgeSeconds)} old) \xB7 pass --force for a fresh scan`),e.reportUrl&&c.push(` Full report: ${e.reportUrl}`),c.length){o.push("");for(let l of c)o.push(v.default.dim(l))}return o.push(""),o}var Pt=require("child_process"),Q=class extends Error{},Or=3e4,Nr=9e4,jr=1e4;function De(e){try{let n=new URL(e.includes("://")?e:`http://${e}`).hostname;return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="[::1]"||n.endsWith(".local")||n.endsWith(".localhost")}catch{return!1}}function Lr(e){for(let t of e.matchAll(/https:\/\/[^\s"'|]+/g))try{let n=new URL(t[0]);if(n.pathname==="/"&&!n.search&&!De(n.hostname))return n.origin}catch{}}async function It(e,t=Or){let n=await Dr(e,t);try{await Wr(n.url,Nr)}catch(r){throw n.close(),r}return n}async function Wr(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(e,{redirect:"manual",signal:AbortSignal.timeout(jr)})).status<500)return}catch{}await new Promise(r=>setTimeout(r,5e3))}throw new Q([`tunnel opened but never became routable within ${Math.round(t/1e3)}s.`,"Some networks and DNS filters block tunnel vendors' domains entirely -","if this repeats, try another network, DNS resolver, or tunnel tool."].join(`
15
15
  `))}function Dr(e,t){return new Promise((n,r)=>{let o=process.platform!=="win32",i=(0,Pt.spawn)(e,{shell:!0,detached:o,stdio:["ignore","pipe","pipe"]}),s=!1,a="",c=()=>{try{o&&i.pid?process.kill(-i.pid,"SIGTERM"):i.kill("SIGTERM")}catch{}},l=d=>{s||(s=!0,clearTimeout(u),c(),r(d))},u=setTimeout(()=>l(new Q(`tunnel command did not print a public https URL within ${Math.round(t/1e3)}s: ${e}`)),t);i.on("error",d=>l(new Q(d.message))),i.on("exit",d=>{let g=a.trim()?`
16
16
  output: ${a.trim().slice(-300)}`:"";l(new Q(`tunnel command exited before printing a public https URL (code ${d??"unknown"}): ${e}${g}`))});for(let d of[i.stdout,i.stderr])d?.setEncoding("utf8"),d?.on("data",g=>{a=(a+g).slice(-2e3);let p=Lr(a);p&&!s&&(s=!0,clearTimeout(u),i.removeAllListeners("exit"),n({url:p,close:c}))})})}var Be=U(D(),1);function G(e,t){let n=process.stdout.columns??100;return Math.min(t,Math.max(e,n))}function V(e,t){let n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}\u2026`:n}function T(e,t){let n=[],r="";for(let o of e.replace(/\s+/g," ").trim().split(" "))r&&r.length+1+o.length>t?(n.push(r),r=o):r=r?`${r} ${o}`:o;return r&&n.push(r),n}var Z=["\u25C7","\u25C7","\u25C8","\u25C8","\u25C6","\u25C6","\u25C8","\u25C8"];function _(e){return e.replace(/[\u0000-\u001f\u007f-\u009f]/g," ")}var Br=80,fe,Ue=0,ie="";function Ur(){let e=Be.default.cyan(Z[Ue%Z.length]),t=Math.max(10,(process.stderr.columns??80)-2),n=ie.length>t?`${ie.slice(0,t-1)}\u2026`:ie;process.stderr.write(`\r\x1B[K${e} ${Be.default.dim(n)}`),Ue++}var k={start(e){k.stop(),Ue=0,ie=e,process.stderr.isTTY&&(fe=setInterval(Ur,Br))},update(e){ie=e},stop(){fe&&(clearInterval(fe),fe=void 0,process.stderr.write("\r\x1B[K"))}};var P={OK:0,BELOW_MIN_SCORE:1,USAGE:2,API:3};function Mt(e,t,n,r){if(e===void 0)return{};let o=Number(e);return e.trim()===""||!Number.isInteger(o)||o<n||o>r?{error:`${t} must be an integer between ${n} and ${r}, got ${JSON.stringify(e)}`}:{value:o}}function Jr(e){let t=e.trim().replace(/\/+$/,"");if(!(!t||/\s/.test(t)))try{let n=new URL(t.includes("://")?t:`https://${t}`);return!n.hostname.includes(".")&&n.hostname!=="localhost"?void 0:t}catch{return}}async function Ot(e){let t=Jr(e.url);if(!t)return console.error(`Not a scannable URL or domain: ${JSON.stringify(e.url)}`),P.USAGE;let n=Mt(e.minScore,"--min-score",0,100),r=Mt(e.maxAge,"--max-age",0,86400);for(let p of[n,r])if(p.error)return console.error(p.error),P.USAGE;let o=e.tunnelCmd?.trim()||process.env.ORA_TUNNEL_CMD?.trim(),i=!!o;if(!i&&De(t))return console.error([`${t} only exists on this machine, and ora audits public URLs.`,"Either audit a publicly reachable deployment of this site (e.g. a preview URL),","or run it through a tunnel you provide:"," ax audit localhost:3000 --tunnel-cmd 'ngrok http 3000 --log stdout'","Any command that prints a public https URL works; the result is stored as","ephemeral (excluded from rankings, deleted after a few days)."].join(`
17
- `)),P.USAGE;let s=!e.json;s&&k.start(`Auditing ${t} with ora`);let a,c=()=>a?.close(),l=p=>{c(),process.exit(p==="SIGINT"?130:143)},u=t;if(i&&o){s&&k.update(`Opening a tunnel to ${t}`);try{a=await It(o)}catch(p){return k.stop(),console.error(p instanceof Error?p.message:String(p)),P.USAGE}process.on("SIGINT",l),process.on("SIGTERM",l),u=a.url}let d;try{d=await At(u,{progress:s?p=>k.update(p):void 0,maxAgeSeconds:r.value,force:e.force,ephemeral:i||void 0,apiKey:e.apiKey?.trim()||void 0})}catch(p){return k.stop(),console.error(`Audit failed: ${p instanceof Error?p.message:String(p)}`),p instanceof O?P.API:P.USAGE}finally{c(),process.removeListener("SIGINT",l),process.removeListener("SIGTERM",l)}k.stop();let{result:g}=d;if(e.json)process.stdout.write(`${JSON.stringify(g,null,2)}
17
+ `)),P.USAGE;let s=!e.json;s&&k.start(`Auditing ${t} with ora`);let a,c=()=>a?.close(),l=p=>{c(),process.exit(p==="SIGINT"?130:143)},u=t;if(i&&o){s&&k.update(`Opening a tunnel to ${t}`);try{a=await It(o)}catch(p){return k.stop(),console.error(p instanceof Error?p.message:String(p)),P.USAGE}process.on("SIGINT",l),process.on("SIGTERM",l),u=a.url}let d;try{d=await $t(u,{progress:s?p=>k.update(p):void 0,maxAgeSeconds:r.value,force:e.force,ephemeral:i||void 0,apiKey:e.apiKey?.trim()||void 0})}catch(p){return k.stop(),console.error(`Audit failed: ${p instanceof Error?p.message:String(p)}`),p instanceof O?P.API:P.USAGE}finally{c(),process.removeListener("SIGINT",l),process.removeListener("SIGTERM",l)}k.stop();let{result:g}=d;if(e.json)process.stdout.write(`${JSON.stringify(g,null,2)}
18
18
  `);else for(let p of Tt(Rt(d,t),{showSkipped:e.showSkipped,showPassing:e.showPassing,tunnel:i}))console.log(p);if(n.value!==void 0){if(g.mcpAuthRequired)return process.stderr.write(`--min-score skipped: the MCP handshake requires credentials, so the target is unscored
19
19
  `),P.OK;if(g.score<n.value)return e.json||console.log(` Score ${g.score} is below the required minimum ${n.value}
20
20
  `),P.BELOW_MIN_SCORE}return P.OK}var w=U(D(),1);var Fr="https://api.agentfront.sh",Hr=12e4;async function Gr(e,t){let n=await fetch(`${e}/auth/token`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:"{}"});if(n.status===401)throw new Error("ora rejected the API key (401). Check ORA_API_KEY.");let r=await n.json().catch(()=>({}));if(!n.ok||!r.token)throw new Error(`ora auth failed (${n.status})${r.error?`: ${r.error}`:""}`);return r.token}async function qr(e,t,n){let r={intent:n.intent};n.domain&&(r.domain=n.domain),n.harness&&(r.harness=n.harness),n.model&&(r.model=n.model),n.executionKind&&(r.execution_kind=n.executionKind);let o=await fetch(`${e}/experiment/v1/runs`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(r)});if(o.status===429)throw new Error("ora rate limit hit (429). Wait a moment and retry.");let i=await o.text(),s;try{s=JSON.parse(i)}catch{throw new Error(`ora returned a non-JSON response (${o.status})`)}if(!o.ok||!s.runId)throw new Error(`ora run failed (${o.status}): ${s.message??s.error??i}`);return s}function Je(e){let t="message",n=[];for(let r of e.split(`
@@ -29,14 +29,14 @@ output: ${a.trim().slice(-300)}`:"";l(new Q(`tunnel command exited before printi
29
29
 
30
30
  `);for(;g!==-1;){let p=Je(u.slice(0,g));if(u=u.slice(g+2),g=u.indexOf(`
31
31
 
32
- `),!p)continue;let f;try{f=JSON.parse(p.data)}catch{continue}if(p.event==="trajectory"){let h=f.steps??[],m=h.filter(y=>y.type==="tool_call").at(-1);n.progress?.(`step ${h.length} \xB7 ${no(m??h.at(-1))}`),n.onTrajectory?.(h)}else if(p.event==="processing")n.progress?.(typeof f.message=="string"?f.message:"generating insights\u2026");else if(p.event==="result"){l.result=f;break e}else if(p.event==="error"){l.errorMessage=typeof f.message=="string"?f.message:"unknown engine error";break e}}}}catch(d){if(i.tripped())throw s();if(d instanceof R)throw d;let g=d instanceof Error?d.message:String(d);throw new R(`ora journey stream error: ${g}`)}finally{i.disarm(),a.body.cancel().catch(()=>{})}return l}function ye(e,t){return Ge(`${e}/api/journey/runs/${encodeURIComponent(t)}`)}async function jt(e,t,n){let r=n.pollEveryMs??Qr,o=n.pollLimit??Zr,i=await ye(e,t);for(let s=0;s<o&&i.status==="running";s++){n.progress?.("agent working\u2026 (polling)"),await K(r);try{i=await ye(e,t)}catch{}}return i}async function Dt(e,t){let n=He(t.baseUrl);t={...t,apiKey:t.apiKey||process.env.ORA_PARTNER_API_KEY||process.env.ORA_SCAN_API_KEY||void 0};let r=await to(n,e,t),{record:o}=r;r.cached&&t.progress?.("target at its 24h cap \u2014 fetching the most recent stored run");let i;if(!t.noStream&&o.status==="running")try{i=(await ro(n,o.stream_url,t)).errorMessage}catch{t.progress?.("stream went quiet \u2014 switching to polling"),await jt(n,o.id,t)}else t.noStream&&o.status==="running"&&await jt(n,o.id,t);let s=await oo(n,o.id,t);if(s.status==="running")throw i?new R(`ora journey run failed: ${i}`):new R(`run ${o.id} is still executing \u2014 the ${t.noStream?"poll budget ran out":"stream ended"} before a terminal result. Check ${n}/api/journey/runs/${o.id} shortly`);return oe(s.contractVersion),{record:o,cached:r.cached,retryAfterMs:r.record.retry_after_ms,allowance:r.allowance,detail:s,engineError:i}}async function oo(e,t,n){let r=await ye(e,t);for(let o=0;o<3&&r.status==="running";o++)n.progress?.("finalizing\u2026"),await K(1500),r=await ye(e,t);return r}var A=U(D(),1);function Ke(e){if(!e)return{};let t=e.match(/https?:\/\/([^/\s]+)(\/\S*)?/i);return t?{host:t[1],path:t[2]??"/"}:{}}function Y(e){return/search/i.test(`${e.tool??""} ${e.action??""}`)}function io(e){if(Y(e))return"\u{1F50D}";let t=`${e.tool??""} ${e.action??""}`.toLowerCase();return/fetch|http|get/.test(t)?"\u{1F310}":/read|open|view/.test(t)?"\u{1F4C4}":"\u{1F310}"}function so(e,t){if(Y(e)){let c=e.input_display??String(e.input?.query??"search"),l=e.output_structured?.links?.length;return{id:e.id,kind:"search",icon:"\u{1F50D}",label:V(`"${c}"`,t),meta:l?`${l} results`:void 0,tone:"ok",notes:[],children:[]}}let{host:n,path:r}=Ke(e.input_display??String(e.input?.url??"")),o=e.status,i=o!=null&&o>=300&&o<400,s=!!e.is_error||o!=null&&o>=400,a;if(i)a=`\u21B3 ${o}`;else if(s)a=`\u2717 ${o??"error"}`;else{let c=["\u2713"];o&&c.push(String(o)),e.duration_ms&&c.push(`${(e.duration_ms/1e3).toFixed(1)}s`),a=c.join(" ")}return{id:e.id,kind:"fetch",icon:io(e),label:V(`${n??"?"}${r??""}`,t),meta:a,tone:i?"redirect":s?"error":"ok",notes:[],children:[]}}function be(e,t,n){let r=G(60,120),o=Math.min(52,Math.max(24,r-40)),i=Math.max(30,r-24),s={id:-1,kind:"intent",icon:"\u25C6",label:V(t,i),tone:"root",notes:[],children:[]},a=new Map,c=[],l,u,d;for(let g of e){if(g.type==="text"&&g.kind==="reasoning"){let h=(g.thinking??g.text??"").trim();h&&c.push(V(h,i));continue}if(g.type!=="tool_call")continue;let p=so(g,o);p.notes=c,c=[],a.set(g.id,p);let f=s;if(!Y(g)){let h=g.attribution?.referrer?.step_id,m=g.attribution?.kind,y=h!=null?a.get(h):void 0;y&&y!==p?f=y:m==="web_search"&&l?f=l:m==="previous_artifact"&&u&&(f=u)}f.children.push(p),Y(g)?l=p:u=p,d=p}return d&&!n&&(d.tone="active",d.meta="\u2026"),{root:s,looseNotes:c}}function we(e){let t=e.filter(o=>o.kind==="reasoning").length,n=e.filter(o=>o.type==="tool_call"&&Y(o)).length,r=[`${A.default.bold(String(e.length))} steps`];return t&&r.push(`${A.default.bold(String(t))} reasoning`),n&&r.push(`${A.default.bold(String(n))} search${n===1?"":"es"}`),r.join(A.default.dim(" \xB7 "))}function ao(e){switch(e){case"root":return{frame:A.default.dim,ink:t=>A.default.bold(t)};case"active":return{frame:A.default.cyan,ink:t=>A.default.cyan(A.default.bold(t))};case"redirect":return{frame:A.default.yellow,ink:A.default.yellow};case"error":return{frame:A.default.red,ink:A.default.red};default:return{frame:A.default.green,ink:A.default.green}}}var Bt=e=>A.default.dim(`(\u2026) ${e}`);function Ut(e,t){let{frame:n,ink:r}=ao(e.tone),i=`${e.icon} ${e.label}${e.meta?` ${e.meta}`:""}`.length+2,s=`${e.icon} ${r(e.label)}${e.meta?` ${A.default.dim(e.meta)}`:""}`,a=e.children.length>0,c=e.notes.map(Bt);return c.push(n(`\u256D${"\u2500".repeat(i)}\u256E`)),c.push(`${n(t?"\u2524":"\u2502")} ${s} ${n("\u2502")}`),c.push(n(a?`\u2570\u2500\u252C${"\u2500".repeat(i-2)}\u256F`:`\u2570${"\u2500".repeat(i)}\u256F`)),e.children.forEach((l,u)=>{let d=u===e.children.length-1,g=Ut(l,!0),p=l.notes.length+1;g.forEach((f,h)=>{let m;h===p?m=d?" \u2570\u2500\u2500":" \u251C\u2500\u2500":h<p?m=" \u2502 ":m=d?" ":" \u2502 ",c.push(A.default.dim(m)+f)})}),c}function ve(e){let t=Ut(e.root,!1);return e.looseNotes.length&&(t.push(""),t.push(...e.looseNotes.map(Bt))),t}var Se=U(D(),1);var ee=class{rows=0;beat=0;bornAt=Date.now();ticker;live=!!process.stdout.isTTY;content=[];headline="";open(){this.live&&!this.ticker&&(this.ticker=setInterval(()=>this.pulse(),100))}draw(t,n){this.content=t,this.headline=n,this.repaint()}close(){this.ticker&&(clearInterval(this.ticker),this.ticker=void 0),this.live&&this.rows>0&&(process.stdout.write(`\x1B[${this.rows}A\r\x1B[0J`),this.rows=0)}banner(){let t=Se.default.cyan(Z[this.beat%Z.length]),n=Math.floor((Date.now()-this.bornAt)/1e3),r=`${this.headline} ${n}s`,o=Math.max(10,(process.stdout.columns??80)-6),i=r.length>o?`${r.slice(0,o-1)}\u2026`:r;return` ${t} ${Se.default.bold(i)}`}clamp(t){let n=Math.max(2,(process.stdout.rows??24)-3);if(t.length<=n)return t;let r=n-1,o=t.length-r;return[Se.default.dim(` \u22EF ${o} earlier line${o===1?"":"s"}`),...t.slice(-r)]}repaint(){if(!this.live)return;let t=[this.banner(),"",...this.clamp(this.content)],n=this.rows>0?`\x1B[${this.rows}A`:"";for(let r of t)n+=`\x1B[2K${r}
32
+ `),!p)continue;let f;try{f=JSON.parse(p.data)}catch{continue}if(p.event==="trajectory"){let h=f.steps??[],m=h.filter(y=>y.type==="tool_call").at(-1);n.progress?.(`step ${h.length} \xB7 ${no(m??h.at(-1))}`),n.onTrajectory?.(h)}else if(p.event==="processing")n.progress?.(typeof f.message=="string"?f.message:"generating insights\u2026");else if(p.event==="result"){l.result=f;break e}else if(p.event==="error"){l.errorMessage=typeof f.message=="string"?f.message:"unknown engine error";break e}}}}catch(d){if(i.tripped())throw s();if(d instanceof R)throw d;let g=d instanceof Error?d.message:String(d);throw new R(`ora journey stream error: ${g}`)}finally{i.disarm(),a.body.cancel().catch(()=>{})}return l}function ye(e,t){return Ge(`${e}/api/journey/runs/${encodeURIComponent(t)}`)}async function jt(e,t,n){let r=n.pollEveryMs??Qr,o=n.pollLimit??Zr,i=await ye(e,t);for(let s=0;s<o&&i.status==="running";s++){n.progress?.("agent working\u2026 (polling)"),await K(r);try{i=await ye(e,t)}catch{}}return i}async function Dt(e,t){let n=He(t.baseUrl);t={...t,apiKey:t.apiKey||process.env.ORA_PARTNER_API_KEY||process.env.ORA_SCAN_API_KEY||void 0};let r=await to(n,e,t),{record:o}=r;r.cached&&t.progress?.("target at its 24h cap \u2014 fetching the most recent stored run");let i;if(!t.noStream&&o.status==="running")try{i=(await ro(n,o.stream_url,t)).errorMessage}catch{t.progress?.("stream went quiet \u2014 switching to polling"),await jt(n,o.id,t)}else t.noStream&&o.status==="running"&&await jt(n,o.id,t);let s=await oo(n,o.id,t);if(s.status==="running")throw i?new R(`ora journey run failed: ${i}`):new R(`run ${o.id} is still executing \u2014 the ${t.noStream?"poll budget ran out":"stream ended"} before a terminal result. Check ${n}/api/journey/runs/${o.id} shortly`);return oe(s.contractVersion),{record:o,cached:r.cached,retryAfterMs:r.record.retry_after_ms,allowance:r.allowance,detail:s,engineError:i}}async function oo(e,t,n){let r=await ye(e,t);for(let o=0;o<3&&r.status==="running";o++)n.progress?.("finalizing\u2026"),await K(1500),r=await ye(e,t);return r}var $=U(D(),1);function Ke(e){if(!e)return{};let t=e.match(/https?:\/\/([^/\s]+)(\/\S*)?/i);return t?{host:t[1],path:t[2]??"/"}:{}}function Y(e){return/search/i.test(`${e.tool??""} ${e.action??""}`)}function io(e){if(Y(e))return"\u{1F50D}";let t=`${e.tool??""} ${e.action??""}`.toLowerCase();return/fetch|http|get/.test(t)?"\u{1F310}":/read|open|view/.test(t)?"\u{1F4C4}":"\u{1F310}"}function so(e,t){if(Y(e)){let c=e.input_display??String(e.input?.query??"search"),l=e.output_structured?.links?.length;return{id:e.id,kind:"search",icon:"\u{1F50D}",label:V(`"${c}"`,t),meta:l?`${l} results`:void 0,tone:"ok",notes:[],children:[]}}let{host:n,path:r}=Ke(e.input_display??String(e.input?.url??"")),o=e.status,i=o!=null&&o>=300&&o<400,s=!!e.is_error||o!=null&&o>=400,a;if(i)a=`\u21B3 ${o}`;else if(s)a=`\u2717 ${o??"error"}`;else{let c=["\u2713"];o&&c.push(String(o)),e.duration_ms&&c.push(`${(e.duration_ms/1e3).toFixed(1)}s`),a=c.join(" ")}return{id:e.id,kind:"fetch",icon:io(e),label:V(`${n??"?"}${r??""}`,t),meta:a,tone:i?"redirect":s?"error":"ok",notes:[],children:[]}}function be(e,t,n){let r=G(60,120),o=Math.min(52,Math.max(24,r-40)),i=Math.max(30,r-24),s={id:-1,kind:"intent",icon:"\u25C6",label:V(t,i),tone:"root",notes:[],children:[]},a=new Map,c=[],l,u,d;for(let g of e){if(g.type==="text"&&g.kind==="reasoning"){let h=(g.thinking??g.text??"").trim();h&&c.push(V(h,i));continue}if(g.type!=="tool_call")continue;let p=so(g,o);p.notes=c,c=[],a.set(g.id,p);let f=s;if(!Y(g)){let h=g.attribution?.referrer?.step_id,m=g.attribution?.kind,y=h!=null?a.get(h):void 0;y&&y!==p?f=y:m==="web_search"&&l?f=l:m==="previous_artifact"&&u&&(f=u)}f.children.push(p),Y(g)?l=p:u=p,d=p}return d&&!n&&(d.tone="active",d.meta="\u2026"),{root:s,looseNotes:c}}function we(e){let t=e.filter(o=>o.kind==="reasoning").length,n=e.filter(o=>o.type==="tool_call"&&Y(o)).length,r=[`${$.default.bold(String(e.length))} steps`];return t&&r.push(`${$.default.bold(String(t))} reasoning`),n&&r.push(`${$.default.bold(String(n))} search${n===1?"":"es"}`),r.join($.default.dim(" \xB7 "))}function ao(e){switch(e){case"root":return{frame:$.default.dim,ink:t=>$.default.bold(t)};case"active":return{frame:$.default.cyan,ink:t=>$.default.cyan($.default.bold(t))};case"redirect":return{frame:$.default.yellow,ink:$.default.yellow};case"error":return{frame:$.default.red,ink:$.default.red};default:return{frame:$.default.green,ink:$.default.green}}}var Bt=e=>$.default.dim(`(\u2026) ${e}`);function Ut(e,t){let{frame:n,ink:r}=ao(e.tone),i=`${e.icon} ${e.label}${e.meta?` ${e.meta}`:""}`.length+2,s=`${e.icon} ${r(e.label)}${e.meta?` ${$.default.dim(e.meta)}`:""}`,a=e.children.length>0,c=e.notes.map(Bt);return c.push(n(`\u256D${"\u2500".repeat(i)}\u256E`)),c.push(`${n(t?"\u2524":"\u2502")} ${s} ${n("\u2502")}`),c.push(n(a?`\u2570\u2500\u252C${"\u2500".repeat(i-2)}\u256F`:`\u2570${"\u2500".repeat(i)}\u256F`)),e.children.forEach((l,u)=>{let d=u===e.children.length-1,g=Ut(l,!0),p=l.notes.length+1;g.forEach((f,h)=>{let m;h===p?m=d?" \u2570\u2500\u2500":" \u251C\u2500\u2500":h<p?m=" \u2502 ":m=d?" ":" \u2502 ",c.push($.default.dim(m)+f)})}),c}function ve(e){let t=Ut(e.root,!1);return e.looseNotes.length&&(t.push(""),t.push(...e.looseNotes.map(Bt))),t}var Se=U(D(),1);var ee=class{rows=0;beat=0;bornAt=Date.now();ticker;live=!!process.stdout.isTTY;content=[];headline="";open(){this.live&&!this.ticker&&(this.ticker=setInterval(()=>this.pulse(),100))}draw(t,n){this.content=t,this.headline=n,this.repaint()}close(){this.ticker&&(clearInterval(this.ticker),this.ticker=void 0),this.live&&this.rows>0&&(process.stdout.write(`\x1B[${this.rows}A\r\x1B[0J`),this.rows=0)}banner(){let t=Se.default.cyan(Z[this.beat%Z.length]),n=Math.floor((Date.now()-this.bornAt)/1e3),r=`${this.headline} ${n}s`,o=Math.max(10,(process.stdout.columns??80)-6),i=r.length>o?`${r.slice(0,o-1)}\u2026`:r;return` ${t} ${Se.default.bold(i)}`}clamp(t){let n=Math.max(2,(process.stdout.rows??24)-3);if(t.length<=n)return t;let r=n-1,o=t.length-r;return[Se.default.dim(` \u22EF ${o} earlier line${o===1?"":"s"}`),...t.slice(-r)]}repaint(){if(!this.live)return;let t=[this.banner(),"",...this.clamp(this.content)],n=this.rows>0?`\x1B[${this.rows}A`:"";for(let r of t)n+=`\x1B[2K${r}
33
33
  `;t.length<this.rows&&(n+="\x1B[0J"),this.rows=t.length,process.stdout.write(n)}pulse(){!this.live||this.rows===0||(this.beat++,process.stdout.write(`\x1B[${this.rows}A\r\x1B[2K${this.banner()}\x1B[${this.rows}B\r`))}};var B={OK:0,RUN_FAILED:1,USAGE:2,API:3},co="public caps: 100 runs/24h per target \xB7 200 runs/24h per IP",lo="keyed caps: 1000 runs/24h per key \xB7 no per-target cap",uo={id:"cas-haiku",label:"Claude Code",variant:"Haiku 4.5",harness:"claude-agent-sdk",model:"claude-haiku-4-5",blurb:"Fast, frugal navigator \u2014 the CLI default."};function Ve(e){return console.error(w.default.red(`ax deep-journey: ${e}`)),B.API}function po(e,t){if(t==="failed")return w.default.red("\u2717 run failed");switch(e){case"satisfied":return w.default.green("\u2713 task satisfied");case"partial":return w.default.yellow("\u25D0 partially satisfied");case"unsatisfied":return w.default.red("\u2717 task not satisfied");default:return w.default.dim("\xB7 not gradable")}}function Ye(e){return`${e.label} \xB7 ${e.variant}`}function Jt(e){let n=e.action==="search"?e.search_query:e.url_host||e.url_path?`https://${e.url_host??""}${e.url_path??""}`:e.url;return{id:e.id,turn:e.turn??0,type:e.type,kind:e.type==="text"?"reasoning":void 0,text:e.text,thinking:e.text,tool:e.tool,action:e.action,input_display:n,status:e.status,duration_ms:e.duration_ms,attribution:e.attribution?{kind:e.attribution.kind,referrer:{step_id:e.attribution.referrer?.step_id??e.parent_id}}:void 0}}function Ft(e,t,n){return[` ${we(e)}`,"",...ve(be(e,t,n)).map(r=>` ${r}`)]}var mo=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);function go(e){return e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function ho(e){if(!e)return;let{input_tokens:t,output_tokens:n}=e;if(!(t==null&&n==null))return(t??0)+(n??0)}function fo(e){return(e?.trajectory?.steps??[]).filter(t=>t.action==="search").length}function Xe(e,t,n){return e>=t?w.default.green:e>=n?w.default.yellow:w.default.red}function yo(e){let t=e.run_signals,r=(e.trajectory?.steps??[]).filter(i=>i.type==="tool_call"&&(i.action==="fetch"||i.action==="api_call")),o=[];if(t?.answer_basis!=null){let i=Math.round(t.answer_basis.site_share*100);o.push({label:"answer from your site",pct:i,paint:Xe(i,70,40)})}if(t?.answer_efficiency!=null){let i=Math.round(t.answer_efficiency*100);o.push({label:"answer efficiency",pct:i,paint:Xe(i,70,30)})}if(r.length){let i=t?.link_following_rate??r.filter(a=>a.attribution?.kind==="previous_artifact").length/r.length,s=Math.round(i*100);o.push({label:"followed site links",pct:s,paint:Xe(s,70,35)})}return o}function bo(e,t=20,n=21){let r=Math.max(0,Math.min(t,Math.round(e.pct/100*t))),o=`${e.paint("\u25B0".repeat(r))}${w.default.dim("\u25B1".repeat(t-r))}`,i=`${e.pct}%`.padStart(4);return` ${w.default.dim(e.label.padEnd(n))} ${o} ${e.paint(w.default.bold(i))}`}function ze(e,t,n){let r=Math.max(0,t-e.length),o=Math.floor(r/2);return`${" ".repeat(o)}${n(e)}${" ".repeat(r-o)}`}function wo(e,t){let n=e.length;if(n===0)return null;let r=4,o=Math.min(t,100)-2,i=Math.floor((o-r*(n-1))/n);if(i<18)return null;let s=[],a=[],c=[],l=1;for(let g of e){s.push(ze(`${g.pct}%`,i,m=>g.paint(w.default.bold(m))));let p=i-2,f=Math.max(1,Math.min(p,Math.round(g.pct/100*p)));a.push(` ${g.paint("\u2594".repeat(f))}${w.default.dim("\u2594".repeat(p-f))} `);let h=T(g.label.toUpperCase(),i).map(m=>ze(m,i,w.default.dim));c.push(h),l=Math.max(l,h.length)}let u=g=>` ${g.join(" ".repeat(r))}`,d=["",u(s),u(a)];for(let g=0;g<l;g++)d.push(u(c.map(p=>p[g]??ze("",i,w.default.dim))));return d}function Ht(e,t){let n=t.filter(s=>s.n>0),r=n.reduce((s,a)=>s+a.n,0);if(!n.length||!r)return[];let o=Math.max(...n.map(s=>s.label.length)),i=["",` ${w.default.dim(e)}`];for(let s of n){let a=Math.round(s.n/r*100),c=Math.max(0,Math.min(20,Math.round(a/100*20))),l=`${w.default.dim("\u25B0".repeat(c))}${w.default.dim("\u25B1".repeat(20-c))}`;i.push(` ${w.default.dim(s.label.padEnd(o))} ${l} ${w.default.dim(`${a}%`.padStart(4))}`)}return i}function vo(e){return w.default.dim(` ${"\u2500".repeat(Math.min(e-4,52))}`)}function So(e,t){let n=e.run_signals,r=[];if(n?.reached_anchor!=null){let c=n.reached_anchor?w.default.green("\u2713 reached the site"):w.default.red("\u2717 never reached the site");r.push("",` ${c}`)}let o=yo(e);if(o.length){let c=wo(o,t);if(c)r.push(...c);else{r.push("");for(let l of o)r.push(bo(l))}}let i=n?.answer_basis;i&&i.sections_total>0&&r.push(...Ht("answer sources",[{label:"from this site",n:i.from_site},{label:"from external pages",n:i.from_external},{label:"from search results",n:i.from_search},{label:"from agent knowledge",n:i.from_memory}]));let a=(e.trajectory?.steps??[]).filter(c=>c.type==="tool_call"&&(c.action==="fetch"||c.action==="api_call"));if(a.length){let c=u=>{let d=u.attribution?.kind;return d==="previous_step"||d==="previous_artifact"?"previous_artifact":d==="web_search"?"web_search":d==="prior_knowledge"&&u.anchor_relation==="exact"&&(!u.url_path||u.url_path==="/")?"task_input":"prior_knowledge"},l={};for(let u of a){let d=c(u);l[d]=(l[d]??0)+1}r.push(...Ht("url discovery",[{label:"given in the task",n:l.task_input??0},{label:"followed a link",n:l.previous_artifact??0},{label:"found via web search",n:l.web_search??0},{label:"guessed the URL",n:l.prior_knowledge??0}]))}return r}function ko(e,t){let n=G(60,120),{detail:r}=e,o=r.result,i=["",vo(n),""];i.push(` ${po(r.verdict,r.status)} ${w.default.dim("\xB7")} ${w.default.dim(r.domain??t)}`);let s=[];r.step_count!=null&&s.push(`${r.step_count} steps`);let a=o?.run_signals?.search_count??fo(o);a&&s.push(`${a} search${a===1?"":"es"}`),o?.duration_ms!=null&&s.push(`${(o.duration_ms/1e3).toFixed(1)}s`);let c=ho(o);if(c!=null&&s.push(`${mo(c)} tokens`),o?.cost_usd!=null&&s.push(go(o.cost_usd)),s.length&&i.push(` ${w.default.dim(s.join(" \xB7 "))}`),o&&i.push(...So(o,n)),o?.insight?.summary){i.push("");for(let u of T(_(o.insight.summary),n-4))i.push(` ${u}`)}let l=o?.insight?.key_observations??[];if(l.length){i.push("",` ${w.default.bold("Observations")}`);for(let u of l){let[d,...g]=T(_(u),n-6);i.push(` ${w.default.cyan("\xB7")} ${d}`);for(let p of g)i.push(` ${p}`)}}return r.status==="failed"&&i.push("",w.default.dim(e.engineError?` Engine error: ${e.engineError} \u2014 re-running is free to try.`:" The run ended in an engine error; re-running is free to try.")),i.push("",w.default.dim(` For the 4-layer readiness audit, run: ax audit ${t}`)),i}async function Gt(e){let t=e.url.trim();if(!t)return console.error("ax deep-journey: a target URL or domain is required"),B.USAGE;let n=!e.json&&process.stderr.isTTY,r=e.task?.trim()||void 0,o=e.apiKey||process.env.ORA_PARTNER_API_KEY||process.env.ORA_SCAN_API_KEY||void 0;if(r&&e.intent!==void 0)return console.error("ax deep-journey: --task and --intent are mutually exclusive \u2014 a free-text task replaces the curated intent"),B.USAGE;if(r&&!o)return console.error("ax deep-journey: --task needs an ora partner API key \u2014 set ORA_PARTNER_API_KEY or pass --api-key (keys are issued by ora on request)"),B.USAGE;let i=e.intent,s,a=r??"journey";try{let[m,y]=await Promise.all([r?void 0:Lt(),Wt()]);if(m){if(i===void 0)i=m.defaultId;else if(!m.intents.some(z=>z.id===i))return console.error(`ax deep-journey: unknown intent "${i}". Available intents:
34
34
  ${m.intents.map(z=>` ${z.id.padEnd(12)} ${z.hint}`).join(`
35
35
  `)}`),B.USAGE;let M=m.intents.find(z=>z.id===i);a=(M?.template||M?.hint||M?.label||i||"journey").replace(/\{domain\}/g,t)}let C=y.agents.some(M=>M.harness==="claude-agent-sdk"&&/haiku/i.test(M.model))?y.agents:[uo,...y.agents],se=C.find(M=>M.harness==="claude-agent-sdk"&&/haiku/i.test(M.model))?.id??y.defaultId,ae=e.agent??se,ut=C.find(M=>M.id===ae);if(!ut)return console.error(`ax deep-journey: unknown agent "${ae}". Available agents:
36
36
  ${C.map(M=>` ${M.id.padEnd(12)} ${Ye(M)}`).join(`
37
- `)}`),B.USAGE;s=ut}catch(m){return Ve(m instanceof Error?m.message:String(m))}e.json||console.error(w.default.dim(o?lo:co));let c=n&&!e.noStream,l=new ee,u=[],d=`waking ${s.label}`,g=()=>l.draw(Ft(u,a,!1),d);c?(console.log(),console.log(` ${w.default.cyan("\u25B6")} ${w.default.bold(t)} ${w.default.dim("\xB7")} ${w.default.dim(Ye(s))} ${w.default.dim("\xB7")} ${w.default.dim(r?"custom task":i??"default")}`),console.log(),l.open(),g()):n&&k.start(`Sending ${Ye(s)} to ${t} (${r?`"${r}"`:i})`);let p=m=>{c?(d=m,g()):n&&k.update(m)},f;try{f=await Dt(t,{intentId:r?void 0:i,task:r,apiKey:o,harness:s.harness,model:s.model,noStream:e.noStream,progress:n?p:void 0,onTrajectory:c?m=>{u=m.map(Jt),g()}:void 0})}catch(m){return c?l.close():n&&k.stop(),m instanceof R?Ve(m.message):Ve(m instanceof Error?m.message:String(m))}if(c?l.close():n&&k.stop(),e.json)return console.log(JSON.stringify(f.detail,null,2)),f.detail.status==="failed"?B.RUN_FAILED:B.OK;f.cached?console.error(w.default.yellow(`This target hit its 24h cap \u2014 showing the most recent stored run${f.retryAfterMs?` (fresh run in ${qe(f.retryAfterMs)})`:""}.`)):f.allowance.remaining!==void 0&&f.allowance.limit!==void 0&&console.error(w.default.dim(`allowance: ${f.allowance.remaining} of ${f.allowance.limit} target runs left in the 24h window`));let h=(f.detail.result?.trajectory?.steps??[]).map(Jt);if(h.length){console.log();for(let m of Ft(h,a,!0))console.log(m)}for(let m of ko(f,t))console.log(m);return f.detail.status==="failed"?B.RUN_FAILED:B.OK}var S=U(D(),1);var ke=()=>G(60,120);function xo(e){if(e.type==="tool_call"){let t=e.input_display??e.summary??"";if(Y(e))return t?`searching ${V(t,40)}`:"searching\u2026";let{host:n}=Ke(t);return n?`fetching ${n}`:"fetching\u2026"}return e.type==="text"&&e.kind==="reasoning"?"deciding next step\u2026":e.type==="text"?"writing the answer\u2026":"working\u2026"}var $o=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);function Ao(e){return e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function _o(e,t){let n=e.outcome==="success",r=[];return e.num_turns!=null&&r.push(`${e.num_turns} turns`),e.duration_ms!=null&&r.push(`${(e.duration_ms/1e3).toFixed(1)}s`),t?.totalTokens!=null&&r.push(`${$o(t.totalTokens)} tokens`),t?.costUsd!=null&&r.push(Ao(t.costUsd)),["",` ${S.default.dim("\u2500".repeat(Math.min(ke()-4,52)))}`,` ${n?S.default.green("\u2713"):S.default.red("\u2717")} ${S.default.bold(n?"completed":e.outcome)}${r.length?` ${S.default.dim(r.join(" \xB7 "))}`:""}`]}function Ro(e,t=22){let n=Math.min(100,Math.max(0,e)),r=Math.round(n/100*t);return(n>=70?S.default.green:n>=50?S.default.yellow:S.default.red)("\u2588".repeat(r))+S.default.dim("\u2591".repeat(t-r))}function Co(e){return e==="high"?S.default.red("\u25CF high "):e==="medium"?S.default.yellow("\u25CF medium"):e==="low"?S.default.dim("\u25CF low "):S.default.dim("\u25CF ")}function Eo(e){let t=[""];if(e.visibility_score!=null){let n=e.visibility_score,r=n>=70?S.default.green:n>=50?S.default.yellow:S.default.red,o=e.intent_satisfied?S.default.green("\u2713 intent satisfied"):S.default.yellow("\u2717 intent not satisfied");t.push(` ${S.default.bold("Visibility")} ${Ro(n)} ${r(S.default.bold(`${n}/100`))} ${o}`)}if(e.summary){t.push("");for(let n of T(e.summary,ke()-4))t.push(` ${S.default.dim(n)}`)}if(e.friction_points?.length){t.push("",` ${S.default.bold("Friction")}`);for(let n of e.friction_points){let[r,...o]=T(n,ke()-6);t.push(` ${S.default.yellow("\xB7")} ${r}`);for(let i of o)t.push(` ${i}`)}}if(e.recommendations?.length){t.push("",` ${S.default.bold("Recommendations")}`);for(let n of e.recommendations){t.push(` ${Co(n.priority)} ${S.default.bold(n.title)}`);for(let r of T(n.detail,ke()-8))t.push(` ${S.default.dim(r)}`)}}return t.push(""),t}function To(e){let t=e.insight??{};return JSON.stringify({runId:e.runId,intent:e.intent,domain:e.domain,harness:e.harness,model:e.result?.effective_model??e.result?.model,outcome:e.result?.outcome,durationMs:e.result?.duration_ms,numTurns:e.result?.num_turns,totalTokens:e.usage?.totalTokens,inputTokens:e.usage?.inputTokens,outputTokens:e.usage?.outputTokens,costUsd:e.usage?.costUsd,visibilityScore:t.visibility_score,intentSatisfied:t.intent_satisfied,taskSatisfied:t.task_satisfied,summary:t.summary,keyObservations:t.key_observations,frictionPoints:t.friction_points,recommendations:t.recommendations,journeyLayers:t.journey_layers,intentCategory:t.intent_category,steps:e.trajectory},null,2)}async function qt(e){let t={intent:e.intent,domain:e.domain,harness:e.harness,model:e.model};if(e.json)try{let s=await Fe(t);return process.stdout.write(`${To(s)}
37
+ `)}`),B.USAGE;s=ut}catch(m){return Ve(m instanceof Error?m.message:String(m))}e.json||console.error(w.default.dim(o?lo:co));let c=n&&!e.noStream,l=new ee,u=[],d=`waking ${s.label}`,g=()=>l.draw(Ft(u,a,!1),d);c?(console.log(),console.log(` ${w.default.cyan("\u25B6")} ${w.default.bold(t)} ${w.default.dim("\xB7")} ${w.default.dim(Ye(s))} ${w.default.dim("\xB7")} ${w.default.dim(r?"custom task":i??"default")}`),console.log(),l.open(),g()):n&&k.start(`Sending ${Ye(s)} to ${t} (${r?`"${r}"`:i})`);let p=m=>{c?(d=m,g()):n&&k.update(m)},f;try{f=await Dt(t,{intentId:r?void 0:i,task:r,apiKey:o,harness:s.harness,model:s.model,noStream:e.noStream,progress:n?p:void 0,onTrajectory:c?m=>{u=m.map(Jt),g()}:void 0})}catch(m){return c?l.close():n&&k.stop(),m instanceof R?Ve(m.message):Ve(m instanceof Error?m.message:String(m))}if(c?l.close():n&&k.stop(),e.json)return console.log(JSON.stringify(f.detail,null,2)),f.detail.status==="failed"?B.RUN_FAILED:B.OK;f.cached?console.error(w.default.yellow(`This target hit its 24h cap \u2014 showing the most recent stored run${f.retryAfterMs?` (fresh run in ${qe(f.retryAfterMs)})`:""}.`)):f.allowance.remaining!==void 0&&f.allowance.limit!==void 0&&console.error(w.default.dim(`allowance: ${f.allowance.remaining} of ${f.allowance.limit} target runs left in the 24h window`));let h=(f.detail.result?.trajectory?.steps??[]).map(Jt);if(h.length){console.log();for(let m of Ft(h,a,!0))console.log(m)}for(let m of ko(f,t))console.log(m);return f.detail.status==="failed"?B.RUN_FAILED:B.OK}var S=U(D(),1);var ke=()=>G(60,120);function xo(e){if(e.type==="tool_call"){let t=e.input_display??e.summary??"";if(Y(e))return t?`searching ${V(t,40)}`:"searching\u2026";let{host:n}=Ke(t);return n?`fetching ${n}`:"fetching\u2026"}return e.type==="text"&&e.kind==="reasoning"?"deciding next step\u2026":e.type==="text"?"writing the answer\u2026":"working\u2026"}var Ao=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);function $o(e){return e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function _o(e,t){let n=e.outcome==="success",r=[];return e.num_turns!=null&&r.push(`${e.num_turns} turns`),e.duration_ms!=null&&r.push(`${(e.duration_ms/1e3).toFixed(1)}s`),t?.totalTokens!=null&&r.push(`${Ao(t.totalTokens)} tokens`),t?.costUsd!=null&&r.push($o(t.costUsd)),["",` ${S.default.dim("\u2500".repeat(Math.min(ke()-4,52)))}`,` ${n?S.default.green("\u2713"):S.default.red("\u2717")} ${S.default.bold(n?"completed":e.outcome)}${r.length?` ${S.default.dim(r.join(" \xB7 "))}`:""}`]}function Ro(e,t=22){let n=Math.min(100,Math.max(0,e)),r=Math.round(n/100*t);return(n>=70?S.default.green:n>=50?S.default.yellow:S.default.red)("\u2588".repeat(r))+S.default.dim("\u2591".repeat(t-r))}function Co(e){return e==="high"?S.default.red("\u25CF high "):e==="medium"?S.default.yellow("\u25CF medium"):e==="low"?S.default.dim("\u25CF low "):S.default.dim("\u25CF ")}function Eo(e){let t=[""];if(e.visibility_score!=null){let n=e.visibility_score,r=n>=70?S.default.green:n>=50?S.default.yellow:S.default.red,o=e.intent_satisfied?S.default.green("\u2713 intent satisfied"):S.default.yellow("\u2717 intent not satisfied");t.push(` ${S.default.bold("Visibility")} ${Ro(n)} ${r(S.default.bold(`${n}/100`))} ${o}`)}if(e.summary){t.push("");for(let n of T(e.summary,ke()-4))t.push(` ${S.default.dim(n)}`)}if(e.friction_points?.length){t.push("",` ${S.default.bold("Friction")}`);for(let n of e.friction_points){let[r,...o]=T(n,ke()-6);t.push(` ${S.default.yellow("\xB7")} ${r}`);for(let i of o)t.push(` ${i}`)}}if(e.recommendations?.length){t.push("",` ${S.default.bold("Recommendations")}`);for(let n of e.recommendations){t.push(` ${Co(n.priority)} ${S.default.bold(n.title)}`);for(let r of T(n.detail,ke()-8))t.push(` ${S.default.dim(r)}`)}}return t.push(""),t}function To(e){let t=e.insight??{};return JSON.stringify({runId:e.runId,intent:e.intent,domain:e.domain,harness:e.harness,model:e.result?.effective_model??e.result?.model,outcome:e.result?.outcome,durationMs:e.result?.duration_ms,numTurns:e.result?.num_turns,totalTokens:e.usage?.totalTokens,inputTokens:e.usage?.inputTokens,outputTokens:e.usage?.outputTokens,costUsd:e.usage?.costUsd,visibilityScore:t.visibility_score,intentSatisfied:t.intent_satisfied,taskSatisfied:t.task_satisfied,summary:t.summary,keyObservations:t.key_observations,frictionPoints:t.friction_points,recommendations:t.recommendations,journeyLayers:t.journey_layers,intentCategory:t.intent_category,steps:e.trajectory},null,2)}async function qt(e){let t={intent:e.intent,domain:e.domain,harness:e.harness,model:e.model};if(e.json)try{let s=await Fe(t);return process.stdout.write(`${To(s)}
38
38
  `),s.result?.outcome==="success"?0:1}catch(s){return console.error(`Journey failed: ${s instanceof Error?s.message:String(s)}`),2}let n=new ee,r=[],o=!1,i=()=>[` ${we(r)}`,"",...ve(be(r,e.intent,o)).map(s=>` ${s}`)];console.log(),console.log(` ${S.default.cyan("\u25B6")} ${e.domain?S.default.bold(e.domain):S.default.dim("(no domain)")} ${S.default.dim("\xB7")} ${S.default.dim(e.harness)}`),console.log(),n.open(),n.draw(i(),"waking the agent");try{let s=await Fe(t,{snapshot:a=>{r=a;let c=a[a.length-1];n.draw(i(),c?xo(c):"working")},finished:()=>{o=!0,n.draw(i(),"scoring the journey")}});n.close(),o=!0,s.trajectory.length&&(r=s.trajectory);for(let a of i())console.log(a);if(s.result)for(let a of _o(s.result,s.usage))console.log(a);if(s.insight)for(let a of Eo(s.insight))console.log(a);else s.result&&(console.log(S.default.dim(" (insight not available for this run)")),console.log());return s.result?.outcome==="success"?0:1}catch(s){return n.close(),console.error(`Journey failed: ${s instanceof Error?s.message:String(s)}`),2}}var xe=require("fs"),Ze=require("path"),te=U(D(),1);var Vt=require("crypto"),Po="https://ora.ai",L=class extends Error{};function Yt(e){return(e??process.env.ORA_API_URL??Po).replace(/\/+$/,"")}async function Qe(e){let t=Yt(e),n;try{n=await fetch(`${t}/.well-known/agent-skills/index.json`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(15e3)})}catch(o){throw new L(`could not reach the skill registry at ${t}: ${o instanceof Error?o.message:String(o)}`)}if(!n.ok)throw new L(`skill registry answered HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r.skills))throw new L("skill registry index has no skills[]");return r.skills}function Kt(e){return`sha256:${(0,Vt.createHash)("sha256").update(e).digest("hex")}`}async function Xt(e,t){let n=Yt(t),r=await Qe(n),o=r.find(c=>c.name===e);if(!o){let c=r.map(l=>l.name).join(", ");throw new L(`unknown skill ${JSON.stringify(e)} - the registry has: ${c}`)}let i=o.url.startsWith("http")?o.url:`${n}${o.url}`,s;try{s=await fetch(i,{signal:AbortSignal.timeout(15e3)})}catch(c){throw new L(`could not fetch ${i}: ${c instanceof Error?c.message:String(c)}`)}if(!s.ok)throw new L(`skill fetch answered HTTP ${s.status} for ${i}`);let a=new Uint8Array(await s.arrayBuffer());if(o.digest&&Kt(a)!==o.digest)throw new L(`digest mismatch for ${e}: index says ${o.digest}, served bytes hash to ${Kt(a)} - refusing to use them`);return{entry:o,bytes:a}}var Io=".claude/skills";function Mo(e,t,n){let r=[],o="";for(let i of e.split(/\s+/))o&&`${o} ${i}`.length>t?(r.push(n+o),o=i):o=o?`${o} ${i}`:i;return o&&r.push(n+o),r}async function zt(e){try{if(!e.name){let r=await Qe();if(e.json)return process.stdout.write(`${JSON.stringify(r,null,2)}
39
- `),P.OK;console.log("");for(let o of r){let i=o.digest?te.default.dim(` ${o.digest.slice(0,19)}\u2026`):"";if(console.log(` ${te.default.bold(o.name)}${i}`),o.description)for(let s of Mo(o.description,76," "))console.log(te.default.dim(s));console.log("")}return console.log(te.default.dim(" Install one with: ax skill <name> --install")),console.log(""),P.OK}let{entry:t,bytes:n}=await Xt(e.name);if(e.install){let r=(0,Ze.join)(e.dir??Io,t.name);(0,xe.mkdirSync)(r,{recursive:!0});let o=(0,Ze.join)(r,"SKILL.md");return(0,xe.writeFileSync)(o,n),console.log(`Installed ${t.name} to ${o}`),t.digest&&console.log(te.default.dim(`verified ${t.digest}`)),P.OK}return process.stdout.write(n),P.OK}catch(t){let n=t instanceof Error?t.message:String(t);return console.error(`Skill command failed: ${n}`),t instanceof L&&n.includes("unknown skill")?P.USAGE:P.API}}var x=class extends Error{constructor(t,n){super(t,n),this.name="CdpError"}},Qt=1e4,Zt=5e3,tt=class e{socket;nextId=1;pending=new Map;handlers=new Map;closed=!1;closeReason=null;constructor(t){this.socket=t,t.addEventListener("message",n=>{this.dispatch(String(n.data))}),t.addEventListener("close",()=>{this.fail("the browser closed the DevTools connection")}),t.addEventListener("error",()=>{this.fail("the DevTools connection errored")})}static async open(t){let n=new WebSocket(t);return await new Promise((r,o)=>{let i=setTimeout(()=>{o(new x(`timed out connecting to ${t}`))},Zt);n.addEventListener("open",()=>{clearTimeout(i),r()},{once:!0}),n.addEventListener("error",()=>{clearTimeout(i),o(new x(`could not connect to ${t}`))},{once:!0})}),new e(n)}dispatch(t){let n;try{n=JSON.parse(t)}catch{return}let r=n.id;if(typeof r=="number"){let a=this.pending.get(r);if(!a)return;this.pending.delete(r),clearTimeout(a.timer);let c=n.error;c?a.reject(new x(c.message??"CDP call failed")):a.resolve(n.result??{});return}let o=n.method;if(typeof o!="string")return;let i=typeof n.sessionId=="string"?n.sessionId:"",s=n.params??{};for(let a of this.handlers.get(`${i}\0${o}`)??[])try{a(s)}catch{}}fail(t){if(!this.closed){this.closed=!0,this.closeReason=t;for(let[,n]of this.pending)clearTimeout(n.timer),n.reject(new x(t));this.pending.clear()}}send(t,n={},r={}){if(this.closed)return Promise.reject(new x(this.closeReason??"the connection is closed"));let o=this.nextId++,i=r.timeoutMs??Qt;return new Promise((s,a)=>{let c=setTimeout(()=>{this.pending.delete(o),a(new x(`${t} timed out after ${i}ms`))},i);this.pending.set(o,{resolve:s,reject:a,timer:c});let l={id:o,method:t,params:n};r.sessionId&&(l.sessionId=r.sessionId);try{this.socket.send(JSON.stringify(l))}catch(u){this.pending.delete(o),clearTimeout(c),a(new x(`could not send ${t}`,{cause:u}))}})}on(t,n,r){let o=`${t}\0${n}`,i=this.handlers.get(o)??new Set;return i.add(r),this.handlers.set(o,i),()=>{i.delete(r)}}close(){this.closed=!0;try{this.socket.close()}catch{}}};async function rt(e,t=Zt){if(e.startsWith("ws://")||e.startsWith("wss://"))return{webSocketDebuggerUrl:e,product:""};let n=e.startsWith("http://")||e.startsWith("https://")?e.replace(/\/+$/,""):`http://${e.replace(/\/+$/,"")}`,r;try{r=await fetch(`${n}/json/version`,{signal:AbortSignal.timeout(t)})}catch(i){throw new x(`no debuggable Chrome answered at ${n}`,{cause:i})}if(!r.ok)throw new x(`${n}/json/version returned HTTP ${r.status}`);let o=await r.json().catch(()=>null);if(!o?.webSocketDebuggerUrl)throw new x(`${n}/json/version carried no webSocketDebuggerUrl`);return{webSocketDebuggerUrl:o.webSocketDebuggerUrl,product:o.Browser??""}}var $e=class e{connection;product;constructor(t,n){this.connection=t,this.product=n}static async connect(t){let n=await tt.open(t.webSocketDebuggerUrl),r=t.product;if(!r){let o=await n.send("Browser.getVersion").catch(()=>({}));r=typeof o.product=="string"?o.product:""}return new e(n,r.replace(/^(?:Headless)?Chrome\//i,""))}async newContext(t){let{browserContextId:n}=await this.connection.send("Target.createBrowserContext",{disposeOnDetach:!0}),{targetId:r}=await this.connection.send("Target.createTarget",{url:"about:blank",browserContextId:n}),{sessionId:o}=await this.connection.send("Target.attachToTarget",{targetId:r,flatten:!0}),i=new nt(this.connection,o,n,t.entryUrl);return await i.prepare(t.initScripts??[],t.viewport),i}close(){this.connection.close()}},Oo=8,No=1024*1024,jo=new Set(["Image","Media","Font"]),nt=class{connection;sessionId;browserContextId;entryHost;currentUrl="about:blank";viewport=null;domContentFired=!1;loadFired=!1;documentResponses=new Map;scripts=[];scriptsStarted=0;pendingScriptRequests=new Map;constructor(t,n,r,o){this.connection=t,this.sessionId=n,this.browserContextId=r,this.entryHost=et(o)}async prepare(t,n){await this.send("Page.enable"),await this.send("Runtime.enable"),await this.send("Network.enable"),await this.send("Fetch.enable",{patterns:[{urlPattern:"*"}]}),this.connection.on(this.sessionId,"Fetch.requestPaused",r=>{this.onRequestPaused(r)}),n&&(this.viewport=n,await this.send("Emulation.setDeviceMetricsOverride",{width:n.width,height:n.height,deviceScaleFactor:1,mobile:!1})),this.connection.on(this.sessionId,"Page.domContentEventFired",()=>{this.domContentFired=!0}),this.connection.on(this.sessionId,"Page.loadEventFired",()=>{this.loadFired=!0}),this.connection.on(this.sessionId,"Page.frameNavigated",r=>{let o=r.frame;!o||o.parentId||typeof o.url=="string"&&(this.currentUrl=o.url)}),this.connection.on(this.sessionId,"Network.responseReceived",r=>{this.onResponse(r)}),this.connection.on(this.sessionId,"Network.loadingFinished",r=>{this.onLoadingFinished(r)});for(let r of t)await this.send("Page.addScriptToEvaluateOnNewDocument",{source:r})}send(t,n={},r){return this.connection.send(t,n,{sessionId:this.sessionId,timeoutMs:r})}onRequestPaused(t){let n=t.requestId;if(typeof n!="string")return;(jo.has(String(t.resourceType))?this.send("Fetch.failRequest",{requestId:n,errorReason:"BlockedByClient"}):this.send("Fetch.continueRequest",{requestId:n})).catch(()=>{})}onResponse(t){let n=t.type,r=t.requestId,o=t.response;if(typeof r!="string"||!o)return;if(n==="Document"){let a=typeof t.frameId=="string"?t.frameId:"";this.documentResponses.set(a,{status:typeof o.status=="number"?o.status:0,headers:Lo(o.headers??{})});return}if(n!=="Script"||this.scriptsStarted>=Oo)return;let i=typeof o.url=="string"?o.url:"",s=et(i);s&&(s!==this.entryHost&&s!==et(this.currentUrl)||(this.scriptsStarted++,this.pendingScriptRequests.set(r,i)))}onLoadingFinished(t){let n=t.requestId;if(typeof n!="string")return;let r=this.pendingScriptRequests.get(n);r!==void 0&&(this.pendingScriptRequests.delete(n),this.send("Network.getResponseBody",{requestId:n}).then(o=>{let i=typeof o.body=="string"?o.body:"",s=o.base64Encoded===!0?Buffer.from(i,"base64").toString("utf8"):i;this.scripts.push({url:r,body:s.slice(0,No)})}).catch(()=>{}))}async goto(t,n){this.domContentFired=!1,this.loadFired=!1;let r=await this.send("Page.navigate",{url:t},n),o=r.errorText;if(typeof o=="string"&&o.length>0)throw new x(`navigating to ${t} failed: ${o}`);let i=typeof r.frameId=="string"?r.frameId:"";return await this.waitFor(()=>this.domContentFired,n,`${t} never reached DOMContentLoaded`),this.currentUrl=await this.readLocation(t),this.documentResponses.get(i)??this.documentResponses.get("")??null}async waitForLoad(t){await this.waitFor(()=>this.loadFired,t,"load").catch(()=>{})}async waitFor(t,n,r){let o=Date.now()+n;for(;!t();){if(Date.now()>=o)throw new x(`timed out waiting for ${r}`);await new Promise(i=>setTimeout(i,25))}}async readLocation(t){let n=await this.evaluate("location.href",2e3).catch(()=>null);return typeof n=="string"&&n.length>0?n:t}async evaluate(t,n=Qt){let r=await this.send("Runtime.evaluate",{expression:t,awaitPromise:!0,returnByValue:!0},n),o=r.exceptionDetails;if(o)throw new x(o.exception?.description??o.text??"evaluation threw");return r.result?.value}async content(){return await this.evaluate("document.documentElement ? document.documentElement.outerHTML : ''").catch(()=>"")??""}async inlineScripts(){return await this.evaluate('Array.from(document.querySelectorAll("script:not([src])")).map(function (s) { return s.textContent || ""; }).join("\\n")').catch(()=>"")??""}url(){return this.currentUrl}collectedScripts(){return this.scripts.slice()}viewportSize(){return this.viewport}async screenshot(t,n){try{let o=(await this.send("Page.captureScreenshot",{format:"jpeg",quality:t,captureBeyondViewport:!1},n)).data;return typeof o!="string"||o.length===0?null:Buffer.from(o,"base64")}catch{return null}}async close(){await this.connection.send("Target.disposeBrowserContext",{browserContextId:this.browserContextId}).catch(()=>{})}};function Lo(e){let t={};for(let[n,r]of Object.entries(e)){let o=n.toLowerCase(),i=r.split(`
39
+ `),P.OK;console.log("");for(let o of r){let i=o.digest?te.default.dim(` ${o.digest.slice(0,19)}\u2026`):"";if(console.log(` ${te.default.bold(o.name)}${i}`),o.description)for(let s of Mo(o.description,76," "))console.log(te.default.dim(s));console.log("")}return console.log(te.default.dim(" Install one with: ax skill <name> --install")),console.log(""),P.OK}let{entry:t,bytes:n}=await Xt(e.name);if(e.install){let r=(0,Ze.join)(e.dir??Io,t.name);(0,xe.mkdirSync)(r,{recursive:!0});let o=(0,Ze.join)(r,"SKILL.md");return(0,xe.writeFileSync)(o,n),console.log(`Installed ${t.name} to ${o}`),t.digest&&console.log(te.default.dim(`verified ${t.digest}`)),P.OK}return process.stdout.write(n),P.OK}catch(t){let n=t instanceof Error?t.message:String(t);return console.error(`Skill command failed: ${n}`),t instanceof L&&n.includes("unknown skill")?P.USAGE:P.API}}var x=class extends Error{constructor(t,n){super(t,n),this.name="CdpError"}},Qt=1e4,Zt=5e3,tt=class e{socket;nextId=1;pending=new Map;handlers=new Map;closed=!1;closeReason=null;constructor(t){this.socket=t,t.addEventListener("message",n=>{this.dispatch(String(n.data))}),t.addEventListener("close",()=>{this.fail("the browser closed the DevTools connection")}),t.addEventListener("error",()=>{this.fail("the DevTools connection errored")})}static async open(t){let n=new WebSocket(t);return await new Promise((r,o)=>{let i=setTimeout(()=>{o(new x(`timed out connecting to ${t}`))},Zt);n.addEventListener("open",()=>{clearTimeout(i),r()},{once:!0}),n.addEventListener("error",()=>{clearTimeout(i),o(new x(`could not connect to ${t}`))},{once:!0})}),new e(n)}dispatch(t){let n;try{n=JSON.parse(t)}catch{return}let r=n.id;if(typeof r=="number"){let a=this.pending.get(r);if(!a)return;this.pending.delete(r),clearTimeout(a.timer);let c=n.error;c?a.reject(new x(c.message??"CDP call failed")):a.resolve(n.result??{});return}let o=n.method;if(typeof o!="string")return;let i=typeof n.sessionId=="string"?n.sessionId:"",s=n.params??{};for(let a of this.handlers.get(`${i}\0${o}`)??[])try{a(s)}catch{}}fail(t){if(!this.closed){this.closed=!0,this.closeReason=t;for(let[,n]of this.pending)clearTimeout(n.timer),n.reject(new x(t));this.pending.clear()}}send(t,n={},r={}){if(this.closed)return Promise.reject(new x(this.closeReason??"the connection is closed"));let o=this.nextId++,i=r.timeoutMs??Qt;return new Promise((s,a)=>{let c=setTimeout(()=>{this.pending.delete(o),a(new x(`${t} timed out after ${i}ms`))},i);this.pending.set(o,{resolve:s,reject:a,timer:c});let l={id:o,method:t,params:n};r.sessionId&&(l.sessionId=r.sessionId);try{this.socket.send(JSON.stringify(l))}catch(u){this.pending.delete(o),clearTimeout(c),a(new x(`could not send ${t}`,{cause:u}))}})}on(t,n,r){let o=`${t}\0${n}`,i=this.handlers.get(o)??new Set;return i.add(r),this.handlers.set(o,i),()=>{i.delete(r)}}close(){this.closed=!0;try{this.socket.close()}catch{}}};async function rt(e,t=Zt){if(e.startsWith("ws://")||e.startsWith("wss://"))return{webSocketDebuggerUrl:e,product:""};let n=e.startsWith("http://")||e.startsWith("https://")?e.replace(/\/+$/,""):`http://${e.replace(/\/+$/,"")}`,r;try{r=await fetch(`${n}/json/version`,{signal:AbortSignal.timeout(t)})}catch(i){throw new x(`no debuggable Chrome answered at ${n}`,{cause:i})}if(!r.ok)throw new x(`${n}/json/version returned HTTP ${r.status}`);let o=await r.json().catch(()=>null);if(!o?.webSocketDebuggerUrl)throw new x(`${n}/json/version carried no webSocketDebuggerUrl`);return{webSocketDebuggerUrl:o.webSocketDebuggerUrl,product:o.Browser??""}}var Ae=class e{connection;product;constructor(t,n){this.connection=t,this.product=n}static async connect(t){let n=await tt.open(t.webSocketDebuggerUrl),r=t.product;if(!r){let o=await n.send("Browser.getVersion").catch(()=>({}));r=typeof o.product=="string"?o.product:""}return new e(n,r.replace(/^(?:Headless)?Chrome\//i,""))}async newContext(t){let{browserContextId:n}=await this.connection.send("Target.createBrowserContext",{disposeOnDetach:!0}),{targetId:r}=await this.connection.send("Target.createTarget",{url:"about:blank",browserContextId:n}),{sessionId:o}=await this.connection.send("Target.attachToTarget",{targetId:r,flatten:!0}),i=new nt(this.connection,o,n,t.entryUrl);return await i.prepare(t.initScripts??[],t.viewport),i}close(){this.connection.close()}},Oo=8,No=1024*1024,jo=new Set(["Image","Media","Font"]),nt=class{connection;sessionId;browserContextId;entryHost;currentUrl="about:blank";viewport=null;domContentFired=!1;loadFired=!1;documentResponses=new Map;scripts=[];scriptsStarted=0;pendingScriptRequests=new Map;constructor(t,n,r,o){this.connection=t,this.sessionId=n,this.browserContextId=r,this.entryHost=et(o)}async prepare(t,n){await this.send("Page.enable"),await this.send("Runtime.enable"),await this.send("Network.enable"),await this.send("Fetch.enable",{patterns:[{urlPattern:"*"}]}),this.connection.on(this.sessionId,"Fetch.requestPaused",r=>{this.onRequestPaused(r)}),n&&(this.viewport=n,await this.send("Emulation.setDeviceMetricsOverride",{width:n.width,height:n.height,deviceScaleFactor:1,mobile:!1})),this.connection.on(this.sessionId,"Page.domContentEventFired",()=>{this.domContentFired=!0}),this.connection.on(this.sessionId,"Page.loadEventFired",()=>{this.loadFired=!0}),this.connection.on(this.sessionId,"Page.frameNavigated",r=>{let o=r.frame;!o||o.parentId||typeof o.url=="string"&&(this.currentUrl=o.url)}),this.connection.on(this.sessionId,"Network.responseReceived",r=>{this.onResponse(r)}),this.connection.on(this.sessionId,"Network.loadingFinished",r=>{this.onLoadingFinished(r)});for(let r of t)await this.send("Page.addScriptToEvaluateOnNewDocument",{source:r})}send(t,n={},r){return this.connection.send(t,n,{sessionId:this.sessionId,timeoutMs:r})}onRequestPaused(t){let n=t.requestId;if(typeof n!="string")return;(jo.has(String(t.resourceType))?this.send("Fetch.failRequest",{requestId:n,errorReason:"BlockedByClient"}):this.send("Fetch.continueRequest",{requestId:n})).catch(()=>{})}onResponse(t){let n=t.type,r=t.requestId,o=t.response;if(typeof r!="string"||!o)return;if(n==="Document"){let a=typeof t.frameId=="string"?t.frameId:"";this.documentResponses.set(a,{status:typeof o.status=="number"?o.status:0,headers:Lo(o.headers??{})});return}if(n!=="Script"||this.scriptsStarted>=Oo)return;let i=typeof o.url=="string"?o.url:"",s=et(i);s&&(s!==this.entryHost&&s!==et(this.currentUrl)||(this.scriptsStarted++,this.pendingScriptRequests.set(r,i)))}onLoadingFinished(t){let n=t.requestId;if(typeof n!="string")return;let r=this.pendingScriptRequests.get(n);r!==void 0&&(this.pendingScriptRequests.delete(n),this.send("Network.getResponseBody",{requestId:n}).then(o=>{let i=typeof o.body=="string"?o.body:"",s=o.base64Encoded===!0?Buffer.from(i,"base64").toString("utf8"):i;this.scripts.push({url:r,body:s.slice(0,No)})}).catch(()=>{}))}async goto(t,n){this.domContentFired=!1,this.loadFired=!1;let r=await this.send("Page.navigate",{url:t},n),o=r.errorText;if(typeof o=="string"&&o.length>0)throw new x(`navigating to ${t} failed: ${o}`);let i=typeof r.frameId=="string"?r.frameId:"";return await this.waitFor(()=>this.domContentFired,n,`${t} never reached DOMContentLoaded`),this.currentUrl=await this.readLocation(t),this.documentResponses.get(i)??this.documentResponses.get("")??null}async waitForLoad(t){await this.waitFor(()=>this.loadFired,t,"load").catch(()=>{})}async waitFor(t,n,r){let o=Date.now()+n;for(;!t();){if(Date.now()>=o)throw new x(`timed out waiting for ${r}`);await new Promise(i=>setTimeout(i,25))}}async readLocation(t){let n=await this.evaluate("location.href",2e3).catch(()=>null);return typeof n=="string"&&n.length>0?n:t}async evaluate(t,n=Qt){let r=await this.send("Runtime.evaluate",{expression:t,awaitPromise:!0,returnByValue:!0},n),o=r.exceptionDetails;if(o)throw new x(o.exception?.description??o.text??"evaluation threw");return r.result?.value}async content(){return await this.evaluate("document.documentElement ? document.documentElement.outerHTML : ''").catch(()=>"")??""}async inlineScripts(){return await this.evaluate('Array.from(document.querySelectorAll("script:not([src])")).map(function (s) { return s.textContent || ""; }).join("\\n")').catch(()=>"")??""}url(){return this.currentUrl}collectedScripts(){return this.scripts.slice()}viewportSize(){return this.viewport}async screenshot(t,n){try{let o=(await this.send("Page.captureScreenshot",{format:"jpeg",quality:t,captureBeyondViewport:!1},n)).data;return typeof o!="string"||o.length===0?null:Buffer.from(o,"base64")}catch{return null}}async close(){await this.connection.send("Target.disposeBrowserContext",{browserContextId:this.browserContextId}).catch(()=>{})}};function Lo(e){let t={};for(let[n,r]of Object.entries(e)){let o=n.toLowerCase(),i=r.split(`
40
40
  `).map(s=>s.trim()).filter(s=>s.length>0).join(", ");t[o]=t[o]===void 0?i:`${t[o]}, ${i}`}return t}function et(e){try{return new URL(e).host}catch{return""}}var Wo=new Set([2,3]),Do=8192,Bo=864e10;function Uo(e){if(typeof e!="string")return null;let t=e.trim();if(t.length===0||t.length>Do)return null;let n;try{n=Buffer.from(t,"base64")}catch{return null}if(n.length<=69||!Wo.has(n[0])||n.readUInt32BE(65)!==n.length-69)return null;let o;try{o=JSON.parse(n.subarray(69).toString("utf8"))}catch{return null}if(!o||typeof o!="object")return null;let i=o,s=i.origin,a=i.feature,c=i.expiry;return typeof s!="string"||typeof a!="string"||typeof c!="number"||!Number.isFinite(c)||c<0||c>Bo?null:{origin:s,feature:a,expiry:c,isSubdomain:i.isSubdomain===!0,isThirdParty:i.isThirdParty===!0}}function Jo(e){return e.toLowerCase().replace(/[^a-z]/g,"").includes("modelcontext")}function Fo(e,t,n){let r,o;try{r=new URL(e),o=new URL(t)}catch{return!1}if(r.protocol!==o.protocol)return!1;let i=r.hostname.toLowerCase(),s=o.hostname.toLowerCase();return i===s?!0:n&&s.endsWith(`.${i}`)}function en(e,t,n){let r=e.map(i=>i.trim()).filter(i=>i.length>0);if(r.length===0)return null;let o=null;for(let i of r){let s=Uo(i);if(!s)continue;let a=Jo(s.feature),c=s.expiry*1e3>n.getTime(),l=Fo(s.origin,t,s.isSubdomain),u=a&&c&&l,d=u?3:a?2:1;(!o||d>o.rank)&&(o={parsed:s,valid:u,rank:d})}return o?{present:!0,valid:o.valid,origin:o.parsed.origin,feature:o.parsed.feature,expiresAt:new Date(o.parsed.expiry*1e3).toISOString()}:{present:!0,valid:!1}}function tn(e){return e?e.split(",").map(t=>t.trim()).filter(t=>t.length>0):[]}var ot="capture-incomplete:";function Ho(e){return e.imperative!==null||e.polyfillPackages.length>0}function nn(e){return e.blocked?"blocked":e.loadError?"load-error":e.toolCount>0?e.nativeApi||e.originTrialValid||e.declarativeToolCount>0?"active":"testing-only":e.nativeApi?"api-empty":e.shimTakenOver||Ho(e.staticSignals)?"declared-inactive":"absent"}function rn(e,t){switch(e){case"blocked":return"waf-blocked";case"load-error":return"unreachable";case"active":case"testing-only":{let n=t.filter(r=>r.via==="imperative");return n.length>0&&n.every(r=>!r.hasExecute)?"stub-only":"ok"}case"api-empty":case"declared-inactive":case"absent":return"no-tools";default:return e}}var on={"shared-experience":30,"task-completion":25,"tool-quality":25,trust:20},it={"page-experience":{title:"Page experience",category:"shared-experience",weight:20,docSlug:"page-experience"},"human-parity":{title:"Human parity",category:"shared-experience",weight:10,docSlug:"human-parity"},"tool-selection":{title:"Tool selection",category:"task-completion",weight:15,docSlug:"tool-selection"},"coverage-vs-site-type":{title:"Coverage vs. site type",category:"task-completion",weight:10,docSlug:"coverage-vs-site-type"},"schema-validity":{title:"Schema validity",category:"tool-quality",weight:4,docSlug:"schema-validity"},"schema-quality":{title:"Schema quality",category:"tool-quality",weight:4,docSlug:"schema-quality"},"description-quality":{title:"Description quality",category:"tool-quality",weight:5,docSlug:"description-quality"},"stub-detection":{title:"Stub detection",category:"tool-quality",weight:4,docSlug:"stub-detection"},"canonical-entry-point":{title:"Canonical entry point",category:"tool-quality",weight:3,docSlug:"canonical-entry-point"},"naming-quality":{title:"Naming quality",category:"tool-quality",weight:2,docSlug:"naming-quality"},"registration-errors":{title:"Registration errors",category:"tool-quality",weight:2,docSlug:"registration-errors"},"registration-timing":{title:"Registration timing",category:"tool-quality",weight:1,docSlug:"registration-timing"},"annotations-present":{title:"Annotations present",category:"trust",weight:6,docSlug:"annotations-present"},"annotation-mismatch":{title:"Annotation mismatch",category:"trust",weight:6,docSlug:"annotation-mismatch"},"injection-surface":{title:"Injection surface",category:"trust",weight:4,docSlug:"injection-surface"},"untrusted-content-hint":{title:"Untrusted content hint",category:"trust",weight:4,docSlug:"untrusted-content-hint"}},X="1";function Go(e,t,n){return!!(t["cf-mitigated"]==="challenge"||e===403&&n.includes("cf-browser-verification")||e===503&&n.includes("challenge-platform"))}function sn(e,t,n){return!!(Go(e,t,n)||t["x-vercel-mitigated"]==="challenge"||"x-vercel-challenge-token"in t||n.includes("Vercel Security Checkpoint")||n.includes("vercel-challenge")||e===429&&n.length<2e3||e===403&&(n.includes("Access Denied")||n.includes("Bot Protection")))}var qo=100,cn=4096,Ko=32768,Vo=50,Yo=200,an="__oraWebmcpCapture",ln=`(function () {
41
41
  "use strict";
42
42
  try {
@@ -572,11 +572,11 @@ ${C.map(M=>` ${M.id.padEnd(12)} ${Ye(M)}`).join(`
572
572
  } catch (e) {
573
573
  return "error";
574
574
  }
575
- })()`;function vn(e,t){return e.filter(n=>!n.unregistered).map(n=>({name:n.name.slice(0,yn),description:n.description,via:"imperative",entryPoint:n.source==="provideContext"?"provideContext":n.entryPoint,pageUrl:t,inputSchema:n.inputSchema,annotations:li(n.annotations),hasExecute:n.hasExecute,registrationMs:n.registrationMs}))}function ci(e,t){return e.map(n=>({name:n.toolName.slice(0,yn),description:n.toolDescription,via:"declarative",entryPoint:"form",pageUrl:t,inputSchema:null,annotations:{},hasExecute:!0,registrationMs:null}))}function li(e){if(!e||typeof e!="object"||Array.isArray(e))return{};let t=e,n={};for(let r of["readOnlyHint","destructiveHint","idempotentHint","openWorldHint","untrustedContentHint"])typeof t[r]=="boolean"&&(n[r]=t[r]);return typeof t.title=="string"&&(n.title=t.title.slice(0,ri)),n}function ui(e){if(!e)return[];let t=[...e.registrationErrors];return e.takenOver.length>0&&t.push(`${ot} the page replaced modelContext on ${e.takenOver.join(", ")}, so imperative tools may be under-reported`),e.extraToolCount>0&&t.push(`${ot} the capture's tool cap was reached and ${e.extraToolCount} further registration attempts were not stored`),t}function di(e){if(!e)return null;for(let t of e.split(",")){let n=/^\s*([a-z0-9-]+)\s*=\s*(.*)$/i.exec(t);if(!n||!n[1].toLowerCase().replace(/-/g,"").includes("modelcontext"))continue;let r=n[2].trim().replace(/^\(|\)$/g,"").trim();return r==="*"?!0:r===""||r.toLowerCase()==="self"?!1:r.split(/\s+/).some(o=>o.toLowerCase()!=="self"&&o.length>0)}return null}async function pi(e,t,n,r){let o=Date.now(),i={finalUrl:t,navMs:0,blocked:!1,nativeApi:!1,originTrialTokens:[],permissionsPolicy:null,html:"",inlineJs:"",scripts:[],screenshot:null,loadError:null},s=null;try{s=await e.newContext({entryUrl:t,viewport:bn});let a;try{a=await s.goto(t,_e(n,fn))}catch(h){return{...i,navMs:Date.now()-o,loadError:Ae(h)}}let c=Date.now()-o;await s.waitForLoad(_e(n,5e3));let l=a?.headers??{},u=a?.status??0,d=(await s.content()).slice(0,ni),g=await s.inlineScripts(),p=await s.evaluate(si).catch(()=>null)??{},f=r?await yi(s,n):null;return{finalUrl:s.url(),navMs:c,blocked:sn(u,l,d),nativeApi:p.nativeApi===!0,originTrialTokens:[...tn(l["origin-trial"]),...Array.isArray(p.metaTokens)?p.metaTokens:[]],permissionsPolicy:l["permissions-policy"]??null,html:d,inlineJs:g,scripts:s.collectedScripts(),screenshot:f,loadError:null}}catch(a){return{...i,navMs:Date.now()-o,loadError:Ae(a)}}finally{await s?.close()}}async function mi(e,t,n,r,o){let i=null;try{i=await e.newContext({initScripts:[ln],entryUrl:t,viewport:bn});try{await i.goto(t,_e(r,fn))}catch(l){return{snapshot:null,declarative:null,quietMs:0,loadError:Ae(l)}}let s=await gi(i,n,r,o),a=await i.evaluate(wn).catch(()=>null),c=await i.evaluate(un).catch(()=>null);return{snapshot:a,declarative:c,quietMs:s,loadError:null}}catch(s){return{snapshot:null,declarative:null,quietMs:0,loadError:Ae(s)}}finally{await i?.close()}}async function gi(e,t,n,r){let o=Date.now(),i=Math.min(ti[t],Math.max(0,n-o)),s=null,a=o;for(;Date.now()-o<i;){let c=await e.evaluate(ai).catch(()=>null);if(c!==s)s=typeof c=="string"?c:null,a=Date.now(),r&&await hi(e,r);else if(Date.now()-a>=Zo)break;if(await wi(Math.min(ei,Math.max(0,n-Date.now()))),Date.now()>=n)break}return Date.now()-o}async function hi(e,t){let n=await e.evaluate(wn).catch(()=>null);n&&t(vn(n.tools,e.url()))}async function fi(e,t,n,r,o){let i=Date.now(),s=i+Qo,a=await pi(e,t,s,r),l=a.loadError!==null||a.blocked?{snapshot:null,declarative:null,quietMs:0,loadError:null}:await mi(e,t,n,s,o),u=a.loadError??l.loadError,d=l.snapshot,g=(l.declarative?.forms??[]).filter(ae=>ae.toolName.trim()!==""),p=a.finalUrl||t,f=d?vn(d.tools,p):[],h=ci(g,p),m=[...f,...h],y=bi(a.html,a.inlineJs,a.scripts),$=en(a.originTrialTokens,hn(p)??hn(t)??"",new Date),C={loadError:u,blocked:a.blocked,nativeApi:a.nativeApi,originTrialValid:$?.valid===!0,declarativeToolCount:h.length,toolCount:m.length,shimTakenOver:(d?.takenOver.length??0)>0,staticSignals:y},se=nn(C);return{page:{url:t,finalUrl:p,verdict:se,status:rn(se,m),tools:m,declarativeFormCount:h.length,consumer:{nativeApi:a.nativeApi,originTrial:$,permissionsPolicy:a.permissionsPolicy,iframeAllow:di(a.permissionsPolicy)},staticSignals:y,apiSurface:{toolchangeEvents:d?.toolchangeEvents??0,provideContextCalls:d?.provideContextCalls??0,registrationErrors:ui(d)},timing:{navMs:a.navMs,quietMs:l.quietMs,totalMs:Date.now()-i},error:u},screenshot:a.blocked?null:a.screenshot}}async function Sn(e){let{url:t,endpoint:n,mode:r="fast",screenshot:o=!0,onTools:i}=e,s=Date.now(),a=new Date().toISOString(),c=await $e.connect(n);try{let l=await fi(c,t,r,o,i);return{url:t,pages:[l.page],chromeVersion:c.product,shimVersion:X,capturedAt:a,durationMs:Date.now()-s,screenshot:l.screenshot}}finally{c.close()}}async function yi(e,t){let n=await e.screenshot(oi,_e(t,5e3));if(!n||n.byteLength===0||n.byteLength>ii)return null;let r=e.viewportSize();return{data:n.toString("base64"),mimeType:"image/jpeg",width:r?.width??0,height:r?.height??0}}function bi(e,t,n){if(!e)return gn;try{return mn(e,t,n)}catch{return gn}}function hn(e){try{return new URL(e).origin}catch{return null}}function Ae(e){return(e instanceof Error?e.message:String(e)).split(`
576
- `)[0].slice(0,300)}function _e(e,t){return Math.max(250,Math.min(t,e-Date.now()))}function wi(e){return new Promise(t=>setTimeout(t,e))}var xn=require("child_process"),W=require("fs"),$n=require("os"),at=require("path");var An=9222;async function _n(e){if(e)try{return{ok:!0,endpoint:await rt(e),close:async()=>{},launched:!1}}catch(t){let n=st(t);return{ok:!1,message:[`No debuggable Chrome answered at ${e}.`,...n.startsWith("no debuggable Chrome answered")?[]:[n],"",...vi(An)].join(`
575
+ })()`;function vn(e,t){return e.filter(n=>!n.unregistered).map(n=>({name:n.name.slice(0,yn),description:n.description,via:"imperative",entryPoint:n.source==="provideContext"?"provideContext":n.entryPoint,pageUrl:t,inputSchema:n.inputSchema,annotations:li(n.annotations),hasExecute:n.hasExecute,registrationMs:n.registrationMs}))}function ci(e,t){return e.map(n=>({name:n.toolName.slice(0,yn),description:n.toolDescription,via:"declarative",entryPoint:"form",pageUrl:t,inputSchema:null,annotations:{},hasExecute:!0,registrationMs:null}))}function li(e){if(!e||typeof e!="object"||Array.isArray(e))return{};let t=e,n={};for(let r of["readOnlyHint","destructiveHint","idempotentHint","openWorldHint","untrustedContentHint"])typeof t[r]=="boolean"&&(n[r]=t[r]);return typeof t.title=="string"&&(n.title=t.title.slice(0,ri)),n}function ui(e){if(!e)return[];let t=[...e.registrationErrors];return e.takenOver.length>0&&t.push(`${ot} the page replaced modelContext on ${e.takenOver.join(", ")}, so imperative tools may be under-reported`),e.extraToolCount>0&&t.push(`${ot} the capture's tool cap was reached and ${e.extraToolCount} further registration attempts were not stored`),t}function di(e){if(!e)return null;for(let t of e.split(",")){let n=/^\s*([a-z0-9-]+)\s*=\s*(.*)$/i.exec(t);if(!n||!n[1].toLowerCase().replace(/-/g,"").includes("modelcontext"))continue;let r=n[2].trim().replace(/^\(|\)$/g,"").trim();return r==="*"?!0:r===""||r.toLowerCase()==="self"?!1:r.split(/\s+/).some(o=>o.toLowerCase()!=="self"&&o.length>0)}return null}async function pi(e,t,n,r){let o=Date.now(),i={finalUrl:t,navMs:0,blocked:!1,nativeApi:!1,originTrialTokens:[],permissionsPolicy:null,html:"",inlineJs:"",scripts:[],screenshot:null,loadError:null},s=null;try{s=await e.newContext({entryUrl:t,viewport:bn});let a;try{a=await s.goto(t,_e(n,fn))}catch(h){return{...i,navMs:Date.now()-o,loadError:$e(h)}}let c=Date.now()-o;await s.waitForLoad(_e(n,5e3));let l=a?.headers??{},u=a?.status??0,d=(await s.content()).slice(0,ni),g=await s.inlineScripts(),p=await s.evaluate(si).catch(()=>null)??{},f=r?await yi(s,n):null;return{finalUrl:s.url(),navMs:c,blocked:sn(u,l,d),nativeApi:p.nativeApi===!0,originTrialTokens:[...tn(l["origin-trial"]),...Array.isArray(p.metaTokens)?p.metaTokens:[]],permissionsPolicy:l["permissions-policy"]??null,html:d,inlineJs:g,scripts:s.collectedScripts(),screenshot:f,loadError:null}}catch(a){return{...i,navMs:Date.now()-o,loadError:$e(a)}}finally{await s?.close()}}async function mi(e,t,n,r,o){let i=null;try{i=await e.newContext({initScripts:[ln],entryUrl:t,viewport:bn});try{await i.goto(t,_e(r,fn))}catch(l){return{snapshot:null,declarative:null,quietMs:0,loadError:$e(l)}}let s=await gi(i,n,r,o),a=await i.evaluate(wn).catch(()=>null),c=await i.evaluate(un).catch(()=>null);return{snapshot:a,declarative:c,quietMs:s,loadError:null}}catch(s){return{snapshot:null,declarative:null,quietMs:0,loadError:$e(s)}}finally{await i?.close()}}async function gi(e,t,n,r){let o=Date.now(),i=Math.min(ti[t],Math.max(0,n-o)),s=null,a=o;for(;Date.now()-o<i;){let c=await e.evaluate(ai).catch(()=>null);if(c!==s)s=typeof c=="string"?c:null,a=Date.now(),r&&await hi(e,r);else if(Date.now()-a>=Zo)break;if(await wi(Math.min(ei,Math.max(0,n-Date.now()))),Date.now()>=n)break}return Date.now()-o}async function hi(e,t){let n=await e.evaluate(wn).catch(()=>null);n&&t(vn(n.tools,e.url()))}async function fi(e,t,n,r,o){let i=Date.now(),s=i+Qo,a=await pi(e,t,s,r),l=a.loadError!==null||a.blocked?{snapshot:null,declarative:null,quietMs:0,loadError:null}:await mi(e,t,n,s,o),u=a.loadError??l.loadError,d=l.snapshot,g=(l.declarative?.forms??[]).filter(ae=>ae.toolName.trim()!==""),p=a.finalUrl||t,f=d?vn(d.tools,p):[],h=ci(g,p),m=[...f,...h],y=bi(a.html,a.inlineJs,a.scripts),A=en(a.originTrialTokens,hn(p)??hn(t)??"",new Date),C={loadError:u,blocked:a.blocked,nativeApi:a.nativeApi,originTrialValid:A?.valid===!0,declarativeToolCount:h.length,toolCount:m.length,shimTakenOver:(d?.takenOver.length??0)>0,staticSignals:y},se=nn(C);return{page:{url:t,finalUrl:p,verdict:se,status:rn(se,m),tools:m,declarativeFormCount:h.length,consumer:{nativeApi:a.nativeApi,originTrial:A,permissionsPolicy:a.permissionsPolicy,iframeAllow:di(a.permissionsPolicy)},staticSignals:y,apiSurface:{toolchangeEvents:d?.toolchangeEvents??0,provideContextCalls:d?.provideContextCalls??0,registrationErrors:ui(d)},timing:{navMs:a.navMs,quietMs:l.quietMs,totalMs:Date.now()-i},error:u},screenshot:a.blocked?null:a.screenshot}}async function Sn(e){let{url:t,endpoint:n,mode:r="fast",screenshot:o=!0,onTools:i}=e,s=Date.now(),a=new Date().toISOString(),c=await Ae.connect(n);try{let l=await fi(c,t,r,o,i);return{url:t,pages:[l.page],chromeVersion:c.product,shimVersion:X,capturedAt:a,durationMs:Date.now()-s,screenshot:l.screenshot}}finally{c.close()}}async function yi(e,t){let n=await e.screenshot(oi,_e(t,5e3));if(!n||n.byteLength===0||n.byteLength>ii)return null;let r=e.viewportSize();return{data:n.toString("base64"),mimeType:"image/jpeg",width:r?.width??0,height:r?.height??0}}function bi(e,t,n){if(!e)return gn;try{return mn(e,t,n)}catch{return gn}}function hn(e){try{return new URL(e).origin}catch{return null}}function $e(e){return(e instanceof Error?e.message:String(e)).split(`
576
+ `)[0].slice(0,300)}function _e(e,t){return Math.max(250,Math.min(t,e-Date.now()))}function wi(e){return new Promise(t=>setTimeout(t,e))}var xn=require("child_process"),W=require("fs"),An=require("os"),at=require("path");var $n=9222;async function _n(e){if(e)try{return{ok:!0,endpoint:await rt(e),close:async()=>{},launched:!1}}catch(t){let n=st(t);return{ok:!1,message:[`No debuggable Chrome answered at ${e}.`,...n.startsWith("no debuggable Chrome answered")?[]:[n],"",...vi($n)].join(`
577
577
  `)}}try{let t=await Ei();return{ok:!0,endpoint:t.endpoint,close:t.close,launched:!0}}catch(t){return{ok:!1,message:st(t)}}}function Rn(e){return e.pages.some(t=>t.consumer.nativeApi)?["This Chrome provides WebMCP itself. ora captures with a browser that does not,","so anything that depended on the browser rather than on your page can read","differently there.","","Where that actually changed a result, ora says so in the availability reason","above - read that rather than this. This notice only reports what the browser","did, because deciding whether it changed the outcome is ora's job, not the","CLI's.","","If you started Chrome with --enable-features=WebMCPTesting, drop the flag (or","omit --chrome-endpoint and let this command start its own).","","Keep a flag-enabled Chrome for `npx @ora-ai/webmcp-verify`, which needs the API","present in order to call your tools."].join(`
578
- `):null}function vi(e){return["The audit drives a Chrome you already have; it never downloads one.","Start one with a debugging port and a scratch profile:","",` ${Cn(e)}`,"","Then re-run this command. Point at a different one with --chrome-endpoint.","","Do not add --enable-features=WebMCPTesting: the audit measures whether a","real browser gives an agent WebMCP on your page, and a browser that","provides it itself answers yes for every site."]}function Cn(e){let t=process.platform==="darwin"?'"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"':process.platform==="win32"?'"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"':"google-chrome",n=process.platform==="win32"?"%TEMP%\\ax-webmcp":"/tmp/ax-webmcp";return`${t} --remote-debugging-port=${e} --user-data-dir=${n}`}function st(e){return e instanceof x||e instanceof Error?e.message:String(e)}function Si(){let e=process.env.CHROME_PATH;return e?[e]:process.platform==="darwin"?["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Chromium.app/Contents/MacOS/Chromium","/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"]:process.platform==="win32"?[process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"],process.env.LOCALAPPDATA].filter(n=>!!n).map(n=>`${n}\\Google\\Chrome\\Application\\chrome.exe`):["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/chromium","/usr/bin/chromium-browser","/opt/google/chrome/chrome","/snap/bin/chromium"]}function ki(){for(let e of Si())try{if((0,W.statSync)(e).isFile())return e}catch{}return null}var xi=["--headless=new","--disable-gpu","--mute-audio","--no-first-run","--no-default-browser-check","--disable-background-networking","--disable-sync","--disable-extensions","--force-webrtc-ip-handling-policy=disable_non_proxied_udp"];function $i(){return process.env.AX_WEBMCP_NO_SANDBOX==="1"}var kn=2e4,Ai=3e3,_i=4,Ri=150;function Ci(e,t){return e.exitCode!==null||e.signalCode!==null?Promise.resolve():new Promise(n=>{let r=()=>{clearTimeout(o),e.off("exit",r),n()},o=setTimeout(r,t);e.once("exit",r)})}async function Ei(){let e=ki();if(!e)throw new x(Ii());let t=(0,W.mkdtempSync)((0,at.join)((0,$n.tmpdir)(),"ax-webmcp-")),n=(0,xn.spawn)(e,[...xi,...$i()?["--no-sandbox"]:[],"--remote-debugging-port=0",`--user-data-dir=${t}`,"about:blank"],{stdio:"ignore",detached:!0}),r=i=>{o().finally(()=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r),process.kill(process.pid,i)})},o=async()=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r);let i=n.pid;try{i!==void 0?process.kill(-i,"SIGTERM"):n.kill("SIGTERM")}catch{try{n.kill("SIGTERM")}catch{}}await Ci(n,Ai),await Pi(t)};process.once("SIGINT",r),process.once("SIGTERM",r);try{let i=await Ti(t,n);return{endpoint:await rt(`127.0.0.1:${i}`),close:o}}catch(i){throw await o(),i instanceof x?i:new x(st(i))}}async function Ti(e,t){let n=(0,at.join)(e,"DevToolsActivePort"),r=Date.now()+kn;for(;Date.now()<r;){if(t.exitCode!==null)throw new x(`Chrome exited with code ${t.exitCode} before it was ready.`);try{let o=(0,W.readFileSync)(n,"utf8").split(`
579
- `)[0]?.trim(),i=Number(o);if(Number.isInteger(i)&&i>0)return i}catch{}await new Promise(o=>setTimeout(o,100))}throw new x(`Chrome did not publish a debugging port within ${kn/1e3}s.`)}async function Pi(e){for(let t=0;t<_i;t++){try{if((0,W.rmSync)(e,{recursive:!0,force:!0}),!(0,W.existsSync)(e))return}catch{}await new Promise(n=>setTimeout(n,Ri))}try{(0,W.rmSync)(e,{recursive:!0,force:!0})}catch{}}function Ii(){return["No Chrome found on this machine.","","The audit opens your page in a real browser, because WebMCP tools only","exist inside a live page. This package never downloads one.","","Install Chrome (https://google.com/chrome), or point at one you already","have with CHROME_PATH=/path/to/chrome, or start one yourself and pass","--chrome-endpoint:","",` ${Cn(An)}`].join(`
578
+ `):null}function vi(e){return["The audit drives a Chrome you already have; it never downloads one.","Start one with a debugging port and a scratch profile:","",` ${Cn(e)}`,"","Then re-run this command. Point at a different one with --chrome-endpoint.","","Do not add --enable-features=WebMCPTesting: the audit measures whether a","real browser gives an agent WebMCP on your page, and a browser that","provides it itself answers yes for every site."]}function Cn(e){let t=process.platform==="darwin"?'"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"':process.platform==="win32"?'"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"':"google-chrome",n=process.platform==="win32"?"%TEMP%\\ax-webmcp":"/tmp/ax-webmcp";return`${t} --remote-debugging-port=${e} --user-data-dir=${n}`}function st(e){return e instanceof x||e instanceof Error?e.message:String(e)}function Si(){let e=process.env.CHROME_PATH;return e?[e]:process.platform==="darwin"?["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Chromium.app/Contents/MacOS/Chromium","/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"]:process.platform==="win32"?[process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"],process.env.LOCALAPPDATA].filter(n=>!!n).map(n=>`${n}\\Google\\Chrome\\Application\\chrome.exe`):["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/chromium","/usr/bin/chromium-browser","/opt/google/chrome/chrome","/snap/bin/chromium"]}function ki(){for(let e of Si())try{if((0,W.statSync)(e).isFile())return e}catch{}return null}var xi=["--headless=new","--disable-gpu","--mute-audio","--no-first-run","--no-default-browser-check","--disable-background-networking","--disable-sync","--disable-extensions","--force-webrtc-ip-handling-policy=disable_non_proxied_udp"];function Ai(){return process.env.AX_WEBMCP_NO_SANDBOX==="1"}var kn=2e4,$i=3e3,_i=4,Ri=150;function Ci(e,t){return e.exitCode!==null||e.signalCode!==null?Promise.resolve():new Promise(n=>{let r=()=>{clearTimeout(o),e.off("exit",r),n()},o=setTimeout(r,t);e.once("exit",r)})}async function Ei(){let e=ki();if(!e)throw new x(Ii());let t=(0,W.mkdtempSync)((0,at.join)((0,An.tmpdir)(),"ax-webmcp-")),n=(0,xn.spawn)(e,[...xi,...Ai()?["--no-sandbox"]:[],"--remote-debugging-port=0",`--user-data-dir=${t}`,"about:blank"],{stdio:"ignore",detached:!0}),r=i=>{o().finally(()=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r),process.kill(process.pid,i)})},o=async()=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r);let i=n.pid;try{i!==void 0?process.kill(-i,"SIGTERM"):n.kill("SIGTERM")}catch{try{n.kill("SIGTERM")}catch{}}await Ci(n,$i),await Pi(t)};process.once("SIGINT",r),process.once("SIGTERM",r);try{let i=await Ti(t,n);return{endpoint:await rt(`127.0.0.1:${i}`),close:o}}catch(i){throw await o(),i instanceof x?i:new x(st(i))}}async function Ti(e,t){let n=(0,at.join)(e,"DevToolsActivePort"),r=Date.now()+kn;for(;Date.now()<r;){if(t.exitCode!==null)throw new x(`Chrome exited with code ${t.exitCode} before it was ready.`);try{let o=(0,W.readFileSync)(n,"utf8").split(`
579
+ `)[0]?.trim(),i=Number(o);if(Number.isInteger(i)&&i>0)return i}catch{}await new Promise(o=>setTimeout(o,100))}throw new x(`Chrome did not publish a debugging port within ${kn/1e3}s.`)}async function Pi(e){for(let t=0;t<_i;t++){try{if((0,W.rmSync)(e,{recursive:!0,force:!0}),!(0,W.existsSync)(e))return}catch{}await new Promise(n=>setTimeout(n,Ri))}try{(0,W.rmSync)(e,{recursive:!0,force:!0})}catch{}}function Ii(){return["No Chrome found on this machine.","","The audit opens your page in a real browser, because WebMCP tools only","exist inside a live page. This package never downloads one.","","Install Chrome (https://google.com/chrome), or point at one you already","have with CHROME_PATH=/path/to/chrome, or start one yourself and pass","--chrome-endpoint:","",` ${Cn($n)}`].join(`
580
580
  `)}var Mi="https://ora.ai",Oi=12e4,I=class extends Error{code;retryAfterMs;constructor(t,n={}){super(t),this.name="WebmcpIngestError",this.code=n.code??null,this.retryAfterMs=n.retryAfterMs??null}},En=4*1024*1024,Tn=10,Pn=100,In=32768,Mn=4096,On=512;function Nn(e){if(e.shimVersion!==X)return`this build captures with shim version ${e.shimVersion}, which is not the version it was built against (${X})`;if(e.pages.length>Tn)return`capture covers ${e.pages.length} pages; the limit is ${Tn}`;for(let t of e.pages){if(t.tools.length>Pn)return`${t.url} registered ${t.tools.length} tools; the limit is ${Pn} per page`;for(let n of t.tools){if(n.name.length>On)return`tool name on ${t.url} is ${n.name.length} characters; the limit is ${On}`;if(n.description.length>Mn)return`description for "${n.name}" is ${n.description.length} characters; the limit is ${Mn}`;for(let[r,o]of[["inputSchema",n.inputSchema],["annotations",n.annotations]]){let i=Ni(o);if(i===null)return`${r} for "${n.name}" could not be serialized (a cycle, or a value JSON cannot carry)`;if(i.length>In)return`${r} for "${n.name}" serializes to ${i.length} characters; the limit is ${In}`}}}return null}function jn(e){let t=e.screenshot;if(!t)return{capture:e,droppedScreenshot:!1};let n=t.data.length>2*1024*1024,r=t.mimeType!=="image/jpeg";return!n&&!r?{capture:e,droppedScreenshot:!1}:{capture:{...e,screenshot:null},droppedScreenshot:!0}}function Ni(e){try{return JSON.stringify(e)??"null"}catch{return null}}async function Ln(e,t,n={}){let r=(n.baseUrl??process.env.ORA_API_URL??Mi).replace(/\/+$/,""),o=n.idleMs??Oi,i=F(o),s=()=>new I(`ora scoring timed out \u2014 no progress for ${Math.round(o/1e3)}s`),a=JSON.stringify({url:e,capture:t});if(Buffer.byteLength(a,"utf8")>En)throw i.disarm(),new I(`this capture serializes to ${Math.round(Buffer.byteLength(a,"utf8")/1024)} KB; the ingest limit is ${En/1024/1024} MB`,{code:"BODY_TOO_LARGE"});let c;try{c=await fetch(`${r}/api/webmcp/audit/ingest`,{method:"POST",headers:{accept:"text/event-stream","content-type":"application/json",...n.apiKey?{authorization:`Bearer ${n.apiKey}`}:{}},body:a,signal:i.signal})}catch(l){throw i.disarm(),i.tripped()?s():new I(`ora ingest request failed: ${l instanceof Error?l.message:String(l)}`)}if(!c.ok||!c.body)throw i.disarm(),await ji(c);return Li(c,i,n,s)}async function ji(e){let t=await e.clone().json().catch(()=>null),n=t?.code??null;if(e.status===429){let r=Number(e.headers.get("retry-after")),o=t?.retry_after_ms??(Number.isFinite(r)&&r>0?r*1e3:null),i=o?` \u2014 retry in ${Math.ceil(o/1e3)}s`:"";return new I(`ora rate limit exceeded${i} (10/min and 20 per 24h per IP). An ora API key lifts these limits: set ORA_API_KEY or pass --api-key.`,{code:n??"RATE_LIMITED",retryAfterMs:o})}return n==="SHIM_VERSION_MISMATCH"?new I(`This ax build captures with a shim ora no longer scores, so the audit was refused.
581
581
  Upgrade with \`npm i -g ax@latest\` (or \`npx ax@latest webmcp-audit \u2026\`) and run it again.
582
582
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ax",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Score any site's agent readiness and watch real AI agents navigate it — powered by ora",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.34.5",
@@ -16,7 +16,10 @@
16
16
  },
17
17
  "main": "./dist/index.cjs",
18
18
  "types": "./dist/index.d.ts",
19
- "files": ["dist", ".env.example"],
19
+ "files": [
20
+ "dist",
21
+ ".env.example"
22
+ ],
20
23
  "engines": {
21
24
  "node": ">=22.4.0"
22
25
  },
@@ -51,10 +54,21 @@
51
54
  "access": "public"
52
55
  },
53
56
  "pnpm": {
54
- "onlyBuiltDependencies": ["@biomejs/biome", "esbuild"]
57
+ "onlyBuiltDependencies": [
58
+ "@biomejs/biome",
59
+ "esbuild"
60
+ ],
61
+ "overrides": {
62
+ "undici@<6.28.0": "^6.28.0"
63
+ }
55
64
  },
56
65
  "license": "MIT",
57
- "homepage": "https://ora.ai",
66
+ "author": {
67
+ "name": "Era AI Labs",
68
+ "url": "https://ora.ai"
69
+ },
70
+ "homepage": "https://ora.ai/docs#cli",
71
+ "bugs": "https://github.com/ora/ax/issues",
58
72
  "repository": {
59
73
  "type": "git",
60
74
  "url": "git+https://github.com/ora/ax.git"