@monkeytestai/monkeytester 0.6.1 → 0.7.0-beta.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/CHANGELOG.md +35 -0
- package/README.md +5 -3
- package/dist/checks/axe.d.ts +24 -0
- package/dist/checks/axe.d.ts.map +1 -0
- package/dist/checks/axe.js +57 -0
- package/dist/checks/axe.js.map +1 -0
- package/dist/checks/console.d.ts +17 -0
- package/dist/checks/console.d.ts.map +1 -0
- package/dist/checks/console.js +32 -0
- package/dist/checks/console.js.map +1 -0
- package/dist/checks/execute.d.ts +34 -0
- package/dist/checks/execute.d.ts.map +1 -0
- package/dist/checks/execute.js +424 -0
- package/dist/checks/execute.js.map +1 -0
- package/dist/checks/http.d.ts +27 -0
- package/dist/checks/http.d.ts.map +1 -0
- package/dist/checks/http.js +90 -0
- package/dist/checks/http.js.map +1 -0
- package/dist/checks/meta.d.ts +23 -0
- package/dist/checks/meta.d.ts.map +1 -0
- package/dist/checks/meta.js +39 -0
- package/dist/checks/meta.js.map +1 -0
- package/dist/checks/mobile.d.ts +30 -0
- package/dist/checks/mobile.d.ts.map +1 -0
- package/dist/checks/mobile.js +61 -0
- package/dist/checks/mobile.js.map +1 -0
- package/dist/checks/noise.d.ts +10 -0
- package/dist/checks/noise.d.ts.map +1 -0
- package/dist/checks/noise.js +53 -0
- package/dist/checks/noise.js.map +1 -0
- package/dist/checks/plan.d.ts +35 -0
- package/dist/checks/plan.d.ts.map +1 -0
- package/dist/checks/plan.js +108 -0
- package/dist/checks/plan.js.map +1 -0
- package/dist/cli.js +64 -26
- package/dist/cli.js.map +1 -1
- package/dist/depth.d.ts +44 -1
- package/dist/depth.d.ts.map +1 -1
- package/dist/depth.js +38 -3
- package/dist/depth.js.map +1 -1
- package/dist/explorer/index.d.ts.map +1 -1
- package/dist/explorer/index.js +122 -16
- package/dist/explorer/index.js.map +1 -1
- package/dist/explorer/queue.d.ts +18 -0
- package/dist/explorer/queue.d.ts.map +1 -1
- package/dist/explorer/queue.js +77 -6
- package/dist/explorer/queue.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/llm/prices.d.ts +17 -0
- package/dist/llm/prices.d.ts.map +1 -0
- package/dist/llm/prices.js +41 -0
- package/dist/llm/prices.js.map +1 -0
- package/dist/monkey.d.ts +6 -0
- package/dist/monkey.d.ts.map +1 -1
- package/dist/monkey.js +29 -10
- package/dist/monkey.js.map +1 -1
- package/dist/outcome.d.ts +10 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +44 -8
- package/dist/outcome.js.map +1 -1
- package/dist/planner/authNegative.d.ts +31 -0
- package/dist/planner/authNegative.d.ts.map +1 -0
- package/dist/planner/authNegative.js +240 -0
- package/dist/planner/authNegative.js.map +1 -0
- package/dist/planner/dedupe.d.ts +16 -0
- package/dist/planner/dedupe.d.ts.map +1 -0
- package/dist/planner/dedupe.js +94 -0
- package/dist/planner/dedupe.js.map +1 -0
- package/dist/planner/focus.d.ts.map +1 -1
- package/dist/planner/focus.js +16 -5
- package/dist/planner/focus.js.map +1 -1
- package/dist/planner/forms.d.ts.map +1 -1
- package/dist/planner/forms.js +3 -1
- package/dist/planner/forms.js.map +1 -1
- package/dist/planner/index.d.ts +13 -2
- package/dist/planner/index.d.ts.map +1 -1
- package/dist/planner/index.js +86 -12
- package/dist/planner/index.js.map +1 -1
- package/dist/planner/inventory.d.ts +6 -0
- package/dist/planner/inventory.d.ts.map +1 -1
- package/dist/planner/inventory.js +23 -2
- package/dist/planner/inventory.js.map +1 -1
- package/dist/planner/verdict.d.ts.map +1 -1
- package/dist/planner/verdict.js +2 -0
- package/dist/planner/verdict.js.map +1 -1
- package/dist/runner/actions.d.ts +8 -2
- package/dist/runner/actions.d.ts.map +1 -1
- package/dist/runner/actions.js +14 -5
- package/dist/runner/actions.js.map +1 -1
- package/dist/runner/authNegative.d.ts +33 -0
- package/dist/runner/authNegative.d.ts.map +1 -0
- package/dist/runner/authNegative.js +291 -0
- package/dist/runner/authNegative.js.map +1 -0
- package/dist/runner/index.d.ts +11 -0
- package/dist/runner/index.d.ts.map +1 -1
- package/dist/runner/index.js +137 -1
- package/dist/runner/index.js.map +1 -1
- package/dist/runner/replay.d.ts.map +1 -1
- package/dist/runner/replay.js +52 -14
- package/dist/runner/replay.js.map +1 -1
- package/dist/trace/serialize.d.ts.map +1 -1
- package/dist/trace/serialize.js +1 -0
- package/dist/trace/serialize.js.map +1 -1
- package/dist/triager/index.d.ts +5 -0
- package/dist/triager/index.d.ts.map +1 -1
- package/dist/triager/index.js +14 -4
- package/dist/triager/index.js.map +1 -1
- package/dist/types.d.ts +95 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +20 -0
- package/dist/version.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/checks/meta.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,MAAM,UAAU,SAAS,CAAC,QAAsB;IAC9C,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;SAC3D,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACjF,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;IAC/G,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE;QAAE,IAAI,CAA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|
|
5
|
+
* links in a sentence are not tap targets (WCAG 2.5.8 exempts them). A
|
|
6
|
+
* control is a bug only when both width and height are under 24px and it
|
|
7
|
+
* has an accessible name. A row of tiny icons is info, not a pile of bugs.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MOBILE_VIEWPORT: {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export interface TapTarget {
|
|
14
|
+
name: string;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
tag: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MobileSnapshot {
|
|
20
|
+
overflow: number;
|
|
21
|
+
targets: TapTarget[];
|
|
22
|
+
}
|
|
23
|
+
export interface MobileJudgement {
|
|
24
|
+
bugs: string[];
|
|
25
|
+
info: string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function judgeMobile(snapshot: MobileSnapshot): MobileJudgement;
|
|
28
|
+
/** Read in the page. Must not close over Node values; Playwright serializes it. */
|
|
29
|
+
export declare function readMobileInPage(): MobileSnapshot;
|
|
30
|
+
//# sourceMappingURL=mobile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile.d.ts","sourceRoot":"","sources":["../../src/checks/mobile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,eAAe;;;CAA8B,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAKD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,eAAe,CAuBrE;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,IAAI,cAAc,CAoBjD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 375px viewport: horizontal overflow and tap-target size.
|
|
3
|
+
*
|
|
4
|
+
* A scrollbar is about 15px, so overflow under 32px is ignored. Inline
|
|
5
|
+
* links in a sentence are not tap targets (WCAG 2.5.8 exempts them). A
|
|
6
|
+
* control is a bug only when both width and height are under 24px and it
|
|
7
|
+
* has an accessible name. A row of tiny icons is info, not a pile of bugs.
|
|
8
|
+
*/
|
|
9
|
+
export const MOBILE_VIEWPORT = { width: 375, height: 812 };
|
|
10
|
+
const OVERFLOW_BUG_PX = 32;
|
|
11
|
+
const TAP_MIN_PX = 24;
|
|
12
|
+
export function judgeMobile(snapshot) {
|
|
13
|
+
const bugs = [];
|
|
14
|
+
const info = [];
|
|
15
|
+
if (snapshot.overflow > OVERFLOW_BUG_PX) {
|
|
16
|
+
bugs.push(`The page is ${Math.round(snapshot.overflow)}px wider than the 375px screen.`);
|
|
17
|
+
}
|
|
18
|
+
else if (snapshot.overflow > 8) {
|
|
19
|
+
info.push(`Horizontal overflow is ${Math.round(snapshot.overflow)}px, within the scrollbar allowance.`);
|
|
20
|
+
}
|
|
21
|
+
const tiny = snapshot.targets.filter(target => target.width > 0
|
|
22
|
+
&& target.height > 0
|
|
23
|
+
&& target.width < TAP_MIN_PX
|
|
24
|
+
&& target.height < TAP_MIN_PX
|
|
25
|
+
&& target.name.trim().length >= 2);
|
|
26
|
+
if (tiny.length > 8) {
|
|
27
|
+
info.push(`${tiny.length} controls are under ${TAP_MIN_PX}px. Too many to call each one a bug.`);
|
|
28
|
+
}
|
|
29
|
+
else if (tiny.length > 0) {
|
|
30
|
+
const sample = tiny.slice(0, 3).map(target => `"${target.name}" (${Math.round(target.width)}×${Math.round(target.height)})`).join(', ');
|
|
31
|
+
bugs.push(`Tap targets under ${TAP_MIN_PX}px: ${sample}.`);
|
|
32
|
+
}
|
|
33
|
+
return { bugs, info };
|
|
34
|
+
}
|
|
35
|
+
/** Read in the page. Must not close over Node values; Playwright serializes it. */
|
|
36
|
+
export function readMobileInPage() {
|
|
37
|
+
const doc = document.documentElement;
|
|
38
|
+
const overflow = Math.max(0, doc.scrollWidth - doc.clientWidth);
|
|
39
|
+
const nodes = document.querySelectorAll('a, button, input, select, textarea, [role="button"]');
|
|
40
|
+
const targets = [];
|
|
41
|
+
for (const node of Array.from(nodes)) {
|
|
42
|
+
const el = node;
|
|
43
|
+
const style = getComputedStyle(el);
|
|
44
|
+
if (style.visibility === 'hidden' || style.display === 'none' || Number(style.opacity) === 0)
|
|
45
|
+
continue;
|
|
46
|
+
if (el.tagName === 'A' && style.display === 'inline')
|
|
47
|
+
continue;
|
|
48
|
+
const rect = el.getBoundingClientRect();
|
|
49
|
+
if (rect.width < 1 || rect.height < 1)
|
|
50
|
+
continue;
|
|
51
|
+
if (rect.bottom < 0 || rect.top > window.innerHeight + 40)
|
|
52
|
+
continue;
|
|
53
|
+
const name = (el.getAttribute('aria-label') || el.innerText || el.getAttribute('value') || '')
|
|
54
|
+
.replace(/\s+/g, ' ')
|
|
55
|
+
.trim()
|
|
56
|
+
.slice(0, 80);
|
|
57
|
+
targets.push({ name, width: rect.width, height: rect.height, tag: el.tagName.toLowerCase() });
|
|
58
|
+
}
|
|
59
|
+
return { overflow, targets };
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile.js","sourceRoot":"","sources":["../../src/checks/mobile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAmB3D,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,UAAU,GAAG,EAAE,CAAC;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,YAAY,CAAC,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;aAC3F,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;aACpB,IAAI,EAAE;aACN,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console and page-error noise.
|
|
3
|
+
*
|
|
4
|
+
* A message is a site bug only when it is first-party and it is not one of
|
|
5
|
+
* our own automation failures. Extension URLs, third-party hosts, Chrome's
|
|
6
|
+
* "Failed to load resource" line, and `isOwnAutomationBug` signatures are
|
|
7
|
+
* dropped before a check can file them.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isIgnoredConsoleMessage(message: string, sourceUrl: string | undefined, pageUrl: string): boolean;
|
|
10
|
+
//# sourceMappingURL=noise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noise.d.ts","sourceRoot":"","sources":["../../src/checks/noise.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAwBH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAQT"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console and page-error noise.
|
|
3
|
+
*
|
|
4
|
+
* A message is a site bug only when it is first-party and it is not one of
|
|
5
|
+
* our own automation failures. Extension URLs, third-party hosts, Chrome's
|
|
6
|
+
* "Failed to load resource" line, and `isOwnAutomationBug` signatures are
|
|
7
|
+
* dropped before a check can file them.
|
|
8
|
+
*/
|
|
9
|
+
import { isOwnAutomationBug } from '../automation/signatures.js';
|
|
10
|
+
import { isSameCrawlSite } from '../explorer/queue.js';
|
|
11
|
+
const EXTENSION = /(?:chrome|moz|safari|edge)-extension:|webkit-masked-url:|about:blank/i;
|
|
12
|
+
const NOISE = [
|
|
13
|
+
/ResizeObserver loop/i,
|
|
14
|
+
/favicon\.ico/i,
|
|
15
|
+
/apple-touch-icon/i,
|
|
16
|
+
/Failed to load resource/i,
|
|
17
|
+
/net::ERR_BLOCKED_BY_CLIENT/i,
|
|
18
|
+
/net::ERR_ABORTED/i,
|
|
19
|
+
/net::ERR_FAILED/i,
|
|
20
|
+
/Download the React DevTools/i,
|
|
21
|
+
/\[vite\]/i,
|
|
22
|
+
/\[HMR\]/i,
|
|
23
|
+
/webpack-dev-server/i,
|
|
24
|
+
/^Script error\.?$/i,
|
|
25
|
+
/chrome-extension:/i,
|
|
26
|
+
/moz-extension:/i,
|
|
27
|
+
];
|
|
28
|
+
export function isIgnoredConsoleMessage(message, sourceUrl, pageUrl) {
|
|
29
|
+
const text = message.trim();
|
|
30
|
+
if (!text)
|
|
31
|
+
return true;
|
|
32
|
+
if (EXTENSION.test(text) || (sourceUrl && EXTENSION.test(sourceUrl)))
|
|
33
|
+
return true;
|
|
34
|
+
if (NOISE.some(pattern => pattern.test(text)))
|
|
35
|
+
return true;
|
|
36
|
+
if (isOwnAutomationBug({ title: text, observed: text, error: text }))
|
|
37
|
+
return true;
|
|
38
|
+
if (sourceUrl && isThirdParty(sourceUrl, pageUrl))
|
|
39
|
+
return true;
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function isThirdParty(sourceUrl, pageUrl) {
|
|
43
|
+
try {
|
|
44
|
+
const source = new URL(sourceUrl);
|
|
45
|
+
if (source.protocol !== 'http:' && source.protocol !== 'https:')
|
|
46
|
+
return false;
|
|
47
|
+
return !isSameCrawlSite(sourceUrl, pageUrl);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=noise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noise.js","sourceRoot":"","sources":["../../src/checks/noise.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,SAAS,GAAG,uEAAuE,CAAC;AAE1F,MAAM,KAAK,GAAG;IACZ,sBAAsB;IACtB,eAAe;IACf,mBAAmB;IACnB,0BAA0B;IAC1B,6BAA6B;IAC7B,mBAAmB;IACnB,kBAAkB;IAClB,8BAA8B;IAC9B,WAAW;IACX,UAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,iBAAiB;CAClB,CAAC;AAEF,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,SAA6B,EAC7B,OAAe;IAEf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAClF,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3D,IAAI,kBAAkB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC;IAClF,IAAI,SAAS,IAAI,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/D,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,SAAiB,EAAE,OAAe;IACtD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC9E,OAAO,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One engine flow per deterministic check.
|
|
3
|
+
*
|
|
4
|
+
* Ids are reserved (`check-*`). They are not part of the LLM flow budget
|
|
5
|
+
* and `reconcileModelFlows` never sees them. Each flow has one step per
|
|
6
|
+
* crawled page, capped by the page limit the caller passes.
|
|
7
|
+
*/
|
|
8
|
+
import type { FlowKind, PageCheck, SiteMap, TestFlow } from '../types.js';
|
|
9
|
+
export declare const PAGE_CHECK_PREFIX = "check-";
|
|
10
|
+
export interface PageCheckSpec {
|
|
11
|
+
id: string;
|
|
12
|
+
pageCheck: PageCheck;
|
|
13
|
+
kind: FlowKind;
|
|
14
|
+
severityIfFails: TestFlow['severityIfFails'];
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
expectation: string;
|
|
18
|
+
/** Short verb used in the step action. */
|
|
19
|
+
action: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const PAGE_CHECK_SPECS: readonly PageCheckSpec[];
|
|
22
|
+
export declare function isPageCheckFlowId(id: string): boolean;
|
|
23
|
+
export declare function isPageCheck(value: string | undefined): value is PageCheck;
|
|
24
|
+
export declare function pageCheckSpec(kind: PageCheck): PageCheckSpec;
|
|
25
|
+
export interface PageCheckPlan {
|
|
26
|
+
flows: TestFlow[];
|
|
27
|
+
note?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build the reserved check flows. Empty when the crawl has no pages.
|
|
31
|
+
* `maxPages` slices the sitemap so a host that passes a longer map still
|
|
32
|
+
* stays inside the page cap. The check-type cap is `BASIC_PRESET`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildPageCheckFlows(siteMap: SiteMap, maxPages?: number): PageCheckPlan;
|
|
35
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/checks/plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAY,MAAM,aAAa,CAAC;AAEpF,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,eAAe,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAmDpD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,IAAI,SAAS,CAEzE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,aAAa,CAI5D;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CA6BtF"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One engine flow per deterministic check.
|
|
3
|
+
*
|
|
4
|
+
* Ids are reserved (`check-*`). They are not part of the LLM flow budget
|
|
5
|
+
* and `reconcileModelFlows` never sees them. Each flow has one step per
|
|
6
|
+
* crawled page, capped by the page limit the caller passes.
|
|
7
|
+
*/
|
|
8
|
+
import { BASIC_PRESET } from '../depth.js';
|
|
9
|
+
export const PAGE_CHECK_PREFIX = 'check-';
|
|
10
|
+
export const PAGE_CHECK_SPECS = [
|
|
11
|
+
{
|
|
12
|
+
id: 'check-console',
|
|
13
|
+
pageCheck: 'console',
|
|
14
|
+
kind: 'visual',
|
|
15
|
+
severityIfFails: 'major',
|
|
16
|
+
name: 'Console errors on load',
|
|
17
|
+
description: 'First-party console errors and uncaught exceptions while the page loads.',
|
|
18
|
+
expectation: 'The page loads without a first-party console error or uncaught exception.',
|
|
19
|
+
action: 'Check console errors',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'check-http',
|
|
23
|
+
pageCheck: 'http',
|
|
24
|
+
kind: 'visual',
|
|
25
|
+
severityIfFails: 'major',
|
|
26
|
+
name: 'Broken requests and links',
|
|
27
|
+
description: 'Same-site requests that fail or return 4xx/5xx, and same-site links checked over HTTP without opening them.',
|
|
28
|
+
expectation: 'Same-site documents, scripts, and links respond without a 4xx or 5xx.',
|
|
29
|
+
action: 'Check failed requests and broken links',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'check-axe',
|
|
33
|
+
pageCheck: 'axe',
|
|
34
|
+
kind: 'accessibility',
|
|
35
|
+
severityIfFails: 'major',
|
|
36
|
+
name: 'WCAG A and AA',
|
|
37
|
+
description: 'axe-core WCAG A and AA. Serious and critical violations are bugs. Other hits are info. A missing autocomplete on a login field is minor.',
|
|
38
|
+
expectation: 'The page has no serious or critical WCAG A/AA violation.',
|
|
39
|
+
action: 'Check WCAG A and AA',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'check-mobile',
|
|
43
|
+
pageCheck: 'mobile',
|
|
44
|
+
kind: 'visual',
|
|
45
|
+
severityIfFails: 'minor',
|
|
46
|
+
name: 'Mobile layout',
|
|
47
|
+
description: 'Horizontal overflow and tap-target size at a 375px viewport.',
|
|
48
|
+
expectation: 'At 375px the page does not overflow sideways and primary controls are large enough to tap.',
|
|
49
|
+
action: 'Check mobile overflow and tap targets',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'check-meta',
|
|
53
|
+
pageCheck: 'meta',
|
|
54
|
+
kind: 'accessibility',
|
|
55
|
+
severityIfFails: 'minor',
|
|
56
|
+
name: 'Page metadata',
|
|
57
|
+
description: 'Title, meta description, lang, viewport, and a single h1. Missing title or viewport is minor. The rest is info.',
|
|
58
|
+
expectation: 'The page has a title and a viewport meta tag.',
|
|
59
|
+
action: 'Check title, description, lang, viewport, and h1',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
export function isPageCheckFlowId(id) {
|
|
63
|
+
return id.startsWith(PAGE_CHECK_PREFIX);
|
|
64
|
+
}
|
|
65
|
+
export function isPageCheck(value) {
|
|
66
|
+
return PAGE_CHECK_SPECS.some(spec => spec.pageCheck === value);
|
|
67
|
+
}
|
|
68
|
+
export function pageCheckSpec(kind) {
|
|
69
|
+
const spec = PAGE_CHECK_SPECS.find(item => item.pageCheck === kind);
|
|
70
|
+
if (!spec)
|
|
71
|
+
throw new Error(`Unknown page check "${kind}"`);
|
|
72
|
+
return spec;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build the reserved check flows. Empty when the crawl has no pages.
|
|
76
|
+
* `maxPages` slices the sitemap so a host that passes a longer map still
|
|
77
|
+
* stays inside the page cap. The check-type cap is `BASIC_PRESET`.
|
|
78
|
+
*/
|
|
79
|
+
export function buildPageCheckFlows(siteMap, maxPages) {
|
|
80
|
+
const cap = maxPages && maxPages > 0 ? maxPages : siteMap.pages.length;
|
|
81
|
+
const pages = siteMap.pages.slice(0, cap);
|
|
82
|
+
if (pages.length === 0)
|
|
83
|
+
return { flows: [] };
|
|
84
|
+
const specs = PAGE_CHECK_SPECS.slice(0, BASIC_PRESET.engineFlowCaps.checks);
|
|
85
|
+
const flows = specs.map(spec => {
|
|
86
|
+
const steps = pages.map(page => ({
|
|
87
|
+
action: `${spec.action} on ${page.url}`,
|
|
88
|
+
expectation: spec.expectation,
|
|
89
|
+
pageCheck: spec.pageCheck,
|
|
90
|
+
url: page.url,
|
|
91
|
+
}));
|
|
92
|
+
return {
|
|
93
|
+
id: spec.id,
|
|
94
|
+
name: spec.name,
|
|
95
|
+
description: spec.description,
|
|
96
|
+
kind: spec.kind,
|
|
97
|
+
startUrl: pages[0].url,
|
|
98
|
+
steps,
|
|
99
|
+
expectation: spec.expectation,
|
|
100
|
+
severityIfFails: spec.severityIfFails,
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
flows,
|
|
105
|
+
note: `Added ${flows.length} page checks (${specs.map(spec => spec.pageCheck).join(', ')}) outside the flow budget.`,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/checks/plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAc1C,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD;QACE,EAAE,EAAE,eAAe;QACn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EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG;YACtB,KAAK;YACL,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,IAAI,EAAE,SAAS,KAAK,CAAC,MAAM,iBAAiB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B;KACrH,CAAC;AACJ,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -44,13 +44,14 @@ import { mkdirSync, writeFileSync, existsSync, statSync } from 'node:fs';
|
|
|
44
44
|
import { resolve, relative } from 'node:path';
|
|
45
45
|
import { Monkey } from './monkey.js';
|
|
46
46
|
import { createLLM } from './llm/index.js';
|
|
47
|
-
import { autoLLMConfig, detectProviderFromEnv, CHEAP_FAST_MODEL } from './llm/presets.js';
|
|
48
|
-
import { applyDepthPreset } from './depth.js';
|
|
47
|
+
import { autoLLMConfig, detectProviderFromEnv, CHEAP_FAST_MODEL, SMART_MODEL } from './llm/presets.js';
|
|
48
|
+
import { applyDepthPreset, BASIC_PRESET } from './depth.js';
|
|
49
49
|
import { savePlan, loadPlan, saveRun, loadRun, listRuns, } from './persistence/index.js';
|
|
50
50
|
import { bugMatchesFingerprint, diffRuns, summariseDiff } from './diff/index.js';
|
|
51
51
|
import { replayTraces } from './runner/replay.js';
|
|
52
52
|
import { triage } from './triager/index.js';
|
|
53
53
|
import { verifyBugs } from './verify/index.js';
|
|
54
|
+
import { ENGINE_VERSION } from './version.js';
|
|
54
55
|
/* ── Tiny ANSI helpers (no chalk dep) ─────────────────────────────────── */
|
|
55
56
|
const c = {
|
|
56
57
|
reset: '\x1b[0m',
|
|
@@ -66,7 +67,7 @@ const c = {
|
|
|
66
67
|
function tty(s, code) {
|
|
67
68
|
return process.stdout.isTTY ? `${c[code]}${s}${c.reset}` : s;
|
|
68
69
|
}
|
|
69
|
-
const
|
|
70
|
+
const ENGINE_LABEL = `monkeytester@${ENGINE_VERSION}`;
|
|
70
71
|
function defaultCommonOpts() {
|
|
71
72
|
return {
|
|
72
73
|
dir: '.monkeytest',
|
|
@@ -118,6 +119,13 @@ function parseArgs(argv) {
|
|
|
118
119
|
case '--model':
|
|
119
120
|
out.opts.model = next();
|
|
120
121
|
break;
|
|
122
|
+
case '--planner-model': {
|
|
123
|
+
const id = next();
|
|
124
|
+
if (!id)
|
|
125
|
+
die(2, '--planner-model requires a model id');
|
|
126
|
+
out.opts.plannerModel = id;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
121
129
|
case '--api-key':
|
|
122
130
|
case '--apikey':
|
|
123
131
|
out.opts.apiKey = next();
|
|
@@ -191,6 +199,13 @@ function parseArgs(argv) {
|
|
|
191
199
|
out.opts.maxFlows = applied.maxFlows;
|
|
192
200
|
out.opts.focus = applied.focus;
|
|
193
201
|
out.opts.depth = applied.preset.id;
|
|
202
|
+
out.opts.stepTimeoutMs = applied.stepTimeoutMs;
|
|
203
|
+
out.opts.flowTimeoutMs = applied.flowTimeoutMs;
|
|
204
|
+
out.opts.totalBudgetMs = applied.totalBudgetMs;
|
|
205
|
+
out.opts.pageTimeoutMs = applied.pageTimeoutMs;
|
|
206
|
+
if (applied.preset.id === 'basic') {
|
|
207
|
+
out.opts.minFlows = Math.min(BASIC_PRESET.llmFlows, applied.maxFlows);
|
|
208
|
+
}
|
|
194
209
|
}
|
|
195
210
|
catch (err) {
|
|
196
211
|
die(2, err instanceof Error ? err.message : String(err));
|
|
@@ -200,21 +215,38 @@ function parseArgs(argv) {
|
|
|
200
215
|
}
|
|
201
216
|
/* ── LLM config resolution ────────────────────────────────────────────── */
|
|
202
217
|
function buildLLMConfig(opts) {
|
|
203
|
-
//
|
|
218
|
+
// Explorer summaries stay on the cheap model. --model changes the runner
|
|
219
|
+
// and, unless --planner-model is set, the planner. --planner-model never
|
|
220
|
+
// changes the summary or runner models.
|
|
221
|
+
let config;
|
|
204
222
|
if (opts.provider) {
|
|
205
|
-
const
|
|
223
|
+
const base = {
|
|
206
224
|
provider: opts.provider,
|
|
207
|
-
model: opts.model,
|
|
208
225
|
apiKey: opts.apiKey,
|
|
209
226
|
baseURL: opts.baseURL,
|
|
210
227
|
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
228
|
+
const cheap = CHEAP_FAST_MODEL[opts.provider];
|
|
229
|
+
const plannerDefault = opts.quality === 'cheap' ? cheap : SMART_MODEL[opts.provider];
|
|
230
|
+
config = {
|
|
231
|
+
explorer: { ...base, model: cheap },
|
|
232
|
+
planner: { ...base, model: opts.model || plannerDefault },
|
|
233
|
+
runner: { ...base, model: opts.model || cheap },
|
|
215
234
|
};
|
|
216
235
|
}
|
|
217
|
-
|
|
236
|
+
else {
|
|
237
|
+
config = autoLLMConfig({ quality: opts.quality });
|
|
238
|
+
if (opts.model) {
|
|
239
|
+
config = {
|
|
240
|
+
...config,
|
|
241
|
+
planner: { ...config.planner, model: opts.model },
|
|
242
|
+
runner: { ...(config.runner ?? config.planner), model: opts.model },
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (opts.plannerModel) {
|
|
247
|
+
config = { ...config, planner: { ...config.planner, model: opts.plannerModel } };
|
|
248
|
+
}
|
|
249
|
+
return config;
|
|
218
250
|
}
|
|
219
251
|
function ensureLLMReady(opts) {
|
|
220
252
|
if (opts.provider)
|
|
@@ -249,12 +281,13 @@ Commands:
|
|
|
249
281
|
Common flags (apply to most commands):
|
|
250
282
|
-d, --dir <path> Working dir (default ./.monkeytest)
|
|
251
283
|
--provider <id> openai | gemini | anthropic | mistral | groq | openai_compatible
|
|
252
|
-
--model <id>
|
|
284
|
+
--model <id> Runner model. Also the planner model unless --planner-model is set
|
|
285
|
+
--planner-model <id> Planner model only. Page summaries stay on the cheap model
|
|
253
286
|
--api-key <key> Override env API key
|
|
254
287
|
--base-url <url> Required for openai_compatible (Ollama, vLLM, …)
|
|
255
288
|
--quality <preset> cheap | balanced | smart (default balanced)
|
|
256
289
|
--depth <preset> basic (Quick pass) | standard | deep | shallow
|
|
257
|
-
basic: 6 pages,
|
|
290
|
+
basic: 6 pages, 5 LLM flows, 5 page checks, 120s budget
|
|
258
291
|
-m, --max <n> Max pages to crawl (default 8, or the depth preset)
|
|
259
292
|
--flows <n> Max flows to plan (default 6, or the depth preset)
|
|
260
293
|
--no-headless Show the browser window
|
|
@@ -288,11 +321,11 @@ Docs: https://docs.monkeytest.ai
|
|
|
288
321
|
Scaffold a working directory with config defaults. Idempotent.`,
|
|
289
322
|
explore: `monkeytest explore <url> [--max 8] [--flows 6] [--depth basic] [--no-headless]
|
|
290
323
|
Crawl <url>, summarise pages, generate a TestPlan. Writes plan.json + shots/.
|
|
291
|
-
--depth basic is Quick pass:
|
|
324
|
+
--depth basic is Quick pass: 6 pages, 5 LLM flows, page checks outside that budget, 120s total.`,
|
|
292
325
|
run: `monkeytest run <url> [--max 8] [--flows 6] [--depth basic] [--quality balanced]
|
|
293
326
|
Run the full pipeline (explore + plan + run + triage). Writes plan.json,
|
|
294
327
|
runs/<id>.json, and screenshots. Exits with code 1 if blocking bugs found.
|
|
295
|
-
--depth basic is Quick pass (6 pages,
|
|
328
|
+
--depth basic is Quick pass (6 pages, 5 LLM flows, page checks, 120s budget).
|
|
296
329
|
Same-origin HTTP ≥500 responses fail the step (--no-fail-on-5xx opts out).
|
|
297
330
|
The crawl reserves room for help/contact/about pages under a small --max.
|
|
298
331
|
A crawled form, an enabled button, a link to a page the crawl did not open,
|
|
@@ -360,7 +393,7 @@ async function cmdExplore(url, opts) {
|
|
|
360
393
|
if (!url)
|
|
361
394
|
die(2, 'Usage: monkeytest explore <url>');
|
|
362
395
|
ensureLLMReady(opts);
|
|
363
|
-
const monkey = new Monkey({ llm: buildLLMConfig(opts), strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
396
|
+
const monkey = new Monkey({ llm: buildLLMConfig(opts), plannerModel: opts.plannerModel, strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
364
397
|
console.log(`\n→ Exploring ${tty(url, 'cyan')} (max ${opts.maxPages} pages, headless=${opts.headless})…\n`);
|
|
365
398
|
const t0 = Date.now();
|
|
366
399
|
const screenshotsDir = resolve(opts.dir, 'shots');
|
|
@@ -370,15 +403,16 @@ async function cmdExplore(url, opts) {
|
|
|
370
403
|
maxPages: opts.maxPages,
|
|
371
404
|
headless: opts.headless,
|
|
372
405
|
screenshotsDir,
|
|
406
|
+
pageTimeoutMs: opts.pageTimeoutMs,
|
|
373
407
|
onPage: (p) => console.log(` · visited [${p.authGated ? 'auth' : 'open'}] ${p.url} — ${truncate(p.summary, 80)}`),
|
|
374
408
|
},
|
|
375
|
-
plan: { maxFlows: opts.maxFlows, focus: opts.focus },
|
|
409
|
+
plan: { maxFlows: opts.maxFlows, focus: opts.focus, minFlows: opts.minFlows, maxPages: opts.maxPages },
|
|
376
410
|
});
|
|
377
411
|
const dt = ((Date.now() - t0) / 1000).toFixed(1);
|
|
378
412
|
const sitemapFile = resolve(opts.dir, 'sitemap.json');
|
|
379
413
|
mkdirSync(opts.dir, { recursive: true });
|
|
380
414
|
writeFileSync(sitemapFile, JSON.stringify(siteMap, null, 2));
|
|
381
|
-
const planFile = savePlan(plan, { dir: opts.dir, label: opts.label, engine:
|
|
415
|
+
const planFile = savePlan(plan, { dir: opts.dir, label: opts.label, engine: ENGINE_LABEL });
|
|
382
416
|
console.log(summariseSiteMap(siteMap));
|
|
383
417
|
console.log(summarisePlan(plan));
|
|
384
418
|
console.log(`\n${tty('✓', 'green')} Done in ${dt}s.`);
|
|
@@ -391,7 +425,7 @@ async function cmdRun(url, opts) {
|
|
|
391
425
|
ensureLLMReady(opts);
|
|
392
426
|
const screenshotsDir = resolve(opts.dir, 'shots');
|
|
393
427
|
mkdirSync(screenshotsDir, { recursive: true });
|
|
394
|
-
const monkey = new Monkey({ llm: buildLLMConfig(opts), strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
428
|
+
const monkey = new Monkey({ llm: buildLLMConfig(opts), plannerModel: opts.plannerModel, strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
395
429
|
console.log(`\n→ Running ${tty(url, 'cyan')} (max ${opts.maxPages} pages, ${opts.maxFlows} flows, headless=${opts.headless})…\n`);
|
|
396
430
|
const t0 = Date.now();
|
|
397
431
|
const { siteMap, plan, run } = await monkey.executeAndTriage(url, {
|
|
@@ -399,12 +433,16 @@ async function cmdRun(url, opts) {
|
|
|
399
433
|
maxPages: opts.maxPages,
|
|
400
434
|
headless: opts.headless,
|
|
401
435
|
screenshotsDir,
|
|
436
|
+
pageTimeoutMs: opts.pageTimeoutMs,
|
|
402
437
|
onPage: (p) => console.log(` · visited ${p.url}`),
|
|
403
438
|
},
|
|
404
|
-
plan: { maxFlows: opts.maxFlows, focus: opts.focus },
|
|
439
|
+
plan: { maxFlows: opts.maxFlows, focus: opts.focus, minFlows: opts.minFlows, maxPages: opts.maxPages },
|
|
405
440
|
run: {
|
|
406
441
|
screenshotsDir,
|
|
407
442
|
headless: opts.headless,
|
|
443
|
+
stepTimeoutMs: opts.stepTimeoutMs,
|
|
444
|
+
flowTimeoutMs: opts.flowTimeoutMs,
|
|
445
|
+
totalBudgetMs: opts.totalBudgetMs,
|
|
408
446
|
onEvent: (evt) => {
|
|
409
447
|
if (evt.type === 'flow.start')
|
|
410
448
|
console.log(` ▶ ${tty(evt.flow.name, 'magenta')}`);
|
|
@@ -416,11 +454,11 @@ async function cmdRun(url, opts) {
|
|
|
416
454
|
},
|
|
417
455
|
});
|
|
418
456
|
const dt = ((Date.now() - t0) / 1000).toFixed(1);
|
|
419
|
-
const planFile = savePlan(plan, { dir: opts.dir, label: opts.label, engine:
|
|
457
|
+
const planFile = savePlan(plan, { dir: opts.dir, label: opts.label, engine: ENGINE_LABEL });
|
|
420
458
|
const { path: runFile, id: runId } = saveRun(run, {
|
|
421
459
|
dir: opts.dir,
|
|
422
460
|
planRef: { path: planFile, createdAt: new Date().toISOString() },
|
|
423
|
-
engine:
|
|
461
|
+
engine: ENGINE_LABEL,
|
|
424
462
|
});
|
|
425
463
|
if (opts.json) {
|
|
426
464
|
console.log(JSON.stringify({ siteMap, plan, run, runId, runFile, planFile }, null, 2));
|
|
@@ -474,7 +512,7 @@ async function replayStoredRun(stored, traces, opts) {
|
|
|
474
512
|
const { path: runFile, id: newRunId } = saveRun(run, {
|
|
475
513
|
dir: opts.dir,
|
|
476
514
|
planRef: stored.planRef,
|
|
477
|
-
engine:
|
|
515
|
+
engine: ENGINE_LABEL,
|
|
478
516
|
});
|
|
479
517
|
if (opts.json) {
|
|
480
518
|
console.log(JSON.stringify({ run, runId: newRunId, runFile, replay: true, heal: opts.heal }, null, 2));
|
|
@@ -510,7 +548,7 @@ async function rerunStoredPlan(stored, opts) {
|
|
|
510
548
|
}
|
|
511
549
|
const screenshotsDir = resolve(opts.dir, 'shots');
|
|
512
550
|
mkdirSync(screenshotsDir, { recursive: true });
|
|
513
|
-
const monkey = new Monkey({ llm: buildLLMConfig(opts), strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
551
|
+
const monkey = new Monkey({ llm: buildLLMConfig(opts), plannerModel: opts.plannerModel, strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
514
552
|
console.log(`\n↻ Re-running ${storedPlan.plan.flows.length} flow(s) from ${tty(relative(process.cwd(), planSource), 'cyan')}…\n`);
|
|
515
553
|
const t0 = Date.now();
|
|
516
554
|
const { run } = await monkey.runFromPlan(storedPlan.plan, {
|
|
@@ -531,7 +569,7 @@ async function rerunStoredPlan(stored, opts) {
|
|
|
531
569
|
const { path: runFile, id: newRunId } = saveRun(run, {
|
|
532
570
|
dir: opts.dir,
|
|
533
571
|
planRef: { path: planSource, createdAt: storedPlan.createdAt },
|
|
534
|
-
engine:
|
|
572
|
+
engine: ENGINE_LABEL,
|
|
535
573
|
});
|
|
536
574
|
console.log(summariseRun(run));
|
|
537
575
|
console.log(`\n${tty('✓', 'green')} Re-run complete in ${dt}s.`);
|
|
@@ -782,7 +820,7 @@ async function main() {
|
|
|
782
820
|
return;
|
|
783
821
|
}
|
|
784
822
|
if (args.command === 'version') {
|
|
785
|
-
console.log(
|
|
823
|
+
console.log(ENGINE_LABEL);
|
|
786
824
|
return;
|
|
787
825
|
}
|
|
788
826
|
switch (args.command) {
|