autokap 1.0.7 → 1.0.8
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/cursors/macos.svg +4 -0
- package/assets/cursors/windows.svg +15 -0
- package/assets/skill/OPCODE-REFERENCE.md +607 -0
- package/assets/skill/README.md +39 -0
- package/assets/skill/SKILL.md +453 -468
- package/assets/skill/STUDIO-SKILL.md +476 -0
- package/assets/skill/references/examples.md +104 -0
- package/assets/skill/references/interactive-demo.md +225 -0
- package/assets/skill/references/mock-data.md +178 -0
- package/dist/action-verifier.d.ts +29 -0
- package/dist/action-verifier.js +133 -0
- package/dist/agent-action-recovery.d.ts +45 -0
- package/dist/agent-action-recovery.js +370 -0
- package/dist/agent-message-utils.d.ts +21 -0
- package/dist/agent-message-utils.js +77 -0
- package/dist/agent-url-utils.d.ts +30 -0
- package/dist/agent-url-utils.js +138 -0
- package/dist/agent.d.ts +92 -8
- package/dist/agent.js +2936 -781
- package/dist/ak-tree.d.ts +39 -0
- package/dist/ak-tree.js +368 -0
- package/dist/alt-text.d.ts +26 -0
- package/dist/alt-text.js +55 -0
- package/dist/auth-capture.d.ts +17 -0
- package/dist/auth-capture.js +164 -0
- package/dist/benchmark.d.ts +59 -0
- package/dist/benchmark.js +135 -0
- package/dist/browser-bar.d.ts +14 -6
- package/dist/browser-bar.js +145 -8
- package/dist/browser-pool.d.ts +7 -0
- package/dist/browser-pool.js +15 -5
- package/dist/browser-utils.d.ts +31 -0
- package/dist/browser-utils.js +97 -0
- package/dist/browser.d.ts +51 -1
- package/dist/browser.js +1481 -31
- package/dist/capture-alt-text.js +2 -1
- package/dist/capture-language-preflight.js +14 -0
- package/dist/capture-llm-page-identity.js +22 -10
- package/dist/capture-page-identity.d.ts +5 -7
- package/dist/capture-page-identity.js +211 -78
- package/dist/capture-preset-credentials.d.ts +50 -0
- package/dist/capture-preset-credentials.js +127 -0
- package/dist/capture-request-plan.d.ts +2 -2
- package/dist/capture-request-plan.js +64 -16
- package/dist/capture-run-optimizer.js +48 -33
- package/dist/capture-selector-memory.d.ts +5 -0
- package/dist/capture-selector-memory.js +18 -0
- package/dist/capture-strategy.d.ts +36 -0
- package/dist/capture-strategy.js +95 -0
- package/dist/capture-studio-sync.d.ts +1 -0
- package/dist/capture-studio-sync.js +9 -3
- package/dist/capture-surface-contract.d.ts +36 -0
- package/dist/capture-surface-contract.js +299 -0
- package/dist/capture-transition-engine.d.ts +28 -0
- package/dist/capture-transition-engine.js +292 -0
- package/dist/capture-variant-state.d.ts +2 -0
- package/dist/capture-variant-state.js +26 -0
- package/dist/capture-verification.d.ts +35 -0
- package/dist/capture-verification.js +95 -0
- package/dist/capture-viewport-lock.d.ts +48 -0
- package/dist/capture-viewport-lock.js +74 -0
- package/dist/circuit-breaker.d.ts +42 -0
- package/dist/circuit-breaker.js +119 -0
- package/dist/cli-config.d.ts +8 -1
- package/dist/cli-config.js +62 -6
- package/dist/cli-contract.d.ts +15 -0
- package/dist/cli-contract.js +167 -0
- package/dist/cli-runner-local.d.ts +12 -0
- package/dist/cli-runner-local.js +102 -0
- package/dist/cli-runner.d.ts +34 -0
- package/dist/cli-runner.js +433 -0
- package/dist/cli-utils.d.ts +0 -1
- package/dist/cli-utils.js +2 -5
- package/dist/cli.js +1005 -267
- package/dist/clip-orchestrator.js +9 -2
- package/dist/clip-postprocess.js +25 -16
- package/dist/cookie-dismiss.d.ts +2 -0
- package/dist/cookie-dismiss.js +48 -13
- package/dist/cost-logging.d.ts +8 -0
- package/dist/cost-logging.js +160 -46
- package/dist/cost-resolution-monitor.d.ts +16 -0
- package/dist/cost-resolution-monitor.js +34 -0
- package/dist/credential-templates.js +2 -2
- package/dist/cursor-overlay-script.d.ts +6 -0
- package/dist/cursor-overlay-script.js +169 -0
- package/dist/dom-css-purger.d.ts +65 -0
- package/dist/dom-css-purger.js +333 -0
- package/dist/dom-font-inliner.d.ts +45 -0
- package/dist/dom-font-inliner.js +148 -0
- package/dist/dom-patch-resolver.d.ts +52 -0
- package/dist/dom-patch-resolver.js +242 -0
- package/dist/dom-serializer.d.ts +82 -0
- package/dist/dom-serializer.js +378 -0
- package/dist/element-capture.d.ts +1 -41
- package/dist/element-capture.js +202 -446
- package/dist/env-validation.d.ts +5 -0
- package/dist/env-validation.js +29 -0
- package/dist/execution-schema.d.ts +4423 -0
- package/dist/execution-schema.js +507 -0
- package/dist/execution-types.d.ts +886 -0
- package/dist/execution-types.js +65 -0
- package/dist/fonts-loader.d.ts +14 -0
- package/dist/fonts-loader.js +55 -0
- package/dist/hybrid-navigator.js +12 -12
- package/dist/index.d.ts +9 -6
- package/dist/index.js +10 -4
- package/dist/legacy/agent-action-recovery.d.ts +45 -0
- package/dist/legacy/agent-action-recovery.js +370 -0
- package/dist/legacy/agent-message-utils.d.ts +21 -0
- package/dist/legacy/agent-message-utils.js +77 -0
- package/dist/legacy/agent-url-utils.d.ts +30 -0
- package/dist/legacy/agent-url-utils.js +138 -0
- package/dist/legacy/agent.d.ts +226 -0
- package/dist/legacy/agent.js +6666 -0
- package/dist/legacy/clip-orchestrator.d.ts +148 -0
- package/dist/legacy/clip-orchestrator.js +957 -0
- package/dist/legacy/credential-templates.d.ts +5 -0
- package/dist/legacy/credential-templates.js +60 -0
- package/dist/legacy/hybrid-navigator.d.ts +138 -0
- package/dist/legacy/hybrid-navigator.js +468 -0
- package/dist/legacy/llm-usage.d.ts +17 -0
- package/dist/legacy/llm-usage.js +45 -0
- package/dist/legacy/prompt-cache.d.ts +10 -0
- package/dist/legacy/prompt-cache.js +24 -0
- package/dist/legacy/prompts.d.ts +175 -0
- package/dist/legacy/prompts.js +1038 -0
- package/dist/legacy/tools.d.ts +4 -0
- package/dist/legacy/tools.js +216 -0
- package/dist/legacy/video-agent.d.ts +143 -0
- package/dist/legacy/video-agent.js +4788 -0
- package/dist/legacy/video-observation.d.ts +36 -0
- package/dist/legacy/video-observation.js +192 -0
- package/dist/legacy/video-planner.d.ts +12 -0
- package/dist/legacy/video-planner.js +501 -0
- package/dist/legacy/video-prompts.d.ts +37 -0
- package/dist/legacy/video-prompts.js +569 -0
- package/dist/legacy/video-tools.d.ts +3 -0
- package/dist/legacy/video-tools.js +59 -0
- package/dist/legacy/video-variant-state.d.ts +29 -0
- package/dist/legacy/video-variant-state.js +80 -0
- package/dist/legacy/vision-model.d.ts +17 -0
- package/dist/legacy/vision-model.js +74 -0
- package/dist/llm-healer.d.ts +63 -0
- package/dist/llm-healer.js +166 -0
- package/dist/llm-provider.d.ts +29 -0
- package/dist/llm-provider.js +80 -0
- package/dist/logger.d.ts +6 -2
- package/dist/logger.js +15 -1
- package/dist/mockup-html.js +35 -25
- package/dist/mockup.d.ts +95 -2
- package/dist/mockup.js +427 -166
- package/dist/mouse-animation.d.ts +2 -2
- package/dist/mouse-animation.js +34 -20
- package/dist/opcode-actions.d.ts +42 -0
- package/dist/opcode-actions.js +511 -0
- package/dist/opcode-runner.d.ts +51 -0
- package/dist/opcode-runner.js +770 -0
- package/dist/openrouter-client.d.ts +40 -0
- package/dist/openrouter-client.js +16 -0
- package/dist/overlay-engine.d.ts +24 -0
- package/dist/overlay-engine.js +176 -0
- package/dist/postcondition.d.ts +16 -0
- package/dist/postcondition.js +269 -0
- package/dist/program-patcher.d.ts +25 -0
- package/dist/program-patcher.js +44 -0
- package/dist/prompts.d.ts +13 -5
- package/dist/prompts.js +224 -351
- package/dist/provider-config.d.ts +12 -0
- package/dist/provider-config.js +15 -0
- package/dist/recovery-chain.d.ts +37 -0
- package/dist/recovery-chain.js +350 -0
- package/dist/remote-browser.d.ts +28 -4
- package/dist/remote-browser.js +60 -5
- package/dist/safari-browser-bar.d.ts +15 -0
- package/dist/safari-browser-bar.js +95 -0
- package/dist/safari-toolbar-asset.d.ts +15 -0
- package/dist/safari-toolbar-asset.js +12 -0
- package/dist/security.d.ts +2 -1
- package/dist/security.js +49 -10
- package/dist/selector-resolver.d.ts +34 -0
- package/dist/selector-resolver.js +181 -0
- package/dist/semantic-resolver.d.ts +35 -0
- package/dist/semantic-resolver.js +161 -0
- package/dist/server-capture-runtime.d.ts +5 -3
- package/dist/server-capture-runtime.js +42 -95
- package/dist/server-credit-usage.d.ts +2 -2
- package/dist/server-project-webhooks.d.ts +15 -1
- package/dist/server-project-webhooks.js +34 -8
- package/dist/server-screenshot-watermark.js +27 -5
- package/dist/session-profile.js +164 -1
- package/dist/sf-pro-symbols.d.ts +1 -0
- package/dist/sf-pro-symbols.js +55 -0
- package/dist/skill-packaging.d.ts +28 -0
- package/dist/skill-packaging.js +169 -0
- package/dist/smart-wait.d.ts +27 -0
- package/dist/smart-wait.js +81 -0
- package/dist/status-bar-render.d.ts +20 -0
- package/dist/status-bar-render.js +410 -0
- package/dist/status-bar.d.ts +9 -0
- package/dist/status-bar.js +298 -14
- package/dist/svg-browser-bar.d.ts +33 -0
- package/dist/svg-browser-bar.js +206 -0
- package/dist/svg-status-bar.d.ts +36 -0
- package/dist/svg-status-bar.js +597 -0
- package/dist/svg-text.d.ts +61 -0
- package/dist/svg-text.js +118 -0
- package/dist/tools.js +89 -451
- package/dist/types.d.ts +240 -5
- package/dist/types.js +23 -1
- package/dist/v2/action-verifier.d.ts +29 -0
- package/dist/v2/action-verifier.js +133 -0
- package/dist/v2/alt-text.d.ts +26 -0
- package/dist/v2/alt-text.js +55 -0
- package/dist/v2/benchmark.d.ts +59 -0
- package/dist/v2/benchmark.js +135 -0
- package/dist/v2/capture-strategy.d.ts +30 -0
- package/dist/v2/capture-strategy.js +67 -0
- package/dist/v2/capture-verification.d.ts +35 -0
- package/dist/v2/capture-verification.js +95 -0
- package/dist/v2/circuit-breaker.d.ts +42 -0
- package/dist/v2/circuit-breaker.js +119 -0
- package/dist/v2/cli-runner-local.d.ts +11 -0
- package/dist/v2/cli-runner-local.js +91 -0
- package/dist/v2/cli-runner.d.ts +34 -0
- package/dist/v2/cli-runner.js +300 -0
- package/dist/v2/compiler-prompts.d.ts +27 -0
- package/dist/v2/compiler-prompts.js +123 -0
- package/dist/v2/compiler.d.ts +37 -0
- package/dist/v2/compiler.js +147 -0
- package/dist/v2/explorer.d.ts +41 -0
- package/dist/v2/explorer.js +56 -0
- package/dist/v2/index.d.ts +37 -0
- package/dist/v2/index.js +31 -0
- package/dist/v2/llm-healer.d.ts +62 -0
- package/dist/v2/llm-healer.js +166 -0
- package/dist/v2/llm-provider.d.ts +29 -0
- package/dist/v2/llm-provider.js +80 -0
- package/dist/v2/opcode-runner.d.ts +47 -0
- package/dist/v2/opcode-runner.js +634 -0
- package/dist/v2/overlay-engine.d.ts +24 -0
- package/dist/v2/overlay-engine.js +150 -0
- package/dist/v2/postcondition.d.ts +16 -0
- package/dist/v2/postcondition.js +249 -0
- package/dist/v2/program-patcher.d.ts +25 -0
- package/dist/v2/program-patcher.js +44 -0
- package/dist/v2/recovery-chain.d.ts +30 -0
- package/dist/v2/recovery-chain.js +368 -0
- package/dist/v2/schema.d.ts +2580 -0
- package/dist/v2/schema.js +295 -0
- package/dist/v2/selector-resolver.d.ts +34 -0
- package/dist/v2/selector-resolver.js +181 -0
- package/dist/v2/semantic-resolver.d.ts +35 -0
- package/dist/v2/semantic-resolver.js +161 -0
- package/dist/v2/smart-wait.d.ts +27 -0
- package/dist/v2/smart-wait.js +81 -0
- package/dist/v2/types.d.ts +444 -0
- package/dist/v2/types.js +19 -0
- package/dist/v2/web-playwright-local.d.ts +69 -0
- package/dist/v2/web-playwright-local.js +392 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/video-agent.js +18 -13
- package/dist/video-planner.js +2 -1
- package/dist/video-prompts.js +3 -3
- package/dist/web-playwright-local.d.ts +126 -0
- package/dist/web-playwright-local.js +819 -0
- package/dist/ws-auth.js +4 -1
- package/dist/ws-broadcast.d.ts +34 -0
- package/dist/ws-broadcast.js +85 -0
- package/dist/ws-connection-limits.d.ts +12 -0
- package/dist/ws-connection-limits.js +44 -0
- package/dist/ws-handler-utils.d.ts +32 -0
- package/dist/ws-handler-utils.js +139 -0
- package/dist/ws-handler.js +294 -164
- package/dist/ws-metrics-server.d.ts +9 -0
- package/dist/ws-metrics-server.js +31 -0
- package/dist/ws-server.js +41 -1
- package/package.json +51 -34
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture Agent — IR Types
|
|
3
|
+
*
|
|
4
|
+
* All types for the compiled execution model:
|
|
5
|
+
* preset (natural language) -> ExecutionProgram (typed IR) -> deterministic runtime
|
|
6
|
+
*/
|
|
7
|
+
/** Sentinel value that resolves to the current variant's locale or theme at runtime */
|
|
8
|
+
export const VARIANT_PLACEHOLDER = '$variant';
|
|
9
|
+
// ── Opcode kinds ────────────────────────────────────────────────────
|
|
10
|
+
export const OPCODE_KINDS = [
|
|
11
|
+
'NAVIGATE',
|
|
12
|
+
'DISMISS_OVERLAYS',
|
|
13
|
+
'ASSERT_ROUTE',
|
|
14
|
+
'ASSERT_SURFACE',
|
|
15
|
+
'CLICK',
|
|
16
|
+
'TYPE',
|
|
17
|
+
'PRESS_KEY',
|
|
18
|
+
'WAIT_FOR',
|
|
19
|
+
'SET_LOCALE',
|
|
20
|
+
'SET_THEME',
|
|
21
|
+
'SCROLL',
|
|
22
|
+
'CAPTURE_SCREENSHOT',
|
|
23
|
+
'CAPTURE_DOM',
|
|
24
|
+
'CAPTURE_FRAGMENT',
|
|
25
|
+
'BEGIN_CLIP',
|
|
26
|
+
'END_CLIP',
|
|
27
|
+
'HOVER',
|
|
28
|
+
'SELECT_OPTION',
|
|
29
|
+
'CHECK',
|
|
30
|
+
'DOUBLE_CLICK',
|
|
31
|
+
'CLONE_ELEMENT',
|
|
32
|
+
'INJECT_MOCK_DATA',
|
|
33
|
+
'REMOVE_ELEMENT',
|
|
34
|
+
'SET_ATTRIBUTE',
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Soft opcodes are non-blocking — if their action or postcondition fails at
|
|
38
|
+
* runtime, the runner returns `status: 'skipped'` instead of aborting the
|
|
39
|
+
* variant. The circuit breaker is not ticked. Used by mock data injection so
|
|
40
|
+
* a missing template selector logs a warning and the capture proceeds.
|
|
41
|
+
*/
|
|
42
|
+
export const SOFT_OPCODE_KINDS = new Set([
|
|
43
|
+
'CLONE_ELEMENT',
|
|
44
|
+
'INJECT_MOCK_DATA',
|
|
45
|
+
'REMOVE_ELEMENT',
|
|
46
|
+
'SET_ATTRIBUTE',
|
|
47
|
+
]);
|
|
48
|
+
export function isSoftOpcodeKind(kind) {
|
|
49
|
+
return SOFT_OPCODE_KINDS.has(kind);
|
|
50
|
+
}
|
|
51
|
+
export const DEFAULT_RECOVERY_POLICY = {
|
|
52
|
+
retries: 2,
|
|
53
|
+
useSelectorMemory: true,
|
|
54
|
+
useAltInteraction: true,
|
|
55
|
+
allowReload: false,
|
|
56
|
+
allowHealer: true,
|
|
57
|
+
};
|
|
58
|
+
// ── Artifact spec ───────────────────────────────────────────────────
|
|
59
|
+
export const MEDIA_MODES = ['screenshot', 'clip', 'dom'];
|
|
60
|
+
export const DEFAULT_CIRCUIT_BREAKER = {
|
|
61
|
+
maxPerOpcode: 3,
|
|
62
|
+
maxPerPage: 5,
|
|
63
|
+
maxPerRun: 10,
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=execution-types.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SF Pro font loader for native SVG mockup rendering.
|
|
3
|
+
*
|
|
4
|
+
* Parses the woff2 base64 data URIs from sf-pro-fonts.ts / sf-pro-symbols.ts
|
|
5
|
+
* with fontkit and caches the parsed Font instances at module level. Used by
|
|
6
|
+
* src/svg-text.ts and the SVG status bar / browser bar generators to render
|
|
7
|
+
* text as native `<path>` elements (no Playwright required).
|
|
8
|
+
*/
|
|
9
|
+
import type { Font } from 'fontkit';
|
|
10
|
+
export type SfFontId = 'text-regular' | 'text-semibold' | 'text-bold' | 'display-regular' | 'display-semibold' | 'display-bold' | 'symbols';
|
|
11
|
+
/** Get a parsed Font instance for the requested SF Pro variant. Cached. */
|
|
12
|
+
export declare function getFont(id: SfFontId): Font;
|
|
13
|
+
/** Resolve an SF font id from a CSS-like family + weight pair. */
|
|
14
|
+
export declare function resolveFontId(family: 'text' | 'display', weight?: number | 'bold' | 'semibold' | 'regular' | 'medium' | 'normal'): SfFontId;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SF Pro font loader for native SVG mockup rendering.
|
|
3
|
+
*
|
|
4
|
+
* Parses the woff2 base64 data URIs from sf-pro-fonts.ts / sf-pro-symbols.ts
|
|
5
|
+
* with fontkit and caches the parsed Font instances at module level. Used by
|
|
6
|
+
* src/svg-text.ts and the SVG status bar / browser bar generators to render
|
|
7
|
+
* text as native `<path>` elements (no Playwright required).
|
|
8
|
+
*/
|
|
9
|
+
import * as fontkit from 'fontkit';
|
|
10
|
+
import { SF_PRO_TEXT_REGULAR, SF_PRO_TEXT_SEMIBOLD, SF_PRO_DISPLAY_REGULAR, SF_PRO_DISPLAY_SEMIBOLD, } from './sf-pro-fonts.js';
|
|
11
|
+
import { SF_PRO_SYMBOLS } from './sf-pro-symbols.js';
|
|
12
|
+
const FONT_DATA = {
|
|
13
|
+
// SF Pro "Bold" maps to "Semibold" in our subset (we don't ship a separate
|
|
14
|
+
// bold weight). Native macOS uses semibold for menu bar app names anyway.
|
|
15
|
+
'text-regular': SF_PRO_TEXT_REGULAR,
|
|
16
|
+
'text-semibold': SF_PRO_TEXT_SEMIBOLD,
|
|
17
|
+
'text-bold': SF_PRO_TEXT_SEMIBOLD,
|
|
18
|
+
'display-regular': SF_PRO_DISPLAY_REGULAR,
|
|
19
|
+
'display-semibold': SF_PRO_DISPLAY_SEMIBOLD,
|
|
20
|
+
'display-bold': SF_PRO_DISPLAY_SEMIBOLD,
|
|
21
|
+
symbols: SF_PRO_SYMBOLS,
|
|
22
|
+
};
|
|
23
|
+
const cache = new Map();
|
|
24
|
+
function dataUriToBuffer(dataUri) {
|
|
25
|
+
const comma = dataUri.indexOf(',');
|
|
26
|
+
if (comma === -1) {
|
|
27
|
+
throw new Error('invalid font data URI');
|
|
28
|
+
}
|
|
29
|
+
const base64 = dataUri.slice(comma + 1);
|
|
30
|
+
return Buffer.from(base64, 'base64');
|
|
31
|
+
}
|
|
32
|
+
/** Get a parsed Font instance for the requested SF Pro variant. Cached. */
|
|
33
|
+
export function getFont(id) {
|
|
34
|
+
const cached = cache.get(id);
|
|
35
|
+
if (cached)
|
|
36
|
+
return cached;
|
|
37
|
+
const buf = dataUriToBuffer(FONT_DATA[id]);
|
|
38
|
+
const parsed = fontkit.create(buf);
|
|
39
|
+
// fontkit.create can return a FontCollection, but our subsets are all
|
|
40
|
+
// single fonts.
|
|
41
|
+
if ('fonts' in parsed) {
|
|
42
|
+
throw new Error(`unexpected font collection for ${id}`);
|
|
43
|
+
}
|
|
44
|
+
cache.set(id, parsed);
|
|
45
|
+
return parsed;
|
|
46
|
+
}
|
|
47
|
+
/** Resolve an SF font id from a CSS-like family + weight pair. */
|
|
48
|
+
export function resolveFontId(family, weight = 400) {
|
|
49
|
+
const isBoldish = weight === 'bold' ||
|
|
50
|
+
weight === 'semibold' ||
|
|
51
|
+
(typeof weight === 'number' && weight >= 600);
|
|
52
|
+
const suffix = isBoldish ? 'semibold' : 'regular';
|
|
53
|
+
return `${family}-${suffix}`;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=fonts-loader.js.map
|
package/dist/hybrid-navigator.js
CHANGED
|
@@ -390,9 +390,9 @@ export function buildNavigationPrompt(resolvedUrl, config) {
|
|
|
390
390
|
'Your tasks:',
|
|
391
391
|
'1. Load the page at the URL above',
|
|
392
392
|
'2. Handle login if credentials are provided',
|
|
393
|
-
'3. Dismiss ALL cookie banners, consent walls, analytics prompts, overlays, and popups — do this BEFORE calling
|
|
393
|
+
'3. Dismiss ALL cookie banners, consent walls, analytics prompts, overlays, and popups — do this BEFORE calling capture',
|
|
394
394
|
'4. Navigate to the specific page/state described below',
|
|
395
|
-
'5. Once the page is clean (no overlays, no spinners, correct page), call
|
|
395
|
+
'5. Once the page is clean (no overlays, no spinners, correct page), call capture',
|
|
396
396
|
];
|
|
397
397
|
if (hasTwoPartPrompt) {
|
|
398
398
|
// Two-part mode: clear separation between navigation goal and what will be recorded.
|
|
@@ -402,13 +402,13 @@ export function buildNavigationPrompt(resolvedUrl, config) {
|
|
|
402
402
|
parts.push('</navigation_goal>');
|
|
403
403
|
parts.push('');
|
|
404
404
|
parts.push('<recording_preview>');
|
|
405
|
-
parts.push(`After you call
|
|
405
|
+
parts.push(`After you call capture, the recording system will perform: ${config.recordingScript}`);
|
|
406
406
|
parts.push('You must NOT perform these recording actions yourself. Your job is ONLY to reach the state where the recording can begin.');
|
|
407
407
|
parts.push('</recording_preview>');
|
|
408
408
|
parts.push('');
|
|
409
409
|
parts.push('Follow the <navigation_goal> instructions exactly. Navigate to the described page/state. ' +
|
|
410
410
|
'Dismiss all overlays and popups along the way. ' +
|
|
411
|
-
'Once you are on the correct page with no obstructions, call
|
|
411
|
+
'Once you are on the correct page with no obstructions, call capture.');
|
|
412
412
|
}
|
|
413
413
|
else if (config.navigationPrompt) {
|
|
414
414
|
// Legacy mode: single script for both navigation and recording.
|
|
@@ -423,15 +423,15 @@ export function buildNavigationPrompt(resolvedUrl, config) {
|
|
|
423
423
|
}
|
|
424
424
|
else {
|
|
425
425
|
parts.push('');
|
|
426
|
-
parts.push('No specific navigation required. Just load the page, dismiss overlays, and call
|
|
426
|
+
parts.push('No specific navigation required. Just load the page, dismiss overlays, and call capture once the exact pre-recording start state is visible.');
|
|
427
427
|
}
|
|
428
428
|
parts.push('');
|
|
429
|
-
parts.push('IMPORTANT — Before calling
|
|
430
|
-
'- Dismiss ALL overlays: cookie banners, analytics prompts, consent walls, feedback widgets, onboarding tooltips.
|
|
429
|
+
parts.push('IMPORTANT — Before calling capture:\n' +
|
|
430
|
+
'- Dismiss ALL overlays: cookie banners, analytics prompts, consent walls, feedback widgets, onboarding tooltips. Tap dismiss/close buttons or press Escape.\n' +
|
|
431
431
|
'- If the URL is /home, /dashboard, /app, or / you are on a GENERIC dashboard, NOT inside a specific project/workspace. ' +
|
|
432
|
-
'Do NOT call
|
|
432
|
+
'Do NOT call capture from a generic dashboard unless explicitly targeting the homepage.\n' +
|
|
433
433
|
'- Check the URL path: it must match the specific entity/page required.\n' +
|
|
434
|
-
'- If you changed language or theme via settings, navigate BACK to the target page before calling
|
|
434
|
+
'- If you changed language or theme via settings, navigate BACK to the target page before calling capture.');
|
|
435
435
|
if (config.credentials) {
|
|
436
436
|
parts.push('');
|
|
437
437
|
parts.push('If the page requires authentication, use the provided credentials to log in.');
|
|
@@ -439,15 +439,15 @@ export function buildNavigationPrompt(resolvedUrl, config) {
|
|
|
439
439
|
if (config.lang) {
|
|
440
440
|
parts.push('');
|
|
441
441
|
parts.push(`<variant_requirement type="language" value="${config.lang}">\n` +
|
|
442
|
-
`The app\'s fixed UI chrome (menus, buttons, labels, navigation) MUST be in "${config.lang}" when you call
|
|
443
|
-
`If the fixed chrome is in a different language, you MUST switch it before calling
|
|
442
|
+
`The app\'s fixed UI chrome (menus, buttons, labels, navigation) MUST be in "${config.lang}" when you call capture.\n` +
|
|
443
|
+
`If the fixed chrome is in a different language, you MUST switch it before calling capture.\n` +
|
|
444
444
|
`Ignore user-generated content (project names, preset names, imported data) that may remain in another language.\n` +
|
|
445
445
|
`</variant_requirement>`);
|
|
446
446
|
}
|
|
447
447
|
if (config.theme) {
|
|
448
448
|
parts.push('');
|
|
449
449
|
parts.push(`<variant_requirement type="theme" value="${config.theme}">\n` +
|
|
450
|
-
`The app MUST be in "${config.theme}" theme when you call
|
|
450
|
+
`The app MUST be in "${config.theme}" theme when you call capture.\n` +
|
|
451
451
|
`If the app has an in-app theme toggle/selector, use it to switch to "${config.theme}" mode.\n` +
|
|
452
452
|
`</variant_requirement>`);
|
|
453
453
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export type { ExecutionProgram, ExecutionOpcode, OpcodeKind, SemanticTarget, PostconditionSpec, PostconditionType, RecoveryPolicy, VariantSpec, PreconditionSpec, ArtifactSpec, MediaMode, CircuitBreakerConfig, HealerPatch, OpcodeResult, OpcodeResultStatus, VariantResult, ArtifactResult, RunResult, RunTelemetry, LLMStepUsage, LLMStepType, RuntimeAdapter, ClickOptions, WaitCondition, RecordingOptions, RecordingResult, HoverOpcode, SelectOptionOpcode, CheckOpcode, DoubleClickOpcode, CloneElementOpcode, InjectMockDataOpcode, RemoveElementOpcode, SetAttributeOpcode, MockDataSlot, MockDataRow, MockDataGroup, } from './execution-types.js';
|
|
2
|
+
export { DEFAULT_RECOVERY_POLICY, DEFAULT_CIRCUIT_BREAKER, VARIANT_PLACEHOLDER, SOFT_OPCODE_KINDS, isSoftOpcodeKind, } from './execution-types.js';
|
|
3
|
+
export { ExecutionProgramSchema, ExecutionOpcodeSchema, parseProgram, parseOpcode, safeParseProgramResult, MockDataSlotSchema, MockDataRowSchema, MockDataGroupSchema, } from './execution-schema.js';
|
|
4
|
+
export { callLLM } from './llm-provider.js';
|
|
5
|
+
export type { LLMProviderConfig, LLMCallResult } from './llm-provider.js';
|
|
6
|
+
export { generateAltText } from './alt-text.js';
|
|
7
|
+
export type { AltTextResult, AltTextContext } from './alt-text.js';
|
|
5
8
|
export { logger, setOnLog, setOnScreenshot, emitScreenshot } from './logger.js';
|
|
6
9
|
export type { LogEntry, LogLevel, OnLogCallback, OnScreenshotCallback } from './logger.js';
|
|
7
10
|
export { applyDeviceFrame, getDeviceFrames, getDeviceFrame, invalidateDeviceConfigCache, resolveDeviceFrameDescriptor, rasterizeDeviceFrame, } from './mockup.js';
|
|
8
11
|
export type { DeviceFrameId, DeviceFrameDefinition, DeviceCategory, MockupOptions, MockupOrientation, ResolvedDeviceFrameDescriptor, } from './mockup.js';
|
|
9
12
|
export { generateStatusBarHtml } from './status-bar.js';
|
|
10
13
|
export { generateBrowserBarHtml } from './browser-bar.js';
|
|
11
|
-
export type { BrowserBarConfig, BrowserBarRenderOptions } from './browser-bar.js';
|
|
14
|
+
export type { BrowserBarConfig, BrowserBarRenderOptions, BrowserBarStyle } from './browser-bar.js';
|
|
12
15
|
export { convertToGif, convertToMp4, ensureFfmpegAvailable, extractThumbnail, getMediaDurationMs, } from './clip-postprocess.js';
|
|
13
16
|
export { evaluateActionSecurity, describeSecurityTarget } from './security.js';
|
|
14
17
|
export type { StatusBarConfig, StatusBarLayout, StatusBarDeviceType, StatusBarRenderOptions } from './status-bar.js';
|
|
15
|
-
export type
|
|
18
|
+
export type { BrowserOptions, BrowserStorageState, BrowserSessionStorageState, AKTree, AKNode, AKType, AKBounds, AKPageState, InteractiveElement, PageState, VideoPageSignals, VideoStep, VideoStepType, VideoPlan, VideoAgentConfig, VideoAgentResult, ClipDefinition, ClipOptions, StepUsage, IsolatedElement, OutscaleConfig, CapturePageIdentity, ValidatedSessionProfile, FocusQuery, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// Playwright-free root entry. The CLI owns Playwright exclusively — import
|
|
2
|
+
// Browser/WebPlaywrightLocal/opcode runner symbols directly via their files
|
|
3
|
+
// (or the `screenshot-agent/browser` subpath for external consumers).
|
|
4
|
+
// Server-side callers must use specific subpaths (ESLint enforces this).
|
|
5
|
+
export { DEFAULT_RECOVERY_POLICY, DEFAULT_CIRCUIT_BREAKER, VARIANT_PLACEHOLDER, SOFT_OPCODE_KINDS, isSoftOpcodeKind, } from './execution-types.js';
|
|
6
|
+
export { ExecutionProgramSchema, ExecutionOpcodeSchema, parseProgram, parseOpcode, safeParseProgramResult, MockDataSlotSchema, MockDataRowSchema, MockDataGroupSchema, } from './execution-schema.js';
|
|
7
|
+
// ── LLM-backed helpers (OpenAI, no browser) ─────────────────────────
|
|
8
|
+
export { callLLM } from './llm-provider.js';
|
|
9
|
+
export { generateAltText } from './alt-text.js';
|
|
10
|
+
// ── Shared utilities ────────────────────────────────────────────────
|
|
5
11
|
export { logger, setOnLog, setOnScreenshot, emitScreenshot } from './logger.js';
|
|
6
12
|
export { applyDeviceFrame, getDeviceFrames, getDeviceFrame, invalidateDeviceConfigCache, resolveDeviceFrameDescriptor, rasterizeDeviceFrame, } from './mockup.js';
|
|
7
13
|
export { generateStatusBarHtml } from './status-bar.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action recovery, guard inference, and login detection utilities for the capture agent.
|
|
3
|
+
* Extracted from agent.ts — these are pure functions with no closure dependencies.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExecutedAction, ActionType } from '../types.js';
|
|
6
|
+
export declare const META_ACTIONS: Set<ActionType>;
|
|
7
|
+
export declare const BOOTSTRAP_ACTIONS: Set<ActionType>;
|
|
8
|
+
export declare const REPLAYABLE_ACTIONS: ReadonlyArray<ActionType>;
|
|
9
|
+
export declare function isNoEffectAction(action: ExecutedAction): boolean;
|
|
10
|
+
export declare function isBootstrapStabilizationAction(action: ExecutedAction): boolean;
|
|
11
|
+
export declare function hasMeaningfulBrowserAction(actionHistory: ExecutedAction[]): boolean;
|
|
12
|
+
export declare function buildRecoveryActionSignature(action: ExecutedAction): string;
|
|
13
|
+
export declare function isExplicitLoginAction(action: ExecutedAction): boolean;
|
|
14
|
+
export declare function hasRecentExplicitLoginAction(previousActions: ExecutedAction[]): boolean;
|
|
15
|
+
export declare function isLoginAction(action: ExecutedAction, previousActions?: ExecutedAction[]): boolean;
|
|
16
|
+
export declare function compactReplayActions(recordedActions: ExecutedAction[], params?: {
|
|
17
|
+
currentUrl?: string;
|
|
18
|
+
targetUrl?: string;
|
|
19
|
+
currentViewport?: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
} | null;
|
|
23
|
+
isAuthenticated?: boolean;
|
|
24
|
+
ignoreRecordedViewport?: boolean;
|
|
25
|
+
}): ExecutedAction[];
|
|
26
|
+
export declare function countRecentNoEffectActions(actionHistory: ExecutedAction[]): number;
|
|
27
|
+
export declare function shouldTriggerRecovery(actionHistory: ExecutedAction[]): boolean;
|
|
28
|
+
export declare function inferPrematureGiveUpCorrection(params: {
|
|
29
|
+
reason: string;
|
|
30
|
+
actionHistory: ExecutedAction[];
|
|
31
|
+
lastVerificationFailure?: string;
|
|
32
|
+
iteration: number;
|
|
33
|
+
maxIterations: number;
|
|
34
|
+
}): string | null;
|
|
35
|
+
export declare function inferSearchScrollLoopGuard(params: {
|
|
36
|
+
actionHistory: ExecutedAction[];
|
|
37
|
+
action: ActionType;
|
|
38
|
+
args: Record<string, unknown>;
|
|
39
|
+
}): string | null;
|
|
40
|
+
export declare function inferRepeatedActionGuard(params: {
|
|
41
|
+
actionHistory: ExecutedAction[];
|
|
42
|
+
action: ActionType;
|
|
43
|
+
args: Record<string, unknown>;
|
|
44
|
+
currentUrl?: string;
|
|
45
|
+
}): string | null;
|