oh-my-opencode 5.1.82 → 5.1.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli-program.d.ts +3 -0
- package/dist/cli/index.js +202 -193
- package/dist/cli-node/index.js +202 -193
- package/dist/index.js +28 -22
- package/dist/skills/browser/SKILL.md +97 -91
- package/dist/skills/browser/references/commands.md +88 -26
- package/dist/skills/browser/references/desktop.md +21 -0
- package/dist/skills/browser/references/install.md +18 -0
- package/dist/skills/browser/references/owned-engine/README.md +5 -2
- package/dist/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
- package/dist/skills/browser/references/owned-engine/network.md +4 -3
- package/dist/skills/browser/references/recipes/1password.md +4 -2
- package/dist/skills/browser/runtime/omowright/index.js +7 -7
- package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
- package/dist/skills/debugging/references/tools/browser-qa.md +1 -1
- package/dist/skills/programming/SKILL.md +51 -320
- package/dist/skills/programming/references/go/README.md +1 -0
- package/dist/skills/programming/references/python/README.md +21 -3
- package/dist/skills/programming/references/python/error-handling.md +14 -0
- package/dist/skills/programming/references/rust/README.md +5 -1
- package/dist/skills/programming/references/typescript/README.md +9 -3
- package/dist/skills/programming/references/typescript/error-handling.md +18 -0
- package/dist/skills/ultimate-browsing/SKILL.md +1 -1
- package/dist/skills/visual-qa/references/browser-setup.md +5 -5
- package/dist/tui.js +16 -16
- package/package.json +14 -14
- package/packages/lsp-core/src/lsp/client-key.ts +14 -0
- package/packages/lsp-core/src/lsp/client-startup.ts +139 -0
- package/packages/lsp-core/src/lsp/client-wrapper.ts +4 -4
- package/packages/lsp-core/src/lsp/config-loader.ts +15 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics-group-scan.test.ts +388 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics-mixed-typescript.test.ts +124 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics.test.ts +4 -4
- package/packages/lsp-core/src/lsp/directory-diagnostics.ts +38 -41
- package/packages/lsp-core/src/lsp/directory-group-scan.ts +124 -0
- package/packages/lsp-core/src/lsp/directory-server-groups.ts +84 -0
- package/packages/lsp-core/src/lsp/manager-acquisition.test.ts +115 -0
- package/packages/lsp-core/src/lsp/manager-lifecycle.test.ts +9 -9
- package/packages/lsp-core/src/lsp/manager-max-clients.test.ts +41 -16
- package/packages/lsp-core/src/lsp/manager-reaping.test.ts +119 -0
- package/packages/lsp-core/src/lsp/manager-test-support.ts +108 -0
- package/packages/lsp-core/src/lsp/manager.ts +80 -249
- package/packages/lsp-core/src/lsp/native-typescript.ts +88 -0
- package/packages/lsp-core/src/lsp/server-installation.ts +15 -7
- package/packages/lsp-core/src/lsp/server-resolution-typescript-native.test.ts +327 -0
- package/packages/lsp-core/src/lsp/server-resolution.ts +28 -2
- package/packages/lsp-core/src/lsp/timer-provider.ts +17 -0
- package/packages/lsp-core/src/lsp/typescript-project-test-support.ts +52 -0
- package/packages/lsp-daemon/dist/cli.js +486 -310
- package/packages/lsp-daemon/dist/client.js +472 -296
- package/packages/lsp-daemon/dist/index.js +476 -300
- package/packages/lsp-tools-mcp/dist/cli.js +467 -291
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +160 -193
- package/packages/lsp-tools-mcp/dist/mcp.js +467 -291
- package/packages/lsp-tools-mcp/dist/tools.js +467 -291
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2 -2
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +478 -313
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +8711 -172
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +8660 -121
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +5 -0
- package/packages/omo-codex/plugin/components/telemetry/tsconfig.json +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +15 -1
- package/packages/omo-codex/plugin/skills/browser/SKILL.md +97 -91
- package/packages/omo-codex/plugin/skills/browser/references/commands.md +88 -26
- package/packages/omo-codex/plugin/skills/browser/references/desktop.md +21 -0
- package/packages/omo-codex/plugin/skills/browser/references/install.md +18 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +5 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +4 -3
- package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +4 -2
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +7 -7
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +51 -320
- package/packages/omo-codex/plugin/skills/programming/references/go/README.md +1 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/README.md +21 -3
- package/packages/omo-codex/plugin/skills/programming/references/python/error-handling.md +14 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/README.md +5 -1
- package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +9 -3
- package/packages/omo-codex/plugin/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +5 -5
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +21189 -20653
- package/packages/shared-skills/skills/browser/SKILL.md +97 -91
- package/packages/shared-skills/skills/browser/references/commands.md +88 -26
- package/packages/shared-skills/skills/browser/references/desktop.md +21 -0
- package/packages/shared-skills/skills/browser/references/install.md +18 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/README.md +5 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/network.md +4 -3
- package/packages/shared-skills/skills/browser/references/recipes/1password.md +4 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/index.js +7 -7
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/shared-skills/skills/programming/SKILL.md +51 -320
- package/packages/shared-skills/skills/programming/references/go/README.md +1 -0
- package/packages/shared-skills/skills/programming/references/python/README.md +21 -3
- package/packages/shared-skills/skills/programming/references/python/error-handling.md +14 -0
- package/packages/shared-skills/skills/programming/references/rust/README.md +5 -1
- package/packages/shared-skills/skills/programming/references/typescript/README.md +9 -3
- package/packages/shared-skills/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +5 -5
|
@@ -9,122 +9,128 @@ One library, two engines. omowright ships inside this skill; choose the engine b
|
|
|
9
9
|
|
|
10
10
|
| You need | Engine | Entry point |
|
|
11
11
|
|---|---|---|
|
|
12
|
-
| A site the user is signed into, their open tabs,
|
|
13
|
-
|
|
|
14
|
-
|
|
|
12
|
+
| A site the user is signed into, their open tabs, an extension popup, a step only they can do | **attached** — the user's own browser through BrowserSkill | `connectBrowserSkill()` |
|
|
13
|
+
| QA of a local or public page, screenshots at device sizes, scraping, network capture, a QA trace, bot-scored targets, headless runs | **owned** — a browser your code launches on a throwaway profile | `connectPipe()` / `connectCloakProfile()` |
|
|
14
|
+
| The tab the user watches beside the chat in OmO Desktop (`OMO_BROWSER_ENGINE` is set) | the app's built-in browser | `connectBuiltinBrowser()` — [references/desktop.md](references/desktop.md) |
|
|
15
|
+
| A 403/WAF host neither engine opens, a platform with a native reader, an archive snapshot | neither | the `ultimate-browsing` skill |
|
|
15
16
|
|
|
16
|
-
**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
step.
|
|
17
|
+
**Anything that needs the user's logins is attached.** It works in an Agent Window inside the user's own
|
|
18
|
+
profile, never a copy, and exists only where the user enabled the BrowserSkill extension. Never
|
|
19
|
+
substitute one engine for the other silently, and **never launch a headless browser because the
|
|
20
|
+
attached one is missing**: it has none of the user's sessions. Run the doctor, relay its one step.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
```js
|
|
23
|
+
const { loadOmowright } = await import("<skill-root>/scripts/omowright.mjs")
|
|
24
|
+
const { omowright } = await loadOmowright()
|
|
25
|
+
```
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`connect()` for a browser of your own, with the same table to choose between them. The app adds one more option:
|
|
27
|
+
Before the first attached session: `node "<skill-root>/scripts/browser-doctor.mjs" --json`. `ready`
|
|
28
|
+
means start; every other state and its one next step are in [references/install.md](references/install.md).
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
## Three rules for both engines
|
|
31
|
+
|
|
32
|
+
**1. WAIT FOR A STATE, NEVER FOR A CLOCK.** No `Bun.sleep`, no `setTimeout` delay, no hand-written
|
|
33
|
+
poll loop: a fixed delay fails on a slow page and wastes itself on a fast one. Start the wait
|
|
34
|
+
before the action that causes it. `goto`, `newTab` and `navigate` already wait for content, so
|
|
35
|
+
nothing follows them.
|
|
36
|
+
|
|
37
|
+
| Waiting for | Owned | Attached |
|
|
29
38
|
|---|---|---|
|
|
30
|
-
|
|
|
39
|
+
| Page content appearing or changing | `page.waitForFunction(fn, undefined, { timeout })` (options are the THIRD argument), `page.locator(ref).waitFor()` | `navigate(url, { waitUntil: "networkidle" })`; later, `session.waitForElement(target, { state: "visible", timeoutMs })`, or for any other state `evaluate` a promise that resolves on it (`{ awaitPromise: true, timeoutMs, context }`) |
|
|
40
|
+
| The request an action triggers | `const got = page.waitForResponse("**/api/x")`, act, `await got` | `waitForNavigation()` after an action that navigates |
|
|
41
|
+
| A feed that loads more as you scroll | `omowright.collectWhileScrolling(page, snoop, { minItems, maxScrolls, extract })` over a `createNetworkSnoop`: [network.md](references/owned-engine/network.md) | `session.scrollTo(target)`, then wait as in the first row |
|
|
42
|
+
| A person | `requestHuman(page, { prompt, until })` | `session.requestHelp({ prompt, targets })` |
|
|
43
|
+
|
|
44
|
+
**2. ONE CONNECTION PER TASK, AND A LONG WAIT GOES TO `tool.monitor`.** Keep the handle on
|
|
45
|
+
`globalThis` and reuse it in later cells; a new connect in every cell throws the page state away.
|
|
46
|
+
A cell detaches after 30 s and then blocks the js kernel, so anything that may run longer (a
|
|
47
|
+
person, a deploy, a slow job) is **never awaited in a cell**. Subscribe first, start the wait
|
|
48
|
+
without `await`, and end the cell; the event wakes you on success and on timeout alike:
|
|
31
49
|
|
|
32
50
|
```js
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
const flag = join(tmpdir(), `signed-in-${Date.now()}.flag`)
|
|
52
|
+
await tool.monitor({ description: "sign-in finished", path: flag, event: "create" })
|
|
53
|
+
globalThis.wait = page.waitForFunction(() => !!document.querySelector("[data-user]"), undefined, { timeout: 600_000 })
|
|
54
|
+
.then(() => Bun.write(flag, "ok"), (e) => Bun.write(flag, `failed: ${e.message}`))
|
|
37
55
|
```
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
opening new ones. `BuiltinBrowserUnavailableError` permits another engine only for `unavailable`, `timeout`, or
|
|
43
|
-
`invalid_grant`. For `user_stopped` or any other app refusal, stop browser work and report it; do not open another browser.
|
|
57
|
+
The same shape holds for `requestHelp`, `requestHuman` and any other promise. For a state outside
|
|
58
|
+
the page (a dev server, a build) watch a command instead:
|
|
59
|
+
`tool.monitor({ description, command: "until curl -sf localhost:3000 >/dev/null; do sleep 1; done; printf 'READY\\n'", filter: "^READY$" })`.
|
|
44
60
|
|
|
45
|
-
|
|
61
|
+
**3. READ WITHIN A TOKEN BUDGET.** Read the smallest thing that answers the question:
|
|
62
|
+
`session.observe({ maxTokens: 4000 })` attached, and `session.read(target)` for the text, value or attributes of a few nodes; `omowright.compactSnapshot(await page.snapshot({ find: "Checkout" }))`
|
|
63
|
+
owned (`{ interactive: true }` for controls only, `{ diff: true }` after an action).
|
|
64
|
+
`omowright.snapshotTokens(snapshot).estTokens` measures a tree before you print it. From
|
|
65
|
+
`evaluate`, return the fields you need; never print `getHtml()`, `innerHTML` or a page's `innerText`.
|
|
46
66
|
|
|
47
|
-
|
|
48
|
-
const { loadOmowright } = await import("<skill-root>/scripts/omowright.mjs")
|
|
49
|
-
const { omowright } = await loadOmowright() // { connectBrowserSkill, bskSnapshot, connectPipe, ... }
|
|
50
|
-
```
|
|
67
|
+
## The loop (owned)
|
|
51
68
|
|
|
52
|
-
```
|
|
53
|
-
|
|
69
|
+
```js
|
|
70
|
+
const profile = mkdtempSync(join(tmpdir(), "omowright-"))
|
|
71
|
+
globalThis.browser = await omowright.connectPipe({
|
|
72
|
+
browserPath: omowright.detectBrowsers().find((b) => b.installed)?.binary, // bot-scored target: connectCloakProfile() instead
|
|
73
|
+
browserArgs: ["--headless", "--no-first-run", `--user-data-dir=${profile}`], storageRoot: profile,
|
|
74
|
+
})
|
|
75
|
+
globalThis.page = await browser.newTab("http://localhost:3000/")
|
|
76
|
+
await omowright.emulate(page, "iphone-14") // iphone-14 | pixel-7 | ipad-air | desktop-1440
|
|
77
|
+
print(omowright.compactSnapshot(await page.snapshot({ interactive: true }))) // refs (e7) come from the latest snapshot
|
|
78
|
+
const saved = page.waitForResponse("**/api/cart")
|
|
79
|
+
await page.locator("e7").click(); await saved
|
|
80
|
+
display(await page.screenshot())
|
|
81
|
+
// the task's last cell, on success and failure: await browser.close(); rmSync(profile, { recursive: true, force: true })
|
|
54
82
|
```
|
|
55
83
|
|
|
56
|
-
|
|
57
|
-
|---|---|---|
|
|
58
|
-
| `ready` | CLI, daemon and a connected browser | start a session |
|
|
59
|
-
| `no-cli` / `no-daemon` / `no-extension` | something is missing | `node "<skill-root>/scripts/browser-install.mjs" [--browser=<id>]` prepares everything it can for **the browser the user uses**, then prints the **single** step only the user can do (relaunch that browser and click **Enable**); relay it verbatim, wait, re-run the doctor |
|
|
60
|
-
| `choose-browser` | the signals do not single out one browser (Safari/Firefox default, an idle default while another browser runs, several in use) | nothing was installed; take the browser from memory or ask the user, then `browser-install.mjs --browser=<id>` |
|
|
61
|
-
| `no-browser-support` | no Chromium-family profile on this machine | say so and stop |
|
|
62
|
-
| `outdated-extension` | the only connected extension is BrowserSkill 0.4.0, which leaves a "BrowserSkill" tab group in the user's browser after every task | start no session; relay the doctor's remedy (update the extension to 0.4.1 or later, delete saved "BrowserSkill" groups by hand), then re-run the doctor |
|
|
63
|
-
|
|
64
|
-
**Install into the browser the user actually uses, never into whatever happens to be on disk.** Before
|
|
65
|
-
installing, check your memory for the user's browser; otherwise read the doctor's `browser` (picked
|
|
66
|
-
from the OS default browser, running apps and recent use — `candidates` shows the evidence). If memory
|
|
67
|
-
and the doctor disagree, or the doctor says `choose-browser`, ask the user. Pass the answer as
|
|
68
|
-
`--browser=<id>` and record it in memory. A Chrome that is merely installed is not their browser.
|
|
69
|
-
|
|
70
|
-
**Never launch a headless browser because the attached one is missing.** It has none of the
|
|
71
|
-
user's sessions, so every login turns into a ladder you should not be climbing. Say which state
|
|
72
|
-
you hit and ask.
|
|
84
|
+
Launch, network capture, frames, coordinates and CAPTCHA: [references/owned-engine/README.md](references/owned-engine/README.md).
|
|
73
85
|
|
|
74
86
|
## The loop (attached)
|
|
75
87
|
|
|
76
88
|
```js
|
|
77
|
-
|
|
78
|
-
const sync = async () => (await session.cooperate("sync")).context_id // one context per
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
await session.waitForNavigation({ waitUntil: "load" })
|
|
88
|
-
const shot = await session.screenshot() // { buffer, width, height, captureId }
|
|
89
|
-
} finally {
|
|
90
|
-
await session.stop() // success AND failure; returns borrowed tabs
|
|
91
|
-
}
|
|
89
|
+
globalThis.session = await omowright.connectBrowserSkill({ name: "<task>", focused: false })
|
|
90
|
+
const sync = async () => (await session.cooperate("sync")).context_id // strict policy: one context per gated action
|
|
91
|
+
await session.navigate("https://example.com/", { waitUntil: "load" }) // the first navigate needs no context
|
|
92
|
+
const vom = await session.observe({ maxTokens: 4000 }) // @eN refs; shadow DOM and frames included
|
|
93
|
+
const { items } = await session.read("a") // [{ ref, values: { text } }]: no context, no script
|
|
94
|
+
await session.hover("a", { context: await sync(), expect: [{ target: "a", field: "text", equals: items[0].values.text }] })
|
|
95
|
+
await session.press("End", { context: await sync() })
|
|
96
|
+
await session.navigate("https://example.org/", { waitUntil: "load", context: await sync() })
|
|
97
|
+
const shot = await session.screenshot() // { buffer, width, height, captureId }
|
|
98
|
+
// the task's last cell, on success and failure: await session.stop() // returns borrowed tabs
|
|
92
99
|
```
|
|
93
100
|
|
|
94
|
-
1. **
|
|
95
|
-
|
|
96
|
-
2. **
|
|
97
|
-
3. **
|
|
101
|
+
1. **Refs are reissued by every read, `cooperate("sync")` included.** Act on a ref in the cycle you
|
|
102
|
+
read it, or use a CSS selector, which resolves live; navigation and large DOM changes stale all refs.
|
|
103
|
+
2. **Two identical failures mean change approach, not retry.** A third identical attempt is a defect.
|
|
104
|
+
3. **Sync before every gated action except the first navigate.** Under the default `strict`
|
|
105
|
+
policy a context from `session.cooperate("sync")` is good for one action; reads (`observe`,
|
|
106
|
+
`read`, `snapshot`, `screenshot()`, `waitForElement`, `waitForNavigation`) need none. `expect`
|
|
107
|
+
names facts the extension checks right before the input; a false one refuses the action and
|
|
108
|
+
nothing reaches the page. Under strict that refusal carries `cooperation_sync_required` and
|
|
109
|
+
a message starting `Precondition failed:`, so read the page again instead of waiting. The `target` policy reuses one context
|
|
110
|
+
across DOM actions: [references/commands.md](references/commands.md). On
|
|
111
|
+
`cooperation_sync_required` the person is using the tab:
|
|
112
|
+
`session.cooperate("wait", { timeoutMs: 25_000 })` until `ready`, read again and replan; never
|
|
113
|
+
replay the refused action.
|
|
98
114
|
4. **Borrow a user tab explicitly** (`tabList({ scope: "user" })`, `tabBorrow(id)`, `tabReturn(id)`).
|
|
99
115
|
Borrowing prompts the user; never invent tab ids and never repeat a denied borrow.
|
|
100
|
-
5. **Always `stop()` the session
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
for one action: sync, act with `{ context }`, sync again. Navigation, every input method,
|
|
105
|
-
`evaluate` (and so `bskSnapshot`), `tabClose`, `resize`, `emulate`, `observe({ probeHover })` and
|
|
106
|
-
`screenshot({ fullPage: true })` need it; plain reads (`observe`, `snapshot`, `getHtml`,
|
|
107
|
-
`screenshot()`, `console`, `network`, `waitForNavigation`) do not.
|
|
108
|
-
7. **On `cooperation_sync_required`, wait for the person, then replan.** Call
|
|
109
|
-
`session.cooperate("wait", { timeoutMs: 25_000 })` until it reports `ready`, read the page again
|
|
110
|
-
and decide afresh; never replay the refused action blindly.
|
|
111
|
-
8. **Pass only the options a method takes.** A gated action throws a `TypeError` on any other key
|
|
112
|
-
(a misspelt `contextId` would otherwise send no context). `bskSnapshot` and
|
|
113
|
-
`screenshot({ fullPage: true })` do not throw: they drop the stray key, and the daemon then
|
|
114
|
-
refuses the call with `cooperation_sync_required`.
|
|
115
|
-
|
|
116
|
-
Every method, its options, and the failure codes are in [references/commands.md](references/commands.md).
|
|
116
|
+
5. **Always `stop()` the session**, and keep `focused: false`: the browser belongs to someone who is
|
|
117
|
+
probably using it.
|
|
118
|
+
|
|
119
|
+
Every method, its options, the gated list and the failure codes: [references/commands.md](references/commands.md).
|
|
117
120
|
|
|
118
121
|
## When a human is the only way through
|
|
119
122
|
|
|
120
123
|
Login, CAPTCHA, OTP, a payment confirmation, a consent dialog:
|
|
121
124
|
|
|
122
125
|
```js
|
|
123
|
-
|
|
126
|
+
await tool.monitor({ description: "help finished", path: flag, event: "create" })
|
|
127
|
+
globalThis.help = session.requestHelp({ prompt: "<what you need done>", targets: ["@e4"], timeoutMs: 300_000 })
|
|
128
|
+
.then((r) => Bun.write(flag, r.outcome), (e) => Bun.write(flag, `failed: ${e.message}`))
|
|
124
129
|
```
|
|
125
130
|
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
A person takes longer than a cell, so this is rule 2. When the event arrives, read the flag and
|
|
132
|
+
the page again. Respect a `cancelled` or `timed_out` outcome; do not work around it by changing
|
|
133
|
+
the extension's automation settings.
|
|
128
134
|
|
|
129
135
|
## Rules
|
|
130
136
|
|
|
@@ -132,17 +138,17 @@ changing the extension's automation settings.
|
|
|
132
138
|
cookie or recovery code. The value of the attached engine is that the browser is already signed in.
|
|
133
139
|
- **Never clear cookies, cache or site data.** It is the user's real profile; clearing it logs them
|
|
134
140
|
out everywhere. No flow here needs it.
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
capture on every tab it drives, which is a known automation signal.
|
|
141
|
+
- **Bot-scored or WAF targets never go through the attached engine** — route them to the
|
|
142
|
+
`ultimate-browsing` skill, whose browser tier is `connectCloakProfile()`. The attached engine's
|
|
143
|
+
daemon enables console capture on every tab it drives, which is a known automation signal.
|
|
139
144
|
|
|
140
145
|
## Where the rest lives
|
|
141
146
|
|
|
142
147
|
| Topic | Read |
|
|
143
148
|
|---|---|
|
|
144
149
|
| Session methods, targets, options, error codes | [references/commands.md](references/commands.md) |
|
|
145
|
-
|
|
|
150
|
+
| Doctor states, installing the CLI, daemon and extension, the one human step | [references/install.md](references/install.md) |
|
|
151
|
+
| The built-in browser inside OmO Desktop | [references/desktop.md](references/desktop.md) |
|
|
146
152
|
| Agent on one machine, browser on another | [references/remote.md](references/remote.md) |
|
|
147
153
|
| Owned engine: launch, snapshot ladder, network, frames, human handoff | [references/owned-engine/README.md](references/owned-engine/README.md) |
|
|
148
154
|
| Reading a 1Password vault the user has unlocked | [references/recipes/1password.md](references/recipes/1password.md) |
|
|
@@ -17,36 +17,68 @@ await session.stop() // ALWAYS, on success and failure
|
|
|
17
17
|
on purpose. Throws `BskRpcError` `no_browser_connected` when no extension is attached — that is a
|
|
18
18
|
stop, not a cue to launch something else.
|
|
19
19
|
|
|
20
|
-
## Shared control (BrowserSkill 0.
|
|
20
|
+
## Shared control (BrowserSkill 0.5)
|
|
21
21
|
|
|
22
|
-
The person at the keyboard can work in the task tab while you do, so the extension refuses
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
The person at the keyboard can work in the task tab while you do, so the extension refuses a gated
|
|
23
|
+
page action unless it carries what the latest `session.cooperate("sync")` returned. The daemon
|
|
24
|
+
never fills it in for you. Every gated action takes `{ context, observation, expect, dependsOn }`
|
|
25
|
+
besides its own options.
|
|
26
|
+
|
|
27
|
+
A session runs under one control policy, chosen by its first sync and fixed after that (a sync
|
|
28
|
+
naming the other policy fails with `invalid_params`; start a new session to change it):
|
|
29
|
+
|
|
30
|
+
| Action | `strict` (the default) | `target` (`cooperate("sync", { controlPolicy: "target" })`) |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `click`, `hover`, `fill` and the other calls on a ref or selector | a fresh `context` per action | `context`; the same one serves the next DOM action |
|
|
33
|
+
| `evaluate` (and so `bskSnapshot`) | a fresh `context` per action | `context` plus an unused `observation`, or `expect` facts, or `unverified: true` |
|
|
34
|
+
| `press` with no target, `navigate` | a fresh `context` per action | `context` plus an unused `observation` |
|
|
35
|
+
| `dependsOn` | narrows the check to the observed regions your decision used | refused; state facts in `expect` |
|
|
26
36
|
|
|
27
37
|
```js
|
|
38
|
+
// strict: one context, one action
|
|
28
39
|
const sync = async () => (await session.cooperate("sync")).context_id
|
|
29
|
-
await session.click("@e3", { context: await sync() })
|
|
40
|
+
await session.click("@e3", { context: await sync() })
|
|
30
41
|
await session.fill("#q", "hello", { clearBefore: true, context: await sync() })
|
|
42
|
+
|
|
43
|
+
// target: one context for DOM actions, one observation per script, untargeted key or navigate
|
|
44
|
+
const s = await session.cooperate("sync", { controlPolicy: "target" })
|
|
45
|
+
await session.click("#apply-coupon", { context: s.context_id })
|
|
46
|
+
await session.click("#checkout", { context: s.context_id, expect: [{ target: "#total", field: "text", equals: "$3.00" }] })
|
|
47
|
+
const next = await session.cooperate("sync")
|
|
48
|
+
await session.press("Enter", { context: next.context_id, observation: next.observation_id })
|
|
31
49
|
```
|
|
32
50
|
|
|
33
51
|
| Call | Use |
|
|
34
52
|
|---|---|
|
|
35
|
-
| `session.cooperate("sync", { tabId, maxTokens })` | returns `{ context_id, ... }`; pass
|
|
53
|
+
| `session.cooperate("sync", { controlPolicy, tabId, maxTokens })` | returns `{ context_id, observation_id, ... }`; pass them as `{ context, observation }`. An observation is good for one action |
|
|
36
54
|
| `session.cooperate("wait", { tabId, timeoutMs })` | after `cooperation_sync_required`: blocks (at most 25 s per call) until the person is done; repeat until it reports `ready`, then sync and replan from the live page |
|
|
37
55
|
|
|
38
|
-
-
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
- **`expect`** is a list of literal facts the extension checks right before the input:
|
|
57
|
+
`{ target, field, equals }`, where `field` is `text`, `value`, `checked`, `attribute` or `exists`.
|
|
58
|
+
A false fact refuses the action with `effect_state: "none"`, so nothing reached the page. The
|
|
59
|
+
reason differs by policy: under `target` it is `precondition_failed`; under `strict` it is
|
|
60
|
+
`cooperation_sync_required` with a message starting `Precondition failed: <target> <field>`.
|
|
61
|
+
Recognise the strict case by that prefix, and read the page again instead of calling
|
|
62
|
+
`cooperate("wait")`.
|
|
63
|
+
Use it for the fact your decision rests on: the total you are about to pay, the row you are about
|
|
64
|
+
to delete.
|
|
65
|
+
- **The first `navigate`** of a session needs no context. If the extension refuses it because the new
|
|
66
|
+
task tab is still committing its blank document, `navigate` waits for the tab to settle and sends
|
|
67
|
+
it once more by itself; it throws only when the tab never settles, naming the tab's state.
|
|
68
|
+
- **Gated:** `navigate` (after the first), `back`, `forward`, `reload`, `click`, `hover`, `focus`,
|
|
69
|
+
`blur`, `fill`, `press`, `select`, `scrollTo`, `wheel`, `drag`, `evaluate` (and so
|
|
70
|
+
`bskSnapshot`), `tabClose`, `resize`, `emulate`, `observe({ probeHover: true })`,
|
|
71
|
+
`screenshot({ fullPage: true })`.
|
|
72
|
+
- **Not gated:** `observe`, `snapshot`, `getHtml`, `read`, `extract`, `screenshot()`, `console`,
|
|
73
|
+
`network`, `waitForElement`, `waitForNavigation`, `tabList`, `tabCreate`, `tabSelect`,
|
|
74
|
+
`tabBorrow`, `tabReturn`, `requestHelp`.
|
|
75
|
+
- A method that reads or acts on a tab accepts only its own options (plus
|
|
76
|
+
`{ context, observation, expect, dependsOn }`);
|
|
77
|
+
any other key (`contextId`, an option copied from another method) throws a `TypeError` before
|
|
78
|
+
anything is sent, plain `observe()` included. Two calls do not throw:
|
|
79
|
+
`screenshot({ fullPage: true })` drops an unknown key and `bskSnapshot` passes it on as a
|
|
80
|
+
snapshot option, so a misspelt `contextId` there sends no context and the daemon refuses the
|
|
81
|
+
call with `cooperation_sync_required`.
|
|
50
82
|
- Never replay a refused action blindly: the page may have changed under the person's hands.
|
|
51
83
|
|
|
52
84
|
## Targets
|
|
@@ -54,8 +86,8 @@ await session.fill("#q", "hello", { clearBefore: true, context: await sync() })
|
|
|
54
86
|
| Form | Meaning |
|
|
55
87
|
|---|---|
|
|
56
88
|
| `"@e3"` / `"e3"` | a ref from the last `observe()` / `snapshot()` |
|
|
57
|
-
| `"#login > button"` | a CSS selector, resolved live |
|
|
58
|
-
| `{ captureId, x, y }` | a point in a screenshot, from `screenshot()` |
|
|
89
|
+
| `"#login > button"` | a CSS selector, resolved live in the main document; a gated action refuses one that matches more than one element (`invalid_params`, `target_unavailable`) |
|
|
90
|
+
| `{ captureId, x, y }` | a point in a screenshot, from `screenshot()`; `click` only. `captureId` is `null` when the daemon reports `captureUnavailable`; use a ref or selector then |
|
|
59
91
|
| `css.e3` from `bskSnapshot` | the light-DOM CSS path of an OmOWright ref (`null` inside shadow roots — use the daemon ref instead) |
|
|
60
92
|
|
|
61
93
|
## Reading
|
|
@@ -65,9 +97,16 @@ await session.fill("#q", "hello", { clearBefore: true, context: await sync() })
|
|
|
65
97
|
| `bskSnapshot(session, { interactive, maxDepth, context })` | `{ tree, refs, css }` — the OmOWright accessibility tree with refs, computed in the page **without** leaving a global or touching the DOM |
|
|
66
98
|
| `session.observe({ maxTokens, cursor, probeHover })` | the daemon's semantic tree (`@vom`) with `@eN` refs, layers and hover probes — **the default read for shadow DOM and iframes** |
|
|
67
99
|
| `session.snapshot({ maxDepth, maxTokens })` | the daemon's plain accessibility tree |
|
|
100
|
+
| `session.read(target, { fields, maxNodes })` | `{ items: [{ ref, values: { text, ... } }], page_url, title }` for the matching nodes, with no script and no context; `items` is empty when nothing matches. Each field is an object: `fields: [{ key: "href", read: "attribute", attribute: "href" }]` puts the link's `href` in `values.href` (`read` is `text`, `attribute`, `value`, `checked` or `exists`) |
|
|
101
|
+
| `session.extract("table" \| "list" \| "discover", { target, itemSelector, fields })` | rows of a table or list |
|
|
68
102
|
| `session.getHtml({ ref, maxBytes })` | exact markup |
|
|
69
103
|
| `session.screenshot({ ref })` / `screenshot({ fullPage: true })` | `{ buffer, width, height, captureId }`; full-page captures stream back in chunks |
|
|
70
|
-
| `session.evaluate(expression, { awaitPromise, timeoutMs, context })` | `{ ok, value, error }` — **check `.ok`**; a resolved promise does not mean the script succeeded |
|
|
104
|
+
| `session.evaluate(expression, { awaitPromise, timeoutMs, unverified, context })` | `{ ok, value, error }` — **check `.ok`**; a resolved promise does not mean the script succeeded |
|
|
105
|
+
|
|
106
|
+
Prefer `read` or `extract` to `evaluate` whenever the answer is already in the DOM (a heading, an
|
|
107
|
+
input's value, a link's `href`, a table): they need no sync, cannot change the page, and pass the
|
|
108
|
+
field traps below. Keep `evaluate` for values the page computes (`location.href`, layout, app
|
|
109
|
+
state) and for waiting on a state that `waitForElement` cannot express.
|
|
71
110
|
| `session.console({ since })` / `session.network({ since })` | buffered console entries / request metadata (no bodies) |
|
|
72
111
|
|
|
73
112
|
**Refs are reissued by every read.** Read a ref and act on it in the same cycle. A ref captured
|
|
@@ -76,7 +115,7 @@ neighbouring row.
|
|
|
76
115
|
|
|
77
116
|
## Acting
|
|
78
117
|
|
|
79
|
-
Every call here is gated: add `context` (from `cooperate("sync")`) to its options object, as in
|
|
118
|
+
Every call here except `waitForElement()` and `waitForNavigation()` is gated: add `context` (from `cooperate("sync")`) to its options object, as in
|
|
80
119
|
`session.click(target, { context })`, `session.resize(width, height, { context })`,
|
|
81
120
|
`session.tabClose(id, { context })`.
|
|
82
121
|
|
|
@@ -88,11 +127,17 @@ Every call here is gated: add `context` (from `cooperate("sync")`) to its option
|
|
|
88
127
|
| Key | `session.press("Enter", { target, modifiers, holdMs })` |
|
|
89
128
|
| Hover | `session.hover(target, { settleMs })` |
|
|
90
129
|
| Scroll into view | `session.scrollTo(target)` |
|
|
130
|
+
| Drag | `session.drag(source, { target, delta: { x, y }, mode })` |
|
|
91
131
|
| Wheel | `session.wheel({ deltaY: 600, target })` |
|
|
92
132
|
| Focus / blur | `session.focus(target)` / `session.blur(target)` |
|
|
93
133
|
| Navigate | `session.navigate(url, { waitUntil: "load" \| "domcontentloaded" \| "networkidle" \| "commit", timeoutMs })`, `back()`, `forward()`, `reload({ hard })`, `waitForNavigation()` |
|
|
94
134
|
| Window | `session.resize(width, height)`, `session.emulate({ overrides: { width, mobile } })` |
|
|
95
135
|
|
|
136
|
+
Waiting is never a fixed delay: `navigate(url, { waitUntil: "networkidle" })` for a page that renders
|
|
137
|
+
after load, `waitForNavigation()` after an action that navigates,
|
|
138
|
+
`waitForElement(target, { state: "visible" | "hidden" | "attached" | "detached", timeoutMs })` for an
|
|
139
|
+
element, and for any other state `evaluate("new Promise((done) => { /* resolve when the state holds */ })", { awaitPromise: true, timeoutMs, context })`.
|
|
140
|
+
|
|
96
141
|
Traps:
|
|
97
142
|
|
|
98
143
|
- `select` takes the option's **value attribute**, not its visible label.
|
|
@@ -103,7 +148,16 @@ Traps:
|
|
|
103
148
|
- Hover-only controls report `element not visible`: hover the trigger, read again, then act on the
|
|
104
149
|
revealed item's fresh ref. `observe({ probeHover: true })` finds one when no marker does, at the
|
|
105
150
|
cost of touching the live page.
|
|
106
|
-
|
|
151
|
+
|
|
152
|
+
### Field traps in any Chromium-based browser
|
|
153
|
+
|
|
154
|
+
- **A frame injected by another extension** (a password manager, a translator, a grammar checker)
|
|
155
|
+
can make the debugger refuse the whole tab. It is usually transient: do
|
|
156
|
+
the work in one `evaluate`, or navigate away and back, then read again.
|
|
157
|
+
- **A control inside another extension's own frame can never be driven.** Its frame belongs to that
|
|
158
|
+
extension, not to the page. Hand that click to the person with `requestHelp`.
|
|
159
|
+
- **Clipboard writes fail in an unfocused Agent Window**, and `focused: false` is the default you
|
|
160
|
+
should keep. Read the value out of the DOM with `read` instead of copying it.
|
|
107
161
|
|
|
108
162
|
## Tabs
|
|
109
163
|
|
|
@@ -119,10 +173,14 @@ Never invent tab ids and never repeat a denied borrow.
|
|
|
119
173
|
## Humans
|
|
120
174
|
|
|
121
175
|
```js
|
|
122
|
-
|
|
176
|
+
await tool.monitor({ description: "help finished", path: flag, event: "create" }) // subscribe first
|
|
177
|
+
globalThis.help = session.requestHelp({ prompt, title, targets: ["@e4"], completionCriteria, timeoutMs })
|
|
178
|
+
.then((r) => Bun.write(flag, r.outcome), (e) => Bun.write(flag, `failed: ${e.message}`))
|
|
123
179
|
// outcome: "completed" | "continued" | "cancelled" | "timed_out" | "navigated" | "disabled"
|
|
124
180
|
```
|
|
125
181
|
|
|
182
|
+
Never `await` it in an eval cell: a person takes longer than a cell (SKILL.md rule 2).
|
|
183
|
+
|
|
126
184
|
## Errors
|
|
127
185
|
|
|
128
186
|
Every refusal is a `BskRpcError` with the daemon's own `code`:
|
|
@@ -132,7 +190,11 @@ Every refusal is a `BskRpcError` with the daemon's own `code`:
|
|
|
132
190
|
| `no_browser_connected` | no extension attached | run the onboarding script, relay the human step, wait |
|
|
133
191
|
| `not_found` | stale ref or unknown session | read again; if the session is gone, start a new one |
|
|
134
192
|
| `invalid_params` | wrong option shape | fix the call, do not retry as-is |
|
|
135
|
-
| `permission_denied` with `data.reason: "cooperation_sync_required"` | a gated action without the latest sync context, or the person is using the tab | `cooperate("wait")` until `ready`, sync, read the page again, replan |
|
|
193
|
+
| `permission_denied` with `data.reason: "cooperation_sync_required"` (any other message) | a gated action without the latest sync context, or the person is using the tab | `cooperate("wait")` until `ready`, sync, read the page again, replan |
|
|
194
|
+
| `permission_denied` with `data.reason: "precondition_failed"` (target), or `cooperation_sync_required` with a message starting `Precondition failed:` (strict) | an `expect` fact was false; nothing was sent | read the page again and decide afresh |
|
|
195
|
+
| `permission_denied` with `data.reason: "observation_required"` | target policy: a script, an untargeted key or a navigate with no observation, or with one already used | sync, pass `{ context, observation }` (or `expect` for a script) |
|
|
196
|
+
| `permission_denied` with `data.reason: "observation_changed"` | target policy: the page changed between the sync and this action | sync again, read, replan |
|
|
197
|
+
| `data.reason: "control_context_invalid"` | the keyboard focus changed since the sync | sync again, read, replan |
|
|
136
198
|
| `permission_denied` (any other reason) | `evaluate` on a tab outside the Agent Window, or a denied borrow | stop; the user said no |
|
|
137
199
|
| `timeout` | the tool did not finish in its budget | read the page state before retrying once |
|
|
138
200
|
| `user_aborted` | the user pressed Stop in the browser | stop the task and report |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# The built-in browser inside OmO Desktop
|
|
2
|
+
|
|
3
|
+
When `OMO_BROWSER_ENGINE` is set (the OmO desktop app sets it for every session), both engines work exactly
|
|
4
|
+
as in the terminal. The app adds one more option:
|
|
5
|
+
|
|
6
|
+
| Option | What it is | Use it when |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `connectBuiltinBrowser()` | OmO's built-in browser for this thread: the tab the user sees beside the chat, which they can watch, take over and share | the user should see the page while you work, the task is QA of something in the app, or a sign-in the user should do themselves in a visible tab |
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
const browser = await omowright.connectBuiltinBrowser()
|
|
12
|
+
const [tab] = await browser.listTargets()
|
|
13
|
+
const page = await browser.attachPage(tab.id)
|
|
14
|
+
await page.goto(url)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It is an OmOWright connection like `connect()`. Work in few calls: take `page.snapshot()` once, act on its refs,
|
|
18
|
+
and chain several actions in one eval cell (`page.locator(ref).fill()`, `.click()`, `.selectOption(value)`,
|
|
19
|
+
`.setInputFiles(path)`), snapshotting again only after the page changed. It has one tab: navigate it rather than
|
|
20
|
+
opening new ones. `BuiltinBrowserUnavailableError` permits another engine only for `unavailable`, `timeout`, or
|
|
21
|
+
`invalid_grant`. For `user_stopped` or any other app refusal, stop browser work and report it; do not open another browser.
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Installing the attached engine
|
|
2
2
|
|
|
3
|
+
## Doctor states
|
|
4
|
+
|
|
5
|
+
`node "<skill-root>/scripts/browser-doctor.mjs" --json` reports one state:
|
|
6
|
+
|
|
7
|
+
| State | Meaning | Next |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `ready` | CLI, daemon and a connected browser | start a session |
|
|
10
|
+
| `no-cli` / `no-daemon` / `no-extension` | something is missing | `node "<skill-root>/scripts/browser-install.mjs" [--browser=<id>]` prepares everything it can for **the browser the user uses**, then prints the **single** step only the user can do (relaunch that browser and click **Enable**); relay it verbatim, wait, re-run the doctor |
|
|
11
|
+
| `choose-browser` | the signals do not single out one browser (Safari/Firefox default, an idle default while another browser runs, several in use) | nothing was installed; take the browser from memory or ask the user, then `browser-install.mjs --browser=<id>` |
|
|
12
|
+
| `no-browser-support` | no Chromium-family profile on this machine | say so and stop |
|
|
13
|
+
| `outdated-extension` | the only connected extension is BrowserSkill 0.4.0, which leaves a "BrowserSkill" tab group in the user's browser after every task | start no session; relay the doctor's remedy (update the extension to 0.4.1 or later, delete saved "BrowserSkill" groups by hand), then re-run the doctor |
|
|
14
|
+
|
|
15
|
+
**Install into the browser the user actually uses, never into whatever happens to be on disk.** Before
|
|
16
|
+
installing, check your memory for the user's browser; otherwise read the doctor's `browser` (picked
|
|
17
|
+
from the OS default browser, running apps and recent use — `candidates` shows the evidence). If memory
|
|
18
|
+
and the doctor disagree, or the doctor says `choose-browser`, ask the user. Pass the answer as
|
|
19
|
+
`--browser=<id>` and record it in memory. A Chrome that is merely installed is not their browser.
|
|
20
|
+
|
|
3
21
|
Three pieces. The onboarding script prepares all three; a human finishes exactly one.
|
|
4
22
|
|
|
5
23
|
| Piece | Channel | Automatable |
|
|
@@ -7,7 +7,7 @@ opposite of the attached engine: no user logins, full control.
|
|
|
7
7
|
const { omowright } = await loadOmowright()
|
|
8
8
|
const profile = mkdtempSync(join(tmpdir(), "omowright-"))
|
|
9
9
|
const browser = await omowright.connectPipe({
|
|
10
|
-
browserPath:
|
|
10
|
+
browserPath: omowright.detectBrowsers().find((b) => b.installed)?.binary, // or omowright.findCloakBrowserPath(); never a guessed path
|
|
11
11
|
browserArgs: ["--headless", "--no-first-run", `--user-data-dir=${profile}`],
|
|
12
12
|
storageRoot: profile,
|
|
13
13
|
dialogPolicy: { accept: true },
|
|
@@ -49,7 +49,10 @@ blocked URL, neither: use the `ultimate-browsing` skill.
|
|
|
49
49
|
|
|
50
50
|
`OmOPage` is Playwright-shaped: `goto`, `snapshot`, `locator(ref | css)`, `click`, `fill`,
|
|
51
51
|
`press`, `hover`, `check`, `selectOption`, `dragTo`, `setInputFiles`, `screenshot`, `pdf`,
|
|
52
|
-
`evaluate`, `
|
|
52
|
+
`evaluate`, `keyboard`, `mouse`, `frameLocator`, `getByRole` / `getByText` / `getByLabel`, and the
|
|
53
|
+
waits `waitForFunction(fn, arg, { timeout })`, `waitForResponse` / `waitForRequest`, `waitForURL`,
|
|
54
|
+
`waitForLoadState`, `locator.waitFor`. `page.emulateMedia({ colorScheme, reducedMotion })` sets
|
|
55
|
+
media features; raw `Emulation.*` CDP is never needed. A snapshot is an accessibility tree
|
|
53
56
|
with virtual refs (`[ref=e3]`, cross-origin frames as `f1e3`); `compactSnapshot()` drops the refs
|
|
54
57
|
map, about half the bytes. Readiness is a content probe (body plus interactive elements, landmarks
|
|
55
58
|
or text), not a timer; `goto(url, { waitUntil: "commit" })` is the escape hatch for empty pages.
|
package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md
CHANGED
|
@@ -56,13 +56,18 @@ When every rung fails on a login, a one-time code, or a challenge you cannot cle
|
|
|
56
56
|
the fallback, not the failure:
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
|
-
|
|
59
|
+
await tool.monitor({ description: "sign-in finished", path: flag, event: "create" }) // subscribe first
|
|
60
|
+
globalThis.handoff = omowright.requestHuman(page, {
|
|
60
61
|
prompt: "Please finish the sign-in in this window.",
|
|
61
62
|
until: { url: /\/dashboard/ }, // or { selector } or async (page) => boolean
|
|
62
63
|
timeoutMs: 300_000,
|
|
63
|
-
})
|
|
64
|
+
}).then((r) => Bun.write(flag, r.outcome), (e) => Bun.write(flag, `failed: ${e.message}`))
|
|
64
65
|
```
|
|
65
66
|
|
|
67
|
+
Never `await` it in the cell: a person takes longer than a cell, and the page stays usable from
|
|
68
|
+
other cells while the handoff is pending (measured: a second cell snapshotted the page 6 s in,
|
|
69
|
+
before the person finished).
|
|
70
|
+
|
|
66
71
|
It brings the window to the front, shows a banner with a Done button, and waits on a
|
|
67
72
|
**condition** with a bounded timeout rather than a fixed delay. Respect the answer: `timed_out`
|
|
68
73
|
or `cancelled` is a stop, and the correct response is to report which rung failed with what
|
|
@@ -25,13 +25,14 @@ reason.
|
|
|
25
25
|
## Collecting through infinite scroll
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
|
-
for await (const
|
|
29
|
-
items.push(
|
|
28
|
+
for await (const item of omowright.collectWhileScrolling(page, snoop, { minItems: 200, maxScrolls: 10, extract: (json) => json.items })) {
|
|
29
|
+
items.push(item) // one extracted item per iteration, already de-duplicated
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Scroll, collect what is new, stop on a target count or a scroll ceiling. Bound both, so a page
|
|
34
|
-
that keeps producing cannot run forever.
|
|
34
|
+
that keeps producing cannot run forever. A round ends when the next response lands; `settleMs`
|
|
35
|
+
(default 800) only bounds a round in which nothing arrives, so leave it unset.
|
|
35
36
|
|
|
36
37
|
## Flight traces
|
|
37
38
|
|
|
@@ -47,10 +47,12 @@ Other automation may be driving the same window.
|
|
|
47
47
|
## If it is locked
|
|
48
48
|
|
|
49
49
|
```js
|
|
50
|
-
await
|
|
50
|
+
await tool.monitor({ description: "1Password unlocked", path: flag, event: "create" }) // subscribe first
|
|
51
|
+
globalThis.help = session.requestHelp({ prompt: "Please unlock 1Password in this tab, then continue." })
|
|
52
|
+
.then((r) => Bun.write(flag, r.outcome), (e) => Bun.write(flag, `failed: ${e.message}`))
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
End the cell; when the event arrives, read the page again.
|
|
54
56
|
|
|
55
57
|
## Not in scope
|
|
56
58
|
|