autokap 1.9.4 → 1.9.6
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/action-verifier.d.ts +33 -0
- package/dist/action-verifier.js +103 -4
- package/dist/browser.js +96 -10
- package/dist/cli-runner.js +26 -9
- package/dist/cookie-dismiss.d.ts +9 -0
- package/dist/cookie-dismiss.js +43 -10
- package/dist/opcode-runner.js +86 -5
- package/dist/overlay-engine.js +108 -15
- package/dist/postcondition.js +73 -16
- package/dist/recovery-chain.js +70 -5
- package/dist/security.d.ts +21 -4
- package/dist/security.js +73 -6
- package/dist/wait-contract.d.ts +23 -9
- package/dist/wait-contract.js +24 -12
- package/dist/web-playwright-local.d.ts +1 -0
- package/dist/web-playwright-local.js +34 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import type { Browser } from './browser.js';
|
|
|
8
8
|
import type { AKTree, OutscaleConfig, VideoPageSignals } from './types.js';
|
|
9
9
|
import type { RuntimeAdapter, ClickOptions, WaitCondition, RecordingOptions, RecordingResult, SemanticTarget, ProgressSnapshot, VisualStabilityResult } from './execution-types.js';
|
|
10
10
|
import { type ResolveOptions } from './semantic-resolver.js';
|
|
11
|
+
export declare function isRecognizedHintCookieKey(key: string, kind: 'locale' | 'theme'): boolean;
|
|
11
12
|
export declare class WebPlaywrightLocal implements RuntimeAdapter {
|
|
12
13
|
private browser;
|
|
13
14
|
private recordingDir?;
|
|
@@ -13,6 +13,32 @@ import { logger } from './logger.js';
|
|
|
13
13
|
import { ClipCaptureLoop } from './clip-capture-loop.js';
|
|
14
14
|
import { FfmpegX11Recorder } from './ffmpeg-x11-recorder.js';
|
|
15
15
|
import { assembleMp4FromFrames, getMediaDurationMs } from './clip-postprocess.js';
|
|
16
|
+
/**
|
|
17
|
+
* Locale/theme cookie names the engine treats as a real "applied" signal.
|
|
18
|
+
* Mirrors the storage-key whitelists in {@link Browser.writeStorageHintCandidate}
|
|
19
|
+
* so a SET_LOCALE/SET_THEME cookie hint is only reported as effective when the
|
|
20
|
+
* cookie name plausibly drives the app's locale/theme. Apps that derive these
|
|
21
|
+
* from the path or middleware (common in Next.js) won't match, so the opcode
|
|
22
|
+
* fails instead of passing with a wrong-variant capture.
|
|
23
|
+
*/
|
|
24
|
+
const LOCALE_COOKIE_KEY_WHITELIST = [
|
|
25
|
+
'lang', 'locale', 'language', 'i18n', 'intl', 'i18n-locale',
|
|
26
|
+
'next-i18next', 'NEXT_LOCALE', 'nuxt-i18n-locale',
|
|
27
|
+
];
|
|
28
|
+
const THEME_COOKIE_KEY_WHITELIST = [
|
|
29
|
+
'theme', 'color-scheme', 'colorScheme', 'dark-mode', 'darkMode', 'appearance',
|
|
30
|
+
];
|
|
31
|
+
export function isRecognizedHintCookieKey(key, kind) {
|
|
32
|
+
const whitelist = kind === 'locale' ? LOCALE_COOKIE_KEY_WHITELIST : THEME_COOKIE_KEY_WHITELIST;
|
|
33
|
+
const lower = key.toLowerCase();
|
|
34
|
+
return whitelist.some((entry) => {
|
|
35
|
+
const normalized = entry.toLowerCase();
|
|
36
|
+
if (lower === normalized)
|
|
37
|
+
return true;
|
|
38
|
+
const re = new RegExp(`(?:^|[^a-zA-Z0-9])${normalized.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')}(?:$|[^a-zA-Z0-9])`, 'i');
|
|
39
|
+
return re.test(lower);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
16
42
|
/**
|
|
17
43
|
* Snapshot the scroll offset of the window and every scroll container, tagging
|
|
18
44
|
* each element so {@link restoreScrollState} can put it back.
|
|
@@ -805,7 +831,14 @@ export class WebPlaywrightLocal {
|
|
|
805
831
|
secure: url.protocol === 'https:',
|
|
806
832
|
sameSite: 'Lax',
|
|
807
833
|
}]);
|
|
808
|
-
|
|
834
|
+
// Writing the cookie to the browser context always succeeds, but that is
|
|
835
|
+
// NOT a signal that the app actually reads locale/theme from this cookie.
|
|
836
|
+
// Many Next.js apps derive locale/theme from the path or middleware, so a
|
|
837
|
+
// blanket `true` here falsely reports the hint as "applied" and lets the
|
|
838
|
+
// SET_LOCALE/SET_THEME opcode pass with a wrong-variant capture. Mirror the
|
|
839
|
+
// storage-key skepticism (browser.ts#writeStorageHintCandidate): only claim
|
|
840
|
+
// success when the cookie name looks like a recognized locale/theme key.
|
|
841
|
+
return isRecognizedHintCookieKey(params.key, params.kind);
|
|
809
842
|
}
|
|
810
843
|
return this.browser.writeStorageHintCandidate({
|
|
811
844
|
storageName: params.storage,
|