@jobshimo/browser-link 0.23.14 → 0.25.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/dist/agent-instructions/content.js +32 -0
- package/dist/agent-instructions/content.js.map +1 -1
- package/dist/cdp/flow.d.ts +90 -8
- package/dist/cdp/flow.js +411 -122
- package/dist/cdp/flow.js.map +1 -1
- package/dist/cdp/transport.js +5 -1
- package/dist/cdp/transport.js.map +1 -1
- package/dist/extension/background.js +6 -1
- package/dist/extension/background.js.map +1 -1
- package/dist/extension/flow.d.ts +97 -8
- package/dist/extension/flow.js +418 -122
- package/dist/extension/flow.js.map +1 -1
- package/dist/extension/manifest.json +1 -1
- package/dist/tools/browser-definitions.js +84 -5
- package/dist/tools/browser-definitions.js.map +1 -1
- package/dist/tools/browser-dispatch.d.ts +3 -1
- package/dist/tools/browser-dispatch.js +130 -7
- package/dist/tools/browser-dispatch.js.map +1 -1
- package/package.json +1 -1
|
@@ -184,8 +184,40 @@ function body() {
|
|
|
184
184
|
' working notes and pass as `since_id` next call. One variable. The',
|
|
185
185
|
' server does not maintain per-agent cursors.',
|
|
186
186
|
'',
|
|
187
|
+
'### BULK WORK — `flow` + `repeat`, NEVER a loop inside `evaluate`',
|
|
188
|
+
'',
|
|
189
|
+
'"Click every element matching X until the list drains" is a',
|
|
190
|
+
'`browser.flow` with a `repeat` step, not an `evaluate` loop:',
|
|
191
|
+
'',
|
|
192
|
+
'```',
|
|
193
|
+
'{ repeat: { steps: [{ click: { selector: ".row .delete" } }],',
|
|
194
|
+
' max_iterations: 200, while_found: ".row", delay_ms: 250 } }',
|
|
195
|
+
'```',
|
|
196
|
+
'',
|
|
197
|
+
'- Hundreds of iterations in ONE round trip, and every click is still',
|
|
198
|
+
' trusted CDP input with the occlusion guard and a recovery snapshot.',
|
|
199
|
+
' An `evaluate` loop has NONE of that — `el.click()` is',
|
|
200
|
+
' `isTrusted:false`, nothing hit-tests, nothing is recorded.',
|
|
201
|
+
'- `max_iterations` is REQUIRED and repeats do NOT nest. Inner steps',
|
|
202
|
+
' count against the same 20-step ceiling. If the projected budget',
|
|
203
|
+
' exceeds 60s the flow is rejected up front — lower `max_iterations`',
|
|
204
|
+
' and run the flow again; each call picks up where the last left off',
|
|
205
|
+
' when `while_found` still matches.',
|
|
206
|
+
'- Use `while_found` to decide when to stop, NOT a page counter. It',
|
|
207
|
+
' checks for a VISIBLE match before each iteration and reports',
|
|
208
|
+
' `stopped_by: "condition"` vs `"max_iterations"`.',
|
|
209
|
+
'- `delay_ms` throttles between iterations. Use it on anything',
|
|
210
|
+
' server-backed.',
|
|
211
|
+
'- BEFORE an irreversible bulk run (deleting, sending, paying), call',
|
|
212
|
+
' the same flow once with `dry_run: true`. It dispatches NOTHING and',
|
|
213
|
+
' reports `max_iterations` / `inner_steps` / `delay_ms` /',
|
|
214
|
+
' `while_found` / `would_start` per repeat.',
|
|
215
|
+
'',
|
|
187
216
|
'### LONG-RUNNING WORK — a timed-out `evaluate` KEEPS RUNNING',
|
|
188
217
|
'',
|
|
218
|
+
'Reach for this only when `flow` + `repeat` genuinely cannot express',
|
|
219
|
+
'the work (it needs branching, or arbitrary JS per item).',
|
|
220
|
+
'',
|
|
189
221
|
'A bridge timeout drops the RESPONSE only. The expression itself keeps',
|
|
190
222
|
'running in the page; there is no cancellation path. A timeout reads',
|
|
191
223
|
'like failure, so the reflex is to relaunch — and on irreversible',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/agent-instructions/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,sCAAsC,CAAC;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAEnE,MAAM,UAAU,WAAW,CAAC,OAAO,GAAG,OAAO;IAC3C,OAAO,GAAG,YAAY,K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C,CAAC,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACrF,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,KAAK;QACvB,QAAQ;QACR,gBAAgB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,IAAI,IAAI;KAChD,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/agent-instructions/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,sCAAsC,CAAC;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAEnE,MAAM,UAAU,WAAW,CAAC,OAAO,GAAG,OAAO;IAC3C,OAAO,GAAG,YAAY,KAAK,OAAO,MAAM,CAAC;AAC3C,CAAC;AAED;;;;yCAIyC;AACzC,MAAM,CAAC,MAAM,QAAQ,GACnB,gFAAgF,CAAC;AACnF,MAAM,CAAC,MAAM,MAAM,GAAG,4CAA4C,CAAC;AAEnE;;;;mBAImB;AACnB,SAAS,IAAI;IACX,OAAO;QACL,mDAAmD;QACnD,EAAE;QACF,kFAAkF;QAClF,wEAAwE;QACxE,+DAA+D;QAC/D,EAAE;QACF,0DAA0D;QAC1D,EAAE;QACF,kDAAkD;QAClD,qEAAqE;QACrE,+DAA+D;QAC/D,yEAAyE;QACzE,oDAAoD;QACpD,yEAAyE;QACzE,sEAAsE;QACtE,kFAAkF;QAClF,EAAE;QACF,iDAAiD;QACjD,kCAAkC;QAClC,mEAAmE;QACnE,sEAAsE;QACtE,qEAAqE;QACrE,EAAE;QACF,qDAAqD;QACrD,qEAAqE;QACrE,EAAE;QACF,yCAAyC;QACzC,wEAAwE;QACxE,sEAAsE;QACtE,sEAAsE;QACtE,kEAAkE;QAClE,uCAAuC;QACvC,EAAE;QACF,yEAAyE;QACzE,mBAAmB;QACnB,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
|
@@ -12,13 +12,15 @@
|
|
|
12
12
|
*
|
|
13
13
|
* browser.flow step sequencing — the logic behind the composite action
|
|
14
14
|
* tool. Runs a short, declarative list of find/click/type/press/wait_for/
|
|
15
|
-
* drag steps strictly in order, fails fast on the first step that
|
|
16
|
-
* not succeed, and threads an "implicit target" from a `find` step
|
|
17
|
-
* the very next click/type/press step that omits its own
|
|
18
|
-
* `drag` step stays OUT of that chain: both of its
|
|
19
|
-
* explicit (selector or coords), so it neither
|
|
20
|
-
* implicit target — a pending target survives a
|
|
21
|
-
* a later click/type/press, exactly like it
|
|
15
|
+
* drag/sleep steps strictly in order, fails fast on the first step that
|
|
16
|
+
* does not succeed, and threads an "implicit target" from a `find` step
|
|
17
|
+
* into the very next click/type/press step that omits its own
|
|
18
|
+
* `selector`. A `drag` step stays OUT of that chain: both of its
|
|
19
|
+
* endpoints are always explicit (selector or coords), so it neither
|
|
20
|
+
* consumes nor sets the implicit target — a pending target survives a
|
|
21
|
+
* drag step untouched for a later click/type/press, exactly like it
|
|
22
|
+
* survives a wait_for. A `sleep` step is a fixed pause and stays out of
|
|
23
|
+
* the chain for the same reason: it names no target at all.
|
|
22
24
|
*
|
|
23
25
|
* Deliberately decoupled from any specific transport: every side effect
|
|
24
26
|
* goes through the `FlowDeps` the caller injects. The concrete wiring —
|
|
@@ -187,6 +189,67 @@ export interface DragStepResult {
|
|
|
187
189
|
intercept_received: boolean;
|
|
188
190
|
events_fired: string[];
|
|
189
191
|
}
|
|
192
|
+
/** Hard cap on one `sleep` step's `ms`. Matches the ceiling a single
|
|
193
|
+
* `wait_for` step may request, so no one step can park the flow longer
|
|
194
|
+
* than the longest wait already expressible. Out-of-range values are a
|
|
195
|
+
* validation ERROR rather than a silent clamp: a flow that asked to
|
|
196
|
+
* throttle by 60s and got 30s would hammer a backend at twice the
|
|
197
|
+
* intended rate without ever saying so. */
|
|
198
|
+
export declare const MAX_FLOW_SLEEP_MS = 30000;
|
|
199
|
+
/** A fixed pause between steps. `settle_ms` cannot serve this purpose —
|
|
200
|
+
* it is a quiet-PERIOD wait that returns as soon as the page stops
|
|
201
|
+
* mutating, so it collapses to nothing on a page that is already idle.
|
|
202
|
+
* Throttling a repeated action against a rate-limited backend needs a
|
|
203
|
+
* real delay, and before this step existed the only way to get one was
|
|
204
|
+
* to drop out of the flow into `browser.evaluate` — losing trusted CDP
|
|
205
|
+
* input for every action in the loop. */
|
|
206
|
+
export interface SleepStepParams {
|
|
207
|
+
ms: number;
|
|
208
|
+
}
|
|
209
|
+
/** Hard cap on one `repeat` step's `max_iterations`. The real ceiling in
|
|
210
|
+
* practice is the flow's own worst-case time budget (a repeat's budget is
|
|
211
|
+
* `max_iterations × (inner steps + delay)`), which bites long before this
|
|
212
|
+
* does; this is the backstop that keeps a typo from producing an
|
|
213
|
+
* absurd projected budget. */
|
|
214
|
+
export declare const MAX_FLOW_REPEAT_ITERATIONS = 500;
|
|
215
|
+
/** Hard cap on a `repeat`'s inter-iteration `delay_ms` — same ceiling a
|
|
216
|
+
* standalone `sleep` step may request. */
|
|
217
|
+
export declare const MAX_FLOW_REPEAT_DELAY_MS = 30000;
|
|
218
|
+
/** A BOUNDED loop over a sub-sequence of steps.
|
|
219
|
+
*
|
|
220
|
+
* `max_iterations` is REQUIRED, deliberately: it is what keeps a flow's
|
|
221
|
+
* worst-case duration statically computable, which is the whole basis of
|
|
222
|
+
* the up-front `MAX_FLOW_TIMEOUT_MS` rejection. An unbounded loop would
|
|
223
|
+
* make that budget unknowable and force the bridge to either park
|
|
224
|
+
* indefinitely or time out mid-flow — the exact failure the flow budget
|
|
225
|
+
* exists to prevent.
|
|
226
|
+
*
|
|
227
|
+
* `while_found` is the early stop: the loop runs another iteration only
|
|
228
|
+
* while that selector still matches something VISIBLE in the live DOM.
|
|
229
|
+
* Making the stop condition declarative is the point — it replaces the
|
|
230
|
+
* hand-rolled "parse a counter and guess when we are done" pattern that
|
|
231
|
+
* silently misreads pages whose counters vanish at zero.
|
|
232
|
+
*
|
|
233
|
+
* Nesting is rejected: a repeat may not contain a repeat. One bounded
|
|
234
|
+
* loop keeps the budget arithmetic trivial and the grammar honest.
|
|
235
|
+
* `steps` may not contain a `repeat`, and inner steps count against the
|
|
236
|
+
* same `MAX_FLOW_STEPS` ceiling as outer ones. */
|
|
237
|
+
export interface RepeatStepParams {
|
|
238
|
+
steps: FlowStep[];
|
|
239
|
+
max_iterations: number;
|
|
240
|
+
while_found?: string;
|
|
241
|
+
delay_ms?: number;
|
|
242
|
+
}
|
|
243
|
+
export interface RepeatStepResult {
|
|
244
|
+
iterations_completed: number;
|
|
245
|
+
/** `condition` — `while_found` stopped matching. `max_iterations` — the
|
|
246
|
+
* bound was reached with the condition still true (or with no condition
|
|
247
|
+
* at all). A failing inner step does not produce a result at all: it
|
|
248
|
+
* fails the whole flow, like every other step. */
|
|
249
|
+
stopped_by: 'condition' | 'max_iterations';
|
|
250
|
+
/** Per-iteration list of the inner steps' compacted results. */
|
|
251
|
+
iterations: unknown[][];
|
|
252
|
+
}
|
|
190
253
|
export type FlowStep = {
|
|
191
254
|
find: FindStepParams;
|
|
192
255
|
} | {
|
|
@@ -199,6 +262,10 @@ export type FlowStep = {
|
|
|
199
262
|
wait_for: WaitForStepParams;
|
|
200
263
|
} | {
|
|
201
264
|
drag: DragStepParams;
|
|
265
|
+
} | {
|
|
266
|
+
sleep: SleepStepParams;
|
|
267
|
+
} | {
|
|
268
|
+
repeat: RepeatStepParams;
|
|
202
269
|
};
|
|
203
270
|
/** Everything the step executor needs from the outside world. `background.ts`
|
|
204
271
|
* (extension) / `cdp/transport.ts` (server) binds each method to the real
|
|
@@ -229,6 +296,10 @@ export interface FlowSuccess {
|
|
|
229
296
|
ok: true;
|
|
230
297
|
steps_completed: number;
|
|
231
298
|
results: unknown[];
|
|
299
|
+
/** Present ONLY on a `dryRun` projection, where nothing was dispatched
|
|
300
|
+
* and `steps_completed` is therefore 0. Omitted on a real run, so an
|
|
301
|
+
* existing consumer sees a byte-identical success shape. */
|
|
302
|
+
dry_run?: true;
|
|
232
303
|
}
|
|
233
304
|
export interface FlowFailure {
|
|
234
305
|
ok: false;
|
|
@@ -239,6 +310,14 @@ export interface FlowFailure {
|
|
|
239
310
|
recovery_snapshot: unknown;
|
|
240
311
|
}
|
|
241
312
|
export type FlowResult = FlowSuccess | FlowFailure;
|
|
313
|
+
export interface RunFlowOptions {
|
|
314
|
+
/** Validate and PROJECT the flow without dispatching a single input
|
|
315
|
+
* event, navigation or pause. Answers the one question that matters
|
|
316
|
+
* before an irreversible bulk run — "I am about to do this up to N
|
|
317
|
+
* times; would it even start?" — and is the reason `repeat` and this
|
|
318
|
+
* flag shipped together. */
|
|
319
|
+
dryRun?: boolean;
|
|
320
|
+
}
|
|
242
321
|
/**
|
|
243
322
|
* Run a declarative sequence of steps strictly in order, stopping at the
|
|
244
323
|
* first failure. See the module doc comment for the implicit-target and
|
|
@@ -249,5 +328,8 @@ export type FlowResult = FlowSuccess | FlowFailure;
|
|
|
249
328
|
* array may originate from an untrusted JSON payload cast at the wire
|
|
250
329
|
* boundary in `background.ts` (extension) / `cdp/transport.ts` (server),
|
|
251
330
|
* and a malformed entry must fail the flow cleanly rather than throw.
|
|
331
|
+
*
|
|
332
|
+
* With `options.dryRun`, the flow is validated and projected instead:
|
|
333
|
+
* nothing is dispatched, and each entry describes what WOULD run.
|
|
252
334
|
*/
|
|
253
|
-
export declare function runFlow(steps: readonly FlowStep[], deps: FlowDeps): Promise<FlowResult>;
|
|
335
|
+
export declare function runFlow(steps: readonly FlowStep[], deps: FlowDeps, options?: RunFlowOptions): Promise<FlowResult>;
|