@dev-blinq/bvt-playwright-js 1.0.0-dev.4.staging.117.1 → 1.0.0-dev.4.staging.124.1
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/index.d.mts +17 -0
- package/index.mjs +86 -2
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -9008,6 +9008,20 @@ type RecoveryResult = {
|
|
|
9008
9008
|
decision: RecoveryDecision$1;
|
|
9009
9009
|
artifact: RecoveryArtifact | null;
|
|
9010
9010
|
};
|
|
9011
|
+
type RecoveryArtifactAttemptLogEntry = {
|
|
9012
|
+
attemptNumber: number;
|
|
9013
|
+
scope: "single-command" | "whole-step";
|
|
9014
|
+
representation: "native" | "custom";
|
|
9015
|
+
action: string;
|
|
9016
|
+
outcome: "succeeded" | "failed" | "blocked";
|
|
9017
|
+
};
|
|
9018
|
+
type RecoveryArtifactGenerationInput = {
|
|
9019
|
+
decision: RecoveryDecision$1;
|
|
9020
|
+
failureContext: FailureContext$1;
|
|
9021
|
+
recoverySucceeded: boolean;
|
|
9022
|
+
stoppedReason: string;
|
|
9023
|
+
attemptLog: RecoveryArtifactAttemptLogEntry[];
|
|
9024
|
+
};
|
|
9011
9025
|
type FailureContext$1 = {
|
|
9012
9026
|
failedCommand: Command;
|
|
9013
9027
|
stepDefinitionId: string;
|
|
@@ -9027,6 +9041,7 @@ type FailureContext$1 = {
|
|
|
9027
9041
|
};
|
|
9028
9042
|
interface RecoveryController {
|
|
9029
9043
|
analyzeAndPropose(context: FailureContext$1): Promise<RecoveryResult>;
|
|
9044
|
+
generateRecoveryArtifact?(input: RecoveryArtifactGenerationInput): Promise<RecoveryArtifact | null>;
|
|
9030
9045
|
}
|
|
9031
9046
|
type TraceUploadRequestInput = {
|
|
9032
9047
|
reportId: string;
|
|
@@ -9280,6 +9295,8 @@ declare class Tester {
|
|
|
9280
9295
|
private onTestCaseFail;
|
|
9281
9296
|
private isBrowserDerivedCommand;
|
|
9282
9297
|
private buildFailureContext;
|
|
9298
|
+
private generateRecoveryArtifactForOutcome;
|
|
9299
|
+
private buildStepRepairAttemptLog;
|
|
9283
9300
|
private getCommandRecoverySelectors;
|
|
9284
9301
|
private getRecorderStepIndex;
|
|
9285
9302
|
private restoreAndReplayToStepStartForRepair;
|
package/index.mjs
CHANGED
|
@@ -10471,9 +10471,14 @@ const FillFormBatchFieldSchema = object({
|
|
|
10471
10471
|
value: union([string(), array(string())]),
|
|
10472
10472
|
autocompleteSettleMs: number().int().positive().optional()
|
|
10473
10473
|
}).strict();
|
|
10474
|
+
const FillFormBatchSeedSchema = object({
|
|
10475
|
+
key: string().min(1),
|
|
10476
|
+
value: string().min(1)
|
|
10477
|
+
}).strict();
|
|
10474
10478
|
const FillFormBatchArgsSchema = object({
|
|
10475
10479
|
fields: array(FillFormBatchFieldSchema).min(1).max(50),
|
|
10476
|
-
stopOnError: boolean().default(false)
|
|
10480
|
+
stopOnError: boolean().default(false),
|
|
10481
|
+
seeds: array(FillFormBatchSeedSchema).max(50).optional()
|
|
10477
10482
|
}).strict();
|
|
10478
10483
|
const FillFormBatchResultEntrySchema = object({
|
|
10479
10484
|
fieldId: string().min(1),
|
|
@@ -10557,6 +10562,7 @@ const AiChatFormFieldSnapshotSchema = object({
|
|
|
10557
10562
|
readOnly: boolean().default(false),
|
|
10558
10563
|
label: string().nullable(),
|
|
10559
10564
|
selector: string().nullable(),
|
|
10565
|
+
value: string().nullable().optional(),
|
|
10560
10566
|
options: array(string()).optional(),
|
|
10561
10567
|
formIndex: number().int().nonnegative().nullable().optional(),
|
|
10562
10568
|
formName: string().nullable().optional()
|
|
@@ -26665,6 +26671,40 @@ var Tester = class {
|
|
|
26665
26671
|
abortSignal: commandContext.abortSignal
|
|
26666
26672
|
};
|
|
26667
26673
|
}
|
|
26674
|
+
async generateRecoveryArtifactForOutcome(input) {
|
|
26675
|
+
if (!this.recoveryController.generateRecoveryArtifact) return null;
|
|
26676
|
+
try {
|
|
26677
|
+
return await this.recoveryController.generateRecoveryArtifact(input);
|
|
26678
|
+
} catch (error) {
|
|
26679
|
+
this.obs.logger.warn("Recovery artifact generation failed after repair outcome", {
|
|
26680
|
+
recoveryAttemptId: input.decision.recoveryAttemptId,
|
|
26681
|
+
recoverySucceeded: input.recoverySucceeded,
|
|
26682
|
+
error: error instanceof Error ? error.message : String(error)
|
|
26683
|
+
});
|
|
26684
|
+
return null;
|
|
26685
|
+
}
|
|
26686
|
+
}
|
|
26687
|
+
buildStepRepairAttemptLog(decision, outcome) {
|
|
26688
|
+
if (decision.kind !== "step-repair") return [{
|
|
26689
|
+
attemptNumber: 1,
|
|
26690
|
+
scope: "single-command",
|
|
26691
|
+
representation: "native",
|
|
26692
|
+
action: "repair",
|
|
26693
|
+
outcome
|
|
26694
|
+
}];
|
|
26695
|
+
const plan = decision.stepRepairPlan;
|
|
26696
|
+
const representation = (plan.type === "whole-step" ? plan.replacementCommands : plan.type === "single-command" ? [plan.replacementCommand] : plan.operations.map((operation) => operation.type === "delete" ? null : operation.type === "insert" ? operation.command : operation.replacementCommand).filter((command) => command !== null)).flatMap((command) => {
|
|
26697
|
+
const parsed = CommandSchema.safeParse(command);
|
|
26698
|
+
return parsed.success ? [parsed.data] : [];
|
|
26699
|
+
}).some((command) => command.type === "custom" || command.type === "custom.code") ? "custom" : "native";
|
|
26700
|
+
return [{
|
|
26701
|
+
attemptNumber: 1,
|
|
26702
|
+
scope: plan.type === "whole-step" ? "whole-step" : "single-command",
|
|
26703
|
+
representation,
|
|
26704
|
+
action: decision.actionVerb ?? "repair",
|
|
26705
|
+
outcome
|
|
26706
|
+
}];
|
|
26707
|
+
}
|
|
26668
26708
|
getCommandRecoverySelectors(command) {
|
|
26669
26709
|
if (!("target" in command) || !command.target) return [];
|
|
26670
26710
|
const target = command.target;
|
|
@@ -26726,7 +26766,9 @@ var Tester = class {
|
|
|
26726
26766
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
26727
26767
|
};
|
|
26728
26768
|
const failureContext = this.buildFailureContext(command, recorderStep, stepDefinitionId, commandIndex, commandContext, executionError);
|
|
26729
|
-
const
|
|
26769
|
+
const recoveryResult = await this.recoveryController.analyzeAndPropose(failureContext);
|
|
26770
|
+
const { decision } = recoveryResult;
|
|
26771
|
+
let artifact = recoveryResult.artifact;
|
|
26730
26772
|
if (this.shouldAttemptAiRecovery(session)) {
|
|
26731
26773
|
let emittedTerminalRecoveryStatus = false;
|
|
26732
26774
|
if (decision.kind === "step-repair" && this.isSupportedRepairContext(decision, session) && decision.stepRepairPlan.type === "whole-step") {
|
|
@@ -26791,6 +26833,13 @@ var Tester = class {
|
|
|
26791
26833
|
plan: decision.stepRepairPlan
|
|
26792
26834
|
});
|
|
26793
26835
|
if (!persistResult.success) throw new Error(persistResult.error);
|
|
26836
|
+
artifact = await this.generateRecoveryArtifactForOutcome({
|
|
26837
|
+
decision,
|
|
26838
|
+
failureContext,
|
|
26839
|
+
recoverySucceeded: true,
|
|
26840
|
+
stoppedReason: "accept-repair",
|
|
26841
|
+
attemptLog: this.buildStepRepairAttemptLog(decision, "succeeded")
|
|
26842
|
+
}) ?? artifact;
|
|
26794
26843
|
const recoveryMeta = {
|
|
26795
26844
|
recoveryAttemptId: decision.recoveryAttemptId,
|
|
26796
26845
|
originalCommandId: command._id,
|
|
@@ -26840,6 +26889,13 @@ var Tester = class {
|
|
|
26840
26889
|
originalError: executionError.message,
|
|
26841
26890
|
retryError: retryExecutionError.message
|
|
26842
26891
|
});
|
|
26892
|
+
artifact = await this.generateRecoveryArtifactForOutcome({
|
|
26893
|
+
decision,
|
|
26894
|
+
failureContext,
|
|
26895
|
+
recoverySucceeded: false,
|
|
26896
|
+
stoppedReason: "retry_failed",
|
|
26897
|
+
attemptLog: this.buildStepRepairAttemptLog(decision, "failed")
|
|
26898
|
+
}) ?? artifact;
|
|
26843
26899
|
yield {
|
|
26844
26900
|
type: "recovery_status",
|
|
26845
26901
|
recoveryAttemptId: decision.recoveryAttemptId,
|
|
@@ -26854,6 +26910,13 @@ var Tester = class {
|
|
|
26854
26910
|
}
|
|
26855
26911
|
else {
|
|
26856
26912
|
terminalExecutionError = /* @__PURE__ */ new Error(`${decision.userFacingMessages.failed}. Repair application failure: ${appliedRepair.error}. Original failure: ${executionError.message}`);
|
|
26913
|
+
artifact = await this.generateRecoveryArtifactForOutcome({
|
|
26914
|
+
decision,
|
|
26915
|
+
failureContext,
|
|
26916
|
+
recoverySucceeded: false,
|
|
26917
|
+
stoppedReason: "repair_application_failed",
|
|
26918
|
+
attemptLog: this.buildStepRepairAttemptLog(decision, "failed")
|
|
26919
|
+
}) ?? artifact;
|
|
26857
26920
|
yield {
|
|
26858
26921
|
type: "recovery_status",
|
|
26859
26922
|
recoveryAttemptId: decision.recoveryAttemptId,
|
|
@@ -26908,6 +26971,13 @@ var Tester = class {
|
|
|
26908
26971
|
plan: decision.stepRepairPlan
|
|
26909
26972
|
});
|
|
26910
26973
|
if (!persistResult.success) throw new Error(persistResult.error);
|
|
26974
|
+
artifact = await this.generateRecoveryArtifactForOutcome({
|
|
26975
|
+
decision,
|
|
26976
|
+
failureContext,
|
|
26977
|
+
recoverySucceeded: true,
|
|
26978
|
+
stoppedReason: "accept-repair",
|
|
26979
|
+
attemptLog: this.buildStepRepairAttemptLog(decision, "succeeded")
|
|
26980
|
+
}) ?? artifact;
|
|
26911
26981
|
const recoveryMeta = {
|
|
26912
26982
|
recoveryAttemptId: decision.recoveryAttemptId,
|
|
26913
26983
|
originalCommandId: command._id,
|
|
@@ -26958,6 +27028,13 @@ var Tester = class {
|
|
|
26958
27028
|
originalError: executionError.message,
|
|
26959
27029
|
retryError: retryExecutionError.message
|
|
26960
27030
|
});
|
|
27031
|
+
artifact = await this.generateRecoveryArtifactForOutcome({
|
|
27032
|
+
decision,
|
|
27033
|
+
failureContext,
|
|
27034
|
+
recoverySucceeded: false,
|
|
27035
|
+
stoppedReason: "retry_failed",
|
|
27036
|
+
attemptLog: this.buildStepRepairAttemptLog(decision, "failed")
|
|
27037
|
+
}) ?? artifact;
|
|
26961
27038
|
yield {
|
|
26962
27039
|
type: "recovery_status",
|
|
26963
27040
|
recoveryAttemptId: decision.recoveryAttemptId,
|
|
@@ -26971,6 +27048,13 @@ var Tester = class {
|
|
|
26971
27048
|
emittedTerminalRecoveryStatus = true;
|
|
26972
27049
|
}
|
|
26973
27050
|
else {
|
|
27051
|
+
artifact = await this.generateRecoveryArtifactForOutcome({
|
|
27052
|
+
decision,
|
|
27053
|
+
failureContext,
|
|
27054
|
+
recoverySucceeded: false,
|
|
27055
|
+
stoppedReason: "repair_application_failed",
|
|
27056
|
+
attemptLog: this.buildStepRepairAttemptLog(decision, "failed")
|
|
27057
|
+
}) ?? artifact;
|
|
26974
27058
|
yield {
|
|
26975
27059
|
type: "recovery_status",
|
|
26976
27060
|
recoveryAttemptId: decision.recoveryAttemptId,
|