browser-opt 1.0.2 → 1.0.5

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 (73) hide show
  1. package/dist/browser-core/agent.d.ts +131 -0
  2. package/dist/browser-core/agent.d.ts.map +1 -0
  3. package/dist/browser-core/agent.js +437 -0
  4. package/dist/browser-core/agent.js.map +1 -0
  5. package/dist/browser-core/browser-executable.d.ts +3 -0
  6. package/dist/browser-core/browser-executable.d.ts.map +1 -0
  7. package/dist/browser-core/browser-executable.js +49 -0
  8. package/dist/browser-core/browser-executable.js.map +1 -0
  9. package/dist/browser-core/index.d.ts +9 -0
  10. package/dist/browser-core/index.d.ts.map +1 -0
  11. package/dist/browser-core/index.js +7 -0
  12. package/dist/browser-core/index.js.map +1 -0
  13. package/dist/browser-core/proxy-env.d.ts +9 -0
  14. package/dist/browser-core/proxy-env.d.ts.map +1 -0
  15. package/dist/browser-core/proxy-env.js +77 -0
  16. package/dist/browser-core/proxy-env.js.map +1 -0
  17. package/dist/browser-core/skill-install.d.ts +15 -0
  18. package/dist/browser-core/skill-install.d.ts.map +1 -0
  19. package/dist/browser-core/skill-install.js +42 -0
  20. package/dist/browser-core/skill-install.js.map +1 -0
  21. package/dist/browser-core/types.d.ts +111 -0
  22. package/dist/browser-core/types.d.ts.map +1 -0
  23. package/dist/browser-core/types.js +2 -0
  24. package/dist/browser-core/types.js.map +1 -0
  25. package/dist/browser-opt/runner/actions/index.d.ts +1 -1
  26. package/dist/browser-opt/runner/actions/index.d.ts.map +1 -1
  27. package/dist/browser-opt/runner/actions/utils/click-action.d.ts +1 -1
  28. package/dist/browser-opt/runner/actions/utils/click-action.d.ts.map +1 -1
  29. package/dist/browser-opt/runner/actions/utils/date-action.d.ts +1 -1
  30. package/dist/browser-opt/runner/actions/utils/date-action.d.ts.map +1 -1
  31. package/dist/browser-opt/runner/actions/utils/dom-action.d.ts +1 -1
  32. package/dist/browser-opt/runner/actions/utils/dom-action.d.ts.map +1 -1
  33. package/dist/browser-opt/runner/actions/utils/fill-action.d.ts +1 -1
  34. package/dist/browser-opt/runner/actions/utils/fill-action.d.ts.map +1 -1
  35. package/dist/browser-opt/runner/actions/utils/handoff-action.d.ts +1 -1
  36. package/dist/browser-opt/runner/actions/utils/handoff-action.d.ts.map +1 -1
  37. package/dist/browser-opt/runner/actions/utils/open-action.d.ts +1 -1
  38. package/dist/browser-opt/runner/actions/utils/open-action.d.ts.map +1 -1
  39. package/dist/browser-opt/runner/actions/utils/select-option-action.d.ts +1 -1
  40. package/dist/browser-opt/runner/actions/utils/select-option-action.d.ts.map +1 -1
  41. package/dist/browser-opt/runner/actions/utils/upload-action.d.ts +1 -1
  42. package/dist/browser-opt/runner/actions/utils/upload-action.d.ts.map +1 -1
  43. package/dist/browser-opt/runner/evidence.d.ts +1 -1
  44. package/dist/browser-opt/runner/evidence.d.ts.map +1 -1
  45. package/dist/browser-opt/runner/handoff.d.ts +1 -1
  46. package/dist/browser-opt/runner/handoff.d.ts.map +1 -1
  47. package/dist/browser-opt/runner/index.d.ts +1 -1
  48. package/dist/browser-opt/runner/index.d.ts.map +1 -1
  49. package/dist/browser-opt/runner/index.js +3 -1
  50. package/dist/browser-opt/runner/index.js.map +1 -1
  51. package/dist/browser-opt/runner/step-executor.d.ts +1 -1
  52. package/dist/browser-opt/runner/step-executor.d.ts.map +1 -1
  53. package/dist/browser-opt/type.d.ts +2 -2
  54. package/dist/browser-opt/type.d.ts.map +1 -1
  55. package/dist/browser-opt/utils.d.ts +1 -1
  56. package/dist/browser-opt/utils.d.ts.map +1 -1
  57. package/dist/browser-opt/workflow/matcher.d.ts.map +1 -1
  58. package/dist/browser-opt/workflow/matcher.js +12 -3
  59. package/dist/browser-opt/workflow/matcher.js.map +1 -1
  60. package/dist/cli/browser-opt.js +0 -0
  61. package/dist/cli/commands/browser-opt.d.ts.map +1 -1
  62. package/dist/cli/commands/browser-opt.js +22 -8
  63. package/dist/cli/commands/browser-opt.js.map +1 -1
  64. package/dist/cli/commands/setup.d.ts +12 -1
  65. package/dist/cli/commands/setup.d.ts.map +1 -1
  66. package/dist/cli/commands/setup.js +89 -11
  67. package/dist/cli/commands/setup.js.map +1 -1
  68. package/dist/cli/utils/constants.d.ts +1 -1
  69. package/dist/cli/utils/constants.d.ts.map +1 -1
  70. package/dist/cli/utils/constants.js +11 -10
  71. package/dist/cli/utils/constants.js.map +1 -1
  72. package/package.json +19 -5
  73. package/skills/browser-opt/SKILL.md +36 -24
