@refrainai/cli 0.4.1 → 0.4.3
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/{ai-model-FM6GWCID.js → ai-model-DP5PKGM6.js} +2 -2
- package/dist/{chunk-IGFCYKHC.js → chunk-5CKPPEYP.js} +262 -305
- package/dist/chunk-5CKPPEYP.js.map +1 -0
- package/dist/{chunk-7UCVPKD4.js → chunk-6FGCPMBU.js} +34 -74
- package/dist/chunk-6FGCPMBU.js.map +1 -0
- package/dist/{chunk-2BVDAJZT.js → chunk-A5X2VF5G.js} +9 -6
- package/dist/chunk-A5X2VF5G.js.map +1 -0
- package/dist/{chunk-H47NWH7N.js → chunk-AOCGSFRM.js} +611 -73
- package/dist/chunk-AOCGSFRM.js.map +1 -0
- package/dist/{chunk-CLYJHKPY.js → chunk-CMWLFQXD.js} +43 -42
- package/dist/chunk-CMWLFQXD.js.map +1 -0
- package/dist/chunk-GC7I5SGK.js +1146 -0
- package/dist/chunk-GC7I5SGK.js.map +1 -0
- package/dist/{chunk-WEYR56ZN.js → chunk-HHRHHFSK.js} +4 -4
- package/dist/chunk-IGJNT457.js +30 -0
- package/dist/chunk-IGJNT457.js.map +1 -0
- package/dist/{chunk-UGPXCQY3.js → chunk-KFNW4XR2.js} +13 -4
- package/dist/chunk-KFNW4XR2.js.map +1 -0
- package/dist/{chunk-RT664YIO.js → chunk-LZDZGI4M.js} +3 -1
- package/dist/chunk-LZDZGI4M.js.map +1 -0
- package/dist/{chunk-RYIJPYM3.js → chunk-MYITSQYV.js} +25 -8
- package/dist/chunk-MYITSQYV.js.map +1 -0
- package/dist/chunk-NRKZJVPE.js +74 -0
- package/dist/chunk-NRKZJVPE.js.map +1 -0
- package/dist/chunk-RBZK7T76.js +349 -0
- package/dist/chunk-RBZK7T76.js.map +1 -0
- package/dist/{chunk-HQDXLWAY.js → chunk-SDV3X5UN.js} +2 -2
- package/dist/{chunk-Z33FCOTZ.js → chunk-VVXNFUPL.js} +4 -2
- package/dist/chunk-VVXNFUPL.js.map +1 -0
- package/dist/chunk-YTVEYQGA.js +64 -0
- package/dist/chunk-YTVEYQGA.js.map +1 -0
- package/dist/{chunk-DJVUITRB.js → chunk-ZEBQWBEU.js} +898 -1135
- package/dist/chunk-ZEBQWBEU.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{compose-MTSIJY5D.js → compose-AVX5RU67.js} +9 -7
- package/dist/{compose-MTSIJY5D.js.map → compose-AVX5RU67.js.map} +1 -1
- package/dist/extraction-prompt-VDCKIFLB.js +17 -0
- package/dist/extraction-prompt-VDCKIFLB.js.map +1 -0
- package/dist/{fix-runbook-ZSBOTLC2.js → fix-runbook-6L5ZMA5G.js} +12 -10
- package/dist/{fix-runbook-ZSBOTLC2.js.map → fix-runbook-6L5ZMA5G.js.map} +1 -1
- package/dist/prompts-AGUYYIOM.js +13 -0
- package/dist/runbook-builder-2ZLE2AEO.js +11 -0
- package/dist/{runbook-data-helpers-KRR2SH76.js → runbook-data-helpers-5UAO65TZ.js} +3 -3
- package/dist/{runbook-executor-K7T6RJWJ.js → runbook-executor-OJXJTN6A.js} +41 -444
- package/dist/runbook-executor-OJXJTN6A.js.map +1 -0
- package/dist/{runbook-generator-MPXJBQ5N.js → runbook-generator-UIHWBEYC.js} +61 -136
- package/dist/runbook-generator-UIHWBEYC.js.map +1 -0
- package/dist/{runbook-schema-3T6TP3JJ.js → runbook-schema-X7DW725O.js} +2 -2
- package/dist/runbook-store-S24PXIHD.js +11 -0
- package/dist/{schema-5G6UQSPT.js → schema-XFSD5EWN.js} +2 -2
- package/dist/{server-AG3LXQBI.js → server-MULT5ZWG.js} +1176 -128
- package/dist/server-MULT5ZWG.js.map +1 -0
- package/dist/{tenant-ai-config-QPFEJUVJ.js → tenant-ai-config-4NHKRW7O.js} +4 -4
- package/dist/tenant-ai-config-4NHKRW7O.js.map +1 -0
- package/dist/yaml-patcher-GOCLYKZZ.js +18 -0
- package/dist/yaml-patcher-GOCLYKZZ.js.map +1 -0
- package/package.json +3 -2
- package/dist/chunk-2BVDAJZT.js.map +0 -1
- package/dist/chunk-7UCVPKD4.js.map +0 -1
- package/dist/chunk-CLYJHKPY.js.map +0 -1
- package/dist/chunk-DJVUITRB.js.map +0 -1
- package/dist/chunk-H47NWH7N.js.map +0 -1
- package/dist/chunk-IGFCYKHC.js.map +0 -1
- package/dist/chunk-RT664YIO.js.map +0 -1
- package/dist/chunk-RYIJPYM3.js.map +0 -1
- package/dist/chunk-UGPXCQY3.js.map +0 -1
- package/dist/chunk-VPK2MQAZ.js +0 -589
- package/dist/chunk-VPK2MQAZ.js.map +0 -1
- package/dist/chunk-Z33FCOTZ.js.map +0 -1
- package/dist/runbook-executor-K7T6RJWJ.js.map +0 -1
- package/dist/runbook-generator-MPXJBQ5N.js.map +0 -1
- package/dist/runbook-store-G5GUOWRR.js +0 -11
- package/dist/server-AG3LXQBI.js.map +0 -1
- package/dist/yaml-patcher-VGUS2JGH.js +0 -15
- /package/dist/{ai-model-FM6GWCID.js.map → ai-model-DP5PKGM6.js.map} +0 -0
- /package/dist/{chunk-WEYR56ZN.js.map → chunk-HHRHHFSK.js.map} +0 -0
- /package/dist/{chunk-HQDXLWAY.js.map → chunk-SDV3X5UN.js.map} +0 -0
- /package/dist/{runbook-data-helpers-KRR2SH76.js.map → prompts-AGUYYIOM.js.map} +0 -0
- /package/dist/{runbook-schema-3T6TP3JJ.js.map → runbook-builder-2ZLE2AEO.js.map} +0 -0
- /package/dist/{runbook-store-G5GUOWRR.js.map → runbook-data-helpers-5UAO65TZ.js.map} +0 -0
- /package/dist/{schema-5G6UQSPT.js.map → runbook-schema-X7DW725O.js.map} +0 -0
- /package/dist/{tenant-ai-config-QPFEJUVJ.js.map → runbook-store-S24PXIHD.js.map} +0 -0
- /package/dist/{yaml-patcher-VGUS2JGH.js.map → schema-XFSD5EWN.js.map} +0 -0
|
@@ -0,0 +1,1146 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getLocale
|
|
4
|
+
} from "./chunk-6FGCPMBU.js";
|
|
5
|
+
|
|
6
|
+
// src/i18n/prompts/en/exploration.ts
|
|
7
|
+
var COMMAND_SCHEMA = `### Basic Operations
|
|
8
|
+
- \`click\`: Click element by selector
|
|
9
|
+
- \`fill\`: Fill value in selector (clears existing value)
|
|
10
|
+
- \`type\`: Type value into selector character by character
|
|
11
|
+
- \`select\`: Select value from dropdown by selector
|
|
12
|
+
- \`check\` / \`uncheck\`: Toggle checkbox by selector
|
|
13
|
+
|
|
14
|
+
### Navigation
|
|
15
|
+
- \`navigate\`: Navigate to URL in value (only URLs explicitly stated in goal/context; use click for page links)
|
|
16
|
+
- \`wait\`: Wait for value ms
|
|
17
|
+
- \`scroll\`: value: "up"|"down"|"left"|"right"
|
|
18
|
+
|
|
19
|
+
### Data Extraction
|
|
20
|
+
- \`extract\`: Extract data via script (JS) or extractPrompt (AI). Result in extractedData
|
|
21
|
+
- **script MUST be wrapped in IIFE \`(()=>{...})()\`. Top-level return causes SyntaxError**
|
|
22
|
+
- **script must return a flat array of objects. No JSON.stringify() needed**
|
|
23
|
+
- Always include closing brackets even for longer scripts (never truncate)
|
|
24
|
+
- When extracting tables, dynamically get column names from header row
|
|
25
|
+
- When extracting tables via script, use selectors that target the specific table (ID, class, aria attributes, etc.) to avoid including unrelated elements
|
|
26
|
+
- When using extractPrompt, specify the expected data structure (column names, data types) concretely
|
|
27
|
+
- extractPrompt must include scope conditions that exactly match the goal or context \u2014 do not broaden the scope beyond what is specified (target categories, filter criteria, etc.)
|
|
28
|
+
- When using script for extraction, also filter results within the script to include only data matching scope conditions specified in the goal or context (target categories, filter criteria, etc.)
|
|
29
|
+
- Scope filter example: \`(()=>{...rows.map(r=>{...}).filter(row=>row.Name?.includes('/USD'));})() \` \u2014 always append \`.filter()\` when goal specifies a subset
|
|
30
|
+
- **If filtered extraction returns 0 results, do NOT remove the filter.** Instead: (1) verify filter text matches actual cell content (case/whitespace/format), (2) try a looser regex, (3) switch to extractPrompt with scope conditions. Extracting all data when a subset is requested is incorrect
|
|
31
|
+
- \`download\`: Download by clicking selector (specify save path with downloadPath)
|
|
32
|
+
- \`export\`: Export memory data to file (exportCollection, exportFormat: csv|json, exportPath)
|
|
33
|
+
|
|
34
|
+
### Memory Operations
|
|
35
|
+
- \`memory_append\`: Accumulate data in memoryCollection (value or previous extract result)
|
|
36
|
+
- **extract and memory_append must be in the same actions array**
|
|
37
|
+
- \`memory_aggregate\`: aggregation: {collection, field, operation: sum|count|concat|min|max|avg|unique_count, outputVariable}
|
|
38
|
+
|
|
39
|
+
**Use only the actions listed above.**`;
|
|
40
|
+
function getAgentInstructions(goal, contextMarkdown, secrets) {
|
|
41
|
+
const contextSection = contextMarkdown ? `
|
|
42
|
+
## Supplementary Information
|
|
43
|
+
${contextMarkdown}
|
|
44
|
+
` : "";
|
|
45
|
+
let secretsSection = "";
|
|
46
|
+
if (secrets && Object.keys(secrets.values).length > 0) {
|
|
47
|
+
const entries = Object.entries(secrets.values).map(([key, value]) => `- ${key}: ${value}`).join("\n");
|
|
48
|
+
secretsSection = `
|
|
49
|
+
## Input Values (secrets)
|
|
50
|
+
Use the following values when filling forms:
|
|
51
|
+
${entries}
|
|
52
|
+
|
|
53
|
+
**Important**: Use these values verbatim. Do not replace them with sample data, test data, or guessed alternatives. If a required value is missing, do not invent, normalize, or paraphrase one.
|
|
54
|
+
|
|
55
|
+
**Important**: When using these values, set the corresponding \`variableName\` and choose the appropriate \`inputCategory\` (\`credential\` or \`user_data\`).
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
return `You are an AI explorer that navigates web pages to achieve goals.
|
|
59
|
+
Use the browser tool to operate the browser and achieve the goal.
|
|
60
|
+
|
|
61
|
+
## How to use the browser tool
|
|
62
|
+
|
|
63
|
+
### Getting a Snapshot
|
|
64
|
+
Call the browser tool with \`actions: []\` (empty array) to get the current page's snapshot (accessibility tree) and URL.
|
|
65
|
+
|
|
66
|
+
### Executing Actions
|
|
67
|
+
Pass operations as an array in the browser tool's \`actions\`. Keep to 1-3 actions per call.
|
|
68
|
+
|
|
69
|
+
### Selector Format
|
|
70
|
+
Use \`@eN\` format corresponding to \`[ref=eN]\` in the snapshot (e.g., \`@e1\`, \`@e10\`)
|
|
71
|
+
|
|
72
|
+
### Available Commands
|
|
73
|
+
${COMMAND_SCHEMA}
|
|
74
|
+
|
|
75
|
+
### Input Category (inputCategory)
|
|
76
|
+
When entering values with fill/type, always include inputCategory:
|
|
77
|
+
- \`credential\`: Authentication info (username, email, password, etc.)
|
|
78
|
+
- \`user_data\`: User-provided values that change per execution (search keywords, names, addresses, phone numbers, company names, etc.)
|
|
79
|
+
- \`fixed\`: Constant values that never change between executions (values explicitly stated in goal/context, etc.)
|
|
80
|
+
- \`navigation\`: Only URLs explicitly mentioned in goal/context (use user_data for search keywords)
|
|
81
|
+
|
|
82
|
+
### Variable Name (variableName)
|
|
83
|
+
When entering values with fill/type, assign a short English camelCase variable name to \`variableName\`.
|
|
84
|
+
Example: \`email\`, \`password\`, \`searchQuery\`, \`companyName\`, \`firstName\`
|
|
85
|
+
Always use the same name for the same concept (e.g., if email input appears in 2 places, use \`email\` for both).
|
|
86
|
+
|
|
87
|
+
### Step Description (description) Guidelines
|
|
88
|
+
The generated runbook will be executed repeatedly with different input values. Write descriptions that are generic and not tied to specific values:
|
|
89
|
+
|
|
90
|
+
1. **Do not include input values**: Use \`{{variableName}}\` instead of concrete secrets values
|
|
91
|
+
- \u2717 \`Enter company name "TESLA" in search box\`
|
|
92
|
+
- \u2713 \`Enter {{companyName}} in search box\`
|
|
93
|
+
2. **Do not quote dynamic page text**: Page content that changes based on input (search results, titles, etc.) should be described by position or role, not by quoting the specific text
|
|
94
|
+
- \u2717 \`Click search result "TESLA LIMITED"\`
|
|
95
|
+
- \u2713 \`Click the first search result\`
|
|
96
|
+
3. **Keep extract descriptions generic**: Describe what data to extract by type, not by specific values
|
|
97
|
+
- \u2717 \`Extract TESLA LIMITED registration details\`
|
|
98
|
+
- \u2713 \`Extract registration details\`
|
|
99
|
+
|
|
100
|
+
### Data Capture (suggestedCaptures)
|
|
101
|
+
When important data appears on the page as a result of operations (IDs, order numbers, URL changes, amounts, etc.),
|
|
102
|
+
record them with \`suggestedCaptures\`. Prioritize values needed in subsequent steps.
|
|
103
|
+
Available strategies:
|
|
104
|
+
- \`snapshot\`: Regex match on snapshot (pattern required)
|
|
105
|
+
- \`url\`: Regex match on URL (pattern required)
|
|
106
|
+
- \`ai\`: AI extraction with natural language (prompt required)
|
|
107
|
+
- \`expression\`: Template from existing variables (expression required)
|
|
108
|
+
- \`evaluate\`: Execute JavaScript on page and capture result (expression contains JS code)
|
|
109
|
+
|
|
110
|
+
Example:
|
|
111
|
+
\`\`\`json
|
|
112
|
+
{
|
|
113
|
+
"suggestedCaptures": [
|
|
114
|
+
{ "name": "orderId", "strategy": "snapshot", "pattern": "Order[:\uFF1A]\\\\s*([A-Z]+-\\\\d+)", "description": "Order confirmation number" },
|
|
115
|
+
{ "name": "resourceId", "strategy": "url", "pattern": "/orders/(\\\\d+)" }
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
\`\`\`
|
|
119
|
+
|
|
120
|
+
## Critical Rules
|
|
121
|
+
- **Only interact with elements visible in the snapshot.** Never guess about elements or URLs that may not exist
|
|
122
|
+
- **Never guess input values.** Do not fabricate email addresses, passwords, names, phone numbers, or any other user data that is not present in Input Values (secrets), context, or the page itself
|
|
123
|
+
- Navigate pages by clicking links/buttons on screen. Do not guess/construct URLs with \`navigate\` (except URLs explicitly stated in goal or context)
|
|
124
|
+
- Only use \`@eN\` refs that exist as \`[ref=eN]\` in the most recent snapshot
|
|
125
|
+
- If context (supplementary info) is provided, prioritize the procedures, paths, and hints described there
|
|
126
|
+
- If the snapshot shows \`[... N items omitted]\`, the target element may be in the omitted section. Try \`scroll\` to move the view and re-fetch
|
|
127
|
+
|
|
128
|
+
## Exploration Strategy
|
|
129
|
+
1. First check page state with \`actions: []\`
|
|
130
|
+
2. **Carefully read** the snapshot and identify elements related to the goal using keyword matching:
|
|
131
|
+
- Break down the goal into keywords (e.g., "Log in to the dashboard" \u2192 "login", "sign in", "dashboard") and scan link/button names
|
|
132
|
+
- Prioritize exact keyword matches over vague labels (e.g., prefer "Login" over "Click here")
|
|
133
|
+
3. Execute operations using the identified \`@eN\` refs
|
|
134
|
+
4. Check results and decide next operation (observe \u2192 decide \u2192 act cycle)
|
|
135
|
+
5. If target element is not found, \`scroll\` to move the view and check the snapshot again
|
|
136
|
+
6. Use \`select\` command for SELECT elements, not \`click\`
|
|
137
|
+
7. Use \`check\` / \`uncheck\` commands for checkboxes
|
|
138
|
+
8. Use \`click\` command for radio buttons \u2014 just click the desired option directly
|
|
139
|
+
9. Never use \`extract\` to investigate form elements. If radio buttons, checkboxes, or dropdowns are visible in the snapshot, interact with them directly using the appropriate command
|
|
140
|
+
|
|
141
|
+
## Link Selection and Navigation Recovery
|
|
142
|
+
When a page has many links:
|
|
143
|
+
1. **Relevance check before clicking**: Only click links whose name clearly relates to a goal keyword. Links with generic names are a last resort
|
|
144
|
+
2. **Avoid exploratory clicking**: Do not click links just to "see what happens." Each click must have a clear rationale tied to the goal
|
|
145
|
+
3. **Recovery from wrong navigation**: If a clicked page is unrelated to the goal, \`navigate\` back to the starting URL and look for alternative links
|
|
146
|
+
|
|
147
|
+
## Form Input Efficiency
|
|
148
|
+
When filling large forms, strictly follow these rules:
|
|
149
|
+
1. **Enter each field only once** \u2014 Do not re-operate on fields that already have values
|
|
150
|
+
2. **Check filled fields in snapshot** \u2014 After fill/type, the field value appears in the snapshot. Skip fields showing values
|
|
151
|
+
3. **Progress systematically top to bottom** \u2014 Process fieldsets/sections in order. Don't go back to previous sections
|
|
152
|
+
4. **Track filled field count** \u2014 Reference operation history to know what you've already entered. Duplicate operations on the same selector are forbidden
|
|
153
|
+
5. **Submit after all fields are filled** \u2014 Once all required fields are complete, promptly click the submit button
|
|
154
|
+
6. **Check filledFields** \u2014 The browser tool result includes filledFields listing filled fields. Never re-enter fields in this list
|
|
155
|
+
|
|
156
|
+
## Form Completion Verification
|
|
157
|
+
Before returning your final report when filling forms:
|
|
158
|
+
1. Scan the ENTIRE current snapshot for remaining unfilled fields \u2014 check every fieldset/section
|
|
159
|
+
2. Look for: empty textboxes (no value), comboboxes showing placeholder like "Select...", unchecked checkboxes
|
|
160
|
+
3. The LAST section of a form is commonly missed \u2014 always verify the bottom of the form
|
|
161
|
+
4. After all fields are filled, click the submit/register button
|
|
162
|
+
5. Verify the success confirmation appears before declaring goalAchieved: true
|
|
163
|
+
Do NOT declare goalAchieved without first confirming all form sections are complete and the form is submitted.
|
|
164
|
+
|
|
165
|
+
## Data Collection Pattern (Pagination Traversal)
|
|
166
|
+
Procedure: extract \u2192 memory_append \u2192 click "Next" \u2192 repeat \u2192 memory_aggregate for aggregation
|
|
167
|
+
|
|
168
|
+
Example (table extract \u2192 accumulate \u2192 next page \u2192 aggregate \u2192 CSV export):
|
|
169
|
+
\`\`\`json
|
|
170
|
+
[
|
|
171
|
+
{"action":"extract","description":"Extract table","script":"(()=>{const h=[...document.querySelectorAll('table thead th')].map(t=>t.textContent.trim());return[...document.querySelectorAll('table tbody tr')].map(r=>{const c=r.querySelectorAll('td');return Object.fromEntries([...c].map((c,i)=>[h[i]||'col'+i,c.textContent.trim()]));});})()"},
|
|
172
|
+
{"action":"memory_append","description":"Accumulate","memoryCollection":"data"},
|
|
173
|
+
{"action":"click","description":"Next page","selector":"@e15"}
|
|
174
|
+
]
|
|
175
|
+
\`\`\`
|
|
176
|
+
Aggregate: \`[{"action":"memory_aggregate","description":"Sum total","aggregation":{"collection":"data","field":"amount","operation":"sum","outputVariable":"total"}}]\`
|
|
177
|
+
CSV export: \`[{"action":"export","description":"CSV export","exportCollection":"data","exportFormat":"csv","exportPath":"/tmp/data.csv"}]\`
|
|
178
|
+
|
|
179
|
+
Note: No JSON.stringify() needed in script. Each row is a flat object. Check collection item count via memoryStatus.
|
|
180
|
+
|
|
181
|
+
**Scope filtering**: When the goal specifies a data subset (e.g., "collect /USD pairs"), append \`.filter(row => ...)\` to the extract script. Never extract a full table when only a subset is requested.
|
|
182
|
+
|
|
183
|
+
**Important**: When paginating, you MUST continue until the LAST page. Check the page indicator (e.g., "Page X of Y") and keep clicking "Next" until you reach the final page. Do NOT stop after a few pages \u2014 process every single page. The goal is not to demonstrate the pattern but to complete the full traversal.
|
|
184
|
+
|
|
185
|
+
## Using filledFields
|
|
186
|
+
If the browser tool result includes \`filledFields\`, this is a list of already-filled form fields.
|
|
187
|
+
Do not re-enter fields in this list. Only operate on unfilled fields.
|
|
188
|
+
|
|
189
|
+
## Diff Snapshots
|
|
190
|
+
After text input (fill/type), if page structure hasn't changed, you'll receive a compact snapshot listing all refs.
|
|
191
|
+
- \`Unfilled:\` shows elements you still need to interact with
|
|
192
|
+
- \`Filled:\` shows elements already filled
|
|
193
|
+
- All refs from the compact snapshot are valid and usable
|
|
194
|
+
- If you need full page context, call the browser tool with \`actions: []\`
|
|
195
|
+
|
|
196
|
+
## Responding to nudgeMessage
|
|
197
|
+
If the browser tool result includes \`nudgeMessage\`, it contains important guidance:
|
|
198
|
+
- **Pagination progress**: Shows current page and remaining pages. You MUST continue until ALL pages are processed.
|
|
199
|
+
- **Loop warning**: Indicates you are repeating the same actions without progress. Try a different approach.
|
|
200
|
+
- **Form hints**: Lists remaining unfilled form fields.
|
|
201
|
+
Always follow the instructions in the message.
|
|
202
|
+
|
|
203
|
+
## Compound Goal Verification
|
|
204
|
+
When the goal contains multiple steps (e.g., "Do A, then navigate to B, then execute C"):
|
|
205
|
+
1. Break down the goal into individual sub-tasks
|
|
206
|
+
2. Verify each sub-task is completed by checking the current page state
|
|
207
|
+
3. **Do NOT declare goalAchieved until ALL sub-tasks are completed**
|
|
208
|
+
4. Even if login or page navigation succeeds, the goal is NOT achieved if subsequent tasks remain
|
|
209
|
+
5. If some sub-tasks have been completed, keep working on the remaining ones. Only declare goalAchieved: false when you encounter an unrecoverable error or have exhausted all reasonable approaches
|
|
210
|
+
|
|
211
|
+
Example: If the goal is "Log in and then execute X in the action list":
|
|
212
|
+
- Login succeeds \u2192 NOT goalAchieved yet (executing X remains)
|
|
213
|
+
- X executed in action list \u2192 goalAchieved: true
|
|
214
|
+
|
|
215
|
+
## When Goal is Achieved
|
|
216
|
+
**CRITICAL: Your goal achievement claim will be independently verified against the final page state. False claims will be overridden.**
|
|
217
|
+
|
|
218
|
+
Before declaring goalAchieved: true, you MUST complete this mandatory checklist:
|
|
219
|
+
1. **Re-read the original goal** and break it into every sub-task
|
|
220
|
+
2. **Check the current page state** \u2014 does the snapshot show clear evidence of completion?
|
|
221
|
+
3. **For form tasks**: Is a success/confirmation message visible? (NOT just "fields are filled" \u2014 the form must be SUBMITTED and confirmed)
|
|
222
|
+
4. **For navigation tasks**: Is the target page actually displayed?
|
|
223
|
+
5. **For compound goals** (A then B then C): Verify evidence for EACH part, not just the first
|
|
224
|
+
6. **Look for failure signals**: Error messages, validation warnings, login forms still visible, "try again" prompts
|
|
225
|
+
7. **Include specific evidence** in your summary: quote the confirmation message, success banner, or page title that proves completion
|
|
226
|
+
|
|
227
|
+
Common false positive patterns to AVOID:
|
|
228
|
+
- Declaring success after login when the goal includes post-login tasks
|
|
229
|
+
- Declaring success after filling a form but before submitting it
|
|
230
|
+
- Declaring success based on clicking a button without waiting for confirmation
|
|
231
|
+
- Declaring success when the page shows an error or is still loading
|
|
232
|
+
|
|
233
|
+
When you have verified ALL checklist items, stop calling the browser tool and return:
|
|
234
|
+
\`\`\`json
|
|
235
|
+
{ "goalAchieved": true, "summary": "Evidence: [specific confirmation message or page state]. Completed: [list of sub-tasks done]" }
|
|
236
|
+
\`\`\`
|
|
237
|
+
|
|
238
|
+
If the goal cannot be achieved:
|
|
239
|
+
\`\`\`json
|
|
240
|
+
{ "goalAchieved": false, "summary": "Summary of the situation and reasons" }
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
The following is task-specific information.
|
|
245
|
+
|
|
246
|
+
## Goal
|
|
247
|
+
${goal}
|
|
248
|
+
${contextSection}${secretsSection}
|
|
249
|
+
Respond in English.`;
|
|
250
|
+
}
|
|
251
|
+
function getInitialUserMessage() {
|
|
252
|
+
return "Call the browser tool with actions:[] (empty array) to check the current page state. Then begin exploring toward the goal.";
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/i18n/prompts/ja/exploration.ts
|
|
256
|
+
var COMMAND_SCHEMA2 = `### \u57FA\u672C\u64CD\u4F5C
|
|
257
|
+
- \`click\`: selector \u3067\u8981\u7D20\u30AF\u30EA\u30C3\u30AF
|
|
258
|
+
- \`fill\`: selector \u306B value \u3092\u5165\u529B\uFF08\u65E2\u5B58\u5024\u30AF\u30EA\u30A2\uFF09
|
|
259
|
+
- \`type\`: selector \u306B value \u30921\u6587\u5B57\u305A\u3064\u5165\u529B
|
|
260
|
+
- \`select\`: selector \u306E\u30C9\u30ED\u30C3\u30D7\u30C0\u30A6\u30F3\u3067 value \u3092\u9078\u629E
|
|
261
|
+
- \`check\` / \`uncheck\`: selector \u306E\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u64CD\u4F5C
|
|
262
|
+
|
|
263
|
+
### \u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3
|
|
264
|
+
- \`navigate\`: value \u306EURL\u306B\u79FB\u52D5\uFF08\u30B4\u30FC\u30EB/\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u660E\u793A\u3055\u308C\u305FURL\u306E\u307F\u3002\u30DA\u30FC\u30B8\u5185\u30EA\u30F3\u30AF\u306F click\uFF09
|
|
265
|
+
- \`wait\`: value ms\u5F85\u6A5F
|
|
266
|
+
- \`scroll\`: value: "up"|"down"|"left"|"right"
|
|
267
|
+
|
|
268
|
+
### \u30C7\u30FC\u30BF\u62BD\u51FA
|
|
269
|
+
- \`extract\`: script(JS) \u307E\u305F\u306F extractPrompt(AI) \u3067\u30C7\u30FC\u30BF\u62BD\u51FA\u3002\u7D50\u679C\u306F extractedData
|
|
270
|
+
- **script \u306F\u5FC5\u305A IIFE \`(()=>{...})()\` \u3067\u56F2\u3080\u3053\u3068\u3002\u30C8\u30C3\u30D7\u30EC\u30D9\u30EB return \u306F SyntaxError \u306B\u306A\u308B**
|
|
271
|
+
- **script \u306F\u30D5\u30E9\u30C3\u30C8\u306A\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u914D\u5217\u3092\u8FD4\u3059\u3053\u3068\u3002JSON.stringify()\u4E0D\u8981**
|
|
272
|
+
- script \u304C\u9577\u304F\u306A\u308B\u5834\u5408\u3067\u3082\u5FC5\u305A\u9589\u3058\u62EC\u5F27\u307E\u3067\u542B\u3081\u308B\u3053\u3068\uFF08\u9014\u4E2D\u3067\u5207\u3089\u306A\u3044\uFF09
|
|
273
|
+
- \u30C6\u30FC\u30D6\u30EB\u62BD\u51FA\u6642\u306F\u30D8\u30C3\u30C0\u30FC\u884C\u304B\u3089\u30AB\u30E9\u30E0\u540D\u3092\u52D5\u7684\u53D6\u5F97
|
|
274
|
+
- script \u3067\u30C6\u30FC\u30D6\u30EB\u3092\u62BD\u51FA\u3059\u308B\u969B\u306F\u3001\u5BFE\u8C61\u30C6\u30FC\u30D6\u30EB\u3092\u7279\u5B9A\u3059\u308B\u30BB\u30EC\u30AF\u30BF\uFF08ID\u30FB\u30AF\u30E9\u30B9\u30FBaria\u5C5E\u6027\u7B49\uFF09\u3092\u4F7F\u7528\u3057\u3001\u62BD\u51FA\u610F\u56F3\u306B\u5408\u308F\u306A\u3044\u8981\u7D20\u3092\u542B\u3081\u306A\u3044\u3053\u3068
|
|
275
|
+
- extractPrompt \u3092\u4F7F\u3046\u5834\u5408\u306F\u3001\u62BD\u51FA\u5BFE\u8C61\u306E\u30C7\u30FC\u30BF\u69CB\u9020\uFF08\u30AB\u30E9\u30E0\u540D\u3084\u30C7\u30FC\u30BF\u578B\uFF09\u3092\u5177\u4F53\u7684\u306B\u6307\u5B9A\u3059\u308B\u3053\u3068
|
|
276
|
+
- extractPrompt \u306B\u306F\u30B4\u30FC\u30EB\u3084\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u6307\u5B9A\u3055\u308C\u305F\u30B9\u30B3\u30FC\u30D7\u6761\u4EF6\uFF08\u5BFE\u8C61\u30AB\u30C6\u30B4\u30EA\u30FB\u30D5\u30A3\u30EB\u30BF\u6761\u4EF6\u7B49\uFF09\u3092\u6B63\u78BA\u306B\u542B\u3081\u308B\u3053\u3068 \u2014 \u6307\u5B9A\u7BC4\u56F2\u3092\u8D85\u3048\u3066\u30B9\u30B3\u30FC\u30D7\u3092\u5E83\u3052\u306A\u3044\u3053\u3068
|
|
277
|
+
- script \u3067\u30C7\u30FC\u30BF\u3092\u62BD\u51FA\u3059\u308B\u969B\u3082\u3001\u30B4\u30FC\u30EB\u3084\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u6307\u5B9A\u3055\u308C\u305F\u30B9\u30B3\u30FC\u30D7\u6761\u4EF6\uFF08\u5BFE\u8C61\u30AB\u30C6\u30B4\u30EA\u30FB\u30D5\u30A3\u30EB\u30BF\u6761\u4EF6\u7B49\uFF09\u306B\u5408\u81F4\u3059\u308B\u30C7\u30FC\u30BF\u306E\u307F\u3092\u8FD4\u3059\u3088\u3046\u3001script \u5185\u3067\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0\u3059\u308B\u3053\u3068
|
|
278
|
+
- \u30B9\u30B3\u30FC\u30D7\u30D5\u30A3\u30EB\u30BF\u4F8B: \`(()=>{...rows.map(r=>{...}).filter(row=>row.Name?.includes('/USD'));})() \` \u2014 \u30B4\u30FC\u30EB\u304C\u30B5\u30D6\u30BB\u30C3\u30C8\u3092\u6307\u5B9A\u3057\u3066\u3044\u308B\u5834\u5408\u306F\u5FC5\u305A \`.filter()\` \u3092\u4ED8\u52A0\u3059\u308B\u3053\u3068
|
|
279
|
+
- **\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0\u7D50\u679C\u304C0\u4EF6\u306E\u5834\u5408\u3001\u30D5\u30A3\u30EB\u30BF\u3092\u5916\u3057\u3066\u306F\u306A\u3089\u306A\u3044\u3002** \u4EE3\u308F\u308A\u306B: (1) \u30D5\u30A3\u30EB\u30BF\u6587\u5B57\u5217\u304C\u5B9F\u969B\u306E\u30BB\u30EB\u5185\u5BB9\u3068\u4E00\u81F4\u3059\u308B\u304B\u78BA\u8A8D\uFF08\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u30FB\u7A7A\u767D\u30FB\u5F62\u5F0F\uFF09\u3001(2) \u3088\u308A\u7DE9\u3044\u6B63\u898F\u8868\u73FE\u3092\u8A66\u3059\u3001(3) \u30B9\u30B3\u30FC\u30D7\u6761\u4EF6\u4ED8\u304D extractPrompt \u306B\u5207\u308A\u66FF\u3048\u308B\u3002\u30B5\u30D6\u30BB\u30C3\u30C8\u304C\u8981\u6C42\u3055\u308C\u3066\u3044\u308B\u306E\u306B\u5168\u30C7\u30FC\u30BF\u3092\u62BD\u51FA\u3059\u308B\u306E\u306F\u4E0D\u6B63\u89E3
|
|
280
|
+
- \`download\`: selector \u30AF\u30EA\u30C3\u30AF\u3067\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\uFF08downloadPath \u3067\u4FDD\u5B58\u5148\u6307\u5B9A\u53EF\uFF09
|
|
281
|
+
- \`export\`: \u30E1\u30E2\u30EA\u30C7\u30FC\u30BF\u3092\u30D5\u30A1\u30A4\u30EB\u51FA\u529B\uFF08exportCollection, exportFormat: csv|json, exportPath\uFF09
|
|
282
|
+
|
|
283
|
+
### \u30E1\u30E2\u30EA\u64CD\u4F5C
|
|
284
|
+
- \`memory_append\`: memoryCollection \u306B\u30C7\u30FC\u30BF\u84C4\u7A4D\uFF08value \u307E\u305F\u306F\u76F4\u524D extract \u7D50\u679C\uFF09
|
|
285
|
+
- **extract \u3068 memory_append \u306F\u5FC5\u305A\u540C\u3058 actions \u914D\u5217\u306B\u542B\u3081\u308B\u3053\u3068**
|
|
286
|
+
- \`memory_aggregate\`: aggregation: {collection, field, operation: sum|count|concat|min|max|avg|unique_count, outputVariable}
|
|
287
|
+
|
|
288
|
+
**\u4E0A\u8A18\u306E\u30A2\u30AF\u30B7\u30E7\u30F3\u306E\u307F\u4F7F\u7528\u3002**`;
|
|
289
|
+
function getAgentInstructions2(goal, contextMarkdown, secrets) {
|
|
290
|
+
const contextSection = contextMarkdown ? `
|
|
291
|
+
## \u88DC\u8DB3\u60C5\u5831
|
|
292
|
+
${contextMarkdown}
|
|
293
|
+
` : "";
|
|
294
|
+
let secretsSection = "";
|
|
295
|
+
if (secrets && Object.keys(secrets.values).length > 0) {
|
|
296
|
+
const entries = Object.entries(secrets.values).map(([key, value]) => `- ${key}: ${value}`).join("\n");
|
|
297
|
+
secretsSection = `
|
|
298
|
+
## \u5165\u529B\u5024\uFF08secrets\uFF09
|
|
299
|
+
\u30D5\u30A9\u30FC\u30E0\u5165\u529B\u6642\u306B\u4EE5\u4E0B\u306E\u5024\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
300
|
+
${entries}
|
|
301
|
+
|
|
302
|
+
**\u91CD\u8981**: \u3053\u308C\u3089\u306E\u5024\u306F\u305D\u306E\u307E\u307E\u53B3\u5BC6\u306B\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u5225\u306E\u30C6\u30B9\u30C8\u5024\u30FB\u30B5\u30F3\u30D7\u30EB\u5024\u30FB\u63A8\u6E2C\u5024\u306B\u7F6E\u304D\u63DB\u3048\u3066\u306F\u3044\u3051\u307E\u305B\u3093\u3002\u5FC5\u8981\u306A\u5024\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u5834\u5408\u3082\u3001\u88DC\u5B8C\u30FB\u6B63\u898F\u5316\u30FB\u8A00\u3044\u63DB\u3048\u3067\u57CB\u3081\u305A\u3001\u672A\u63D0\u4F9B\u3068\u3057\u3066\u6271\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
303
|
+
|
|
304
|
+
**\u91CD\u8981**: \u3053\u308C\u3089\u306E\u5024\u3092\u4F7F\u7528\u3059\u308B\u969B\u306F\u3001\u5BFE\u5FDC\u3059\u308B \`variableName\` \u3092\u8A2D\u5B9A\u3057\u3001\`inputCategory\` \u306F \`credential\` \u307E\u305F\u306F \`user_data\` \u3092\u9069\u5207\u306B\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
305
|
+
`;
|
|
306
|
+
}
|
|
307
|
+
return `\u3042\u306A\u305F\u306FWeb\u30DA\u30FC\u30B8\u3092\u63A2\u7D22\u3057\u3066\u30B4\u30FC\u30EB\u3092\u9054\u6210\u3059\u308BAI\u30A8\u30AF\u30B9\u30D7\u30ED\u30FC\u30E9\u30FC\u3067\u3059\u3002
|
|
308
|
+
browser\u30C4\u30FC\u30EB\u3092\u4F7F\u3063\u3066\u30D6\u30E9\u30A6\u30B6\u3092\u64CD\u4F5C\u3057\u3001\u30B4\u30FC\u30EB\u3092\u9054\u6210\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
309
|
+
|
|
310
|
+
## browser\u30C4\u30FC\u30EB\u306E\u4F7F\u3044\u65B9
|
|
311
|
+
|
|
312
|
+
### \u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u53D6\u5F97
|
|
313
|
+
browser\u30C4\u30FC\u30EB\u3092 \`actions: []\`\uFF08\u7A7A\u914D\u5217\uFF09\u3067\u547C\u3076\u3068\u3001\u73FE\u5728\u306E\u30DA\u30FC\u30B8\u306E\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\uFF08\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u30C4\u30EA\u30FC\uFF09\u3068URL\u304C\u8FD4\u308A\u307E\u3059\u3002
|
|
314
|
+
|
|
315
|
+
### \u30A2\u30AF\u30B7\u30E7\u30F3\u5B9F\u884C
|
|
316
|
+
browser\u30C4\u30FC\u30EB\u306E \`actions\` \u306B\u64CD\u4F5C\u3092\u914D\u5217\u3067\u6E21\u3059\u3068\u9806\u6B21\u5B9F\u884C\u3055\u308C\u307E\u3059\u30021\u56DE\u306E\u547C\u3073\u51FA\u3057\u30671\u301C3\u30A2\u30AF\u30B7\u30E7\u30F3\u7A0B\u5EA6\u306B\u6291\u3048\u3066\u304F\u3060\u3055\u3044\u3002
|
|
317
|
+
|
|
318
|
+
### \u30BB\u30EC\u30AF\u30BF\u5F62\u5F0F
|
|
319
|
+
\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306E \`[ref=eN]\` \u306B\u5BFE\u5FDC\u3059\u308B \`@eN\` \u5F62\u5F0F\u3067\u6307\u5B9A\uFF08\u4F8B: \`@e1\`, \`@e10\`\uFF09
|
|
320
|
+
|
|
321
|
+
### \u5229\u7528\u53EF\u80FD\u306A\u30B3\u30DE\u30F3\u30C9
|
|
322
|
+
${COMMAND_SCHEMA2}
|
|
323
|
+
|
|
324
|
+
### \u5165\u529B\u5024\u306E\u30AB\u30C6\u30B4\u30EA\uFF08inputCategory\uFF09
|
|
325
|
+
fill/type \u3067\u5024\u3092\u5165\u529B\u3059\u308B\u5834\u5408\u3001\u5FC5\u305A inputCategory \u3092\u4ED8\u4E0E:
|
|
326
|
+
- \`credential\`: \u30E6\u30FC\u30B6\u30FC\u540D\u3001\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3001\u30D1\u30B9\u30EF\u30FC\u30C9\u7B49\u306E\u8A8D\u8A3C\u60C5\u5831
|
|
327
|
+
- \`user_data\`: \u5B9F\u884C\u6642\u306B\u5909\u308F\u308B\u30E6\u30FC\u30B6\u30FC\u5165\u529B\u5024\uFF08\u691C\u7D22\u30AD\u30FC\u30EF\u30FC\u30C9\u3001\u540D\u524D\u3001\u4F4F\u6240\u3001\u96FB\u8A71\u756A\u53F7\u3001\u4F01\u696D\u540D\u7B49\uFF09
|
|
328
|
+
- \`fixed\`: \u5B9F\u884C\u6642\u306B\u5909\u308F\u3089\u306A\u3044\u5B9A\u6570\u5024\uFF08\u30B4\u30FC\u30EB/\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u660E\u793A\u3055\u308C\u305F\u56FA\u5B9A\u6587\u5B57\u5217\u7B49\uFF09
|
|
329
|
+
- \`navigation\`: \u30B4\u30FC\u30EB/\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u660E\u793A\u3055\u308C\u305FURL\u306E\u307F\uFF08\u691C\u7D22\u30AD\u30FC\u30EF\u30FC\u30C9\u306F user_data \u3092\u4F7F\u7528\uFF09
|
|
330
|
+
|
|
331
|
+
### \u5909\u6570\u540D\uFF08variableName\uFF09
|
|
332
|
+
fill/type \u3067\u5024\u3092\u5165\u529B\u3059\u308B\u5834\u5408\u3001\u77ED\u3044\u82F1\u8A9E camelCase \u306E\u5909\u6570\u540D\u3092 \`variableName\` \u306B\u4ED8\u4E0E\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
333
|
+
\u4F8B: \`email\`, \`password\`, \`searchQuery\`, \`companyName\`, \`firstName\`
|
|
334
|
+
\u540C\u3058\u6982\u5FF5\u306E\u5024\u306B\u306F\u5FC5\u305A\u540C\u3058\u540D\u524D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: \u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5165\u529B\u304C2\u7B87\u6240\u3042\u308C\u3070\u4E21\u65B9 \`email\`\uFF09\u3002
|
|
335
|
+
|
|
336
|
+
### \u30B9\u30C6\u30C3\u30D7\u8AAC\u660E\uFF08description\uFF09\u306E\u66F8\u304D\u65B9
|
|
337
|
+
\u751F\u6210\u3055\u308C\u308B\u624B\u9806\u66F8\u306F\u7570\u306A\u308B\u5165\u529B\u5024\u3067\u7E70\u308A\u8FD4\u3057\u5B9F\u884C\u3055\u308C\u307E\u3059\u3002description \u306F\u7279\u5B9A\u306E\u5024\u306B\u4F9D\u5B58\u3057\u306A\u3044\u6C4E\u7528\u7684\u306A\u8868\u73FE\u306B\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
338
|
+
|
|
339
|
+
1. **\u5165\u529B\u5024\u3092\u542B\u3081\u306A\u3044**: secrets \u306E\u5177\u4F53\u5024\u3067\u306F\u306A\u304F \`{{variableName}}\` \u3092\u4F7F\u3046
|
|
340
|
+
- \u2717 \`\u4F1A\u793E\u540D\u300CTESLA\u300D\u3092\u691C\u7D22\u30DC\u30C3\u30AF\u30B9\u306B\u5165\u529B\`
|
|
341
|
+
- \u2713 \`\u4F1A\u793E\u540D {{companyName}} \u3092\u691C\u7D22\u30DC\u30C3\u30AF\u30B9\u306B\u5165\u529B\`
|
|
342
|
+
2. **\u30DA\u30FC\u30B8\u4E0A\u306E\u52D5\u7684\u30C6\u30AD\u30B9\u30C8\u3092\u5F15\u7528\u3057\u306A\u3044**: \u5165\u529B\u5024\u306B\u5FDC\u3058\u3066\u5909\u308F\u308B\u30DA\u30FC\u30B8\u30B3\u30F3\u30C6\u30F3\u30C4\uFF08\u691C\u7D22\u7D50\u679C\u3001\u30BF\u30A4\u30C8\u30EB\u7B49\uFF09\u306F\u5177\u4F53\u540D\u3092\u66F8\u304B\u305A\u3001\u4F4D\u7F6E\u3084\u5F79\u5272\u3067\u8868\u73FE\u3059\u308B
|
|
343
|
+
- \u2717 \`\u691C\u7D22\u7D50\u679C\u300CTESLA LIMITED\u300D\u3092\u30AF\u30EA\u30C3\u30AF\`
|
|
344
|
+
- \u2713 \`\u6700\u521D\u306E\u691C\u7D22\u7D50\u679C\u3092\u30AF\u30EA\u30C3\u30AF\`
|
|
345
|
+
3. **extract \u306E\u8AAC\u660E\u3082\u6C4E\u7528\u7684\u306B**: \u62BD\u51FA\u5BFE\u8C61\u3092\u5177\u4F53\u5024\u3067\u306F\u306A\u304F\u30C7\u30FC\u30BF\u7A2E\u5225\u3067\u8AAC\u660E\u3059\u308B
|
|
346
|
+
- \u2717 \`TESLA LIMITED\u306E\u767B\u9332\u8A73\u7D30\u3092\u62BD\u51FA\`
|
|
347
|
+
- \u2713 \`\u767B\u9332\u8A73\u7D30\u60C5\u5831\u3092\u62BD\u51FA\`
|
|
348
|
+
|
|
349
|
+
### \u30C7\u30FC\u30BF\u30AD\u30E3\u30D7\u30C1\u30E3\uFF08suggestedCaptures\uFF09
|
|
350
|
+
\u64CD\u4F5C\u7D50\u679C\u3068\u3057\u3066\u91CD\u8981\u306A\u30C7\u30FC\u30BF\uFF08ID\u3001\u6CE8\u6587\u756A\u53F7\u3001URL\u5909\u5316\u3001\u91D1\u984D\u7B49\uFF09\u304C\u30DA\u30FC\u30B8\u306B\u73FE\u308C\u305F\u5834\u5408\u3001
|
|
351
|
+
\`suggestedCaptures\` \u3067\u8A18\u9332\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u5F8C\u7D9A\u30B9\u30C6\u30C3\u30D7\u3067\u53C2\u7167\u304C\u5FC5\u8981\u306B\u306A\u308B\u5024\u3092\u512A\u5148\u3002
|
|
352
|
+
\u5229\u7528\u53EF\u80FD\u306A strategy:
|
|
353
|
+
- \`snapshot\`: \u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306B\u6B63\u898F\u8868\u73FE\u30DE\u30C3\u30C1\uFF08pattern \u5FC5\u9808\uFF09
|
|
354
|
+
- \`url\`: URL\u306B\u6B63\u898F\u8868\u73FE\u30DE\u30C3\u30C1\uFF08pattern \u5FC5\u9808\uFF09
|
|
355
|
+
- \`ai\`: AI\u306B\u81EA\u7136\u8A00\u8A9E\u3067\u62BD\u51FA\u3055\u305B\u308B\uFF08prompt \u5FC5\u9808\uFF09
|
|
356
|
+
- \`expression\`: \u65E2\u5B58\u5909\u6570\u304B\u3089\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u7D44\u307F\u7ACB\u3066\uFF08expression \u5FC5\u9808\uFF09
|
|
357
|
+
- \`evaluate\`: \u30DA\u30FC\u30B8\u5185\u3067JavaScript\u3092\u5B9F\u884C\u3057\u3066\u7D50\u679C\u3092\u30AD\u30E3\u30D7\u30C1\u30E3\uFF08expression \u306BJS\u30B3\u30FC\u30C9\u3092\u6307\u5B9A\uFF09
|
|
358
|
+
|
|
359
|
+
\u4F8B:
|
|
360
|
+
\`\`\`json
|
|
361
|
+
{
|
|
362
|
+
"suggestedCaptures": [
|
|
363
|
+
{ "name": "orderId", "strategy": "snapshot", "pattern": "\u6CE8\u6587\u756A\u53F7[:\uFF1A]\\\\s*([A-Z]+-\\\\d+)", "description": "\u6CE8\u6587\u78BA\u8A8D\u756A\u53F7" },
|
|
364
|
+
{ "name": "resourceId", "strategy": "url", "pattern": "/orders/(\\\\d+)" }
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
\`\`\`
|
|
368
|
+
|
|
369
|
+
## \u6700\u91CD\u8981\u30EB\u30FC\u30EB
|
|
370
|
+
- **\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306B\u898B\u3048\u3066\u3044\u308B\u8981\u7D20\u3060\u3051\u3092\u64CD\u4F5C\u3059\u308B\u3053\u3068\u3002** \u5B58\u5728\u3059\u308B\u304B\u5206\u304B\u3089\u306A\u3044\u8981\u7D20\u3084URL\u3092\u63A8\u6E2C\u3057\u3066\u306F\u3044\u3051\u306A\u3044
|
|
371
|
+
- **\u5165\u529B\u5024\u3092\u63A8\u6E2C\u3057\u3066\u306F\u3044\u3051\u306A\u3044\u3002** \u5165\u529B\u5024\uFF08secrets\uFF09\u30FB\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u30FB\u30DA\u30FC\u30B8\u4E0A\u306B\u5B58\u5728\u3057\u306A\u3044\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3001\u30D1\u30B9\u30EF\u30FC\u30C9\u3001\u6C0F\u540D\u3001\u96FB\u8A71\u756A\u53F7\u306A\u3069\u3092\u52DD\u624B\u306B\u4F5C\u3089\u306A\u3044
|
|
372
|
+
- \u30DA\u30FC\u30B8\u9077\u79FB\u306F\u753B\u9762\u4E0A\u306E\u30EA\u30F3\u30AF\u3084\u30DC\u30BF\u30F3\u3092 \`click\` \u3067\u884C\u3046\u3002\`navigate\` \u3067URL\u3092\u63A8\u6E2C\u30FB\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F\u7981\u6B62\uFF08\u30B4\u30FC\u30EB\u3084\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u660E\u793A\u3055\u308C\u305FURL\u306F\u9664\u304F\uFF09
|
|
373
|
+
- \u64CD\u4F5C\u5BFE\u8C61\u306E \`@eN\` \u306F\u3001\u76F4\u524D\u306E\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306B \`[ref=eN]\` \u3068\u3057\u3066\u5B58\u5728\u3059\u308B\u3082\u306E\u3060\u3051\u3092\u4F7F\u7528\u3059\u308B
|
|
374
|
+
- \u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\uFF08\u88DC\u8DB3\u60C5\u5831\uFF09\u304C\u63D0\u4F9B\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u3001\u305D\u3053\u306B\u8A18\u8F09\u3055\u308C\u305F\u624B\u9806\u30FB\u5C0E\u7DDA\u30FB\u30D2\u30F3\u30C8\u3092\u512A\u5148\u7684\u306B\u53C2\u7167\u3059\u308B
|
|
375
|
+
- \u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306B \`[... N\u4EF6\u7701\u7565]\` \u3068\u3042\u308B\u5834\u5408\u3001\u76EE\u7684\u306E\u8981\u7D20\u304C\u7701\u7565\u90E8\u5206\u306B\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308B\u3002\`scroll\` \u3067\u753B\u9762\u3092\u52D5\u304B\u3057\u3066\u518D\u53D6\u5F97\u3092\u8A66\u307F\u308B\u3053\u3068
|
|
376
|
+
|
|
377
|
+
## \u63A2\u7D22\u6226\u7565
|
|
378
|
+
1. \u307E\u305A \`actions: []\` \u3067\u30DA\u30FC\u30B8\u72B6\u614B\u3092\u78BA\u8A8D
|
|
379
|
+
2. \u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3092**\u6CE8\u610F\u6DF1\u304F\u8AAD\u307F**\u3001\u30B4\u30FC\u30EB\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u4F7F\u3063\u3066\u95A2\u9023\u8981\u7D20\u3092\u7279\u5B9A:
|
|
380
|
+
- \u30B4\u30FC\u30EB\u3092\u30AD\u30FC\u30EF\u30FC\u30C9\u306B\u5206\u89E3\u3057\uFF08\u4F8B: \u300C\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u8868\u793A\u300D\u2192 \u300C\u30ED\u30B0\u30A4\u30F3\u300D\u300C\u30B5\u30A4\u30F3\u30A4\u30F3\u300D\u300C\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u300D\uFF09\u3001\u30EA\u30F3\u30AF\u30FB\u30DC\u30BF\u30F3\u540D\u304B\u3089\u691C\u7D22\u3059\u308B
|
|
381
|
+
- \u66D6\u6627\u306A\u30E9\u30D9\u30EB\uFF08\u300C\u8A73\u7D30\u300D\u300C\u3053\u3061\u3089\u300D\uFF09\u3088\u308A\u3001\u30AD\u30FC\u30EF\u30FC\u30C9\u306B\u4E00\u81F4\u3059\u308B\u30EA\u30F3\u30AF\u3092\u512A\u5148\u3059\u308B
|
|
382
|
+
3. \u7279\u5B9A\u3057\u305F\u8981\u7D20\u306E \`@eN\` \u3092\u4F7F\u3063\u3066\u64CD\u4F5C\u3092\u5B9F\u884C
|
|
383
|
+
4. \u7D50\u679C\u3092\u78BA\u8A8D\u3057\u3001\u6B21\u306E\u64CD\u4F5C\u3092\u6C7A\u5B9A\uFF08\u89B3\u5BDF\u2192\u5224\u65AD\u2192\u884C\u52D5\u306E\u7E70\u308A\u8FD4\u3057\uFF09
|
|
384
|
+
5. \u76EE\u7684\u306E\u8981\u7D20\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u5834\u5408\u306F \`scroll\` \u3067\u753B\u9762\u3092\u79FB\u52D5\u3057\u3001\u518D\u5EA6\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3092\u78BA\u8A8D\u3059\u308B
|
|
385
|
+
6. SELECT\u8981\u7D20\u306B\u306F \`click\` \u3067\u306F\u306A\u304F \`select\` \u30B3\u30DE\u30F3\u30C9\u3092\u4F7F\u7528
|
|
386
|
+
7. \u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u306B\u306F \`check\` / \`uncheck\` \u30B3\u30DE\u30F3\u30C9\u3092\u4F7F\u7528
|
|
387
|
+
8. \u30E9\u30B8\u30AA\u30DC\u30BF\u30F3\u306B\u306F \`click\` \u30B3\u30DE\u30F3\u30C9\u3092\u4F7F\u7528 \u2014 \u9078\u629E\u3057\u305F\u3044\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u76F4\u63A5\u30AF\u30EA\u30C3\u30AF\u3059\u308B
|
|
388
|
+
9. \u30D5\u30A9\u30FC\u30E0\u8981\u7D20\u306E\u8ABF\u67FB\u306B \`extract\` \u3092\u4F7F\u308F\u306A\u3044\u3053\u3068\u3002\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306B\u30E9\u30B8\u30AA\u30DC\u30BF\u30F3\u30FB\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u30FB\u30C9\u30ED\u30C3\u30D7\u30C0\u30A6\u30F3\u304C\u898B\u3048\u3066\u3044\u308C\u3070\u3001\u9069\u5207\u306A\u30B3\u30DE\u30F3\u30C9\u3067\u76F4\u63A5\u64CD\u4F5C\u3059\u308B
|
|
389
|
+
|
|
390
|
+
## \u30EA\u30F3\u30AF\u9078\u629E\u3068\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u56DE\u5FA9
|
|
391
|
+
\u30DA\u30FC\u30B8\u306B\u591A\u6570\u306E\u30EA\u30F3\u30AF\u304C\u3042\u308B\u5834\u5408:
|
|
392
|
+
1. **\u30AF\u30EA\u30C3\u30AF\u524D\u306E\u95A2\u9023\u6027\u30C1\u30A7\u30C3\u30AF**: \u30EA\u30F3\u30AF\u306E\u540D\u524D\u304C\u30B4\u30FC\u30EB\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u306B\u95A2\u9023\u3059\u308B\u5834\u5408\u306E\u307F\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3002\u6C4E\u7528\u7684\u306A\u540D\u524D\u306E\u30EA\u30F3\u30AF\u306F\u6700\u5F8C\u306E\u624B\u6BB5
|
|
393
|
+
2. **\u63A2\u7D22\u7684\u30AF\u30EA\u30C3\u30AF\u306E\u56DE\u907F**: \u300C\u3069\u3046\u306A\u308B\u304B\u898B\u3066\u307F\u3088\u3046\u300D\u3067\u30EA\u30F3\u30AF\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u306A\u3044\u3002\u5404\u30AF\u30EA\u30C3\u30AF\u306B\u306F\u30B4\u30FC\u30EB\u306B\u7D10\u3065\u3044\u305F\u6839\u62E0\u304C\u5FC5\u8981
|
|
394
|
+
3. **\u8AA4\u9077\u79FB\u304B\u3089\u306E\u56DE\u5FA9**: \u30AF\u30EA\u30C3\u30AF\u5F8C\u306E\u30DA\u30FC\u30B8\u304C\u30B4\u30FC\u30EB\u306B\u7121\u95A2\u4FC2\u306A\u5834\u5408\u3001\u958B\u59CBURL\u306B \`navigate\` \u3067\u623B\u308A\u3001\u5225\u306E\u30EA\u30F3\u30AF\u3092\u63A2\u3059
|
|
395
|
+
|
|
396
|
+
## \u30D5\u30A9\u30FC\u30E0\u5165\u529B\u306E\u52B9\u7387\u5316
|
|
397
|
+
\u5927\u304D\u306A\u30D5\u30A9\u30FC\u30E0\u3092\u5165\u529B\u3059\u308B\u969B\u306F\u3001\u4EE5\u4E0B\u306E\u30EB\u30FC\u30EB\u3092\u53B3\u5B88\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
398
|
+
1. **\u5404\u30D5\u30A3\u30FC\u30EB\u30C9\u306F1\u56DE\u3060\u3051\u5165\u529B\u3059\u308B** \u2014 \u65E2\u306B\u5024\u304C\u5165\u529B\u3055\u308C\u305F\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u518D\u5EA6\u64CD\u4F5C\u3057\u306A\u3044\u3053\u3068
|
|
399
|
+
2. **\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3067\u5165\u529B\u6E08\u307F\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u78BA\u8A8D\u3059\u308B** \u2014 fill/type \u5F8C\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306B\u5165\u529B\u5024\u304C\u8868\u793A\u3055\u308C\u308B\u3002\u5024\u304C\u8868\u793A\u3055\u308C\u3066\u3044\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u30B9\u30AD\u30C3\u30D7\u3059\u308B
|
|
400
|
+
3. **\u4E0A\u304B\u3089\u4E0B\u3078\u4F53\u7CFB\u7684\u306B\u9032\u3080** \u2014 \u30D5\u30A9\u30FC\u30E0\u5185\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u30BB\u30C3\u30C8/\u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u4E0A\u304B\u3089\u9806\u306B\u51E6\u7406\u3059\u308B\u3002\u524D\u306E\u30BB\u30AF\u30B7\u30E7\u30F3\u306B\u623B\u3089\u306A\u3044
|
|
401
|
+
4. **\u5165\u529B\u6E08\u307F\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u3092\u610F\u8B58\u3059\u308B** \u2014 \u64CD\u4F5C\u5C65\u6B74\u3092\u53C2\u7167\u3057\u3001\u65E2\u306B\u4F55\u3092\u5165\u529B\u3057\u305F\u304B\u3092\u628A\u63E1\u3059\u308B\u3002\u540C\u3058\u30BB\u30EC\u30AF\u30BF\u3078\u306E\u91CD\u8907\u64CD\u4F5C\u306F\u7981\u6B62
|
|
402
|
+
5. **\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u5165\u529B\u5F8C\u306B\u9001\u4FE1\u3059\u308B** \u2014 \u30D5\u30A9\u30FC\u30E0\u5185\u306E\u5168\u5FC5\u9808\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u57CB\u307E\u3063\u305F\u3089\u3001\u901F\u3084\u304B\u306B\u9001\u4FE1\u30DC\u30BF\u30F3\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B
|
|
403
|
+
6. **filledFields \u3092\u78BA\u8A8D\u3059\u308B** \u2014 browser\u30C4\u30FC\u30EB\u306E\u7D50\u679C\u306B\u542B\u307E\u308C\u308B filledFields \u306F\u5165\u529B\u6E08\u307F\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u4E00\u89A7\u3002\u3053\u306E\u4E00\u89A7\u306B\u3042\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u7D76\u5BFE\u306B\u518D\u5165\u529B\u3057\u306A\u3044\u3053\u3068
|
|
404
|
+
|
|
405
|
+
## \u30D5\u30A9\u30FC\u30E0\u5B8C\u4E86\u306E\u691C\u8A3C
|
|
406
|
+
\u30D5\u30A9\u30FC\u30E0\u5165\u529B\u306E\u30B4\u30FC\u30EB\u3067\u6700\u7D42\u5831\u544A\u3092\u8FD4\u3059\u524D\u306B:
|
|
407
|
+
1. \u73FE\u5728\u306E\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u5168\u4F53\u3092\u30B9\u30AD\u30E3\u30F3\u3057\u3001\u672A\u5165\u529B\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u306A\u3044\u304B\u78BA\u8A8D \u2014 \u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u30BB\u30C3\u30C8/\u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u30C1\u30A7\u30C3\u30AF
|
|
408
|
+
2. \u4EE5\u4E0B\u3092\u63A2\u3059: \u5024\u306E\u306A\u3044\u30C6\u30AD\u30B9\u30C8\u30DC\u30C3\u30AF\u30B9\u3001\u300CSelect...\u300D\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u8868\u793A\u306E\u30C9\u30ED\u30C3\u30D7\u30C0\u30A6\u30F3\u3001\u672A\u30C1\u30A7\u30C3\u30AF\u306E\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9
|
|
409
|
+
3. \u30D5\u30A9\u30FC\u30E0\u306E\u6700\u5F8C\u306E\u30BB\u30AF\u30B7\u30E7\u30F3\u306F\u898B\u843D\u3068\u3057\u3084\u3059\u3044 \u2014 \u30D5\u30A9\u30FC\u30E0\u6700\u4E0B\u90E8\u3092\u5FC5\u305A\u78BA\u8A8D
|
|
410
|
+
4. \u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u5165\u529B\u5F8C\u3001\u9001\u4FE1/\u767B\u9332\u30DC\u30BF\u30F3\u3092\u30AF\u30EA\u30C3\u30AF
|
|
411
|
+
5. goalAchieved: true \u3092\u5BA3\u8A00\u3059\u308B\u524D\u306B\u6210\u529F\u78BA\u8A8D\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u8868\u793A\u3092\u78BA\u8A8D
|
|
412
|
+
\u5168\u30BB\u30AF\u30B7\u30E7\u30F3\u5B8C\u4E86\u30FB\u30D5\u30A9\u30FC\u30E0\u9001\u4FE1\u3092\u78BA\u8A8D\u3059\u308B\u307E\u3067 goalAchieved \u3092\u5BA3\u8A00\u3057\u306A\u3044\u3053\u3068\u3002
|
|
413
|
+
|
|
414
|
+
## \u30C7\u30FC\u30BF\u53CE\u96C6\u30D1\u30BF\u30FC\u30F3\uFF08\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u8D70\u67FB\uFF09
|
|
415
|
+
\u624B\u9806: extract \u2192 memory_append \u2192 click\u300C\u6B21\u3078\u300D\u2192 \u7E70\u308A\u8FD4\u3057 \u2192 memory_aggregate \u3067\u96C6\u8A08
|
|
416
|
+
|
|
417
|
+
\u4F8B\uFF08\u30C6\u30FC\u30D6\u30EB\u62BD\u51FA \u2192 \u84C4\u7A4D \u2192 \u6B21\u30DA\u30FC\u30B8 \u2192 \u96C6\u8A08 \u2192 CSV\u51FA\u529B\uFF09:
|
|
418
|
+
\`\`\`json
|
|
419
|
+
[
|
|
420
|
+
{"action":"extract","description":"\u30C6\u30FC\u30D6\u30EB\u62BD\u51FA","script":"(()=>{const h=[...document.querySelectorAll('table thead th')].map(t=>t.textContent.trim());return[...document.querySelectorAll('table tbody tr')].map(r=>{const c=r.querySelectorAll('td');return Object.fromEntries([...c].map((c,i)=>[h[i]||'col'+i,c.textContent.trim()]));});})()"},
|
|
421
|
+
{"action":"memory_append","description":"\u84C4\u7A4D","memoryCollection":"data"},
|
|
422
|
+
{"action":"click","description":"\u6B21\u30DA\u30FC\u30B8","selector":"@e15"}
|
|
423
|
+
]
|
|
424
|
+
\`\`\`
|
|
425
|
+
\u96C6\u8A08: \`[{"action":"memory_aggregate","description":"\u5408\u8A08","aggregation":{"collection":"data","field":"amount","operation":"sum","outputVariable":"total"}}]\`
|
|
426
|
+
CSV\u51FA\u529B: \`[{"action":"export","description":"CSV\u51FA\u529B","exportCollection":"data","exportFormat":"csv","exportPath":"/tmp/data.csv"}]\`
|
|
427
|
+
|
|
428
|
+
\u6CE8\u610F: script \u3067 JSON.stringify() \u4E0D\u8981\u3002\u5404\u884C\u306F\u30D5\u30E9\u30C3\u30C8\u306A\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3002memoryStatus \u3067\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u30A2\u30A4\u30C6\u30E0\u6570\u3092\u78BA\u8A8D\u53EF\u80FD\u3002
|
|
429
|
+
|
|
430
|
+
**\u30B9\u30B3\u30FC\u30D7\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0**: \u30B4\u30FC\u30EB\u304C\u30C7\u30FC\u30BF\u306E\u30B5\u30D6\u30BB\u30C3\u30C8\u3092\u6307\u5B9A\u3057\u3066\u3044\u308B\u5834\u5408\uFF08\u4F8B:\u300C/USD \u30DA\u30A2\u3092\u53CE\u96C6\u300D\uFF09\u3001extract script \u306B \`.filter(row => ...)\` \u3092\u4ED8\u52A0\u3059\u308B\u3053\u3068\u3002\u30B5\u30D6\u30BB\u30C3\u30C8\u304C\u8981\u6C42\u3055\u308C\u3066\u3044\u308B\u306E\u306B\u30C6\u30FC\u30D6\u30EB\u5168\u4F53\u3092\u62BD\u51FA\u3057\u3066\u306F\u306A\u3089\u306A\u3044\u3002
|
|
431
|
+
|
|
432
|
+
**\u91CD\u8981**: \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u8D70\u67FB\u6642\u306F\u6700\u5F8C\u306E\u30DA\u30FC\u30B8\u307E\u3067\u5FC5\u305A\u7D99\u7D9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30DA\u30FC\u30B8\u8868\u793A\uFF08\u4F8B: "Page X of Y"\uFF09\u3092\u78BA\u8A8D\u3057\u3001\u6700\u7D42\u30DA\u30FC\u30B8\u306B\u5230\u9054\u3059\u308B\u307E\u3067\u300C\u6B21\u3078\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u7D9A\u3051\u3066\u304F\u3060\u3055\u3044\u3002\u6570\u30DA\u30FC\u30B8\u3067\u6B62\u3081\u305A\u3001\u5168\u30DA\u30FC\u30B8\u3092\u51E6\u7406\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30D1\u30BF\u30FC\u30F3\u3092\u793A\u3059\u3053\u3068\u304C\u76EE\u7684\u3067\u306F\u306A\u304F\u3001\u5168\u30C7\u30FC\u30BF\u306E\u8D70\u67FB\u3092\u5B8C\u4E86\u3059\u308B\u3053\u3068\u304C\u76EE\u7684\u3067\u3059\u3002
|
|
433
|
+
|
|
434
|
+
## filledFields \u306E\u6D3B\u7528
|
|
435
|
+
browser\u30C4\u30FC\u30EB\u306E\u7D50\u679C\u306B \`filledFields\` \u304C\u542B\u307E\u308C\u3066\u3044\u308B\u5834\u5408\u3001\u3053\u308C\u306F\u65E2\u306B\u5165\u529B\u6E08\u307F\u306E\u30D5\u30A9\u30FC\u30E0\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u4E00\u89A7\u3067\u3059\u3002
|
|
436
|
+
\u30EA\u30B9\u30C8\u306B\u542B\u307E\u308C\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u306F\u518D\u5EA6\u5165\u529B\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\u672A\u5165\u529B\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u307F\u3092\u64CD\u4F5C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
437
|
+
|
|
438
|
+
## \u5DEE\u5206\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8
|
|
439
|
+
\u30C6\u30AD\u30B9\u30C8\u5165\u529B\uFF08fill/type\uFF09\u5F8C\u306B\u30DA\u30FC\u30B8\u69CB\u9020\u304C\u5909\u308F\u3063\u3066\u3044\u306A\u3044\u5834\u5408\u3001\u5168ref\u3092\u4E00\u89A7\u306B\u3057\u305F\u30B3\u30F3\u30D1\u30AF\u30C8\u306A\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u304C\u8FD4\u3055\u308C\u307E\u3059\u3002
|
|
440
|
+
- \`Unfilled:\` \u306F\u307E\u3060\u64CD\u4F5C\u304C\u5FC5\u8981\u306A\u8981\u7D20\u3092\u793A\u3057\u307E\u3059
|
|
441
|
+
- \`Filled:\` \u306F\u5165\u529B\u6E08\u307F\u306E\u8981\u7D20\u3092\u793A\u3057\u307E\u3059
|
|
442
|
+
- \u30B3\u30F3\u30D1\u30AF\u30C8\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u5185\u306E\u5168ref\u306F\u6709\u52B9\u3067\u4F7F\u7528\u53EF\u80FD\u3067\u3059
|
|
443
|
+
- \u5B8C\u5168\u306A\u30DA\u30FC\u30B8\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u304C\u5FC5\u8981\u306A\u5834\u5408\u306F \`actions: []\` \u3067\u30D6\u30E9\u30A6\u30B6\u30C4\u30FC\u30EB\u3092\u547C\u3073\u51FA\u3057\u3066\u304F\u3060\u3055\u3044
|
|
444
|
+
|
|
445
|
+
## nudgeMessage \u3078\u306E\u5BFE\u5FDC
|
|
446
|
+
browser\u30C4\u30FC\u30EB\u306E\u7D50\u679C\u306B \`nudgeMessage\` \u304C\u542B\u307E\u308C\u3066\u3044\u308B\u5834\u5408\u3001\u91CD\u8981\u306A\u30AC\u30A4\u30C0\u30F3\u30B9\u304C\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u3059:
|
|
447
|
+
- **\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u9032\u6357**: \u73FE\u5728\u306E\u30DA\u30FC\u30B8\u3068\u6B8B\u308A\u30DA\u30FC\u30B8\u6570\u3092\u793A\u3057\u307E\u3059\u3002\u5168\u30DA\u30FC\u30B8\u306E\u51E6\u7406\u304C\u5B8C\u4E86\u3059\u308B\u307E\u3067\u7D9A\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
448
|
+
- **\u30EB\u30FC\u30D7\u8B66\u544A**: \u540C\u3058\u64CD\u4F5C\u3092\u7E70\u308A\u8FD4\u3057\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u5225\u306E\u30A2\u30D7\u30ED\u30FC\u30C1\u3092\u8A66\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
449
|
+
- **\u30D5\u30A9\u30FC\u30E0\u30D2\u30F3\u30C8**: \u672A\u5165\u529B\u306E\u30D5\u30A9\u30FC\u30E0\u30D5\u30A3\u30FC\u30EB\u30C9\u4E00\u89A7\u3067\u3059\u3002
|
|
450
|
+
\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u6307\u793A\u306B\u5FC5\u305A\u5F93\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
451
|
+
|
|
452
|
+
## \u8907\u5408\u30B4\u30FC\u30EB\u306E\u691C\u8A3C
|
|
453
|
+
\u30B4\u30FC\u30EB\u306B\u8907\u6570\u306E\u30B9\u30C6\u30C3\u30D7\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u5834\u5408\uFF08\u4F8B: \u300CA\u3057\u3066\u3001B\u306B\u9077\u79FB\u3057\u3001C\u3092\u5B9F\u884C\u3059\u308B\u300D\uFF09\uFF1A
|
|
454
|
+
1. \u30B4\u30FC\u30EB\u3092\u500B\u5225\u306E\u30B5\u30D6\u30BF\u30B9\u30AF\u306B\u5206\u89E3\u3059\u308B
|
|
455
|
+
2. \u5404\u30B5\u30D6\u30BF\u30B9\u30AF\u304C\u5B8C\u4E86\u3057\u305F\u304B\u3069\u3046\u304B\u3092\u73FE\u5728\u306E\u30DA\u30FC\u30B8\u72B6\u614B\u304B\u3089\u78BA\u8A8D\u3059\u308B
|
|
456
|
+
3. **\u5168\u3066\u306E\u30B5\u30D6\u30BF\u30B9\u30AF\u304C\u5B8C\u4E86\u3059\u308B\u307E\u3067 goalAchieved \u3092\u5BA3\u8A00\u3057\u306A\u3044\u3053\u3068**
|
|
457
|
+
4. \u30ED\u30B0\u30A4\u30F3\u3084\u30DA\u30FC\u30B8\u9077\u79FB\u304C\u6210\u529F\u3057\u3066\u3082\u3001\u5F8C\u7D9A\u306E\u30BF\u30B9\u30AF\u304C\u3042\u308C\u3070\u307E\u3060\u30B4\u30FC\u30EB\u306F\u672A\u9054\u6210
|
|
458
|
+
5. \u4E00\u90E8\u306E\u30B5\u30D6\u30BF\u30B9\u30AF\u304C\u5B8C\u4E86\u3057\u3066\u3044\u308B\u5834\u5408\u306F\u3001\u6B8B\u308A\u306E\u30B5\u30D6\u30BF\u30B9\u30AF\u306B\u53D6\u308A\u7D44\u307F\u7D9A\u3051\u308B\u3053\u3068\u3002\u56DE\u5FA9\u4E0D\u80FD\u306A\u30A8\u30E9\u30FC\u3084\u5168\u3066\u306E\u30A2\u30D7\u30ED\u30FC\u30C1\u3092\u8A66\u3057\u305F\u5834\u5408\u306B\u306E\u307F goalAchieved: false \u3092\u5BA3\u8A00\u3059\u308B
|
|
459
|
+
|
|
460
|
+
\u4F8B: \u30B4\u30FC\u30EB\u304C\u300C\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u30A2\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7\u3067X\u3092\u5B9F\u884C\u3059\u308B\u300D\u306E\u5834\u5408\uFF1A
|
|
461
|
+
- \u30ED\u30B0\u30A4\u30F3\u6210\u529F \u2192 \u307E\u3060 goalAchieved \u3067\u306F\u306A\u3044\uFF08\u30A2\u30AF\u30B7\u30E7\u30F3\u5B9F\u884C\u304C\u6B8B\u3063\u3066\u3044\u308B\uFF09
|
|
462
|
+
- \u30A2\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7\u3067X\u3092\u5B9F\u884C\u5B8C\u4E86 \u2192 goalAchieved: true
|
|
463
|
+
|
|
464
|
+
## \u30B4\u30FC\u30EB\u9054\u6210\u6642
|
|
465
|
+
**\u91CD\u8981: goalAchieved \u306E\u7533\u544A\u306F\u6700\u7D42\u30DA\u30FC\u30B8\u72B6\u614B\u304B\u3089\u72EC\u7ACB\u691C\u8A3C\u3055\u308C\u307E\u3059\u3002\u865A\u507D\u306E\u7533\u544A\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002**
|
|
466
|
+
|
|
467
|
+
goalAchieved: true \u3092\u5BA3\u8A00\u3059\u308B\u524D\u306B\u3001\u4EE5\u4E0B\u306E\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8\u3092\u5FC5\u305A\u5B8C\u4E86\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
468
|
+
1. **\u5143\u306E\u30B4\u30FC\u30EB\u3092\u518D\u78BA\u8A8D** \u2014 \u5168\u3066\u306E\u30B5\u30D6\u30BF\u30B9\u30AF\u306B\u5206\u89E3\u3059\u308B
|
|
469
|
+
2. **\u73FE\u5728\u306E\u30DA\u30FC\u30B8\u72B6\u614B\u3092\u78BA\u8A8D** \u2014 \u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306B\u9054\u6210\u306E\u660E\u78BA\u306A\u8A3C\u62E0\u304C\u3042\u308B\u304B\uFF1F
|
|
470
|
+
3. **\u30D5\u30A9\u30FC\u30E0\u30BF\u30B9\u30AF**: \u6210\u529F/\u78BA\u8A8D\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u8868\u793A\u3055\u308C\u3066\u3044\u308B\u304B\uFF1F\uFF08\u300C\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u5165\u529B\u3057\u305F\u300D\u3060\u3051\u3067\u306F\u4E0D\u5341\u5206 \u2014 \u30D5\u30A9\u30FC\u30E0\u304C\u9001\u4FE1\u3055\u308C\u3001\u78BA\u8A8D\u304C\u8868\u793A\u3055\u308C\u3066\u3044\u308B\u3053\u3068\uFF09
|
|
471
|
+
4. **\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30BF\u30B9\u30AF**: \u76EE\u7684\u306E\u30DA\u30FC\u30B8\u304C\u5B9F\u969B\u306B\u8868\u793A\u3055\u308C\u3066\u3044\u308B\u304B\uFF1F
|
|
472
|
+
5. **\u8907\u5408\u30B4\u30FC\u30EB**\uFF08A \u2192 B \u2192 C\uFF09: \u6700\u521D\u306E\u90E8\u5206\u3060\u3051\u3067\u306A\u304F\u3001\u5168\u30D1\u30FC\u30C8\u306E\u8A3C\u62E0\u3092\u78BA\u8A8D
|
|
473
|
+
6. **\u5931\u6557\u30B7\u30B0\u30CA\u30EB\u306E\u78BA\u8A8D**: \u30A8\u30E9\u30FC\u30E1\u30C3\u30BB\u30FC\u30B8\u3001\u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\u8B66\u544A\u3001\u30ED\u30B0\u30A4\u30F3\u30D5\u30A9\u30FC\u30E0\u304C\u307E\u3060\u8868\u793A\u3055\u308C\u3066\u3044\u306A\u3044\u304B\u3001\u300C\u518D\u8A66\u884C\u300D\u30D7\u30ED\u30F3\u30D7\u30C8\u304C\u306A\u3044\u304B
|
|
474
|
+
7. **summary \u306B\u5177\u4F53\u7684\u306A\u8A3C\u62E0\u3092\u542B\u3081\u308B**: \u5B8C\u4E86\u3092\u8A3C\u660E\u3059\u308B\u78BA\u8A8D\u30E1\u30C3\u30BB\u30FC\u30B8\u3001\u6210\u529F\u30D0\u30CA\u30FC\u3001\u30DA\u30FC\u30B8\u30BF\u30A4\u30C8\u30EB\u3092\u5F15\u7528\u3059\u308B
|
|
475
|
+
|
|
476
|
+
\u3088\u304F\u3042\u308B\u507D\u967D\u6027\u30D1\u30BF\u30FC\u30F3\uFF08\u907F\u3051\u308B\u3079\u304D\uFF09:
|
|
477
|
+
- \u30ED\u30B0\u30A4\u30F3\u5F8C\u306E\u30BF\u30B9\u30AF\u304C\u3042\u308B\u306E\u306B\u3001\u30ED\u30B0\u30A4\u30F3\u6210\u529F\u3060\u3051\u3067\u9054\u6210\u3068\u5BA3\u8A00\u3059\u308B
|
|
478
|
+
- \u30D5\u30A9\u30FC\u30E0\u5165\u529B\u5F8C\u3001\u9001\u4FE1\u524D\u306B\u9054\u6210\u3068\u5BA3\u8A00\u3059\u308B
|
|
479
|
+
- \u30DC\u30BF\u30F3\u30AF\u30EA\u30C3\u30AF\u5F8C\u3001\u78BA\u8A8D\u3092\u5F85\u305F\u305A\u306B\u9054\u6210\u3068\u5BA3\u8A00\u3059\u308B
|
|
480
|
+
- \u30DA\u30FC\u30B8\u304C\u30A8\u30E9\u30FC\u3092\u8868\u793A\u3057\u3066\u3044\u308B\u3001\u307E\u305F\u306F\u30ED\u30FC\u30C9\u4E2D\u306A\u306E\u306B\u9054\u6210\u3068\u5BA3\u8A00\u3059\u308B
|
|
481
|
+
|
|
482
|
+
\u5168\u30C1\u30A7\u30C3\u30AF\u9805\u76EE\u3092\u78BA\u8A8D\u3057\u305F\u4E0A\u3067\u3001browser\u30C4\u30FC\u30EB\u306E\u547C\u3073\u51FA\u3057\u3092\u505C\u6B62\u3057\u3001\u4EE5\u4E0B\u306EJSON\u5F62\u5F0F\u3067\u6700\u7D42\u5831\u544A\u3092\u8FD4\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
483
|
+
\`\`\`json
|
|
484
|
+
{ "goalAchieved": true, "summary": "\u8A3C\u62E0: [\u5177\u4F53\u7684\u306A\u78BA\u8A8D\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u30DA\u30FC\u30B8\u72B6\u614B]\u3002\u5B8C\u4E86: [\u5B9F\u884C\u3057\u305F\u30B5\u30D6\u30BF\u30B9\u30AF\u4E00\u89A7]" }
|
|
485
|
+
\`\`\`
|
|
486
|
+
|
|
487
|
+
\u30B4\u30FC\u30EB\u304C\u9054\u6210\u3067\u304D\u306A\u3044\u3068\u5224\u65AD\u3057\u305F\u5834\u5408:
|
|
488
|
+
\`\`\`json
|
|
489
|
+
{ "goalAchieved": false, "summary": "\u72B6\u6CC1\u306E\u8981\u7D04\u3068\u7406\u7531" }
|
|
490
|
+
\`\`\`
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
\u4EE5\u4E0B\u306F\u3053\u306E\u30BF\u30B9\u30AF\u56FA\u6709\u306E\u60C5\u5831\u3067\u3059\u3002
|
|
494
|
+
|
|
495
|
+
## \u30B4\u30FC\u30EB
|
|
496
|
+
${goal}
|
|
497
|
+
${contextSection}${secretsSection}
|
|
498
|
+
\u65E5\u672C\u8A9E\u3067\u5FDC\u7B54\u3057\u3066\u304F\u3060\u3055\u3044\u3002`;
|
|
499
|
+
}
|
|
500
|
+
function getInitialUserMessage2() {
|
|
501
|
+
return "browser\u30C4\u30FC\u30EB\u3092actions:[]\uFF08\u7A7A\u914D\u5217\uFF09\u3067\u547C\u3073\u51FA\u3057\u3001\u73FE\u5728\u306E\u30DA\u30FC\u30B8\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u305D\u306E\u5F8C\u3001\u30B4\u30FC\u30EB\u9054\u6210\u306B\u5411\u3051\u3066\u63A2\u7D22\u3092\u958B\u59CB\u3057\u3066\u304F\u3060\u3055\u3044\u3002";
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// src/i18n/prompts/en/review.ts
|
|
505
|
+
function getReviewSystemPrompt() {
|
|
506
|
+
return `You are an expert reviewer of web browser automation procedures.
|
|
507
|
+
|
|
508
|
+
## Task
|
|
509
|
+
Analyze the recorded steps and determine the following:
|
|
510
|
+
|
|
511
|
+
1. **Remove unnecessary steps**: Identify and exclude trial-and-error during exploration, dead ends, unnecessary navigation, and duplicate operations
|
|
512
|
+
2. **Risk level assessment**: Assess the risk of each step
|
|
513
|
+
- \`low\`: Low side-effect operations like input, scrolling, navigation
|
|
514
|
+
- \`medium\`: Login, form submission, settings changes, etc.
|
|
515
|
+
- \`high\`: Irreversible operations like deletion, payment, data modification
|
|
516
|
+
3. **Approval requirement**: Whether user approval is needed before execution
|
|
517
|
+
|
|
518
|
+
## Capture Candidate Identification
|
|
519
|
+
If you detect important data used in subsequent steps (IDs, order numbers, URL changes, amounts, etc.),
|
|
520
|
+
include them as suggestedCaptures in each step's response.
|
|
521
|
+
Available strategies: snapshot (regex), url (URL regex), ai (AI extraction), expression (template)
|
|
522
|
+
|
|
523
|
+
## Notes
|
|
524
|
+
- Failed steps (success=false) should generally be excluded
|
|
525
|
+
- Keep only the shortest path steps needed to achieve the goal
|
|
526
|
+
- riskLevel is used in the Chrome extension approval flow (medium/high requires approval)
|
|
527
|
+
- Respond in English`;
|
|
528
|
+
}
|
|
529
|
+
function createReviewUserPrompt(goal, recordedSteps, goalAchieved, interventions) {
|
|
530
|
+
const stepsList = recordedSteps.map(
|
|
531
|
+
(s) => `${s.ordinal}. [${s.success ? "OK" : "FAIL"}] ${s.action.description} (action: ${s.action.action}, url: ${s.url})${s.error ? ` Error: ${s.error}` : ""}`
|
|
532
|
+
).join("\n");
|
|
533
|
+
const interventionsSection = interventions && interventions.length > 0 ? `
|
|
534
|
+
## User Interventions During Exploration
|
|
535
|
+
The user modified the exploration direction at the following points.
|
|
536
|
+
Steps before the intervention likely contain trial-and-error, while steps after are more accurate.
|
|
537
|
+
|
|
538
|
+
${interventions.map(
|
|
539
|
+
(iv, i) => `${i + 1}. Around step #${iv.stepIndex}: "${iv.userInstruction}" (URL: ${iv.url})`
|
|
540
|
+
).join("\n")}
|
|
541
|
+
|
|
542
|
+
**Review note**: Actively exclude unnecessary steps before intervention points.
|
|
543
|
+
` : "";
|
|
544
|
+
return `## Goal
|
|
545
|
+
${goal}
|
|
546
|
+
|
|
547
|
+
## Goal Achievement Status
|
|
548
|
+
${goalAchieved ? "Achieved" : "Not achieved"}
|
|
549
|
+
${interventionsSection}
|
|
550
|
+
## All Recorded Steps
|
|
551
|
+
${stepsList}`;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// src/i18n/prompts/ja/review.ts
|
|
555
|
+
function getReviewSystemPrompt2() {
|
|
556
|
+
return `\u3042\u306A\u305F\u306FWeb\u30D6\u30E9\u30A6\u30B6\u81EA\u52D5\u64CD\u4F5C\u306E\u624B\u9806\u66F8\u3092\u30EC\u30D3\u30E5\u30FC\u3059\u308B\u30A8\u30AD\u30B9\u30D1\u30FC\u30C8\u3067\u3059\u3002
|
|
557
|
+
|
|
558
|
+
## \u30BF\u30B9\u30AF
|
|
559
|
+
\u8A18\u9332\u3055\u308C\u305F\u30B9\u30C6\u30C3\u30D7\u3092\u5206\u6790\u3057\u3001\u4EE5\u4E0B\u3092\u5224\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
560
|
+
|
|
561
|
+
1. **\u4E0D\u8981\u30B9\u30C6\u30C3\u30D7\u306E\u9664\u5916**: \u63A2\u7D22\u4E2D\u306E\u8A66\u884C\u932F\u8AA4\u3001\u884C\u304D\u6B62\u307E\u308A\u3001\u4E0D\u8981\u306A\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u3001\u91CD\u8907\u64CD\u4F5C\u3092\u7279\u5B9A\u3057\u9664\u5916
|
|
562
|
+
2. **\u30EA\u30B9\u30AF\u30EC\u30D9\u30EB\u5224\u5B9A**: \u5404\u30B9\u30C6\u30C3\u30D7\u306E\u30EA\u30B9\u30AF\u3092\u5224\u5B9A
|
|
563
|
+
- \`low\`: \u5165\u529B\u3001\u30B9\u30AF\u30ED\u30FC\u30EB\u3001\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u306A\u3069\u526F\u4F5C\u7528\u306E\u5C11\u306A\u3044\u64CD\u4F5C
|
|
564
|
+
- \`medium\`: \u30ED\u30B0\u30A4\u30F3\u3001\u30D5\u30A9\u30FC\u30E0\u9001\u4FE1\u3001\u8A2D\u5B9A\u5909\u66F4\u306A\u3069
|
|
565
|
+
- \`high\`: \u524A\u9664\u3001\u6C7A\u6E08\u3001\u30C7\u30FC\u30BF\u5909\u66F4\u306A\u3069\u4E0D\u53EF\u9006\u306A\u64CD\u4F5C
|
|
566
|
+
3. **\u627F\u8A8D\u8981\u5426\u5224\u5B9A**: \u5B9F\u884C\u524D\u306B\u30E6\u30FC\u30B6\u30FC\u627F\u8A8D\u304C\u5FC5\u8981\u304B\u3069\u3046\u304B
|
|
567
|
+
|
|
568
|
+
## \u30AD\u30E3\u30D7\u30C1\u30E3\u5019\u88DC\u306E\u8B58\u5225
|
|
569
|
+
\u64CD\u4F5C\u7D50\u679C\u3068\u3057\u3066\u5F8C\u7D9A\u30B9\u30C6\u30C3\u30D7\u3067\u4F7F\u7528\u3055\u308C\u308B\u91CD\u8981\u306A\u30C7\u30FC\u30BF\uFF08ID\u3001\u6CE8\u6587\u756A\u53F7\u3001URL\u5909\u5316\u3001\u91D1\u984D\u306A\u3069\uFF09\u3092\u691C\u51FA\u3057\u305F\u5834\u5408\u3001
|
|
570
|
+
suggestedCaptures \u3068\u3057\u3066\u30EC\u30B9\u30DD\u30F3\u30B9\u306E\u5404\u30B9\u30C6\u30C3\u30D7\u306B\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002
|
|
571
|
+
\u5229\u7528\u53EF\u80FD\u306A strategy: snapshot\uFF08\u6B63\u898F\u8868\u73FE\uFF09, url\uFF08URL\u6B63\u898F\u8868\u73FE\uFF09, ai\uFF08AI\u62BD\u51FA\uFF09, expression\uFF08\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\uFF09
|
|
572
|
+
|
|
573
|
+
## \u6CE8\u610F\u4E8B\u9805
|
|
574
|
+
- \u5931\u6557\u30B9\u30C6\u30C3\u30D7\uFF08success=false\uFF09\u306F\u57FA\u672C\u7684\u306B\u9664\u5916\u3057\u3066\u304F\u3060\u3055\u3044
|
|
575
|
+
- \u30B4\u30FC\u30EB\u9054\u6210\u306B\u5FC5\u8981\u306A\u6700\u77ED\u7D4C\u8DEF\u306E\u30B9\u30C6\u30C3\u30D7\u306E\u307F\u6B8B\u3057\u3066\u304F\u3060\u3055\u3044
|
|
576
|
+
- riskLevel \u306F Chrome\u62E1\u5F35\u306E\u627F\u8A8D\u30D5\u30ED\u30FC\u3067\u4F7F\u7528\u3055\u308C\u307E\u3059\uFF08medium/high \u306F\u627F\u8A8D\u304C\u5FC5\u8981\uFF09
|
|
577
|
+
- \u65E5\u672C\u8A9E\u3067\u5FDC\u7B54\u3057\u3066\u304F\u3060\u3055\u3044`;
|
|
578
|
+
}
|
|
579
|
+
function createReviewUserPrompt2(goal, recordedSteps, goalAchieved, interventions) {
|
|
580
|
+
const stepsList = recordedSteps.map(
|
|
581
|
+
(s) => `${s.ordinal}. [${s.success ? "\u6210\u529F" : "\u5931\u6557"}] ${s.action.description} (action: ${s.action.action}, url: ${s.url})${s.error ? ` \u30A8\u30E9\u30FC: ${s.error}` : ""}`
|
|
582
|
+
).join("\n");
|
|
583
|
+
const interventionsSection = interventions && interventions.length > 0 ? `
|
|
584
|
+
## \u63A2\u7D22\u4E2D\u306E\u30E6\u30FC\u30B6\u30FC\u4ECB\u5165
|
|
585
|
+
\u4EE5\u4E0B\u306E\u30BF\u30A4\u30DF\u30F3\u30B0\u3067\u30E6\u30FC\u30B6\u30FC\u304C\u63A2\u7D22\u65B9\u91DD\u3092\u4FEE\u6B63\u3057\u307E\u3057\u305F\u3002
|
|
586
|
+
\u4ECB\u5165\u524D\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u306F\u63A2\u7D22\u306E\u8A66\u884C\u932F\u8AA4\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u9AD8\u304F\u3001\u4ECB\u5165\u5F8C\u306E\u30B9\u30C6\u30C3\u30D7\u304C\u3088\u308A\u6B63\u78BA\u306A\u624B\u9806\u3067\u3059\u3002
|
|
587
|
+
|
|
588
|
+
${interventions.map(
|
|
589
|
+
(iv, i) => `${i + 1}. \u30B9\u30C6\u30C3\u30D7#${iv.stepIndex}\u4ED8\u8FD1: "${iv.userInstruction}" (URL: ${iv.url})`
|
|
590
|
+
).join("\n")}
|
|
591
|
+
|
|
592
|
+
**\u30EC\u30D3\u30E5\u30FC\u6642\u306E\u6CE8\u610F**: \u4ECB\u5165\u30DD\u30A4\u30F3\u30C8\u3088\u308A\u524D\u306E\u4E0D\u8981\u306A\u30B9\u30C6\u30C3\u30D7\u306F\u7A4D\u6975\u7684\u306B\u9664\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
593
|
+
` : "";
|
|
594
|
+
return `## \u30B4\u30FC\u30EB
|
|
595
|
+
${goal}
|
|
596
|
+
|
|
597
|
+
## \u30B4\u30FC\u30EB\u9054\u6210\u72B6\u6CC1
|
|
598
|
+
${goalAchieved ? "\u9054\u6210\u6E08\u307F" : "\u672A\u9054\u6210"}
|
|
599
|
+
${interventionsSection}
|
|
600
|
+
## \u8A18\u9332\u3055\u308C\u305F\u5168\u30B9\u30C6\u30C3\u30D7
|
|
601
|
+
${stepsList}`;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// src/i18n/prompts/en/selector.ts
|
|
605
|
+
function buildSelectorMessages(snapshot, selector, stepDescription, url, contextMarkdown, retryContext, workingMemorySummary) {
|
|
606
|
+
const system = [
|
|
607
|
+
"You are a selector resolver for browser automation.",
|
|
608
|
+
"Based on the step description, identify the target element in the accessibility snapshot.",
|
|
609
|
+
"",
|
|
610
|
+
"## Matching Guidelines",
|
|
611
|
+
"1. Infer the type of target element (button, input field, link, etc.) from the step description",
|
|
612
|
+
"2. Find the element in the snapshot that semantically best matches the step description",
|
|
613
|
+
"3. Use surrounding text, labels, placeholders, and roles as clues",
|
|
614
|
+
"4. Even without an exact match, return the ref of the most likely element",
|
|
615
|
+
"5. Return an empty string only if the target element truly does not exist in the snapshot"
|
|
616
|
+
].join("\n");
|
|
617
|
+
const parts = [
|
|
618
|
+
"## Step Description (Most Important)",
|
|
619
|
+
stepDescription,
|
|
620
|
+
"",
|
|
621
|
+
"## Selector Hints (Reference)",
|
|
622
|
+
"The following is reference information for identifying the element. Even without an exact match, choose the element semantically closest to the step description.",
|
|
623
|
+
JSON.stringify(pruneSelectorHints(selector)),
|
|
624
|
+
"",
|
|
625
|
+
"Notes:",
|
|
626
|
+
'- If tagName is "unknown" or ":", there is no tag name information',
|
|
627
|
+
"- ariaLabel is auto-generated from the step description and may not match the actual aria-label attribute",
|
|
628
|
+
"- Prioritize semantic match with the step description over exact selector match",
|
|
629
|
+
"",
|
|
630
|
+
"## Current URL",
|
|
631
|
+
url
|
|
632
|
+
];
|
|
633
|
+
if (workingMemorySummary) {
|
|
634
|
+
parts.push("", "## Execution Context", workingMemorySummary);
|
|
635
|
+
}
|
|
636
|
+
parts.push(
|
|
637
|
+
"",
|
|
638
|
+
"## Accessibility Snapshot",
|
|
639
|
+
snapshot
|
|
640
|
+
);
|
|
641
|
+
const includeContext = contextMarkdown && !(retryContext && retryContext.attempt > 0);
|
|
642
|
+
if (includeContext) {
|
|
643
|
+
parts.push("", "## Supplementary Context", contextMarkdown);
|
|
644
|
+
}
|
|
645
|
+
if (retryContext && retryContext.attempt > 0) {
|
|
646
|
+
parts.push(
|
|
647
|
+
"",
|
|
648
|
+
"## Recovery Context (Attempt " + (retryContext.attempt + 1) + ")"
|
|
649
|
+
);
|
|
650
|
+
if (retryContext.failureHints) {
|
|
651
|
+
parts.push(`Pattern: ${retryContext.failureHints}`);
|
|
652
|
+
}
|
|
653
|
+
if (retryContext.failureHistory.length > 0) {
|
|
654
|
+
const recent = retryContext.failureHistory.slice(-2);
|
|
655
|
+
parts.push(`Previous: ${recent.join("; ")}`);
|
|
656
|
+
}
|
|
657
|
+
if (retryContext.previousAiResponse) {
|
|
658
|
+
try {
|
|
659
|
+
const parsed = JSON.parse(retryContext.previousAiResponse);
|
|
660
|
+
if (parsed.reasoning) {
|
|
661
|
+
parts.push(`Last reasoning: "${parsed.reasoning}"`);
|
|
662
|
+
}
|
|
663
|
+
} catch {
|
|
664
|
+
parts.push(`Last response: ${retryContext.previousAiResponse.slice(0, 200)}`);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (!retryContext.snapshotChanged) {
|
|
668
|
+
parts.push(
|
|
669
|
+
"Snapshot unchanged \u2014 try partial matching, role-based matching, or inference from nearby elements."
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return { system, userPrompt: parts.join("\n") };
|
|
674
|
+
}
|
|
675
|
+
function pruneSelectorHints(selector) {
|
|
676
|
+
const pruned = {};
|
|
677
|
+
for (const [key, value] of Object.entries(selector)) {
|
|
678
|
+
if (value === null || value === void 0 || value === "" || value === "unknown" || value === ":") continue;
|
|
679
|
+
pruned[key] = value;
|
|
680
|
+
}
|
|
681
|
+
return pruned;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// src/i18n/prompts/ja/selector.ts
|
|
685
|
+
function buildSelectorMessages2(snapshot, selector, stepDescription, url, contextMarkdown, retryContext, workingMemorySummary) {
|
|
686
|
+
const system = [
|
|
687
|
+
"\u3042\u306A\u305F\u306F\u30D6\u30E9\u30A6\u30B6\u81EA\u52D5\u64CD\u4F5C\u306E\u30BB\u30EC\u30AF\u30BF\u30EA\u30BE\u30EB\u30D0\u30FC\u3067\u3059\u3002",
|
|
688
|
+
"\u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\u306B\u57FA\u3065\u3044\u3066\u3001\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u5185\u306E\u64CD\u4F5C\u5BFE\u8C61\u8981\u7D20\u3092\u7279\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
689
|
+
"",
|
|
690
|
+
"## \u30DE\u30C3\u30C1\u30F3\u30B0\u306E\u6307\u91DD",
|
|
691
|
+
"1. \u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\u304B\u3089\u64CD\u4F5C\u5BFE\u8C61\u306E\u8981\u7D20\u306E\u7A2E\u985E\uFF08\u30DC\u30BF\u30F3\u3001\u5165\u529B\u30D5\u30A3\u30FC\u30EB\u30C9\u3001\u30EA\u30F3\u30AF\u7B49\uFF09\u3092\u63A8\u5B9A\u3059\u308B",
|
|
692
|
+
"2. \u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u5185\u3067\u3001\u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\u3068\u610F\u5473\u7684\u306B\u6700\u3082\u4E00\u81F4\u3059\u308B\u8981\u7D20\u3092\u63A2\u3059",
|
|
693
|
+
"3. \u5468\u8FBA\u306E\u30C6\u30AD\u30B9\u30C8\u3001\u30E9\u30D9\u30EB\u3001\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u3001role \u3082\u624B\u304C\u304B\u308A\u306B\u3059\u308B",
|
|
694
|
+
"4. \u5B8C\u5168\u4E00\u81F4\u304C\u306A\u304F\u3066\u3082\u6700\u3082\u53EF\u80FD\u6027\u306E\u9AD8\u3044\u8981\u7D20\u306E ref \u3092\u8FD4\u3059",
|
|
695
|
+
"5. \u8A72\u5F53\u3059\u308B\u8981\u7D20\u304C\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u5185\u306B\u672C\u5F53\u306B\u5B58\u5728\u3057\u306A\u3044\u5834\u5408\u306E\u307F\u7A7A\u6587\u5B57\u3092\u8FD4\u3059"
|
|
696
|
+
].join("\n");
|
|
697
|
+
const parts = [
|
|
698
|
+
"## \u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\uFF08\u6700\u91CD\u8981\uFF09",
|
|
699
|
+
stepDescription,
|
|
700
|
+
"",
|
|
701
|
+
"## \u30BB\u30EC\u30AF\u30BF\u306E\u30D2\u30F3\u30C8\uFF08\u53C2\u8003\u60C5\u5831\uFF09",
|
|
702
|
+
"\u4EE5\u4E0B\u306F\u8981\u7D20\u3092\u7279\u5B9A\u3059\u308B\u305F\u3081\u306E\u53C2\u8003\u60C5\u5831\u3067\u3059\u3002\u5B8C\u5168\u4E00\u81F4\u3057\u306A\u3044\u5834\u5408\u3067\u3082\u3001\u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\u304B\u3089\u610F\u5473\u7684\u306B\u6700\u3082\u8FD1\u3044\u8981\u7D20\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",
|
|
703
|
+
JSON.stringify(pruneSelectorHints2(selector)),
|
|
704
|
+
"",
|
|
705
|
+
"\u6CE8\u610F:",
|
|
706
|
+
'- tagName \u304C "unknown" \u3084 ":" \u306E\u5834\u5408\u306F\u30BF\u30B0\u540D\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093',
|
|
707
|
+
"- ariaLabel \u306F\u30B9\u30C6\u30C3\u30D7\u8AAC\u660E\u304B\u3089\u81EA\u52D5\u751F\u6210\u3055\u308C\u305F\u3082\u306E\u3067\u3042\u308A\u3001\u5B9F\u969B\u306E aria-label \u5C5E\u6027\u3068\u4E00\u81F4\u3057\u306A\u3044\u3053\u3068\u304C\u3042\u308A\u307E\u3059",
|
|
708
|
+
"- \u30BB\u30EC\u30AF\u30BF\u306E\u5B8C\u5168\u4E00\u81F4\u3088\u308A\u3082\u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\u3068\u306E\u610F\u5473\u7684\u4E00\u81F4\u3092\u512A\u5148\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
709
|
+
"",
|
|
710
|
+
"## \u73FE\u5728\u306EURL",
|
|
711
|
+
url
|
|
712
|
+
];
|
|
713
|
+
if (workingMemorySummary) {
|
|
714
|
+
parts.push("", "## \u5B9F\u884C\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8", workingMemorySummary);
|
|
715
|
+
}
|
|
716
|
+
parts.push(
|
|
717
|
+
"",
|
|
718
|
+
"## \u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8",
|
|
719
|
+
snapshot
|
|
720
|
+
);
|
|
721
|
+
const includeContext = contextMarkdown && !(retryContext && retryContext.attempt > 0);
|
|
722
|
+
if (includeContext) {
|
|
723
|
+
parts.push("", "## \u88DC\u8DB3\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8", contextMarkdown);
|
|
724
|
+
}
|
|
725
|
+
if (retryContext && retryContext.attempt > 0) {
|
|
726
|
+
parts.push(
|
|
727
|
+
"",
|
|
728
|
+
"## \u56DE\u5FA9\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\uFF08\u8A66\u884C" + (retryContext.attempt + 1) + "\u56DE\u76EE\uFF09"
|
|
729
|
+
);
|
|
730
|
+
if (retryContext.failureHints) {
|
|
731
|
+
parts.push(`\u30D1\u30BF\u30FC\u30F3: ${retryContext.failureHints}`);
|
|
732
|
+
}
|
|
733
|
+
if (retryContext.failureHistory.length > 0) {
|
|
734
|
+
const recent = retryContext.failureHistory.slice(-2);
|
|
735
|
+
parts.push(`\u76F4\u8FD1\u306E\u5931\u6557: ${recent.join("; ")}`);
|
|
736
|
+
}
|
|
737
|
+
if (retryContext.previousAiResponse) {
|
|
738
|
+
try {
|
|
739
|
+
const parsed = JSON.parse(retryContext.previousAiResponse);
|
|
740
|
+
if (parsed.reasoning) {
|
|
741
|
+
parts.push(`\u524D\u56DE\u306E\u63A8\u8AD6: "${parsed.reasoning}"`);
|
|
742
|
+
}
|
|
743
|
+
} catch {
|
|
744
|
+
parts.push(`\u524D\u56DE\u306E\u5FDC\u7B54: ${retryContext.previousAiResponse.slice(0, 200)}`);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
if (!retryContext.snapshotChanged) {
|
|
748
|
+
parts.push(
|
|
749
|
+
"\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u672A\u5909\u5316 \u2014 \u90E8\u5206\u4E00\u81F4\u3001role\u30D9\u30FC\u30B9\u306E\u30DE\u30C3\u30C1\u30F3\u30B0\u3001\u8FD1\u63A5\u8981\u7D20\u304B\u3089\u306E\u63A8\u5B9A\u3092\u8A66\u307F\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
return { system, userPrompt: parts.join("\n") };
|
|
754
|
+
}
|
|
755
|
+
function pruneSelectorHints2(selector) {
|
|
756
|
+
const pruned = {};
|
|
757
|
+
for (const [key, value] of Object.entries(selector)) {
|
|
758
|
+
if (value === null || value === void 0 || value === "" || value === "unknown" || value === ":") continue;
|
|
759
|
+
pruned[key] = value;
|
|
760
|
+
}
|
|
761
|
+
return pruned;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// src/i18n/prompts/en/goal-agent.ts
|
|
765
|
+
function buildFallbackMessages(snapshot, step, failureHistory, url, contextMarkdown) {
|
|
766
|
+
const system = [
|
|
767
|
+
"You are a problem-solving agent for browser automation.",
|
|
768
|
+
"Normal selector resolution has failed at all phases. Analyze the entire page and find an alternative operation path.",
|
|
769
|
+
"",
|
|
770
|
+
"## Alternative Path Search Guidelines",
|
|
771
|
+
"1. Check if the target element is hidden inside a hamburger menu, dropdown, or accordion",
|
|
772
|
+
"2. Check if a modal or overlay is covering the target element",
|
|
773
|
+
"3. Check if the page is in an unexpected state (not logged in, error state, loading)",
|
|
774
|
+
"4. Check if the target element is above the current scroll position",
|
|
775
|
+
"5. Check if a semantically equivalent alternative element exists (e.g., a button instead of a link)",
|
|
776
|
+
"",
|
|
777
|
+
"## Alternative Strategy Selection Criteria",
|
|
778
|
+
"- direct_ref: Try a different ref directly (when a semantically equivalent element is found)",
|
|
779
|
+
"- scroll_up_and_retry: When the target element might be above the current view",
|
|
780
|
+
"- expand_collapsed: When a collapsed section/menu needs to be expanded (prerequisiteRef required)",
|
|
781
|
+
"- dismiss_overlay: When a modal/overlay needs to be closed (prerequisiteRef required)",
|
|
782
|
+
"- tab_navigation: When the element can be reached via Tab key focus navigation",
|
|
783
|
+
"- not_found: When the target element truly does not exist on the page"
|
|
784
|
+
].join("\n");
|
|
785
|
+
const parts = [
|
|
786
|
+
"## Step Being Attempted",
|
|
787
|
+
`Description: ${step.description}`,
|
|
788
|
+
`Action: ${step.action.type}`,
|
|
789
|
+
`Selector hints: ${JSON.stringify(step.action.selector, null, 2)}`,
|
|
790
|
+
`URL: ${url}`,
|
|
791
|
+
"",
|
|
792
|
+
"## Failure History",
|
|
793
|
+
...failureHistory.map((f, i) => ` ${i + 1}. ${f}`),
|
|
794
|
+
"",
|
|
795
|
+
"## Current Page Snapshot (Filtered)",
|
|
796
|
+
snapshot
|
|
797
|
+
];
|
|
798
|
+
if (contextMarkdown) {
|
|
799
|
+
parts.push("", "## Supplementary Context", contextMarkdown);
|
|
800
|
+
}
|
|
801
|
+
return { system, userPrompt: parts.join("\n") };
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// src/i18n/prompts/ja/goal-agent.ts
|
|
805
|
+
function buildFallbackMessages2(snapshot, step, failureHistory, url, contextMarkdown) {
|
|
806
|
+
const system = [
|
|
807
|
+
"\u3042\u306A\u305F\u306F\u30D6\u30E9\u30A6\u30B6\u81EA\u52D5\u64CD\u4F5C\u306E\u554F\u984C\u89E3\u6C7A\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3067\u3059\u3002",
|
|
808
|
+
"\u901A\u5E38\u306E\u30BB\u30EC\u30AF\u30BF\u89E3\u6C7A\u304C\u5168\u30D5\u30A7\u30FC\u30BA\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u30DA\u30FC\u30B8\u5168\u4F53\u3092\u5206\u6790\u3057\u3066\u4EE3\u66FF\u64CD\u4F5C\u30D1\u30B9\u3092\u898B\u3064\u3051\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
809
|
+
"",
|
|
810
|
+
"## \u4EE3\u66FF\u30D1\u30B9\u63A2\u7D22\u306E\u6307\u91DD",
|
|
811
|
+
"1. \u30CF\u30F3\u30D0\u30FC\u30AC\u30FC\u30E1\u30CB\u30E5\u30FC\u3001\u30C9\u30ED\u30C3\u30D7\u30C0\u30A6\u30F3\u3001\u30A2\u30B3\u30FC\u30C7\u30A3\u30AA\u30F3\u306E\u4E2D\u306B\u5BFE\u8C61\u8981\u7D20\u304C\u96A0\u308C\u3066\u3044\u306A\u3044\u304B\u78BA\u8A8D",
|
|
812
|
+
"2. \u30E2\u30FC\u30C0\u30EB\u3084\u30AA\u30FC\u30D0\u30FC\u30EC\u30A4\u304C\u524D\u9762\u306B\u3042\u3063\u3066\u5BFE\u8C61\u8981\u7D20\u3092\u96A0\u3057\u3066\u3044\u306A\u3044\u304B\u78BA\u8A8D",
|
|
813
|
+
"3. \u30DA\u30FC\u30B8\u304C\u60F3\u5B9A\u3068\u7570\u306A\u308B\u72B6\u614B\uFF08\u672A\u30ED\u30B0\u30A4\u30F3\u3001\u30A8\u30E9\u30FC\u72B6\u614B\u3001\u30ED\u30FC\u30C7\u30A3\u30F3\u30B0\u4E2D\uFF09\u3067\u306A\u3044\u304B\u78BA\u8A8D",
|
|
814
|
+
"4. \u5BFE\u8C61\u8981\u7D20\u304C\u4E0A\u65B9\u306B\u3042\u3063\u3066\u30B9\u30AF\u30ED\u30FC\u30EB\u3067\u96A0\u308C\u3066\u3044\u306A\u3044\u304B\u78BA\u8A8D",
|
|
815
|
+
"5. \u610F\u5473\u7684\u306B\u540C\u7B49\u306A\u5225\u306E\u8981\u7D20\uFF08\u30EA\u30F3\u30AF\u3067\u306F\u306A\u304F\u30DC\u30BF\u30F3\u3001\u7B49\uFF09\u304C\u5B58\u5728\u3057\u306A\u3044\u304B\u78BA\u8A8D",
|
|
816
|
+
"",
|
|
817
|
+
"## \u4EE3\u66FF\u6226\u7565\u306E\u9078\u629E\u57FA\u6E96",
|
|
818
|
+
"- direct_ref: \u5225\u306E ref \u3092\u76F4\u63A5\u8A66\u3059\uFF08\u610F\u5473\u7684\u306B\u540C\u7B49\u306A\u8981\u7D20\u304C\u898B\u3064\u304B\u3063\u305F\u5834\u5408\uFF09",
|
|
819
|
+
"- scroll_up_and_retry: \u5BFE\u8C61\u8981\u7D20\u304C\u4E0A\u65B9\u306B\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308B\u5834\u5408",
|
|
820
|
+
"- expand_collapsed: \u6298\u308A\u7573\u307E\u308C\u305F\u30BB\u30AF\u30B7\u30E7\u30F3/\u30E1\u30CB\u30E5\u30FC\u3092\u5C55\u958B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u5834\u5408\uFF08prerequisiteRef \u5FC5\u9808\uFF09",
|
|
821
|
+
"- dismiss_overlay: \u30E2\u30FC\u30C0\u30EB/\u30AA\u30FC\u30D0\u30FC\u30EC\u30A4\u3092\u9589\u3058\u308B\u5FC5\u8981\u304C\u3042\u308B\u5834\u5408\uFF08prerequisiteRef \u5FC5\u9808\uFF09",
|
|
822
|
+
"- tab_navigation: Tab \u30AD\u30FC\u3067\u30D5\u30A9\u30FC\u30AB\u30B9\u79FB\u52D5\u3057\u3066\u5230\u9054\u3067\u304D\u308B\u5834\u5408",
|
|
823
|
+
"- not_found: \u672C\u5F53\u306B\u30DA\u30FC\u30B8\u4E0A\u306B\u5BFE\u8C61\u8981\u7D20\u304C\u5B58\u5728\u3057\u306A\u3044\u5834\u5408"
|
|
824
|
+
].join("\n");
|
|
825
|
+
const parts = [
|
|
826
|
+
"## \u9054\u6210\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u305F\u30B9\u30C6\u30C3\u30D7",
|
|
827
|
+
`\u8AAC\u660E: ${step.description}`,
|
|
828
|
+
`\u30A2\u30AF\u30B7\u30E7\u30F3: ${step.action.type}`,
|
|
829
|
+
`\u30BB\u30EC\u30AF\u30BF\u30D2\u30F3\u30C8: ${JSON.stringify(step.action.selector, null, 2)}`,
|
|
830
|
+
`URL: ${url}`,
|
|
831
|
+
"",
|
|
832
|
+
"## \u3053\u308C\u307E\u3067\u306E\u5931\u6557\u5C65\u6B74",
|
|
833
|
+
...failureHistory.map((f, i) => ` ${i + 1}. ${f}`),
|
|
834
|
+
"",
|
|
835
|
+
"## \u73FE\u5728\u306E\u30DA\u30FC\u30B8\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\uFF08\u30D5\u30A3\u30EB\u30BF\u6E08\u307F\uFF09",
|
|
836
|
+
snapshot
|
|
837
|
+
];
|
|
838
|
+
if (contextMarkdown) {
|
|
839
|
+
parts.push("", "## \u88DC\u8DB3\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8", contextMarkdown);
|
|
840
|
+
}
|
|
841
|
+
return { system, userPrompt: parts.join("\n") };
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// src/i18n/prompts/en/vision.ts
|
|
845
|
+
function buildVisionMessages(annotations, selector, stepDescription, url, failureHistory) {
|
|
846
|
+
const system = [
|
|
847
|
+
"You are a visual selector resolver for browser automation.",
|
|
848
|
+
"The text-based accessibility tree could not find the element.",
|
|
849
|
+
"Analyze the screenshot visually to identify the target element.",
|
|
850
|
+
"",
|
|
851
|
+
"## How to Read the Screenshot",
|
|
852
|
+
"- Each interactive element has a red border and number label",
|
|
853
|
+
"- Number labels are displayed at the top-left of each element",
|
|
854
|
+
"- Each number corresponds to the number field in the annotation list below",
|
|
855
|
+
"",
|
|
856
|
+
"## Matching Guidelines",
|
|
857
|
+
"1. Infer the type of target element (button, input field, link, etc.) from the step description",
|
|
858
|
+
"2. Find the element in the screenshot that visually best matches",
|
|
859
|
+
"3. Use element text, position, and appearance as clues",
|
|
860
|
+
"4. Also reference the role and name from the annotation list",
|
|
861
|
+
"5. Target elements not in the A11y tree (canvas, Shadow DOM, iframe, etc.) are also in scope",
|
|
862
|
+
"6. Return empty string if confidence is low (below 0.5)"
|
|
863
|
+
].join("\n");
|
|
864
|
+
const annotationList = annotations.map((a) => {
|
|
865
|
+
const nameStr = a.name ? ` "${a.name}"` : "";
|
|
866
|
+
return ` #${a.number} ref=${a.ref} ${a.role}${nameStr} @(${a.box.x},${a.box.y})`;
|
|
867
|
+
}).join("\n");
|
|
868
|
+
const selectorHints = pruneSelectorHints3(selector);
|
|
869
|
+
const parts = [
|
|
870
|
+
"## Step Description (Most Important)",
|
|
871
|
+
stepDescription,
|
|
872
|
+
"",
|
|
873
|
+
"## Selector Hints (Reference)",
|
|
874
|
+
JSON.stringify(selectorHints),
|
|
875
|
+
"",
|
|
876
|
+
"## Current URL",
|
|
877
|
+
url,
|
|
878
|
+
"",
|
|
879
|
+
"## Annotation List (Corresponds to Numbers on Screenshot)",
|
|
880
|
+
annotationList
|
|
881
|
+
];
|
|
882
|
+
if (failureHistory.length > 0) {
|
|
883
|
+
const recent = failureHistory.slice(-3);
|
|
884
|
+
parts.push(
|
|
885
|
+
"",
|
|
886
|
+
"## Text-based Resolution Failure History (Recent 3)",
|
|
887
|
+
...recent.map((f, i) => ` ${i + 1}. ${f}`)
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
return { system, userTextContent: parts.join("\n") };
|
|
891
|
+
}
|
|
892
|
+
function pruneSelectorHints3(selector) {
|
|
893
|
+
const pruned = {};
|
|
894
|
+
for (const [key, value] of Object.entries(selector)) {
|
|
895
|
+
if (value === null || value === void 0 || value === "" || value === "unknown" || value === ":") continue;
|
|
896
|
+
pruned[key] = value;
|
|
897
|
+
}
|
|
898
|
+
return pruned;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// src/i18n/prompts/ja/vision.ts
|
|
902
|
+
function buildVisionMessages2(annotations, selector, stepDescription, url, failureHistory) {
|
|
903
|
+
const system = [
|
|
904
|
+
"\u3042\u306A\u305F\u306F\u30D6\u30E9\u30A6\u30B6\u81EA\u52D5\u64CD\u4F5C\u306E\u30D3\u30B8\u30E5\u30A2\u30EB\u30BB\u30EC\u30AF\u30BF\u30EA\u30BE\u30EB\u30D0\u30FC\u3067\u3059\u3002",
|
|
905
|
+
"\u30C6\u30AD\u30B9\u30C8\u30D9\u30FC\u30B9\u306E\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u30C4\u30EA\u30FC\u3067\u306F\u8981\u7D20\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
|
|
906
|
+
"\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u3092\u8996\u899A\u7684\u306B\u5206\u6790\u3057\u3066\u3001\u64CD\u4F5C\u5BFE\u8C61\u306E\u8981\u7D20\u3092\u7279\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
907
|
+
"",
|
|
908
|
+
"## \u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306E\u898B\u65B9",
|
|
909
|
+
"- \u5404\u30A4\u30F3\u30BF\u30E9\u30AF\u30C6\u30A3\u30D6\u8981\u7D20\u306B\u8D64\u3044\u67A0\u7DDA\u3068\u756A\u53F7\u30E9\u30D9\u30EB\u304C\u8868\u793A\u3055\u308C\u3066\u3044\u307E\u3059",
|
|
910
|
+
"- \u756A\u53F7\u30E9\u30D9\u30EB\u306F\u5404\u8981\u7D20\u306E\u5DE6\u4E0A\u306B\u8868\u793A\u3055\u308C\u307E\u3059",
|
|
911
|
+
"- \u5404\u756A\u53F7\u306F\u4E0B\u8A18\u306E\u30A2\u30CE\u30C6\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7\u306E number \u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u5BFE\u5FDC\u3057\u307E\u3059",
|
|
912
|
+
"",
|
|
913
|
+
"## \u30DE\u30C3\u30C1\u30F3\u30B0\u306E\u6307\u91DD",
|
|
914
|
+
"1. \u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\u304B\u3089\u64CD\u4F5C\u5BFE\u8C61\u306E\u8981\u7D20\u306E\u7A2E\u985E\uFF08\u30DC\u30BF\u30F3\u3001\u5165\u529B\u30D5\u30A3\u30FC\u30EB\u30C9\u3001\u30EA\u30F3\u30AF\u7B49\uFF09\u3092\u63A8\u5B9A",
|
|
915
|
+
"2. \u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u5185\u3067\u8996\u899A\u7684\u306B\u6700\u3082\u4E00\u81F4\u3059\u308B\u8981\u7D20\u3092\u63A2\u3059",
|
|
916
|
+
"3. \u8981\u7D20\u306E\u30C6\u30AD\u30B9\u30C8\u3001\u4F4D\u7F6E\u3001\u5916\u89B3\u3092\u624B\u304C\u304B\u308A\u306B\u3059\u308B",
|
|
917
|
+
"4. \u30A2\u30CE\u30C6\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7\u306E role \u3068 name \u3082\u53C2\u8003\u306B\u3059\u308B",
|
|
918
|
+
"5. A11y \u30C4\u30EA\u30FC\u306B\u8868\u308C\u306A\u3044\u8981\u7D20\uFF08canvas\u3001Shadow DOM\u3001iframe \u5185\u7B49\uFF09\u3082\u5BFE\u8C61",
|
|
919
|
+
"6. \u78BA\u4FE1\u5EA6\u304C\u4F4E\u3044\u5834\u5408\uFF080.5\u672A\u6E80\uFF09\u306F\u7A7A\u6587\u5B57\u3092\u8FD4\u3059"
|
|
920
|
+
].join("\n");
|
|
921
|
+
const annotationList = annotations.map((a) => {
|
|
922
|
+
const nameStr = a.name ? ` "${a.name}"` : "";
|
|
923
|
+
return ` #${a.number} ref=${a.ref} ${a.role}${nameStr} @(${a.box.x},${a.box.y})`;
|
|
924
|
+
}).join("\n");
|
|
925
|
+
const selectorHints = pruneSelectorHints4(selector);
|
|
926
|
+
const parts = [
|
|
927
|
+
"## \u30B9\u30C6\u30C3\u30D7\u306E\u8AAC\u660E\uFF08\u6700\u91CD\u8981\uFF09",
|
|
928
|
+
stepDescription,
|
|
929
|
+
"",
|
|
930
|
+
"## \u30BB\u30EC\u30AF\u30BF\u306E\u30D2\u30F3\u30C8\uFF08\u53C2\u8003\u60C5\u5831\uFF09",
|
|
931
|
+
JSON.stringify(selectorHints),
|
|
932
|
+
"",
|
|
933
|
+
"## \u73FE\u5728\u306EURL",
|
|
934
|
+
url,
|
|
935
|
+
"",
|
|
936
|
+
"## \u30A2\u30CE\u30C6\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7\uFF08\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u4E0A\u306E\u756A\u53F7\u3068\u5BFE\u5FDC\uFF09",
|
|
937
|
+
annotationList
|
|
938
|
+
];
|
|
939
|
+
if (failureHistory.length > 0) {
|
|
940
|
+
const recent = failureHistory.slice(-3);
|
|
941
|
+
parts.push(
|
|
942
|
+
"",
|
|
943
|
+
"## \u30C6\u30AD\u30B9\u30C8\u30D9\u30FC\u30B9\u89E3\u6C7A\u306E\u5931\u6557\u5C65\u6B74\uFF08\u76F4\u8FD13\u4EF6\uFF09",
|
|
944
|
+
...recent.map((f, i) => ` ${i + 1}. ${f}`)
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
return { system, userTextContent: parts.join("\n") };
|
|
948
|
+
}
|
|
949
|
+
function pruneSelectorHints4(selector) {
|
|
950
|
+
const pruned = {};
|
|
951
|
+
for (const [key, value] of Object.entries(selector)) {
|
|
952
|
+
if (value === null || value === void 0 || value === "" || value === "unknown" || value === ":") continue;
|
|
953
|
+
pruned[key] = value;
|
|
954
|
+
}
|
|
955
|
+
return pruned;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// src/i18n/prompts/en/self-heal.ts
|
|
959
|
+
function getSuggestionSystemPrompt() {
|
|
960
|
+
return [
|
|
961
|
+
"You are an runbook debugger for browser automation.",
|
|
962
|
+
"Analyze the failed steps from the debug execution and generate fix suggestions for the runbook and context.",
|
|
963
|
+
"",
|
|
964
|
+
"## Fix Suggestion Guidelines",
|
|
965
|
+
"",
|
|
966
|
+
"For each failed step, provide suggestions from these two perspectives:",
|
|
967
|
+
"",
|
|
968
|
+
"### 1. runbookFix (Runbook YAML Fix)",
|
|
969
|
+
"- Selector changes (when element has moved/been renamed)",
|
|
970
|
+
"- Step addition/removal (when the navigation flow has changed)",
|
|
971
|
+
"- Action value updates (text or URL changes)",
|
|
972
|
+
"- riskLevel or requiresConfirmation adjustments",
|
|
973
|
+
`Example: "Step 3: Change selector ariaLabel from 'Submit' to 'Confirm and Submit'"`,
|
|
974
|
+
"",
|
|
975
|
+
"### 2. contextFix (Context Markdown Fix)",
|
|
976
|
+
"- Document page structure changes (new modals, menu structure changes, etc.)",
|
|
977
|
+
"- Add prerequisites (login state, permissions, environment conditions, etc.)",
|
|
978
|
+
"- Add selector resolution hints (dynamic ID naming patterns, etc.)",
|
|
979
|
+
`Example: "Add to context: 'Settings page has changed from tab UI to accordion UI'"`,
|
|
980
|
+
"",
|
|
981
|
+
"If context markdown is not provided, return empty string for contextFix.",
|
|
982
|
+
"",
|
|
983
|
+
"### severity Criteria",
|
|
984
|
+
"- error: Selector completely not found, fundamental page structure change",
|
|
985
|
+
"- warning: Succeeded with retry but unstable, element position or label slightly changed",
|
|
986
|
+
"",
|
|
987
|
+
"### Template Variable Protection",
|
|
988
|
+
"- If step values contain {{varName}} template variables, preserve them as-is in fix suggestions",
|
|
989
|
+
"- Template variables are dynamic references resolved at runtime. Do not suggest replacing them with literal values",
|
|
990
|
+
"",
|
|
991
|
+
"### failureCategory and suggestedStrategy",
|
|
992
|
+
"If a failure category is provided, describe a specific fix strategy in suggestedStrategy:",
|
|
993
|
+
"- element_not_found: Update selector ariaLabel/role/text to match current page structure",
|
|
994
|
+
"- element_stale: Delete selector cache and re-execute",
|
|
995
|
+
"- page_structure_changed: Document page structure changes in context.md and update all selectors",
|
|
996
|
+
"- navigation_timeout: Add wait step or increase step-delay",
|
|
997
|
+
"- action_failed: Consider changing action type (e.g., click \u2192 hover)",
|
|
998
|
+
"- unknown: Analyze error details and propose specific remediation"
|
|
999
|
+
].join("\n");
|
|
1000
|
+
}
|
|
1001
|
+
function buildSuggestionUserPrompt(failedInfo, stepsInfo, runbook, contextMarkdown) {
|
|
1002
|
+
const parts = [
|
|
1003
|
+
"## Instruction Information",
|
|
1004
|
+
`Title: ${runbook.title}`,
|
|
1005
|
+
`Goal: ${runbook.metadata.goal}`,
|
|
1006
|
+
`Start URL: ${runbook.metadata.startUrl}`,
|
|
1007
|
+
"",
|
|
1008
|
+
"## Instruction Steps",
|
|
1009
|
+
stepsInfo.join("\n\n"),
|
|
1010
|
+
"",
|
|
1011
|
+
"## Failed Step Details",
|
|
1012
|
+
failedInfo.join("\n\n")
|
|
1013
|
+
];
|
|
1014
|
+
if (contextMarkdown) {
|
|
1015
|
+
parts.push(
|
|
1016
|
+
"",
|
|
1017
|
+
"## Current Context (markdown)",
|
|
1018
|
+
contextMarkdown
|
|
1019
|
+
);
|
|
1020
|
+
} else {
|
|
1021
|
+
parts.push(
|
|
1022
|
+
"",
|
|
1023
|
+
"## Context",
|
|
1024
|
+
"Context markdown is not provided. Return empty string for contextFix."
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
return parts.join("\n");
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// src/i18n/prompts/ja/self-heal.ts
|
|
1031
|
+
function getSuggestionSystemPrompt2() {
|
|
1032
|
+
return [
|
|
1033
|
+
"\u3042\u306A\u305F\u306F\u30D6\u30E9\u30A6\u30B6\u81EA\u52D5\u64CD\u4F5C\u306E\u624B\u9806\u66F8\u30C7\u30D0\u30C3\u30AC\u30FC\u3067\u3059\u3002",
|
|
1034
|
+
"\u30C7\u30D0\u30C3\u30B0\u5B9F\u884C\u3067\u5931\u6557\u3057\u305F\u30B9\u30C6\u30C3\u30D7\u3092\u5206\u6790\u3057\u3001\u624B\u9806\u66F8\u3068\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u306E\u4FEE\u6B63\u63D0\u6848\u3092\u751F\u6210\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
1035
|
+
"",
|
|
1036
|
+
"## \u4FEE\u6B63\u63D0\u6848\u306E\u6307\u91DD",
|
|
1037
|
+
"",
|
|
1038
|
+
"\u5404\u5931\u6557\u30B9\u30C6\u30C3\u30D7\u306B\u3064\u3044\u3066\u3001\u4EE5\u4E0B\u306E2\u3064\u306E\u89B3\u70B9\u3067\u4FEE\u6B63\u63D0\u6848\u3092\u51FA\u3057\u3066\u304F\u3060\u3055\u3044:",
|
|
1039
|
+
"",
|
|
1040
|
+
"### 1. runbookFix\uFF08\u624B\u9806\u66F8 YAML \u306E\u4FEE\u6B63\uFF09",
|
|
1041
|
+
"- \u30BB\u30EC\u30AF\u30BF\u306E\u5909\u66F4\uFF08\u8981\u7D20\u304C\u79FB\u52D5/\u30EA\u30CD\u30FC\u30E0\u3055\u308C\u305F\u5834\u5408\uFF09",
|
|
1042
|
+
"- \u30B9\u30C6\u30C3\u30D7\u306E\u8FFD\u52A0/\u524A\u9664\uFF08\u5C0E\u7DDA\u304C\u5909\u308F\u3063\u305F\u5834\u5408\uFF09",
|
|
1043
|
+
"- \u30A2\u30AF\u30B7\u30E7\u30F3\u5024\u306E\u66F4\u65B0\uFF08\u30C6\u30AD\u30B9\u30C8\u3084URL\u306E\u5909\u66F4\uFF09",
|
|
1044
|
+
"- riskLevel \u3084 requiresConfirmation \u306E\u8ABF\u6574",
|
|
1045
|
+
"\u4F8B: \u300CStep 3: selector \u306E ariaLabel \u3092 '\u9001\u4FE1' \u2192 '\u78BA\u8A8D\u3057\u3066\u9001\u4FE1' \u306B\u5909\u66F4\u300D",
|
|
1046
|
+
"",
|
|
1047
|
+
"### 2. contextFix\uFF08context markdown \u306E\u4FEE\u6B63\uFF09",
|
|
1048
|
+
"- \u30DA\u30FC\u30B8\u69CB\u9020\u5909\u66F4\u306E\u8A18\u8F09\uFF08\u65B0\u3057\u3044\u30E2\u30FC\u30C0\u30EB\u3001\u30E1\u30CB\u30E5\u30FC\u69CB\u9020\u306E\u5909\u66F4\u306A\u3069\uFF09",
|
|
1049
|
+
"- \u524D\u63D0\u6761\u4EF6\u306E\u8FFD\u52A0\uFF08\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3001\u6A29\u9650\u3001\u74B0\u5883\u6761\u4EF6\u306A\u3069\uFF09",
|
|
1050
|
+
"- \u30BB\u30EC\u30AF\u30BF\u89E3\u6C7A\u306E\u30D2\u30F3\u30C8\u8FFD\u52A0\uFF08\u52D5\u7684ID\u306E\u547D\u540D\u898F\u5247\u306A\u3069\uFF09",
|
|
1051
|
+
"\u4F8B: \u300Ccontext \u306B'\u8A2D\u5B9A\u753B\u9762\u304C\u30BF\u30D6UI\u304B\u3089\u30A2\u30B3\u30FC\u30C7\u30A3\u30AA\u30F3UI\u306B\u5909\u66F4\u3055\u308C\u305F'\u65E8\u3092\u8FFD\u8A18\u300D",
|
|
1052
|
+
"",
|
|
1053
|
+
"context markdown \u304C\u672A\u63D0\u4F9B\u306E\u5834\u5408\u3001contextFix \u306F\u7A7A\u6587\u5B57\u3067\u8FD4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
1054
|
+
"",
|
|
1055
|
+
"### severity \u306E\u5224\u5B9A\u57FA\u6E96",
|
|
1056
|
+
"- error: \u30BB\u30EC\u30AF\u30BF\u304C\u5B8C\u5168\u306B\u898B\u3064\u304B\u3089\u306A\u3044\u3001\u30DA\u30FC\u30B8\u69CB\u9020\u304C\u6839\u672C\u7684\u306B\u5909\u308F\u3063\u3066\u3044\u308B",
|
|
1057
|
+
"- warning: \u30EA\u30C8\u30E9\u30A4\u3067\u6210\u529F\u3057\u305F\u304C\u4E0D\u5B89\u5B9A\u3001\u8981\u7D20\u306E\u4F4D\u7F6E\u3084\u30E9\u30D9\u30EB\u304C\u5FAE\u5999\u306B\u5909\u308F\u3063\u3066\u3044\u308B",
|
|
1058
|
+
"",
|
|
1059
|
+
"### \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5909\u6570\u306E\u4FDD\u8B77",
|
|
1060
|
+
"- \u30B9\u30C6\u30C3\u30D7\u306E\u5024\u306B {{varName}} \u5F62\u5F0F\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5909\u6570\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u5834\u5408\u3001\u4FEE\u6B63\u63D0\u6848\u3067\u3082\u305D\u306E\u307E\u307E\u7DAD\u6301\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
1061
|
+
"- \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5909\u6570\u306F\u5B9F\u884C\u6642\u306B\u52D5\u7684\u306B\u5C55\u958B\u3055\u308C\u308B\u5909\u6570\u53C2\u7167\u3067\u3059\u3002\u30EA\u30C6\u30E9\u30EB\u5024\u3078\u306E\u7F6E\u63DB\u3092\u63D0\u6848\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044",
|
|
1062
|
+
"",
|
|
1063
|
+
"### failureCategory \u3068 suggestedStrategy",
|
|
1064
|
+
"\u30A8\u30E9\u30FC\u5206\u985E\u30AB\u30C6\u30B4\u30EA\u304C\u63D0\u4F9B\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u3001\u305D\u308C\u306B\u57FA\u3065\u3044\u3066\u5177\u4F53\u7684\u306A\u4FEE\u6B63\u6226\u7565\u3092 suggestedStrategy \u306B\u8A18\u8F09\u3057\u3066\u304F\u3060\u3055\u3044:",
|
|
1065
|
+
"- element_not_found: \u30BB\u30EC\u30AF\u30BF\u306E ariaLabel/role/text \u3092\u73FE\u5728\u306E\u30DA\u30FC\u30B8\u69CB\u9020\u306B\u5408\u308F\u305B\u3066\u66F4\u65B0",
|
|
1066
|
+
"- element_stale: \u30BB\u30EC\u30AF\u30BF\u30AD\u30E3\u30C3\u30B7\u30E5\u306E\u524A\u9664\u3068\u518D\u5B9F\u884C",
|
|
1067
|
+
"- page_structure_changed: context.md \u306B\u30DA\u30FC\u30B8\u69CB\u9020\u5909\u66F4\u3092\u8A18\u9332\u3057\u3001\u30BB\u30EC\u30AF\u30BF\u3092\u5168\u9762\u66F4\u65B0",
|
|
1068
|
+
"- navigation_timeout: wait \u30B9\u30C6\u30C3\u30D7\u306E\u8FFD\u52A0\u307E\u305F\u306F step-delay \u306E\u5897\u52A0",
|
|
1069
|
+
"- action_failed: \u30A2\u30AF\u30B7\u30E7\u30F3\u7A2E\u5225\u306E\u5909\u66F4\uFF08\u4F8B: click \u2192 hover\uFF09\u3092\u691C\u8A0E",
|
|
1070
|
+
"- unknown: \u30A8\u30E9\u30FC\u5185\u5BB9\u3092\u8A73\u7D30\u306B\u5206\u6790\u3057\u3001\u5177\u4F53\u7684\u306A\u5BFE\u51E6\u3092\u63D0\u6848"
|
|
1071
|
+
].join("\n");
|
|
1072
|
+
}
|
|
1073
|
+
function buildSuggestionUserPrompt2(failedInfo, stepsInfo, runbook, contextMarkdown) {
|
|
1074
|
+
const parts = [
|
|
1075
|
+
"## \u624B\u9806\u66F8\u60C5\u5831",
|
|
1076
|
+
`\u30BF\u30A4\u30C8\u30EB: ${runbook.title}`,
|
|
1077
|
+
`\u76EE\u7684: ${runbook.metadata.goal}`,
|
|
1078
|
+
`\u958B\u59CBURL: ${runbook.metadata.startUrl}`,
|
|
1079
|
+
"",
|
|
1080
|
+
"## \u624B\u9806\u66F8\u306E\u30B9\u30C6\u30C3\u30D7\u4E00\u89A7",
|
|
1081
|
+
stepsInfo.join("\n\n"),
|
|
1082
|
+
"",
|
|
1083
|
+
"## \u5931\u6557\u30B9\u30C6\u30C3\u30D7\u306E\u8A73\u7D30",
|
|
1084
|
+
failedInfo.join("\n\n")
|
|
1085
|
+
];
|
|
1086
|
+
if (contextMarkdown) {
|
|
1087
|
+
parts.push(
|
|
1088
|
+
"",
|
|
1089
|
+
"## \u73FE\u5728\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\uFF08markdown\uFF09",
|
|
1090
|
+
contextMarkdown
|
|
1091
|
+
);
|
|
1092
|
+
} else {
|
|
1093
|
+
parts.push(
|
|
1094
|
+
"",
|
|
1095
|
+
"## \u30B3\u30F3\u30C6\u30AD\u30B9\u30C8",
|
|
1096
|
+
"context markdown \u306F\u672A\u63D0\u4F9B\u3067\u3059\u3002contextFix \u306F\u7A7A\u6587\u5B57\u3067\u8FD4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
return parts.join("\n");
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// src/i18n/prompts/index.ts
|
|
1103
|
+
function getAgentInstructions3(goal, contextMarkdown, secrets, locale) {
|
|
1104
|
+
const effectiveLocale = locale ?? getLocale();
|
|
1105
|
+
return effectiveLocale === "ja" ? getAgentInstructions2(goal, contextMarkdown, secrets) : getAgentInstructions(goal, contextMarkdown, secrets);
|
|
1106
|
+
}
|
|
1107
|
+
function getInitialUserMessage3(locale) {
|
|
1108
|
+
const effectiveLocale = locale ?? getLocale();
|
|
1109
|
+
return effectiveLocale === "ja" ? getInitialUserMessage2() : getInitialUserMessage();
|
|
1110
|
+
}
|
|
1111
|
+
function getReviewSystemPrompt3(locale) {
|
|
1112
|
+
const effectiveLocale = locale ?? getLocale();
|
|
1113
|
+
return effectiveLocale === "ja" ? getReviewSystemPrompt2() : getReviewSystemPrompt();
|
|
1114
|
+
}
|
|
1115
|
+
function createReviewUserPrompt3(goal, recordedSteps, goalAchieved, interventions, locale) {
|
|
1116
|
+
const effectiveLocale = locale ?? getLocale();
|
|
1117
|
+
return effectiveLocale === "ja" ? createReviewUserPrompt2(goal, recordedSteps, goalAchieved, interventions) : createReviewUserPrompt(goal, recordedSteps, goalAchieved, interventions);
|
|
1118
|
+
}
|
|
1119
|
+
function buildSelectorMessages3(snapshot, selector, stepDescription, url, contextMarkdown, retryContext, workingMemorySummary) {
|
|
1120
|
+
return getLocale() === "ja" ? buildSelectorMessages2(snapshot, selector, stepDescription, url, contextMarkdown, retryContext, workingMemorySummary) : buildSelectorMessages(snapshot, selector, stepDescription, url, contextMarkdown, retryContext, workingMemorySummary);
|
|
1121
|
+
}
|
|
1122
|
+
function buildFallbackMessages3(snapshot, step, failureHistory, url, contextMarkdown) {
|
|
1123
|
+
return getLocale() === "ja" ? buildFallbackMessages2(snapshot, step, failureHistory, url, contextMarkdown) : buildFallbackMessages(snapshot, step, failureHistory, url, contextMarkdown);
|
|
1124
|
+
}
|
|
1125
|
+
function buildVisionMessages3(annotations, selector, stepDescription, url, failureHistory) {
|
|
1126
|
+
return getLocale() === "ja" ? buildVisionMessages2(annotations, selector, stepDescription, url, failureHistory) : buildVisionMessages(annotations, selector, stepDescription, url, failureHistory);
|
|
1127
|
+
}
|
|
1128
|
+
function getSuggestionSystemPrompt3() {
|
|
1129
|
+
return getLocale() === "ja" ? getSuggestionSystemPrompt2() : getSuggestionSystemPrompt();
|
|
1130
|
+
}
|
|
1131
|
+
function buildSuggestionUserPrompt3(failedInfo, stepsInfo, runbook, contextMarkdown) {
|
|
1132
|
+
return getLocale() === "ja" ? buildSuggestionUserPrompt2(failedInfo, stepsInfo, runbook, contextMarkdown) : buildSuggestionUserPrompt(failedInfo, stepsInfo, runbook, contextMarkdown);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
export {
|
|
1136
|
+
getAgentInstructions3 as getAgentInstructions,
|
|
1137
|
+
getInitialUserMessage3 as getInitialUserMessage,
|
|
1138
|
+
getReviewSystemPrompt3 as getReviewSystemPrompt,
|
|
1139
|
+
createReviewUserPrompt3 as createReviewUserPrompt,
|
|
1140
|
+
buildSelectorMessages3 as buildSelectorMessages,
|
|
1141
|
+
buildFallbackMessages3 as buildFallbackMessages,
|
|
1142
|
+
buildVisionMessages3 as buildVisionMessages,
|
|
1143
|
+
getSuggestionSystemPrompt3 as getSuggestionSystemPrompt,
|
|
1144
|
+
buildSuggestionUserPrompt3 as buildSuggestionUserPrompt
|
|
1145
|
+
};
|
|
1146
|
+
//# sourceMappingURL=chunk-GC7I5SGK.js.map
|