@developerz.ai/ui-debugger-mcp 1.10.0 → 1.11.0
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/README.md +9 -5
- package/dist/adapters/android/abortable.d.ts +6 -0
- package/dist/adapters/android/abortable.js +22 -0
- package/dist/adapters/android/abortable.js.map +1 -0
- package/dist/adapters/android/android-adapter.d.ts +7 -39
- package/dist/adapters/android/android-adapter.js +54 -436
- package/dist/adapters/android/android-adapter.js.map +1 -1
- package/dist/adapters/android/commands.d.ts +10 -0
- package/dist/adapters/android/commands.js +22 -0
- package/dist/adapters/android/commands.js.map +1 -1
- package/dist/adapters/android/emulator.d.ts +41 -0
- package/dist/adapters/android/emulator.js +115 -0
- package/dist/adapters/android/emulator.js.map +1 -0
- package/dist/adapters/android/logcat.d.ts +87 -0
- package/dist/adapters/android/logcat.js +352 -0
- package/dist/adapters/android/logcat.js.map +1 -0
- package/dist/adapters/browser/browser-adapter.js +30 -42
- package/dist/adapters/browser/browser-adapter.js.map +1 -1
- package/dist/adapters/browser/cdp.d.ts +7 -10
- package/dist/adapters/browser/cdp.js +93 -69
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/exchange-read.d.ts +39 -0
- package/dist/adapters/browser/exchange-read.js +102 -0
- package/dist/adapters/browser/exchange-read.js.map +1 -0
- package/dist/adapters/browser/extractor.js +9 -2
- package/dist/adapters/browser/extractor.js.map +1 -1
- package/dist/adapters/browser/lifecycle.d.ts +33 -0
- package/dist/adapters/browser/lifecycle.js +47 -4
- package/dist/adapters/browser/lifecycle.js.map +1 -1
- package/dist/adapters/browser/locate.d.ts +18 -2
- package/dist/adapters/browser/locate.js +48 -3
- package/dist/adapters/browser/locate.js.map +1 -1
- package/dist/adapters/browser/log-filters.d.ts +1 -1
- package/dist/adapters/browser/log-filters.js +15 -4
- package/dist/adapters/browser/log-filters.js.map +1 -1
- package/dist/adapters/browser/log-format.d.ts +12 -0
- package/dist/adapters/browser/log-format.js +123 -7
- package/dist/adapters/browser/log-format.js.map +1 -1
- package/dist/adapters/contract.d.ts +22 -5
- package/dist/adapters/desktop/atspi-busctl.js +3 -1
- package/dist/adapters/desktop/atspi-busctl.js.map +1 -1
- package/dist/adapters/desktop/atspi.d.ts +6 -0
- package/dist/adapters/desktop/atspi.js.map +1 -1
- package/dist/adapters/desktop/desktop-adapter.d.ts +2 -0
- package/dist/adapters/desktop/desktop-adapter.js +132 -98
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
- package/dist/adapters/desktop/input.d.ts +1 -1
- package/dist/adapters/desktop/input.js +14 -3
- package/dist/adapters/desktop/input.js.map +1 -1
- package/dist/adapters/desktop/managed-app.d.ts +43 -0
- package/dist/adapters/desktop/managed-app.js +114 -0
- package/dist/adapters/desktop/managed-app.js.map +1 -0
- package/dist/adapters/desktop/proc.d.ts +2 -0
- package/dist/adapters/desktop/proc.js +4 -0
- package/dist/adapters/desktop/proc.js.map +1 -1
- package/dist/adapters/desktop/wait-poll.d.ts +17 -0
- package/dist/adapters/desktop/wait-poll.js +38 -0
- package/dist/adapters/desktop/wait-poll.js.map +1 -0
- package/dist/adapters/factory.d.ts +1 -1
- package/dist/adapters/factory.js +1 -1
- package/dist/adapters/log-format.d.ts +6 -0
- package/dist/adapters/log-format.js +10 -2
- package/dist/adapters/log-format.js.map +1 -1
- package/dist/agent/belt/act.d.ts +6 -3
- package/dist/agent/belt/act.js +40 -60
- package/dist/agent/belt/act.js.map +1 -1
- package/dist/agent/belt/look.d.ts +9 -3
- package/dist/agent/belt/look.js +21 -5
- package/dist/agent/belt/look.js.map +1 -1
- package/dist/agent/belt/observe.d.ts +9 -43
- package/dist/agent/belt/observe.js +66 -242
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/belt/redact-output.d.ts +20 -0
- package/dist/agent/belt/redact-output.js +70 -0
- package/dist/agent/belt/redact-output.js.map +1 -0
- package/dist/agent/belt/same-origin.d.ts +21 -0
- package/dist/agent/belt/same-origin.js +38 -0
- package/dist/agent/belt/same-origin.js.map +1 -0
- package/dist/agent/belt/target-refs.d.ts +39 -0
- package/dist/agent/belt/target-refs.js +60 -0
- package/dist/agent/belt/target-refs.js.map +1 -0
- package/dist/agent/belt/tree-targets.d.ts +79 -0
- package/dist/agent/belt/tree-targets.js +242 -0
- package/dist/agent/belt/tree-targets.js.map +1 -0
- package/dist/agent/loop-frames.d.ts +26 -0
- package/dist/agent/loop-frames.js +106 -0
- package/dist/agent/loop-frames.js.map +1 -0
- package/dist/agent/loop.d.ts +13 -24
- package/dist/agent/loop.js +40 -104
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/prompts/debug-agent.js +3 -2
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +2 -2
- package/dist/agent/prompts/web-addendum.js +21 -32
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/agent/provider.d.ts +3 -1
- package/dist/agent/provider.js +4 -2
- package/dist/agent/provider.js.map +1 -1
- package/dist/boot.js +3 -1
- package/dist/boot.js.map +1 -1
- package/dist/cli/chromium-libs.d.ts +6 -1
- package/dist/cli/chromium-libs.js +27 -3
- package/dist/cli/chromium-libs.js.map +1 -1
- package/dist/cli/control.js +30 -5
- package/dist/cli/control.js.map +1 -1
- package/dist/config/load.js +10 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.js +12 -10
- package/dist/config/schema.js.map +1 -1
- package/dist/errors.d.ts +17 -16
- package/dist/errors.js +33 -32
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +10 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/end-session.js +2 -1
- package/dist/mcp/tools/end-session.js.map +1 -1
- package/dist/mcp/tools/output.d.ts +7 -0
- package/dist/mcp/tools/output.js +5 -0
- package/dist/mcp/tools/output.js.map +1 -1
- package/dist/mcp/tools/result.js +4 -1
- package/dist/mcp/tools/result.js.map +1 -1
- package/dist/redact.d.ts +20 -4
- package/dist/redact.js +134 -19
- package/dist/redact.js.map +1 -1
- package/dist/services/auth-persona.d.ts +19 -0
- package/dist/services/auth-persona.js +32 -0
- package/dist/services/auth-persona.js.map +1 -0
- package/dist/services/debug-api.d.ts +7 -0
- package/dist/services/debug-service.d.ts +1 -1
- package/dist/services/debug-service.js +64 -65
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/foreign-findings.d.ts +22 -0
- package/dist/services/foreign-findings.js +38 -0
- package/dist/services/foreign-findings.js.map +1 -0
- package/dist/services/login-failure.d.ts +10 -0
- package/dist/services/login-failure.js +24 -0
- package/dist/services/login-failure.js.map +1 -0
- package/dist/services/login-selectors.d.ts +18 -0
- package/dist/services/login-selectors.js +44 -0
- package/dist/services/login-selectors.js.map +1 -0
- package/dist/services/login-session.d.ts +25 -0
- package/dist/services/login-session.js +59 -0
- package/dist/services/login-session.js.map +1 -0
- package/dist/services/login.d.ts +9 -27
- package/dist/services/login.js +78 -80
- package/dist/services/login.js.map +1 -1
- package/dist/services/replay.js +15 -3
- package/dist/services/replay.js.map +1 -1
- package/dist/services/session-builder.js +19 -4
- package/dist/services/session-builder.js.map +1 -1
- package/dist/services/shutdown.d.ts +8 -4
- package/dist/services/shutdown.js +21 -8
- package/dist/services/shutdown.js.map +1 -1
- package/dist/services/start-guards.d.ts +6 -1
- package/dist/services/start-guards.js +13 -2
- package/dist/services/start-guards.js.map +1 -1
- package/dist/session/cleanup.d.ts +3 -2
- package/dist/session/cleanup.js +6 -2
- package/dist/session/cleanup.js.map +1 -1
- package/dist/session/finalize.d.ts +45 -0
- package/dist/session/finalize.js +150 -0
- package/dist/session/finalize.js.map +1 -0
- package/dist/session/flock-backend.d.ts +117 -0
- package/dist/session/flock-backend.js +293 -0
- package/dist/session/flock-backend.js.map +1 -0
- package/dist/session/owner-lock.d.ts +4 -95
- package/dist/session/owner-lock.js +7 -288
- package/dist/session/owner-lock.js.map +1 -1
- package/dist/session/session.js +11 -134
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.js +9 -1
- package/dist/session/state-file.js.map +1 -1
- package/dist/session/workspace.d.ts +32 -2
- package/dist/session/workspace.js +65 -4
- package/dist/session/workspace.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The managed desktop app's process lifecycle — spawn, death latch, teardown.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `desktop-adapter.ts` (one responsibility per file): the adapter
|
|
5
|
+
* drives the window, this owns the `launch` command's process group.
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from 'node:child_process';
|
|
8
|
+
import { AdapterError } from '../../errors.js';
|
|
9
|
+
import { groupAlive, terminateGroup } from './proc.js';
|
|
10
|
+
/**
|
|
11
|
+
* Appended to the early-exit diagnosis when the launch command itself exits (code
|
|
12
|
+
* or signal) before any window appears. A possibility, never a proof: the exit
|
|
13
|
+
* code alone cannot show the command daemonized, so the hint names the likely
|
|
14
|
+
* shape and the fix, not a cause.
|
|
15
|
+
*/
|
|
16
|
+
const EARLY_EXIT_HINT = '. The command may have backgrounded or daemonized itself (e.g. a trailing &, nohup, or a wrapper that forks) — that exits before any window can appear. Use a foreground launch command that stays alive holding the window';
|
|
17
|
+
/** Owns the launched app's detached process group. */
|
|
18
|
+
export class ManagedApp {
|
|
19
|
+
#command;
|
|
20
|
+
#env;
|
|
21
|
+
#child = null;
|
|
22
|
+
/**
|
|
23
|
+
* Process group of a launch leader that already exited. The leader dying does not
|
|
24
|
+
* mean the group is empty: a wrapper that backgrounds the app (`app &`) exits while
|
|
25
|
+
* the app lives on in the group — and with `#child` cleared nothing else would ever
|
|
26
|
+
* signal it, leaving the app (and its X/profile locks) orphaned past `stop`.
|
|
27
|
+
*/
|
|
28
|
+
#lingering = null;
|
|
29
|
+
constructor(command, env) {
|
|
30
|
+
this.#command = command;
|
|
31
|
+
this.#env = env;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Spawn the managed app (a live child is reused) and latch its death.
|
|
35
|
+
*
|
|
36
|
+
* `stdio: 'ignore'` keeps the app detached from our stdio MCP channel, so the exit
|
|
37
|
+
* code is the only signal we get — hence the latch: {@link Launched.died} carries it
|
|
38
|
+
* to whoever is waiting in `open`.
|
|
39
|
+
*/
|
|
40
|
+
launch() {
|
|
41
|
+
const running = this.#child;
|
|
42
|
+
if (running)
|
|
43
|
+
return running;
|
|
44
|
+
const command = this.#command;
|
|
45
|
+
const proc = spawn('/bin/sh', ['-c', command], {
|
|
46
|
+
env: this.#env,
|
|
47
|
+
detached: true,
|
|
48
|
+
stdio: 'ignore',
|
|
49
|
+
});
|
|
50
|
+
const died = new Promise((_resolve, reject) => {
|
|
51
|
+
const down = (reason, hint = '') => {
|
|
52
|
+
// A dead app must not pin `#child`: clear it so a later `open` relaunches
|
|
53
|
+
// and `stop` never kills a recycled process group.
|
|
54
|
+
if (this.#child?.proc === proc) {
|
|
55
|
+
this.#child = null;
|
|
56
|
+
// Remember the group only while it still has members: a pgid cannot be
|
|
57
|
+
// reused while one lives, but an EMPTY group's number can name an unrelated
|
|
58
|
+
// group by the time `stop` signals it.
|
|
59
|
+
this.#lingering = proc.pid !== undefined && groupAlive(proc.pid) ? proc.pid : null;
|
|
60
|
+
}
|
|
61
|
+
reject(new AdapterError(`desktop: launch command exited (${reason}) before the window appeared: ${command}${hint}`));
|
|
62
|
+
};
|
|
63
|
+
// The daemonization hint rides the exit event only — on 'error' (spawn
|
|
64
|
+
// failed) the command never ran, so the hint would mislead there.
|
|
65
|
+
proc.once('exit', (code, signal) => down(signal ? `killed by ${signal}` : `exit code ${code ?? 'unknown'}`, EARLY_EXIT_HINT));
|
|
66
|
+
// 'error' fires async: unlistened, a missing `/bin/sh` would crash the server.
|
|
67
|
+
proc.once('error', (error) => down(`spawn failed: ${error.message}`));
|
|
68
|
+
});
|
|
69
|
+
// The app normally outlives `open`, so its eventual exit rejects with nobody racing
|
|
70
|
+
// it — pre-handle so a clean quit is never an unhandled rejection.
|
|
71
|
+
died.catch(() => { });
|
|
72
|
+
const launched = { proc, died };
|
|
73
|
+
this.#child = launched;
|
|
74
|
+
return launched;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Managed teardown: SIGTERM the launched process group, then SIGKILL it if it is still
|
|
78
|
+
* alive after the grace period; an already-dead process is a no-op.
|
|
79
|
+
*
|
|
80
|
+
* The handle is dropped only once the group is confirmed gone — an app that traps
|
|
81
|
+
* SIGTERM (prompting "save changes?") would otherwise survive, with nothing left to
|
|
82
|
+
* kill it and its X/profile locks held until the user does it by hand.
|
|
83
|
+
*/
|
|
84
|
+
async stop() {
|
|
85
|
+
const pid = this.#child?.proc.pid;
|
|
86
|
+
if (pid !== undefined) {
|
|
87
|
+
await terminateGroup(pid);
|
|
88
|
+
this.#child = null;
|
|
89
|
+
}
|
|
90
|
+
await this.reapLingering();
|
|
91
|
+
}
|
|
92
|
+
/** Stop whatever an exited launch leader left behind in its group (no-op when empty). */
|
|
93
|
+
async reapLingering() {
|
|
94
|
+
const pid = this.#lingering;
|
|
95
|
+
if (pid === null)
|
|
96
|
+
return;
|
|
97
|
+
await terminateGroup(pid);
|
|
98
|
+
this.#lingering = null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A window xdotool cannot find, on a Wayland session, is usually a native-Wayland
|
|
103
|
+
* window: xdotool only sees (and can only drive) XWayland clients, and no input path
|
|
104
|
+
* exists for the rest. Name that instead of leaving a bare timeout.
|
|
105
|
+
*/
|
|
106
|
+
export function withWaylandHint(error) {
|
|
107
|
+
if (!(error instanceof AdapterError) || !error.message.startsWith('desktop: window not found')) {
|
|
108
|
+
return error;
|
|
109
|
+
}
|
|
110
|
+
return new AdapterError(`${error.message} — WAYLAND_DISPLAY is set: native Wayland windows are invisible to xdotool ` +
|
|
111
|
+
'(capture works via grim, but input does not). Run the app under XWayland ' +
|
|
112
|
+
'(e.g. GDK_BACKEND=x11, QT_QPA_PLATFORM=xcb) or point `display` at an Xvfb', { cause: error });
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=managed-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-app.js","sourceRoot":"","sources":["../../../src/adapters/desktop/managed-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,eAAe,GACnB,6NAA6N,CAAC;AAShO,sDAAsD;AACtD,MAAM,OAAO,UAAU;IACZ,QAAQ,CAAS;IACjB,IAAI,CAAoB;IACjC,MAAM,GAAoB,IAAI,CAAC;IAC/B;;;;;OAKG;IACH,UAAU,GAAkB,IAAI,CAAC;IAEjC,YAAY,OAAe,EAAE,GAAsB;QACjD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACH,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC5B,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;YAC7C,GAAG,EAAE,IAAI,CAAC,IAAI;YACd,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,OAAO,CAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YACnD,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,IAAI,GAAG,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IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC;QAClC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAC7B,CAAC;IAED,yFAAyF;IACzF,KAAK,CAAC,aAAa;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;QAC5B,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO;QACzB,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,CAAC,CAAC,KAAK,YAAY,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,2BAA2B,CAAC,EAAE,CAAC;QAC/F,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,YAAY,CACrB,GAAG,KAAK,CAAC,OAAO,6EAA6E;QAC3F,2EAA2E;QAC3E,2EAA2E,EAC7E,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -66,6 +66,8 @@ export declare function desktopEnv(display?: string): NodeJS.ProcessEnv;
|
|
|
66
66
|
* a seam keeps the deadline logic deterministic with no cross-file blast radius.
|
|
67
67
|
*/
|
|
68
68
|
export declare function makeExec(env: NodeJS.ProcessEnv, timeoutMs?: number, now?: () => number): Exec;
|
|
69
|
+
/** True while any process still sits in the detached group `pid` leads (a `kill -0` probe). */
|
|
70
|
+
export declare function groupAlive(pid: number): boolean;
|
|
69
71
|
/**
|
|
70
72
|
* Tear a managed target down: SIGTERM its group, wait for it to actually die, escalate
|
|
71
73
|
* to SIGKILL after `graceMs`.
|
|
@@ -126,6 +126,10 @@ function signalGroup(pid, signal) {
|
|
|
126
126
|
throw error;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
/** True while any process still sits in the detached group `pid` leads (a `kill -0` probe). */
|
|
130
|
+
export function groupAlive(pid) {
|
|
131
|
+
return signalGroup(pid, 0);
|
|
132
|
+
}
|
|
129
133
|
/**
|
|
130
134
|
* Tear a managed target down: SIGTERM its group, wait for it to actually die, escalate
|
|
131
135
|
* to SIGKILL after `graceMs`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proc.js","sourceRoot":"","sources":["../../../src/adapters/desktop/proc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEtC,sFAAsF;AACtF,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,GAAG,SAAS,CAAC;AAmB9B;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/B,IAAI,OAAO,EAAE,CAAC;QACZ,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,OAAO,GAAG,CAAC,eAAe,CAAC;IAC7B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAsB,EACtB,SAAS,GAAG,uBAAuB,EACnC,GAAG,GA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C,CAAC;IACpE,CAAC;AACH,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,CAAC;AACtF,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The desktop `waitFor` poll loop, abort-aware — split out of `desktop-adapter.ts`.
|
|
3
|
+
*/
|
|
4
|
+
/** The rejection `WaitOptions.signal` asks for — an error named `AbortError`. */
|
|
5
|
+
export declare const abortError: () => DOMException;
|
|
6
|
+
export interface PollInit {
|
|
7
|
+
/** One deadline-bounded read: true once the awaited node is present. */
|
|
8
|
+
present: () => Promise<boolean>;
|
|
9
|
+
/** Timeout wording, e.g. `waitFor timed out after 50ms (query)`. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Absolute epoch-ms instant the wait must not run past. */
|
|
12
|
+
deadline: number;
|
|
13
|
+
/** Rejects the moment the caller's signal fires; cuts short a walk and the nap. */
|
|
14
|
+
aborted: Promise<never>;
|
|
15
|
+
}
|
|
16
|
+
/** Poll until present; reject on the deadline (loud) or on abort. Clears its nap timer on every path. */
|
|
17
|
+
export declare function pollUntilPresent(init: PollInit): Promise<void>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The desktop `waitFor` poll loop, abort-aware — split out of `desktop-adapter.ts`.
|
|
3
|
+
*/
|
|
4
|
+
import { AdapterError } from '../../errors.js';
|
|
5
|
+
/** Pause between polls of the a11y tree. */
|
|
6
|
+
const POLL_MS = 500;
|
|
7
|
+
/** The rejection `WaitOptions.signal` asks for — an error named `AbortError`. */
|
|
8
|
+
export const abortError = () => new DOMException('desktop: waitFor aborted', 'AbortError');
|
|
9
|
+
/** Poll until present; reject on the deadline (loud) or on abort. Clears its nap timer on every path. */
|
|
10
|
+
export async function pollUntilPresent(init) {
|
|
11
|
+
const { deadline, aborted } = init;
|
|
12
|
+
for (;;) {
|
|
13
|
+
// The losing walk keeps running to its own deadline; its rejection must not go unhandled.
|
|
14
|
+
const present = init.present();
|
|
15
|
+
present.catch(() => { });
|
|
16
|
+
if (await Promise.race([present, aborted])) {
|
|
17
|
+
// A match that only landed after the deadline is not a success: the wait is
|
|
18
|
+
// over, so resolving now would report a node the caller waited too long for.
|
|
19
|
+
if (Date.now() > deadline) {
|
|
20
|
+
throw new AdapterError(`desktop: ${init.label} — the query matched only after the deadline`);
|
|
21
|
+
}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (Date.now() >= deadline)
|
|
25
|
+
throw new AdapterError(`desktop: ${init.label}`);
|
|
26
|
+
let timer;
|
|
27
|
+
const nap = new Promise((resolve) => {
|
|
28
|
+
timer = setTimeout(resolve, POLL_MS);
|
|
29
|
+
});
|
|
30
|
+
try {
|
|
31
|
+
await Promise.race([nap, aborted]);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=wait-poll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-poll.js","sourceRoot":"","sources":["../../../src/adapters/desktop/wait-poll.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,4CAA4C;AAC5C,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB,iFAAiF;AACjF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAiB,EAAE,CAC3C,IAAI,YAAY,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAC;AAa7D,yGAAyG;AACzG,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAc;IACnD,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACnC,SAAS,CAAC;QACR,0FAA0F;QAC1F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACxB,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;YAC3C,4EAA4E;YAC5E,6EAA6E;YAC7E,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;gBAC1B,MAAM,IAAI,YAAY,CACpB,YAAY,IAAI,CAAC,KAAK,8CAA8C,CACrE,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ;YAAE,MAAM,IAAI,YAAY,CAAC,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7E,IAAI,KAAgD,CAAC;QACrD,MAAM,GAAG,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACxC,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -20,7 +20,7 @@ export declare function isAdapterWired(kind: string): kind is Target['adapter'];
|
|
|
20
20
|
* Create an adapter for a named target from the resolved config.
|
|
21
21
|
*
|
|
22
22
|
* @param targetName — the key in config.targets (e.g., "web")
|
|
23
|
-
* @param config — the resolved
|
|
23
|
+
* @param config — the resolved project config
|
|
24
24
|
* @param profileDir — absolute path to persistent profile dir (for managed browser adapter)
|
|
25
25
|
* @param onLog — optional sink for streaming console/network logs to findings store
|
|
26
26
|
* @param timeoutMs — the run's remaining wall-clock budget for getting the target up;
|
package/dist/adapters/factory.js
CHANGED
|
@@ -39,7 +39,7 @@ export function isAdapterWired(kind) {
|
|
|
39
39
|
* Create an adapter for a named target from the resolved config.
|
|
40
40
|
*
|
|
41
41
|
* @param targetName — the key in config.targets (e.g., "web")
|
|
42
|
-
* @param config — the resolved
|
|
42
|
+
* @param config — the resolved project config
|
|
43
43
|
* @param profileDir — absolute path to persistent profile dir (for managed browser adapter)
|
|
44
44
|
* @param onLog — optional sink for streaming console/network logs to findings store
|
|
45
45
|
* @param timeoutMs — the run's remaining wall-clock budget for getting the target up;
|
|
@@ -30,3 +30,9 @@ export declare function tabMarker(tab: string | undefined): string;
|
|
|
30
30
|
* from a target without tabs renders exactly as it did before markers existed.
|
|
31
31
|
*/
|
|
32
32
|
export declare function formatConsoleLine(entry: ConsoleEntry): string;
|
|
33
|
+
/**
|
|
34
|
+
* Collapse line breaks to a literal `\n` so one entry is ONE log line. Console text is
|
|
35
|
+
* page-controlled: a multi-line message (a stack trace) would otherwise span lines, and
|
|
36
|
+
* a crafted `"x\n2026-… [tab-1] ERROR forged"` would plant a line the trail reads as real.
|
|
37
|
+
*/
|
|
38
|
+
export declare function oneLine(text: string): string;
|
|
@@ -33,7 +33,15 @@ export function tabMarker(tab) {
|
|
|
33
33
|
* from a target without tabs renders exactly as it did before markers existed.
|
|
34
34
|
*/
|
|
35
35
|
export function formatConsoleLine(entry) {
|
|
36
|
-
const where = entry.location ? ` @ ${entry.location}` : '';
|
|
37
|
-
return `${stamp(entry.timestamp)}${tabMarker(entry.tab)} ${entry.level.toUpperCase()} ${entry.text}${where}`;
|
|
36
|
+
const where = entry.location ? ` @ ${oneLine(entry.location)}` : '';
|
|
37
|
+
return `${stamp(entry.timestamp)}${tabMarker(entry.tab)} ${entry.level.toUpperCase()} ${oneLine(entry.text)}${where}`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Collapse line breaks to a literal `\n` so one entry is ONE log line. Console text is
|
|
41
|
+
* page-controlled: a multi-line message (a stack trace) would otherwise span lines, and
|
|
42
|
+
* a crafted `"x\n2026-… [tab-1] ERROR forged"` would plant a line the trail reads as real.
|
|
43
|
+
*/
|
|
44
|
+
export function oneLine(text) {
|
|
45
|
+
return text.replace(/\r\n|[\r\n\u2028\u2029]/g, '\\n');
|
|
38
46
|
}
|
|
39
47
|
//# sourceMappingURL=log-format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-format.js","sourceRoot":"","sources":["../../src/adapters/log-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,4EAA4E;AAC5E,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAuB;IAC/C,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAmB;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"log-format.js","sourceRoot":"","sources":["../../src/adapters/log-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,4EAA4E;AAC5E,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAuB;IAC/C,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAmB;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC;AACxH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/agent/belt/act.d.ts
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import type { Adapter, TabInfo } from '../../adapters/contract.js';
|
|
31
|
+
import type { Redactor } from '../../redact.js';
|
|
31
32
|
import type { LogChannel } from '../../session/findings-store.js';
|
|
32
33
|
import type { ActTrail } from './trail.js';
|
|
33
34
|
/** The action verbs `act` routes to the shared contract. */
|
|
@@ -135,14 +136,16 @@ export interface StepRecorder {
|
|
|
135
136
|
* error (and can retry), while the evidence trail keeps the step that did not work
|
|
136
137
|
* instead of silently dropping it.
|
|
137
138
|
*/
|
|
138
|
-
export declare function runAct(adapter: Adapter, recorder: StepRecorder, input: ActInput, trail?: ActTrail, entered?: () => void, origin?: string): Promise<ActResult>;
|
|
139
|
+
export declare function runAct(adapter: Adapter, recorder: StepRecorder, input: ActInput, trail?: ActTrail, entered?: () => void, origin?: string, signal?: AbortSignal): Promise<ActResult>;
|
|
139
140
|
/**
|
|
140
141
|
* Build the `act` tool bound to one adapter + recorder, for the debug agent's belt.
|
|
141
142
|
* `trail` (when wired by the loop) is the run's shared step trail, so every act —
|
|
142
143
|
* the ones that worked and the ones that threw — lands in the persisted findings.
|
|
143
|
-
* `origin` is the app
|
|
144
|
+
* `origin` is the app's origin (web only; see {@link assertSameOrigin}). `redact`, the
|
|
145
|
+
* run's secret redactor, masks every string of the result and of a thrown error —
|
|
146
|
+
* REQUIRED, so a forgotten wire fails the typecheck instead of leaking.
|
|
144
147
|
*/
|
|
145
|
-
export declare function createActTool(adapter: Adapter, recorder: StepRecorder, trail
|
|
148
|
+
export declare function createActTool(adapter: Adapter, recorder: StepRecorder, trail: ActTrail | undefined, origin: string | undefined, redact: Redactor): ({
|
|
146
149
|
deferLoading?: boolean;
|
|
147
150
|
title?: string;
|
|
148
151
|
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
package/dist/agent/belt/act.js
CHANGED
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
import { tool } from 'ai';
|
|
30
30
|
import { z } from 'zod';
|
|
31
31
|
import { AgentError } from '../../errors.js';
|
|
32
|
+
import { withRedactedOutput } from './redact-output.js';
|
|
33
|
+
import { assertSameOrigin } from './same-origin.js';
|
|
34
|
+
import { resolveTargetRef } from './target-refs.js';
|
|
32
35
|
/** The action verbs `act` routes to the shared contract. */
|
|
33
36
|
export const ACT_ACTIONS = [
|
|
34
37
|
'click',
|
|
@@ -147,39 +150,14 @@ function failureNote(error) {
|
|
|
147
150
|
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
148
151
|
}
|
|
149
152
|
/** Perform one action against the contract and return its target-derived step label. */
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* target had been left. The smart agent would have gone hunting for a CORS bug that
|
|
159
|
-
* does not exist in its repo.
|
|
160
|
-
*
|
|
161
|
-
* `origin` is the run's own origin (web only; empty for desktop/android, whose
|
|
162
|
-
* `navigate` means a window title or an app package). Same-origin URLs and relative
|
|
163
|
-
* paths pass; anything else fails loud, naming where the driver is supposed to be.
|
|
164
|
-
* A run that wanders off the app under test is worse than a run that stops.
|
|
165
|
-
*/
|
|
166
|
-
function assertSameOrigin(target, origin) {
|
|
167
|
-
if (!origin)
|
|
168
|
-
return; // non-web target, or no origin to enforce
|
|
169
|
-
let destination;
|
|
170
|
-
try {
|
|
171
|
-
destination = new URL(target, origin); // relative paths resolve against the app
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
return; // not URL-shaped — let the adapter reject it with its own message
|
|
175
|
-
}
|
|
176
|
-
if (destination.origin === origin)
|
|
177
|
-
return;
|
|
178
|
-
throw new AgentError(`act 'navigate' refused: '${target}' leaves the app under test (${origin}). ` +
|
|
179
|
-
'Findings about another site cannot be acted on. Use a path or a URL on ' +
|
|
180
|
-
`${origin}; if the app genuinely lives elsewhere, the smart agent must pass that url to start_debug.`);
|
|
181
|
-
}
|
|
182
|
-
async function performAct(adapter, input, origin) {
|
|
153
|
+
async function performAct(adapter, raw, origin, signal) {
|
|
154
|
+
// An opaque `@@ref:N` target (issued by `observe` for a selector that would carry
|
|
155
|
+
// a run secret) resolves to the real selector HERE, never in the driver's
|
|
156
|
+
// context. `switch_tab`'s target is a tab index, `navigate`'s a URL — not selectors.
|
|
157
|
+
const selector = raw.action === 'switch_tab' || raw.action === 'navigate';
|
|
158
|
+
const input = selector || raw.target === undefined
|
|
159
|
+
? raw
|
|
160
|
+
: { ...raw, target: resolveTargetRef(adapter, raw.target) };
|
|
183
161
|
switch (input.action) {
|
|
184
162
|
case 'click': {
|
|
185
163
|
const node = await resolve(adapter, required(input.target, 'target', 'click'));
|
|
@@ -187,9 +165,9 @@ async function performAct(adapter, input, origin) {
|
|
|
187
165
|
return `click ${describeNode(node)}`;
|
|
188
166
|
}
|
|
189
167
|
case 'type': {
|
|
190
|
-
// Validate `text` before resolving
|
|
191
|
-
//
|
|
192
|
-
const text = required(input.text, 'text', 'type');
|
|
168
|
+
// Validate `text` before resolving: a stale selector must not mask the real
|
|
169
|
+
// `requires 'text'` failure. Empty text WITH `clear` is valid: empty the field.
|
|
170
|
+
const text = input.clear && input.text === '' ? '' : required(input.text, 'text', 'type');
|
|
193
171
|
const node = await resolve(adapter, required(input.target, 'target', 'type'));
|
|
194
172
|
if (input.clear === true) {
|
|
195
173
|
// `type` appends by design (it focuses and types, it does not `fill`), so
|
|
@@ -205,7 +183,8 @@ async function performAct(adapter, input, origin) {
|
|
|
205
183
|
await adapter.type(node, '');
|
|
206
184
|
await adapter.pressKey('Control+a');
|
|
207
185
|
await adapter.pressKey('Delete');
|
|
208
|
-
|
|
186
|
+
if (text !== '')
|
|
187
|
+
await adapter.type(node, text);
|
|
209
188
|
return `type ${text.length} chars into ${describeNode(node)} (replacing)`;
|
|
210
189
|
}
|
|
211
190
|
await adapter.type(node, text);
|
|
@@ -221,8 +200,7 @@ async function performAct(adapter, input, origin) {
|
|
|
221
200
|
// Every adapter needs something to block on — a bare `wait` can only throw
|
|
222
201
|
// (`waitFor requires query and/or networkIdle`). Reject it HERE so the driver
|
|
223
202
|
// gets a steering message from its own tool, and the dead step lands on the
|
|
224
|
-
// trail
|
|
225
|
-
// sleep, which the loop has no use for.
|
|
203
|
+
// trail. A `timeout` alone is a sleep, which the loop has no use for.
|
|
226
204
|
if (!input.target && input.networkIdle !== true) {
|
|
227
205
|
throw new AgentError("act 'wait' requires 'target' (a selector to wait for) and/or 'networkIdle': true");
|
|
228
206
|
}
|
|
@@ -230,6 +208,8 @@ async function performAct(adapter, input, origin) {
|
|
|
230
208
|
query: input.target,
|
|
231
209
|
networkIdle: input.networkIdle,
|
|
232
210
|
timeout: input.timeout,
|
|
211
|
+
// The run's abort cancels the wait — a 60s wait must not outlive its run.
|
|
212
|
+
signal,
|
|
233
213
|
});
|
|
234
214
|
return `wait for ${describeWait(input.target, input.networkIdle, input.timeout)}`;
|
|
235
215
|
}
|
|
@@ -269,7 +249,7 @@ async function performAct(adapter, input, origin) {
|
|
|
269
249
|
* error (and can retry), while the evidence trail keeps the step that did not work
|
|
270
250
|
* instead of silently dropping it.
|
|
271
251
|
*/
|
|
272
|
-
export async function runAct(adapter, recorder, input, trail, entered, origin) {
|
|
252
|
+
export async function runAct(adapter, recorder, input, trail, entered, origin, signal) {
|
|
273
253
|
// Enter the gate BEFORE the first await, so a same-step terminal read sees this
|
|
274
254
|
// act in flight rather than an empty trail. `entered` is the release of a
|
|
275
255
|
// `begin()` the CALLER already made — `createActTool` enters the gate when the
|
|
@@ -280,7 +260,8 @@ export async function runAct(adapter, recorder, input, trail, entered, origin) {
|
|
|
280
260
|
// no target-derived label, and an unlabelled failed step is not evidence.
|
|
281
261
|
let label = describeAttempt(input);
|
|
282
262
|
try {
|
|
283
|
-
|
|
263
|
+
signal?.throwIfAborted(); // still queued when the run ended: never drive the target
|
|
264
|
+
label = await performAct(adapter, input, origin, signal);
|
|
284
265
|
const png = await adapter.screenshot();
|
|
285
266
|
const screenshot = await recorder.saveScreenshot(label, png);
|
|
286
267
|
const navigated = await takeLoads(adapter);
|
|
@@ -360,9 +341,11 @@ async function extraTabs(adapter) {
|
|
|
360
341
|
* Build the `act` tool bound to one adapter + recorder, for the debug agent's belt.
|
|
361
342
|
* `trail` (when wired by the loop) is the run's shared step trail, so every act —
|
|
362
343
|
* the ones that worked and the ones that threw — lands in the persisted findings.
|
|
363
|
-
* `origin` is the app
|
|
344
|
+
* `origin` is the app's origin (web only; see {@link assertSameOrigin}). `redact`, the
|
|
345
|
+
* run's secret redactor, masks every string of the result and of a thrown error —
|
|
346
|
+
* REQUIRED, so a forgotten wire fails the typecheck instead of leaking.
|
|
364
347
|
*/
|
|
365
|
-
export function createActTool(adapter, recorder, trail, origin) {
|
|
348
|
+
export function createActTool(adapter, recorder, trail, origin, redact) {
|
|
366
349
|
/**
|
|
367
350
|
* Acts run ONE AT A TIME, however many the driver emits in a step.
|
|
368
351
|
*
|
|
@@ -372,32 +355,29 @@ export function createActTool(adapter, recorder, trail, origin) {
|
|
|
372
355
|
* it) and keyboard input is dispatched at the PAGE, not at an element: two acts
|
|
373
356
|
* in flight interleave their keystrokes into whichever field last took focus.
|
|
374
357
|
*
|
|
375
|
-
* Observed end-to-end: a registration typed
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* other than what it typed, which is the worst failure mode a debugger can have.
|
|
358
|
+
* Observed end-to-end: a registration typed `tTeessttuPsaesrs1TestPass123!…` into
|
|
359
|
+
* the password field and the app happily created the account. Nothing errored —
|
|
360
|
+
* the run just silently tested something other than what it typed.
|
|
379
361
|
*
|
|
380
362
|
* Chaining here rather than locking the adapter: the atomic unit is the whole
|
|
381
363
|
* act, not any single contract call it makes.
|
|
382
364
|
*/
|
|
383
365
|
let queue = Promise.resolve();
|
|
384
|
-
|
|
366
|
+
const act = tool({
|
|
385
367
|
description: 'Drive the target with one action, chosen by action: click | type | key | scroll | navigate | wait | switch_tab. Resolves target via find, then routes to the adapter (click/type/open/waitFor) and records a step to agent.log plus a post-action screenshot. Returns tabs when more than one is open — a click may have opened one. Returns navigated when the action reloaded the document without being asked to (a form that submits without preventDefault, a plain link, an expired session): the page was replaced and every bit of in-page state is gone, so re-read before concluding anything — and treat a submit that only reloads as a bug, not a success. Use observe to read state before and after.',
|
|
386
368
|
inputSchema: ActInputSchema,
|
|
387
|
-
execute: (input) => {
|
|
388
|
-
// Enter the trail's gate NOW, not when this act's turn on the queue comes up
|
|
389
|
-
// `runAct` releases
|
|
390
|
-
//
|
|
391
|
-
//
|
|
392
|
-
// missing every act but the first (and the loop then stops, so that act
|
|
393
|
-
// reaches no persisted file at all).
|
|
369
|
+
execute: (input, { abortSignal: signal }) => {
|
|
370
|
+
// Enter the trail's gate NOW, not when this act's turn on the queue comes up:
|
|
371
|
+
// `runAct` releases it BEFORE the queue continuation starts the next act, so
|
|
372
|
+
// a `report` racing in the same step saw an idle gate between two queued acts
|
|
373
|
+
// and wrote a verdict missing every act but the first.
|
|
394
374
|
const entered = trail?.begin();
|
|
395
|
-
const
|
|
396
|
-
// The
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
return next;
|
|
375
|
+
const run = queue.then(() => runAct(adapter, recorder, input, trail, entered, origin, signal));
|
|
376
|
+
// The QUEUE copy swallows a rejection; the driver still gets it via `run`.
|
|
377
|
+
queue = run.catch(() => undefined);
|
|
378
|
+
return run;
|
|
400
379
|
},
|
|
401
380
|
});
|
|
381
|
+
return withRedactedOutput(act, redact);
|
|
402
382
|
}
|
|
403
383
|
//# sourceMappingURL=act.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.js","sourceRoot":"","sources":["../../../src/agent/belt/act.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"act.js","sourceRoot":"","sources":["../../../src/agent/belt/act.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,4DAA4D;AAC5D,M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GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAgB,EAChB,QAAsB,EACtB,KAA2B,EAC3B,MAA0B,EAC1B,MAAgB;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,IAAI,KAAK,GAAqB,OAAO,CAAC,OAAO,EAAE,CAAC;IAEhD,MAAM,GAAG,GAAG,IAAI,CAAC;QACf,WAAW,EACT,qrBAAqrB;QACvrB,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1C,8EAA8E;YAC9E,6EAA6E;YAC7E,8EAA8E;YAC9E,uDAAuD;YACvD,MAAM,OAAO,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC;YAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAC1B,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CACjE,CAAC;YACF,2EAA2E;YAC3E,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACnC,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC,CAAC;IACH,OAAO,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -109,14 +109,14 @@ export interface SelfLookResult {
|
|
|
109
109
|
mediaType: 'image/png' | 'image/jpeg';
|
|
110
110
|
/** The question/expectation echoed back so the driver judges against it. */
|
|
111
111
|
prompt: string;
|
|
112
|
-
/** Base64 frame — mapped to a `file
|
|
112
|
+
/** Base64 frame — mapped to a `file` part via `toModelOutput`. */
|
|
113
113
|
frame: string;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Build `look` for a MULTIMODAL driver (self-look): when control + vision are the
|
|
117
117
|
* SAME model, a second blind vision call wastes a round-trip and drops the run's
|
|
118
118
|
* context — instead the tool returns the frame itself as multimodal tool output
|
|
119
|
-
* (`toModelOutput` → `content` with a `file
|
|
119
|
+
* (`toModelOutput` → `content` with a `file` part), so the driver looks at
|
|
120
120
|
* the screenshot with its own eyes, in full conversation context.
|
|
121
121
|
*
|
|
122
122
|
* Older frames are pruned from the transcript by the loop (`pruneStaleFrames`) so
|
|
@@ -352,6 +352,12 @@ export declare function createSelfLookTool(adapter: Adapter, recorder: EvidenceR
|
|
|
352
352
|
expect?: string | undefined;
|
|
353
353
|
}, SelfLookResult, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
354
354
|
});
|
|
355
|
+
/**
|
|
356
|
+
* Hard cap on ONE vision call. Without it a stalled vision provider holds the
|
|
357
|
+
* step until the run's wall-clock timeout — the whole run dies verdict-less over
|
|
358
|
+
* a single screenshot the driver could have done without.
|
|
359
|
+
*/
|
|
360
|
+
export declare const VISION_TIMEOUT_MS = 90000;
|
|
355
361
|
/**
|
|
356
362
|
* Build the `look` tool bound to one adapter + vision model + recorder, for the belt.
|
|
357
363
|
* `trail` (when wired by the loop) is the run's evidence trail: every issue the
|
|
@@ -359,7 +365,7 @@ export declare function createSelfLookTool(adapter: Adapter, recorder: EvidenceR
|
|
|
359
365
|
* the gate releases, so a `report` racing in the SAME step carries it even when
|
|
360
366
|
* the driver's own `visual` array omits it. The trail dedupes repeats.
|
|
361
367
|
*/
|
|
362
|
-
export declare function createLookTool(adapter: Adapter, vision: LanguageModel, recorder: EvidenceRecorder, trail?: ActTrail, notes?: readonly string[]): ({
|
|
368
|
+
export declare function createLookTool(adapter: Adapter, vision: LanguageModel, recorder: EvidenceRecorder, trail?: ActTrail, notes?: readonly string[], timeoutMs?: number): ({
|
|
363
369
|
deferLoading?: boolean;
|
|
364
370
|
title?: string;
|
|
365
371
|
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|