@refrainai/cli 0.4.1 → 0.4.2

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.
Files changed (83) hide show
  1. package/dist/{ai-model-FM6GWCID.js → ai-model-DP5PKGM6.js} +2 -2
  2. package/dist/{chunk-2BVDAJZT.js → chunk-65CTEK2K.js} +9 -6
  3. package/dist/chunk-65CTEK2K.js.map +1 -0
  4. package/dist/chunk-BGC75OVR.js +30 -0
  5. package/dist/chunk-BGC75OVR.js.map +1 -0
  6. package/dist/{chunk-H47NWH7N.js → chunk-CJM3IU5Q.js} +611 -73
  7. package/dist/chunk-CJM3IU5Q.js.map +1 -0
  8. package/dist/{chunk-CLYJHKPY.js → chunk-CMWLFQXD.js} +43 -42
  9. package/dist/chunk-CMWLFQXD.js.map +1 -0
  10. package/dist/{chunk-IGFCYKHC.js → chunk-CNJ5KCDN.js} +252 -295
  11. package/dist/chunk-CNJ5KCDN.js.map +1 -0
  12. package/dist/{chunk-DJVUITRB.js → chunk-ELQ23L4Z.js} +898 -1135
  13. package/dist/chunk-ELQ23L4Z.js.map +1 -0
  14. package/dist/chunk-EMAYENG4.js +1146 -0
  15. package/dist/chunk-EMAYENG4.js.map +1 -0
  16. package/dist/{chunk-7UCVPKD4.js → chunk-F7WTOQIQ.js} +12 -72
  17. package/dist/chunk-F7WTOQIQ.js.map +1 -0
  18. package/dist/{chunk-WEYR56ZN.js → chunk-HHRHHFSK.js} +4 -4
  19. package/dist/{chunk-UGPXCQY3.js → chunk-KFNW4XR2.js} +13 -4
  20. package/dist/chunk-KFNW4XR2.js.map +1 -0
  21. package/dist/{chunk-RT664YIO.js → chunk-LZDZGI4M.js} +3 -1
  22. package/dist/chunk-LZDZGI4M.js.map +1 -0
  23. package/dist/chunk-RBZK7T76.js +349 -0
  24. package/dist/chunk-RBZK7T76.js.map +1 -0
  25. package/dist/{chunk-HQDXLWAY.js → chunk-SDV3X5UN.js} +2 -2
  26. package/dist/{chunk-Z33FCOTZ.js → chunk-VVXNFUPL.js} +4 -2
  27. package/dist/chunk-VVXNFUPL.js.map +1 -0
  28. package/dist/chunk-XIVS7N3V.js +74 -0
  29. package/dist/chunk-XIVS7N3V.js.map +1 -0
  30. package/dist/chunk-YTVEYQGA.js +64 -0
  31. package/dist/chunk-YTVEYQGA.js.map +1 -0
  32. package/dist/{chunk-RYIJPYM3.js → chunk-YW46VP57.js} +25 -8
  33. package/dist/chunk-YW46VP57.js.map +1 -0
  34. package/dist/cli.js +5 -5
  35. package/dist/{compose-MTSIJY5D.js → compose-B2IAO7YW.js} +9 -7
  36. package/dist/{compose-MTSIJY5D.js.map → compose-B2IAO7YW.js.map} +1 -1
  37. package/dist/extraction-prompt-VDCKIFLB.js +17 -0
  38. package/dist/extraction-prompt-VDCKIFLB.js.map +1 -0
  39. package/dist/{fix-runbook-ZSBOTLC2.js → fix-runbook-JJN4HVIP.js} +12 -10
  40. package/dist/{fix-runbook-ZSBOTLC2.js.map → fix-runbook-JJN4HVIP.js.map} +1 -1
  41. package/dist/prompts-XMJXIITW.js +13 -0
  42. package/dist/runbook-builder-2ZLE2AEO.js +11 -0
  43. package/dist/{runbook-data-helpers-KRR2SH76.js → runbook-data-helpers-5UAO65TZ.js} +3 -3
  44. package/dist/{runbook-executor-K7T6RJWJ.js → runbook-executor-TVV5EG6Q.js} +41 -444
  45. package/dist/runbook-executor-TVV5EG6Q.js.map +1 -0
  46. package/dist/{runbook-generator-MPXJBQ5N.js → runbook-generator-4XKNV2B7.js} +61 -136
  47. package/dist/runbook-generator-4XKNV2B7.js.map +1 -0
  48. package/dist/{runbook-schema-3T6TP3JJ.js → runbook-schema-X7DW725O.js} +2 -2
  49. package/dist/runbook-store-S24PXIHD.js +11 -0
  50. package/dist/{schema-5G6UQSPT.js → schema-XFSD5EWN.js} +2 -2
  51. package/dist/{server-AG3LXQBI.js → server-5XARL5N7.js} +1176 -128
  52. package/dist/server-5XARL5N7.js.map +1 -0
  53. package/dist/{tenant-ai-config-QPFEJUVJ.js → tenant-ai-config-4NHKRW7O.js} +4 -4
  54. package/dist/tenant-ai-config-4NHKRW7O.js.map +1 -0
  55. package/dist/yaml-patcher-32QBPXT2.js +18 -0
  56. package/dist/yaml-patcher-32QBPXT2.js.map +1 -0
  57. package/package.json +3 -2
  58. package/dist/chunk-2BVDAJZT.js.map +0 -1
  59. package/dist/chunk-7UCVPKD4.js.map +0 -1
  60. package/dist/chunk-CLYJHKPY.js.map +0 -1
  61. package/dist/chunk-DJVUITRB.js.map +0 -1
  62. package/dist/chunk-H47NWH7N.js.map +0 -1
  63. package/dist/chunk-IGFCYKHC.js.map +0 -1
  64. package/dist/chunk-RT664YIO.js.map +0 -1
  65. package/dist/chunk-RYIJPYM3.js.map +0 -1
  66. package/dist/chunk-UGPXCQY3.js.map +0 -1
  67. package/dist/chunk-VPK2MQAZ.js +0 -589
  68. package/dist/chunk-VPK2MQAZ.js.map +0 -1
  69. package/dist/chunk-Z33FCOTZ.js.map +0 -1
  70. package/dist/runbook-executor-K7T6RJWJ.js.map +0 -1
  71. package/dist/runbook-generator-MPXJBQ5N.js.map +0 -1
  72. package/dist/runbook-store-G5GUOWRR.js +0 -11
  73. package/dist/server-AG3LXQBI.js.map +0 -1
  74. package/dist/yaml-patcher-VGUS2JGH.js +0 -15
  75. /package/dist/{ai-model-FM6GWCID.js.map → ai-model-DP5PKGM6.js.map} +0 -0
  76. /package/dist/{chunk-WEYR56ZN.js.map → chunk-HHRHHFSK.js.map} +0 -0
  77. /package/dist/{chunk-HQDXLWAY.js.map → chunk-SDV3X5UN.js.map} +0 -0
  78. /package/dist/{runbook-data-helpers-KRR2SH76.js.map → prompts-XMJXIITW.js.map} +0 -0
  79. /package/dist/{runbook-schema-3T6TP3JJ.js.map → runbook-builder-2ZLE2AEO.js.map} +0 -0
  80. /package/dist/{runbook-store-G5GUOWRR.js.map → runbook-data-helpers-5UAO65TZ.js.map} +0 -0
  81. /package/dist/{schema-5G6UQSPT.js.map → runbook-schema-X7DW725O.js.map} +0 -0
  82. /package/dist/{tenant-ai-config-QPFEJUVJ.js.map → runbook-store-S24PXIHD.js.map} +0 -0
  83. /package/dist/{yaml-patcher-VGUS2JGH.js.map → schema-XFSD5EWN.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/i18n/prompts/en/exploration.ts","../../../src/i18n/prompts/ja/exploration.ts","../../../src/i18n/prompts/en/review.ts","../../../src/i18n/prompts/ja/review.ts","../../../src/i18n/prompts/en/selector.ts","../../../src/i18n/prompts/ja/selector.ts","../../../src/i18n/prompts/en/goal-agent.ts","../../../src/i18n/prompts/ja/goal-agent.ts","../../../src/i18n/prompts/en/vision.ts","../../../src/i18n/prompts/ja/vision.ts","../../../src/i18n/prompts/en/self-heal.ts","../../../src/i18n/prompts/ja/self-heal.ts","../../../src/i18n/prompts/index.ts"],"sourcesContent":["/**\n * Exploration agent prompt — English\n */\n\nimport type { SecretsData } from \"../../../cli/secrets-loader\";\n\nconst COMMAND_SCHEMA = `### Basic Operations\n- \\`click\\`: Click element by selector\n- \\`fill\\`: Fill value in selector (clears existing value)\n- \\`type\\`: Type value into selector character by character\n- \\`select\\`: Select value from dropdown by selector\n- \\`check\\` / \\`uncheck\\`: Toggle checkbox by selector\n\n### Navigation\n- \\`navigate\\`: Navigate to URL in value (only URLs explicitly stated in goal/context; use click for page links)\n- \\`wait\\`: Wait for value ms\n- \\`scroll\\`: value: \"up\"|\"down\"|\"left\"|\"right\"\n\n### Data Extraction\n- \\`extract\\`: Extract data via script (JS) or extractPrompt (AI). Result in extractedData\n - **script MUST be wrapped in IIFE \\`(()=>{...})()\\`. Top-level return causes SyntaxError**\n - **script must return a flat array of objects. No JSON.stringify() needed**\n - Always include closing brackets even for longer scripts (never truncate)\n - When extracting tables, dynamically get column names from header row\n - When extracting tables via script, use selectors that target the specific table (ID, class, aria attributes, etc.) to avoid including unrelated elements\n - When using extractPrompt, specify the expected data structure (column names, data types) concretely\n - extractPrompt must include scope conditions that exactly match the goal or context — do not broaden the scope beyond what is specified (target categories, filter criteria, etc.)\n - 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.)\n - Scope filter example: \\`(()=>{...rows.map(r=>{...}).filter(row=>row.Name?.includes('/USD'));})() \\` — always append \\`.filter()\\` when goal specifies a subset\n - **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\n- \\`download\\`: Download by clicking selector (specify save path with downloadPath)\n- \\`export\\`: Export memory data to file (exportCollection, exportFormat: csv|json, exportPath)\n\n### Memory Operations\n- \\`memory_append\\`: Accumulate data in memoryCollection (value or previous extract result)\n - **extract and memory_append must be in the same actions array**\n- \\`memory_aggregate\\`: aggregation: {collection, field, operation: sum|count|concat|min|max|avg|unique_count, outputVariable}\n\n**Use only the actions listed above.**`;\n\nexport function getAgentInstructions(\n goal: string,\n contextMarkdown: string,\n secrets?: SecretsData,\n): string {\n const contextSection = contextMarkdown\n ? `\\n## Supplementary Information\\n${contextMarkdown}\\n`\n : \"\";\n\n let secretsSection = \"\";\n if (secrets && Object.keys(secrets.values).length > 0) {\n const entries = Object.entries(secrets.values)\n .map(([key, value]) => `- ${key}: ${value}`)\n .join(\"\\n\");\n secretsSection = `\\n## Input Values (secrets)\\nUse the following values when filling forms:\\n${entries}\\n\\n**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.\\n\\n**Important**: When using these values, set the corresponding \\`variableName\\` and choose the appropriate \\`inputCategory\\` (\\`credential\\` or \\`user_data\\`).\\n`;\n }\n\n return `You are an AI explorer that navigates web pages to achieve goals.\nUse the browser tool to operate the browser and achieve the goal.\n\n## How to use the browser tool\n\n### Getting a Snapshot\nCall the browser tool with \\`actions: []\\` (empty array) to get the current page's snapshot (accessibility tree) and URL.\n\n### Executing Actions\nPass operations as an array in the browser tool's \\`actions\\`. Keep to 1-3 actions per call.\n\n### Selector Format\nUse \\`@eN\\` format corresponding to \\`[ref=eN]\\` in the snapshot (e.g., \\`@e1\\`, \\`@e10\\`)\n\n### Available Commands\n${COMMAND_SCHEMA}\n\n### Input Category (inputCategory)\nWhen entering values with fill/type, always include inputCategory:\n- \\`credential\\`: Authentication info (username, email, password, etc.)\n- \\`user_data\\`: User-provided values that change per execution (search keywords, names, addresses, phone numbers, company names, etc.)\n- \\`fixed\\`: Constant values that never change between executions (values explicitly stated in goal/context, etc.)\n- \\`navigation\\`: Only URLs explicitly mentioned in goal/context (use user_data for search keywords)\n\n### Variable Name (variableName)\nWhen entering values with fill/type, assign a short English camelCase variable name to \\`variableName\\`.\nExample: \\`email\\`, \\`password\\`, \\`searchQuery\\`, \\`companyName\\`, \\`firstName\\`\nAlways use the same name for the same concept (e.g., if email input appears in 2 places, use \\`email\\` for both).\n\n### Step Description (description) Guidelines\nThe generated runbook will be executed repeatedly with different input values. Write descriptions that are generic and not tied to specific values:\n\n1. **Do not include input values**: Use \\`{{variableName}}\\` instead of concrete secrets values\n - ✗ \\`Enter company name \"TESLA\" in search box\\`\n - ✓ \\`Enter {{companyName}} in search box\\`\n2. **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\n - ✗ \\`Click search result \"TESLA LIMITED\"\\`\n - ✓ \\`Click the first search result\\`\n3. **Keep extract descriptions generic**: Describe what data to extract by type, not by specific values\n - ✗ \\`Extract TESLA LIMITED registration details\\`\n - ✓ \\`Extract registration details\\`\n\n### Data Capture (suggestedCaptures)\nWhen important data appears on the page as a result of operations (IDs, order numbers, URL changes, amounts, etc.),\nrecord them with \\`suggestedCaptures\\`. Prioritize values needed in subsequent steps.\nAvailable strategies:\n- \\`snapshot\\`: Regex match on snapshot (pattern required)\n- \\`url\\`: Regex match on URL (pattern required)\n- \\`ai\\`: AI extraction with natural language (prompt required)\n- \\`expression\\`: Template from existing variables (expression required)\n- \\`evaluate\\`: Execute JavaScript on page and capture result (expression contains JS code)\n\nExample:\n\\`\\`\\`json\n{\n \"suggestedCaptures\": [\n { \"name\": \"orderId\", \"strategy\": \"snapshot\", \"pattern\": \"Order[::]\\\\\\\\s*([A-Z]+-\\\\\\\\d+)\", \"description\": \"Order confirmation number\" },\n { \"name\": \"resourceId\", \"strategy\": \"url\", \"pattern\": \"/orders/(\\\\\\\\d+)\" }\n ]\n}\n\\`\\`\\`\n\n## Critical Rules\n- **Only interact with elements visible in the snapshot.** Never guess about elements or URLs that may not exist\n- **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\n- Navigate pages by clicking links/buttons on screen. Do not guess/construct URLs with \\`navigate\\` (except URLs explicitly stated in goal or context)\n- Only use \\`@eN\\` refs that exist as \\`[ref=eN]\\` in the most recent snapshot\n- If context (supplementary info) is provided, prioritize the procedures, paths, and hints described there\n- 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\n\n## Exploration Strategy\n1. First check page state with \\`actions: []\\`\n2. **Carefully read** the snapshot and identify elements related to the goal using keyword matching:\n - Break down the goal into keywords (e.g., \"Log in to the dashboard\" → \"login\", \"sign in\", \"dashboard\") and scan link/button names\n - Prioritize exact keyword matches over vague labels (e.g., prefer \"Login\" over \"Click here\")\n3. Execute operations using the identified \\`@eN\\` refs\n4. Check results and decide next operation (observe → decide → act cycle)\n5. If target element is not found, \\`scroll\\` to move the view and check the snapshot again\n6. Use \\`select\\` command for SELECT elements, not \\`click\\`\n7. Use \\`check\\` / \\`uncheck\\` commands for checkboxes\n8. Use \\`click\\` command for radio buttons — just click the desired option directly\n9. 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\n\n## Link Selection and Navigation Recovery\nWhen a page has many links:\n1. **Relevance check before clicking**: Only click links whose name clearly relates to a goal keyword. Links with generic names are a last resort\n2. **Avoid exploratory clicking**: Do not click links just to \"see what happens.\" Each click must have a clear rationale tied to the goal\n3. **Recovery from wrong navigation**: If a clicked page is unrelated to the goal, \\`navigate\\` back to the starting URL and look for alternative links\n\n## Form Input Efficiency\nWhen filling large forms, strictly follow these rules:\n1. **Enter each field only once** — Do not re-operate on fields that already have values\n2. **Check filled fields in snapshot** — After fill/type, the field value appears in the snapshot. Skip fields showing values\n3. **Progress systematically top to bottom** — Process fieldsets/sections in order. Don't go back to previous sections\n4. **Track filled field count** — Reference operation history to know what you've already entered. Duplicate operations on the same selector are forbidden\n5. **Submit after all fields are filled** — Once all required fields are complete, promptly click the submit button\n6. **Check filledFields** — The browser tool result includes filledFields listing filled fields. Never re-enter fields in this list\n\n## Form Completion Verification\nBefore returning your final report when filling forms:\n1. Scan the ENTIRE current snapshot for remaining unfilled fields — check every fieldset/section\n2. Look for: empty textboxes (no value), comboboxes showing placeholder like \"Select...\", unchecked checkboxes\n3. The LAST section of a form is commonly missed — always verify the bottom of the form\n4. After all fields are filled, click the submit/register button\n5. Verify the success confirmation appears before declaring goalAchieved: true\nDo NOT declare goalAchieved without first confirming all form sections are complete and the form is submitted.\n\n## Data Collection Pattern (Pagination Traversal)\nProcedure: extract → memory_append → click \"Next\" → repeat → memory_aggregate for aggregation\n\nExample (table extract → accumulate → next page → aggregate → CSV export):\n\\`\\`\\`json\n[\n {\"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()]));});})()\"},\n {\"action\":\"memory_append\",\"description\":\"Accumulate\",\"memoryCollection\":\"data\"},\n {\"action\":\"click\",\"description\":\"Next page\",\"selector\":\"@e15\"}\n]\n\\`\\`\\`\nAggregate: \\`[{\"action\":\"memory_aggregate\",\"description\":\"Sum total\",\"aggregation\":{\"collection\":\"data\",\"field\":\"amount\",\"operation\":\"sum\",\"outputVariable\":\"total\"}}]\\`\nCSV export: \\`[{\"action\":\"export\",\"description\":\"CSV export\",\"exportCollection\":\"data\",\"exportFormat\":\"csv\",\"exportPath\":\"/tmp/data.csv\"}]\\`\n\nNote: No JSON.stringify() needed in script. Each row is a flat object. Check collection item count via memoryStatus.\n\n**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.\n\n**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 — process every single page. The goal is not to demonstrate the pattern but to complete the full traversal.\n\n## Using filledFields\nIf the browser tool result includes \\`filledFields\\`, this is a list of already-filled form fields.\nDo not re-enter fields in this list. Only operate on unfilled fields.\n\n## Diff Snapshots\nAfter text input (fill/type), if page structure hasn't changed, you'll receive a compact snapshot listing all refs.\n- \\`Unfilled:\\` shows elements you still need to interact with\n- \\`Filled:\\` shows elements already filled\n- All refs from the compact snapshot are valid and usable\n- If you need full page context, call the browser tool with \\`actions: []\\`\n\n## Responding to nudgeMessage\nIf the browser tool result includes \\`nudgeMessage\\`, it contains important guidance:\n- **Pagination progress**: Shows current page and remaining pages. You MUST continue until ALL pages are processed.\n- **Loop warning**: Indicates you are repeating the same actions without progress. Try a different approach.\n- **Form hints**: Lists remaining unfilled form fields.\nAlways follow the instructions in the message.\n\n## Compound Goal Verification\nWhen the goal contains multiple steps (e.g., \"Do A, then navigate to B, then execute C\"):\n1. Break down the goal into individual sub-tasks\n2. Verify each sub-task is completed by checking the current page state\n3. **Do NOT declare goalAchieved until ALL sub-tasks are completed**\n4. Even if login or page navigation succeeds, the goal is NOT achieved if subsequent tasks remain\n5. 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\n\nExample: If the goal is \"Log in and then execute X in the action list\":\n- Login succeeds → NOT goalAchieved yet (executing X remains)\n- X executed in action list → goalAchieved: true\n\n## When Goal is Achieved\n**CRITICAL: Your goal achievement claim will be independently verified against the final page state. False claims will be overridden.**\n\nBefore declaring goalAchieved: true, you MUST complete this mandatory checklist:\n1. **Re-read the original goal** and break it into every sub-task\n2. **Check the current page state** — does the snapshot show clear evidence of completion?\n3. **For form tasks**: Is a success/confirmation message visible? (NOT just \"fields are filled\" — the form must be SUBMITTED and confirmed)\n4. **For navigation tasks**: Is the target page actually displayed?\n5. **For compound goals** (A then B then C): Verify evidence for EACH part, not just the first\n6. **Look for failure signals**: Error messages, validation warnings, login forms still visible, \"try again\" prompts\n7. **Include specific evidence** in your summary: quote the confirmation message, success banner, or page title that proves completion\n\nCommon false positive patterns to AVOID:\n- Declaring success after login when the goal includes post-login tasks\n- Declaring success after filling a form but before submitting it\n- Declaring success based on clicking a button without waiting for confirmation\n- Declaring success when the page shows an error or is still loading\n\nWhen you have verified ALL checklist items, stop calling the browser tool and return:\n\\`\\`\\`json\n{ \"goalAchieved\": true, \"summary\": \"Evidence: [specific confirmation message or page state]. Completed: [list of sub-tasks done]\" }\n\\`\\`\\`\n\nIf the goal cannot be achieved:\n\\`\\`\\`json\n{ \"goalAchieved\": false, \"summary\": \"Summary of the situation and reasons\" }\n\\`\\`\\`\n\n---\nThe following is task-specific information.\n\n## Goal\n${goal}\n${contextSection}${secretsSection}\nRespond in English.`;\n}\n\nexport function getInitialUserMessage(): string {\n return \"Call the browser tool with actions:[] (empty array) to check the current page state. Then begin exploring toward the goal.\";\n}\n","/**\n * Exploration agent prompt — Japanese (current production)\n */\n\nimport type { SecretsData } from \"../../../cli/secrets-loader\";\n\nconst COMMAND_SCHEMA = `### 基本操作\n- \\`click\\`: selector で要素クリック\n- \\`fill\\`: selector に value を入力(既存値クリア)\n- \\`type\\`: selector に value を1文字ずつ入力\n- \\`select\\`: selector のドロップダウンで value を選択\n- \\`check\\` / \\`uncheck\\`: selector のチェックボックス操作\n\n### ナビゲーション\n- \\`navigate\\`: value のURLに移動(ゴール/コンテキストで明示されたURLのみ。ページ内リンクは click)\n- \\`wait\\`: value ms待機\n- \\`scroll\\`: value: \"up\"|\"down\"|\"left\"|\"right\"\n\n### データ抽出\n- \\`extract\\`: script(JS) または extractPrompt(AI) でデータ抽出。結果は extractedData\n - **script は必ず IIFE \\`(()=>{...})()\\` で囲むこと。トップレベル return は SyntaxError になる**\n - **script はフラットなオブジェクト配列を返すこと。JSON.stringify()不要**\n - script が長くなる場合でも必ず閉じ括弧まで含めること(途中で切らない)\n - テーブル抽出時はヘッダー行からカラム名を動的取得\n - script でテーブルを抽出する際は、対象テーブルを特定するセレクタ(ID・クラス・aria属性等)を使用し、抽出意図に合わない要素を含めないこと\n - extractPrompt を使う場合は、抽出対象のデータ構造(カラム名やデータ型)を具体的に指定すること\n - extractPrompt にはゴールやコンテキストで指定されたスコープ条件(対象カテゴリ・フィルタ条件等)を正確に含めること — 指定範囲を超えてスコープを広げないこと\n - script でデータを抽出する際も、ゴールやコンテキストで指定されたスコープ条件(対象カテゴリ・フィルタ条件等)に合致するデータのみを返すよう、script 内でフィルタリングすること\n - スコープフィルタ例: \\`(()=>{...rows.map(r=>{...}).filter(row=>row.Name?.includes('/USD'));})() \\` — ゴールがサブセットを指定している場合は必ず \\`.filter()\\` を付加すること\n - **フィルタリング結果が0件の場合、フィルタを外してはならない。** 代わりに: (1) フィルタ文字列が実際のセル内容と一致するか確認(大文字小文字・空白・形式)、(2) より緩い正規表現を試す、(3) スコープ条件付き extractPrompt に切り替える。サブセットが要求されているのに全データを抽出するのは不正解\n- \\`download\\`: selector クリックでダウンロード(downloadPath で保存先指定可)\n- \\`export\\`: メモリデータをファイル出力(exportCollection, exportFormat: csv|json, exportPath)\n\n### メモリ操作\n- \\`memory_append\\`: memoryCollection にデータ蓄積(value または直前 extract 結果)\n - **extract と memory_append は必ず同じ actions 配列に含めること**\n- \\`memory_aggregate\\`: aggregation: {collection, field, operation: sum|count|concat|min|max|avg|unique_count, outputVariable}\n\n**上記のアクションのみ使用。**`;\n\nexport function getAgentInstructions(\n goal: string,\n contextMarkdown: string,\n secrets?: SecretsData,\n): string {\n const contextSection = contextMarkdown\n ? `\\n## 補足情報\\n${contextMarkdown}\\n`\n : \"\";\n\n let secretsSection = \"\";\n if (secrets && Object.keys(secrets.values).length > 0) {\n const entries = Object.entries(secrets.values)\n .map(([key, value]) => `- ${key}: ${value}`)\n .join(\"\\n\");\n secretsSection = `\\n## 入力値(secrets)\\nフォーム入力時に以下の値を使用してください:\\n${entries}\\n\\n**重要**: これらの値はそのまま厳密に使用してください。別のテスト値・サンプル値・推測値に置き換えてはいけません。必要な値が不足している場合も、補完・正規化・言い換えで埋めず、未提供として扱ってください。\\n\\n**重要**: これらの値を使用する際は、対応する \\`variableName\\` を設定し、\\`inputCategory\\` は \\`credential\\` または \\`user_data\\` を適切に選択してください。\\n`;\n }\n\n return `あなたはWebページを探索してゴールを達成するAIエクスプローラーです。\nbrowserツールを使ってブラウザを操作し、ゴールを達成してください。\n\n## browserツールの使い方\n\n### スナップショット取得\nbrowserツールを \\`actions: []\\`(空配列)で呼ぶと、現在のページのスナップショット(アクセシビリティツリー)とURLが返ります。\n\n### アクション実行\nbrowserツールの \\`actions\\` に操作を配列で渡すと順次実行されます。1回の呼び出しで1〜3アクション程度に抑えてください。\n\n### セレクタ形式\nスナップショットの \\`[ref=eN]\\` に対応する \\`@eN\\` 形式で指定(例: \\`@e1\\`, \\`@e10\\`)\n\n### 利用可能なコマンド\n${COMMAND_SCHEMA}\n\n### 入力値のカテゴリ(inputCategory)\nfill/type で値を入力する場合、必ず inputCategory を付与:\n- \\`credential\\`: ユーザー名、メールアドレス、パスワード等の認証情報\n- \\`user_data\\`: 実行時に変わるユーザー入力値(検索キーワード、名前、住所、電話番号、企業名等)\n- \\`fixed\\`: 実行時に変わらない定数値(ゴール/コンテキストで明示された固定文字列等)\n- \\`navigation\\`: ゴール/コンテキストで明示されたURLのみ(検索キーワードは user_data を使用)\n\n### 変数名(variableName)\nfill/type で値を入力する場合、短い英語 camelCase の変数名を \\`variableName\\` に付与してください。\n例: \\`email\\`, \\`password\\`, \\`searchQuery\\`, \\`companyName\\`, \\`firstName\\`\n同じ概念の値には必ず同じ名前を使用してください(例: メールアドレス入力が2箇所あれば両方 \\`email\\`)。\n\n### ステップ説明(description)の書き方\n生成される手順書は異なる入力値で繰り返し実行されます。description は特定の値に依存しない汎用的な表現にしてください:\n\n1. **入力値を含めない**: secrets の具体値ではなく \\`{{variableName}}\\` を使う\n - ✗ \\`会社名「TESLA」を検索ボックスに入力\\`\n - ✓ \\`会社名 {{companyName}} を検索ボックスに入力\\`\n2. **ページ上の動的テキストを引用しない**: 入力値に応じて変わるページコンテンツ(検索結果、タイトル等)は具体名を書かず、位置や役割で表現する\n - ✗ \\`検索結果「TESLA LIMITED」をクリック\\`\n - ✓ \\`最初の検索結果をクリック\\`\n3. **extract の説明も汎用的に**: 抽出対象を具体値ではなくデータ種別で説明する\n - ✗ \\`TESLA LIMITEDの登録詳細を抽出\\`\n - ✓ \\`登録詳細情報を抽出\\`\n\n### データキャプチャ(suggestedCaptures)\n操作結果として重要なデータ(ID、注文番号、URL変化、金額等)がページに現れた場合、\n\\`suggestedCaptures\\` で記録してください。後続ステップで参照が必要になる値を優先。\n利用可能な strategy:\n- \\`snapshot\\`: スナップショットに正規表現マッチ(pattern 必須)\n- \\`url\\`: URLに正規表現マッチ(pattern 必須)\n- \\`ai\\`: AIに自然言語で抽出させる(prompt 必須)\n- \\`expression\\`: 既存変数からテンプレート組み立て(expression 必須)\n- \\`evaluate\\`: ページ内でJavaScriptを実行して結果をキャプチャ(expression にJSコードを指定)\n\n例:\n\\`\\`\\`json\n{\n \"suggestedCaptures\": [\n { \"name\": \"orderId\", \"strategy\": \"snapshot\", \"pattern\": \"注文番号[::]\\\\\\\\s*([A-Z]+-\\\\\\\\d+)\", \"description\": \"注文確認番号\" },\n { \"name\": \"resourceId\", \"strategy\": \"url\", \"pattern\": \"/orders/(\\\\\\\\d+)\" }\n ]\n}\n\\`\\`\\`\n\n## 最重要ルール\n- **スナップショットに見えている要素だけを操作すること。** 存在するか分からない要素やURLを推測してはいけない\n- **入力値を推測してはいけない。** 入力値(secrets)・コンテキスト・ページ上に存在しないメールアドレス、パスワード、氏名、電話番号などを勝手に作らない\n- ページ遷移は画面上のリンクやボタンを \\`click\\` で行う。\\`navigate\\` でURLを推測・組み立てることは禁止(ゴールやコンテキストで明示されたURLは除く)\n- 操作対象の \\`@eN\\` は、直前のスナップショットに \\`[ref=eN]\\` として存在するものだけを使用する\n- コンテキスト(補足情報)が提供されている場合、そこに記載された手順・導線・ヒントを優先的に参照する\n- スナップショットに \\`[... N件省略]\\` とある場合、目的の要素が省略部分にある可能性がある。\\`scroll\\` で画面を動かして再取得を試みること\n\n## 探索戦略\n1. まず \\`actions: []\\` でページ状態を確認\n2. スナップショットを**注意深く読み**、ゴールのキーワードを使って関連要素を特定:\n - ゴールをキーワードに分解し(例: 「ログインしてダッシュボード表示」→ 「ログイン」「サインイン」「ダッシュボード」)、リンク・ボタン名から検索する\n - 曖昧なラベル(「詳細」「こちら」)より、キーワードに一致するリンクを優先する\n3. 特定した要素の \\`@eN\\` を使って操作を実行\n4. 結果を確認し、次の操作を決定(観察→判断→行動の繰り返し)\n5. 目的の要素が見つからない場合は \\`scroll\\` で画面を移動し、再度スナップショットを確認する\n6. SELECT要素には \\`click\\` ではなく \\`select\\` コマンドを使用\n7. チェックボックスには \\`check\\` / \\`uncheck\\` コマンドを使用\n8. ラジオボタンには \\`click\\` コマンドを使用 — 選択したいオプションを直接クリックする\n9. フォーム要素の調査に \\`extract\\` を使わないこと。スナップショットにラジオボタン・チェックボックス・ドロップダウンが見えていれば、適切なコマンドで直接操作する\n\n## リンク選択とナビゲーション回復\nページに多数のリンクがある場合:\n1. **クリック前の関連性チェック**: リンクの名前がゴールのキーワードに関連する場合のみクリックする。汎用的な名前のリンクは最後の手段\n2. **探索的クリックの回避**: 「どうなるか見てみよう」でリンクをクリックしない。各クリックにはゴールに紐づいた根拠が必要\n3. **誤遷移からの回復**: クリック後のページがゴールに無関係な場合、開始URLに \\`navigate\\` で戻り、別のリンクを探す\n\n## フォーム入力の効率化\n大きなフォームを入力する際は、以下のルールを厳守してください:\n1. **各フィールドは1回だけ入力する** — 既に値が入力されたフィールドを再度操作しないこと\n2. **スナップショットで入力済みフィールドを確認する** — fill/type 後のフィールドはスナップショットに入力値が表示される。値が表示されているフィールドはスキップする\n3. **上から下へ体系的に進む** — フォーム内のフィールドセット/セクションを上から順に処理する。前のセクションに戻らない\n4. **入力済みフィールド数を意識する** — 操作履歴を参照し、既に何を入力したかを把握する。同じセレクタへの重複操作は禁止\n5. **全フィールド入力後に送信する** — フォーム内の全必須フィールドが埋まったら、速やかに送信ボタンをクリックする\n6. **filledFields を確認する** — browserツールの結果に含まれる filledFields は入力済みフィールドの一覧。この一覧にあるフィールドは絶対に再入力しないこと\n\n## フォーム完了の検証\nフォーム入力のゴールで最終報告を返す前に:\n1. 現在のスナップショット全体をスキャンし、未入力フィールドがないか確認 — 全フィールドセット/セクションをチェック\n2. 以下を探す: 値のないテキストボックス、「Select...」プレースホルダー表示のドロップダウン、未チェックのチェックボックス\n3. フォームの最後のセクションは見落としやすい — フォーム最下部を必ず確認\n4. 全フィールド入力後、送信/登録ボタンをクリック\n5. goalAchieved: true を宣言する前に成功確認メッセージの表示を確認\n全セクション完了・フォーム送信を確認するまで goalAchieved を宣言しないこと。\n\n## データ収集パターン(ページネーション走査)\n手順: extract → memory_append → click「次へ」→ 繰り返し → memory_aggregate で集計\n\n例(テーブル抽出 → 蓄積 → 次ページ → 集計 → CSV出力):\n\\`\\`\\`json\n[\n {\"action\":\"extract\",\"description\":\"テーブル抽出\",\"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()]));});})()\"},\n {\"action\":\"memory_append\",\"description\":\"蓄積\",\"memoryCollection\":\"data\"},\n {\"action\":\"click\",\"description\":\"次ページ\",\"selector\":\"@e15\"}\n]\n\\`\\`\\`\n集計: \\`[{\"action\":\"memory_aggregate\",\"description\":\"合計\",\"aggregation\":{\"collection\":\"data\",\"field\":\"amount\",\"operation\":\"sum\",\"outputVariable\":\"total\"}}]\\`\nCSV出力: \\`[{\"action\":\"export\",\"description\":\"CSV出力\",\"exportCollection\":\"data\",\"exportFormat\":\"csv\",\"exportPath\":\"/tmp/data.csv\"}]\\`\n\n注意: script で JSON.stringify() 不要。各行はフラットなオブジェクト。memoryStatus でコレクションのアイテム数を確認可能。\n\n**スコープフィルタリング**: ゴールがデータのサブセットを指定している場合(例:「/USD ペアを収集」)、extract script に \\`.filter(row => ...)\\` を付加すること。サブセットが要求されているのにテーブル全体を抽出してはならない。\n\n**重要**: ページネーション走査時は最後のページまで必ず継続してください。ページ表示(例: \"Page X of Y\")を確認し、最終ページに到達するまで「次へ」をクリックし続けてください。数ページで止めず、全ページを処理してください。パターンを示すことが目的ではなく、全データの走査を完了することが目的です。\n\n## filledFields の活用\nbrowserツールの結果に \\`filledFields\\` が含まれている場合、これは既に入力済みのフォームフィールドの一覧です。\nリストに含まれるフィールドには再度入力しないでください。未入力のフィールドのみを操作してください。\n\n## 差分スナップショット\nテキスト入力(fill/type)後にページ構造が変わっていない場合、全refを一覧にしたコンパクトなスナップショットが返されます。\n- \\`Unfilled:\\` はまだ操作が必要な要素を示します\n- \\`Filled:\\` は入力済みの要素を示します\n- コンパクトスナップショット内の全refは有効で使用可能です\n- 完全なページコンテキストが必要な場合は \\`actions: []\\` でブラウザツールを呼び出してください\n\n## nudgeMessage への対応\nbrowserツールの結果に \\`nudgeMessage\\` が含まれている場合、重要なガイダンスが記載されています:\n- **ページネーション進捗**: 現在のページと残りページ数を示します。全ページの処理が完了するまで続行してください。\n- **ループ警告**: 同じ操作を繰り返している可能性があります。別のアプローチを試してください。\n- **フォームヒント**: 未入力のフォームフィールド一覧です。\nメッセージの指示に必ず従ってください。\n\n## 複合ゴールの検証\nゴールに複数のステップが含まれている場合(例: 「Aして、Bに遷移し、Cを実行する」):\n1. ゴールを個別のサブタスクに分解する\n2. 各サブタスクが完了したかどうかを現在のページ状態から確認する\n3. **全てのサブタスクが完了するまで goalAchieved を宣言しないこと**\n4. ログインやページ遷移が成功しても、後続のタスクがあればまだゴールは未達成\n5. 一部のサブタスクが完了している場合は、残りのサブタスクに取り組み続けること。回復不能なエラーや全てのアプローチを試した場合にのみ goalAchieved: false を宣言する\n\n例: ゴールが「ログインしてアクション一覧でXを実行する」の場合:\n- ログイン成功 → まだ goalAchieved ではない(アクション実行が残っている)\n- アクション一覧でXを実行完了 → goalAchieved: true\n\n## ゴール達成時\n**重要: goalAchieved の申告は最終ページ状態から独立検証されます。虚偽の申告は上書きされます。**\n\ngoalAchieved: true を宣言する前に、以下のチェックリストを必ず完了してください:\n1. **元のゴールを再確認** — 全てのサブタスクに分解する\n2. **現在のページ状態を確認** — スナップショットに達成の明確な証拠があるか?\n3. **フォームタスク**: 成功/確認メッセージが表示されているか?(「フィールドを入力した」だけでは不十分 — フォームが送信され、確認が表示されていること)\n4. **ナビゲーションタスク**: 目的のページが実際に表示されているか?\n5. **複合ゴール**(A → B → C): 最初の部分だけでなく、全パートの証拠を確認\n6. **失敗シグナルの確認**: エラーメッセージ、バリデーション警告、ログインフォームがまだ表示されていないか、「再試行」プロンプトがないか\n7. **summary に具体的な証拠を含める**: 完了を証明する確認メッセージ、成功バナー、ページタイトルを引用する\n\nよくある偽陽性パターン(避けるべき):\n- ログイン後のタスクがあるのに、ログイン成功だけで達成と宣言する\n- フォーム入力後、送信前に達成と宣言する\n- ボタンクリック後、確認を待たずに達成と宣言する\n- ページがエラーを表示している、またはロード中なのに達成と宣言する\n\n全チェック項目を確認した上で、browserツールの呼び出しを停止し、以下のJSON形式で最終報告を返してください:\n\\`\\`\\`json\n{ \"goalAchieved\": true, \"summary\": \"証拠: [具体的な確認メッセージやページ状態]。完了: [実行したサブタスク一覧]\" }\n\\`\\`\\`\n\nゴールが達成できないと判断した場合:\n\\`\\`\\`json\n{ \"goalAchieved\": false, \"summary\": \"状況の要約と理由\" }\n\\`\\`\\`\n\n---\n以下はこのタスク固有の情報です。\n\n## ゴール\n${goal}\n${contextSection}${secretsSection}\n日本語で応答してください。`;\n}\n\nexport function getInitialUserMessage(): string {\n return \"browserツールをactions:[](空配列)で呼び出し、現在のページ状態を確認してください。その後、ゴール達成に向けて探索を開始してください。\";\n}\n","/**\n * Review prompt — English\n */\n\nimport type { RecordedStep, InterventionRecord } from \"../../../runbook-generator/types\";\n\nexport function getReviewSystemPrompt(): string {\n return `You are an expert reviewer of web browser automation procedures.\n\n## Task\nAnalyze the recorded steps and determine the following:\n\n1. **Remove unnecessary steps**: Identify and exclude trial-and-error during exploration, dead ends, unnecessary navigation, and duplicate operations\n2. **Risk level assessment**: Assess the risk of each step\n - \\`low\\`: Low side-effect operations like input, scrolling, navigation\n - \\`medium\\`: Login, form submission, settings changes, etc.\n - \\`high\\`: Irreversible operations like deletion, payment, data modification\n3. **Approval requirement**: Whether user approval is needed before execution\n\n## Capture Candidate Identification\nIf you detect important data used in subsequent steps (IDs, order numbers, URL changes, amounts, etc.),\ninclude them as suggestedCaptures in each step's response.\nAvailable strategies: snapshot (regex), url (URL regex), ai (AI extraction), expression (template)\n\n## Notes\n- Failed steps (success=false) should generally be excluded\n- Keep only the shortest path steps needed to achieve the goal\n- riskLevel is used in the Chrome extension approval flow (medium/high requires approval)\n- Respond in English`;\n}\n\nexport function createReviewUserPrompt(\n goal: string,\n recordedSteps: RecordedStep[],\n goalAchieved: boolean,\n interventions?: InterventionRecord[],\n): string {\n const stepsList = recordedSteps\n .map(\n (s) =>\n `${s.ordinal}. [${s.success ? \"OK\" : \"FAIL\"}] ${s.action.description} (action: ${s.action.action}, url: ${s.url})${s.error ? ` Error: ${s.error}` : \"\"}`,\n )\n .join(\"\\n\");\n\n const interventionsSection =\n interventions && interventions.length > 0\n ? `\\n## User Interventions During Exploration\nThe user modified the exploration direction at the following points.\nSteps before the intervention likely contain trial-and-error, while steps after are more accurate.\n\n${interventions\n .map(\n (iv, i) =>\n `${i + 1}. Around step #${iv.stepIndex}: \"${iv.userInstruction}\" (URL: ${iv.url})`,\n )\n .join(\"\\n\")}\n\n**Review note**: Actively exclude unnecessary steps before intervention points.\n`\n : \"\";\n\n return `## Goal\n${goal}\n\n## Goal Achievement Status\n${goalAchieved ? \"Achieved\" : \"Not achieved\"}\n${interventionsSection}\n## All Recorded Steps\n${stepsList}`;\n}\n","/**\n * Review prompt — Japanese (current production)\n */\n\nimport type { RecordedStep, InterventionRecord } from \"../../../runbook-generator/types\";\n\nexport function getReviewSystemPrompt(): string {\n return `あなたはWebブラウザ自動操作の手順書をレビューするエキスパートです。\n\n## タスク\n記録されたステップを分析し、以下を判定してください:\n\n1. **不要ステップの除外**: 探索中の試行錯誤、行き止まり、不要なナビゲーション、重複操作を特定し除外\n2. **リスクレベル判定**: 各ステップのリスクを判定\n - \\`low\\`: 入力、スクロール、ナビゲーションなど副作用の少ない操作\n - \\`medium\\`: ログイン、フォーム送信、設定変更など\n - \\`high\\`: 削除、決済、データ変更など不可逆な操作\n3. **承認要否判定**: 実行前にユーザー承認が必要かどうか\n\n## キャプチャ候補の識別\n操作結果として後続ステップで使用される重要なデータ(ID、注文番号、URL変化、金額など)を検出した場合、\nsuggestedCaptures としてレスポンスの各ステップに含めてください。\n利用可能な strategy: snapshot(正規表現), url(URL正規表現), ai(AI抽出), expression(テンプレート)\n\n## 注意事項\n- 失敗ステップ(success=false)は基本的に除外してください\n- ゴール達成に必要な最短経路のステップのみ残してください\n- riskLevel は Chrome拡張の承認フローで使用されます(medium/high は承認が必要)\n- 日本語で応答してください`;\n}\n\nexport function createReviewUserPrompt(\n goal: string,\n recordedSteps: RecordedStep[],\n goalAchieved: boolean,\n interventions?: InterventionRecord[],\n): string {\n const stepsList = recordedSteps\n .map(\n (s) =>\n `${s.ordinal}. [${s.success ? \"成功\" : \"失敗\"}] ${s.action.description} (action: ${s.action.action}, url: ${s.url})${s.error ? ` エラー: ${s.error}` : \"\"}`,\n )\n .join(\"\\n\");\n\n const interventionsSection =\n interventions && interventions.length > 0\n ? `\\n## 探索中のユーザー介入\n以下のタイミングでユーザーが探索方針を修正しました。\n介入前のステップには探索の試行錯誤が含まれている可能性が高く、介入後のステップがより正確な手順です。\n\n${interventions\n .map(\n (iv, i) =>\n `${i + 1}. ステップ#${iv.stepIndex}付近: \"${iv.userInstruction}\" (URL: ${iv.url})`,\n )\n .join(\"\\n\")}\n\n**レビュー時の注意**: 介入ポイントより前の不要なステップは積極的に除外してください。\n`\n : \"\";\n\n return `## ゴール\n${goal}\n\n## ゴール達成状況\n${goalAchieved ? \"達成済み\" : \"未達成\"}\n${interventionsSection}\n## 記録された全ステップ\n${stepsList}`;\n}\n","/**\n * Selector resolver prompt — English\n */\n\nimport type { Selector } from \"../../../runbook-executor/types\";\nimport type { RetryContext } from \"../../../harness/selector-resolver\";\n\nexport function buildSelectorMessages(\n snapshot: string,\n selector: Selector,\n stepDescription: string,\n url: string,\n contextMarkdown: string,\n retryContext?: RetryContext,\n workingMemorySummary?: string,\n): { system: string; userPrompt: string } {\n const system = [\n \"You are a selector resolver for browser automation.\",\n \"Based on the step description, identify the target element in the accessibility snapshot.\",\n \"\",\n \"## Matching Guidelines\",\n \"1. Infer the type of target element (button, input field, link, etc.) from the step description\",\n \"2. Find the element in the snapshot that semantically best matches the step description\",\n \"3. Use surrounding text, labels, placeholders, and roles as clues\",\n \"4. Even without an exact match, return the ref of the most likely element\",\n \"5. Return an empty string only if the target element truly does not exist in the snapshot\",\n ].join(\"\\n\");\n\n const parts: string[] = [\n \"## Step Description (Most Important)\",\n stepDescription,\n \"\",\n \"## Selector Hints (Reference)\",\n \"The following is reference information for identifying the element. Even without an exact match, choose the element semantically closest to the step description.\",\n JSON.stringify(pruneSelectorHints(selector)),\n \"\",\n \"Notes:\",\n '- If tagName is \"unknown\" or \":\", there is no tag name information',\n \"- ariaLabel is auto-generated from the step description and may not match the actual aria-label attribute\",\n \"- Prioritize semantic match with the step description over exact selector match\",\n \"\",\n \"## Current URL\",\n url,\n ];\n\n if (workingMemorySummary) {\n parts.push(\"\", \"## Execution Context\", workingMemorySummary);\n }\n\n parts.push(\n \"\",\n \"## Accessibility Snapshot\",\n snapshot,\n );\n\n const includeContext = contextMarkdown && !(retryContext && retryContext.attempt > 0);\n if (includeContext) {\n parts.push(\"\", \"## Supplementary Context\", contextMarkdown);\n }\n\n if (retryContext && retryContext.attempt > 0) {\n parts.push(\n \"\",\n \"## Recovery Context (Attempt \" + (retryContext.attempt + 1) + \")\",\n );\n\n // Failure pattern hints from registry\n if (retryContext.failureHints) {\n parts.push(`Pattern: ${retryContext.failureHints}`);\n }\n\n if (retryContext.failureHistory.length > 0) {\n const recent = retryContext.failureHistory.slice(-2);\n parts.push(`Previous: ${recent.join(\"; \")}`);\n }\n if (retryContext.previousAiResponse) {\n // Extract only the reasoning from the previous AI response\n try {\n const parsed = JSON.parse(retryContext.previousAiResponse);\n if (parsed.reasoning) {\n parts.push(`Last reasoning: \"${parsed.reasoning}\"`);\n }\n } catch {\n parts.push(`Last response: ${retryContext.previousAiResponse.slice(0, 200)}`);\n }\n }\n if (!retryContext.snapshotChanged) {\n parts.push(\n \"Snapshot unchanged — try partial matching, role-based matching, or inference from nearby elements.\",\n );\n }\n }\n\n return { system, userPrompt: parts.join(\"\\n\") };\n}\n\nfunction pruneSelectorHints(selector: Selector): Record<string, unknown> {\n const pruned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(selector)) {\n if (value === null || value === undefined || value === \"\" || value === \"unknown\" || value === \":\") continue;\n pruned[key] = value;\n }\n return pruned;\n}\n","/**\n * Selector resolver prompt — Japanese (current production)\n */\n\nimport type { Selector } from \"../../../runbook-executor/types\";\nimport type { RetryContext } from \"../../../harness/selector-resolver\";\n\nexport function buildSelectorMessages(\n snapshot: string,\n selector: Selector,\n stepDescription: string,\n url: string,\n contextMarkdown: string,\n retryContext?: RetryContext,\n workingMemorySummary?: string,\n): { system: string; userPrompt: string } {\n const system = [\n \"あなたはブラウザ自動操作のセレクタリゾルバーです。\",\n \"ステップの説明に基づいて、アクセシビリティスナップショット内の操作対象要素を特定してください。\",\n \"\",\n \"## マッチングの指針\",\n \"1. ステップの説明から操作対象の要素の種類(ボタン、入力フィールド、リンク等)を推定する\",\n \"2. スナップショット内で、ステップの説明と意味的に最も一致する要素を探す\",\n \"3. 周辺のテキスト、ラベル、プレースホルダー、role も手がかりにする\",\n \"4. 完全一致がなくても最も可能性の高い要素の ref を返す\",\n \"5. 該当する要素がスナップショット内に本当に存在しない場合のみ空文字を返す\",\n ].join(\"\\n\");\n\n const parts: string[] = [\n \"## ステップの説明(最重要)\",\n stepDescription,\n \"\",\n \"## セレクタのヒント(参考情報)\",\n \"以下は要素を特定するための参考情報です。完全一致しない場合でも、ステップの説明から意味的に最も近い要素を選んでください。\",\n JSON.stringify(pruneSelectorHints(selector)),\n \"\",\n \"注意:\",\n '- tagName が \"unknown\" や \":\" の場合はタグ名情報がありません',\n \"- ariaLabel はステップ説明から自動生成されたものであり、実際の aria-label 属性と一致しないことがあります\",\n \"- セレクタの完全一致よりもステップの説明との意味的一致を優先してください\",\n \"\",\n \"## 現在のURL\",\n url,\n ];\n\n if (workingMemorySummary) {\n parts.push(\"\", \"## 実行コンテキスト\", workingMemorySummary);\n }\n\n parts.push(\n \"\",\n \"## アクセシビリティスナップショット\",\n snapshot,\n );\n\n const includeContext = contextMarkdown && !(retryContext && retryContext.attempt > 0);\n if (includeContext) {\n parts.push(\"\", \"## 補足コンテキスト\", contextMarkdown);\n }\n\n if (retryContext && retryContext.attempt > 0) {\n parts.push(\n \"\",\n \"## 回復コンテキスト(試行\" + (retryContext.attempt + 1) + \"回目)\",\n );\n\n // FailureRegistry からの回復ヒント\n if (retryContext.failureHints) {\n parts.push(`パターン: ${retryContext.failureHints}`);\n }\n\n if (retryContext.failureHistory.length > 0) {\n const recent = retryContext.failureHistory.slice(-2);\n parts.push(`直近の失敗: ${recent.join(\"; \")}`);\n }\n if (retryContext.previousAiResponse) {\n try {\n const parsed = JSON.parse(retryContext.previousAiResponse);\n if (parsed.reasoning) {\n parts.push(`前回の推論: \"${parsed.reasoning}\"`);\n }\n } catch {\n parts.push(`前回の応答: ${retryContext.previousAiResponse.slice(0, 200)}`);\n }\n }\n if (!retryContext.snapshotChanged) {\n parts.push(\n \"スナップショット未変化 — 部分一致、roleベースのマッチング、近接要素からの推定を試みてください。\",\n );\n }\n }\n\n return { system, userPrompt: parts.join(\"\\n\") };\n}\n\nfunction pruneSelectorHints(selector: Selector): Record<string, unknown> {\n const pruned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(selector)) {\n if (value === null || value === undefined || value === \"\" || value === \"unknown\" || value === \":\") continue;\n pruned[key] = value;\n }\n return pruned;\n}\n","/**\n * Goal agent (fallback) prompt — English\n */\n\nimport type { GoalAgentStep } from \"../../../harness/goal-agent\";\n\nexport function buildFallbackMessages(\n snapshot: string,\n step: GoalAgentStep,\n failureHistory: string[],\n url: string,\n contextMarkdown: string,\n): { system: string; userPrompt: string } {\n const system = [\n \"You are a problem-solving agent for browser automation.\",\n \"Normal selector resolution has failed at all phases. Analyze the entire page and find an alternative operation path.\",\n \"\",\n \"## Alternative Path Search Guidelines\",\n \"1. Check if the target element is hidden inside a hamburger menu, dropdown, or accordion\",\n \"2. Check if a modal or overlay is covering the target element\",\n \"3. Check if the page is in an unexpected state (not logged in, error state, loading)\",\n \"4. Check if the target element is above the current scroll position\",\n \"5. Check if a semantically equivalent alternative element exists (e.g., a button instead of a link)\",\n \"\",\n \"## Alternative Strategy Selection Criteria\",\n \"- direct_ref: Try a different ref directly (when a semantically equivalent element is found)\",\n \"- scroll_up_and_retry: When the target element might be above the current view\",\n \"- expand_collapsed: When a collapsed section/menu needs to be expanded (prerequisiteRef required)\",\n \"- dismiss_overlay: When a modal/overlay needs to be closed (prerequisiteRef required)\",\n \"- tab_navigation: When the element can be reached via Tab key focus navigation\",\n \"- not_found: When the target element truly does not exist on the page\",\n ].join(\"\\n\");\n\n const parts = [\n \"## Step Being Attempted\",\n `Description: ${step.description}`,\n `Action: ${step.action.type}`,\n `Selector hints: ${JSON.stringify(step.action.selector, null, 2)}`,\n `URL: ${url}`,\n \"\",\n \"## Failure History\",\n ...failureHistory.map((f, i) => ` ${i + 1}. ${f}`),\n \"\",\n \"## Current Page Snapshot (Filtered)\",\n snapshot,\n ];\n\n if (contextMarkdown) {\n parts.push(\"\", \"## Supplementary Context\", contextMarkdown);\n }\n\n return { system, userPrompt: parts.join(\"\\n\") };\n}\n","/**\n * Goal agent (fallback) prompt — Japanese (current production)\n */\n\nimport type { GoalAgentStep } from \"../../../harness/goal-agent\";\n\nexport function buildFallbackMessages(\n snapshot: string,\n step: GoalAgentStep,\n failureHistory: string[],\n url: string,\n contextMarkdown: string,\n): { system: string; userPrompt: string } {\n const system = [\n \"あなたはブラウザ自動操作の問題解決エージェントです。\",\n \"通常のセレクタ解決が全フェーズ失敗しました。ページ全体を分析して代替操作パスを見つけてください。\",\n \"\",\n \"## 代替パス探索の指針\",\n \"1. ハンバーガーメニュー、ドロップダウン、アコーディオンの中に対象要素が隠れていないか確認\",\n \"2. モーダルやオーバーレイが前面にあって対象要素を隠していないか確認\",\n \"3. ページが想定と異なる状態(未ログイン、エラー状態、ローディング中)でないか確認\",\n \"4. 対象要素が上方にあってスクロールで隠れていないか確認\",\n \"5. 意味的に同等な別の要素(リンクではなくボタン、等)が存在しないか確認\",\n \"\",\n \"## 代替戦略の選択基準\",\n \"- direct_ref: 別の ref を直接試す(意味的に同等な要素が見つかった場合)\",\n \"- scroll_up_and_retry: 対象要素が上方にある可能性がある場合\",\n \"- expand_collapsed: 折り畳まれたセクション/メニューを展開する必要がある場合(prerequisiteRef 必須)\",\n \"- dismiss_overlay: モーダル/オーバーレイを閉じる必要がある場合(prerequisiteRef 必須)\",\n \"- tab_navigation: Tab キーでフォーカス移動して到達できる場合\",\n \"- not_found: 本当にページ上に対象要素が存在しない場合\",\n ].join(\"\\n\");\n\n const parts = [\n \"## 達成しようとしていたステップ\",\n `説明: ${step.description}`,\n `アクション: ${step.action.type}`,\n `セレクタヒント: ${JSON.stringify(step.action.selector, null, 2)}`,\n `URL: ${url}`,\n \"\",\n \"## これまでの失敗履歴\",\n ...failureHistory.map((f, i) => ` ${i + 1}. ${f}`),\n \"\",\n \"## 現在のページスナップショット(フィルタ済み)\",\n snapshot,\n ];\n\n if (contextMarkdown) {\n parts.push(\"\", \"## 補足コンテキスト\", contextMarkdown);\n }\n\n return { system, userPrompt: parts.join(\"\\n\") };\n}\n","/**\n * Vision resolver prompt — English\n */\n\nimport type { Selector } from \"../../../runbook-executor/types\";\nimport type { Annotation } from \"../../../browser/engine\";\n\nexport function buildVisionMessages(\n annotations: Annotation[],\n selector: Selector,\n stepDescription: string,\n url: string,\n failureHistory: string[],\n): { system: string; userTextContent: string } {\n const system = [\n \"You are a visual selector resolver for browser automation.\",\n \"The text-based accessibility tree could not find the element.\",\n \"Analyze the screenshot visually to identify the target element.\",\n \"\",\n \"## How to Read the Screenshot\",\n \"- Each interactive element has a red border and number label\",\n \"- Number labels are displayed at the top-left of each element\",\n \"- Each number corresponds to the number field in the annotation list below\",\n \"\",\n \"## Matching Guidelines\",\n \"1. Infer the type of target element (button, input field, link, etc.) from the step description\",\n \"2. Find the element in the screenshot that visually best matches\",\n \"3. Use element text, position, and appearance as clues\",\n \"4. Also reference the role and name from the annotation list\",\n \"5. Target elements not in the A11y tree (canvas, Shadow DOM, iframe, etc.) are also in scope\",\n \"6. Return empty string if confidence is low (below 0.5)\",\n ].join(\"\\n\");\n\n const annotationList = annotations\n .map((a) => {\n const nameStr = a.name ? ` \"${a.name}\"` : \"\";\n return ` #${a.number} ref=${a.ref} ${a.role}${nameStr} @(${a.box.x},${a.box.y})`;\n })\n .join(\"\\n\");\n\n const selectorHints = pruneSelectorHints(selector);\n\n const parts: string[] = [\n \"## Step Description (Most Important)\",\n stepDescription,\n \"\",\n \"## Selector Hints (Reference)\",\n JSON.stringify(selectorHints),\n \"\",\n \"## Current URL\",\n url,\n \"\",\n \"## Annotation List (Corresponds to Numbers on Screenshot)\",\n annotationList,\n ];\n\n if (failureHistory.length > 0) {\n const recent = failureHistory.slice(-3);\n parts.push(\n \"\",\n \"## Text-based Resolution Failure History (Recent 3)\",\n ...recent.map((f, i) => ` ${i + 1}. ${f}`),\n );\n }\n\n return { system, userTextContent: parts.join(\"\\n\") };\n}\n\nfunction pruneSelectorHints(selector: Selector): Record<string, unknown> {\n const pruned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(selector)) {\n if (value === null || value === undefined || value === \"\" || value === \"unknown\" || value === \":\") continue;\n pruned[key] = value;\n }\n return pruned;\n}\n","/**\n * Vision resolver prompt — Japanese (current production)\n */\n\nimport type { Selector } from \"../../../runbook-executor/types\";\nimport type { Annotation } from \"../../../browser/engine\";\n\nexport function buildVisionMessages(\n annotations: Annotation[],\n selector: Selector,\n stepDescription: string,\n url: string,\n failureHistory: string[],\n): { system: string; userTextContent: string } {\n const system = [\n \"あなたはブラウザ自動操作のビジュアルセレクタリゾルバーです。\",\n \"テキストベースのアクセシビリティツリーでは要素が見つかりませんでした。\",\n \"スクリーンショットを視覚的に分析して、操作対象の要素を特定してください。\",\n \"\",\n \"## スクリーンショットの見方\",\n \"- 各インタラクティブ要素に赤い枠線と番号ラベルが表示されています\",\n \"- 番号ラベルは各要素の左上に表示されます\",\n \"- 各番号は下記のアノテーション一覧の number フィールドに対応します\",\n \"\",\n \"## マッチングの指針\",\n \"1. ステップの説明から操作対象の要素の種類(ボタン、入力フィールド、リンク等)を推定\",\n \"2. スクリーンショット内で視覚的に最も一致する要素を探す\",\n \"3. 要素のテキスト、位置、外観を手がかりにする\",\n \"4. アノテーション一覧の role と name も参考にする\",\n \"5. A11y ツリーに表れない要素(canvas、Shadow DOM、iframe 内等)も対象\",\n \"6. 確信度が低い場合(0.5未満)は空文字を返す\",\n ].join(\"\\n\");\n\n const annotationList = annotations\n .map((a) => {\n const nameStr = a.name ? ` \"${a.name}\"` : \"\";\n return ` #${a.number} ref=${a.ref} ${a.role}${nameStr} @(${a.box.x},${a.box.y})`;\n })\n .join(\"\\n\");\n\n const selectorHints = pruneSelectorHints(selector);\n\n const parts: string[] = [\n \"## ステップの説明(最重要)\",\n stepDescription,\n \"\",\n \"## セレクタのヒント(参考情報)\",\n JSON.stringify(selectorHints),\n \"\",\n \"## 現在のURL\",\n url,\n \"\",\n \"## アノテーション一覧(スクリーンショット上の番号と対応)\",\n annotationList,\n ];\n\n if (failureHistory.length > 0) {\n const recent = failureHistory.slice(-3);\n parts.push(\n \"\",\n \"## テキストベース解決の失敗履歴(直近3件)\",\n ...recent.map((f, i) => ` ${i + 1}. ${f}`),\n );\n }\n\n return { system, userTextContent: parts.join(\"\\n\") };\n}\n\nfunction pruneSelectorHints(selector: Selector): Record<string, unknown> {\n const pruned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(selector)) {\n if (value === null || value === undefined || value === \"\" || value === \"unknown\" || value === \":\") continue;\n pruned[key] = value;\n }\n return pruned;\n}\n","/**\n * Self-heal analyzer prompt — English\n */\n\nimport type { ParsedRunbook } from \"../../../runbook-executor/types\";\n\nexport function getSuggestionSystemPrompt(): string {\n return [\n \"You are an runbook debugger for browser automation.\",\n \"Analyze the failed steps from the debug execution and generate fix suggestions for the runbook and context.\",\n \"\",\n \"## Fix Suggestion Guidelines\",\n \"\",\n \"For each failed step, provide suggestions from these two perspectives:\",\n \"\",\n \"### 1. runbookFix (Runbook YAML Fix)\",\n \"- Selector changes (when element has moved/been renamed)\",\n \"- Step addition/removal (when the navigation flow has changed)\",\n \"- Action value updates (text or URL changes)\",\n \"- riskLevel or requiresConfirmation adjustments\",\n `Example: \"Step 3: Change selector ariaLabel from 'Submit' to 'Confirm and Submit'\"`,\n \"\",\n \"### 2. contextFix (Context Markdown Fix)\",\n \"- Document page structure changes (new modals, menu structure changes, etc.)\",\n \"- Add prerequisites (login state, permissions, environment conditions, etc.)\",\n \"- Add selector resolution hints (dynamic ID naming patterns, etc.)\",\n `Example: \"Add to context: 'Settings page has changed from tab UI to accordion UI'\"`,\n \"\",\n \"If context markdown is not provided, return empty string for contextFix.\",\n \"\",\n \"### severity Criteria\",\n \"- error: Selector completely not found, fundamental page structure change\",\n \"- warning: Succeeded with retry but unstable, element position or label slightly changed\",\n \"\",\n \"### Template Variable Protection\",\n \"- If step values contain {{varName}} template variables, preserve them as-is in fix suggestions\",\n \"- Template variables are dynamic references resolved at runtime. Do not suggest replacing them with literal values\",\n \"\",\n \"### failureCategory and suggestedStrategy\",\n \"If a failure category is provided, describe a specific fix strategy in suggestedStrategy:\",\n \"- element_not_found: Update selector ariaLabel/role/text to match current page structure\",\n \"- element_stale: Delete selector cache and re-execute\",\n \"- page_structure_changed: Document page structure changes in context.md and update all selectors\",\n \"- navigation_timeout: Add wait step or increase step-delay\",\n \"- action_failed: Consider changing action type (e.g., click → hover)\",\n \"- unknown: Analyze error details and propose specific remediation\",\n ].join(\"\\n\");\n}\n\nexport function buildSuggestionUserPrompt(\n failedInfo: string[],\n stepsInfo: string[],\n runbook: ParsedRunbook,\n contextMarkdown: string,\n): string {\n const parts: string[] = [\n \"## Instruction Information\",\n `Title: ${runbook.title}`,\n `Goal: ${runbook.metadata.goal}`,\n `Start URL: ${runbook.metadata.startUrl}`,\n \"\",\n \"## Instruction Steps\",\n stepsInfo.join(\"\\n\\n\"),\n \"\",\n \"## Failed Step Details\",\n failedInfo.join(\"\\n\\n\"),\n ];\n\n if (contextMarkdown) {\n parts.push(\n \"\",\n \"## Current Context (markdown)\",\n contextMarkdown,\n );\n } else {\n parts.push(\n \"\",\n \"## Context\",\n \"Context markdown is not provided. Return empty string for contextFix.\",\n );\n }\n\n return parts.join(\"\\n\");\n}\n","/**\n * Self-heal analyzer prompt — Japanese (current production)\n */\n\nimport type { ParsedRunbook } from \"../../../runbook-executor/types\";\n\nexport function getSuggestionSystemPrompt(): string {\n return [\n \"あなたはブラウザ自動操作の手順書デバッガーです。\",\n \"デバッグ実行で失敗したステップを分析し、手順書とコンテキストの修正提案を生成してください。\",\n \"\",\n \"## 修正提案の指針\",\n \"\",\n \"各失敗ステップについて、以下の2つの観点で修正提案を出してください:\",\n \"\",\n \"### 1. runbookFix(手順書 YAML の修正)\",\n \"- セレクタの変更(要素が移動/リネームされた場合)\",\n \"- ステップの追加/削除(導線が変わった場合)\",\n \"- アクション値の更新(テキストやURLの変更)\",\n \"- riskLevel や requiresConfirmation の調整\",\n '例: 「Step 3: selector の ariaLabel を \\'送信\\' → \\'確認して送信\\' に変更」',\n \"\",\n \"### 2. contextFix(context markdown の修正)\",\n \"- ページ構造変更の記載(新しいモーダル、メニュー構造の変更など)\",\n \"- 前提条件の追加(ログイン状態、権限、環境条件など)\",\n \"- セレクタ解決のヒント追加(動的IDの命名規則など)\",\n '例: 「context に\\'設定画面がタブUIからアコーディオンUIに変更された\\'旨を追記」',\n \"\",\n \"context markdown が未提供の場合、contextFix は空文字で返してください。\",\n \"\",\n \"### severity の判定基準\",\n \"- error: セレクタが完全に見つからない、ページ構造が根本的に変わっている\",\n \"- warning: リトライで成功したが不安定、要素の位置やラベルが微妙に変わっている\",\n \"\",\n \"### テンプレート変数の保護\",\n \"- ステップの値に {{varName}} 形式のテンプレート変数が含まれている場合、修正提案でもそのまま維持してください\",\n \"- テンプレート変数は実行時に動的に展開される変数参照です。リテラル値への置換を提案しないでください\",\n \"\",\n \"### failureCategory と suggestedStrategy\",\n \"エラー分類カテゴリが提供されている場合、それに基づいて具体的な修正戦略を suggestedStrategy に記載してください:\",\n \"- element_not_found: セレクタの ariaLabel/role/text を現在のページ構造に合わせて更新\",\n \"- element_stale: セレクタキャッシュの削除と再実行\",\n \"- page_structure_changed: context.md にページ構造変更を記録し、セレクタを全面更新\",\n \"- navigation_timeout: wait ステップの追加または step-delay の増加\",\n \"- action_failed: アクション種別の変更(例: click → hover)を検討\",\n \"- unknown: エラー内容を詳細に分析し、具体的な対処を提案\",\n ].join(\"\\n\");\n}\n\nexport function buildSuggestionUserPrompt(\n failedInfo: string[],\n stepsInfo: string[],\n runbook: ParsedRunbook,\n contextMarkdown: string,\n): string {\n const parts: string[] = [\n \"## 手順書情報\",\n `タイトル: ${runbook.title}`,\n `目的: ${runbook.metadata.goal}`,\n `開始URL: ${runbook.metadata.startUrl}`,\n \"\",\n \"## 手順書のステップ一覧\",\n stepsInfo.join(\"\\n\\n\"),\n \"\",\n \"## 失敗ステップの詳細\",\n failedInfo.join(\"\\n\\n\"),\n ];\n\n if (contextMarkdown) {\n parts.push(\n \"\",\n \"## 現在のコンテキスト(markdown)\",\n contextMarkdown,\n );\n } else {\n parts.push(\n \"\",\n \"## コンテキスト\",\n \"context markdown は未提供です。contextFix は空文字で返してください。\",\n );\n }\n\n return parts.join(\"\\n\");\n}\n","/**\n * i18n/prompts --- ロケール切替ディスパッチャー\n *\n * AI プロンプト(複雑な複数行テンプレート)をロケールごとに切り替える。\n * 各プロンプトモジュールは関数を export し、ディスパッチャーが getLocale() に\n * 基づいて適切なロケールの関数を呼び出す。\n */\n\nimport { getLocale } from \"../index\";\n\nimport { getAgentInstructions as getAgentInstructionsEn, getInitialUserMessage as getInitialUserMessageEn } from \"./en/exploration\";\nimport { getAgentInstructions as getAgentInstructionsJa, getInitialUserMessage as getInitialUserMessageJa } from \"./ja/exploration\";\n\nimport { getReviewSystemPrompt as getReviewSystemPromptEn, createReviewUserPrompt as createReviewUserPromptEn } from \"./en/review\";\nimport { getReviewSystemPrompt as getReviewSystemPromptJa, createReviewUserPrompt as createReviewUserPromptJa } from \"./ja/review\";\n\nimport { buildSelectorMessages as buildSelectorMessagesEn } from \"./en/selector\";\nimport { buildSelectorMessages as buildSelectorMessagesJa } from \"./ja/selector\";\n\nimport { buildFallbackMessages as buildFallbackMessagesEn } from \"./en/goal-agent\";\nimport { buildFallbackMessages as buildFallbackMessagesJa } from \"./ja/goal-agent\";\n\nimport { buildVisionMessages as buildVisionMessagesEn } from \"./en/vision\";\nimport { buildVisionMessages as buildVisionMessagesJa } from \"./ja/vision\";\n\nimport { getSuggestionSystemPrompt as getSuggestionSystemPromptEn, buildSuggestionUserPrompt as buildSuggestionUserPromptEn } from \"./en/self-heal\";\nimport { getSuggestionSystemPrompt as getSuggestionSystemPromptJa, buildSuggestionUserPrompt as buildSuggestionUserPromptJa } from \"./ja/self-heal\";\n\nimport type { SecretsData } from \"../../cli/secrets-loader\";\nimport type { RecordedStep, InterventionRecord } from \"../../runbook-generator/types\";\nimport type { Selector } from \"../../runbook-executor/types\";\nimport type { RetryContext } from \"../../harness/selector-resolver\";\nimport type { GoalAgentStep } from \"../../harness/goal-agent\";\nimport type { Annotation } from \"../../browser/engine\";\nimport type { ParsedRunbook } from \"../../runbook-executor/types\";\n\n// ── Exploration ──\n\nexport function getAgentInstructions(\n goal: string,\n contextMarkdown: string,\n secrets?: SecretsData,\n locale?: \"en\" | \"ja\",\n): string {\n const effectiveLocale = locale ?? getLocale();\n return effectiveLocale === \"ja\"\n ? getAgentInstructionsJa(goal, contextMarkdown, secrets)\n : getAgentInstructionsEn(goal, contextMarkdown, secrets);\n}\n\nexport function getInitialUserMessage(locale?: \"en\" | \"ja\"): string {\n const effectiveLocale = locale ?? getLocale();\n return effectiveLocale === \"ja\"\n ? getInitialUserMessageJa()\n : getInitialUserMessageEn();\n}\n\n// ── Review ──\n\nexport function getReviewSystemPrompt(locale?: \"en\" | \"ja\"): string {\n const effectiveLocale = locale ?? getLocale();\n return effectiveLocale === \"ja\"\n ? getReviewSystemPromptJa()\n : getReviewSystemPromptEn();\n}\n\nexport function createReviewUserPrompt(\n goal: string,\n recordedSteps: RecordedStep[],\n goalAchieved: boolean,\n interventions?: InterventionRecord[],\n locale?: \"en\" | \"ja\",\n): string {\n const effectiveLocale = locale ?? getLocale();\n return effectiveLocale === \"ja\"\n ? createReviewUserPromptJa(goal, recordedSteps, goalAchieved, interventions)\n : createReviewUserPromptEn(goal, recordedSteps, goalAchieved, interventions);\n}\n\n// ── Selector ──\n\nexport function buildSelectorMessages(\n snapshot: string,\n selector: Selector,\n stepDescription: string,\n url: string,\n contextMarkdown: string,\n retryContext?: RetryContext,\n workingMemorySummary?: string,\n): { system: string; userPrompt: string } {\n return getLocale() === \"ja\"\n ? buildSelectorMessagesJa(snapshot, selector, stepDescription, url, contextMarkdown, retryContext, workingMemorySummary)\n : buildSelectorMessagesEn(snapshot, selector, stepDescription, url, contextMarkdown, retryContext, workingMemorySummary);\n}\n\n// ── Goal Agent ──\n\nexport function buildFallbackMessages(\n snapshot: string,\n step: GoalAgentStep,\n failureHistory: string[],\n url: string,\n contextMarkdown: string,\n): { system: string; userPrompt: string } {\n return getLocale() === \"ja\"\n ? buildFallbackMessagesJa(snapshot, step, failureHistory, url, contextMarkdown)\n : buildFallbackMessagesEn(snapshot, step, failureHistory, url, contextMarkdown);\n}\n\n// ── Vision ──\n\nexport function buildVisionMessages(\n annotations: Annotation[],\n selector: Selector,\n stepDescription: string,\n url: string,\n failureHistory: string[],\n): { system: string; userTextContent: string } {\n return getLocale() === \"ja\"\n ? buildVisionMessagesJa(annotations, selector, stepDescription, url, failureHistory)\n : buildVisionMessagesEn(annotations, selector, stepDescription, url, failureHistory);\n}\n\n// ── Self-Heal ──\n\nexport function getSuggestionSystemPrompt(): string {\n return getLocale() === \"ja\"\n ? getSuggestionSystemPromptJa()\n : getSuggestionSystemPromptEn();\n}\n\nexport function buildSuggestionUserPrompt(\n failedInfo: string[],\n stepsInfo: string[],\n runbook: ParsedRunbook,\n contextMarkdown: string,\n): string {\n return getLocale() === \"ja\"\n ? buildSuggestionUserPromptJa(failedInfo, stepsInfo, runbook, contextMarkdown)\n : buildSuggestionUserPromptEn(failedInfo, stepsInfo, runbook, contextMarkdown);\n}\n"],"mappings":";;;;;;AAMA,IAAM,iBAAiB;AA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AAM,OACnBA,2BAA4B,YAAY,WAAW,SAAS,eAAe,IAC3E,0BAA4B,YAAY,WAAW,SAAS,eAAe;AACjF;","names":["COMMAND_SCHEMA","getAgentInstructions","getInitialUserMessage","getReviewSystemPrompt","createReviewUserPrompt","buildSelectorMessages","pruneSelectorHints","buildFallbackMessages","pruneSelectorHints","buildVisionMessages","pruneSelectorHints","getSuggestionSystemPrompt","buildSuggestionUserPrompt","getAgentInstructions","getInitialUserMessage","getReviewSystemPrompt","createReviewUserPrompt","buildSelectorMessages","buildFallbackMessages","buildVisionMessages","getSuggestionSystemPrompt","buildSuggestionUserPrompt"]}
