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
package/dist/tools.js
CHANGED
|
@@ -1,114 +1,57 @@
|
|
|
1
1
|
// Note: evaluation_previous_action and memory fields are no longer injected into
|
|
2
2
|
// tool schemas. They are documented in the system prompt instead (see prompts.ts),
|
|
3
|
-
// which saves
|
|
3
|
+
// which saves tokens on every iteration.
|
|
4
|
+
const akTypeEnum = [
|
|
5
|
+
'button', 'input', 'link', 'text', 'image', 'heading',
|
|
6
|
+
'list', 'table', 'container', 'icon', 'toggle', 'select',
|
|
7
|
+
'checkbox', 'radio', 'slider', 'tab', 'modal', 'nav', 'form',
|
|
8
|
+
'video', 'audio', 'iframe',
|
|
9
|
+
];
|
|
10
|
+
const semanticPatternEnum = [
|
|
11
|
+
'cookie-banner', 'modal', 'navbar', 'footer', 'hero',
|
|
12
|
+
'sidebar', 'dropdown', 'toast', 'tooltip', 'form', 'card',
|
|
13
|
+
'pricing-table', 'cta-group',
|
|
14
|
+
];
|
|
15
|
+
const semanticTraitEnum = [
|
|
16
|
+
'floating', 'overlay', 'sticky', 'fixed',
|
|
17
|
+
'above-fold', 'below-fold', 'full-width', 'scrollable',
|
|
18
|
+
];
|
|
4
19
|
export const agentTools = [
|
|
5
20
|
{
|
|
6
21
|
type: 'function',
|
|
7
22
|
function: {
|
|
8
|
-
name: '
|
|
9
|
-
description: 'Click
|
|
23
|
+
name: 'tap',
|
|
24
|
+
description: 'Click an element identified by its AKTree nodeId.',
|
|
10
25
|
parameters: {
|
|
11
26
|
type: 'object',
|
|
12
27
|
properties: {
|
|
13
|
-
|
|
14
|
-
type: 'string',
|
|
15
|
-
description: 'Brief reason.',
|
|
16
|
-
},
|
|
17
|
-
index: {
|
|
18
|
-
type: 'number',
|
|
19
|
-
description: 'Element badge index [N].',
|
|
20
|
-
},
|
|
21
|
-
selector: {
|
|
28
|
+
nodeId: {
|
|
22
29
|
type: 'string',
|
|
23
|
-
description: '
|
|
24
|
-
},
|
|
25
|
-
x: {
|
|
26
|
-
type: 'number',
|
|
27
|
-
description: 'X coordinate (viewport pixels). Last resort.',
|
|
28
|
-
},
|
|
29
|
-
y: {
|
|
30
|
-
type: 'number',
|
|
31
|
-
description: 'Y coordinate (viewport pixels). Last resort.',
|
|
32
|
-
},
|
|
33
|
-
hover_only: {
|
|
34
|
-
type: 'boolean',
|
|
35
|
-
description: 'If true, hover without clicking. Use to reveal dropdown menus, tooltips, mega-navs, or account popovers.',
|
|
30
|
+
description: 'Stable AKTree node id, for example "ak_3f8a2c1b".',
|
|
36
31
|
},
|
|
37
32
|
},
|
|
38
|
-
required: ['
|
|
39
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
33
|
+
required: ['nodeId'],
|
|
40
34
|
},
|
|
41
35
|
},
|
|
42
36
|
},
|
|
43
37
|
{
|
|
44
38
|
type: 'function',
|
|
45
39
|
function: {
|
|
46
|
-
name: '
|
|
47
|
-
description: 'Type text into
|
|
40
|
+
name: 'type',
|
|
41
|
+
description: 'Type text into a text-like control identified by AKTree nodeId.',
|
|
48
42
|
parameters: {
|
|
49
43
|
type: 'object',
|
|
50
44
|
properties: {
|
|
51
|
-
|
|
45
|
+
nodeId: {
|
|
52
46
|
type: 'string',
|
|
53
|
-
description: '
|
|
47
|
+
description: 'Stable AKTree node id of the target input.',
|
|
54
48
|
},
|
|
55
49
|
text: {
|
|
56
50
|
type: 'string',
|
|
57
|
-
description: 'Text to type.
|
|
58
|
-
},
|
|
59
|
-
index: {
|
|
60
|
-
type: 'number',
|
|
61
|
-
description: 'Index of the input element to type into.',
|
|
62
|
-
},
|
|
63
|
-
selector: {
|
|
64
|
-
type: 'string',
|
|
65
|
-
description: 'CSS selector of the input element.',
|
|
66
|
-
},
|
|
67
|
-
clearFirst: {
|
|
68
|
-
type: 'boolean',
|
|
69
|
-
description: 'Clear the input before typing. Default false.',
|
|
51
|
+
description: 'Text to type. Use credential placeholders when available.',
|
|
70
52
|
},
|
|
71
53
|
},
|
|
72
|
-
required: ['
|
|
73
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
type: 'function',
|
|
79
|
-
function: {
|
|
80
|
-
name: 'select_option',
|
|
81
|
-
description: 'Change a native select/dropdown value (sort, filter, language, theme).',
|
|
82
|
-
parameters: {
|
|
83
|
-
type: 'object',
|
|
84
|
-
properties: {
|
|
85
|
-
reason: {
|
|
86
|
-
type: 'string',
|
|
87
|
-
description: 'Brief reason.',
|
|
88
|
-
},
|
|
89
|
-
index: {
|
|
90
|
-
type: 'number',
|
|
91
|
-
description: 'Element badge index [N].',
|
|
92
|
-
},
|
|
93
|
-
selector: {
|
|
94
|
-
type: 'string',
|
|
95
|
-
description: 'CSS selector. Use only when index is unavailable.',
|
|
96
|
-
},
|
|
97
|
-
optionLabel: {
|
|
98
|
-
type: 'string',
|
|
99
|
-
description: 'Visible label of the option to choose.',
|
|
100
|
-
},
|
|
101
|
-
optionValue: {
|
|
102
|
-
type: 'string',
|
|
103
|
-
description: 'Underlying option value to choose.',
|
|
104
|
-
},
|
|
105
|
-
optionIndex: {
|
|
106
|
-
type: 'number',
|
|
107
|
-
description: 'Zero-based option index to choose if label/value are unavailable.',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
required: ['reason'],
|
|
111
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
54
|
+
required: ['nodeId', 'text'],
|
|
112
55
|
},
|
|
113
56
|
},
|
|
114
57
|
},
|
|
@@ -116,123 +59,80 @@ export const agentTools = [
|
|
|
116
59
|
type: 'function',
|
|
117
60
|
function: {
|
|
118
61
|
name: 'scroll',
|
|
119
|
-
description: 'Scroll the page or
|
|
62
|
+
description: 'Scroll the page or a scrollable AKTree container. Use direction/offset for manual scrolling, or centerOn to center another AKTree node inside the page or container.',
|
|
120
63
|
parameters: {
|
|
121
64
|
type: 'object',
|
|
122
65
|
properties: {
|
|
123
|
-
reason: {
|
|
124
|
-
type: 'string',
|
|
125
|
-
description: 'Brief reason.',
|
|
126
|
-
},
|
|
127
66
|
direction: {
|
|
128
67
|
type: 'string',
|
|
129
68
|
enum: ['up', 'down', 'left', 'right'],
|
|
130
|
-
description: 'Scroll direction.
|
|
131
|
-
},
|
|
132
|
-
amount: {
|
|
133
|
-
type: 'number',
|
|
134
|
-
description: 'Pixels to scroll. Default 500.',
|
|
135
|
-
},
|
|
136
|
-
selector: {
|
|
137
|
-
type: 'string',
|
|
138
|
-
description: 'CSS selector of a scrollable container. Omit for page scroll.',
|
|
69
|
+
description: 'Scroll direction for manual scrolling. Optional when centerOn is provided.',
|
|
139
70
|
},
|
|
140
|
-
|
|
71
|
+
offset: {
|
|
141
72
|
type: 'number',
|
|
142
|
-
description: '
|
|
73
|
+
description: 'Optional scroll offset in pixels for manual scrolling, or bias in pixels from perfect center when centerOn is provided.',
|
|
143
74
|
},
|
|
144
|
-
|
|
75
|
+
target: {
|
|
145
76
|
type: 'string',
|
|
146
|
-
|
|
147
|
-
description: 'Where to place the element when using index. Default: center.',
|
|
77
|
+
description: 'Optional AKTree node id of a scrollable container. Omit to scroll the page.',
|
|
148
78
|
},
|
|
149
|
-
|
|
150
|
-
required: ['reason'],
|
|
151
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
type: 'function',
|
|
157
|
-
function: {
|
|
158
|
-
name: 'press_key',
|
|
159
|
-
description: 'Press a key or combination. Examples: "Escape", "Enter", "Tab", "ArrowDown".',
|
|
160
|
-
parameters: {
|
|
161
|
-
type: 'object',
|
|
162
|
-
properties: {
|
|
163
|
-
reason: {
|
|
164
|
-
type: 'string',
|
|
165
|
-
description: 'Brief reason.',
|
|
166
|
-
},
|
|
167
|
-
key: {
|
|
79
|
+
centerOn: {
|
|
168
80
|
type: 'string',
|
|
169
|
-
description: '
|
|
81
|
+
description: 'Optional AKTree node id to bring to the center of the page or of the target container.',
|
|
170
82
|
},
|
|
171
83
|
},
|
|
172
|
-
required: [
|
|
173
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
84
|
+
required: [],
|
|
174
85
|
},
|
|
175
86
|
},
|
|
176
87
|
},
|
|
177
88
|
{
|
|
178
89
|
type: 'function',
|
|
179
90
|
function: {
|
|
180
|
-
name: '
|
|
181
|
-
description: '
|
|
91
|
+
name: 'navigate_to',
|
|
92
|
+
description: 'Navigate directly to a URL on the current site when that is the fastest deterministic way to reach the target.',
|
|
182
93
|
parameters: {
|
|
183
94
|
type: 'object',
|
|
184
95
|
properties: {
|
|
185
|
-
|
|
96
|
+
url: {
|
|
186
97
|
type: 'string',
|
|
187
|
-
description: '
|
|
98
|
+
description: 'Absolute or site-relative URL to navigate to.',
|
|
188
99
|
},
|
|
189
100
|
},
|
|
190
|
-
required: ['
|
|
191
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
101
|
+
required: ['url'],
|
|
192
102
|
},
|
|
193
103
|
},
|
|
194
104
|
},
|
|
195
105
|
{
|
|
196
106
|
type: 'function',
|
|
197
107
|
function: {
|
|
198
|
-
name: '
|
|
199
|
-
description: '
|
|
108
|
+
name: 'press_key',
|
|
109
|
+
description: 'Press a keyboard key when the workflow requires Escape, Enter, Tab, or arrow keys.',
|
|
200
110
|
parameters: {
|
|
201
111
|
type: 'object',
|
|
202
112
|
properties: {
|
|
203
|
-
|
|
113
|
+
key: {
|
|
204
114
|
type: 'string',
|
|
205
|
-
description: '
|
|
206
|
-
},
|
|
207
|
-
milliseconds: {
|
|
208
|
-
type: 'number',
|
|
209
|
-
description: 'Wait duration in ms. Default 1000, max 5000.',
|
|
115
|
+
description: 'Keyboard key name, for example "Escape", "Enter", "Tab", "ArrowDown".',
|
|
210
116
|
},
|
|
211
117
|
},
|
|
212
|
-
required: ['
|
|
213
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
118
|
+
required: ['key'],
|
|
214
119
|
},
|
|
215
120
|
},
|
|
216
121
|
},
|
|
217
122
|
{
|
|
218
123
|
type: 'function',
|
|
219
124
|
function: {
|
|
220
|
-
name: '
|
|
221
|
-
description: '
|
|
125
|
+
name: 'capture',
|
|
126
|
+
description: 'Capture the current target and end the current run. When nodeId is provided, crop to that node bounds.',
|
|
222
127
|
parameters: {
|
|
223
128
|
type: 'object',
|
|
224
129
|
properties: {
|
|
225
|
-
|
|
226
|
-
type: 'string',
|
|
227
|
-
description: 'Brief reason.',
|
|
228
|
-
},
|
|
229
|
-
query: {
|
|
130
|
+
nodeId: {
|
|
230
131
|
type: 'string',
|
|
231
|
-
description: '
|
|
132
|
+
description: 'Optional AKTree node id to crop. Omit for a page-level capture.',
|
|
232
133
|
},
|
|
233
134
|
},
|
|
234
|
-
required: [
|
|
235
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
135
|
+
required: [],
|
|
236
136
|
},
|
|
237
137
|
},
|
|
238
138
|
},
|
|
@@ -240,339 +140,77 @@ export const agentTools = [
|
|
|
240
140
|
type: 'function',
|
|
241
141
|
function: {
|
|
242
142
|
name: 'analyze_screenshot',
|
|
243
|
-
description: '
|
|
244
|
-
parameters: {
|
|
245
|
-
type: 'object',
|
|
246
|
-
properties: {
|
|
247
|
-
reason: {
|
|
248
|
-
type: 'string',
|
|
249
|
-
description: 'Why visual analysis is needed (e.g., "check theme colors", "verify no overlay blocking content").',
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
required: ['reason'],
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
type: 'function',
|
|
258
|
-
function: {
|
|
259
|
-
name: 'navigate_to',
|
|
260
|
-
description: 'Navigate to a URL. Page fully loads before continuing.',
|
|
261
|
-
parameters: {
|
|
262
|
-
type: 'object',
|
|
263
|
-
properties: {
|
|
264
|
-
reason: {
|
|
265
|
-
type: 'string',
|
|
266
|
-
description: 'Brief reason.',
|
|
267
|
-
},
|
|
268
|
-
url: {
|
|
269
|
-
type: 'string',
|
|
270
|
-
description: 'The full URL to navigate to.',
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
required: ['reason', 'url'],
|
|
274
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
type: 'function',
|
|
280
|
-
function: {
|
|
281
|
-
name: 'resize_viewport',
|
|
282
|
-
description: 'Resize viewport (desktop/tablet/mobile). Wait after resizing for layout to settle.',
|
|
143
|
+
description: 'Ask the vision model a targeted question about the current screenshot when AKTree structure is insufficient.',
|
|
283
144
|
parameters: {
|
|
284
145
|
type: 'object',
|
|
285
146
|
properties: {
|
|
286
|
-
|
|
147
|
+
question: {
|
|
287
148
|
type: 'string',
|
|
288
|
-
description: '
|
|
289
|
-
},
|
|
290
|
-
width: {
|
|
291
|
-
type: 'number',
|
|
292
|
-
description: 'Width in px (e.g. 1440 desktop, 768 tablet, 375 mobile).',
|
|
293
|
-
},
|
|
294
|
-
height: {
|
|
295
|
-
type: 'number',
|
|
296
|
-
description: 'Height in px (e.g. 900 desktop, 1024 tablet, 812 mobile).',
|
|
149
|
+
description: 'Specific visual question to answer, for example "Is a modal blocking the page?" or "Does this dialog already show the target template selected?"',
|
|
297
150
|
},
|
|
298
151
|
},
|
|
299
|
-
required: ['
|
|
300
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
152
|
+
required: ['question'],
|
|
301
153
|
},
|
|
302
154
|
},
|
|
303
155
|
},
|
|
304
156
|
{
|
|
305
157
|
type: 'function',
|
|
306
158
|
function: {
|
|
307
|
-
name: '
|
|
308
|
-
description: '
|
|
159
|
+
name: 'focus',
|
|
160
|
+
description: 'Return a filtered AKTree view using typed filters only.',
|
|
309
161
|
parameters: {
|
|
310
162
|
type: 'object',
|
|
311
163
|
properties: {
|
|
312
|
-
|
|
313
|
-
type: '
|
|
314
|
-
|
|
164
|
+
type: {
|
|
165
|
+
type: 'array',
|
|
166
|
+
items: { type: 'string', enum: [...akTypeEnum] },
|
|
167
|
+
description: 'Optional node types to keep.',
|
|
315
168
|
},
|
|
316
|
-
|
|
317
|
-
type: '
|
|
318
|
-
|
|
169
|
+
semantic: {
|
|
170
|
+
type: 'array',
|
|
171
|
+
items: { type: 'string', enum: [...semanticPatternEnum] },
|
|
172
|
+
description: 'Optional semantic patterns to keep.',
|
|
319
173
|
},
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
type: 'function',
|
|
328
|
-
function: {
|
|
329
|
-
name: 'ready_to_capture',
|
|
330
|
-
description: 'Signal the ENTIRE workflow is complete and capture the final screenshot — ends the session. Use take_screenshot for intermediate captures. Set force=true only if the blocking dialog IS the intended capture target.',
|
|
331
|
-
parameters: {
|
|
332
|
-
type: 'object',
|
|
333
|
-
properties: {
|
|
334
|
-
assessment: {
|
|
335
|
-
type: 'string',
|
|
336
|
-
description: 'Why the workflow is complete and the page is ready.',
|
|
174
|
+
trait: {
|
|
175
|
+
type: 'array',
|
|
176
|
+
items: { type: 'string', enum: [...semanticTraitEnum] },
|
|
177
|
+
description: 'Optional semantic traits to keep.',
|
|
337
178
|
},
|
|
338
|
-
|
|
179
|
+
interactive: {
|
|
339
180
|
type: 'boolean',
|
|
340
|
-
description: '
|
|
181
|
+
description: 'Optional interactive filter.',
|
|
341
182
|
},
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
type: 'function',
|
|
350
|
-
function: {
|
|
351
|
-
name: 'give_up',
|
|
352
|
-
description: 'Signal that the requested screenshot cannot be achieved. Use when: login required, content missing, or stuck in a loop.',
|
|
353
|
-
parameters: {
|
|
354
|
-
type: 'object',
|
|
355
|
-
properties: {
|
|
356
|
-
reason: {
|
|
357
|
-
type: 'string',
|
|
358
|
-
description: 'Explanation of why capture cannot be completed.',
|
|
183
|
+
visible: {
|
|
184
|
+
type: 'boolean',
|
|
185
|
+
description: 'Optional visibility filter.',
|
|
359
186
|
},
|
|
360
|
-
|
|
361
|
-
required: ['reason'],
|
|
362
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
363
|
-
},
|
|
364
|
-
},
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
type: 'function',
|
|
368
|
-
function: {
|
|
369
|
-
name: 'begin_subgoal',
|
|
370
|
-
description: 'Declare a new sub-objective. Archives previous notes and resets working memory. Use at natural workflow boundaries: after login, before language/theme change, before new section, before final capture.',
|
|
371
|
-
parameters: {
|
|
372
|
-
type: 'object',
|
|
373
|
-
properties: {
|
|
374
|
-
name: {
|
|
187
|
+
within: {
|
|
375
188
|
type: 'string',
|
|
376
|
-
description: '
|
|
189
|
+
description: 'Optional AKTree node id used as subtree scope.',
|
|
377
190
|
},
|
|
378
|
-
|
|
191
|
+
labelContains: {
|
|
379
192
|
type: 'string',
|
|
380
|
-
description: '
|
|
193
|
+
description: 'Case-insensitive substring match against node labels.',
|
|
381
194
|
},
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
},
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
type: 'function',
|
|
390
|
-
function: {
|
|
391
|
-
name: 'note',
|
|
392
|
-
description: 'Store a key observation or fact to remember across iterations. Use when you discover important information (element locations, page state, multi-step findings) that you will need in later iterations.',
|
|
393
|
-
parameters: {
|
|
394
|
-
type: 'object',
|
|
395
|
-
properties: {
|
|
396
|
-
reason: {
|
|
397
|
-
type: 'string',
|
|
398
|
-
description: 'Short label for this note (snake_case, max 6 tokens).',
|
|
195
|
+
maxDepth: {
|
|
196
|
+
type: 'number',
|
|
197
|
+
description: 'Optional maximum subtree depth.',
|
|
399
198
|
},
|
|
400
|
-
|
|
401
|
-
type: '
|
|
402
|
-
description: '
|
|
199
|
+
includeAncestors: {
|
|
200
|
+
type: 'boolean',
|
|
201
|
+
description: 'Include parent path to the root when true.',
|
|
403
202
|
},
|
|
404
203
|
},
|
|
405
|
-
required: [
|
|
406
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
204
|
+
required: [],
|
|
407
205
|
},
|
|
408
206
|
},
|
|
409
207
|
},
|
|
410
208
|
];
|
|
411
209
|
/** Restricted tool set for the element capture mini-agent */
|
|
412
210
|
export const elementCaptureTools = [
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
description: 'Capture a screenshot of a page element or component identified by a unique CSS selector. ' +
|
|
418
|
-
'Works for both single interactive elements (buttons, inputs) and full components or sections ' +
|
|
419
|
-
'(navigation bars, forms, pricing tables, hero sections). ' +
|
|
420
|
-
'The selector MUST match exactly one visible element — the system validates this before capturing. ' +
|
|
421
|
-
'Resolve the selector using this priority order: ' +
|
|
422
|
-
'1) [data-testid="..."] or [data-component="..."] — most stable; ' +
|
|
423
|
-
'2) ARIA landmark with label: nav[aria-label="Main"], [role="dialog"]; ' +
|
|
424
|
-
'3) Unique ID: #hero-section, #pricing-table; ' +
|
|
425
|
-
'4) Semantic class on a semantic element: form.login-form, section.pricing, nav.main-nav; ' +
|
|
426
|
-
'5) DOM path as last resort: header > .site-logo. ' +
|
|
427
|
-
'If the system returns a validation error (no match, ambiguous, invisible), read the reason and retry with a refined selector. ' +
|
|
428
|
-
'Use the sel="" values shown in the interactive elements list as starting points for selector construction. ' +
|
|
429
|
-
'If a previous capture was rejected only because the crop was too loose, stay grounded on sel="" values returned by the tools and prefer any search_text container selector instead of inventing a tag-only DOM path from the simplified DOM.',
|
|
430
|
-
parameters: {
|
|
431
|
-
type: 'object',
|
|
432
|
-
properties: {
|
|
433
|
-
selector: {
|
|
434
|
-
type: 'string',
|
|
435
|
-
description: 'A unique CSS selector matching exactly one visible element. ' +
|
|
436
|
-
'Examples: [data-testid="pricing-card"], #hero-section, nav[aria-label="Main navigation"], ' +
|
|
437
|
-
'.pricing-table, form.login-form, header > .navbar',
|
|
438
|
-
},
|
|
439
|
-
confidence: {
|
|
440
|
-
type: 'number',
|
|
441
|
-
description: 'How confident you are this selector matches the correct element (0.0 to 1.0).',
|
|
442
|
-
},
|
|
443
|
-
reasoning: {
|
|
444
|
-
type: 'string',
|
|
445
|
-
description: 'Brief explanation of why this selector was chosen and what it should match.',
|
|
446
|
-
},
|
|
447
|
-
},
|
|
448
|
-
required: ['selector', 'confidence', 'reasoning'],
|
|
449
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
450
|
-
},
|
|
451
|
-
},
|
|
452
|
-
},
|
|
453
|
-
{
|
|
454
|
-
type: 'function',
|
|
455
|
-
function: {
|
|
456
|
-
name: 'scroll',
|
|
457
|
-
description: 'Scroll the page to reveal off-screen elements. Provide index to snap a known interactive element into view (preferred). Provide direction+amount for general scrolling.',
|
|
458
|
-
parameters: {
|
|
459
|
-
type: 'object',
|
|
460
|
-
properties: {
|
|
461
|
-
reason: {
|
|
462
|
-
type: 'string',
|
|
463
|
-
description: 'Brief explanation of why you are scrolling.',
|
|
464
|
-
},
|
|
465
|
-
direction: {
|
|
466
|
-
type: 'string',
|
|
467
|
-
enum: ['up', 'down'],
|
|
468
|
-
description: 'Scroll direction. Required unless using index.',
|
|
469
|
-
},
|
|
470
|
-
amount: {
|
|
471
|
-
type: 'number',
|
|
472
|
-
description: 'Pixels to scroll. Default 500.',
|
|
473
|
-
},
|
|
474
|
-
index: {
|
|
475
|
-
type: 'number',
|
|
476
|
-
description: 'Index of an interactive element to scroll into view. When provided, direction/amount are ignored.',
|
|
477
|
-
},
|
|
478
|
-
align: {
|
|
479
|
-
type: 'string',
|
|
480
|
-
enum: ['start', 'center', 'end'],
|
|
481
|
-
description: 'Alignment when using index. Default: center.',
|
|
482
|
-
},
|
|
483
|
-
},
|
|
484
|
-
required: ['reason'],
|
|
485
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
486
|
-
},
|
|
487
|
-
},
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
type: 'function',
|
|
491
|
-
function: {
|
|
492
|
-
name: 'dismiss_overlays',
|
|
493
|
-
description: 'Dismiss cookie banners and hide common sticky overlays/widgets before capturing an element.',
|
|
494
|
-
parameters: {
|
|
495
|
-
type: 'object',
|
|
496
|
-
properties: {
|
|
497
|
-
reason: {
|
|
498
|
-
type: 'string',
|
|
499
|
-
description: 'Brief explanation of why you are dismissing overlays.',
|
|
500
|
-
},
|
|
501
|
-
},
|
|
502
|
-
required: ['reason'],
|
|
503
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
504
|
-
},
|
|
505
|
-
},
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
type: 'function',
|
|
509
|
-
function: {
|
|
510
|
-
name: 'search_text',
|
|
511
|
-
description: 'Search the entire page DOM for elements containing specific text. ' +
|
|
512
|
-
'Returns matching elements with tag, text, position, size, and a sel="..." CSS selector. ' +
|
|
513
|
-
'Use the sel= value directly in capture_by_selector — no need to scroll first.',
|
|
514
|
-
parameters: {
|
|
515
|
-
type: 'object',
|
|
516
|
-
properties: {
|
|
517
|
-
reason: {
|
|
518
|
-
type: 'string',
|
|
519
|
-
description: 'Brief explanation of why you are searching for this text.',
|
|
520
|
-
},
|
|
521
|
-
query: {
|
|
522
|
-
type: 'string',
|
|
523
|
-
description: 'Text to search for (case-insensitive partial match).',
|
|
524
|
-
},
|
|
525
|
-
},
|
|
526
|
-
required: ['reason', 'query'],
|
|
527
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
528
|
-
},
|
|
529
|
-
},
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
type: 'function',
|
|
533
|
-
function: {
|
|
534
|
-
name: 'resize_viewport',
|
|
535
|
-
description: 'Resize the browser viewport. Use this when the target component is taller or wider than the current viewport ' +
|
|
536
|
-
'and you need to see or capture it in full. After resizing, the page re-renders and you get an updated screenshot ' +
|
|
537
|
-
'on the next iteration. The viewport will be restored to its original size after capture.',
|
|
538
|
-
parameters: {
|
|
539
|
-
type: 'object',
|
|
540
|
-
properties: {
|
|
541
|
-
reason: {
|
|
542
|
-
type: 'string',
|
|
543
|
-
description: 'Brief explanation of why you are resizing the viewport.',
|
|
544
|
-
},
|
|
545
|
-
width: {
|
|
546
|
-
type: 'number',
|
|
547
|
-
description: 'New viewport width in CSS pixels.',
|
|
548
|
-
},
|
|
549
|
-
height: {
|
|
550
|
-
type: 'number',
|
|
551
|
-
description: 'New viewport height in CSS pixels.',
|
|
552
|
-
},
|
|
553
|
-
},
|
|
554
|
-
required: ['reason', 'width', 'height'],
|
|
555
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
556
|
-
},
|
|
557
|
-
},
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
type: 'function',
|
|
561
|
-
function: {
|
|
562
|
-
name: 'give_up',
|
|
563
|
-
description: 'Signal that the described element cannot be found on the page.',
|
|
564
|
-
parameters: {
|
|
565
|
-
type: 'object',
|
|
566
|
-
properties: {
|
|
567
|
-
reason: {
|
|
568
|
-
type: 'string',
|
|
569
|
-
description: 'Explanation of why the element cannot be found.',
|
|
570
|
-
},
|
|
571
|
-
},
|
|
572
|
-
required: ['reason'],
|
|
573
|
-
// NOTE: additionalProperties omitted — strict schema validation can cause tool parsing failures on some models
|
|
574
|
-
},
|
|
575
|
-
},
|
|
576
|
-
},
|
|
211
|
+
agentTools[7],
|
|
212
|
+
agentTools[2],
|
|
213
|
+
agentTools[6],
|
|
214
|
+
agentTools[5],
|
|
577
215
|
];
|
|
578
216
|
//# sourceMappingURL=tools.js.map
|