omowright 0.3.4 → 0.3.6
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/index.js
CHANGED
|
@@ -24458,26 +24458,59 @@ async function emulateMedia(options = {}) {
|
|
|
24458
24458
|
}
|
|
24459
24459
|
|
|
24460
24460
|
// src/redact-value.ts
|
|
24461
|
+
var REMOVED_ANYWHERE_FROM_LENGTH = 4;
|
|
24461
24462
|
function redactValue(error, value) {
|
|
24462
24463
|
if (value.length === 0)
|
|
24463
24464
|
return error;
|
|
24464
24465
|
const replacement = `<redacted, ${value.length} chars>`;
|
|
24465
24466
|
const forms = [...new Set([value, JSON.stringify(value).slice(1, -1)])].toSorted((left, right) => right.length - left.length).map((form) => form.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
24466
|
-
const
|
|
24467
|
+
const anyForm = `(?:${forms.join("|")})`;
|
|
24468
|
+
const pattern = new RegExp(value.length >= REMOVED_ANYWHERE_FROM_LENGTH ? anyForm : `(?<![\\p{L}\\p{N}])${anyForm}(?![\\p{L}\\p{N}])`, "gu");
|
|
24467
24469
|
const scrub = (text) => text.replace(pattern, replacement);
|
|
24468
|
-
|
|
24469
|
-
|
|
24470
|
+
const scrubPayload = (payload) => {
|
|
24471
|
+
if (typeof payload === "string")
|
|
24472
|
+
return scrub(payload);
|
|
24473
|
+
if (payload === undefined || payload === null)
|
|
24474
|
+
return payload;
|
|
24475
|
+
try {
|
|
24476
|
+
const text = JSON.stringify(payload);
|
|
24477
|
+
return typeof text === "string" ? JSON.parse(scrub(text)) : payload;
|
|
24478
|
+
} catch {
|
|
24479
|
+
return `<redacted, unreadable ${typeof payload}>`;
|
|
24480
|
+
}
|
|
24481
|
+
};
|
|
24470
24482
|
const seen = new Set;
|
|
24471
|
-
|
|
24483
|
+
function scrubMember(member) {
|
|
24484
|
+
if (member instanceof Error) {
|
|
24485
|
+
scrubError(member);
|
|
24486
|
+
return member;
|
|
24487
|
+
}
|
|
24488
|
+
if (Array.isArray(member)) {
|
|
24489
|
+
const items = member;
|
|
24490
|
+
if (items.some((item) => item instanceof Error))
|
|
24491
|
+
return items.map((item) => scrubMember(item));
|
|
24492
|
+
}
|
|
24493
|
+
return scrubPayload(member);
|
|
24494
|
+
}
|
|
24495
|
+
function scrubError(link) {
|
|
24496
|
+
if (seen.has(link))
|
|
24497
|
+
return;
|
|
24472
24498
|
seen.add(link);
|
|
24473
24499
|
link.message = scrub(link.message);
|
|
24474
24500
|
if (link.stack !== undefined)
|
|
24475
24501
|
link.stack = scrub(link.stack);
|
|
24476
|
-
const
|
|
24477
|
-
|
|
24478
|
-
|
|
24502
|
+
for (const key of Reflect.ownKeys(link)) {
|
|
24503
|
+
if (key === "message" || key === "stack")
|
|
24504
|
+
continue;
|
|
24505
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(link, key);
|
|
24506
|
+
if (descriptor === undefined || !("value" in descriptor))
|
|
24507
|
+
continue;
|
|
24508
|
+
const scrubbed = scrubMember(descriptor.value);
|
|
24509
|
+
if (!Reflect.set(link, key, scrubbed))
|
|
24510
|
+
Reflect.defineProperty(link, key, { ...descriptor, value: scrubbed });
|
|
24511
|
+
}
|
|
24479
24512
|
}
|
|
24480
|
-
return error;
|
|
24513
|
+
return scrubMember(error);
|
|
24481
24514
|
}
|
|
24482
24515
|
|
|
24483
24516
|
// src/core.ts
|
|
@@ -35703,7 +35736,7 @@ async function snapshotWithFrames(page, opts = {}) {
|
|
|
35703
35736
|
// package.json
|
|
35704
35737
|
var package_default = {
|
|
35705
35738
|
name: "omowright",
|
|
35706
|
-
version: "0.3.
|
|
35739
|
+
version: "0.3.6",
|
|
35707
35740
|
description: "OmOWright browser automation for standard Chromium CDP endpoints.",
|
|
35708
35741
|
keywords: [
|
|
35709
35742
|
"accessibility-snapshot",
|
package/dist/redact-value.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Strips a value being entered (fill/type) out of the error its failure raised, so a secret typed
|
|
3
3
|
* into a form never reaches an agent transcript (#335). The layers below (a CDP transport, the
|
|
4
|
-
* BrowserSkill daemon) may quote the command they refused, raw or JSON-escaped, in
|
|
5
|
-
* the
|
|
4
|
+
* BrowserSkill daemon) may quote the command they refused, raw or JSON-escaped, anywhere in what they
|
|
5
|
+
* throw: the message, the stack, a cause of any type, an `AggregateError`'s members, or a field of
|
|
6
|
+
* their own (`data`, `request`). Every own property of every error reachable from the one raised is
|
|
7
|
+
* rewritten in place, so no list of known error shapes has to keep up with them (#362).
|
|
8
|
+
* A value of four characters or more is removed even where it touches a letter or a digit
|
|
9
|
+
* (`field7<value>`); a shorter one is removed only as a whole token, because taking one or two
|
|
10
|
+
* letters out of every word would leave the message unreadable (fill("a") must keep "locator").
|
|
6
11
|
*/
|
|
7
12
|
export declare function redactValue(error: unknown, value: string): unknown;
|
package/package.json
CHANGED
|
@@ -49,8 +49,14 @@ The sync result carries `context_id` and, when the daemon sends one,
|
|
|
49
49
|
good for one action. `expect` is a list of literal facts the extension checks
|
|
50
50
|
right before the input, for example
|
|
51
51
|
`[{ target: "#total", field: "text", equals: "3" }]` (`field` is `text`,
|
|
52
|
-
`value`, `checked`, `attribute` or `exists`)
|
|
53
|
-
with `
|
|
52
|
+
`value`, `checked`, `attribute` or `exists`). A false fact refuses the action
|
|
53
|
+
with `permission_denied`, a message starting `Precondition failed:` that names
|
|
54
|
+
the fact (for example `Precondition failed: #total text`), and
|
|
55
|
+
`effect_state: "none"`: nothing is sent to the page. `data.reason` depends on
|
|
56
|
+
the policy: `"precondition_failed"` under `target`, and
|
|
57
|
+
`"cooperation_sync_required"` under `strict`, the same reason a stale context
|
|
58
|
+
gets. Under strict, tell the two apart by the message, then sync and decide
|
|
59
|
+
again from the live page.
|
|
54
60
|
|
|
55
61
|
```js
|
|
56
62
|
const { connectBrowserSkill } = await import("omowright");
|
|
@@ -89,23 +89,34 @@ doing: the header becomes the first line of `tree`, and the raw result sits in
|
|
|
89
89
|
## Human handoff: login, OTP, CAPTCHA you can't solve
|
|
90
90
|
|
|
91
91
|
When every rung fails on a login wall, a one-time code, or a challenge the
|
|
92
|
-
captcha preset can't clear, hand the tab to the person
|
|
92
|
+
captcha preset can't clear, hand the tab to the person. **DO NOT `await` THE
|
|
93
|
+
HANDOFF IN AN EVAL CELL**: a person takes longer than a cell, and an awaited
|
|
94
|
+
handoff holds the kernel until they finish. Subscribe the harness watcher to a
|
|
95
|
+
flag file first, start the handoff without `await`, and end the cell:
|
|
93
96
|
|
|
94
97
|
```js
|
|
95
|
-
const
|
|
98
|
+
const { requestHuman } = await import("omowright");
|
|
99
|
+
const fs = await import("node:fs");
|
|
100
|
+
const os = await import("node:os");
|
|
101
|
+
const path = await import("node:path");
|
|
102
|
+
const flag = path.join(os.tmpdir(), `omowright-handoff-${Date.now()}.flag`);
|
|
103
|
+
await tool.monitor({ description: "handoff finished", path: flag, event: "create" }); // omo's watcher; subscribe first
|
|
104
|
+
globalThis.omwHandoff = requestHuman(page, {
|
|
96
105
|
prompt: "Sign in with your account, then click Done.",
|
|
97
106
|
until: { url: /\/dashboard/ }, // or { selector: "nav.account" } or async page => boolean
|
|
98
107
|
timeoutMs: 300000,
|
|
99
|
-
})
|
|
100
|
-
// { outcome: "continued" | "timed_out" | "cancelled", elapsedMs, reason: "until" | "done-button" | "timed_out" | "signal" }
|
|
101
|
-
|
|
108
|
+
}).then(
|
|
109
|
+
// { outcome: "continued" | "timed_out" | "cancelled", elapsedMs, reason: "until" | "done-button" | "timed_out" | "signal" }
|
|
110
|
+
(result) => fs.writeFileSync(flag, result.outcome),
|
|
111
|
+
(error) => fs.writeFileSync(flag, `failed: ${error.message}`),
|
|
112
|
+
);
|
|
102
113
|
```
|
|
103
114
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
The event wakes the turn on every outcome. Read the flag: anything but
|
|
116
|
+
`continued` is a handoff that did not happen. The page stays usable from other
|
|
117
|
+
cells meanwhile; more in `eval-kernel.md` (next to this file), "Waits that
|
|
118
|
+
outlast a cell". A plain script with no cell limit may `await requestHuman(...)`
|
|
119
|
+
and read `result.outcome` directly.
|
|
109
120
|
|
|
110
121
|
The call brings the window to the front, injects a shadow-DOM banner with your
|
|
111
122
|
prompt and a Done button, then polls every `pollMs` for `until` or the button.
|