@@ -59,6 +59,7 @@ var messages = {
59
59
  unresolvedRequired: "{count} required variables are unresolved. Please enter them.",
60
60
  placeholder: "(required \u2014 could not extract from context)",
61
61
  variableRequired: 'Variable "{name}" is required',
62
+ promptVariables: "Prompt variables (edit or press Enter to keep defaults)",
62
63
  preVariables: "Pre-resolved variables:",
63
64
  runtimeCaptures: "Runtime captures:",
64
65
  controlFlow: "Control flow:",
@@ -80,6 +81,7 @@ var messages = {
80
81
  pageStructureChanged: "Page structure has significantly changed. Record the changes in context.md",
81
82
  navigationTimeout: "Page navigation is delayed. Consider adding a wait step or increasing step-delay",
82
83
  actionFailed: "Element was found but the action failed. Consider changing the action type (e.g., click \u2192 hover)",
84
+ scriptSyntaxError: "Extract script has a syntax error. Check for truncated code or top-level return statements",
83
85
  unknownError: "Review the error details and check the corresponding runbook step",
84
86
  scriptExecutionError: "Script execution error",
85
87
  browserActionError: "Browser action error",
@@ -293,7 +295,7 @@ var messages = {
293
295
  tenant: {
294
296
  slugLength: "Slug must be between 3 and 48 characters",
295
297
  slugPattern: "Slug must contain only lowercase letters, numbers, and hyphens",
296
- slugReserved: 'Slugs starting with "user-" are reserved',
298
+ slugReserved: 'Slugs starting with "u-" are reserved',
297
299
  slugTaken: "Slug is already taken"
298
300
  },
299
301
  compose: {
@@ -372,7 +374,8 @@ var messages = {
372
374
  missingCredentials: "Missing required credentials for {platform}: {fields}",
373
375
  planFeatureRequired: "This feature requires {tier} plan or higher",
374
376
  planStepLimitExceeded: "Runbook has {count} steps, but your plan allows up to {limit}",
375
- scheduledAtMustBeFuture: "Scheduled time has already passed. Please select a future date and time."
377
+ scheduledAtMustBeFuture: "Scheduled time has already passed. Please select a future date and time.",
378
+ recurringBlockedByPromptVars: "Recurring schedules are not available for runbooks with prompt variables"
376
379
  }
377
380
  };
378
381
  var en_default = messages;
@@ -436,6 +439,7 @@ var messages2 = {
436
439
  unresolvedRequired: "{count}\u4EF6\u306E\u5FC5\u9808\u5909\u6570\u304C\u672A\u89E3\u6C7A\u3067\u3059\u3002\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
437
440
  placeholder: "(\u5FC5\u9808 \u2014 context\u304B\u3089\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F)",
438
441
  variableRequired: '\u5909\u6570 "{name}" \u306F\u5FC5\u9808\u3067\u3059',
442
+ promptVariables: "\u5165\u529B\u5909\u6570\uFF08\u7DE8\u96C6\u3059\u308B\u304B Enter \u3067\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u7DAD\u6301\uFF09",
439
443
  preVariables: "\u4E8B\u524D\u5909\u6570:",
440
444
  runtimeCaptures: "\u30E9\u30F3\u30BF\u30A4\u30E0\u30AD\u30E3\u30D7\u30C1\u30E3:",
441
445
  controlFlow: "\u5236\u5FA1\u30D5\u30ED\u30FC:",
@@ -457,6 +461,7 @@ var messages2 = {
457
461
  pageStructureChanged: "\u30DA\u30FC\u30B8\u69CB\u9020\u304C\u5927\u5E45\u306B\u5909\u5316\u3057\u3066\u3044\u307E\u3059\u3002context.md \u306B\u30DA\u30FC\u30B8\u69CB\u9020\u306E\u5909\u66F4\u3092\u8A18\u9332\u3057\u3066\u304F\u3060\u3055\u3044",
458
462
  navigationTimeout: "\u30DA\u30FC\u30B8\u9077\u79FB\u304C\u9045\u5EF6\u3057\u3066\u3044\u307E\u3059\u3002wait \u30B9\u30C6\u30C3\u30D7\u306E\u8FFD\u52A0\u307E\u305F\u306F step-delay \u306E\u5897\u52A0\u3092\u691C\u8A0E\u3057\u3066\u304F\u3060\u3055\u3044",
459
463
  actionFailed: "\u8981\u7D20\u306F\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u304C\u30A2\u30AF\u30B7\u30E7\u30F3\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u30A2\u30AF\u30B7\u30E7\u30F3\u7A2E\u5225\u306E\u5909\u66F4\uFF08\u4F8B: click \u2192 hover\uFF09\u3092\u691C\u8A0E\u3057\u3066\u304F\u3060\u3055\u3044",
464
+ scriptSyntaxError: "extract \u30B9\u30AF\u30EA\u30D7\u30C8\u306B\u69CB\u6587\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059\u3002\u30B3\u30FC\u30C9\u306E\u9014\u4E2D\u5207\u65AD\u3084\u30C8\u30C3\u30D7\u30EC\u30D9\u30EB return \u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044",
460
465
  unknownError: "\u30A8\u30E9\u30FC\u5185\u5BB9\u3092\u78BA\u8A8D\u3057\u3001\u624B\u9806\u66F8\u306E\u8A72\u5F53\u30B9\u30C6\u30C3\u30D7\u3092\u898B\u76F4\u3057\u3066\u304F\u3060\u3055\u3044",
461
466
  scriptExecutionError: "\u30B9\u30AF\u30EA\u30D7\u30C8\u5B9F\u884C\u30A8\u30E9\u30FC",
462
467
  browserActionError: "\u30D6\u30E9\u30A6\u30B6\u64CD\u4F5C\u30A8\u30E9\u30FC",
@@ -670,7 +675,7 @@ var messages2 = {
670
675
  tenant: {
671
676
  slugLength: "Slug \u306F 3\u301C48 \u6587\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
672
677
  slugPattern: "Slug \u306B\u306F\u5C0F\u6587\u5B57\u82F1\u6570\u5B57\u3068\u30CF\u30A4\u30D5\u30F3\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059",
673
- slugReserved: '"user-" \u3067\u59CB\u307E\u308B Slug \u306F\u4E88\u7D04\u3055\u308C\u3066\u3044\u307E\u3059',
678
+ slugReserved: '"u-" \u3067\u59CB\u307E\u308B Slug \u306F\u4E88\u7D04\u3055\u308C\u3066\u3044\u307E\u3059',
674
679
  slugTaken: "\u3053\u306E Slug \u306F\u65E2\u306B\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059"
675
680
  },
676
681
  compose: {
@@ -749,7 +754,8 @@ var messages2 = {
749
754
  missingCredentials: "{platform} \u306E\u5FC5\u9808\u8A8D\u8A3C\u60C5\u5831\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u307E\u3059: {fields}",
750
755
  planFeatureRequired: "\u3053\u306E\u6A5F\u80FD\u306F {tier} \u30D7\u30E9\u30F3\u4EE5\u4E0A\u3067\u5229\u7528\u53EF\u80FD\u3067\u3059",
751
756
  planStepLimitExceeded: "\u624B\u9806\u66F8\u306E\u30B9\u30C6\u30C3\u30D7\u6570\u304C {count} \u3067\u3059\u304C\u3001\u73FE\u5728\u306E\u30D7\u30E9\u30F3\u306E\u4E0A\u9650\u306F {limit} \u3067\u3059",
752
- scheduledAtMustBeFuture: "\u4E88\u7D04\u6642\u523B\u3092\u904E\u304E\u3066\u3044\u307E\u3059\u3002\u672A\u6765\u306E\u65E5\u6642\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
757
+ scheduledAtMustBeFuture: "\u4E88\u7D04\u6642\u523B\u3092\u904E\u304E\u3066\u3044\u307E\u3059\u3002\u672A\u6765\u306E\u65E5\u6642\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
758
+ recurringBlockedByPromptVars: "\u5165\u529B\u5909\u6570\u3092\u542B\u3080\u624B\u9806\u66F8\u3067\u306F\u5B9A\u671F\u5B9F\u884C\u3092\u5229\u7528\u3067\u304D\u307E\u305B\u3093"
753
759
  }
754
760
  };
755
761
  var ja_default = messages2;
@@ -824,62 +830,6 @@ function resolveAcceptLanguage(acceptLanguage) {
824
830
  return jaIndex < enIndex ? "ja" : "en";
825
831
  }
826
832
 
827
- // src/cli/prompts.ts
828
- import * as p from "@clack/prompts";
829
- function exitIfCancelled(value) {
830
- if (p.isCancel(value)) {
831
- p.cancel(t("cli.cancelledMessage"));
832
- process.exit(0);
833
- }
834
- return value;
835
- }
836
- function formatRiskHint(level) {
837
- const keyMap = {
838
- low: "risk.low",
839
- medium: "risk.medium",
840
- high: "risk.high"
841
- };
842
- return t(keyMap[level]);
843
- }
844
- async function promptSelect(message, options) {
845
- const result = await p.select({
846
- message,
847
- options
848
- });
849
- return exitIfCancelled(result);
850
- }
851
- async function promptMultiselect(message, options, opts) {
852
- const result = await p.multiselect({
853
- message,
854
- options,
855
- initialValues: opts?.initialValues,
856
- required: opts?.required ?? false
857
- });
858
- return exitIfCancelled(result);
859
- }
860
- async function promptText(message, opts) {
861
- const result = await p.text({
862
- message,
863
- initialValue: opts?.initialValue,
864
- placeholder: opts?.placeholder,
865
- validate: opts?.validate
866
- });
867
- return exitIfCancelled(result);
868
- }
869
- async function promptConfirm(message, initialValue) {
870
- const result = await p.confirm({
871
- message,
872
- initialValue
873
- });
874
- return exitIfCancelled(result);
875
- }
876
- var intro2 = p.intro;
877
- var outro2 = p.outro;
878
- var note2 = p.note;
879
- var cancel2 = p.cancel;
880
- var log2 = p.log;
881
- var isDebug = process.env.DEBUG === "1" || process.env.DEBUG === "true";
882
-
883
833
  export {
884
834
  getLocale,
885
835
  initLocale,
@@ -887,16 +837,6 @@ export {
887
837
  tf,
888
838
  tWithLocale,
889
839
  tfWithLocale,
890
- resolveAcceptLanguage,
891
- formatRiskHint,
892
- promptSelect,
893
- promptMultiselect,
894
- promptText,
895
- promptConfirm,
896
- intro2 as intro,
897
- outro2 as outro,
898
- note2 as note,
899
- cancel2 as cancel,
900
- log2 as log
840
+ resolveAcceptLanguage
901
841
  };
902
- //# sourceMappingURL=chunk-7UCVPKD4.js.map
842
+ //# sourceMappingURL=chunk-F7WTOQIQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/i18n/messages/en.ts","../../../src/i18n/messages/ja.ts","../../../src/i18n/index.ts"],"sourcesContent":["/**\n * English message catalog (default)\n */\nimport type { Messages } from \"../types\";\n\nconst messages: Messages = {\n common: {\n success: \"Success\",\n failure: \"Failed\",\n skipped: \"Skipped\",\n aborted: \"Aborted\",\n none: \"(none)\",\n unknown: \"(unknown)\",\n items: \"items\",\n files: \"files\",\n conditionSkipped: \"condition skipped\",\n iterations: \"iterations\",\n iteration: \"iteration\",\n },\n risk: {\n low: \"Low-side-effect operation\",\n medium: \"Form submission, settings change, etc.\",\n high: \"Irreversible operation (deletion, payment, etc.)\",\n },\n reporter: {\n runbook: \"Runbook: {title}\",\n startUrl: \"Start URL: {url}\",\n totalSteps: \"Total steps: {count}\",\n statsLine: \"Executed: {executed} Succeeded: {succeeded} Failed: {failed} Skipped: {skipped}\",\n statusAborted: \"Status: Aborted\",\n totalDuration: \"Total duration: {duration}\",\n memory: \"Memory: {info}\",\n downloads: \"Downloads: {count} files\",\n executionResult: \"Execution Result\",\n batchResult: \"Batch Execution Result\",\n batchTotalRows: \"Total rows: {count}\",\n batchStats: \"Succeeded: {succeeded} Failed: {failed}\",\n },\n selfHeal: {\n debugResult: \"Self-Healing Result\",\n allStepsSuccess: \"All steps passed ({count} steps, {duration})\",\n failedSteps: \"--- Failed Steps ---\",\n yamlSuggestions: \"--- Runbook (YAML) Fix Suggestions ---\",\n contextSuggestions: \"--- Context (markdown) Fix Suggestions ---\",\n retryWarnings: \"--- Retry Warnings ---\",\n retryCount: \"#{ordinal} {description}: {count} retries (threshold: {threshold})\",\n },\n confirmation: {\n title: \"Approval Required\",\n stepInfo: \"Step {ordinal}: {description}\",\n riskLevelLabel: \"Risk level: {level} ({hint})\",\n selectAction: \"Select an action\",\n approve: \"Approve and execute\",\n skip: \"Skip this step\",\n abort: \"Abort execution\",\n abortHint: \"Stop all\",\n },\n planner: {\n extractingFromContext: \"Extracting variable values from context...\",\n extractedFromContext: \"{count} values extracted from context\",\n unresolvedRequired: \"{count} required variables are unresolved. Please enter them.\",\n placeholder: \"(required — could not extract from context)\",\n variableRequired: 'Variable \"{name}\" is required',\n promptVariables: \"Prompt variables (edit or press Enter to keep defaults)\",\n preVariables: \"Pre-resolved variables:\",\n runtimeCaptures: \"Runtime captures:\",\n controlFlow: \"Control flow:\",\n conditionLabel: \" Step {ordinal}: condition {condition}\",\n loopLabel: \" Step {ordinal}: loop (max {max} iterations, {subSteps} sub-steps, condition: {condition})\",\n forEachLabel: \" Step {ordinal}: forEach (max {max} items, {subSteps} sub-steps, source: {forEach})\",\n branchLabel: \" Step {ordinal}: branch on {value} (cases: {cases})\",\n batchMode: \"Batch mode: {count} rows ({path})\",\n stepCount: \"Step count: {count}\",\n executionPlan: \"Execution Plan\",\n confirmStart: \"Start execution?\",\n fromSecrets: \" (from secrets)\",\n fromContext: \" (extracted from context)\",\n fromDataSource: \" (from data source)\",\n },\n errors: {\n elementNotFound: \"Check the selector ariaLabel / role / text and update to match the current page structure\",\n elementStale: \"Page structure has changed. Delete the selector cache and re-run\",\n pageStructureChanged: \"Page structure has significantly changed. Record the changes in context.md\",\n navigationTimeout: \"Page navigation is delayed. Consider adding a wait step or increasing step-delay\",\n actionFailed: \"Element was found but the action failed. Consider changing the action type (e.g., click → hover)\",\n scriptSyntaxError: \"Extract script has a syntax error. Check for truncated code or top-level return statements\",\n unknownError: \"Review the error details and check the corresponding runbook step\",\n scriptExecutionError: \"Script execution error\",\n browserActionError: \"Browser action error\",\n operationTimedOut: \"Operation timed out\",\n },\n slack: {\n batchComplete: \"Batch execution complete: {title}\",\n executionComplete: \"Execution complete: {title}\",\n debugFailure: \"Self-healing validation failed: {title}\",\n failedLabel: \"Failed:\",\n failedRows: \"Failed rows:\",\n suggestionsLabel: \"Fix suggestions:\",\n retryWarningsLabel: \"Retry warnings:\",\n abortTag: \"Aborted\",\n batchTag: \"batch\",\n totalRows: \"Total {count} rows\",\n moreSteps: \"- ...{count} more steps\",\n moreRows: \"- ...{count} more rows\",\n moreItems: \"- ...{count} more items\",\n approvalRequest: \"Approval request: {description}\",\n approvalDescription: \"An approval request for an operation has arrived.\\n{goalLine}Step: \\\"{description}\\\"\\nRisk level: {riskEmoji} {riskLevel}\",\n taskLabel: \"Task: \",\n stepLabel: \"Step: \",\n riskLabel: \"Risk level: \",\n approveButton: \"Approve\",\n skipButton: \"Skip\",\n abortButton: \"Abort\",\n approvalWaiting: \"Waiting for approval (risk: {riskLevel})\",\n approvalTimeout: \":hourglass: Timed out (auto-abort)\",\n approved: \":white_check_mark: Approved\",\n slackSkipped: \":fast_forward: Skipped\",\n slackAborted: \":octagonal_sign: Aborted\",\n },\n executor: {\n openingUrl: \"Opening {url}...\",\n browserReady: \"Browser ready\",\n recordingStarted: \"Recording started: {path}\",\n recordingStartFailed: \"Failed to start recording: {error}\",\n recordingComplete: \"Recording complete: {path}\",\n recordingStopFailed: \"Failed to stop recording: {error}\",\n jobAbortedTimeout: \"Job aborted: timeout exceeded\",\n conditionSkipping: \"Condition false, skipping: {condition}\",\n stopOnErrorAborting: \"stopOnError=true, aborting execution\",\n approvalWaiting: \"Awaiting approval: Step {ordinal} (risk: {riskLevel})\",\n approvalAborted: \"Approval result: aborted (Step {ordinal})\",\n approvalSkipped: \"Approval result: skipped (Step {ordinal})\",\n approvalApproved: \"Approval result: approved (Step {ordinal})\",\n userAborted: \"User aborted\",\n batchBrowserReady: \"Batch browser ready\",\n chromeErrorDetected: \"Navigation failed: page landed on chrome-error:// (previous URL: {url})\",\n },\n chat: {\n approvalRequest: \"Approval request: {description}\",\n approvalDescription: \"An approval request for an operation has arrived.\\n{goalLine}Step: \\\"{description}\\\"\\nRisk level: {riskEmoji} {riskLevel}\",\n taskLabel: \"Task: \",\n stepLabel: \"Step: \",\n riskLabel: \"Risk level: \",\n approveButton: \"Approve\",\n skipButton: \"Skip\",\n abortButton: \"Abort\",\n approvalWaiting: \"Waiting for approval (risk: {riskLevel})\",\n approvalTimeout: \"\\u231B Timed out (auto-abort)\",\n approved: \"\\u2705 Approved\",\n chatSkipped: \"\\u23E9 Skipped\",\n chatAborted: \"\\uD83D\\uDED1 Aborted\",\n executionComplete: \"Execution complete: {title}\",\n batchComplete: \"Batch execution complete: {title}\",\n debugFailure: \"Self-healing validation failed: {title}\",\n failedLabel: \"Failed:\",\n failedRows: \"Failed rows:\",\n suggestionsLabel: \"Fix suggestions:\",\n retryWarningsLabel: \"Retry warnings:\",\n abortTag: \"Aborted\",\n batchTag: \"batch\",\n totalRows: \"Total {count} rows\",\n moreSteps: \"- ...{count} more steps\",\n moreRows: \"- ...{count} more rows\",\n moreItems: \"- ...{count} more items\",\n stepPrefix: \"Step\",\n succeededFieldLabel: \"Succeeded\",\n failedFieldLabel: \"Failed\",\n skippedFieldLabel: \"Skipped\",\n durationFieldLabel: \"Duration\",\n totalFieldLabel: \"Total\",\n generateComplete: \"Runbook generation complete\",\n goalFieldLabel: \"Goal\",\n goalAchievedFieldLabel: \"Goal achieved\",\n stepsFieldLabel: \"Steps\",\n yamlFieldLabel: \"YAML generated\",\n },\n review: {\n keptSteps: \"Kept steps:\",\n confirmationRequired: \"Steps requiring confirmation:\",\n removedSteps: \"Removed steps:\",\n capturedValues: \"Captured values from page:\",\n notes: \"Notes:\",\n guidancePrefix: \"[Guidance {index}]\",\n summaryLabel: \"Summary: {summary}\",\n reviewResult: \"Review Result\",\n confirm: \"Confirm\",\n confirmHint: \"Proceed to YAML generation\",\n toggleConfirmation: \"Toggle step confirmation requirements\",\n editCaptures: \"Edit captured values from page\",\n editCapturesHint: \"accept/reject/add\",\n editNotes: \"Edit notes\",\n editNotesHint: \"\",\n selectAction: \"Select an action\",\n selectConfirmSteps: \"Select steps requiring confirmation (Space to toggle, Enter to confirm)\",\n selectNotesAction: \"Select note action\",\n addCustomNote: \"Add custom note\",\n addSuggestedNote: \"Select from AI-suggested notes\",\n deleteNote: \"Delete notes\",\n noteContent: \"Note content\",\n noteContentRequired: \"Please enter note content\",\n notesAdded: \"{count} notes added.\",\n notesDeleted: \"{count} notes deleted.\",\n selectCaptureAction: \"Select capture action\",\n acceptAllCaptures: \"Accept all existing captures\",\n rejectCaptures: \"Reject captures\",\n addCapture: \"Add new capture\",\n allCapturesAccepted: \"All captures accepted.\",\n noCapturesAvailable: \"No captures available.\",\n selectCapturesToReject: \"Select captures to reject\",\n capturesRejected: \"{count} captures rejected.\",\n captureStepNumber: \"Target step number (ordinal)\",\n captureStepRequired: \"Please enter a step number\",\n captureStepNumeric: \"Please enter a number\",\n captureVarName: \"Capture variable name (camelCase)\",\n captureVarRequired: \"Please enter a variable name\",\n captureStrategy: \"Capture strategy\",\n strategySnapshot: \"snapshot (regex match)\",\n strategyUrl: \"url (URL regex match)\",\n strategyAi: \"ai (AI extraction)\",\n strategyExpression: \"expression (template)\",\n regexPattern: \"Regex pattern\",\n aiExtractionPrompt: \"AI extraction prompt\",\n templateExpression: \"Template expression\",\n captureAdded: 'Added capture \"{name}\" to Step #{ordinal}.',\n highRiskNote: \"Always get approval before executing high-risk steps ({ordinals})\",\n credentialNote: \"This flow contains credential input steps. Verify the execution environment's auth settings\",\n removedStepsNote: \"{count} steps were removed. The exploration may have been redundant\",\n stepNotFound: \"Step #{ordinal} not found.\",\n },\n fix: {\n noSuggestions: \"No fix suggestions found in the report.\",\n noSuggestionsHint: \"Hint: Run with --self-heal flag to generate AI fix suggestions.\",\n complete: \"Done\",\n suggestionCount: \"Fix suggestions: {count}\",\n errorLabel: \" Error: {error}\",\n categoryLabel: \" Category: {category}\",\n yamlFixLabel: \" YAML fix: {fix}\",\n contextFixLabel: \" Context fix: {fix}\",\n recoveryHintLabel: \" Recovery hint: {hint}\",\n noYamlFix: \" No YAML fix suggestion — skipping.\",\n applyPrompt: \"What would you like to do with this suggestion?\",\n applyLabel: \"Apply\",\n applyHint: \"AI will modify the YAML\",\n skipLabel: \"Skip\",\n skipHint: \"Ignore this suggestion\",\n abortLabel: \"Abort\",\n abortHint: \"Stop processing remaining suggestions\",\n patchGenerated: \"Patch generated. Diff:\",\n confirmApply: \"Apply this change?\",\n applied: \"Applied fix for Step #{ordinal}.\",\n skippedMsg: \"Skipped.\",\n patchFailed: \"Patch generation failed: {error}\",\n writePrompt: \"Write {count} fixes to {path}?\",\n writeSuccess: \"Updated {path}.\",\n writeCancelled: \"Write cancelled.\",\n noChanges: \"No fixes were applied.\",\n verifyCommand: \"Verify command:\",\n noDiff: \"(no changes)\",\n },\n generator: {\n cancelled: \"Exploration was cancelled.\",\n feedbackPrompt: \"Enter feedback or improvements for the exploration (Enter to skip)\",\n aiReviewing: \"AI reviewing...\",\n aiReviewFailed: \"AI review failed: {error}\",\n openingUrl: \"Opening {url}...\",\n pageLoaded: \"Page loaded\",\n recordingStarted: \"Recording started: {path}\",\n recordingStartFailed: \"Failed to start recording: {error}\",\n screenshotSaved: \"Initial screenshot saved: {path}\",\n paused: \"\\u23F8 Paused\",\n waitingForAI: \"Waiting for AI response... [Enter: pause / q: cancel]\",\n cancelledByUser: \"\\u23F9 Cancelled\",\n exploringStep: \"Exploring (step {current}/{total})\",\n explorationComplete: \"Exploration complete ({duration})\",\n recordingComplete: \"Recording complete: {path}\",\n recordingStopFailed: \"Failed to stop recording: {error}\",\n },\n cli: {\n cancelledMessage: \"Operation cancelled.\",\n executionCancelled: \"Execution cancelled.\",\n runbookRequired: \"--runbook is required\",\n urlRequired: \"--url is required\",\n goalRequired: \"--goal is required\",\n outputRequired: \"--output is required\",\n invalidApprovalMode: \"--approval-mode must be one of: web, slack, teams, discord\",\n reportRequired: \"--report is required\",\n contextRequired: \"--context is required\",\n stealthEnabled: \"Stealth: enabled\",\n proxyEnabled: \"Proxy: {proxy}\",\n providerRequired: \"--model-provider (or AI_MODEL_PROVIDER env var) is required. Valid: anthropic, openai, openai-compatible, google, azure, bedrock, vertex\",\n },\n browserTool: {\n interventionGuidance: \"[User guidance] {text}\",\n successCount: \"{count} succeeded\",\n truncated: \"[truncated]\",\n },\n tenant: {\n slugLength: \"Slug must be between 3 and 48 characters\",\n slugPattern: \"Slug must contain only lowercase letters, numbers, and hyphens\",\n slugReserved: \"Slugs starting with \\\"u-\\\" are reserved\",\n slugTaken: \"Slug is already taken\",\n },\n compose: {\n title: \"compose -- Runbook Composition\",\n complete: \"Composition complete: {path}\",\n branchVarPrompt: \"Branch variable name (e.g. sourceType)\",\n yamlPathPrompt: \"Path to runbook YAML\",\n matchValuePrompt: \"Match value for this case\",\n caseLoaded: 'Loaded: \"{title}\" ({steps} steps, {vars} variables)',\n addAnotherCase: \"Add another case?\",\n goalPrompt: \"Goal description (optional)\",\n variableMergePreview: \"Variable Merge Preview\",\n sharedVariables: \"Shared variables:\",\n conflictingVariables: \"Conflicts:\",\n caseSpecificVariables: \"Case-specific variables:\",\n branchVariable: \"Branch variable:\",\n conflictPrompt: 'Variable \"{name}\" has different definitions:',\n useFromCase: 'Use definition from \"{case}\"',\n settingsDiffPrompt: \"Settings differ: {key}\",\n composedPreview: \"Composed Runbook Preview\",\n selectAction: \"Select an action\",\n confirm: \"Confirm\",\n confirmHint: \"Write composed YAML\",\n editBranch: \"Edit branch variable name\",\n editMatches: \"Edit match values\",\n editVariables: \"Edit variables\",\n editTitle: \"Edit title/goal\",\n selectCase: \"Select a case to edit\",\n newMatchValue: \"New match value\",\n newBranchVar: \"New branch variable name\",\n newTitle: \"New title/goal\",\n editVarAction: \"Select variable action\",\n deleteVar: \"Delete a variable\",\n addVar: \"Add a variable\",\n editVarDef: \"Edit variable definition\",\n selectVar: \"Select a variable\",\n varDeleted: 'Variable \"{name}\" deleted.',\n newVarName: \"Variable name\",\n newVarSource: \"Variable source\",\n newVarValue: \"Variable value (optional)\",\n newVarDescription: \"Variable description (optional)\",\n varAdded: 'Variable \"{name}\" added.',\n varUpdated: 'Variable \"{name}\" updated.',\n branchVarConflict: 'Variable name \"{name}\" conflicts with the branch variable. Choose a different name.',\n noCases: \"At least 2 cases are required.\",\n },\n serverErrors: {\n unauthorized: \"Unauthorized\",\n sessionRequired: \"Session authentication required\",\n emailVerificationRequired: \"Email verification required\",\n apiKeyRevoked: \"API key has been revoked\",\n roleForbidden: \"Forbidden: {role} or higher role required\",\n tenantRequired: \"Tenant required\",\n tenantNotFound: \"Tenant not found\",\n notMember: \"Not a member of this tenant\",\n tenantIdRequired: \"tenantId is required\",\n nameRequired: \"name is required\",\n emailRequired: \"email is required\",\n invalidRole: \"role must be one of: {roles}\",\n communityNoApiKey: \"Community tier does not require API keys\",\n apiKeyNotFoundOrRevoked: \"API key not found or already revoked\",\n adminRequired: \"Forbidden: owner or admin required\",\n ownerOnly: \"Forbidden: owner only\",\n ownerOnlyAssign: \"Forbidden: only owner can assign owner role\",\n ownerOnlyRemoveAdmin: \"Forbidden: only owner can remove admin\",\n alreadyMember: \"User is already a member\",\n invitationPending: \"An invitation is already pending for this email\",\n memberNotFound: \"Member not found\",\n cannotRemoveOwner: \"Cannot remove owner\",\n invitationNotFound: \"Invitation not found\",\n invitationExpired: \"Invitation has expired\",\n noFieldsToUpdate: \"No fields to update\",\n invalidLocale: \"locale must be \\\"en\\\" or \\\"ja\\\"\",\n providerIdMismatch: \"Provider ID mismatch\",\n providerNotConfigured: \"Provider not configured\",\n missingCredentials: \"Missing required credentials for {platform}: {fields}\",\n planFeatureRequired: \"This feature requires {tier} plan or higher\",\n planStepLimitExceeded: \"Runbook has {count} steps, but your plan allows up to {limit}\",\n scheduledAtMustBeFuture: \"Scheduled time has already passed. Please select a future date and time.\",\n recurringBlockedByPromptVars: \"Recurring schedules are not available for runbooks with prompt variables\",\n },\n};\n\nexport default messages;\n","/**\n * Japanese message catalog\n */\nimport type { Messages } from \"../types\";\n\nconst messages: Messages = {\n common: {\n success: \"成功\",\n failure: \"失敗\",\n skipped: \"スキップ\",\n aborted: \"中止\",\n none: \"(なし)\",\n unknown: \"(不明)\",\n items: \"件\",\n files: \"ファイル\",\n conditionSkipped: \"条件スキップ\",\n iterations: \"回\",\n iteration: \"回\",\n },\n risk: {\n low: \"副作用の少ない操作\",\n medium: \"フォーム送信・設定変更など\",\n high: \"削除・決済など不可逆操作\",\n },\n reporter: {\n runbook: \"手順書: {title}\",\n startUrl: \"開始URL: {url}\",\n totalSteps: \"全ステップ: {count}\",\n statsLine: \"実行: {executed} 成功: {succeeded} 失敗: {failed} スキップ: {skipped}\",\n statusAborted: \"状態: 中止\",\n totalDuration: \"合計実行時間: {duration}\",\n memory: \"メモリ: {info}\",\n downloads: \"ダウンロード: {count}ファイル\",\n executionResult: \"実行結果\",\n batchResult: \"バッチ実行結果\",\n batchTotalRows: \"全行数: {count}\",\n batchStats: \"成功: {succeeded} 失敗: {failed}\",\n },\n selfHeal: {\n debugResult: \"自動修正結果\",\n allStepsSuccess: \"全ステップ成功 ({count} steps, {duration})\",\n failedSteps: \"--- 失敗ステップ ---\",\n yamlSuggestions: \"--- 手順書(YAML)の修正提案 ---\",\n contextSuggestions: \"--- コンテキスト(markdown)の修正提案 ---\",\n retryWarnings: \"--- リトライ警告 ---\",\n retryCount: \"#{ordinal} {description}: {count}回リトライ (閾値: {threshold})\",\n },\n confirmation: {\n title: \"承認が必要です\",\n stepInfo: \"ステップ {ordinal}: {description}\",\n riskLevelLabel: \"リスクレベル: {level} ({hint})\",\n selectAction: \"操作を選択してください\",\n approve: \"承認して実行\",\n skip: \"このステップをスキップ\",\n abort: \"実行を中止\",\n abortHint: \"全体を停止\",\n },\n planner: {\n extractingFromContext: \"contextから変数値を抽出中...\",\n extractedFromContext: \"{count}件の値をcontextから抽出\",\n unresolvedRequired: \"{count}件の必須変数が未解決です。入力してください。\",\n placeholder: \"(必須 — contextから取得できませんでした)\",\n variableRequired: '変数 \"{name}\" は必須です',\n promptVariables: \"入力変数(編集するか Enter でデフォルトを維持)\",\n preVariables: \"事前変数:\",\n runtimeCaptures: \"ランタイムキャプチャ:\",\n controlFlow: \"制御フロー:\",\n conditionLabel: \" Step {ordinal}: 条件 {condition}\",\n loopLabel: \" Step {ordinal}: ループ (最大{max}回, {subSteps}サブステップ, 条件: {condition})\",\n forEachLabel: \" Step {ordinal}: forEach (最大{max}件, {subSteps}サブステップ, ソース: {forEach})\",\n branchLabel: \" Step {ordinal}: 分岐 {value} (ケース: {cases})\",\n batchMode: \"バッチモード: {count}行 ({path})\",\n stepCount: \"ステップ数: {count}\",\n executionPlan: \"実行プラン\",\n confirmStart: \"実行を開始しますか?\",\n fromSecrets: \" (secretsから読み込み)\",\n fromContext: \" (contextから抽出)\",\n fromDataSource: \" (データソースから)\",\n },\n errors: {\n elementNotFound: \"セレクタの ariaLabel / role / text を確認し、現在のページ構造に合わせて更新してください\",\n elementStale: \"ページ構造が変化しています。セレクタキャッシュを削除して再実行してください\",\n pageStructureChanged: \"ページ構造が大幅に変化しています。context.md にページ構造の変更を記録してください\",\n navigationTimeout: \"ページ遷移が遅延しています。wait ステップの追加または step-delay の増加を検討してください\",\n actionFailed: \"要素は見つかりましたがアクションが失敗しました。アクション種別の変更(例: click → hover)を検討してください\",\n scriptSyntaxError: \"extract スクリプトに構文エラーがあります。コードの途中切断やトップレベル return を確認してください\",\n unknownError: \"エラー内容を確認し、手順書の該当ステップを見直してください\",\n scriptExecutionError: \"スクリプト実行エラー\",\n browserActionError: \"ブラウザ操作エラー\",\n operationTimedOut: \"操作がタイムアウトしました\",\n },\n slack: {\n batchComplete: \"バッチ実行完了: {title}\",\n executionComplete: \"実行完了: {title}\",\n debugFailure: \"デバッグ検証失敗: {title}\",\n failedLabel: \"失敗:\",\n failedRows: \"失敗行:\",\n suggestionsLabel: \"修正提案:\",\n retryWarningsLabel: \"リトライ警告:\",\n abortTag: \"中止\",\n batchTag: \"バッチ\",\n totalRows: \"全{count}行\",\n moreSteps: \"- ...他 {count} ステップ\",\n moreRows: \"- ...他 {count} 行\",\n moreItems: \"- ...他 {count} 件\",\n approvalRequest: \"承認依頼: {description}\",\n approvalDescription: \"操作の承認依頼が届きました。\\n{goalLine}ステップ:「{description}」\\n操作のリスクレベル:{riskEmoji} {riskLevel}\",\n taskLabel: \"業務内容:\",\n stepLabel: \"ステップ:\",\n riskLabel: \"操作のリスクレベル:\",\n approveButton: \"承認\",\n skipButton: \"スキップ\",\n abortButton: \"中止\",\n approvalWaiting: \"承認待ち (リスク: {riskLevel})\",\n approvalTimeout: \":hourglass: タイムアウト(自動中止)\",\n approved: \":white_check_mark: 承認済み\",\n slackSkipped: \":fast_forward: スキップ\",\n slackAborted: \":octagonal_sign: 中止\",\n },\n executor: {\n openingUrl: \"{url} を開いています...\",\n browserReady: \"ブラウザ起動完了\",\n recordingStarted: \"録画開始: {path}\",\n recordingStartFailed: \"録画開始に失敗しました: {error}\",\n recordingComplete: \"録画完了: {path}\",\n recordingStopFailed: \"録画停止に失敗しました: {error}\",\n jobAbortedTimeout: \"ジョブ中止: タイムアウト超過\",\n conditionSkipping: \"条件不成立、スキップ: {condition}\",\n stopOnErrorAborting: \"stopOnError=true、実行を中止\",\n approvalWaiting: \"承認待ち: Step {ordinal} (リスク: {riskLevel})\",\n approvalAborted: \"承認結果: 中止 (Step {ordinal})\",\n approvalSkipped: \"承認結果: スキップ (Step {ordinal})\",\n approvalApproved: \"承認結果: 実行 (Step {ordinal})\",\n userAborted: \"ユーザーが中止しました\",\n batchBrowserReady: \"バッチ用ブラウザ起動完了\",\n chromeErrorDetected: \"ナビゲーション失敗: chrome-error:// に遷移しました(前のURL: {url})\",\n },\n chat: {\n approvalRequest: \"承認依頼: {description}\",\n approvalDescription: \"操作の承認依頼が届きました。\\n{goalLine}ステップ:「{description}」\\n操作のリスクレベル:{riskEmoji} {riskLevel}\",\n taskLabel: \"業務内容:\",\n stepLabel: \"ステップ:\",\n riskLabel: \"操作のリスクレベル:\",\n approveButton: \"承認\",\n skipButton: \"スキップ\",\n abortButton: \"中止\",\n approvalWaiting: \"承認待ち (リスク: {riskLevel})\",\n approvalTimeout: \"\\u231B タイムアウト(自動中止)\",\n approved: \"\\u2705 承認済み\",\n chatSkipped: \"\\u23E9 スキップ\",\n chatAborted: \"\\uD83D\\uDED1 中止\",\n executionComplete: \"実行完了: {title}\",\n batchComplete: \"バッチ実行完了: {title}\",\n debugFailure: \"デバッグ検証失敗: {title}\",\n failedLabel: \"失敗:\",\n failedRows: \"失敗行:\",\n suggestionsLabel: \"修正提案:\",\n retryWarningsLabel: \"リトライ警告:\",\n abortTag: \"中止\",\n batchTag: \"バッチ\",\n totalRows: \"全{count}行\",\n moreSteps: \"- ...他 {count} ステップ\",\n moreRows: \"- ...他 {count} 行\",\n moreItems: \"- ...他 {count} 件\",\n stepPrefix: \"ステップ\",\n succeededFieldLabel: \"成功\",\n failedFieldLabel: \"失敗\",\n skippedFieldLabel: \"スキップ\",\n durationFieldLabel: \"実行時間\",\n totalFieldLabel: \"合計\",\n generateComplete: \"手順書生成完了\",\n goalFieldLabel: \"ゴール\",\n goalAchievedFieldLabel: \"ゴール達成\",\n stepsFieldLabel: \"ステップ数\",\n yamlFieldLabel: \"YAML生成\",\n },\n review: {\n keptSteps: \"保持されるステップ:\",\n confirmationRequired: \"承認が必要なステップ:\",\n removedSteps: \"除外されるステップ:\",\n capturedValues: \"ページから取得する値:\",\n notes: \"ノート:\",\n guidancePrefix: \"[方針修正 {index}]\",\n summaryLabel: \"Summary: {summary}\",\n reviewResult: \"レビュー結果\",\n confirm: \"確定\",\n confirmHint: \"YAML生成に進む\",\n toggleConfirmation: \"ステップの承認要否を変更\",\n editCaptures: \"ページから取得する値を編集\",\n editCapturesHint: \"accept/reject/add\",\n editNotes: \"ノートを編集\",\n editNotesHint: \"\",\n selectAction: \"操作を選択してください\",\n selectConfirmSteps: \"承認が必要なステップを選択(スペースで切替、Enterで確定)\",\n selectNotesAction: \"ノート操作を選択\",\n addCustomNote: \"カスタムノートを追加\",\n addSuggestedNote: \"AI提案ノートから選択\",\n deleteNote: \"ノートを削除\",\n noteContent: \"ノート内容\",\n noteContentRequired: \"ノート内容を入力してください\",\n notesAdded: \"{count}件のノートを追加しました。\",\n notesDeleted: \"{count}件のノートを削除しました。\",\n selectCaptureAction: \"ページから取得する値の操作を選択\",\n acceptAllCaptures: \"既存の取得値をすべて承認\",\n rejectCaptures: \"取得値を除外\",\n addCapture: \"新しい取得値を追加\",\n allCapturesAccepted: \"すべての取得値を承認しました。\",\n noCapturesAvailable: \"取得値がありません。\",\n selectCapturesToReject: \"除外する取得値を選択\",\n capturesRejected: \"{count}件の取得値を除外しました。\",\n captureStepNumber: \"追加先のステップ番号 (ordinal)\",\n captureStepRequired: \"ステップ番号を入力してください\",\n captureStepNumeric: \"数値を入力してください\",\n captureVarName: \"取得値の変数名 (camelCase)\",\n captureVarRequired: \"変数名を入力してください\",\n captureStrategy: \"取得戦略\",\n strategySnapshot: \"snapshot (正規表現マッチ)\",\n strategyUrl: \"url (URLの正規表現マッチ)\",\n strategyAi: \"ai (AI抽出)\",\n strategyExpression: \"expression (テンプレート)\",\n regexPattern: \"正規表現パターン\",\n aiExtractionPrompt: \"AI抽出プロンプト\",\n templateExpression: \"テンプレート式\",\n captureAdded: 'Step #{ordinal} に取得値 \"{name}\" を追加しました。',\n highRiskNote: \"高リスクステップ({ordinals})の実行前に必ず承認を取ること\",\n credentialNote: \"認証情報を含むステップがあります。実行環境の認証設定を確認してください\",\n removedStepsNote: \"{count}ステップが除外されました。探索が冗長だった可能性があります\",\n stepNotFound: \"Step #{ordinal} が見つかりません。\",\n },\n fix: {\n noSuggestions: \"レポートに修正提案が見つかりませんでした。\",\n noSuggestionsHint: \"ヒント: --self-heal フラグ付きで実行すると AI 修正提案が生成されます。\",\n complete: \"完了\",\n suggestionCount: \"修正提案: {count} 件\",\n errorLabel: \" エラー: {error}\",\n categoryLabel: \" 分類: {category}\",\n yamlFixLabel: \" YAML 修正: {fix}\",\n contextFixLabel: \" Context 修正: {fix}\",\n recoveryHintLabel: \" 推奨対応: {hint}\",\n noYamlFix: \" YAML 修正提案がないためスキップします。\",\n applyPrompt: \"この提案をどうしますか?\",\n applyLabel: \"適用\",\n applyHint: \"AI が YAML を修正します\",\n skipLabel: \"スキップ\",\n skipHint: \"この提案を無視\",\n abortLabel: \"中止\",\n abortHint: \"残りの提案も含めて中止\",\n patchGenerated: \"パッチ生成成功。差分:\",\n confirmApply: \"この変更を適用しますか?\",\n applied: \"Step #{ordinal} の修正を適用しました。\",\n skippedMsg: \"スキップしました。\",\n patchFailed: \"パッチ生成失敗: {error}\",\n writePrompt: \"{count} 件の修正を {path} に書き込みますか?\",\n writeSuccess: \"{path} を更新しました。\",\n writeCancelled: \"書き込みをキャンセルしました。\",\n noChanges: \"適用された修正はありません。\",\n verifyCommand: \"検証コマンド:\",\n noDiff: \"(変更なし)\",\n },\n generator: {\n cancelled: \"探索がキャンセルされました。\",\n feedbackPrompt: \"探索の改善点やフィードバックを入力してください(Enterでスキップ)\",\n aiReviewing: \"AIレビュー中...\",\n aiReviewFailed: \"AIレビュー失敗: {error}\",\n openingUrl: \"{url} を開いています...\",\n pageLoaded: \"ページ読み込み完了\",\n recordingStarted: \"録画開始: {path}\",\n recordingStartFailed: \"録画開始に失敗しました: {error}\",\n screenshotSaved: \"スクリーンショット保存: {path}\",\n paused: \"\\u23F8 一時停止\",\n waitingForAI: \"AI 応答待ち... [Enter: 一時停止 / q: キャンセル]\",\n cancelledByUser: \"\\u23F9 キャンセル\",\n exploringStep: \"エージェント探索中 (ステップ {current}/{total})\",\n explorationComplete: \"探索完了 ({duration})\",\n recordingComplete: \"録画完了: {path}\",\n recordingStopFailed: \"録画停止に失敗しました: {error}\",\n },\n cli: {\n cancelledMessage: \"操作がキャンセルされました。\",\n executionCancelled: \"実行がキャンセルされました。\",\n runbookRequired: \"--runbook は必須です\",\n urlRequired: \"--url は必須です\",\n goalRequired: \"--goal は必須です\",\n outputRequired: \"--output は必須です\",\n invalidApprovalMode: \"--approval-mode は web, slack, teams, discord のいずれかを指定してください\",\n reportRequired: \"--report は必須です\",\n contextRequired: \"--context は必須です\",\n stealthEnabled: \"ステルス: 有効\",\n proxyEnabled: \"プロキシ: {proxy}\",\n providerRequired: \"--model-provider(または環境変数 AI_MODEL_PROVIDER)は必須です。有効値: anthropic, openai, openai-compatible, google, azure, bedrock, vertex\",\n },\n browserTool: {\n interventionGuidance: \"[ユーザーからの方針修正] {text}\",\n successCount: \"{count}件成功\",\n truncated: \"[省略]\",\n },\n tenant: {\n slugLength: \"Slug は 3〜48 文字で入力してください\",\n slugPattern: \"Slug には小文字英数字とハイフンのみ使用できます\",\n slugReserved: \"\\\"u-\\\" で始まる Slug は予約されています\",\n slugTaken: \"この Slug は既に使用されています\",\n },\n compose: {\n title: \"compose -- 手順書合成\",\n complete: \"合成完了: {path}\",\n branchVarPrompt: \"分岐変数名を入力してください (例: sourceType)\",\n yamlPathPrompt: \"手順書 YAML パス\",\n matchValuePrompt: \"マッチ値\",\n caseLoaded: '読み込み: \"{title}\" ({steps} steps, {vars} variables)',\n addAnotherCase: \"ケースを追加しますか?\",\n goalPrompt: \"合成後のゴール(空欄でスキップ)\",\n variableMergePreview: \"変数マージプレビュー\",\n sharedVariables: \"共通変数(定義一致):\",\n conflictingVariables: \"競合変数(定義不一致):\",\n caseSpecificVariables: \"ケース固有変数:\",\n branchVariable: \"分岐変数:\",\n conflictPrompt: '変数 \"{name}\" の定義が異なります:',\n useFromCase: '\"{case}\" の定義を使用',\n settingsDiffPrompt: \"Settings の差分: {key}\",\n composedPreview: \"合成手順書プレビュー\",\n selectAction: \"操作を選択\",\n confirm: \"確定\",\n confirmHint: \"YAML を出力\",\n editBranch: \"分岐変数名を変更\",\n editMatches: \"マッチ値を変更\",\n editVariables: \"変数を編集\",\n editTitle: \"タイトル/ゴールを変更\",\n selectCase: \"編集するケースを選択\",\n newMatchValue: \"新しいマッチ値\",\n newBranchVar: \"新しい分岐変数名\",\n newTitle: \"新しいタイトル/ゴール\",\n editVarAction: \"変数の操作を選択\",\n deleteVar: \"変数を削除\",\n addVar: \"変数を追加\",\n editVarDef: \"変数の定義を変更\",\n selectVar: \"変数を選択\",\n varDeleted: '変数 \"{name}\" を削除しました。',\n newVarName: \"変数名\",\n newVarSource: \"変数のソース\",\n newVarValue: \"変数の値(省略可)\",\n newVarDescription: \"変数の説明(省略可)\",\n varAdded: '変数 \"{name}\" を追加しました。',\n varUpdated: '変数 \"{name}\" を更新しました。',\n branchVarConflict: '変数名 \"{name}\" は分岐変数と競合しています。別の名前を選択してください。',\n noCases: \"2つ以上のケースが必要です。\",\n },\n serverErrors: {\n unauthorized: \"認証が必要です\",\n sessionRequired: \"セッション認証が必要です\",\n emailVerificationRequired: \"メールアドレスの確認が必要です\",\n apiKeyRevoked: \"API キーは失効しています\",\n roleForbidden: \"{role} 以上のロールが必要です\",\n tenantRequired: \"テナントが必要です\",\n tenantNotFound: \"テナントが見つかりません\",\n notMember: \"このテナントのメンバーではありません\",\n tenantIdRequired: \"tenantId は必須です\",\n nameRequired: \"name は必須です\",\n emailRequired: \"email は必須です\",\n invalidRole: \"role は次のいずれかを指定してください: {roles}\",\n communityNoApiKey: \"Community ティアでは API キーは不要です\",\n apiKeyNotFoundOrRevoked: \"API キーが見つからないか、既に失効しています\",\n adminRequired: \"owner または admin のロールが必要です\",\n ownerOnly: \"owner のみ実行可能です\",\n ownerOnlyAssign: \"owner ロールの付与は owner のみ可能です\",\n ownerOnlyRemoveAdmin: \"admin の削除は owner のみ可能です\",\n alreadyMember: \"既にメンバーです\",\n invitationPending: \"このメールアドレスへの招待は既に保留中です\",\n memberNotFound: \"メンバーが見つかりません\",\n cannotRemoveOwner: \"owner は削除できません\",\n invitationNotFound: \"招待が見つかりません\",\n invitationExpired: \"招待の有効期限が切れています\",\n noFieldsToUpdate: \"更新するフィールドがありません\",\n invalidLocale: \"locale は \\\"en\\\" または \\\"ja\\\" を指定してください\",\n providerIdMismatch: \"プロバイダー ID が一致しません\",\n providerNotConfigured: \"プロバイダーが設定されていません\",\n missingCredentials: \"{platform} の必須認証情報が不足しています: {fields}\",\n planFeatureRequired: \"この機能は {tier} プラン以上で利用可能です\",\n planStepLimitExceeded: \"手順書のステップ数が {count} ですが、現在のプランの上限は {limit} です\",\n scheduledAtMustBeFuture: \"予約時刻を過ぎています。未来の日時を選択してください。\",\n recurringBlockedByPromptVars: \"入力変数を含む手順書では定期実行を利用できません\",\n },\n};\n\nexport default messages;\n","/**\n * i18n/index --- Locale state management and translation functions\n *\n * Provides a module-level singleton for locale state.\n * Initialized once per process (CLI) or per client construction (SDK).\n */\n\nimport type { Locale, Messages, MessageKey } from \"./types\";\nimport enMessages from \"./messages/en\";\nimport jaMessages from \"./messages/ja\";\n\nlet currentLocale: Locale = \"en\";\n\nexport function getLocale(): Locale {\n return currentLocale;\n}\n\nexport function setLocale(locale: Locale): void {\n currentLocale = locale;\n}\n\n/**\n * Initialize locale from explicit value or environment.\n * Priority: explicit param > REFRAIN_LOCALE env > \"en\"\n */\nexport function initLocale(explicit?: string): void {\n if (explicit === \"ja\" || explicit === \"en\") {\n currentLocale = explicit;\n return;\n }\n const envLocale = process.env.REFRAIN_LOCALE;\n if (envLocale === \"ja\" || envLocale === \"en\") {\n currentLocale = envLocale;\n return;\n }\n currentLocale = \"en\";\n}\n\nfunction getMessages(): Messages {\n return currentLocale === \"ja\" ? jaMessages : enMessages;\n}\n\n/**\n * Translate a message key to the current locale string.\n * Returns the key itself as fallback if not found.\n */\nexport function t(key: MessageKey): string {\n const messages = getMessages();\n const parts = key.split(\".\");\n let current: unknown = messages;\n for (const part of parts) {\n if (current && typeof current === \"object\") {\n current = (current as Record<string, unknown>)[part];\n } else {\n return key;\n }\n }\n return typeof current === \"string\" ? current : key;\n}\n\n/**\n * Translate with parameter interpolation.\n * Replaces {name} placeholders with provided values.\n */\nexport function tf(key: MessageKey, params: Record<string, string | number>): string {\n let message = t(key);\n for (const [k, v] of Object.entries(params)) {\n message = message.replaceAll(`{${k}}`, String(v));\n }\n return message;\n}\n\n/**\n * Returns the AI response language instruction for the current locale.\n * Appended to AI system prompts to control response language.\n */\nexport function aiResponseLanguageInstruction(): string {\n return currentLocale === \"ja\"\n ? \"日本語で応答してください。\"\n : \"Respond in English.\";\n}\n\n/**\n * Translate a message key with an explicit locale (server-side safe, no global state).\n */\nexport function tWithLocale(key: MessageKey, locale: Locale): string {\n const messages = locale === \"ja\" ? jaMessages : enMessages;\n const parts = key.split(\".\");\n let current: unknown = messages;\n for (const part of parts) {\n if (current && typeof current === \"object\") {\n current = (current as Record<string, unknown>)[part];\n } else {\n return key;\n }\n }\n return typeof current === \"string\" ? current : key;\n}\n\n/**\n * Translate with parameter interpolation and explicit locale (server-side safe).\n */\nexport function tfWithLocale(\n key: MessageKey,\n locale: Locale,\n params: Record<string, string | number>,\n): string {\n let message = tWithLocale(key, locale);\n for (const [k, v] of Object.entries(params)) {\n message = message.replaceAll(`{${k}}`, String(v));\n }\n return message;\n}\n\n/**\n * Resolve locale from Accept-Language header value.\n * Returns \"ja\" if Japanese is preferred, \"en\" otherwise.\n */\nexport function resolveAcceptLanguage(acceptLanguage?: string | null): Locale {\n if (!acceptLanguage) return \"en\";\n // Simple check: if \"ja\" appears before \"en\" or is the only language\n const lower = acceptLanguage.toLowerCase();\n const jaIndex = lower.indexOf(\"ja\");\n if (jaIndex === -1) return \"en\";\n const enIndex = lower.indexOf(\"en\");\n if (enIndex === -1) return \"ja\";\n return jaIndex < enIndex ? \"ja\" : \"en\";\n}\n\n// Re-export types\nexport type { Locale, Messages, MessageKey } from \"./types\";\n"],"mappings":";;;AAKA,IAAM,WAAqB;AAAA,EACzB,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IACP,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,IACT,UAAU;AAAA,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AU,MAAM,QAAQ,IAAI;AAClC,MAAI,YAAY,GAAI,QAAO;AAC3B,QAAM,UAAU,MAAM,QAAQ,IAAI;AAClC,MAAI,YAAY,GAAI,QAAO;AAC3B,SAAO,UAAU,UAAU,OAAO;AACpC;","names":["messages","messages","messages"]}
@@ -7,7 +7,7 @@ import {
7
7
  isEditable,
8
8
  loadVersionDetail,
9
9
  resolveDisplayStatus
10
- } from "./chunk-Z33FCOTZ.js";
10
+ } from "./chunk-VVXNFUPL.js";
11
11
  import {
12
12
  jobs,
13
13
  runbookSecrets,
@@ -17,7 +17,7 @@ import {
17
17
  runbookVersionReviews,
18
18
  runbookVersions,
19
19
  runbooks
20
- } from "./chunk-CLYJHKPY.js";
20
+ } from "./chunk-CMWLFQXD.js";
21
21
 
22
22
  // src/server/store/runbook-store.ts
23
23
  import { eq as eq2, and as and2, desc as desc2, sql as sql2, count as count2 } from "drizzle-orm";
@@ -907,7 +907,7 @@ var RunbookStore = class {
907
907
  createdBy: createdBy ?? null
908
908
  });
909
909
  if (source.currentVersionId) {
910
- const { copyVersionData: copyVersionData2 } = await import("./runbook-data-helpers-KRR2SH76.js");
910
+ const { copyVersionData: copyVersionData2 } = await import("./runbook-data-helpers-5UAO65TZ.js");
911
911
  await copyVersionData2(tx, source.currentVersionId, verRow.id);
912
912
  }
913
913
  return { id: newRb.id };
@@ -950,4 +950,4 @@ var RunbookStore = class {
950
950
  export {
951
951
  RunbookStore
952
952
  };
953
- //# sourceMappingURL=chunk-WEYR56ZN.js.map
953
+ //# sourceMappingURL=chunk-HHRHHFSK.js.map
@@ -458,10 +458,19 @@ async function initModel(config) {
458
458
  break;
459
459
  }
460
460
  case "anthropic":
461
- default:
462
- modelFactory = (id) => anthropic(id);
463
- cachedModel = anthropic(modelId);
461
+ default: {
462
+ const apiKey = config?.apiKey ?? process.env.ANTHROPIC_API_KEY;
463
+ if (apiKey) {
464
+ const { createAnthropic } = await import("@ai-sdk/anthropic");
465
+ const client = createAnthropic({ apiKey });
466
+ modelFactory = (id) => client(id);
467
+ cachedModel = client(modelId);
468
+ } else {
469
+ modelFactory = (id) => anthropic(id);
470
+ cachedModel = anthropic(modelId);
471
+ }
464
472
  break;
473
+ }
465
474
  }
466
475
  }
467
476
  async function buildModelFactory(config) {
@@ -775,4 +784,4 @@ export {
775
784
  isRetryableError,
776
785
  withAIRetry
777
786
  };
778
- //# sourceMappingURL=chunk-UGPXCQY3.js.map
787
+ //# sourceMappingURL=chunk-KFNW4XR2.js.map