@@ -73,15 +73,15 @@ Every execution must follow these rules:
73
73
  For saved workflows, start the browser run as a detached task and keep the returned stable `runId`. Do not keep an `exec_command` or PTY session id as the recovery handle; Codex may discard that process handle when the handoff response ends the current turn.
74
74
 
75
75
  ```bash
76
- npx --yes browser-opt start --workflow-id "<matched.id>" --json
77
- npx --yes browser-opt status --run-id "<runId>" --json
76
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest start --workflow-id "<matched.id>" --json
77
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest status --run-id "<runId>" --json
78
78
  ```
79
79
 
80
80
  Poll `status` until it returns `PASS`, `FAIL`, or `HANDOFF`. When it returns `HANDOFF`, ask the user to finish the manual action and end the current turn normally. After the user replies `done`, restore the original runner and browser with:
81
81
 
82
82
  ```bash
83
- npx --yes browser-opt resume --run-id "<runId>" --json
84
- npx --yes browser-opt status --run-id "<runId>" --json
83
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest resume --run-id "<runId>" --json
84
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest status --run-id "<runId>" --json
85
85
  ```
86
86
 
87
87
  The detached task still executes `browser-opt run` exactly once. `status` is read-only and `resume` only sends a one-time signal to that original process. Never start a second `run` or `start` command to simulate resume.
@@ -92,24 +92,36 @@ Reusable flows are stored as JSON files under the calling project's
92
92
  `.browser-opt/workflows/` directory by default. Resolve relative paths from the
93
93
  calling project's current working directory, not from this skill or package directory.
94
94
 
95
- Install the published CLI and this Skill with `npx --yes browser-opt setup`.
96
- By default it installs to the shared Agent Skills directory, similar to
97
- `npx skills add`. Use `--agent codex` for the Codex-specific skills directory,
98
- or `--skills-dir <dir>` for another agent root.
99
- Use this command prefix for every `browser-opt` invocation:
95
+ Install the browser environment and this Skill explicitly before the first Workflow run:
100
96
 
101
97
  ```bash
102
- npx --yes browser-opt
98
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest install
103
99
  ```
104
100
 
105
- Only use `browser-opt ...` when `command -v browser-opt` succeeds in the same
106
- execution environment; otherwise use `npx --yes browser-opt ...`.
101
+ The installer keeps `browser-opt` itself on `npx @latest`, but installs or updates the global `agent-browser`
102
+ runtime once so pure Workflow matching stays lightweight. By default it uses the system's standard Chrome and
103
+ installs into the shared Agent Skills directory. Use `--agent codex` for the Codex-specific skills directory,
104
+ `--skills-dir <dir>` for another agent root, or `--skip-runtime` when only the Skill should be installed.
105
+ Use this exact official-registry prefix for every invocation on macOS, Linux, and Windows:
106
+
107
+ ```bash
108
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest
109
+ ```
110
+
111
+ To remove the global runtime and installed Skill, run:
112
+
113
+ ```bash
114
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest uninstall
115
+ ```
116
+
117
+ Use `--all-data` only when the current project's `.browser-opt` states, artifacts, and handoff records should
118
+ also be deleted.
107
119
 
108
120
  Save a complete flow without executing it:
109
121
 
