ax 0.7.0 → 0.7.2
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.
- package/dist/api/deep-journey.d.ts +7 -1
- package/dist/contract/types.gen.d.ts +89 -8
- package/dist/contract/version.d.ts +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.js +2 -1
- package/dist/main.cjs +59 -59
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JourneyRun, JourneyRunDetail } from "../contract";
|
|
1
|
+
import type { JourneyRun, JourneyRunDetail, JourneyTrajectoryStep } from "../contract";
|
|
2
2
|
/** Any failure to obtain a run from ora: network, HTTP, rate limit, stream error. */
|
|
3
3
|
export declare class DeepJourneyApiError extends Error {
|
|
4
4
|
}
|
|
@@ -45,6 +45,12 @@ export interface DeepJourneyOptions {
|
|
|
45
45
|
model: string;
|
|
46
46
|
/** Receives one-line progress updates while the run streams/polls. */
|
|
47
47
|
progress?: (line: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Receives the cumulative trajectory on every `trajectory` frame - the raw
|
|
50
|
+
* material the caller redraws the live attribution graph from. Streaming
|
|
51
|
+
* only; polling has no per-step frames to hand back.
|
|
52
|
+
*/
|
|
53
|
+
onTrajectory?: (steps: JourneyTrajectoryStep[]) => void;
|
|
48
54
|
/** Base URL override; otherwise $ORA_API_URL, otherwise https://ora.ai. */
|
|
49
55
|
baseUrl?: string;
|
|
50
56
|
/** Abort when the stream is silent for this long (default 120s). */
|
|
@@ -424,7 +424,7 @@ export interface components {
|
|
|
424
424
|
* @description The contract version this payload conforms to. SemVer: a major means a response-envelope break - a stable field removed, renamed, or changed in meaning, or the default response format flipping - and is safe to pin. Additive changes and check-catalog membership changes ship on a minor. See docs/api.md -> Contract and versioning.
|
|
425
425
|
* @enum {string}
|
|
426
426
|
*/
|
|
427
|
-
contractVersion: "1.
|
|
427
|
+
contractVersion: "1.24.0";
|
|
428
428
|
/**
|
|
429
429
|
* @description Present only when this body is a stored result served by the freshness gate instead of a fresh scan. Absent on a live scan.
|
|
430
430
|
* @enum {boolean}
|
|
@@ -623,7 +623,7 @@ export interface components {
|
|
|
623
623
|
* @description The contract version this payload conforms to. SemVer: a major means a response-envelope break - a stable field removed, renamed, or changed in meaning, or the default response format flipping - and is safe to pin. Additive changes and check-catalog membership changes ship on a minor. See docs/api.md -> Contract and versioning.
|
|
624
624
|
* @enum {string}
|
|
625
625
|
*/
|
|
626
|
-
contractVersion: "1.
|
|
626
|
+
contractVersion: "1.24.0";
|
|
627
627
|
/** @description Wall-clock duration of the scan that produced this stored result */
|
|
628
628
|
durationMs: number | null;
|
|
629
629
|
/**
|
|
@@ -667,7 +667,7 @@ export interface components {
|
|
|
667
667
|
* @description The contract version this catalog conforms to - identical to the OpenAPI info.version and the MCP server version. SemVer: a major means a response-envelope break (a stable field, or a layer id, removed or renamed or changed in meaning, or the default response format flipping) and is safe to pin; check-catalog membership changes ship on a minor. The full versioning policy is published in the API description at /api/openapi.json.
|
|
668
668
|
* @enum {string}
|
|
669
669
|
*/
|
|
670
|
-
contractVersion: "1.
|
|
670
|
+
contractVersion: "1.24.0";
|
|
671
671
|
/** @description The four scored layers in scoring order, with display name and current weight. */
|
|
672
672
|
layers: {
|
|
673
673
|
/** @description Stable layer id: discovery, accessibility, usability, or payments. Removing or renaming a layer id is a major version change. Note one intentional divergence: the id 'accessibility' carries the display name 'Access'. */
|
|
@@ -766,7 +766,7 @@ export interface components {
|
|
|
766
766
|
* @description The contract version this response conforms to - identical to the OpenAPI info.version and the MCP server version. The full versioning policy is published in the API description at /api/openapi.json.
|
|
767
767
|
* @enum {string}
|
|
768
768
|
*/
|
|
769
|
-
contractVersion: "1.
|
|
769
|
+
contractVersion: "1.24.0";
|
|
770
770
|
/** @description The apex domain derived from the requested URL. */
|
|
771
771
|
domain: string;
|
|
772
772
|
/** @description The normalized URL the run targeted. */
|
|
@@ -1120,7 +1120,7 @@ export interface components {
|
|
|
1120
1120
|
};
|
|
1121
1121
|
/** @description Flat per-run signal summary. Experimental; absent on legacy runs. */
|
|
1122
1122
|
run_signals?: {
|
|
1123
|
-
/** @description run_signals contract version (
|
|
1123
|
+
/** @description run_signals contract version (4 = current; answer_grounding/answer_efficiency present from v4) */
|
|
1124
1124
|
version: number;
|
|
1125
1125
|
/** @description Engine-classified intent category */
|
|
1126
1126
|
intent_category: string;
|
|
@@ -1179,6 +1179,33 @@ export interface components {
|
|
|
1179
1179
|
page_role?: string;
|
|
1180
1180
|
};
|
|
1181
1181
|
};
|
|
1182
|
+
/** @description Answer grounding: how much of the answer is based on the target site itself. Derived from the judge's answer-source steps. Added in run_signals v4. */
|
|
1183
|
+
answer_grounding?: {
|
|
1184
|
+
/** @description Share of the answer's sources that are pages on the target site (0..1); null when no graded sources */
|
|
1185
|
+
on_site_ratio: number | null;
|
|
1186
|
+
sources_total: number;
|
|
1187
|
+
on_site: number;
|
|
1188
|
+
third_party: number;
|
|
1189
|
+
/** @description External hosts the answer was built from */
|
|
1190
|
+
third_party_hosts: string[];
|
|
1191
|
+
};
|
|
1192
|
+
/** @description Share of the run's fetches that fed the answer (0..1). Added in run_signals v4. */
|
|
1193
|
+
answer_efficiency?: number | null;
|
|
1194
|
+
/** @description Judge-tagged answer-section source counts. Added in run_signals v4. */
|
|
1195
|
+
answer_basis?: {
|
|
1196
|
+
sections_total: number;
|
|
1197
|
+
/** @description Sections carried by fetched pages on the target site */
|
|
1198
|
+
from_site: number;
|
|
1199
|
+
/** @description Sections carried by fetched third-party pages */
|
|
1200
|
+
from_external: number;
|
|
1201
|
+
/** @description Sections carried only by search-result snippets */
|
|
1202
|
+
from_search: number;
|
|
1203
|
+
from_memory: number;
|
|
1204
|
+
/** @description Share of answer sections whose substance came from the target site's own pages (0..1) — the headline 'answer from your site' metric */
|
|
1205
|
+
site_share: number;
|
|
1206
|
+
/** @description Share of answer sections whose substance came from the model's own knowledge rather than retrieved material (0..1) */
|
|
1207
|
+
memory_share: number;
|
|
1208
|
+
};
|
|
1182
1209
|
/** @description Journey-taxonomy layers (5), distinct from the audit report's 4 scoring layers. Falls back to insight.journey_layers on v1/v2 signals; absent when the run was never classified. */
|
|
1183
1210
|
journey_layers?: ("discovery" | "identity" | "access" | "payments" | "experience")[];
|
|
1184
1211
|
};
|
|
@@ -1380,7 +1407,7 @@ export interface components {
|
|
|
1380
1407
|
};
|
|
1381
1408
|
/** @description Flat per-run signal summary. Experimental; absent on legacy runs. */
|
|
1382
1409
|
run_signals?: {
|
|
1383
|
-
/** @description run_signals contract version (
|
|
1410
|
+
/** @description run_signals contract version (4 = current; answer_grounding/answer_efficiency present from v4) */
|
|
1384
1411
|
version: number;
|
|
1385
1412
|
/** @description Engine-classified intent category */
|
|
1386
1413
|
intent_category: string;
|
|
@@ -1439,6 +1466,33 @@ export interface components {
|
|
|
1439
1466
|
page_role?: string;
|
|
1440
1467
|
};
|
|
1441
1468
|
};
|
|
1469
|
+
/** @description Answer grounding: how much of the answer is based on the target site itself. Derived from the judge's answer-source steps. Added in run_signals v4. */
|
|
1470
|
+
answer_grounding?: {
|
|
1471
|
+
/** @description Share of the answer's sources that are pages on the target site (0..1); null when no graded sources */
|
|
1472
|
+
on_site_ratio: number | null;
|
|
1473
|
+
sources_total: number;
|
|
1474
|
+
on_site: number;
|
|
1475
|
+
third_party: number;
|
|
1476
|
+
/** @description External hosts the answer was built from */
|
|
1477
|
+
third_party_hosts: string[];
|
|
1478
|
+
};
|
|
1479
|
+
/** @description Share of the run's fetches that fed the answer (0..1). Added in run_signals v4. */
|
|
1480
|
+
answer_efficiency?: number | null;
|
|
1481
|
+
/** @description Judge-tagged answer-section source counts. Added in run_signals v4. */
|
|
1482
|
+
answer_basis?: {
|
|
1483
|
+
sections_total: number;
|
|
1484
|
+
/** @description Sections carried by fetched pages on the target site */
|
|
1485
|
+
from_site: number;
|
|
1486
|
+
/** @description Sections carried by fetched third-party pages */
|
|
1487
|
+
from_external: number;
|
|
1488
|
+
/** @description Sections carried only by search-result snippets */
|
|
1489
|
+
from_search: number;
|
|
1490
|
+
from_memory: number;
|
|
1491
|
+
/** @description Share of answer sections whose substance came from the target site's own pages (0..1) — the headline 'answer from your site' metric */
|
|
1492
|
+
site_share: number;
|
|
1493
|
+
/** @description Share of answer sections whose substance came from the model's own knowledge rather than retrieved material (0..1) */
|
|
1494
|
+
memory_share: number;
|
|
1495
|
+
};
|
|
1442
1496
|
/** @description Journey-taxonomy layers (5), distinct from the audit report's 4 scoring layers. Falls back to insight.journey_layers on v1/v2 signals; absent when the run was never classified. */
|
|
1443
1497
|
journey_layers?: ("discovery" | "identity" | "access" | "payments" | "experience")[];
|
|
1444
1498
|
};
|
|
@@ -1723,7 +1777,7 @@ export interface components {
|
|
|
1723
1777
|
};
|
|
1724
1778
|
/** @description Flat per-run signal summary. Experimental; absent on legacy runs. */
|
|
1725
1779
|
run_signals?: {
|
|
1726
|
-
/** @description run_signals contract version (
|
|
1780
|
+
/** @description run_signals contract version (4 = current; answer_grounding/answer_efficiency present from v4) */
|
|
1727
1781
|
version: number;
|
|
1728
1782
|
/** @description Engine-classified intent category */
|
|
1729
1783
|
intent_category: string;
|
|
@@ -1782,6 +1836,33 @@ export interface components {
|
|
|
1782
1836
|
page_role?: string;
|
|
1783
1837
|
};
|
|
1784
1838
|
};
|
|
1839
|
+
/** @description Answer grounding: how much of the answer is based on the target site itself. Derived from the judge's answer-source steps. Added in run_signals v4. */
|
|
1840
|
+
answer_grounding?: {
|
|
1841
|
+
/** @description Share of the answer's sources that are pages on the target site (0..1); null when no graded sources */
|
|
1842
|
+
on_site_ratio: number | null;
|
|
1843
|
+
sources_total: number;
|
|
1844
|
+
on_site: number;
|
|
1845
|
+
third_party: number;
|
|
1846
|
+
/** @description External hosts the answer was built from */
|
|
1847
|
+
third_party_hosts: string[];
|
|
1848
|
+
};
|
|
1849
|
+
/** @description Share of the run's fetches that fed the answer (0..1). Added in run_signals v4. */
|
|
1850
|
+
answer_efficiency?: number | null;
|
|
1851
|
+
/** @description Judge-tagged answer-section source counts. Added in run_signals v4. */
|
|
1852
|
+
answer_basis?: {
|
|
1853
|
+
sections_total: number;
|
|
1854
|
+
/** @description Sections carried by fetched pages on the target site */
|
|
1855
|
+
from_site: number;
|
|
1856
|
+
/** @description Sections carried by fetched third-party pages */
|
|
1857
|
+
from_external: number;
|
|
1858
|
+
/** @description Sections carried only by search-result snippets */
|
|
1859
|
+
from_search: number;
|
|
1860
|
+
from_memory: number;
|
|
1861
|
+
/** @description Share of answer sections whose substance came from the target site's own pages (0..1) — the headline 'answer from your site' metric */
|
|
1862
|
+
site_share: number;
|
|
1863
|
+
/** @description Share of answer sections whose substance came from the model's own knowledge rather than retrieved material (0..1) */
|
|
1864
|
+
memory_share: number;
|
|
1865
|
+
};
|
|
1785
1866
|
/** @description Journey-taxonomy layers (5), distinct from the audit report's 4 scoring layers. Falls back to insight.journey_layers on v1/v2 signals; absent when the run was never classified. */
|
|
1786
1867
|
journey_layers?: ("discovery" | "identity" | "access" | "payments" | "experience")[];
|
|
1787
1868
|
};
|
|
@@ -2974,7 +3055,7 @@ export interface operations {
|
|
|
2974
3055
|
* @description Curated intent to execute (GET /api/journey/intents lists them with labels)
|
|
2975
3056
|
* @enum {string}
|
|
2976
3057
|
*/
|
|
2977
|
-
intent_id: "pricing" | "
|
|
3058
|
+
intent_id: "pricing" | "integrate" | "api-docs" | "signup" | "support" | "evaluate" | "discover-trust" | "agent-access" | "understand-offering" | "find-integration" | "inspect-integration" | "production-readiness" | "authenticate" | "transact" | "act-for-user" | "operate-site";
|
|
2978
3059
|
/**
|
|
2979
3060
|
* @description Target domain (e.g. stripe.com). Validated like a scan target: IP literals, localhost, and malformed hosts are rejected with code INVALID_DOMAIN.
|
|
2980
3061
|
* @example stripe.com
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The ora contract version (spec info.version) these types were generated from. */
|
|
2
|
-
export declare const BUILT_AGAINST = "1.
|
|
2
|
+
export declare const BUILT_AGAINST = "1.24.0";
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ __export(src_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(src_exports);
|
|
36
36
|
|
|
37
37
|
// src/contract/version.ts
|
|
38
|
-
var BUILT_AGAINST = "1.
|
|
38
|
+
var BUILT_AGAINST = "1.24.0";
|
|
39
39
|
|
|
40
40
|
// src/contract/index.ts
|
|
41
41
|
function minor(version) {
|
|
@@ -435,6 +435,7 @@ async function followJourneyStream(base, streamPath, options) {
|
|
|
435
435
|
const steps = payload.steps ?? [];
|
|
436
436
|
const active = steps.filter((s) => s.type === "tool_call").at(-1);
|
|
437
437
|
options.progress?.(`step ${steps.length} \xB7 ${activityLabel(active ?? steps.at(-1))}`);
|
|
438
|
+
options.onTrajectory?.(steps);
|
|
438
439
|
} else if (decoded.event === "processing") {
|
|
439
440
|
options.progress?.(
|
|
440
441
|
typeof payload.message === "string" ? payload.message : "generating insights\u2026"
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/contract/version.ts
|
|
2
|
-
var BUILT_AGAINST = "1.
|
|
2
|
+
var BUILT_AGAINST = "1.24.0";
|
|
3
3
|
|
|
4
4
|
// src/contract/index.ts
|
|
5
5
|
function minor(version) {
|
|
@@ -399,6 +399,7 @@ async function followJourneyStream(base, streamPath, options) {
|
|
|
399
399
|
const steps = payload.steps ?? [];
|
|
400
400
|
const active = steps.filter((s) => s.type === "tool_call").at(-1);
|
|
401
401
|
options.progress?.(`step ${steps.length} \xB7 ${activityLabel(active ?? steps.at(-1))}`);
|
|
402
|
+
options.onTrajectory?.(steps);
|
|
402
403
|
} else if (decoded.event === "processing") {
|
|
403
404
|
options.progress?.(
|
|
404
405
|
typeof payload.message === "string" ? payload.message : "generating insights\u2026"
|
package/dist/main.cjs
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`)}function
|
|
4
|
-
`)}catch(n){console.error(n)}}var
|
|
5
|
-
`)}function
|
|
6
|
-
`),process.exit(1)}}async function
|
|
7
|
-
`))}function
|
|
8
|
-
`);let
|
|
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(`
|
|
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.2",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/eralabs-ai/ora-cli.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,`
|
|
8
|
+
`);let p=l.indexOf(`
|
|
9
9
|
|
|
10
|
-
`);for(;
|
|
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
|
|
15
|
-
`))}function
|
|
16
|
-
output: ${
|
|
17
|
-
`)),
|
|
18
|
-
`);else for(let
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
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(`
|
|
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
|
+
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)}
|
|
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
|
+
`),P.OK;if(g.score<n.value)return e.json||console.log(` Score ${g.score} is below the required minimum ${n.value}
|
|
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(`
|
|
21
21
|
`))r.startsWith(":")||(r.startsWith("event:")?t=r.slice(6).trim():r.startsWith("data:")&&n.push(r.slice(5).replace(/^ /,"")));return n.length?{event:t,data:n.join(`
|
|
22
|
-
`)}:null}async function
|
|
23
|
-
`);let
|
|
22
|
+
`)}:null}async function Kr(e,t,n,r,o){let i=n.startsWith("http")?n:`${e}${n}`,s=F(o),a=await fetch(i,{headers:{authorization:`Bearer ${t}`,accept:"text/event-stream"},signal:s.signal});if(!a.ok||!a.body)throw s.disarm(),new Error(`ora run stream failed (${a.status})`);let c=new TextDecoder,l={steps:[],trajectory:[]},u="";try{e:for await(let d of a.body){s.poke(),u=`${u}${c.decode(d,{stream:!0})}`.replace(/\r\n?/g,`
|
|
23
|
+
`);let g=u.indexOf(`
|
|
24
24
|
|
|
25
|
-
`);for(;
|
|
25
|
+
`);for(;g!==-1;){let p=Je(u.slice(0,g));if(u=u.slice(g+2),g=u.indexOf(`
|
|
26
26
|
|
|
27
|
-
`),!
|
|
28
|
-
`);let
|
|
27
|
+
`),!p)continue;let f;try{f=JSON.parse(p.data)}catch{continue}if(Vr(l,p.event,f,r),l.summary&&l.insight)break e}}}catch(d){throw s.tripped()?new Error(`ora run stream timed out after ${o}ms of silence`):d}finally{s.disarm(),a.body.cancel().catch(()=>{})}return l}function Vr(e,t,n,r){switch(t){case"trajectory":{let o=n.steps;Array.isArray(o)&&(e.trajectory=o,r.snapshot?.(e.trajectory));return}case"step":{let o=n.step;o&&(e.steps.push(o),r.step?.(o,Number(n.seq??e.steps.length)));return}case"result":{let o=n.result;o&&(e.summary=o,r.finished?.(o));return}case"insight":{let o=n.insight;o&&(e.insight=o,r.scored?.(o));return}default:return}}async function Yr(e,t,n){for(let r=0;;r++){let o;try{let i=await fetch(`${e}/experiment/v1/runs?pageSize=50`,{headers:{authorization:`Bearer ${t}`}});if(!i.ok)return;o=(await i.json()).results?.find(a=>a.id===n)}catch{return}if(!o)return;if(o.total_tokens!=null||o.cost_usd!=null)return{totalTokens:o.total_tokens??void 0,inputTokens:o.input_tokens??void 0,outputTokens:o.output_tokens??void 0,cacheReadTokens:o.cache_read_tokens??void 0,cacheCreationTokens:o.cache_creation_tokens??void 0,costUsd:o.cost_usd??void 0};if(r>0)return;await K(1200)}}async function Fe(e,t={}){let n=(e.baseUrl??process.env.ORA_PLATFORM_URL??Fr).replace(/\/+$/,""),r=e.apiKey??process.env.ORA_API_KEY;if(!r)throw new Error("Missing ORA_API_KEY. Set it in your environment or a local .env file (see .env.example).");let o=await Gr(n,r),i=await qr(n,o,e),s={runId:i.runId,intent:e.intent,domain:e.domain,harness:e.harness};if(i.status==="succeeded"&&!i.streamUrl)return{...s,steps:[],trajectory:[]};t.opened?.(i.runId);let a=await Kr(n,o,i.streamUrl??`/experiment/v1/runs/${i.runId}/stream`,t,e.idleMs??Hr),c=a.summary?await Yr(n,o,i.runId):void 0;return{...s,result:a.summary,insight:a.insight,usage:c,steps:a.steps,trajectory:a.trajectory}}var Xr="https://ora.ai",zr=12e4,Qr=5e3,Zr=180,R=class extends Error{};function He(e){return(e??process.env.ORA_API_URL??Xr).replace(/\/+$/,"")}async function Ge(e){let t;try{t=await fetch(e,{headers:{accept:"application/json"},signal:AbortSignal.timeout(15e3)})}catch(n){let r=n instanceof Error?n.message:String(n);throw new R(`ora request failed: ${r}`)}if(!t.ok)throw new R(`ora request failed: ${await H(t)}`);return await t.json()}function Lt(e){return Ge(`${He(e)}/api/journey/intents`)}function Wt(e){return Ge(`${He(e)}/api/journey/agents`)}function eo(e){let t=r=>{let o=e.headers.get(r);if(o===null)return;let i=Number.parseInt(o,10);return Number.isFinite(i)?i:void 0},n=t("x-ratelimit-reset");return{limit:t("x-ratelimit-limit"),remaining:t("x-ratelimit-remaining"),resetAtMs:n!==void 0?n*1e3:void 0}}async function to(e,t,n){let r={intent:n.task?{custom:n.task,domain:t}:{...n.intentId?{intent_id:n.intentId}:{},domain:t},harness:n.harness,model:n.model},o;try{o=await fetch(`${e}/api/journey/runs`,{method:"POST",headers:{"content-type":"application/json",accept:"application/json",...n.apiKey?{authorization:`Bearer ${n.apiKey}`}:{}},body:JSON.stringify(r),signal:AbortSignal.timeout(3e4)})}catch(s){let a=s instanceof Error?s.message:String(s);throw new R(`ora journey request failed: ${a}`)}if(o.status===401)throw new R("free-text tasks need an ora partner API key \u2014 set ORA_PARTNER_API_KEY or pass --api-key (keys are issued by ora on request)");if(o.status===429){let s=o.headers.get("retry-after"),a=n.apiKey?"keyed allowance: 1000 runs per 24h per key":"burst: 20/min/IP; daily: 200 runs per 24h per IP \u2014 an ora partner API key raises this to 1000/24h per key: set ORA_PARTNER_API_KEY or pass --api-key";throw new R(`ora journey caller limit exceeded${s?` \u2014 retry after ${qe(Number(s)*1e3)}`:""} (${a})`)}if(o.status===503)throw new R("ora's run engine is unavailable right now \u2014 try again shortly");if(!o.ok)throw new R(`ora journey request failed: ${await H(o)}`);let i=await o.json();return oe(i.contractVersion),{record:i,cached:i.rate_limited===!0,allowance:eo(o)}}function qe(e){if(!Number.isFinite(e)||e<=0)return"soon";let t=e/36e5;if(t>=1)return`${Math.ceil(t)}h`;let n=e/6e4;return n>=1?`${Math.ceil(n)}m`:`${Math.ceil(e/1e3)}s`}function no(e){if(!e)return"starting\u2026";if(e.type==="text")return"thinking\u2026";if(e.action==="search")return e.search_query?`searching \u201C${Nt(e.search_query,40)}\u201D`:"searching\u2026";let t=e.label??`${e.url_host??""}${e.url_path??""}`,n=e.completed===!1?"fetching":"fetched";return t?`${n} ${Nt(t,48)}`:`${n}\u2026`}function Nt(e,t){return e.length>t?`${e.slice(0,t-1)}\u2026`:e}async function ro(e,t,n){let r=t.startsWith("http")?t:`${e}${t}`,o=n.idleMs??zr,i=F(o),s=()=>new R(`ora journey stream timed out \u2014 no frames for ${Math.round(o/1e3)}s`),a;try{a=await fetch(r,{headers:{accept:"text/event-stream"},signal:i.signal})}catch(d){if(i.disarm(),i.tripped())throw s();let g=d instanceof Error?d.message:String(d);throw new R(`ora journey stream failed: ${g}`)}if(!a.ok||!a.body)throw i.disarm(),new R(`ora journey stream failed: ${await H(a)}`);let c=new TextDecoder,l={},u="";try{e:for await(let d of a.body){i.poke(),u=`${u}${c.decode(d,{stream:!0})}`.replace(/\r\n?/g,`
|
|
28
|
+
`);let g=u.indexOf(`
|
|
29
29
|
|
|
30
|
-
`);for(;
|
|
30
|
+
`);for(;g!==-1;){let p=Je(u.slice(0,g));if(u=u.slice(g+2),g=u.indexOf(`
|
|
31
31
|
|
|
32
|
-
`),!
|
|
33
|
-
${c.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
`),
|
|
39
|
-
`),
|
|
40
|
-
`).map(
|
|
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}
|
|
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
|
+
${m.intents.map(z=>` ${z.id.padEnd(12)} ${z.hint}`).join(`
|
|
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
|
+
${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)}
|
|
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(`
|
|
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 {
|
|
43
43
|
var W = typeof globalThis !== "undefined" ? globalThis : window;
|
|
44
|
-
if (W.${
|
|
44
|
+
if (W.${an}) return;
|
|
45
45
|
|
|
46
|
-
var SHIM_VERSION = ${JSON.stringify(
|
|
47
|
-
var MAX_TOOLS = ${
|
|
48
|
-
var MAX_DESCRIPTION_CHARS = ${
|
|
49
|
-
var MAX_SCHEMA_CHARS = ${
|
|
50
|
-
var MAX_ERRORS = ${
|
|
46
|
+
var SHIM_VERSION = ${JSON.stringify(X)};
|
|
47
|
+
var MAX_TOOLS = ${qo};
|
|
48
|
+
var MAX_DESCRIPTION_CHARS = ${cn};
|
|
49
|
+
var MAX_SCHEMA_CHARS = ${Ko};
|
|
50
|
+
var MAX_ERRORS = ${Vo};
|
|
51
51
|
// Internal bound only: a page looping on addEventListener must not grow
|
|
52
52
|
// the shim's retained set without limit.
|
|
53
53
|
var MAX_LISTENERS = 50;
|
|
@@ -501,7 +501,7 @@ ${l.agents.map(m=>` ${m.id.padEnd(12)} ${Tt(m)}`).join(`
|
|
|
501
501
|
// Non-writable and non-configurable: the capture payload is the audit's
|
|
502
502
|
// evidence, so a page must not be able to replace snapshot() and report
|
|
503
503
|
// whatever tools it wishes it had.
|
|
504
|
-
nativeDefineProperty(W, ${JSON.stringify(
|
|
504
|
+
nativeDefineProperty(W, ${JSON.stringify(an)}, {
|
|
505
505
|
value: {
|
|
506
506
|
shimVersion: SHIM_VERSION,
|
|
507
507
|
installedAt: now(),
|
|
@@ -518,9 +518,9 @@ ${l.agents.map(m=>` ${m.id.padEnd(12)} ${Tt(m)}`).join(`
|
|
|
518
518
|
// Nothing left to report to; never let the shim break the page.
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
})();`,
|
|
522
|
-
var MAX_FORMS = ${
|
|
523
|
-
var MAX_DESCRIPTION_CHARS = ${
|
|
521
|
+
})();`,un=`(function () {
|
|
522
|
+
var MAX_FORMS = ${Yo};
|
|
523
|
+
var MAX_DESCRIPTION_CHARS = ${cn};
|
|
524
524
|
var forms = [];
|
|
525
525
|
var nodes = document.querySelectorAll("form[toolname], [toolname]");
|
|
526
526
|
for (var i = 0; i < nodes.length && forms.length < MAX_FORMS; i++) {
|
|
@@ -536,8 +536,8 @@ ${l.agents.map(m=>` ${m.id.padEnd(12)} ${Tt(m)}`).join(`
|
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
return { forms: forms };
|
|
539
|
-
})()`;var
|
|
540
|
-
`)),i=new Set;for(let
|
|
539
|
+
})()`;var pn=["@mcp-b/global","@mcp-b/react-webmcp","usewebmcp"];function Xo(e){let t=e.toLowerCase(),n=/document\.modelcontext/.test(t),r=/navigator\.modelcontext/.test(t),o=/modelcontext\??\.(registertool|providecontext)/.test(t),i=pn.find(a=>t.includes(a));return!n&&!r&&!o&&!i?null:{marker:n?"document.modelContext":r?"navigator.modelContext":o?"modelContext.registerTool/provideContext":`${i} package`,deprecatedAliasOnly:r&&!n}}var zo=["webmcp","web model context protocol"];function dn(e){let t=e.toLowerCase();return zo.some(n=>t.includes(n))}function mn(e,t,n){let r=[t,...n.map(a=>a.body)],o=Xo(r.join(`
|
|
540
|
+
`)),i=new Set;for(let a of r){let c=a.toLowerCase();for(let l of pn)c.includes(l)&&i.add(l)}let s=dn(e)||r.some(dn);return{imperative:o,polyfillPackages:[...i],keywordMention:s}}var fn=15e3,Qo=3e4,Zo=2e3,ei=250,ti={fast:12e3,deep:2e4},ni=2*1024*1024,yn=512,ri=512,oi=60,ii=15e5,bn={width:1280,height:720},gn={imperative:null,polyfillPackages:[],keywordMention:!1},si=`(function () {
|
|
541
541
|
var tokens = [];
|
|
542
542
|
try {
|
|
543
543
|
var metas = document.querySelectorAll('meta[http-equiv="origin-trial" i]');
|
|
@@ -555,14 +555,14 @@ ${l.agents.map(m=>` ${m.id.padEnd(12)} ${Tt(m)}`).join(`
|
|
|
555
555
|
// A hostile getter on either global; absence is the honest answer.
|
|
556
556
|
}
|
|
557
557
|
return { nativeApi: nativeApi, metaTokens: tokens };
|
|
558
|
-
})()`,
|
|
558
|
+
})()`,wn=`(function () {
|
|
559
559
|
try {
|
|
560
560
|
var g = window.__oraWebmcpCapture;
|
|
561
561
|
return g ? g.snapshot() : null;
|
|
562
562
|
} catch (e) {
|
|
563
563
|
return null;
|
|
564
564
|
}
|
|
565
|
-
})()`,
|
|
565
|
+
})()`,ai=`(function () {
|
|
566
566
|
try {
|
|
567
567
|
var g = window.__oraWebmcpCapture;
|
|
568
568
|
if (!g) return "none";
|
|
@@ -572,26 +572,26 @@ ${l.agents.map(m=>` ${m.id.padEnd(12)} ${Tt(m)}`).join(`
|
|
|
572
572
|
} catch (e) {
|
|
573
573
|
return "error";
|
|
574
574
|
}
|
|
575
|
-
})()`;function
|
|
576
|
-
`)[0].slice(0,300)}function
|
|
577
|
-
`)}}try{let t=await
|
|
578
|
-
`):null}function
|
|
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 ${
|
|
580
|
-
`)}var
|
|
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(`
|
|
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(`
|
|
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
|
|
|
583
|
-
ora said: ${t?.error??"shim version mismatch"}`,{code:n}):e.status===503?new
|
|
583
|
+
ora said: ${t?.error??"shim version mismatch"}`,{code:n}):e.status===503?new I(`ora cannot score right now: ${Wi(t?.error??"scoring is unavailable")} Nothing was spent against your rate limit; try again shortly.`,{code:n??"SCORING_UNAVAILABLE"}):new I(`ora ingest failed: ${t?.error??await H(e)}`,{code:n})}async function Li(e,t,n,r){let o=new TextDecoder,i="",s;try{e:for await(let a of e.body){t.poke(),i=`${i}${o.decode(a,{stream:!0})}`.replace(/\r\n?/g,`
|
|
584
584
|
`);let c=i.indexOf(`
|
|
585
585
|
|
|
586
|
-
`);for(;c!==-1;){let l=
|
|
586
|
+
`);for(;c!==-1;){let l=Di(i.slice(0,c));if(i=i.slice(c+2),c=i.indexOf(`
|
|
587
587
|
|
|
588
|
-
`),!l)continue;let u;try{u=JSON.parse(l)}catch{continue}if(n.onEvent?.(u),u.type==="error")throw new
|
|
588
|
+
`),!l)continue;let u;try{u=JSON.parse(l)}catch{continue}if(n.onEvent?.(u),u.type==="error")throw new I(`ora audit failed: ${u.message}`,{code:u.status});if(u.type==="done"){s=u.audit;break e}}}}catch(a){throw t.tripped()?r():a instanceof I?a:new I(`ora ingest stream failed: ${a instanceof Error?a.message:String(a)}`)}finally{t.disarm()}if(!s)throw new I("ora ingest stream ended before the audit completed");return s}function Wi(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function Di(e){let t=[];for(let n of e.split(`
|
|
589
589
|
`))n.startsWith("data:")&&t.push(n.slice(5).replace(/^ /,""));return t.join(`
|
|
590
|
-
`)}var b=
|
|
590
|
+
`)}var b=U(D(),1);var ct=12,Bi=["fail","warning","unmeasured","na","pass"],lt={fail:["\u2716",b.default.red],warning:["\u25B2",b.default.yellow],unmeasured:["?",b.default.magenta],na:["\u2013",b.default.dim],pass:["\u2714",b.default.green]},Ui={fail:"Failing",warning:"Warnings",unmeasured:"Not measured",na:"Not applicable",pass:"Passing"},Ji=["shared-experience","task-completion","tool-quality","trust"],Fi={"shared-experience":"Shared experience","task-completion":"Task completion","tool-quality":"Tool quality",trust:"Trust"};function Wn(e,t={}){let n=G(80,120),r=e.availability.status==="ready";return["",...Hi(e,n),"",...qi(e.availability,n),...r?["",...Ki(e,n),"",...Yi(e)]:[],"",...zi(e.findings,n,t.showPassing===!0),...es(e.simulation,n),"",...ts(e,n)]}function Hi(e,t){let n=[` ${b.default.bold(_(e.url))}`],r=`${e.toolCount} tool${e.toolCount===1?"":"s"}`,o=[Gi(e.verdict),r,`Chrome ${_(e.chromeVersion)}`];return e.error&&o.push(b.default.red(_(e.error))),n.push(` ${b.default.dim(o.join(" \xB7 "))}`),n.map(i=>Dn(i,t))}function Gi(e){switch(e){case"active":return b.default.green("active");case"testing-only":case"declared-inactive":case"api-empty":return b.default.yellow(e);case"blocked":case"load-error":return b.default.red(e);default:return b.default.dim(e)}}function qi(e,t){let[n,r]=e.status==="ready"?["agent-ready",b.default.green]:e.status==="not-ready"?["not agent-ready",b.default.red]:["availability unknown",b.default.yellow],o=[` ${r(b.default.bold(n))}`];for(let i of e.reasons)o.push(...T(_(i.detail),t-4).map(s=>` ${b.default.dim(s)}`));return e.status==="not-ready"&&o.push(...T("No score is reported for a page an agent cannot use yet: the reasons above are what to fix first.",t-4).map(i=>` ${b.default.dim(i)}`)),o}function Ki(e,t){let n=e.score===null?"\u2014":String(e.score),r=[` ${b.default.bold(`${n}/100`)} ${Vi(e)}`];return e.grade===null&&e.score!==null&&r.push(...T(`The grade is withheld because only ${e.evidenceCoverage}% of the applicable check weight was actually measured. The score above still stands; the "Not measured" checks below are what is missing.`,t-4).map(o=>` ${b.default.dim(o)}`)),r}function Vi(e){return e.grade!==null?b.default.bold(b.default.green(`grade ${e.grade}`)):b.default.dim("grade withheld")}function Yi(e){let t=[` ${b.default.bold("Pillars")}`];for(let n of Ji){let r=e.categoryScores[n]??0,o=on[n],i=e.findings.some(c=>it[c.checkId]?.category===n&&c.status!=="na"&&c.status!=="unmeasured"),s=i?Xi(r):b.default.dim("\u2591".repeat(ct)),a=i?`weight ${o}`:`weight ${o} \xB7 nothing measured`;t.push(` ${Fi[n].padEnd(18)} ${s} ${String(r).padStart(3)}% ${b.default.dim(a)}`)}return t}function Xi(e){let t=Math.round(Math.min(100,Math.max(0,e))/100*ct);return`${(e>=75?b.default.green:e>=40?b.default.yellow:b.default.red)("\u2588".repeat(t))}${b.default.dim("\u2591".repeat(ct-t))}`}function zi(e,t,n){let r=[` ${b.default.bold("Checks")}`];for(let o of Bi){let i=e.filter(s=>s.status===o);if(i.length!==0){if(o==="pass"&&!n){r.push(` ${b.default.dim(`${i.length} passing (--show-passing to list)`)}`);continue}r.push("",` ${b.default.bold(Ui[o])} (${i.length})`);for(let s of i)r.push(...Qi(s,t))}}return e.length===0&&r.push(` ${b.default.dim("no checks reported")}`),r}function Qi(e,t){let[n,r]=lt[e.status],o=Zi(e.checkId),s=[` ${r(n)} ${o}${e.toolName?b.default.dim(` ${_(e.toolName)}`):""}`];return e.details&&s.push(...T(_(e.details),t-10).map(a=>` ${b.default.dim(a)}`)),e.evidence&&s.push(...T(_(e.evidence),t-10).map(a=>` ${b.default.dim(a)}`)),s}function Zi(e){return it[e]?.title??e}function es(e,t){if(!e)return[];let n=["",` ${b.default.bold("Tool selection")}`];if(e.skipped)return n.push(...T(_(e.skipReason??"The selection simulation did not run."),t-4).map(o=>` ${b.default.dim(o)}`)),n;let r=Math.round(e.accuracy*100);n.push(` ${r}% of ${e.steps.length} intent${e.steps.length===1?"":"s"} picked the right tool ${b.default.dim(_(e.model))}`);for(let o of e.steps){let[i,s]=o.ok?lt.pass:lt.fail,a=o.chosenTool?_(o.chosenTool):b.default.dim("nothing");n.push(` ${s(i)} ${Dn(_(o.intent),t-30)} ${b.default.dim("\u2192")} ${a}`)}return n}function ts(e,t){let n=e.source==="local"?"Captured by your own browser and scored without being stored \u2014 this result is not published or ranked anywhere. Run the audit at webmcp.ora.ai for a public one.":"";return n?T(n,t-4).map(r=>` ${b.default.dim(r)}`):[]}function Dn(e,t){return e.length>t?`${e.slice(0,t-1)}\u2026`:e}var N={OK:0,BELOW_MIN_SCORE:1,USAGE:2,API:3};function ns(e){let t=e.trim();if(!(!t||/\s/.test(t)))try{let n=new URL(t.includes("://")?t:`http://${t}`);return n.protocol!=="http:"&&n.protocol!=="https:"?void 0:n.toString()}catch{return}}function rs(e){if(e===void 0)return{};let t=Number(e);return e.trim()===""||!Number.isInteger(t)||t<0||t>100?{error:`--min-score must be an integer between 0 and 100, got ${JSON.stringify(e)}`}:{value:t}}async function Bn(e){let t=ns(e.url);if(!t)return console.error(`Not an auditable URL: ${JSON.stringify(e.url)}`),console.error("Pass the page you want audited, e.g. http://localhost:3000"),N.USAGE;let n=rs(e.minScore);if(n.error)return console.error(n.error),N.USAGE;let r=await _n(e.chromeEndpoint);if(!r.ok)return console.error(r.message),N.USAGE;e.json||k.start(r.launched?`Starting Chrome and capturing ${t}`:`Capturing ${t}`);let o;try{o=await Sn({url:t,endpoint:r.endpoint,onTools:d=>{e.json||k.update(`Capturing ${t} \u2014 ${d.length} tools`)}})}catch(d){return k.stop(),console.error(`Capture failed: ${d instanceof Error?d.message:String(d)}`),N.API}finally{await r.close()}let i=o.pages[0];if(i?.error)return k.stop(),console.error(`Could not capture ${t}: ${i.error}`),console.error("Is the dev server running?"),N.USAGE;let s=Nn(o);if(s)return k.stop(),console.error(`ora would refuse this capture: ${s}`),N.USAGE;let{capture:a,droppedScreenshot:c}=jn(o);e.json||k.update("Scoring with ora");let l;try{l=await Ln(t,a,{apiKey:e.apiKey??process.env.ORA_API_KEY,onEvent:d=>{e.json||k.update(os(d))}})}catch(d){return k.stop(),d instanceof I?(console.error(d.message),N.API):(console.error(`Scoring failed: ${d instanceof Error?d.message:String(d)}`),N.API)}if(k.stop(),e.json)console.log(JSON.stringify(l,null,2));else for(let d of Wn(l,{showPassing:e.showPassing}))console.log(d);c&&console.error("Note: the screenshot exceeded ora's 2 MB limit and was not sent, so page-experience could not be graded.");let u=Rn(o);if(u&&console.error(`
|
|
591
591
|
${u}`),n.value!==void 0){if(l.availability.status!=="ready")return e.json||console.log(`
|
|
592
592
|
Not agent-ready, so there is no score to compare against --min-score ${n.value}
|
|
593
|
-
`),
|
|
594
|
-
ora returned no score, so --min-score cannot be evaluated.`),
|
|
593
|
+
`),N.BELOW_MIN_SCORE;if(l.score===null)return e.json||console.error(`
|
|
594
|
+
ora returned no score, so --min-score cannot be evaluated.`),N.API;if(l.score<n.value)return e.json||console.log(`
|
|
595
595
|
Score ${l.score} is below the required minimum ${n.value}
|
|
596
|
-
`),
|
|
597
|
-
`)}var
|
|
596
|
+
`),N.BELOW_MIN_SCORE}return N.OK}function os(e){switch(e.type){case"phase":return`Scoring with ora \u2014 ${e.phase}`;case"tool-discovered":return`Scoring with ora \u2014 found ${_(e.tool.name)}`;case"finding":return`Scoring with ora \u2014 ${e.finding.checkId}`;case"simulation-step":return`Scoring with ora \u2014 simulating "${_(e.step.intent)}"`;default:return"Scoring with ora"}}function Un(){if(typeof process.loadEnvFile!="function")return!1;try{return process.loadEnvFile(),!0}catch{return!1}}var q="ax",is={meta:{name:"audit",description:"Score a site's agent readiness (exit codes: 0 ok, 1 below --min-score, 2 usage, 3 API error)"},args:{url:{type:"positional",description:"URL or domain to audit (e.g. https://docs.example.com)",required:!0},json:{type:"boolean",description:"Print the raw ora audit payload as JSON",default:!1},"min-score":{type:"string",description:"Exit 1 when the score is below this threshold (0-100); the CI gate"},"max-age":{type:"string",description:"Accept a cached result up to this many seconds old (server default 6h)"},force:{type:"boolean",description:"Bypass the cache and rescan (spends the stricter 6/day force budget)",default:!1},"tunnel-cmd":{type:"string",description:"Command that exposes a local target and prints its public https URL (e.g. 'ngrok http 3000 --log stdout'); also read from ORA_TUNNEL_CMD. The result is stored as ephemeral"},"api-key":{type:"string",description:"ora-issued scan API key that lifts the scan rate limits; also read from ORA_SCAN_API_KEY"},"show-passing":{type:"boolean",description:"List each passing check individually",default:!1},"show-skipped":{type:"boolean",description:"List not-applicable / pending checks too",default:!1}},async run({args:e}){process.exitCode=await Ot({url:e.url,json:!!e.json,showSkipped:!!e["show-skipped"],showPassing:!!e["show-passing"],minScore:e["min-score"],maxAge:e["max-age"],force:!!e.force,tunnelCmd:e["tunnel-cmd"],apiKey:e["api-key"]})}},ss={meta:{name:"journey",description:"Send a real AI agent at a site and watch it navigate live"},args:{intent:{type:"positional",description:'Goal for the agent (e.g. "Find the API docs and how to auth")',required:!0},domain:{type:"string",description:"Site the agent targets (e.g. stripe.com)"},harness:{type:"string",description:"Agent harness: claude-code, codex, openclaw, hermess, claude-agent, eve, \u2026",default:"claude-code"},model:{type:"string",description:"Model override (harness default when omitted)"},json:{type:"boolean",description:"Output as JSON",default:!1}},async run({args:e}){process.exitCode=await qt({intent:e.intent,domain:e.domain,harness:e.harness,model:e.model,json:!!e.json})}},as={meta:{name:"deep-journey",description:"Run a real AI agent at a site on a curated task \u2014 or, with a partner API key, a free-text one \u2014 via ora's public API (exit codes: 0 ok, 1 run failed, 2 usage, 3 API error)"},args:{url:{type:"positional",description:"URL or domain the agent targets (e.g. stripe.com)",required:!0},intent:{type:"string",description:"Curated intent id (see GET /api/journey/intents; server default when omitted)"},agent:{type:"string",description:"Agent id (see GET /api/journey/agents); defaults to cas-haiku (Claude Code \xB7 Haiku 4.5)"},json:{type:"boolean",description:"Print the terminal run detail as JSON",default:!1},task:{type:"string",description:"Free-text task for the agent (needs a partner API key; mutually exclusive with --intent)"},"api-key":{type:"string",description:"ora-issued partner API key: unlocks --task and the 1000/24h keyed allowance; also read from ORA_PARTNER_API_KEY"},"no-stream":{type:"boolean",description:"Skip the live trajectory stream and poll for the result instead",default:!1}},async run({args:e}){process.exitCode=await Gt({url:e.url,intent:e.intent,task:e.task,apiKey:e["api-key"],agent:e.agent,json:!!e.json,noStream:!!e["no-stream"]})}},cs={meta:{name:"skill",description:"List, print, or install ora's agent skills (digest-verified from the registry, never bundled)"},args:{name:{type:"positional",description:"Skill name (omit to list the registry)",required:!1},install:{type:"boolean",description:"Write <dir>/<name>/SKILL.md instead of printing",default:!1},dir:{type:"string",description:"Install directory (default .claude/skills)"},json:{type:"boolean",description:"Print the raw registry index as JSON",default:!1}},async run({args:e}){process.exitCode=await zt({name:e.name,install:!!e.install,dir:e.dir,json:!!e.json})}},ls={meta:{name:"webmcp-audit",description:"Audit a page's WebMCP tools in a real browser - localhost included, so you can check before you publish (exit codes: 0 ok, 1 below --min-score, 2 usage, 3 API error)"},args:{url:{type:"positional",description:"Page to audit, scheme included (e.g. http://localhost:3000)",required:!0},"chrome-endpoint":{type:"string",description:"Drive a Chrome you started instead of launching one: ws:// URL, http origin, or host:port"},"min-score":{type:"string",description:"Exit 1 when the score is below this threshold (0-100); the CI gate"},"api-key":{type:"string",description:"ora API key that lifts the ingest rate limits; also read from ORA_API_KEY"},json:{type:"boolean",description:"Print the raw ora audit payload as JSON",default:!1},"show-passing":{type:"boolean",description:"List each passing check individually",default:!1}},async run({args:e}){process.exitCode=await Bn({url:e.url,json:!!e.json,showPassing:!!e["show-passing"],minScore:e["min-score"],chromeEndpoint:e["chrome-endpoint"],apiKey:e["api-key"]})}};function us(){let e=Re.default.green("$"),t=Re.default.dim;return["",` ${Re.default.bold(q)} ${t(`v${Oe.version}`)}`,` ${t("Score any site's agent readiness \u2014 and watch real AI agents navigate it")}`,"",` ${t("Commands:")}`,` audit ${t("<url>")} ${t("Score a site's agent readiness")}`,` webmcp-audit ${t("<url>")} ${t("Audit a WebMCP surface in a real browser, localhost included")}`,` deep-journey ${t("<url>")} ${t("Run a real agent at a site on a curated or free-text task")}`,` journey ${t("<intent>")} ${t("Send a real agent at a site and watch it live (workspace)")}`,` skill ${t("[name]")} ${t("List, print, or install ora's agent skills")}`,"",` ${t("Examples:")}`,` ${e} ${q} audit https://docs.example.com`,` ${e} ${q} audit https://docs.example.com --min-score 70 ${t("# CI gate")}`,` ${e} ${q} audit https://docs.example.com --json`,` ${e} ${q} webmcp-audit http://localhost:3000`,` ${e} ${q} deep-journey stripe.com --intent pricing`,` ${e} ${q} journey "Find the API docs and how to authenticate" --domain stripe.com`,"",` ${t("audit options:")}`,` --min-score <n> ${t("Exit 1 when the score is below n (0-100); the CI gate")}`,` --max-age <s> ${t("Accept a cached result up to s seconds old (default 6h)")}`,` --force ${t("Bypass the cache and rescan (6/day budget)")}`,` --tunnel-cmd <c> ${t("Expose a local target via your own tunnel command (e.g. 'ngrok http 3000 --log stdout')")}`,` --api-key <k> ${t("ora-issued scan API key that lifts the rate limits; also read from ORA_SCAN_API_KEY")}`,` --json ${t("Print the raw ora audit payload as JSON")}`,` --show-passing ${t("List each passing check (hidden by default)")}`,` --show-skipped ${t("List skipped checks (hidden by default)")}`,"",` ${t("audit exit codes:")}`,` ${t("0 success \xB7 1 below --min-score \xB7 2 usage error \xB7 3 API unreachable/rate-limited")}`,"",` ${t("webmcp-audit options:")}`,` --chrome-endpoint ${t("<e> Drive a Chrome you started: ws:// URL, http origin, or host:port")}`,` --min-score <n> ${t("Exit 1 when the score is below n (0-100); the CI gate")}`,` --api-key <k> ${t("ora API key that lifts the ingest rate limits; also read from ORA_API_KEY")}`,` --json ${t("Print the raw ora audit payload as JSON")}`,` --show-passing ${t("List each passing check (hidden by default)")}`,` ${t("starts a headless Chrome you already have installed; never downloads one")}`,` ${t("scored by ora, stored nowhere: the result is never published or ranked")}`,"",` ${t("deep-journey options:")}`,` --intent <id> ${t("Curated task id, e.g. pricing, signup, api-docs (server default when omitted)")}`,` --task <text> ${t("Free-text task (needs a partner API key; replaces --intent)")}`,` --api-key <k> ${t("ora partner API key: unlocks --task + 1000 runs/24h; also read from ORA_PARTNER_API_KEY")}`,` --agent <id> ${t("Agent to run (default: cas-haiku \u2014 Claude Code \xB7 Haiku 4.5)")}`,` --no-stream ${t("Poll for the result instead of streaming the trajectory")}`,` --json ${t("Print the terminal run detail as JSON")}`,` ${t("no key needed \xB7 public caps: 100 runs/24h per target, 200 runs/24h per IP")}`,"",` ${t("journey options:")}`,` --domain <d> ${t("Site the agent targets (e.g. stripe.com)")}`,` --harness <h> ${t("Agent harness: claude-code (default), codex, openclaw, hermess, claude-agent, eve, \u2026")}`,` --model <m> ${t("Model override (harness default when omitted)")}`,` --json ${t("Output as JSON")}`,` ${t("requires ORA_API_KEY (see .env.example)")}`,""].join(`
|
|
597
|
+
`)}var ds={meta:{name:q,version:Oe.version,description:"Score any site's agent readiness \u2014 and watch real AI agents navigate it"},subCommands:{audit:is,"webmcp-audit":ls,"deep-journey":as,journey:ss,skill:cs},setup(){let e=process.argv[2];(!e||e==="--help"||e==="-h")&&(console.log(us()),process.exit(0))}};Un();wt(ds);
|