@monkeytestai/monkeytester 0.7.0-beta.1 → 0.7.0-beta.3
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 +27 -0
- package/README.md +4 -3
- package/dist/audit/cases.d.ts +9 -0
- package/dist/audit/cases.d.ts.map +1 -0
- package/dist/audit/cases.js +164 -0
- package/dist/audit/cases.js.map +1 -0
- package/dist/audit/falsePass.d.ts +41 -0
- package/dist/audit/falsePass.d.ts.map +1 -0
- package/dist/audit/falsePass.js +51 -0
- package/dist/audit/falsePass.js.map +1 -0
- 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 +427 -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 +85 -19
- 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/inbox/http.d.ts +20 -0
- package/dist/inbox/http.d.ts.map +1 -0
- package/dist/inbox/http.js +119 -0
- package/dist/inbox/http.js.map +1 -0
- package/dist/inbox/load.d.ts +10 -0
- package/dist/inbox/load.d.ts.map +1 -0
- package/dist/inbox/load.js +33 -0
- package/dist/inbox/load.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- 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 +13 -1
- package/dist/monkey.d.ts.map +1 -1
- package/dist/monkey.js +28 -4
- package/dist/monkey.js.map +1 -1
- package/dist/outcome/check.d.ts +49 -0
- package/dist/outcome/check.d.ts.map +1 -0
- package/dist/outcome/check.js +275 -0
- package/dist/outcome/check.js.map +1 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +45 -1
- package/dist/outcome.js.map +1 -1
- package/dist/planner/authNegative.d.ts.map +1 -1
- package/dist/planner/authNegative.js +12 -0
- package/dist/planner/authNegative.js.map +1 -1
- package/dist/planner/dedupe.d.ts.map +1 -1
- package/dist/planner/dedupe.js +22 -2
- package/dist/planner/dedupe.js.map +1 -1
- package/dist/planner/faults.js +1 -0
- package/dist/planner/faults.js.map +1 -1
- package/dist/planner/focus.d.ts.map +1 -1
- package/dist/planner/focus.js +18 -5
- package/dist/planner/focus.js.map +1 -1
- package/dist/planner/forms.d.ts.map +1 -1
- package/dist/planner/forms.js +4 -1
- package/dist/planner/forms.js.map +1 -1
- package/dist/planner/index.d.ts +18 -2
- package/dist/planner/index.d.ts.map +1 -1
- package/dist/planner/index.js +84 -8
- 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 +13 -0
- package/dist/planner/inventory.js.map +1 -1
- package/dist/planner/salvage.d.ts.map +1 -1
- package/dist/planner/salvage.js +9 -4
- package/dist/planner/salvage.js.map +1 -1
- package/dist/runner/flowStatus.d.ts +7 -2
- package/dist/runner/flowStatus.d.ts.map +1 -1
- package/dist/runner/flowStatus.js +12 -3
- package/dist/runner/flowStatus.js.map +1 -1
- package/dist/runner/index.d.ts +19 -1
- package/dist/runner/index.d.ts.map +1 -1
- package/dist/runner/index.js +238 -7
- package/dist/runner/index.js.map +1 -1
- package/dist/runner/replay.d.ts +3 -1
- package/dist/runner/replay.d.ts.map +1 -1
- package/dist/runner/replay.js +125 -16
- package/dist/runner/replay.js.map +1 -1
- package/dist/signup/detect.d.ts +60 -0
- package/dist/signup/detect.d.ts.map +1 -0
- package/dist/signup/detect.js +125 -0
- package/dist/signup/detect.js.map +1 -0
- package/dist/signup/guard.d.ts +21 -0
- package/dist/signup/guard.d.ts.map +1 -0
- package/dist/signup/guard.js +102 -0
- package/dist/signup/guard.js.map +1 -0
- package/dist/signup/ledger.d.ts +31 -0
- package/dist/signup/ledger.d.ts.map +1 -0
- package/dist/signup/ledger.js +60 -0
- package/dist/signup/ledger.js.map +1 -0
- package/dist/signup/plan.d.ts +21 -0
- package/dist/signup/plan.d.ts.map +1 -0
- package/dist/signup/plan.js +120 -0
- package/dist/signup/plan.js.map +1 -0
- package/dist/signup/run.d.ts +28 -0
- package/dist/signup/run.d.ts.map +1 -0
- package/dist/signup/run.js +241 -0
- package/dist/signup/run.js.map +1 -0
- package/dist/trace/serialize.d.ts.map +1 -1
- package/dist/trace/serialize.js +2 -0
- package/dist/trace/serialize.js.map +1 -1
- package/dist/triager/index.d.ts.map +1 -1
- package/dist/triager/index.js +8 -3
- package/dist/triager/index.js.map +1 -1
- package/dist/types.d.ts +124 -2
- package/dist/types.d.ts.map +1 -1
- package/package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CAAC,CAAC;IACjE,OAAO;QACL,KAAK,EAAE,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QACpC,WAAW,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAChE,IAAI,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAClE,QAAQ,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC1D,EAAE,EAAE,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,MAAM;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 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;AAEtB,MAAM,UAAU,WAAW,CAAC,QAAwB;IAClD,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,QAAQ,CAAC,QAAQ,GAAG,eAAe,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC;IAC3F,CAAC;SAAM,IAAI,QAAQ,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC;IAC1G,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAC5C,MAAM,CAAC,KAAK,GAAG,CAA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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,W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
+
* 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;QACnB,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,QAAQ;QACd,eAAe,EAAE,OAAO;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,0EAA0E;QACvF,WAAW,EAAE,2EAA2E;QACxF,MAAM,EAAE,sBAAsB;KAC/B;IACD;QACE,EAAE,EAAE,YAAY;QAChB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,QAAQ;QACd,eAAe,EAAE,OAAO;QACxB,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,6GAA6G;QAC1H,WAAW,EAAE,uEAAuE;QACpF,MAAM,EAAE,wCAAwC;KACjD;IACD;QACE,EAAE,EAAE,WAAW;QACf,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,eAAe;QACrB,eAAe,EAAE,OAAO;QACxB,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,0IAA0I;QACvJ,WAAW,EAAE,0DAA0D;QACvE,MAA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
|
|
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
54
|
import { ENGINE_VERSION } from './version.js';
|
|
55
|
+
import { createHttpInbox } from './inbox/http.js';
|
|
56
|
+
import { loadInboxProvider } from './inbox/load.js';
|
|
55
57
|
/* ── Tiny ANSI helpers (no chalk dep) ─────────────────────────────────── */
|
|
56
58
|
const c = {
|
|
57
59
|
reset: '\x1b[0m',
|
|
@@ -119,6 +121,13 @@ function parseArgs(argv) {
|
|
|
119
121
|
case '--model':
|
|
120
122
|
out.opts.model = next();
|
|
121
123
|
break;
|
|
124
|
+
case '--planner-model': {
|
|
125
|
+
const id = next();
|
|
126
|
+
if (!id)
|
|
127
|
+
die(2, '--planner-model requires a model id');
|
|
128
|
+
out.opts.plannerModel = id;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
122
131
|
case '--api-key':
|
|
123
132
|
case '--apikey':
|
|
124
133
|
out.opts.apiKey = next();
|
|
@@ -161,6 +170,20 @@ function parseArgs(argv) {
|
|
|
161
170
|
case '--no-fail-on-5xx':
|
|
162
171
|
out.opts.failOn5xx = false;
|
|
163
172
|
break;
|
|
173
|
+
case '--inbox': {
|
|
174
|
+
const spec = next();
|
|
175
|
+
if (!spec)
|
|
176
|
+
die(2, '--inbox requires a module path');
|
|
177
|
+
out.opts.inboxModule = spec;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
case '--inbox-http': {
|
|
181
|
+
const url = next();
|
|
182
|
+
if (!url)
|
|
183
|
+
die(2, '--inbox-http requires your inbox base URL');
|
|
184
|
+
out.opts.inboxHttp = url;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
164
187
|
case '--heal':
|
|
165
188
|
out.opts.heal = true;
|
|
166
189
|
break;
|
|
@@ -192,6 +215,13 @@ function parseArgs(argv) {
|
|
|
192
215
|
out.opts.maxFlows = applied.maxFlows;
|
|
193
216
|
out.opts.focus = applied.focus;
|
|
194
217
|
out.opts.depth = applied.preset.id;
|
|
218
|
+
out.opts.stepTimeoutMs = applied.stepTimeoutMs;
|
|
219
|
+
out.opts.flowTimeoutMs = applied.flowTimeoutMs;
|
|
220
|
+
out.opts.totalBudgetMs = applied.totalBudgetMs;
|
|
221
|
+
out.opts.pageTimeoutMs = applied.pageTimeoutMs;
|
|
222
|
+
if (applied.preset.id === 'basic') {
|
|
223
|
+
out.opts.minFlows = Math.min(BASIC_PRESET.llmFlows, applied.maxFlows);
|
|
224
|
+
}
|
|
195
225
|
}
|
|
196
226
|
catch (err) {
|
|
197
227
|
die(2, err instanceof Error ? err.message : String(err));
|
|
@@ -201,21 +231,38 @@ function parseArgs(argv) {
|
|
|
201
231
|
}
|
|
202
232
|
/* ── LLM config resolution ────────────────────────────────────────────── */
|
|
203
233
|
function buildLLMConfig(opts) {
|
|
204
|
-
//
|
|
234
|
+
// Explorer summaries stay on the cheap model. --model changes the runner
|
|
235
|
+
// and, unless --planner-model is set, the planner. --planner-model never
|
|
236
|
+
// changes the summary or runner models.
|
|
237
|
+
let config;
|
|
205
238
|
if (opts.provider) {
|
|
206
|
-
const
|
|
239
|
+
const base = {
|
|
207
240
|
provider: opts.provider,
|
|
208
|
-
model: opts.model,
|
|
209
241
|
apiKey: opts.apiKey,
|
|
210
242
|
baseURL: opts.baseURL,
|
|
211
243
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
244
|
+
const cheap = CHEAP_FAST_MODEL[opts.provider];
|
|
245
|
+
const plannerDefault = opts.quality === 'cheap' ? cheap : SMART_MODEL[opts.provider];
|
|
246
|
+
config = {
|
|
247
|
+
explorer: { ...base, model: cheap },
|
|
248
|
+
planner: { ...base, model: opts.model || plannerDefault },
|
|
249
|
+
runner: { ...base, model: opts.model || cheap },
|
|
216
250
|
};
|
|
217
251
|
}
|
|
218
|
-
|
|
252
|
+
else {
|
|
253
|
+
config = autoLLMConfig({ quality: opts.quality });
|
|
254
|
+
if (opts.model) {
|
|
255
|
+
config = {
|
|
256
|
+
...config,
|
|
257
|
+
planner: { ...config.planner, model: opts.model },
|
|
258
|
+
runner: { ...(config.runner ?? config.planner), model: opts.model },
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (opts.plannerModel) {
|
|
263
|
+
config = { ...config, planner: { ...config.planner, model: opts.plannerModel } };
|
|
264
|
+
}
|
|
265
|
+
return config;
|
|
219
266
|
}
|
|
220
267
|
function ensureLLMReady(opts) {
|
|
221
268
|
if (opts.provider)
|
|
@@ -250,12 +297,13 @@ Commands:
|
|
|
250
297
|
Common flags (apply to most commands):
|
|
251
298
|
-d, --dir <path> Working dir (default ./.monkeytest)
|
|
252
299
|
--provider <id> openai | gemini | anthropic | mistral | groq | openai_compatible
|
|
253
|
-
--model <id>
|
|
300
|
+
--model <id> Runner model. Also the planner model unless --planner-model is set
|
|
301
|
+
--planner-model <id> Planner model only. Page summaries stay on the cheap model
|
|
254
302
|
--api-key <key> Override env API key
|
|
255
303
|
--base-url <url> Required for openai_compatible (Ollama, vLLM, …)
|
|
256
304
|
--quality <preset> cheap | balanced | smart (default balanced)
|
|
257
305
|
--depth <preset> basic (Quick pass) | standard | deep | shallow
|
|
258
|
-
basic: 6 pages,
|
|
306
|
+
basic: 6 pages, 5 LLM flows, 5 page checks, 120s budget
|
|
259
307
|
-m, --max <n> Max pages to crawl (default 8, or the depth preset)
|
|
260
308
|
--flows <n> Max flows to plan (default 6, or the depth preset)
|
|
261
309
|
--no-headless Show the browser window
|
|
@@ -266,6 +314,8 @@ Common flags (apply to most commands):
|
|
|
266
314
|
--json Machine-readable output
|
|
267
315
|
--fail-on-5xx Fail steps that saw a same-origin HTTP ≥500 (default)
|
|
268
316
|
--no-fail-on-5xx Keep those 5xx responses as evidence only
|
|
317
|
+
--inbox <module> Module that exports your InboxProvider (no hosted inbox)
|
|
318
|
+
--inbox-http <url> Your HTTP inbox API (MONKEYTEST_INBOX_TOKEN). No default host.
|
|
269
319
|
|
|
270
320
|
Exit codes: 0 ok · 1 bugs still firing · 2 bad args / setup · 3 engine error.
|
|
271
321
|
|
|
@@ -289,11 +339,11 @@ Docs: https://docs.monkeytest.ai
|
|
|
289
339
|
Scaffold a working directory with config defaults. Idempotent.`,
|
|
290
340
|
explore: `monkeytest explore <url> [--max 8] [--flows 6] [--depth basic] [--no-headless]
|
|
291
341
|
Crawl <url>, summarise pages, generate a TestPlan. Writes plan.json + shots/.
|
|
292
|
-
--depth basic is Quick pass:
|
|
342
|
+
--depth basic is Quick pass: 6 pages, 5 LLM flows, page checks outside that budget, 120s total.`,
|
|
293
343
|
run: `monkeytest run <url> [--max 8] [--flows 6] [--depth basic] [--quality balanced]
|
|
294
344
|
Run the full pipeline (explore + plan + run + triage). Writes plan.json,
|
|
295
345
|
runs/<id>.json, and screenshots. Exits with code 1 if blocking bugs found.
|
|
296
|
-
--depth basic is Quick pass (6 pages,
|
|
346
|
+
--depth basic is Quick pass (6 pages, 5 LLM flows, page checks, 120s budget).
|
|
297
347
|
Same-origin HTTP ≥500 responses fail the step (--no-fail-on-5xx opts out).
|
|
298
348
|
The crawl reserves room for help/contact/about pages under a small --max.
|
|
299
349
|
A crawled form, an enabled button, a link to a page the crawl did not open,
|
|
@@ -361,7 +411,7 @@ async function cmdExplore(url, opts) {
|
|
|
361
411
|
if (!url)
|
|
362
412
|
die(2, 'Usage: monkeytest explore <url>');
|
|
363
413
|
ensureLLMReady(opts);
|
|
364
|
-
const monkey = new Monkey({ llm: buildLLMConfig(opts), strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
414
|
+
const monkey = new Monkey({ llm: buildLLMConfig(opts), plannerModel: opts.plannerModel, strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
365
415
|
console.log(`\n→ Exploring ${tty(url, 'cyan')} (max ${opts.maxPages} pages, headless=${opts.headless})…\n`);
|
|
366
416
|
const t0 = Date.now();
|
|
367
417
|
const screenshotsDir = resolve(opts.dir, 'shots');
|
|
@@ -371,9 +421,10 @@ async function cmdExplore(url, opts) {
|
|
|
371
421
|
maxPages: opts.maxPages,
|
|
372
422
|
headless: opts.headless,
|
|
373
423
|
screenshotsDir,
|
|
424
|
+
pageTimeoutMs: opts.pageTimeoutMs,
|
|
374
425
|
onPage: (p) => console.log(` · visited [${p.authGated ? 'auth' : 'open'}] ${p.url} — ${truncate(p.summary, 80)}`),
|
|
375
426
|
},
|
|
376
|
-
plan: { maxFlows: opts.maxFlows, focus: opts.focus },
|
|
427
|
+
plan: { maxFlows: opts.maxFlows, focus: opts.focus, minFlows: opts.minFlows, maxPages: opts.maxPages, signupInbox: Boolean(opts.inboxModule || opts.inboxHttp) },
|
|
377
428
|
});
|
|
378
429
|
const dt = ((Date.now() - t0) / 1000).toFixed(1);
|
|
379
430
|
const sitemapFile = resolve(opts.dir, 'sitemap.json');
|
|
@@ -392,7 +443,8 @@ async function cmdRun(url, opts) {
|
|
|
392
443
|
ensureLLMReady(opts);
|
|
393
444
|
const screenshotsDir = resolve(opts.dir, 'shots');
|
|
394
445
|
mkdirSync(screenshotsDir, { recursive: true });
|
|
395
|
-
const
|
|
446
|
+
const inbox = await inboxFromOpts(opts);
|
|
447
|
+
const monkey = new Monkey({ llm: buildLLMConfig(opts), plannerModel: opts.plannerModel, strictOracles: true, failOn5xx: opts.failOn5xx, inbox });
|
|
396
448
|
console.log(`\n→ Running ${tty(url, 'cyan')} (max ${opts.maxPages} pages, ${opts.maxFlows} flows, headless=${opts.headless})…\n`);
|
|
397
449
|
const t0 = Date.now();
|
|
398
450
|
const { siteMap, plan, run } = await monkey.executeAndTriage(url, {
|
|
@@ -400,12 +452,16 @@ async function cmdRun(url, opts) {
|
|
|
400
452
|
maxPages: opts.maxPages,
|
|
401
453
|
headless: opts.headless,
|
|
402
454
|
screenshotsDir,
|
|
455
|
+
pageTimeoutMs: opts.pageTimeoutMs,
|
|
403
456
|
onPage: (p) => console.log(` · visited ${p.url}`),
|
|
404
457
|
},
|
|
405
|
-
plan: { maxFlows: opts.maxFlows, focus: opts.focus },
|
|
458
|
+
plan: { maxFlows: opts.maxFlows, focus: opts.focus, minFlows: opts.minFlows, maxPages: opts.maxPages, signupInbox: Boolean(opts.inboxModule || opts.inboxHttp) },
|
|
406
459
|
run: {
|
|
407
460
|
screenshotsDir,
|
|
408
461
|
headless: opts.headless,
|
|
462
|
+
stepTimeoutMs: opts.stepTimeoutMs,
|
|
463
|
+
flowTimeoutMs: opts.flowTimeoutMs,
|
|
464
|
+
totalBudgetMs: opts.totalBudgetMs,
|
|
409
465
|
onEvent: (evt) => {
|
|
410
466
|
if (evt.type === 'flow.start')
|
|
411
467
|
console.log(` ▶ ${tty(evt.flow.name, 'magenta')}`);
|
|
@@ -511,7 +567,7 @@ async function rerunStoredPlan(stored, opts) {
|
|
|
511
567
|
}
|
|
512
568
|
const screenshotsDir = resolve(opts.dir, 'shots');
|
|
513
569
|
mkdirSync(screenshotsDir, { recursive: true });
|
|
514
|
-
const monkey = new Monkey({ llm: buildLLMConfig(opts), strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
570
|
+
const monkey = new Monkey({ llm: buildLLMConfig(opts), plannerModel: opts.plannerModel, strictOracles: true, failOn5xx: opts.failOn5xx });
|
|
515
571
|
console.log(`\n↻ Re-running ${storedPlan.plan.flows.length} flow(s) from ${tty(relative(process.cwd(), planSource), 'cyan')}…\n`);
|
|
516
572
|
const t0 = Date.now();
|
|
517
573
|
const { run } = await monkey.runFromPlan(storedPlan.plan, {
|
|
@@ -768,6 +824,16 @@ function exitIfBlocking(run) {
|
|
|
768
824
|
function truncate(s, n) {
|
|
769
825
|
return s.length > n ? `${s.slice(0, n - 1)}…` : s;
|
|
770
826
|
}
|
|
827
|
+
async function inboxFromOpts(opts) {
|
|
828
|
+
if (opts.inboxModule && opts.inboxHttp)
|
|
829
|
+
die(2, 'Pass either --inbox or --inbox-http, not both.');
|
|
830
|
+
if (opts.inboxModule)
|
|
831
|
+
return loadInboxProvider(opts.inboxModule);
|
|
832
|
+
if (!opts.inboxHttp)
|
|
833
|
+
return undefined;
|
|
834
|
+
const token = process.env.MONKEYTEST_INBOX_TOKEN;
|
|
835
|
+
return createHttpInbox({ baseUrl: opts.inboxHttp, ...(token ? { token } : {}) });
|
|
836
|
+
}
|
|
771
837
|
function die(code, msg) {
|
|
772
838
|
console.error(tty(msg, 'red'));
|
|
773
839
|
process.exit(code);
|