blastproof 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/dist/chunk-DO4WZKLT.js +124 -0
- package/dist/chunk-DO4WZKLT.js.map +1 -0
- package/dist/cli.js +287 -68
- package/dist/cli.js.map +1 -1
- package/dist/snapshot-JISKGGMN.js +16 -0
- package/dist/snapshot-JISKGGMN.js.map +1 -0
- package/package.json +1 -1
- package/dist/snapshot-CAIB2OHX.js +0 -43
- package/dist/snapshot-CAIB2OHX.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
indexRefs,
|
|
4
|
+
snapshotCutAt,
|
|
5
|
+
withoutRefs
|
|
6
|
+
} from "./chunk-DO4WZKLT.js";
|
|
2
7
|
|
|
3
8
|
// src/cli.ts
|
|
4
9
|
import { Command, InvalidArgumentError } from "commander";
|
|
@@ -30,7 +35,7 @@ base_url: http://localhost:4173
|
|
|
30
35
|
llm:
|
|
31
36
|
# anthropic | openai | ollama
|
|
32
37
|
provider: anthropic
|
|
33
|
-
# Optional. Defaults: anthropic=claude-haiku-4-5, openai=gpt-
|
|
38
|
+
# Optional. Defaults: anthropic=claude-haiku-4-5, openai=gpt-6-luna, ollama=gpt-oss:20b
|
|
34
39
|
# model: claude-haiku-4-5
|
|
35
40
|
# Env var holding your API key (not needed for ollama).
|
|
36
41
|
api_key_env: ANTHROPIC_API_KEY
|
|
@@ -257,10 +262,23 @@ var ProviderRefusedError = class extends RunStoppedError {
|
|
|
257
262
|
this.statusCode = statusCode;
|
|
258
263
|
}
|
|
259
264
|
};
|
|
265
|
+
var ModelCallTimeoutError = class extends RunStoppedError {
|
|
266
|
+
timeoutMs;
|
|
267
|
+
constructor(timeoutMs) {
|
|
268
|
+
const seconds3 = Number((timeoutMs / 1e3).toFixed(1));
|
|
269
|
+
super(
|
|
270
|
+
`model call timed out: no answer within ${seconds3}s (llm.timeout_s). For a slow local model, raise llm.timeout_s in .blastproof/config.yaml or set BLASTPROOF_LLM_TIMEOUT_S; otherwise check that the provider is answering, then run again.`
|
|
271
|
+
);
|
|
272
|
+
this.name = "ModelCallTimeoutError";
|
|
273
|
+
this.timeoutMs = timeoutMs;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
260
276
|
var RunBudget = class {
|
|
261
277
|
maxCalls;
|
|
262
278
|
maxTokens;
|
|
263
279
|
maxDurationMs;
|
|
280
|
+
/** How long one model call may take; read by `countedGenerate` (design bound-every-model-call, D2). */
|
|
281
|
+
callTimeoutMs;
|
|
264
282
|
now;
|
|
265
283
|
startedAt;
|
|
266
284
|
calls = 0;
|
|
@@ -270,6 +288,7 @@ var RunBudget = class {
|
|
|
270
288
|
this.maxCalls = options.maxCalls;
|
|
271
289
|
this.maxTokens = options.maxTokens;
|
|
272
290
|
this.maxDurationMs = options.maxDurationMs;
|
|
291
|
+
this.callTimeoutMs = options.callTimeoutMs;
|
|
273
292
|
this.now = options.now ?? Date.now;
|
|
274
293
|
this.startedAt = this.now();
|
|
275
294
|
}
|
|
@@ -301,6 +320,25 @@ var RunBudget = class {
|
|
|
301
320
|
}
|
|
302
321
|
}
|
|
303
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Milliseconds left before the deadline, or undefined without one (design
|
|
325
|
+
* bound-every-model-call, D3). Lets a call in flight be aborted when the
|
|
326
|
+
* deadline passes, rather than only the next call being refused.
|
|
327
|
+
*/
|
|
328
|
+
remainingMs() {
|
|
329
|
+
if (this.maxDurationMs === void 0) return void 0;
|
|
330
|
+
return Math.max(0, this.maxDurationMs - (this.now() - this.startedAt));
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The deadline's stop, for a call its timer aborted (design
|
|
334
|
+
* bound-every-model-call, D3). Not `check()`: a timer can fire a millisecond
|
|
335
|
+
* before the clock `check()` reads has reached the deadline, and that call
|
|
336
|
+
* then left as a timeout, failing a test in the 0.25.0 release workflow.
|
|
337
|
+
*/
|
|
338
|
+
deadlineReached() {
|
|
339
|
+
const configured = this.maxDurationMs ?? 0;
|
|
340
|
+
return new BudgetExhaustedError("duration", Math.max(this.now() - this.startedAt, configured), configured);
|
|
341
|
+
}
|
|
304
342
|
/** Records what a completed model call spent. */
|
|
305
343
|
record(usage) {
|
|
306
344
|
this.calls += 1;
|
|
@@ -496,39 +534,68 @@ function describeTarget(target) {
|
|
|
496
534
|
const parts = [];
|
|
497
535
|
if (target.role) parts.push(`role=${target.role}`);
|
|
498
536
|
if (target.name) parts.push(`name="${target.name}"`);
|
|
499
|
-
if (target.text) parts.push(`text="${target.text}"`);
|
|
500
537
|
return parts.join(" ") || "(no target)";
|
|
501
538
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
539
|
+
function normaliseName(text) {
|
|
540
|
+
return (text ?? "").replace(/\s+/g, " ").trim().toLowerCase();
|
|
541
|
+
}
|
|
542
|
+
function bareRef(ref) {
|
|
543
|
+
return ref.trim().replace(/^\[/, "").replace(/^ref=/, "").replace(/\]$/, "");
|
|
544
|
+
}
|
|
545
|
+
function describeElement(element) {
|
|
546
|
+
const name = element.name ?? element.text;
|
|
547
|
+
return name === void 0 ? element.role : `${element.role} "${name}"`;
|
|
548
|
+
}
|
|
549
|
+
function bindTarget(action, refs) {
|
|
550
|
+
const target = action.target;
|
|
551
|
+
if (!target || !target.ref && !target.role && !target.name) return { ...action, target: void 0 };
|
|
552
|
+
const fix = "Use the [ref=\u2026] on the line of the element you mean in the current snapshot.";
|
|
553
|
+
if (!target.ref) {
|
|
554
|
+
throw new ActionError(`refused: the target names no ref, so nothing was done. ${fix}`);
|
|
555
|
+
}
|
|
556
|
+
const ref = bareRef(target.ref);
|
|
557
|
+
const element = refs.get(ref);
|
|
558
|
+
if (!element) {
|
|
559
|
+
throw new ActionError(`refused: no element in the current snapshot has ref "${ref}". ${fix}`);
|
|
560
|
+
}
|
|
561
|
+
const shown = element.name ?? element.text;
|
|
562
|
+
const sameRole = normaliseName(target.role) === normaliseName(element.role);
|
|
563
|
+
const sameName = normaliseName(target.name) === normaliseName(shown);
|
|
564
|
+
if (!sameRole || !sameName) {
|
|
565
|
+
const said = [target.role ?? "(no role)", target.name === void 0 ? "" : `"${target.name}"`].filter(Boolean).join(" ");
|
|
566
|
+
throw new ActionError(
|
|
567
|
+
`refused: ref ${ref} is ${describeElement(element)}, not ${said}, so nothing was done. ${fix}`
|
|
568
|
+
);
|
|
509
569
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
570
|
+
return { ...action, target: { ref, role: element.role, name: shown } };
|
|
571
|
+
}
|
|
572
|
+
async function resolveTarget(page, target, resolveTimeoutMs = 2e3) {
|
|
573
|
+
if (!target.ref) throw new ActionError(`Element not found: ${describeTarget(target)} has no ref`);
|
|
574
|
+
const ref = bareRef(target.ref);
|
|
575
|
+
const locator = page.locator(`aria-ref=${ref}`);
|
|
576
|
+
let count;
|
|
577
|
+
try {
|
|
578
|
+
count = await locator.count();
|
|
579
|
+
} catch {
|
|
580
|
+
count = 0;
|
|
513
581
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
582
|
+
if (count === 0) {
|
|
583
|
+
throw new ActionError(
|
|
584
|
+
`Element not found: ${describeTarget(target)} (ref ${ref}) is no longer on the page; it changed since the snapshot. Choose the element again from the fresh snapshot.`
|
|
585
|
+
);
|
|
518
586
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}
|
|
587
|
+
try {
|
|
588
|
+
await locator.waitFor({ state: "visible", timeout: resolveTimeoutMs });
|
|
589
|
+
} catch {
|
|
590
|
+
throw new ActionError(
|
|
591
|
+
`Element not found: ${describeTarget(target)} (ref ${ref}) is on the page but did not become visible within ${resolveTimeoutMs}ms.`
|
|
592
|
+
);
|
|
526
593
|
}
|
|
527
|
-
|
|
594
|
+
return locator;
|
|
528
595
|
}
|
|
529
596
|
function requireTarget(action) {
|
|
530
|
-
if (!action.target
|
|
531
|
-
throw new ActionError(`Action "${action.action}" requires a target (
|
|
597
|
+
if (!action.target?.ref) {
|
|
598
|
+
throw new ActionError(`Action "${action.action}" requires a target (its ref in the snapshot)`);
|
|
532
599
|
}
|
|
533
600
|
return action.target;
|
|
534
601
|
}
|
|
@@ -587,7 +654,7 @@ async function performResolvedAction(page, action, ctx) {
|
|
|
587
654
|
}
|
|
588
655
|
case "press": {
|
|
589
656
|
const key = action.value ? resolve(action.value, ctx) : "Enter";
|
|
590
|
-
if (action.target
|
|
657
|
+
if (action.target?.ref) {
|
|
591
658
|
const locator = await resolveTarget(page, action.target, ctx.resolveTimeoutMs);
|
|
592
659
|
await locator.press(key);
|
|
593
660
|
return `ok: pressed ${key} on ${describeTarget(action.target)}`;
|
|
@@ -664,24 +731,26 @@ function normalise(text) {
|
|
|
664
731
|
return text.replace(/\s+/g, " ").trim().toLowerCase();
|
|
665
732
|
}
|
|
666
733
|
function describeAction(action) {
|
|
667
|
-
const target = action.target ? ` ${action.target.role ?? ""} "${action.target.name ??
|
|
734
|
+
const target = action.target ? ` ${action.target.role ?? ""} "${action.target.name ?? ""}"` : "";
|
|
668
735
|
const value = action.value ? ` [${action.value}]` : "";
|
|
669
736
|
return `${action.action}${target}${value}`;
|
|
670
737
|
}
|
|
671
738
|
function identity(action) {
|
|
672
739
|
const role = action.target?.role ?? "";
|
|
673
740
|
const name = action.target?.name ?? "";
|
|
674
|
-
return JSON.stringify([
|
|
675
|
-
action.action,
|
|
676
|
-
role,
|
|
677
|
-
normalise(name),
|
|
678
|
-
role || name ? "" : action.target?.text ?? "",
|
|
679
|
-
action.value ?? ""
|
|
680
|
-
]);
|
|
741
|
+
return JSON.stringify([action.action, role, normalise(name), action.value ?? ""]);
|
|
681
742
|
}
|
|
682
743
|
var StepRecovery = class {
|
|
683
744
|
performed = /* @__PURE__ */ new Set();
|
|
684
745
|
history = [];
|
|
746
|
+
/** The last page the model was shown, as given to `observe` (masked, without refs). */
|
|
747
|
+
lastObserved;
|
|
748
|
+
/**
|
|
749
|
+
* The last action that succeeded, with the page it was decided on (design
|
|
750
|
+
* repeat-a-click-that-moves-the-page, D1/D2). A commit that follows itself
|
|
751
|
+
* on a page that moved is a tour's "Next", not a duplicate.
|
|
752
|
+
*/
|
|
753
|
+
lastSuccess;
|
|
685
754
|
/**
|
|
686
755
|
* Everything the model has been allowed to read this step, normalised: the
|
|
687
756
|
* step's own text, plus every snapshot it has been shown, plus every value it
|
|
@@ -726,6 +795,7 @@ var StepRecovery = class {
|
|
|
726
795
|
*/
|
|
727
796
|
observe(maskedSnapshot) {
|
|
728
797
|
this.readable.push(normalise(maskedSnapshot));
|
|
798
|
+
this.lastObserved = maskedSnapshot;
|
|
729
799
|
}
|
|
730
800
|
/**
|
|
731
801
|
* Whether anything succeeded during this step (design close-a-step D1).
|
|
@@ -747,6 +817,7 @@ var StepRecovery = class {
|
|
|
747
817
|
/** Records an action that was actually performed and succeeded. */
|
|
748
818
|
record(action, description, result) {
|
|
749
819
|
this.performed.add(identity(action));
|
|
820
|
+
this.lastSuccess = { identity: identity(action), page: this.lastObserved };
|
|
750
821
|
this.history.push({ action: description, result });
|
|
751
822
|
if (action.value) this.readable.push(normalise(action.value));
|
|
752
823
|
}
|
|
@@ -804,7 +875,24 @@ var StepRecovery = class {
|
|
|
804
875
|
repeatedCommitRefusal(action) {
|
|
805
876
|
if (!isCommit(action)) return void 0;
|
|
806
877
|
if (!this.performed.has(identity(action))) return void 0;
|
|
807
|
-
|
|
878
|
+
if (this.followsItselfOnAMovedPage(action)) return void 0;
|
|
879
|
+
const target = action.target ? ` on ${action.target.role ?? ""} "${action.target.name ?? ""}"` : "";
|
|
880
|
+
return `refused: this ${action.action}${target} already succeeded earlier in this step, so it was NOT performed again. It is the same control even under a new ref: refs are renumbered when the page changes. Repeating something that commits repeats whatever it changed in the application. If the page no longer shows that it worked, that is normal for a submit answered by a redirect \u2014 check the record of what you have already done. Verify the step's outcome another way, or fail the step.`;
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* The one repeat performed (design repeat-a-click-that-moves-the-page): the
|
|
884
|
+
* same commit as the last action that succeeded, with nothing in between, on
|
|
885
|
+
* a page that differs from the one that success was decided on. A tour's
|
|
886
|
+
* "Next" or a "load more" needs it (#164). Both measured duplicates did
|
|
887
|
+
* something else in between to restore the form, a `fill` (#124) or a click
|
|
888
|
+
* on "New Issue" (#28), and a press that moved nothing is still refused.
|
|
889
|
+
* Compared exactly on the ref-less text `observe` receives, so a re-render
|
|
890
|
+
* alone is no change.
|
|
891
|
+
*/
|
|
892
|
+
followsItselfOnAMovedPage(action) {
|
|
893
|
+
const last = this.lastSuccess;
|
|
894
|
+
if (last === void 0 || last.identity !== identity(action)) return false;
|
|
895
|
+
return last.page !== void 0 && this.lastObserved !== void 0 && last.page !== this.lastObserved;
|
|
808
896
|
}
|
|
809
897
|
/**
|
|
810
898
|
* Refuses a typed value that came from nowhere the model was entitled to read
|
|
@@ -848,6 +936,8 @@ var StepRecovery = class {
|
|
|
848
936
|
// src/runner/executor.ts
|
|
849
937
|
var DEFAULT_MAX_ITERATIONS_PER_STEP = 15;
|
|
850
938
|
var SETTLE_TIMEOUT_MS = 2e3;
|
|
939
|
+
var RENDER_WATCH_MS = 3e3;
|
|
940
|
+
var RENDER_POLL_MS = 250;
|
|
851
941
|
async function waitForSettled(page) {
|
|
852
942
|
const deadline = Date.now() + SETTLE_TIMEOUT_MS;
|
|
853
943
|
const urlBefore = page.url();
|
|
@@ -861,7 +951,7 @@ async function waitForSettled(page) {
|
|
|
861
951
|
}
|
|
862
952
|
}
|
|
863
953
|
async function defaultSnapshot(page, maxLines) {
|
|
864
|
-
const { captureSnapshot } = await import("./snapshot-
|
|
954
|
+
const { captureSnapshot } = await import("./snapshot-JISKGGMN.js");
|
|
865
955
|
return captureSnapshot(page, { maxLines });
|
|
866
956
|
}
|
|
867
957
|
function slugify(text) {
|
|
@@ -869,9 +959,20 @@ function slugify(text) {
|
|
|
869
959
|
return slug || "test";
|
|
870
960
|
}
|
|
871
961
|
var NOTHING_DONE_REFUSAL = "refused: nothing succeeded during this step, so it was NOT closed. A step closes on what was done in it, not on being declared finished. If the outcome already holds \u2014 there was nothing left to do \u2014 assert that it holds and let the judgment close the step; an assertion is evidence, a declaration is not. If the step cannot be carried out at all, fail it and say why.";
|
|
962
|
+
var FAIL_ON_A_CHANGING_PAGE = "not accepted yet: the page changed after the snapshot you answered fail on, so it may still have been loading. Decide again on the page as it is now.";
|
|
872
963
|
var VERIFICATION_DONE_REFUSAL = "refused: this step only verifies, so it closes on a passing assertion, not on being declared finished. Assert what the page shows; if it does not show what the step names, fail the step and say why.";
|
|
873
964
|
var StepFailure = class extends Error {
|
|
874
965
|
};
|
|
966
|
+
async function pageChangedWithin(page, takeSnapshot, view, seen, withinMs) {
|
|
967
|
+
const deadline = Date.now() + withinMs;
|
|
968
|
+
while (Date.now() < deadline) {
|
|
969
|
+
await new Promise((resolve2) => setTimeout(resolve2, Math.min(RENDER_POLL_MS, Math.max(0, deadline - Date.now()))));
|
|
970
|
+
const raw = await takeSnapshot(page);
|
|
971
|
+
const current = view(raw);
|
|
972
|
+
if (current !== seen) return { raw, page: current };
|
|
973
|
+
}
|
|
974
|
+
return void 0;
|
|
975
|
+
}
|
|
875
976
|
async function executeTest(page, test, options) {
|
|
876
977
|
const {
|
|
877
978
|
brain,
|
|
@@ -885,6 +986,7 @@ async function executeTest(page, test, options) {
|
|
|
885
986
|
mask = (s) => s,
|
|
886
987
|
snapshot,
|
|
887
988
|
maxSnapshotLines,
|
|
989
|
+
renderWatchMs = RENDER_WATCH_MS,
|
|
888
990
|
onEvent = () => {
|
|
889
991
|
}
|
|
890
992
|
} = options;
|
|
@@ -916,6 +1018,8 @@ async function executeTest(page, test, options) {
|
|
|
916
1018
|
let failedAttempts = 0;
|
|
917
1019
|
let lastResult;
|
|
918
1020
|
let stepFailedReason;
|
|
1021
|
+
let lastSnapshot;
|
|
1022
|
+
let lookedAgain = false;
|
|
919
1023
|
const recovery = new StepRecovery(step);
|
|
920
1024
|
try {
|
|
921
1025
|
while (true) {
|
|
@@ -929,8 +1033,11 @@ async function executeTest(page, test, options) {
|
|
|
929
1033
|
);
|
|
930
1034
|
}
|
|
931
1035
|
const snap = await takeSnapshot(page);
|
|
1036
|
+
lastSnapshot = snap;
|
|
932
1037
|
const maskedSnap = mask(snap);
|
|
933
|
-
|
|
1038
|
+
const refs = indexRefs(maskedSnap);
|
|
1039
|
+
const pageSnap = withoutRefs(maskedSnap);
|
|
1040
|
+
recovery.observe(pageSnap);
|
|
934
1041
|
let action;
|
|
935
1042
|
try {
|
|
936
1043
|
action = await brain.nextAction({
|
|
@@ -968,6 +1075,17 @@ async function executeTest(page, test, options) {
|
|
|
968
1075
|
break;
|
|
969
1076
|
}
|
|
970
1077
|
if (action.action === "fail") {
|
|
1078
|
+
if (!recovery.acted && !lookedAgain) {
|
|
1079
|
+
lookedAgain = true;
|
|
1080
|
+
const moved = await pageChangedWithin(page, takeSnapshot, (snap2) => withoutRefs(mask(snap2)), pageSnap, renderWatchMs);
|
|
1081
|
+
if (moved !== void 0) {
|
|
1082
|
+
lastSnapshot = moved.raw;
|
|
1083
|
+
recovery.observe(moved.page);
|
|
1084
|
+
lastResult = FAIL_ON_A_CHANGING_PAGE;
|
|
1085
|
+
emitAction(index, action, `${action.reasoning} :: ${FAIL_ON_A_CHANGING_PAGE}`);
|
|
1086
|
+
continue;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
971
1089
|
emitAction(index, action, action.reasoning);
|
|
972
1090
|
throw new StepFailure(action.reasoning);
|
|
973
1091
|
}
|
|
@@ -978,14 +1096,15 @@ async function executeTest(page, test, options) {
|
|
|
978
1096
|
judgment = await brain.judge(
|
|
979
1097
|
mask(step),
|
|
980
1098
|
mask(expectation),
|
|
981
|
-
|
|
1099
|
+
pageSnap,
|
|
982
1100
|
recovery.stepHistory(),
|
|
983
1101
|
[...usedEarlier]
|
|
984
1102
|
);
|
|
985
1103
|
if (!judgment.pass) {
|
|
986
1104
|
await waitForSettled(page);
|
|
987
1105
|
const freshSnap = await takeSnapshot(page);
|
|
988
|
-
|
|
1106
|
+
lastSnapshot = freshSnap;
|
|
1107
|
+
const maskedFresh = withoutRefs(mask(freshSnap));
|
|
989
1108
|
recovery.observe(maskedFresh);
|
|
990
1109
|
judgment = await brain.judge(
|
|
991
1110
|
mask(step),
|
|
@@ -1018,6 +1137,17 @@ async function executeTest(page, test, options) {
|
|
|
1018
1137
|
}
|
|
1019
1138
|
continue;
|
|
1020
1139
|
}
|
|
1140
|
+
try {
|
|
1141
|
+
action = bindTarget(action, refs);
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
failedAttempts++;
|
|
1144
|
+
lastResult = error instanceof Error ? error.message : String(error);
|
|
1145
|
+
emitAction(index, action, lastResult);
|
|
1146
|
+
if (failedAttempts >= maxRetries) {
|
|
1147
|
+
throw new StepFailure(lastResult);
|
|
1148
|
+
}
|
|
1149
|
+
continue;
|
|
1150
|
+
}
|
|
1021
1151
|
const refusal = recovery.refusalFor(action);
|
|
1022
1152
|
if (refusal) {
|
|
1023
1153
|
failedAttempts++;
|
|
@@ -1050,6 +1180,10 @@ async function executeTest(page, test, options) {
|
|
|
1050
1180
|
} catch (error) {
|
|
1051
1181
|
if (error instanceof RunStoppedError) throw error;
|
|
1052
1182
|
stepFailedReason = mask(error instanceof Error ? error.message : String(error));
|
|
1183
|
+
const cutAt = lastSnapshot === void 0 ? void 0 : snapshotCutAt(lastSnapshot);
|
|
1184
|
+
if (cutAt !== void 0) {
|
|
1185
|
+
stepFailedReason += ` (The page's snapshot was cut at max_snapshot_lines (${cutAt}); what the step looks for may be in the part left out.)`;
|
|
1186
|
+
}
|
|
1053
1187
|
}
|
|
1054
1188
|
for (const entry of recovery.stepHistory()) {
|
|
1055
1189
|
for (const name of referencedEnvVars(entry.action)) usedEarlier.add(name);
|
|
@@ -1210,7 +1344,8 @@ async function fromSteps(options) {
|
|
|
1210
1344
|
const judgment = await verifyJudgment(
|
|
1211
1345
|
brain,
|
|
1212
1346
|
auth.verify,
|
|
1213
|
-
|
|
1347
|
+
// The judge reads the page without refs (design act-on-the-element-the-model-read, D3).
|
|
1348
|
+
async () => withoutRefs(mask.mask(await takeSnapshot(page))),
|
|
1214
1349
|
(text) => mask.mask(text),
|
|
1215
1350
|
maxRetries
|
|
1216
1351
|
);
|
|
@@ -1270,7 +1405,30 @@ var llmSchema = z.object({
|
|
|
1270
1405
|
provider: z.enum(["anthropic", "openai", "ollama"]).default("anthropic"),
|
|
1271
1406
|
model: z.string().min(1).optional(),
|
|
1272
1407
|
api_key_env: z.string().min(1).optional(),
|
|
1273
|
-
base_url: z.string().url().optional()
|
|
1408
|
+
base_url: z.string().url().optional(),
|
|
1409
|
+
/**
|
|
1410
|
+
* Seconds a single model call may take before it is aborted and the run stops
|
|
1411
|
+
* (design bound-every-model-call, D2). Optional: undefined takes the provider's
|
|
1412
|
+
* default from `DEFAULT_TIMEOUT_SECONDS`, because only the user knows how fast
|
|
1413
|
+
* their local hardware is. Coerced, since `BLASTPROOF_LLM_TIMEOUT_S` is text.
|
|
1414
|
+
*/
|
|
1415
|
+
timeout_s: z.coerce.number().positive().optional(),
|
|
1416
|
+
/**
|
|
1417
|
+
* Fields merged into every request body for an OpenAI-compatible endpoint
|
|
1418
|
+
* (design route-a-gateway-from-the-config, D1): a gateway's own extensions,
|
|
1419
|
+
* such as OpenRouter's `provider` routing, which the SDK does not know. The
|
|
1420
|
+
* fields blastproof sets always win (D2). Opaque on purpose: its keys are the
|
|
1421
|
+
* gateway's API, not ours.
|
|
1422
|
+
*/
|
|
1423
|
+
extra_body: z.record(z.unknown()).optional()
|
|
1424
|
+
}).superRefine((llm, ctx) => {
|
|
1425
|
+
if (llm.extra_body !== void 0 && llm.provider === "anthropic") {
|
|
1426
|
+
ctx.addIssue({
|
|
1427
|
+
code: z.ZodIssueCode.custom,
|
|
1428
|
+
path: ["extra_body"],
|
|
1429
|
+
message: "applies only to the OpenAI-compatible providers (openai, ollama); the Anthropic API rejects unknown fields. Remove llm.extra_body, or reach the model through a gateway with provider: openai and llm.base_url."
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1274
1432
|
});
|
|
1275
1433
|
var browserSchema = z.object({
|
|
1276
1434
|
headless: z.boolean().default(true),
|
|
@@ -1381,6 +1539,7 @@ var ENV_OVERRIDES = {
|
|
|
1381
1539
|
BLASTPROOF_LLM_MODEL: ["llm", "model"],
|
|
1382
1540
|
BLASTPROOF_LLM_BASE_URL: ["llm", "base_url"],
|
|
1383
1541
|
BLASTPROOF_LLM_API_KEY_ENV: ["llm", "api_key_env"],
|
|
1542
|
+
BLASTPROOF_LLM_TIMEOUT_S: ["llm", "timeout_s"],
|
|
1384
1543
|
BLASTPROOF_MAX_LLM_CALLS: ["budget", "max_llm_calls"],
|
|
1385
1544
|
BLASTPROOF_MAX_TOKENS: ["budget", "max_tokens"],
|
|
1386
1545
|
BLASTPROOF_MAX_DURATION_S: ["budget", "max_duration_s"]
|
|
@@ -1585,7 +1744,7 @@ warning: ${findings.length} file(s) changed in the working tree are not in the d
|
|
|
1585
1744
|
}
|
|
1586
1745
|
|
|
1587
1746
|
// src/llm/brain.ts
|
|
1588
|
-
import { APICallError, generateObject, RetryError } from "ai";
|
|
1747
|
+
import { APICallError, generateObject, NoObjectGeneratedError, RetryError } from "ai";
|
|
1589
1748
|
|
|
1590
1749
|
// src/llm/prompts.ts
|
|
1591
1750
|
function agentSystemPrompt() {
|
|
@@ -1598,7 +1757,7 @@ The snapshot is a description of what is on screen. It is the thing you are test
|
|
|
1598
1757
|
Rules:
|
|
1599
1758
|
- Return exactly ONE action per response. Never batch actions.
|
|
1600
1759
|
- Placeholders like {{env.SOME_NAME}} are secrets that are filled in after you answer. Pass them through in your action exactly as written, never expanded, never guessed at.
|
|
1601
|
-
- Pick target elements exclusively from the current snapshot,
|
|
1760
|
+
- Pick target elements exclusively from the current snapshot. Every element there carries a ref, like \`[ref=f1e25]\`: name your target by that ref, and give its role and name exactly as that same line shows them (the text after the colon when it has no quoted name). The ref decides which element is acted on, so copy it from the line of the element you mean; a role or name that does not match that line is refused. Refs change when the page changes, so always take them from the current snapshot. Never invent CSS selectors or guess elements not in the snapshot.
|
|
1602
1761
|
- Use "navigate" only with a URL or path as value. Use "fill" to type into textboxes/inputs. Use "press" for keyboard keys (value e.g. "Enter"). Use "select" for dropdowns (value = option label).
|
|
1603
1762
|
- Use "assert" with an expectation to verify page state (visible text, counts, URLs). Assertions never modify the page.
|
|
1604
1763
|
- A step that begins with "verify", "check", "confirm", "ensure", "assert", "expect", "validate", "make sure" or "see that" only looks. Never click or press in it: making the page show what the step checks would hide the very thing it checks. Assert what the page shows, navigate if what it names is on another page, or fail. It closes on a passing assertion, never on "done". This is enforced: a click, a press or "done" in such a step is refused.
|
|
@@ -1711,17 +1870,19 @@ var agentActionSchema = z2.object({
|
|
|
1711
1870
|
action: z2.enum(ACTION_NAMES).describe("The next browser action to perform for the current step."),
|
|
1712
1871
|
target: absentAsNull(
|
|
1713
1872
|
z2.object({
|
|
1873
|
+
ref: absentAsNull(
|
|
1874
|
+
z2.string().describe('The ref of the target element, copied from its [ref=...] in the snapshot, e.g. "f1e25".')
|
|
1875
|
+
),
|
|
1714
1876
|
role: absentAsNull(
|
|
1715
|
-
z2.string().describe('ARIA role of
|
|
1877
|
+
z2.string().describe('ARIA role of that element, as its snapshot line shows it, e.g. "button", "link", "textbox".')
|
|
1716
1878
|
),
|
|
1717
1879
|
name: absentAsNull(
|
|
1718
|
-
z2.string().describe(
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
z2.string().describe("Visible text of the target element, used as a fallback when no role matches.")
|
|
1880
|
+
z2.string().describe(
|
|
1881
|
+
"Accessible name of that element, exactly as its snapshot line shows it; its text after the colon when it has no quoted name."
|
|
1882
|
+
)
|
|
1722
1883
|
)
|
|
1723
1884
|
})
|
|
1724
|
-
).describe("Element to act on,
|
|
1885
|
+
).describe("Element to act on, named by its ref in the accessibility snapshot. Null for navigate/done/fail, and for press on the focused element."),
|
|
1725
1886
|
value: absentAsNull(
|
|
1726
1887
|
z2.string().describe(
|
|
1727
1888
|
'Action payload: URL/path for navigate, text for fill, key for press (e.g. "Enter"), option label for select.'
|
|
@@ -1735,9 +1896,9 @@ var agentActionSchema = z2.object({
|
|
|
1735
1896
|
var parsedAgentActionSchema = z2.object({
|
|
1736
1897
|
action: z2.enum(ACTION_NAMES),
|
|
1737
1898
|
target: z2.object({
|
|
1899
|
+
ref: z2.string().optional(),
|
|
1738
1900
|
role: z2.string().optional(),
|
|
1739
|
-
name: z2.string().optional()
|
|
1740
|
-
text: z2.string().optional()
|
|
1901
|
+
name: z2.string().optional()
|
|
1741
1902
|
}).optional(),
|
|
1742
1903
|
value: z2.string().optional(),
|
|
1743
1904
|
reasoning: z2.string(),
|
|
@@ -1765,6 +1926,7 @@ var generatedTestSchema = z2.object({
|
|
|
1765
1926
|
});
|
|
1766
1927
|
|
|
1767
1928
|
// src/llm/brain.ts
|
|
1929
|
+
var MAX_OUTPUT_TOKENS = 4096;
|
|
1768
1930
|
var MalformedModelOutputError = class extends Error {
|
|
1769
1931
|
constructor(message) {
|
|
1770
1932
|
super(message);
|
|
@@ -1788,13 +1950,37 @@ function asProviderRefusal(error) {
|
|
|
1788
1950
|
withProviderDetail(cause);
|
|
1789
1951
|
return new ProviderRefusedError(cause.statusCode, cause.message);
|
|
1790
1952
|
}
|
|
1953
|
+
function callAbort(budget) {
|
|
1954
|
+
const timeout = budget.callTimeoutMs;
|
|
1955
|
+
const remaining = budget.remainingMs();
|
|
1956
|
+
if (timeout === void 0 && remaining === void 0) return void 0;
|
|
1957
|
+
const byDeadline = remaining !== void 0 && (timeout === void 0 || remaining <= timeout);
|
|
1958
|
+
const controller = new AbortController();
|
|
1959
|
+
const timer = setTimeout(() => controller.abort(), byDeadline ? remaining : timeout);
|
|
1960
|
+
return { signal: controller.signal, byDeadline, clear: () => clearTimeout(timer) };
|
|
1961
|
+
}
|
|
1962
|
+
function spentAndExplained(error, budget) {
|
|
1963
|
+
if (!NoObjectGeneratedError.isInstance(error)) return error;
|
|
1964
|
+
budget.record(error.usage);
|
|
1965
|
+
if (error.finishReason !== "length") return error;
|
|
1966
|
+
return new MalformedModelOutputError(
|
|
1967
|
+
`the answer reached the ${MAX_OUTPUT_TOKENS}-token output limit before its JSON was complete`
|
|
1968
|
+
);
|
|
1969
|
+
}
|
|
1791
1970
|
async function countedGenerate(generate, budget, options) {
|
|
1792
1971
|
budget.check();
|
|
1972
|
+
const abort = callAbort(budget);
|
|
1793
1973
|
let result;
|
|
1794
1974
|
try {
|
|
1795
|
-
result = await generate(options);
|
|
1975
|
+
result = await generate({ ...options, maxOutputTokens: MAX_OUTPUT_TOKENS, abortSignal: abort?.signal });
|
|
1796
1976
|
} catch (error) {
|
|
1797
|
-
|
|
1977
|
+
if (abort?.signal.aborted) {
|
|
1978
|
+
if (abort.byDeadline) throw budget.deadlineReached();
|
|
1979
|
+
if (budget.callTimeoutMs !== void 0) throw new ModelCallTimeoutError(budget.callTimeoutMs);
|
|
1980
|
+
}
|
|
1981
|
+
throw asProviderRefusal(withProviderDetail(spentAndExplained(error, budget)));
|
|
1982
|
+
} finally {
|
|
1983
|
+
abort?.clear();
|
|
1798
1984
|
}
|
|
1799
1985
|
budget.record(result.usage);
|
|
1800
1986
|
return result;
|
|
@@ -1887,14 +2073,35 @@ import { createAnthropic } from "@ai-sdk/anthropic";
|
|
|
1887
2073
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
1888
2074
|
var DEFAULT_MODELS = {
|
|
1889
2075
|
anthropic: "claude-haiku-4-5",
|
|
1890
|
-
openai: "gpt-
|
|
1891
|
-
ollama: "
|
|
2076
|
+
openai: "gpt-6-luna",
|
|
2077
|
+
ollama: "gpt-oss:20b"
|
|
1892
2078
|
};
|
|
1893
2079
|
var DEFAULT_API_KEY_ENVS = {
|
|
1894
2080
|
anthropic: "ANTHROPIC_API_KEY",
|
|
1895
2081
|
openai: "OPENAI_API_KEY"
|
|
1896
2082
|
};
|
|
1897
2083
|
var DEFAULT_OLLAMA_BASE_URL = "http://localhost:11434/v1";
|
|
2084
|
+
var DEFAULT_TIMEOUT_SECONDS = {
|
|
2085
|
+
anthropic: 300,
|
|
2086
|
+
openai: 300,
|
|
2087
|
+
ollama: 900
|
|
2088
|
+
};
|
|
2089
|
+
function timeoutSeconds(llm) {
|
|
2090
|
+
return llm.timeout_s ?? DEFAULT_TIMEOUT_SECONDS[llm.provider];
|
|
2091
|
+
}
|
|
2092
|
+
function withExtraBody(extra, base = fetch) {
|
|
2093
|
+
return (input, init) => {
|
|
2094
|
+
if (typeof init?.body !== "string") return base(input, init);
|
|
2095
|
+
let body;
|
|
2096
|
+
try {
|
|
2097
|
+
body = JSON.parse(init.body);
|
|
2098
|
+
} catch {
|
|
2099
|
+
return base(input, init);
|
|
2100
|
+
}
|
|
2101
|
+
if (body === null || typeof body !== "object" || Array.isArray(body)) return base(input, init);
|
|
2102
|
+
return base(input, { ...init, body: JSON.stringify({ ...extra, ...body }) });
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
1898
2105
|
var MissingApiKeyError = class extends Error {
|
|
1899
2106
|
constructor(variable, provider) {
|
|
1900
2107
|
super(
|
|
@@ -1914,6 +2121,7 @@ function createModel(llm, env = process.env) {
|
|
|
1914
2121
|
throw new MissingApiKeyError(keyEnv, llm.provider);
|
|
1915
2122
|
}
|
|
1916
2123
|
const baseURL = llm.base_url ? { baseURL: llm.base_url } : {};
|
|
2124
|
+
const extra = llm.extra_body ? { fetch: withExtraBody(llm.extra_body) } : {};
|
|
1917
2125
|
const model = llm.provider === "anthropic" ? (
|
|
1918
2126
|
// A configured endpoint applies to whichever provider is selected —
|
|
1919
2127
|
// dropping it here routed corporate-proxy configs to the public API
|
|
@@ -1922,13 +2130,14 @@ function createModel(llm, env = process.env) {
|
|
|
1922
2130
|
) : (
|
|
1923
2131
|
// `.chat` = Chat Completions: works with official OpenAI and any
|
|
1924
2132
|
// OpenAI-compatible endpoint (OpenRouter, LiteLLM, vLLM) via base_url.
|
|
1925
|
-
createOpenAI({ apiKey, ...baseURL }).chat(modelId)
|
|
2133
|
+
createOpenAI({ apiKey, ...baseURL, ...extra }).chat(modelId)
|
|
1926
2134
|
);
|
|
1927
2135
|
return { model, provider: llm.provider, modelId };
|
|
1928
2136
|
}
|
|
1929
2137
|
case "ollama": {
|
|
1930
2138
|
const baseURL = llm.base_url ?? DEFAULT_OLLAMA_BASE_URL;
|
|
1931
|
-
const
|
|
2139
|
+
const extra = llm.extra_body ? { fetch: withExtraBody(llm.extra_body) } : {};
|
|
2140
|
+
const model = createOpenAI({ baseURL, apiKey: "ollama", ...extra }).chat(modelId);
|
|
1932
2141
|
return { model, provider: "ollama", modelId };
|
|
1933
2142
|
}
|
|
1934
2143
|
}
|
|
@@ -2059,7 +2268,7 @@ async function generateForRoute(page, options) {
|
|
|
2059
2268
|
`Cannot load ${url}: ${error instanceof Error ? error.message : String(error)}`
|
|
2060
2269
|
);
|
|
2061
2270
|
}
|
|
2062
|
-
const pageSnapshot = mask(await takeSnapshot(page));
|
|
2271
|
+
const pageSnapshot = withoutRefs(mask(await takeSnapshot(page)));
|
|
2063
2272
|
const generated = await brain.planTest({
|
|
2064
2273
|
route,
|
|
2065
2274
|
snapshot: pageSnapshot,
|
|
@@ -2227,6 +2436,10 @@ function computeScore(results) {
|
|
|
2227
2436
|
if (total === 0) return 100;
|
|
2228
2437
|
return Math.round(100 * passed / total);
|
|
2229
2438
|
}
|
|
2439
|
+
function scoreOf(results, incomplete) {
|
|
2440
|
+
if (incomplete && results.every((result) => result.status === "not-run")) return void 0;
|
|
2441
|
+
return computeScore(results);
|
|
2442
|
+
}
|
|
2230
2443
|
function formatScoreLine(score, results, threshold) {
|
|
2231
2444
|
if (results.length === 0) {
|
|
2232
2445
|
const base = "Score: 100 (no tests executed)";
|
|
@@ -2237,7 +2450,7 @@ function formatScoreLine(score, results, threshold) {
|
|
|
2237
2450
|
}
|
|
2238
2451
|
function formatIncompleteLine(score, reason) {
|
|
2239
2452
|
return `Run incomplete: ${reason}
|
|
2240
|
-
Score over executed tests: ${score} (not a verdict \u2014 exit code 1 regardless of --min-score)
|
|
2453
|
+
` + (score === void 0 ? "Score: none (no test executed before the stop)" : `Score over executed tests: ${score} (not a verdict \u2014 exit code 1 regardless of --min-score)`);
|
|
2241
2454
|
}
|
|
2242
2455
|
function formatSpendLine(spend) {
|
|
2243
2456
|
const calls = spend.maxCalls === void 0 ? `${spend.calls} model call(s)` : `${spend.calls} of ${spend.maxCalls} model call(s)`;
|
|
@@ -2373,7 +2586,7 @@ async function renderHtml(results, skipped, meta) {
|
|
|
2373
2586
|
const generatedAt = (meta.generatedAt ?? /* @__PURE__ */ new Date()).toISOString();
|
|
2374
2587
|
const ordered = [...failures, ...notRun, ...results.filter((r) => r.status === "passed")];
|
|
2375
2588
|
const detail = (await Promise.all(ordered.map((r) => renderTest(r, meta.screenshots, meta.cwd)))).join("\n");
|
|
2376
|
-
const verdict = meta.minScore === void 0 ? "" : meta.score >= meta.minScore ? `<span class="verdict pass">min-score ${meta.minScore}: pass</span>` : `<span class="verdict fail">min-score ${meta.minScore}: FAIL</span>`;
|
|
2589
|
+
const verdict = meta.minScore === void 0 || meta.score === void 0 ? "" : meta.score >= meta.minScore ? `<span class="verdict pass">min-score ${meta.minScore}: pass</span>` : `<span class="verdict fail">min-score ${meta.minScore}: FAIL</span>`;
|
|
2377
2590
|
const banner = meta.incomplete === void 0 ? "" : ` <section class="incomplete">Run stopped: ${escapeHtml(meta.incomplete)}</section>
|
|
2378
2591
|
|
|
2379
2592
|
`;
|
|
@@ -2402,7 +2615,7 @@ async function renderHtml(results, skipped, meta) {
|
|
|
2402
2615
|
<p class="sub">${escapeHtml(generatedAt)} \xB7 ${seconds(meta.durationMs)}${meta.spend ? ` \xB7 ${escapeHtml(formatSpendLine(meta.spend))}` : ""}</p>
|
|
2403
2616
|
|
|
2404
2617
|
${banner} <section class="score">
|
|
2405
|
-
<b>${meta.score}</b>
|
|
2618
|
+
<b>${meta.score ?? "\u2014"}</b>${meta.score === void 0 ? '\n <span class="counts">no score: no test executed</span>' : ""}
|
|
2406
2619
|
${verdict}
|
|
2407
2620
|
<span class="counts">${passed} passed \xB7 ${failures.length} failed${notRun.length > 0 ? ` \xB7 ${notRun.length} not run` : ""}${skipped.length > 0 ? ` \xB7 ${skipped.length} skipped` : ""}</span>
|
|
2408
2621
|
</section>
|
|
@@ -2458,7 +2671,10 @@ function renderJUnit(results, skipped, meta) {
|
|
|
2458
2671
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
2459
2672
|
`<testsuite name="blastproof" tests="${results.length + skipped.length}" failures="${failures}" skipped="${skipped.length + notRun.length}" time="${seconds2(meta.durationMs)}">`,
|
|
2460
2673
|
" <properties>",
|
|
2461
|
-
|
|
2674
|
+
// Absent rather than a placeholder (design no-score-when-nothing-ran, D2):
|
|
2675
|
+
// the action reads this property as its `score` output, and an empty output
|
|
2676
|
+
// is how it already says "no score". A sentinel would be a number to compare.
|
|
2677
|
+
...meta.score === void 0 ? [] : [` <property name="score" value="${meta.score}"/>`],
|
|
2462
2678
|
...meta.spend ? [` <property name="llm_calls" value="${meta.spend.calls}"/>`] : [],
|
|
2463
2679
|
// Omitted rather than emitted as zero when no call reported usage: a
|
|
2464
2680
|
// property carrying 0 would be read by a pipeline as "this run spent no
|
|
@@ -2588,7 +2804,8 @@ function resolveBudgetOptions(config, options) {
|
|
|
2588
2804
|
return {
|
|
2589
2805
|
maxCalls: options.maxLlmCalls ?? config.budget?.max_llm_calls,
|
|
2590
2806
|
maxTokens: options.maxTokens ?? config.budget?.max_tokens,
|
|
2591
|
-
maxDurationMs: maxDurationSeconds === void 0 ? void 0 : maxDurationSeconds * 1e3
|
|
2807
|
+
maxDurationMs: maxDurationSeconds === void 0 ? void 0 : maxDurationSeconds * 1e3,
|
|
2808
|
+
callTimeoutMs: timeoutSeconds(config.llm) * 1e3
|
|
2592
2809
|
};
|
|
2593
2810
|
}
|
|
2594
2811
|
function sessionId() {
|
|
@@ -2767,9 +2984,9 @@ async function finalize(results, skipped, options, sessionDir, secretsHeld, near
|
|
|
2767
2984
|
if (results.length > 0) printSummary(results);
|
|
2768
2985
|
reportNearMissedSecrets(nearMissedSecrets);
|
|
2769
2986
|
if (spend) console.log(formatSpendLine(spend));
|
|
2770
|
-
const score =
|
|
2987
|
+
const score = scoreOf(results, incomplete !== void 0);
|
|
2771
2988
|
console.log(
|
|
2772
|
-
incomplete ? formatIncompleteLine(score, incomplete.message) : formatScoreLine(
|
|
2989
|
+
incomplete ? formatIncompleteLine(score, incomplete.message) : formatScoreLine(computeScore(results), results, options.minScore)
|
|
2773
2990
|
);
|
|
2774
2991
|
if (options.junit) {
|
|
2775
2992
|
const target = typeof options.junit === "string" ? path9.resolve(options.cwd, options.junit) : path9.join(sessionDir, "junit.xml");
|
|
@@ -2805,7 +3022,7 @@ async function finalize(results, skipped, options, sessionDir, secretsHeld, near
|
|
|
2805
3022
|
if (incomplete) return EXIT_FAILED;
|
|
2806
3023
|
if (reportUnclassified(options, impact)) return EXIT_FAILED;
|
|
2807
3024
|
if (options.minScore !== void 0) {
|
|
2808
|
-
return
|
|
3025
|
+
return computeScore(results) >= options.minScore ? EXIT_OK : EXIT_FAILED;
|
|
2809
3026
|
}
|
|
2810
3027
|
return results.some((result) => result.status === "failed") ? EXIT_FAILED : EXIT_OK;
|
|
2811
3028
|
}
|
|
@@ -3401,7 +3618,7 @@ function parsePositiveNumber(flag) {
|
|
|
3401
3618
|
};
|
|
3402
3619
|
}
|
|
3403
3620
|
var program = new Command();
|
|
3404
|
-
program.name("blastproof").description("Open-source AI testing agent: plain-English YAML tests executed agentically on a real browser.").version("0.
|
|
3621
|
+
program.name("blastproof").description("Open-source AI testing agent: plain-English YAML tests executed agentically on a real browser.").version("0.26.0");
|
|
3405
3622
|
program.command("init").description("Scaffold .blastproof/ (config, tests, sample tests) in the current directory").action(async () => {
|
|
3406
3623
|
try {
|
|
3407
3624
|
const result = await initProject(process.cwd());
|
|
@@ -3536,6 +3753,8 @@ program.command("test").description("Full PR pipeline: run the tests covering th
|
|
|
3536
3753
|
);
|
|
3537
3754
|
program.exitOverride();
|
|
3538
3755
|
for (const command of program.commands) command.exitOverride();
|
|
3756
|
+
process.once("SIGTERM", () => process.exit(143));
|
|
3757
|
+
process.once("SIGHUP", () => process.exit(129));
|
|
3539
3758
|
try {
|
|
3540
3759
|
await program.parseAsync(process.argv);
|
|
3541
3760
|
} catch (error) {
|