oh-my-opencode 5.1.64 → 5.1.66
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/index.js +99 -60
- package/dist/cli/service-auth/closed-device-login.d.ts +16 -0
- package/dist/cli/service-auth/commands.d.ts +9 -2
- package/dist/cli/service-auth/session.d.ts +12 -0
- package/dist/cli-node/index.js +99 -60
- package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
- package/dist/config/schema/runtime-fallback.d.ts +1 -0
- package/dist/features/background-agent/manager.d.ts +1 -0
- package/dist/hooks/runtime-fallback/auto-retry-timeout.d.ts +1 -1
- package/dist/hooks/runtime-fallback/auto-retry.d.ts +1 -1
- package/dist/hooks/runtime-fallback/constants.d.ts +12 -10
- package/dist/hooks/runtime-fallback/fallback-state.d.ts +1 -0
- package/dist/hooks/runtime-fallback/types.d.ts +10 -1
- package/dist/index.js +889 -237
- package/dist/oh-my-opencode.schema.json +4 -0
- package/dist/shared/compaction-in-flight.d.ts +15 -0
- package/dist/shared/runtime-fallback-recovery.d.ts +38 -0
- package/dist/shared/runtime-fallback-retry-marker.d.ts +2 -0
- package/dist/skills/browser/SKILL.md +24 -7
- package/dist/skills/browser/references/commands.md +41 -4
- package/dist/skills/browser/references/owned-engine/frames-and-humans.md +15 -4
- package/dist/skills/browser/references/recipes/1password.md +4 -2
- package/dist/skills/browser/runtime/omowright/index.js +232 -341
- package/dist/skills/browser/runtime/omowright/manifest.json +5 -5
- package/dist/skills/browser/runtime/omowright/page-bundle.js +1586 -1394
- package/dist/skills/browser/scripts/browser-doctor-report.mjs +68 -0
- package/dist/skills/browser/scripts/browser-doctor.mjs +8 -43
- package/dist/skills/browser/scripts/omowright.mjs +7 -1
- package/dist/skills/debugging/references/tools/browser-qa.md +4 -3
- package/dist/skills/ultimate-browsing/SKILL.md +1 -1
- package/dist/skills/ulw-research/SKILL.md +6 -6
- package/dist/skills/ulw-research/references/research-collection.md +2 -2
- package/dist/skills/visual-qa/references/browser-setup.md +5 -4
- package/dist/tui.js +36 -16
- package/package.json +15 -15
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +19 -0
- 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/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- 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/skills/browser/SKILL.md +24 -7
- package/packages/omo-codex/plugin/skills/browser/references/commands.md +41 -4
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +15 -4
- package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +4 -2
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +232 -341
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +5 -5
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/page-bundle.js +1586 -1394
- package/packages/omo-codex/plugin/skills/browser/scripts/browser-doctor-report.mjs +68 -0
- package/packages/omo-codex/plugin/skills/browser/scripts/browser-doctor.mjs +8 -43
- package/packages/omo-codex/plugin/skills/browser/scripts/omowright.mjs +7 -1
- package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +4 -3
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +6 -6
- package/packages/omo-codex/plugin/skills/ulw-research/references/research-collection.md +2 -2
- package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +5 -4
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +21 -2
- package/packages/shared-skills/skills/browser/SKILL.md +24 -7
- package/packages/shared-skills/skills/browser/references/commands.md +41 -4
- package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +15 -4
- package/packages/shared-skills/skills/browser/references/recipes/1password.md +4 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/index.js +232 -341
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +5 -5
- package/packages/shared-skills/skills/browser/runtime/omowright/page-bundle.js +1586 -1394
- package/packages/shared-skills/skills/browser/scripts/browser-doctor-report.mjs +68 -0
- package/packages/shared-skills/skills/browser/scripts/browser-doctor.mjs +8 -43
- package/packages/shared-skills/skills/browser/scripts/omowright.mjs +7 -1
- package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +4 -3
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/shared-skills/skills/ulw-research/SKILL.md +6 -6
- package/packages/shared-skills/skills/ulw-research/references/research-collection.md +2 -2
- package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +5 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type CompactionInFlight = {
|
|
2
|
+
gen: number;
|
|
3
|
+
startedAt: number;
|
|
4
|
+
messageID?: string;
|
|
5
|
+
endedAt?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function recordCompactionStart(sessionID: string, messageID?: string): void;
|
|
8
|
+
export declare function recordCompactionEnd(sessionID: string, expectedGeneration?: number, expectedMessageID?: string): void;
|
|
9
|
+
export declare function clearAllCompactions(): void;
|
|
10
|
+
export declare function getCompaction(sessionID: string): CompactionInFlight | undefined;
|
|
11
|
+
export declare function isCompactionInFlight(sessionID: string): boolean;
|
|
12
|
+
export declare function observeCompactionEvent(event: {
|
|
13
|
+
type: string;
|
|
14
|
+
properties?: unknown;
|
|
15
|
+
}): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arbitration between the runtime-fallback hook (same-session retry) and the
|
|
3
|
+
* background manager (terminal error finalization) for one `session.error` event.
|
|
4
|
+
*
|
|
5
|
+
* The event dispatcher runs the background manager before runtime-fallback, and
|
|
6
|
+
* runtime-fallback resolves its agent asynchronously before it decides anything,
|
|
7
|
+
* so the manager cannot read runtime-fallback's state at the moment the error
|
|
8
|
+
* arrives. Each `session.error` event therefore carries a claim: the dispatcher
|
|
9
|
+
* opens it before any hook runs, runtime-fallback settles it once it has decided,
|
|
10
|
+
* and the manager awaits it before finalizing the task.
|
|
11
|
+
*
|
|
12
|
+
* Claims are keyed by the event object, not by session or message id. Retry
|
|
13
|
+
* prompts can reuse the original user message id, so neither a session id nor a
|
|
14
|
+
* marker on a message can tell a stale error from the failure of the retry; the
|
|
15
|
+
* event itself is the only identity that stays attached to one error.
|
|
16
|
+
*/
|
|
17
|
+
export type RuntimeFallbackRecoveryDecision = "retry-owned" | "declined" | "timed-out";
|
|
18
|
+
type SettledDecision = Exclude<RuntimeFallbackRecoveryDecision, "timed-out">;
|
|
19
|
+
/** Called by the runtime-fallback hook for its lifetime. Without an owner no claim is ever opened. */
|
|
20
|
+
export declare function registerRuntimeFallbackRecoveryOwner(): () => void;
|
|
21
|
+
/** Called by the event dispatcher before any hook sees the event. */
|
|
22
|
+
export declare function openRuntimeFallbackRecoveryClaim(event: object, sessionID: string): void;
|
|
23
|
+
/** Called by the runtime-fallback hook once it has finished handling the event. */
|
|
24
|
+
export declare function settleRuntimeFallbackRecoveryClaim(event: object, decision: SettledDecision): void;
|
|
25
|
+
/**
|
|
26
|
+
* Called by consumers that would otherwise terminalize on the event. Returns
|
|
27
|
+
* undefined when no claim was opened for it, so callers pay no extra await in
|
|
28
|
+
* that case. A timeout is not a refusal: the hook may still commit a dispatch.
|
|
29
|
+
* Consumers must not start competing recovery on `timed-out`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function awaitRuntimeFallbackRecoveryDecision(event: object, timeoutMs?: number): Promise<RuntimeFallbackRecoveryDecision> | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The decision the hook settles after a waiter already timed out. Resolves once the claim is settled,
|
|
34
|
+
* including by the last owner's release, so a late `declined` can still finalize the task.
|
|
35
|
+
*/
|
|
36
|
+
export declare function awaitLateRuntimeFallbackRecoveryDecision(event: object): Promise<SettledDecision> | undefined;
|
|
37
|
+
export declare function _resetRuntimeFallbackRecoveryForTesting(): void;
|
|
38
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const OMO_RUNTIME_FALLBACK_RETRY_MARKER = "<!-- OMO_RUNTIME_FALLBACK_RETRY -->";
|
|
2
|
+
export declare const RUNTIME_FALLBACK_RETRY_CONTINUATION_TEXT = "continue";
|
|
2
3
|
type RuntimeFallbackRetryTextPartLike = {
|
|
3
4
|
type?: string;
|
|
4
5
|
text?: string;
|
|
@@ -13,4 +14,5 @@ export declare function createRuntimeFallbackRetryTextPart(text: string): {
|
|
|
13
14
|
text: string;
|
|
14
15
|
};
|
|
15
16
|
export declare function isRuntimeFallbackRetryTextParts(parts: readonly RuntimeFallbackRetryTextPartLike[] | undefined): boolean;
|
|
17
|
+
export declare function hasSubstantivePromptText(parts: unknown): boolean;
|
|
16
18
|
export {};
|
|
@@ -14,7 +14,8 @@ One library, two engines. omowright ships inside this skill; choose the engine b
|
|
|
14
14
|
| A 403/WAF host the attached engine cannot open, a platform with a native reader, an archive snapshot | neither | the `ultimate-browsing` skill |
|
|
15
15
|
|
|
16
16
|
**Attached is the default,** because it is the only engine carrying the user's logins and the only
|
|
17
|
-
one where a human is a single call away.
|
|
17
|
+
one where a human is a single call away. It works in an Agent Window inside the user's own browser profile, never in
|
|
18
|
+
a copy of that profile, and exists only where the user installed and enabled the BrowserSkill extension. Never substitute one engine for the other silently: if
|
|
18
19
|
the attached engine is not set up, run the onboarding script and tell the user its one remaining
|
|
19
20
|
step.
|
|
20
21
|
|
|
@@ -58,6 +59,7 @@ node "<skill-root>/scripts/browser-doctor.mjs" --json
|
|
|
58
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 |
|
|
59
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>` |
|
|
60
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 |
|
|
61
63
|
|
|
62
64
|
**Install into the browser the user actually uses, never into whatever happens to be on disk.** Before
|
|
63
65
|
installing, check your memory for the user's browser; otherwise read the doctor's `browser` (picked
|
|
@@ -73,14 +75,15 @@ you hit and ask.
|
|
|
73
75
|
|
|
74
76
|
```js
|
|
75
77
|
const session = await omowright.connectBrowserSkill({ name: "<task>", focused: false })
|
|
78
|
+
const sync = async () => (await session.cooperate("sync")).context_id // one context per page action
|
|
76
79
|
try {
|
|
77
|
-
await session.navigate("https://example.com/", { waitUntil: "load" })
|
|
78
|
-
const { tree, refs, css } = await omowright.bskSnapshot(session, { interactive: true }) // OmOWright tree + refs, no trace in the page
|
|
79
|
-
await session.click({ selector: css.e3 })
|
|
80
|
+
await session.navigate("https://example.com/", { waitUntil: "load", context: await sync() })
|
|
81
|
+
const { tree, refs, css } = await omowright.bskSnapshot(session, { interactive: true, context: await sync() }) // OmOWright tree + refs, no trace in the page
|
|
82
|
+
await session.click({ selector: css.e3 }, { context: await sync() }) // css[ref] is null inside shadow roots:
|
|
80
83
|
const vom = await session.observe({ maxTokens: 4000 }) // then read the daemon's own tree ...
|
|
81
|
-
await session.click("@e7")
|
|
82
|
-
await session.fill(css.e5, "hello")
|
|
83
|
-
await session.press("Enter")
|
|
84
|
+
await session.click("@e7", { context: await sync() }) // ... and click its @eN ref
|
|
85
|
+
await session.fill(css.e5, "hello", { context: await sync() })
|
|
86
|
+
await session.press("Enter", { context: await sync() })
|
|
84
87
|
await session.waitForNavigation({ waitUntil: "load" })
|
|
85
88
|
const shot = await session.screenshot() // { buffer, width, height, captureId }
|
|
86
89
|
} finally {
|
|
@@ -95,6 +98,20 @@ try {
|
|
|
95
98
|
4. **Borrow a user tab explicitly** (`tabList({ scope: "user" })`, `tabBorrow(id)`, `tabReturn(id)`).
|
|
96
99
|
Borrowing prompts the user; never invent tab ids and never repeat a denied borrow.
|
|
97
100
|
5. **Always `stop()` the session,** on success and on failure.
|
|
101
|
+
6. **Sync before every page action.** The person at the keyboard can work in the same tab, so
|
|
102
|
+
BrowserSkill 0.4 refuses an action (`permission_denied`, `data.reason: "cooperation_sync_required"`)
|
|
103
|
+
unless it carries `{ context }` from the latest `session.cooperate("sync")`. A context is good
|
|
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`.
|
|
98
115
|
|
|
99
116
|
Every method, its options, and the failure codes are in [references/commands.md](references/commands.md).
|
|
100
117
|
|
|
@@ -17,6 +17,38 @@ 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.4+)
|
|
21
|
+
|
|
22
|
+
The person at the keyboard can work in the task tab while you do, so the extension refuses every
|
|
23
|
+
gated page action with `permission_denied` / `data.reason: "cooperation_sync_required"` unless it
|
|
24
|
+
carries the `context_id` of the latest `session.cooperate("sync")`. The daemon never fills it in
|
|
25
|
+
for you.
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const sync = async () => (await session.cooperate("sync")).context_id
|
|
29
|
+
await session.click("@e3", { context: await sync() }) // one context, one action
|
|
30
|
+
await session.fill("#q", "hello", { clearBefore: true, context: await sync() })
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Call | Use |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `session.cooperate("sync", { tabId, maxTokens })` | returns `{ context_id, ... }`; pass it as `{ context }` to the next gated action, then sync again |
|
|
36
|
+
| `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
|
+
|
|
38
|
+
- **Gated** (need `{ context }`): `navigate` (except the first navigation of the untouched blank tab),
|
|
39
|
+
`back`, `forward`, `reload`, `click`, `hover`, `focus`, `blur`, `fill`, `press`, `select`,
|
|
40
|
+
`scrollTo`, `wheel`, `evaluate` (and so `bskSnapshot`), `tabClose`, `resize`, `emulate`,
|
|
41
|
+
`observe({ probeHover: true })`, `screenshot({ fullPage: true })`.
|
|
42
|
+
- **Not gated:** `observe`, `snapshot`, `getHtml`, `screenshot()`, `console`, `network`,
|
|
43
|
+
`waitForNavigation`, the tab list/borrow/return calls, `requestHelp`.
|
|
44
|
+
- `dependsOn: ["@e2", ...]` narrows the check to the observed regions your decision used.
|
|
45
|
+
- A gated action accepts only its own options plus `{ context, dependsOn }`; any other key
|
|
46
|
+
(`contextId`, a stray option copied from another method) throws a `TypeError` before anything is
|
|
47
|
+
sent. Two exceptions: `bskSnapshot` and `screenshot({ fullPage: true })` pass unknown keys
|
|
48
|
+
through instead of throwing, so a misspelt `contextId` there sends no context and the daemon
|
|
49
|
+
refuses the call with `cooperation_sync_required`.
|
|
50
|
+
- Never replay a refused action blindly: the page may have changed under the person's hands.
|
|
51
|
+
|
|
20
52
|
## Targets
|
|
21
53
|
|
|
22
54
|
| Form | Meaning |
|
|
@@ -30,12 +62,12 @@ stop, not a cue to launch something else.
|
|
|
30
62
|
|
|
31
63
|
| Call | Returns |
|
|
32
64
|
|---|---|
|
|
33
|
-
| `bskSnapshot(session, { interactive, maxDepth })` | `{ tree, refs, css }` — the OmOWright accessibility tree with refs, computed in the page **without** leaving a global or touching the DOM |
|
|
65
|
+
| `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 |
|
|
34
66
|
| `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** |
|
|
35
67
|
| `session.snapshot({ maxDepth, maxTokens })` | the daemon's plain accessibility tree |
|
|
36
68
|
| `session.getHtml({ ref, maxBytes })` | exact markup |
|
|
37
69
|
| `session.screenshot({ ref })` / `screenshot({ fullPage: true })` | `{ buffer, width, height, captureId }`; full-page captures stream back in chunks |
|
|
38
|
-
| `session.evaluate(expression, { awaitPromise, timeoutMs })` | `{ ok, value, error }` — **check `.ok`**; a resolved promise does not mean the script succeeded |
|
|
70
|
+
| `session.evaluate(expression, { awaitPromise, timeoutMs, context })` | `{ ok, value, error }` — **check `.ok`**; a resolved promise does not mean the script succeeded |
|
|
39
71
|
| `session.console({ since })` / `session.network({ since })` | buffered console entries / request metadata (no bodies) |
|
|
40
72
|
|
|
41
73
|
**Refs are reissued by every read.** Read a ref and act on it in the same cycle. A ref captured
|
|
@@ -44,6 +76,10 @@ neighbouring row.
|
|
|
44
76
|
|
|
45
77
|
## Acting
|
|
46
78
|
|
|
79
|
+
Every call here is gated: add `context` (from `cooperate("sync")`) to its options object, as in
|
|
80
|
+
`session.click(target, { context })`, `session.resize(width, height, { context })`,
|
|
81
|
+
`session.tabClose(id, { context })`.
|
|
82
|
+
|
|
47
83
|
| Need | Call |
|
|
48
84
|
|---|---|
|
|
49
85
|
| Click | `session.click(target, { button, clickCount, modifiers })` |
|
|
@@ -75,7 +111,7 @@ Traps:
|
|
|
75
111
|
const { tabs } = await session.tabList({ scope: "user" }) // "user" | "agent" | "all"
|
|
76
112
|
await session.tabBorrow(tabId) // the user confirms in the browser (60 s)
|
|
77
113
|
await session.tabReturn(tabId) // stop() returns anything still borrowed
|
|
78
|
-
await session.tabCreate({ url }); await session.tabSelect(id); await session.tabClose(id)
|
|
114
|
+
await session.tabCreate({ url }); await session.tabSelect(id); await session.tabClose(id, { context: await sync() })
|
|
79
115
|
```
|
|
80
116
|
|
|
81
117
|
Never invent tab ids and never repeat a denied borrow.
|
|
@@ -96,7 +132,8 @@ Every refusal is a `BskRpcError` with the daemon's own `code`:
|
|
|
96
132
|
| `no_browser_connected` | no extension attached | run the onboarding script, relay the human step, wait |
|
|
97
133
|
| `not_found` | stale ref or unknown session | read again; if the session is gone, start a new one |
|
|
98
134
|
| `invalid_params` | wrong option shape | fix the call, do not retry as-is |
|
|
99
|
-
| `permission_denied`
|
|
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 |
|
|
136
|
+
| `permission_denied` (any other reason) | `evaluate` on a tab outside the Agent Window, or a denied borrow | stop; the user said no |
|
|
100
137
|
| `timeout` | the tool did not finish in its budget | read the page state before retrying once |
|
|
101
138
|
| `user_aborted` | the user pressed Stop in the browser | stop the task and report |
|
|
102
139
|
| `cdp_failed` | the page cannot be attached (restricted URL, DevTools open) | say which page and why |
|
|
@@ -19,10 +19,21 @@ miss has another cause and you climb the ladder instead.
|
|
|
19
19
|
|
|
20
20
|
## Dialogs never block
|
|
21
21
|
|
|
22
|
-
`alert`, `confirm`, `prompt`, and `beforeunload` are answered
|
|
23
|
-
|
|
24
|
-
Default to accepting (`{ accept: true }`; a
|
|
25
|
-
`{
|
|
22
|
+
`alert`, `confirm`, `prompt`, and `beforeunload` are answered at the protocol layer, before the
|
|
23
|
+
page sees them: by a `dialog` listener that answers, otherwise by the `dialogPolicy` passed to
|
|
24
|
+
`connectPipe` (or `browser.setDialogPolicy`). Default to accepting (`{ accept: true }`; a policy
|
|
25
|
+
function receives a plain `{ type, message, defaultPrompt, url }` and returns `{ accept, promptText }`).
|
|
26
|
+
|
|
27
|
+
`page.on("dialog", (dialog) => ...)` hands each listener a Playwright-style `Dialog` object, not a
|
|
28
|
+
plain object: read it through methods (`dialog.type()`, `dialog.message()`, `dialog.defaultValue()`,
|
|
29
|
+
and the `dialog.url` getter). A listener can answer it itself, which replaces the policy for that
|
|
30
|
+
dialog; a listener that only observes leaves it to the policy:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
page.on("dialog", (dialog) => dialog.type() === "prompt" ? dialog.accept("42") : dialog.dismiss())
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
A dialog is answered once; a second `accept()` / `dismiss()` throws. A run that hangs on
|
|
26
37
|
an unhandled dialog looks exactly like a hang with no cause, which is the most expensive kind to
|
|
27
38
|
diagnose.
|
|
28
39
|
|
|
@@ -28,13 +28,15 @@ await session.tabReturn(vault.tab_id)
|
|
|
28
28
|
|
|
29
29
|
The app mutates its URL hash without updating the document title, so a signed-in vault can still
|
|
30
30
|
report a sign-in title. A live session's `location.href` contains the app path and never the
|
|
31
|
-
sign-in path. Read the URL from `tabList`, or `session.evaluate("location.href")
|
|
31
|
+
sign-in path. Read the URL from `tabList`, or `session.evaluate("location.href", { context })` with a
|
|
32
|
+
fresh `context` from `session.cooperate("sync")` (see the shared-control section of
|
|
33
|
+
[../commands.md](../commands.md)).
|
|
32
34
|
|
|
33
35
|
## The browser may be shared
|
|
34
36
|
|
|
35
37
|
Other automation may be driving the same window.
|
|
36
38
|
|
|
37
|
-
- **Clear the search box before typing** (`fill(target, value, { clearBefore: true })`). It often
|
|
39
|
+
- **Clear the search box before typing** (`fill(target, value, { clearBefore: true, context })`). It often
|
|
38
40
|
holds someone else's query, and typing alone appends to it, returning confident results for the
|
|
39
41
|
wrong search.
|
|
40
42
|
- **Read the autocomplete listbox, not the results grid.** The grid holds whatever query was last
|