omowright 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -24458,15 +24458,29 @@ 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
|
+
};
|
|
24482
|
+
if (!(error instanceof Error))
|
|
24483
|
+
return scrubPayload(error);
|
|
24470
24484
|
const seen = new Set;
|
|
24471
24485
|
for (let link = error;link instanceof Error && !seen.has(link); link = link.cause) {
|
|
24472
24486
|
seen.add(link);
|
|
@@ -24475,7 +24489,9 @@ function redactValue(error, value) {
|
|
|
24475
24489
|
link.stack = scrub(link.stack);
|
|
24476
24490
|
const data = Reflect.get(link, "data");
|
|
24477
24491
|
if (data !== undefined)
|
|
24478
|
-
Reflect.set(link, "data",
|
|
24492
|
+
Reflect.set(link, "data", scrubPayload(data));
|
|
24493
|
+
if (link.cause !== undefined && !(link.cause instanceof Error))
|
|
24494
|
+
link.cause = scrubPayload(link.cause);
|
|
24479
24495
|
}
|
|
24480
24496
|
return error;
|
|
24481
24497
|
}
|
|
@@ -35703,7 +35719,7 @@ async function snapshotWithFrames(page, opts = {}) {
|
|
|
35703
35719
|
// package.json
|
|
35704
35720
|
var package_default = {
|
|
35705
35721
|
name: "omowright",
|
|
35706
|
-
version: "0.3.
|
|
35722
|
+
version: "0.3.5",
|
|
35707
35723
|
description: "OmOWright browser automation for standard Chromium CDP endpoints.",
|
|
35708
35724
|
keywords: [
|
|
35709
35725
|
"accessibility-snapshot",
|
package/dist/redact-value.d.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
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
4
|
* BrowserSkill daemon) may quote the command they refused, raw or JSON-escaped, in the message,
|
|
5
|
-
* the stack, a `data` payload or a cause; each is rewritten in place down the cause chain.
|
|
5
|
+
* the stack, a `data` payload or a cause of any type; each is rewritten in place down the cause chain.
|
|
6
|
+
* A value of four characters or more is removed even where it touches a letter or a digit
|
|
7
|
+
* (`field7<value>`); a shorter one is removed only as a whole token, because taking one or two
|
|
8
|
+
* letters out of every word would leave the message unreadable (fill("a") must keep "locator").
|
|
6
9
|
*/
|
|
7
10
|
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,30 @@ 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 flag = path.join(os.tmpdir(), `omowright-handoff-${Date.now()}.flag`);
|
|
99
|
+
await tool.monitor({ description: "handoff finished", path: flag, event: "create" }); // omo's watcher; subscribe first
|
|
100
|
+
globalThis.omwHandoff = requestHuman(page, {
|
|
96
101
|
prompt: "Sign in with your account, then click Done.",
|
|
97
102
|
until: { url: /\/dashboard/ }, // or { selector: "nav.account" } or async page => boolean
|
|
98
103
|
timeoutMs: 300000,
|
|
99
|
-
})
|
|
100
|
-
// { outcome: "continued" | "timed_out" | "cancelled", elapsedMs, reason: "until" | "done-button" | "timed_out" | "signal" }
|
|
101
|
-
|
|
104
|
+
}).then(
|
|
105
|
+
// { outcome: "continued" | "timed_out" | "cancelled", elapsedMs, reason: "until" | "done-button" | "timed_out" | "signal" }
|
|
106
|
+
(result) => fs.writeFileSync(flag, result.outcome),
|
|
107
|
+
(error) => fs.writeFileSync(flag, `failed: ${error.message}`),
|
|
108
|
+
);
|
|
102
109
|
```
|
|
103
110
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
The event wakes the turn on every outcome. Read the flag: anything but
|
|
112
|
+
`continued` is a handoff that did not happen. The page stays usable from other
|
|
113
|
+
cells meanwhile; more in `eval-kernel.md` (next to this file), "Waits that
|
|
114
|
+
outlast a cell". A plain script with no cell limit may `await requestHuman(...)`
|
|
115
|
+
and read `result.outcome` directly.
|
|
109
116
|
|
|
110
117
|
The call brings the window to the front, injects a shadow-DOM banner with your
|
|
111
118
|
prompt and a Done button, then polls every `pollMs` for `until` or the button.
|