autokap 1.6.0 → 1.6.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/dist/cli-runner.js
CHANGED
|
@@ -686,6 +686,7 @@ async function uploadResults(config, program, result, runId = randomUUID()) {
|
|
|
686
686
|
healerPatches: sanitizedHealerPatches,
|
|
687
687
|
runResult: strippedRunResult,
|
|
688
688
|
totalDurationMs: result.totalDurationMs,
|
|
689
|
+
detectedAppVersion: result.detectedAppVersion ?? undefined,
|
|
689
690
|
variantSummaries: result.variantResults.map(v => ({
|
|
690
691
|
variantId: v.variantId,
|
|
691
692
|
success: v.success,
|
|
@@ -605,6 +605,13 @@ export interface VariantResult {
|
|
|
605
605
|
durationMs: number;
|
|
606
606
|
/** Artifact buffers produced */
|
|
607
607
|
artifacts: ArtifactResult[];
|
|
608
|
+
/**
|
|
609
|
+
* App version detected on the captured page (meta tag, window global, or
|
|
610
|
+
* data attribute). Sent to the server with telemetry so freshness tracking
|
|
611
|
+
* picks up the version live during the capture instead of waiting for the
|
|
612
|
+
* hourly cron.
|
|
613
|
+
*/
|
|
614
|
+
detectedAppVersion?: string | null;
|
|
608
615
|
error?: string;
|
|
609
616
|
}
|
|
610
617
|
export interface ArtifactResult {
|
|
@@ -725,6 +732,12 @@ export interface RunResult {
|
|
|
725
732
|
* array for `screenshot` and `clip` modes.
|
|
726
733
|
*/
|
|
727
734
|
opcodeTimings: OpcodeTiming[];
|
|
735
|
+
/**
|
|
736
|
+
* First non-null `detectedAppVersion` from the variants. Used by the server
|
|
737
|
+
* telemetry route to bypass the cron-detected version and stamp the preset
|
|
738
|
+
* with the version actually captured on the page.
|
|
739
|
+
*/
|
|
740
|
+
detectedAppVersion?: string | null;
|
|
728
741
|
error?: string;
|
|
729
742
|
}
|
|
730
743
|
export interface WaitCondition {
|
|
@@ -842,6 +855,12 @@ export interface RuntimeAdapter {
|
|
|
842
855
|
buffer: Buffer;
|
|
843
856
|
mimeType: string;
|
|
844
857
|
} | null>;
|
|
858
|
+
/**
|
|
859
|
+
* Read the captured app's version from the live page (meta tag, window
|
|
860
|
+
* global, or data attribute). Mirrors `extractAppVersionFromHtml` server-side
|
|
861
|
+
* and `__AUTOKAP_VERSION__` lookup. Returns null if no marker is present.
|
|
862
|
+
*/
|
|
863
|
+
detectAppVersion?(): Promise<string | null>;
|
|
845
864
|
close(): Promise<void>;
|
|
846
865
|
/** Click an element by semantic target. Falls back to selector if target not found. */
|
|
847
866
|
clickByTarget?(opts: ClickByTargetOptions): Promise<void>;
|
package/dist/opcode-runner.js
CHANGED
|
@@ -147,6 +147,7 @@ export async function executeProgram(program, createAdapter, options = {}) {
|
|
|
147
147
|
const completedVariantResults = variantResults.filter((result) => Boolean(result));
|
|
148
148
|
const aborted = options.abortSignal?.aborted && completedVariantResults.length < program.variants.length;
|
|
149
149
|
const success = !aborted && completedVariantResults.length > 0 && completedVariantResults.every(v => v.success);
|
|
150
|
+
const detectedAppVersion = completedVariantResults.reduce((acc, variantResult) => acc ?? (variantResult.detectedAppVersion ?? null), null);
|
|
150
151
|
return {
|
|
151
152
|
programId: program.presetId,
|
|
152
153
|
success,
|
|
@@ -155,6 +156,7 @@ export async function executeProgram(program, createAdapter, options = {}) {
|
|
|
155
156
|
healerPatches: success ? healerPatches : [], // Only propagate patches on success
|
|
156
157
|
opcodeTimings,
|
|
157
158
|
totalDurationMs: Date.now() - startTime,
|
|
159
|
+
detectedAppVersion,
|
|
158
160
|
error: aborted ? 'aborted' : (success ? undefined : completedVariantResults.find(v => !v.success)?.error),
|
|
159
161
|
};
|
|
160
162
|
}
|
|
@@ -234,12 +236,25 @@ async function executeVariant(program, variant, createAdapter, recoveryChain, te
|
|
|
234
236
|
};
|
|
235
237
|
}
|
|
236
238
|
}
|
|
239
|
+
// Best-effort: read the app version from the live page so the server can
|
|
240
|
+
// stamp the preset with what we actually captured (instead of falling back
|
|
241
|
+
// to whatever the hourly cron last detected).
|
|
242
|
+
let detectedAppVersion = null;
|
|
243
|
+
if (adapter.detectAppVersion) {
|
|
244
|
+
try {
|
|
245
|
+
detectedAppVersion = await adapter.detectAppVersion();
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
detectedAppVersion = null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
237
251
|
return {
|
|
238
252
|
variantId: variant.id,
|
|
239
253
|
success: true,
|
|
240
254
|
opcodeResults,
|
|
241
255
|
durationMs: Date.now() - startTime,
|
|
242
256
|
artifacts,
|
|
257
|
+
detectedAppVersion,
|
|
243
258
|
};
|
|
244
259
|
}
|
|
245
260
|
catch (err) {
|
|
@@ -27,6 +27,7 @@ export declare class WebPlaywrightLocal implements RuntimeAdapter {
|
|
|
27
27
|
constructor(browser: Browser, recordingDir?: string | undefined);
|
|
28
28
|
navigate(url: string): Promise<void>;
|
|
29
29
|
getCurrentUrl(): Promise<string>;
|
|
30
|
+
detectAppVersion(): Promise<string | null>;
|
|
30
31
|
getAKTree(): Promise<AKTree>;
|
|
31
32
|
getPageSignals(): Promise<VideoPageSignals>;
|
|
32
33
|
click(selector: string, options?: ClickOptions): Promise<void>;
|
|
Binary file
|