110
122
  ```bash
111
- npx --yes browser-opt save "创建安选公开直播流程" --flow "<full natural language flow>"
112
- npx --yes browser-opt save "创建安选公开直播流程" --flow "<full natural language flow>" --workflow-dir ./custom/workflows
123
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest save "创建安选公开直播流程" --flow "<full natural language flow>"
124
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest save "创建安选公开直播流程" --flow "<full natural language flow>" --workflow-dir ./custom/workflows
113
125
  ```
114
126
 
115
127
  Saving an existing name fails by default. Only pass `--force` when the user
@@ -145,12 +157,12 @@ When `/browser-opt` is followed by a short request without a URL, such as:
145
157
  Do not treat it as a new one-shot flow. First run:
146
158
 
147
159
  ```bash
148
- npx --yes browser-opt match "<short request>" --json
160
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest match "<short request>" --json
149
161
  ```
150
162
 
151
163
  Handle the JSON result as follows:
152
164
 
153
- - `matched`: run `npx --yes browser-opt start --workflow-id "<matched.id>" --json`, retain its `runId`, and follow the interactive handoff execution protocol above.
165
+ - `matched`: run `npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest start --workflow-id "<matched.id>" --json`, retain its `runId`, and follow the interactive handoff execution protocol above.
154
166
  - `ambiguous`: do not rely on the CLI's human-readable stdout as the user-facing
155
167
  choice list, and do not ask through a modal/input tool that may render Markdown
156
168
  as plain text. Parse `match --json`, then ask in a normal assistant message.
@@ -170,7 +182,7 @@ Handle the JSON result as follows:
170
182
  blocking valid candidates.
171
183
 
172
184
  Use `--workflow-dir` consistently on both `match` and `run` when the user selects
173
- a custom directory. Use `npx --yes browser-opt list --json` when
185
+ a custom directory. Use `npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest list --json` when
174
186
  the user asks to see all saved workflows.
175
187
 
176
188
  Example ambiguous response format:
@@ -205,17 +217,17 @@ workflow request. A full flow includes its target URL:
205
217
  Translate that into:
206
218
 
207
219
  ```bash
208
- npx --yes browser-opt "<full natural language flow>"
220
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest "<full natural language flow>"
209
221
  ```
210
222
 
211
223
  Optional runtime flags:
212
224
 
213
225
  ```bash
214
- npx --yes browser-opt "<flow>" --profile Default
215
- npx --yes browser-opt "<flow>" --state ./.browser-opt/states/browser-opt-default.json
216
- npx --yes browser-opt "<flow>" --no-live-viewport
217
- npx --yes browser-opt "<flow>" --output-dir ./.browser-opt/artifacts
218
- npx --yes browser-opt "<flow>" --agent-chat
226
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest "<flow>" --profile Default
227
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest "<flow>" --state ./.browser-opt/states/browser-opt-default.json
228
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest "<flow>" --no-live-viewport
229
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest "<flow>" --output-dir ./.browser-opt/artifacts
230
+ npx --yes --registry=https://registry.npmjs.org/ browser-opt@latest "<flow>" --agent-chat
219
231
  ```
220
232
 
221
233
  Auth state reuse policy:
@@ -230,7 +242,7 @@ Auth state reuse policy:
230
242
  - Pass `--state <path>` to use a custom state file without automatic profile fallback.
231
243
  - Do not rely on focused-browser reuse for login import: ordinary Chrome is usually not CDP-accessible, and auto-connect can attach to the wrong temporary browser.
232
244
 
233
- It shows and keeps the actual system Chrome browser by default so the user can watch the operation and inspect the final page state. This must be a real Chrome window, not the agent tool's built-in browser such as the Copilot/Codex in-app browser, and it must not open the agent-browser dashboard at `http://localhost:4848`. Use `--no-live-viewport` only when the user explicitly wants headless execution. `--agent-chat` is a legacy compatibility mode. It may require `AI_GATEWAY_API_KEY`; avoid it when the caller can inspect snapshots and produce deterministic actions.
245
+ It explicitly pins the system's standard Chrome executable and isolates the `browser-opt` agent-browser namespace, so a previously installed Chrome for Testing daemon cannot be reused accidentally. It shows and keeps that actual system Chrome browser by default so the user can watch the operation and inspect the final page state. This must be a real Chrome window, not the agent tool's built-in browser such as the Copilot/Codex in-app browser, and it must not open the agent-browser dashboard at `http://localhost:4848`. Use `--no-live-viewport` only when the user explicitly wants headless execution. `--agent-chat` is a legacy compatibility mode. It may require `AI_GATEWAY_API_KEY`; avoid it when the caller can inspect snapshots and produce deterministic actions.
234
246
 
235
247
  ## Output
236
248