oh-my-opencode 5.1.83 → 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/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 +2 -2
- 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
package/dist/index.js
CHANGED
|
@@ -97,15 +97,18 @@ var init_deep_merge = __esm(() => {
|
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
// packages/utils/src/escape-for-display.ts
|
|
100
|
-
function escapeForDisplay(text) {
|
|
100
|
+
function escapeForDisplay(text, { keepLineFeeds = false } = {}) {
|
|
101
101
|
return text.replace(UNSAFE_FOR_DISPLAY, (character) => {
|
|
102
|
+
if (keepLineFeeds && character === `
|
|
103
|
+
`)
|
|
104
|
+
return character;
|
|
102
105
|
const code = character.codePointAt(0) ?? 0;
|
|
103
106
|
return code > 65535 ? `\\u{${code.toString(16)}}` : `\\u${code.toString(16).padStart(4, "0")}`;
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
109
|
var UNSAFE_FOR_DISPLAY;
|
|
107
110
|
var init_escape_for_display = __esm(() => {
|
|
108
|
-
UNSAFE_FOR_DISPLAY = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/gu;
|
|
111
|
+
UNSAFE_FOR_DISPLAY = /[\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/gu;
|
|
109
112
|
});
|
|
110
113
|
|
|
111
114
|
// packages/utils/src/config-merge.ts
|
|
@@ -95727,7 +95730,7 @@ var OmoConfigLayerSchema = z23.object({
|
|
|
95727
95730
|
// packages/omo-config-core/src/schema/legacy-category-names.ts
|
|
95728
95731
|
var LEGACY_CATEGORY_NAME_ALIASES = { deep: "deep-low" };
|
|
95729
95732
|
function canonicalCategoryName(name) {
|
|
95730
|
-
return Object.hasOwn(LEGACY_CATEGORY_NAME_ALIASES, name) ? LEGACY_CATEGORY_NAME_ALIASES[name] : name;
|
|
95733
|
+
return Object.hasOwn(LEGACY_CATEGORY_NAME_ALIASES, name) ? LEGACY_CATEGORY_NAME_ALIASES[name] ?? name : name;
|
|
95731
95734
|
}
|
|
95732
95735
|
function isRecord10(value) {
|
|
95733
95736
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -95785,7 +95788,7 @@ function hasLegacyCategoryNames(document) {
|
|
|
95785
95788
|
|
|
95786
95789
|
// packages/omo-config-core/src/schema/legacy-harness-names.ts
|
|
95787
95790
|
function canonicalHarnessName(name) {
|
|
95788
|
-
return Object.hasOwn(OMO_CONFIG_LEGACY_HARNESS_ALIASES, name) ? OMO_CONFIG_LEGACY_HARNESS_ALIASES[name] : name;
|
|
95791
|
+
return Object.hasOwn(OMO_CONFIG_LEGACY_HARNESS_ALIASES, name) ? OMO_CONFIG_LEGACY_HARNESS_ALIASES[name] ?? name : name;
|
|
95789
95792
|
}
|
|
95790
95793
|
function harnessBlockKey(harness) {
|
|
95791
95794
|
return `[${harness}]`;
|
|
@@ -97390,15 +97393,15 @@ function stripRetiredCodegraph(document) {
|
|
|
97390
97393
|
if (!isPlainObject4(value))
|
|
97391
97394
|
return;
|
|
97392
97395
|
if (Object.prototype.hasOwnProperty.call(value, "codegraph")) {
|
|
97393
|
-
delete value
|
|
97396
|
+
delete value["codegraph"];
|
|
97394
97397
|
removedPaths.push([...path, "codegraph"]);
|
|
97395
97398
|
}
|
|
97396
97399
|
};
|
|
97397
97400
|
strip(stripped, []);
|
|
97398
97401
|
for (const harness of OMO_HARNESS_BLOCKS)
|
|
97399
97402
|
strip(stripped[harness], [harness]);
|
|
97400
|
-
if (isPlainObject4(stripped
|
|
97401
|
-
for (const [profileName, profile] of Object.entries(stripped
|
|
97403
|
+
if (isPlainObject4(stripped["profiles"])) {
|
|
97404
|
+
for (const [profileName, profile] of Object.entries(stripped["profiles"])) {
|
|
97402
97405
|
strip(profile, ["profiles", profileName]);
|
|
97403
97406
|
if (!isPlainObject4(profile))
|
|
97404
97407
|
continue;
|
|
@@ -98105,7 +98108,7 @@ init_src();
|
|
|
98105
98108
|
// package.json
|
|
98106
98109
|
var package_default = {
|
|
98107
98110
|
name: "oh-my-opencode",
|
|
98108
|
-
version: "5.1.
|
|
98111
|
+
version: "5.1.84",
|
|
98109
98112
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
98110
98113
|
main: "./dist/index.js",
|
|
98111
98114
|
types: "dist/index.d.ts",
|
|
@@ -98369,7 +98372,7 @@ var package_default = {
|
|
|
98369
98372
|
"jsonc-parser": "^3.3.1",
|
|
98370
98373
|
knip: "6.43.0",
|
|
98371
98374
|
"node-pty": "^1.1.0",
|
|
98372
|
-
omowright: "^0.3.
|
|
98375
|
+
omowright: "^0.3.4",
|
|
98373
98376
|
"oxc-parser": "0.148.0",
|
|
98374
98377
|
oxlint: "1.89.0",
|
|
98375
98378
|
picocolors: "^1.1.1",
|
|
@@ -98379,18 +98382,18 @@ var package_default = {
|
|
|
98379
98382
|
typescript: "^7.0.2"
|
|
98380
98383
|
},
|
|
98381
98384
|
optionalDependencies: {
|
|
98382
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
98383
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
98384
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
98385
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
98386
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
98387
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
98388
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
98389
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
98390
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
98391
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
98392
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
98393
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
98385
|
+
"oh-my-opencode-darwin-arm64": "5.1.84",
|
|
98386
|
+
"oh-my-opencode-darwin-x64": "5.1.84",
|
|
98387
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.84",
|
|
98388
|
+
"oh-my-opencode-linux-arm64": "5.1.84",
|
|
98389
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.84",
|
|
98390
|
+
"oh-my-opencode-linux-x64": "5.1.84",
|
|
98391
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.84",
|
|
98392
|
+
"oh-my-opencode-linux-x64-musl": "5.1.84",
|
|
98393
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.84",
|
|
98394
|
+
"oh-my-opencode-windows-arm64": "5.1.84",
|
|
98395
|
+
"oh-my-opencode-windows-x64": "5.1.84",
|
|
98396
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.84"
|
|
98394
98397
|
},
|
|
98395
98398
|
overrides: {
|
|
98396
98399
|
hono: "^4.13.8",
|
|
@@ -192900,7 +192903,7 @@ var UNCONFIGURED_POSTHOG_API_KEY = "phc_REPLACE_ME_OMO_NATIVE";
|
|
|
192900
192903
|
|
|
192901
192904
|
// packages/telemetry-core/src/env.ts
|
|
192902
192905
|
var TRUTHY_DISABLE_VALUES = ["1", "true", "yes"];
|
|
192903
|
-
var SEND_OPT_OUT_VALUES = ["0", "false", "no"
|
|
192906
|
+
var SEND_OPT_OUT_VALUES = ["0", "false", "no"];
|
|
192904
192907
|
function normalizeEnvValue(value) {
|
|
192905
192908
|
return value?.trim().toLowerCase();
|
|
192906
192909
|
}
|
|
@@ -192921,6 +192924,9 @@ function shouldDisableTelemetry(input) {
|
|
|
192921
192924
|
if (isDisableFlag(env["DO_NOT_TRACK"]) || isDisableFlag(env[`${globalPrefix}_DISABLE_TELEMETRY`])) {
|
|
192922
192925
|
return true;
|
|
192923
192926
|
}
|
|
192927
|
+
if (env["OTEL_SDK_DISABLED"]?.trim().toLowerCase() === "true") {
|
|
192928
|
+
return true;
|
|
192929
|
+
}
|
|
192924
192930
|
for (const prefix of prefixes) {
|
|
192925
192931
|
if (isDisableFlag(env[`${prefix}_DISABLE_POSTHOG`])) {
|
|
192926
192932
|
return true;
|
|
@@ -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.
|