autokap 1.1.8 → 1.3.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/assets/skill/OPCODE-REFERENCE.md +18 -1
- package/assets/skill/SKILL.md +54 -11
- package/dist/browser.js +23 -1
- package/dist/capture-strategy.d.ts +14 -0
- package/dist/capture-strategy.js +28 -0
- package/dist/cli-contract.d.ts +61 -0
- package/dist/cli-runner.d.ts +10 -1
- package/dist/cli-runner.js +415 -20
- package/dist/cli.js +80 -0
- package/dist/clip-capture-loop.js +11 -2
- package/dist/cookie-dismiss.d.ts +1 -0
- package/dist/cookie-dismiss.js +13 -1
- package/dist/execution-schema.d.ts +303 -2
- package/dist/execution-schema.js +77 -4
- package/dist/execution-types.d.ts +114 -5
- package/dist/execution-types.js +2 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/mouse-animation.d.ts +12 -2
- package/dist/mouse-animation.js +36 -6
- package/dist/opcode-actions.d.ts +2 -0
- package/dist/opcode-actions.js +39 -5
- package/dist/opcode-runner.d.ts +2 -0
- package/dist/opcode-runner.js +139 -17
- package/dist/openrouter-tts.d.ts +74 -0
- package/dist/openrouter-tts.js +218 -0
- package/dist/postcondition.js +36 -26
- package/dist/program-signing.d.ts +67 -0
- package/dist/recovery-chain.js +26 -12
- package/dist/server-credit-usage.d.ts +1 -1
- package/dist/video-narration-schema.d.ts +1165 -0
- package/dist/video-narration-schema.js +137 -0
- package/dist/web-playwright-local.d.ts +16 -0
- package/dist/web-playwright-local.js +204 -18
- package/package.json +9 -1
|
@@ -32,6 +32,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
32
32
|
presetId: z.ZodString;
|
|
33
33
|
programVersion: z.ZodNumber;
|
|
34
34
|
mediaMode: z.ZodEnum<{
|
|
35
|
+
video: "video";
|
|
35
36
|
clip: "clip";
|
|
36
37
|
screenshot: "screenshot";
|
|
37
38
|
}>;
|
|
@@ -170,6 +171,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
170
171
|
}, z.core.$strict>;
|
|
171
172
|
timeoutMs: z.ZodNumber;
|
|
172
173
|
maxFailures: z.ZodNumber;
|
|
174
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
173
175
|
kind: z.ZodLiteral<"NAVIGATE">;
|
|
174
176
|
}, z.core.$strict>, z.ZodObject<{
|
|
175
177
|
description: z.ZodString;
|
|
@@ -199,6 +201,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
199
201
|
}, z.core.$strict>;
|
|
200
202
|
timeoutMs: z.ZodNumber;
|
|
201
203
|
maxFailures: z.ZodNumber;
|
|
204
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
202
205
|
kind: z.ZodLiteral<"DISMISS_OVERLAYS">;
|
|
203
206
|
}, z.core.$strict>, z.ZodObject<{
|
|
204
207
|
urlPattern: z.ZodString;
|
|
@@ -229,6 +232,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
229
232
|
}, z.core.$strict>;
|
|
230
233
|
timeoutMs: z.ZodNumber;
|
|
231
234
|
maxFailures: z.ZodNumber;
|
|
235
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
232
236
|
kind: z.ZodLiteral<"ASSERT_ROUTE">;
|
|
233
237
|
}, z.core.$strict>, z.ZodObject<{
|
|
234
238
|
selectors: z.ZodArray<z.ZodString>;
|
|
@@ -260,6 +264,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
260
264
|
}, z.core.$strict>;
|
|
261
265
|
timeoutMs: z.ZodNumber;
|
|
262
266
|
maxFailures: z.ZodNumber;
|
|
267
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
263
268
|
kind: z.ZodLiteral<"ASSERT_SURFACE">;
|
|
264
269
|
}, z.core.$strict>, z.ZodObject<{
|
|
265
270
|
selector: z.ZodString;
|
|
@@ -304,6 +309,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
304
309
|
}, z.core.$strict>;
|
|
305
310
|
timeoutMs: z.ZodNumber;
|
|
306
311
|
maxFailures: z.ZodNumber;
|
|
312
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
307
313
|
kind: z.ZodLiteral<"CLICK">;
|
|
308
314
|
}, z.core.$strict>, z.ZodObject<{
|
|
309
315
|
selector: z.ZodString;
|
|
@@ -347,6 +353,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
347
353
|
}, z.core.$strict>;
|
|
348
354
|
timeoutMs: z.ZodNumber;
|
|
349
355
|
maxFailures: z.ZodNumber;
|
|
356
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
350
357
|
kind: z.ZodLiteral<"TYPE">;
|
|
351
358
|
}, z.core.$strict>, z.ZodObject<{
|
|
352
359
|
key: z.ZodString;
|
|
@@ -377,6 +384,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
377
384
|
}, z.core.$strict>;
|
|
378
385
|
timeoutMs: z.ZodNumber;
|
|
379
386
|
maxFailures: z.ZodNumber;
|
|
387
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
380
388
|
kind: z.ZodLiteral<"PRESS_KEY">;
|
|
381
389
|
}, z.core.$strict>, z.ZodObject<{
|
|
382
390
|
selector: z.ZodOptional<z.ZodString>;
|
|
@@ -419,7 +427,41 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
419
427
|
}, z.core.$strict>;
|
|
420
428
|
timeoutMs: z.ZodNumber;
|
|
421
429
|
maxFailures: z.ZodNumber;
|
|
430
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
422
431
|
kind: z.ZodLiteral<"WAIT_FOR">;
|
|
432
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
433
|
+
durationMs: z.ZodNumber;
|
|
434
|
+
narrationText: z.ZodOptional<z.ZodString>;
|
|
435
|
+
narrationTextByLocale: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
436
|
+
description: z.ZodString;
|
|
437
|
+
postcondition: z.ZodObject<{
|
|
438
|
+
type: z.ZodEnum<{
|
|
439
|
+
route_matches: "route_matches";
|
|
440
|
+
element_visible: "element_visible";
|
|
441
|
+
element_absent: "element_absent";
|
|
442
|
+
text_contains: "text_contains";
|
|
443
|
+
overlay_dismissed: "overlay_dismissed";
|
|
444
|
+
screenshot_stable: "screenshot_stable";
|
|
445
|
+
any_change: "any_change";
|
|
446
|
+
always: "always";
|
|
447
|
+
}>;
|
|
448
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
449
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
450
|
+
text: z.ZodOptional<z.ZodString>;
|
|
451
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
452
|
+
waitMs: z.ZodOptional<z.ZodNumber>;
|
|
453
|
+
}, z.core.$strict>;
|
|
454
|
+
recovery: z.ZodObject<{
|
|
455
|
+
retries: z.ZodNumber;
|
|
456
|
+
useSelectorMemory: z.ZodBoolean;
|
|
457
|
+
useAltInteraction: z.ZodBoolean;
|
|
458
|
+
allowReload: z.ZodBoolean;
|
|
459
|
+
allowHealer: z.ZodBoolean;
|
|
460
|
+
}, z.core.$strict>;
|
|
461
|
+
timeoutMs: z.ZodNumber;
|
|
462
|
+
maxFailures: z.ZodNumber;
|
|
463
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
464
|
+
kind: z.ZodLiteral<"SLEEP">;
|
|
423
465
|
}, z.core.$strict>, z.ZodObject<{
|
|
424
466
|
locale: z.ZodString;
|
|
425
467
|
method: z.ZodEnum<{
|
|
@@ -464,6 +506,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
464
506
|
}, z.core.$strict>;
|
|
465
507
|
timeoutMs: z.ZodNumber;
|
|
466
508
|
maxFailures: z.ZodNumber;
|
|
509
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
467
510
|
kind: z.ZodLiteral<"SET_LOCALE">;
|
|
468
511
|
}, z.core.$strict>, z.ZodObject<{
|
|
469
512
|
theme: z.ZodEnum<{
|
|
@@ -513,6 +556,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
513
556
|
}, z.core.$strict>;
|
|
514
557
|
timeoutMs: z.ZodNumber;
|
|
515
558
|
maxFailures: z.ZodNumber;
|
|
559
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
516
560
|
kind: z.ZodLiteral<"SET_THEME">;
|
|
517
561
|
}, z.core.$strict>, z.ZodObject<{
|
|
518
562
|
direction: z.ZodEnum<{
|
|
@@ -558,6 +602,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
558
602
|
}, z.core.$strict>;
|
|
559
603
|
timeoutMs: z.ZodNumber;
|
|
560
604
|
maxFailures: z.ZodNumber;
|
|
605
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
561
606
|
kind: z.ZodLiteral<"SCROLL">;
|
|
562
607
|
}, z.core.$strict>, z.ZodObject<{
|
|
563
608
|
captureId: z.ZodOptional<z.ZodString>;
|
|
@@ -590,6 +635,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
590
635
|
}, z.core.$strict>;
|
|
591
636
|
timeoutMs: z.ZodNumber;
|
|
592
637
|
maxFailures: z.ZodNumber;
|
|
638
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
593
639
|
kind: z.ZodLiteral<"CAPTURE_SCREENSHOT">;
|
|
594
640
|
}, z.core.$strict>, z.ZodObject<{
|
|
595
641
|
clipId: z.ZodOptional<z.ZodString>;
|
|
@@ -621,6 +667,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
621
667
|
}, z.core.$strict>;
|
|
622
668
|
timeoutMs: z.ZodNumber;
|
|
623
669
|
maxFailures: z.ZodNumber;
|
|
670
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
624
671
|
kind: z.ZodLiteral<"BEGIN_CLIP">;
|
|
625
672
|
}, z.core.$strict>, z.ZodObject<{
|
|
626
673
|
clipId: z.ZodOptional<z.ZodString>;
|
|
@@ -652,6 +699,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
652
699
|
}, z.core.$strict>;
|
|
653
700
|
timeoutMs: z.ZodNumber;
|
|
654
701
|
maxFailures: z.ZodNumber;
|
|
702
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
655
703
|
kind: z.ZodLiteral<"END_CLIP">;
|
|
656
704
|
}, z.core.$strict>, z.ZodObject<{
|
|
657
705
|
selector: z.ZodString;
|
|
@@ -692,6 +740,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
692
740
|
}, z.core.$strict>;
|
|
693
741
|
timeoutMs: z.ZodNumber;
|
|
694
742
|
maxFailures: z.ZodNumber;
|
|
743
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
695
744
|
kind: z.ZodLiteral<"HOVER">;
|
|
696
745
|
}, z.core.$strict>, z.ZodObject<{
|
|
697
746
|
selector: z.ZodString;
|
|
@@ -735,6 +784,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
735
784
|
}, z.core.$strict>;
|
|
736
785
|
timeoutMs: z.ZodNumber;
|
|
737
786
|
maxFailures: z.ZodNumber;
|
|
787
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
738
788
|
kind: z.ZodLiteral<"SELECT_OPTION">;
|
|
739
789
|
}, z.core.$strict>, z.ZodObject<{
|
|
740
790
|
selector: z.ZodString;
|
|
@@ -776,6 +826,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
776
826
|
}, z.core.$strict>;
|
|
777
827
|
timeoutMs: z.ZodNumber;
|
|
778
828
|
maxFailures: z.ZodNumber;
|
|
829
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
779
830
|
kind: z.ZodLiteral<"CHECK">;
|
|
780
831
|
}, z.core.$strict>, z.ZodObject<{
|
|
781
832
|
selector: z.ZodString;
|
|
@@ -816,6 +867,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
816
867
|
}, z.core.$strict>;
|
|
817
868
|
timeoutMs: z.ZodNumber;
|
|
818
869
|
maxFailures: z.ZodNumber;
|
|
870
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
819
871
|
kind: z.ZodLiteral<"DOUBLE_CLICK">;
|
|
820
872
|
}, z.core.$strict>, z.ZodObject<{
|
|
821
873
|
selector: z.ZodString;
|
|
@@ -870,6 +922,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
870
922
|
}, z.core.$strict>;
|
|
871
923
|
timeoutMs: z.ZodNumber;
|
|
872
924
|
maxFailures: z.ZodNumber;
|
|
925
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
873
926
|
kind: z.ZodLiteral<"DRAG">;
|
|
874
927
|
}, z.core.$strict>, z.ZodObject<{
|
|
875
928
|
sourceSelector: z.ZodString;
|
|
@@ -903,6 +956,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
903
956
|
}, z.core.$strict>;
|
|
904
957
|
timeoutMs: z.ZodNumber;
|
|
905
958
|
maxFailures: z.ZodNumber;
|
|
959
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
906
960
|
kind: z.ZodLiteral<"CLONE_ELEMENT">;
|
|
907
961
|
}, z.core.$strict>, z.ZodObject<{
|
|
908
962
|
groupName: z.ZodString;
|
|
@@ -944,6 +998,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
944
998
|
}, z.core.$strict>;
|
|
945
999
|
timeoutMs: z.ZodNumber;
|
|
946
1000
|
maxFailures: z.ZodNumber;
|
|
1001
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
947
1002
|
kind: z.ZodLiteral<"INJECT_MOCK_DATA">;
|
|
948
1003
|
}, z.core.$strict>, z.ZodObject<{
|
|
949
1004
|
selector: z.ZodString;
|
|
@@ -974,6 +1029,7 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
974
1029
|
}, z.core.$strict>;
|
|
975
1030
|
timeoutMs: z.ZodNumber;
|
|
976
1031
|
maxFailures: z.ZodNumber;
|
|
1032
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
977
1033
|
kind: z.ZodLiteral<"REMOVE_ELEMENT">;
|
|
978
1034
|
}, z.core.$strict>, z.ZodObject<{
|
|
979
1035
|
selector: z.ZodString;
|
|
@@ -1006,10 +1062,12 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
1006
1062
|
}, z.core.$strict>;
|
|
1007
1063
|
timeoutMs: z.ZodNumber;
|
|
1008
1064
|
maxFailures: z.ZodNumber;
|
|
1065
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
1009
1066
|
kind: z.ZodLiteral<"SET_ATTRIBUTE">;
|
|
1010
1067
|
}, z.core.$strict>], "kind">>;
|
|
1011
1068
|
artifactPlan: z.ZodObject<{
|
|
1012
1069
|
mediaMode: z.ZodEnum<{
|
|
1070
|
+
video: "video";
|
|
1013
1071
|
clip: "clip";
|
|
1014
1072
|
screenshot: "screenshot";
|
|
1015
1073
|
}>;
|
|
@@ -1023,6 +1081,15 @@ export declare const SignedExecutionProgramEnvelopeSchema: z.ZodObject<{
|
|
|
1023
1081
|
png: "png";
|
|
1024
1082
|
jpeg: "jpeg";
|
|
1025
1083
|
}>>;
|
|
1084
|
+
captureResolution: z.ZodOptional<z.ZodObject<{
|
|
1085
|
+
width: z.ZodNumber;
|
|
1086
|
+
height: z.ZodNumber;
|
|
1087
|
+
}, z.core.$strict>>;
|
|
1088
|
+
captureFps: z.ZodOptional<z.ZodNumber>;
|
|
1089
|
+
deliveryResolution: z.ZodOptional<z.ZodObject<{
|
|
1090
|
+
width: z.ZodNumber;
|
|
1091
|
+
height: z.ZodNumber;
|
|
1092
|
+
}, z.core.$strict>>;
|
|
1026
1093
|
}, z.core.$strict>>;
|
|
1027
1094
|
cursorTheme: z.ZodOptional<z.ZodEnum<{
|
|
1028
1095
|
minimal: "minimal";
|
package/dist/recovery-chain.js
CHANGED
|
@@ -35,7 +35,7 @@ export class RecoveryChainImpl {
|
|
|
35
35
|
const retryBudget = Math.max(0, Math.min(recovery.retries, options.maxDeterministicRetries ?? recovery.retries));
|
|
36
36
|
if (retryBudget > 0) {
|
|
37
37
|
logger.debug(`[recovery ${opcodeIndex}] strategy 1 (retry x${retryBudget})`);
|
|
38
|
-
const result = await retryOpcode(failedOpcode, adapter, retryBudget, options.remainingTimeMs, options.currentVariant, this.credentials);
|
|
38
|
+
const result = await retryOpcode(failedOpcode, adapter, retryBudget, options.remainingTimeMs, options.currentVariant, this.credentials, options.suppressPageReloads);
|
|
39
39
|
logger.debug(`[recovery ${opcodeIndex}] strategy 1 → recovered=${result.recovered}, reason=${result.reason}`);
|
|
40
40
|
if (result.recovered)
|
|
41
41
|
return result;
|
|
@@ -57,7 +57,12 @@ export class RecoveryChainImpl {
|
|
|
57
57
|
return result;
|
|
58
58
|
}
|
|
59
59
|
// Strategy 4: Targeted reload
|
|
60
|
-
|
|
60
|
+
let skippedReloadReason;
|
|
61
|
+
if (recovery.allowReload && options.allowPageReload === false) {
|
|
62
|
+
skippedReloadReason = 'reload recovery skipped because page reloads are disabled during active recording';
|
|
63
|
+
logger.debug(`[recovery ${opcodeIndex}] strategy 4 skipped (${skippedReloadReason})`);
|
|
64
|
+
}
|
|
65
|
+
else if (recovery.allowReload) {
|
|
61
66
|
logger.debug(`[recovery ${opcodeIndex}] strategy 4 (reload)`);
|
|
62
67
|
const result = await tryReload(failedOpcode, adapter, options.currentVariant, this.credentials);
|
|
63
68
|
logger.debug(`[recovery ${opcodeIndex}] strategy 4 → recovered=${result.recovered}, reason=${result.reason}`);
|
|
@@ -67,16 +72,21 @@ export class RecoveryChainImpl {
|
|
|
67
72
|
// Strategy 5: LLM Healer
|
|
68
73
|
if (recovery.allowHealer && this.healer && this.healer.remainingInvocations > 0) {
|
|
69
74
|
logger.debug(`[recovery ${opcodeIndex}] strategy 5 (LLM healer)`);
|
|
70
|
-
const result = await tryHealer(failedOpcode, opcodeIndex, adapter, this.healer, this.programSteps, options.currentVariant, this.credentials);
|
|
75
|
+
const result = await tryHealer(failedOpcode, opcodeIndex, adapter, this.healer, this.programSteps, options.currentVariant, this.credentials, options.suppressPageReloads);
|
|
71
76
|
logger.debug(`[recovery ${opcodeIndex}] strategy 5 → recovered=${result.recovered}, reason=${result.reason}`);
|
|
72
77
|
return result;
|
|
73
78
|
}
|
|
74
79
|
logger.debug(`[recovery ${opcodeIndex}] all strategies exhausted`);
|
|
75
|
-
return {
|
|
80
|
+
return {
|
|
81
|
+
recovered: false,
|
|
82
|
+
reason: skippedReloadReason
|
|
83
|
+
? `${skippedReloadReason}; all recovery strategies exhausted`
|
|
84
|
+
: 'all recovery strategies exhausted',
|
|
85
|
+
};
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
88
|
// ── Strategy 1: Deterministic retry ─────────────────────────────────
|
|
79
|
-
async function retryOpcode(opcode, adapter, maxRetries, remainingTimeMs, currentVariant, credentials) {
|
|
89
|
+
async function retryOpcode(opcode, adapter, maxRetries, remainingTimeMs, currentVariant, credentials, suppressPageReloads = false) {
|
|
80
90
|
const deadlineMs = typeof remainingTimeMs === 'number'
|
|
81
91
|
? Date.now() + remainingTimeMs
|
|
82
92
|
: Number.POSITIVE_INFINITY;
|
|
@@ -86,7 +96,7 @@ async function retryOpcode(opcode, adapter, maxRetries, remainingTimeMs, current
|
|
|
86
96
|
}
|
|
87
97
|
await sleep(500 * (i + 1)); // backoff
|
|
88
98
|
try {
|
|
89
|
-
await executeRawAction(opcode, adapter, currentVariant, credentials);
|
|
99
|
+
await executeRawAction(opcode, adapter, currentVariant, credentials, suppressPageReloads);
|
|
90
100
|
const postcondition = await evaluatePostcondition(adapter, clampPostconditionWait(opcode.postcondition, deadlineMs));
|
|
91
101
|
if (postcondition.passed) {
|
|
92
102
|
return { recovered: true, strategy: 'retry', reason: `retry ${i + 1}/${maxRetries} succeeded` };
|
|
@@ -210,7 +220,7 @@ async function tryReload(opcode, adapter, currentVariant, credentials) {
|
|
|
210
220
|
return { recovered: false, reason: 'reload + retry failed' };
|
|
211
221
|
}
|
|
212
222
|
// ── Strategy 5: LLM Healer ─────────────────────────────────────────
|
|
213
|
-
async function tryHealer(failedOpcode, opcodeIndex, adapter, healer, programSteps, currentVariant, credentials) {
|
|
223
|
+
async function tryHealer(failedOpcode, opcodeIndex, adapter, healer, programSteps, currentVariant, credentials, suppressPageReloads = false) {
|
|
214
224
|
try {
|
|
215
225
|
const tree = await adapter.getAKTree();
|
|
216
226
|
const akTreeSerialized = serializeAKTree(tree);
|
|
@@ -239,7 +249,7 @@ async function tryHealer(failedOpcode, opcodeIndex, adapter, healer, programStep
|
|
|
239
249
|
// intermediate postcondition after each step.
|
|
240
250
|
for (const replacementOp of result.patch.replacementOpcodes) {
|
|
241
251
|
try {
|
|
242
|
-
await executeHealerPatchedAction(replacementOp, adapter, result.patch.interactionMode, currentVariant, credentials);
|
|
252
|
+
await executeHealerPatchedAction(replacementOp, adapter, result.patch.interactionMode, currentVariant, credentials, suppressPageReloads);
|
|
243
253
|
}
|
|
244
254
|
catch (err) {
|
|
245
255
|
return {
|
|
@@ -278,13 +288,17 @@ async function tryHealer(failedOpcode, opcodeIndex, adapter, healer, programStep
|
|
|
278
288
|
function hasSelector(opcode) {
|
|
279
289
|
return 'selector' in opcode && typeof opcode.selector === 'string' && !!opcode.selector;
|
|
280
290
|
}
|
|
281
|
-
async function executeRawAction(opcode, adapter, currentVariant, credentials) {
|
|
282
|
-
const result = await executeOpcodeCoreAction(opcode, adapter, {
|
|
291
|
+
async function executeRawAction(opcode, adapter, currentVariant, credentials, suppressPageReloads = false) {
|
|
292
|
+
const result = await executeOpcodeCoreAction(opcode, adapter, {
|
|
293
|
+
currentVariant,
|
|
294
|
+
credentials,
|
|
295
|
+
suppressPageReloads,
|
|
296
|
+
});
|
|
283
297
|
if (!result.success) {
|
|
284
298
|
throw new Error(result.error ?? `opcode ${opcode.kind} could not be replayed`);
|
|
285
299
|
}
|
|
286
300
|
}
|
|
287
|
-
async function executeHealerPatchedAction(opcode, adapter, interactionMode, currentVariant, credentials) {
|
|
301
|
+
async function executeHealerPatchedAction(opcode, adapter, interactionMode, currentVariant, credentials, suppressPageReloads = false) {
|
|
288
302
|
if (opcode.kind === 'CLICK' && interactionMode && interactionMode !== 'default') {
|
|
289
303
|
const options = interactionMode === 'keyboard'
|
|
290
304
|
? { useKeyboard: true }
|
|
@@ -296,7 +310,7 @@ async function executeHealerPatchedAction(opcode, adapter, interactionMode, curr
|
|
|
296
310
|
await adapter.click(opcode.selector, options);
|
|
297
311
|
return;
|
|
298
312
|
}
|
|
299
|
-
await executeRawAction(opcode, adapter, currentVariant, credentials);
|
|
313
|
+
await executeRawAction(opcode, adapter, currentVariant, credentials, suppressPageReloads);
|
|
300
314
|
}
|
|
301
315
|
async function executeWithSelector(opcode, adapter, newSelector, credentials) {
|
|
302
316
|
switch (opcode.kind) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
-
export type CreditUsageType = 'screenshot' | 'clip' | 'preset_analysis' | 'ai_chat' | 'studio_creation' | 'studio_iteration';
|
|
2
|
+
export type CreditUsageType = 'screenshot' | 'clip' | 'video' | 'preset_analysis' | 'ai_chat' | 'studio_creation' | 'studio_iteration';
|
|
3
3
|
export declare function recordCreditUsage(supabase: SupabaseClient, params: {
|
|
4
4
|
userId: string;
|
|
5
5
|
projectId: string | null;
|