@trusty-squire/mcp 1.1.14-rc.2 → 1.1.14-rc.4
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 +50 -97
- package/{LICENSE → assets/licenses/browser-use-MIT.txt} +1 -1
- package/dist/bot/browser-use-capture.d.ts +15 -0
- package/dist/bot/browser-use-capture.d.ts.map +1 -0
- package/dist/bot/browser-use-capture.js +488 -0
- package/dist/bot/browser-use-capture.js.map +1 -0
- package/dist/bot/browser-use-serializer.d.ts +60 -0
- package/dist/bot/browser-use-serializer.d.ts.map +1 -0
- package/dist/bot/browser-use-serializer.js +587 -0
- package/dist/bot/browser-use-serializer.js.map +1 -0
- package/dist/bot/browser.d.ts +4 -1
- package/dist/bot/browser.d.ts.map +1 -1
- package/dist/bot/browser.js +13 -2
- package/dist/bot/browser.js.map +1 -1
- package/dist/bot/compact-observation-v2.d.ts +66 -33
- package/dist/bot/compact-observation-v2.d.ts.map +1 -1
- package/dist/bot/compact-observation-v2.js +387 -82
- package/dist/bot/compact-observation-v2.js.map +1 -1
- package/dist/bot/credential-shape.d.ts.map +1 -1
- package/dist/bot/credential-shape.js +7 -0
- package/dist/bot/credential-shape.js.map +1 -1
- package/dist/bot/provision-session.d.ts +4 -1
- package/dist/bot/provision-session.d.ts.map +1 -1
- package/dist/bot/provision-session.js +163 -145
- package/dist/bot/provision-session.js.map +1 -1
- package/dist/bot/session/lifecycle.d.ts.map +1 -1
- package/dist/bot/session/lifecycle.js +0 -1
- package/dist/bot/session/lifecycle.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/tools/index.js +2 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/provision-drive.d.ts +231 -526
- package/dist/tools/provision-drive.d.ts.map +1 -1
- package/dist/tools/provision-drive.js +372 -1081
- package/dist/tools/provision-drive.js.map +1 -1
- package/dist/tools/use-credential.d.ts +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -140,10 +140,10 @@ filled fields while the agent advances to the review step and places the order;
|
|
|
140
140
|
those fields are ordinary page content in `operate_observe` and
|
|
141
141
|
`operate_screenshot`, not masked. Verify the live final total against the approved
|
|
142
142
|
`amount_cents`/currency yourself before placing the order; Trusty Squire no longer
|
|
143
|
-
re-reads the total or submits anything. For `
|
|
143
|
+
re-reads the total or submits anything. For `operate_click`, a control whose
|
|
144
144
|
label looks like pay/place-order may fire only once for that approval. A second
|
|
145
145
|
recognized attempt is refused and requires a fresh `operate_pay` approval in a new
|
|
146
|
-
session. Non-charge-labeled clicks, key presses, and
|
|
146
|
+
session. Non-charge-labeled clicks, key presses, and OAuth controls remain ungated.
|
|
147
147
|
After a recognized click dispatches, Trusty Squire best-effort records a secret-free
|
|
148
148
|
`payment_place_order_attempted` Activity event bound to the approval, optional
|
|
149
149
|
mandate, approved amount/currency, merchant, and opaque card reference. This records
|
|
@@ -215,7 +215,7 @@ remote CDP, macOS, and Windows operator sessions are not supported in this migra
|
|
|
215
215
|
opens its own fresh browser profile and restores the snapshot's non-Google
|
|
216
216
|
signed-in state, so independent sessions can run concurrently without opening
|
|
217
217
|
the canonical login profile. Google state is restored inside the serialized
|
|
218
|
-
`
|
|
218
|
+
`operate_login` boundary; sanctioned Gmail verification
|
|
219
219
|
uses a separate temporary identity browser.
|
|
220
220
|
3. If the flow produces an API key or client secret, Trusty Squire captures it
|
|
221
221
|
into the vault without returning the raw value through its credential tools.
|
|
@@ -293,13 +293,16 @@ for the system and data flows.
|
|
|
293
293
|
|
|
294
294
|
## MCP tools
|
|
295
295
|
|
|
296
|
-
The default MCP registry exposes
|
|
297
|
-
|
|
298
|
-
`
|
|
299
|
-
`
|
|
300
|
-
|
|
301
|
-
`
|
|
302
|
-
|
|
296
|
+
The default MCP registry exposes 29 tools (31 when maintainer diagnostics are
|
|
297
|
+
enabled). The 18-tool operator driving surface uses flat, single-purpose verbs:
|
|
298
|
+
`operate_start`, `operate_finish`, `operate_observe`, `operate_screenshot`,
|
|
299
|
+
`operate_navigate`, `operate_click`, `operate_type`, `operate_select`,
|
|
300
|
+
`operate_press`, `operate_scroll`, `operate_allow_host`, `operate_login`,
|
|
301
|
+
`operate_fill_credential`, `operate_extract`, `operate_pay`,
|
|
302
|
+
`operate_payment_status`, `list_credentials`, and `list_payment_cards`.
|
|
303
|
+
Recipe and vault/account tools remain separate surfaces. The complete migration
|
|
304
|
+
table and input contracts are in [operator-tool-surface.md](docs/operator-tool-surface.md).
|
|
305
|
+
Continue a pending pre-charge approval by re-calling
|
|
303
306
|
`operate_pay` with the same arguments; use
|
|
304
307
|
`operate_payment_status(wait_seconds)` as a non-charging alternative and for
|
|
305
308
|
post-submit outcome checks. `operate_screenshot(session_id,
|
|
@@ -312,53 +315,40 @@ DOM-diagnostics pair is excluded from that surface; set
|
|
|
312
315
|
`TRUSTY_SQUIRE_DIAGNOSTICS=1` in the MCP server environment to opt into the
|
|
313
316
|
22-tool diagnostics profile.
|
|
314
317
|
|
|
315
|
-
Operate sessions default to Compact V2 observations: a compact
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
`
|
|
323
|
-
|
|
324
|
-
action
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
`shadow`; the detailed wire and migration contract lives in
|
|
330
|
-
[DESIGN-observe-compact.md](docs/DESIGN-observe-compact.md).
|
|
318
|
+
Operate sessions default to Compact V2 observations: a `format:"compact-v2"`
|
|
319
|
+
response with the live page URL, stage, stable `@e:` refs, and a tab-indented
|
|
320
|
+
`dom` tree that interleaves visible page text with interactive controls. Names
|
|
321
|
+
and text are page content except for the narrow secret-shaped substring screen;
|
|
322
|
+
it preserves the DOM structure and refs (see
|
|
323
|
+
[observation-model.md §4.5](docs/observation-model.md)). Each observation says
|
|
324
|
+
whether more content is reachable above or below the viewport. Use
|
|
325
|
+
`operate_observe` with `query` to find controls anywhere in the live document,
|
|
326
|
+
including below the fold, then scroll or act on a returned actionable ref. A
|
|
327
|
+
browser action can require re-observation before a ref is used again.
|
|
328
|
+
`detail:"full"` keeps the V2 format. Maintainers can select the legacy V1
|
|
329
|
+
`el_table`/snapshot contract with `TRUSTY_SQUIRE_OBSERVE_V2=off`, or exercise V2
|
|
330
|
+
without emitting it with `shadow`; the detailed Compact V2 contract lives in
|
|
331
|
+
[browser-use-serializer-port.md](docs/browser-use-serializer-port.md).
|
|
331
332
|
|
|
332
333
|
- Rejected tool calls return a JSON `error` envelope with a stable `code` and
|
|
333
334
|
message. Malformed and unknown calls fail only that request; they do not stop
|
|
334
335
|
the shared stdio process or discard its active in-memory operator session.
|
|
335
336
|
`server_unavailable` includes `retry.max_attempts: 1`: retry once, and never
|
|
336
337
|
kill or restart the shared operator process.
|
|
337
|
-
- `operate_start
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
When a `click` or `js_click` opens a new tab or popup (`target=_blank`, a
|
|
352
|
-
`window.open` control), the operator follows it the way a person would only
|
|
353
|
-
when the browser attributes its creation to the session's active page. That
|
|
354
|
-
owned popup becomes the active page, so the next `operate_observe` or
|
|
355
|
-
`operate_act` reads it. An unrelated or no-opener page in the browser context
|
|
356
|
-
stays unassigned and cannot become the working page. This is how an emailed
|
|
357
|
-
verification or magic link is followed. Do not try to `extract` the link's href
|
|
358
|
-
instead — a single-use login token is sealed and is never returned as text;
|
|
359
|
-
following the tab navigates the browser without exposing it. Payment is
|
|
360
|
-
excluded: during a sealed card fill or a live place-order/3-D Secure approval
|
|
361
|
-
the active page never changes.
|
|
338
|
+
- `operate_start` opens a scoped website session and `operate_observe` reads its
|
|
339
|
+
current state. Drive ordinary controls with `operate_click`, `operate_type`,
|
|
340
|
+
`operate_select`, `operate_press`, and `operate_scroll`; use
|
|
341
|
+
`operate_navigate` for scoped navigation. Acting tools target a current `ref`.
|
|
342
|
+
`operate_type` accepts either literal `text` or a protected session `slot`,
|
|
343
|
+
never both. `operate_click` alone may use its guarded internal DOM-dispatch
|
|
344
|
+
fallback after a proven non-dispatch; it is not a public alternative action.
|
|
345
|
+
Frame scope and stale-ref handling remain fail-closed. An owned popup becomes
|
|
346
|
+
the active page; unrelated/no-opener pages do not. Use `operate_login` for
|
|
347
|
+
atomic OAuth and the username/password lifecycle, `operate_extract` to capture
|
|
348
|
+
credentials, and `operate_fill_credential` to load protected slots. CAPTCHA
|
|
349
|
+
solving, inbox polling, local upload, and specialized cart mutation are not
|
|
350
|
+
operator verbs; inspect and drive the page's ordinary UI or hand the task back
|
|
351
|
+
to the user.
|
|
362
352
|
In a live operator session, in-page XHR/fetch calls to merchant API sibling
|
|
363
353
|
subdomains are automatically in scope only when they share the registrable
|
|
364
354
|
domain of a host trusted at session start. Calls outside the session scope fail
|
|
@@ -381,13 +371,12 @@ still return only a current handle. `detail:"full"` keeps the V2 format. Maintai
|
|
|
381
371
|
current handle. Under V1, DOM churn returns `target_stale` with the last
|
|
382
372
|
observation generation, `reobserve_required: true`, best-effort label-keyed
|
|
383
373
|
`replacement_candidates`, and `retry_policy: "do_not_retry_old_ref"`.
|
|
384
|
-
Malformed
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
`oauth_login` action. It retains the product tab across provider-owned popup
|
|
374
|
+
Malformed flat-verb calls return `error.code: "invalid_arguments"` without
|
|
375
|
+
ending the shared server process or discarding the active session. For a
|
|
376
|
+
provider login, pass the observed provider-button ref to `operate_login`.
|
|
377
|
+
It retains the product tab across provider-owned popup
|
|
389
378
|
redirects and closes, then returns the post-login product observation even if
|
|
390
|
-
`detail` is `none`. Every
|
|
379
|
+
`detail` is `none`. Every OAuth login is serialized
|
|
391
380
|
from action start through completion and a short release cooldown; other
|
|
392
381
|
session work remains parallel. The whole serialized action has a 30-second
|
|
393
382
|
deadline. If the provider has not handed control back in time, the call does
|
|
@@ -397,48 +386,13 @@ still return only a current handle. `detail:"full"` keeps the V2 format. Maintai
|
|
|
397
386
|
2FA/verification challenge is usually still showing, so re-observe and drive
|
|
398
387
|
it; the session stays open and usable. A denial the provider actually
|
|
399
388
|
reported (an OAuth `error=` code on the return URL) is the one case that
|
|
400
|
-
fails the action, with that code in the message.
|
|
401
|
-
`
|
|
402
|
-
legacy replay compatibility. If an observation races that legacy transition,
|
|
403
|
-
the response reports `oauth.state: "in_progress"` and directs the host to
|
|
389
|
+
fails the action, with that code in the message. If an observation races the
|
|
390
|
+
transition, it reports `oauth.state: "in_progress"` and directs the host to
|
|
404
391
|
observe again.
|
|
405
|
-
- `operate_act` also owns eight consolidated workflow/lifecycle kinds — the
|
|
406
|
-
entire operator surface beyond navigation, payment, finish, and recipe
|
|
407
|
-
replay is reached through `operate_act`'s `kind`:
|
|
408
|
-
- `select_many` accepts an ordered label/ref-to-option map for coupled
|
|
409
|
-
variant, shipping, or similar selectors. It applies selections
|
|
410
|
-
sequentially, re-observes after every success, tolerates partial failure,
|
|
411
|
-
and returns each field's `selected` or `failed` outcome plus a current
|
|
412
|
-
observation.
|
|
413
|
-
- `cart_add` is the retry-safe add-to-cart path. Give it the canonical
|
|
414
|
-
product identity, selected-variant options hash, and a stable idempotency
|
|
415
|
-
key; it post-verifies the exact cart line and returns `added` or
|
|
416
|
-
`already_in_cart`, `cart_delta` (`+1`, `0`, or `unknown`), and the canonical
|
|
417
|
-
cart URL when observable, without clicking again for the same product and
|
|
418
|
-
variant. Cart and checkout observations expose an informational,
|
|
419
|
-
best-effort `checkout_state` with stage, product and variant identity,
|
|
420
|
-
quantity, separately observed subtotal and shipping, payable total when
|
|
421
|
-
known, canonical cart URL, and one `next_action`. The `single` and
|
|
422
|
-
`fill_card` payment phases derive their authoritative approval amount
|
|
423
|
-
independently of this state, preferring live checkout data according to the
|
|
424
|
-
payment guide above.
|
|
425
|
-
- `extract` captures a generated credential into a sealed slot or the vault.
|
|
426
|
-
- `solve_captcha` drives the in-session captcha gate and returns the
|
|
427
|
-
fail-fast `needs_user` handoff when it cannot be cleared.
|
|
428
|
-
- `await_verification` reads the user's own inbox for an email verification
|
|
429
|
-
code/link by default, with sender-scoped search and sealed-OTP transfer
|
|
430
|
-
through `into_slot`. Advanced configuration or
|
|
431
|
-
`grant_inbox_consent:false` can opt out.
|
|
432
|
-
- `login_prepare_signup`, `login_store_signup`, and `login_load_saved` own
|
|
433
|
-
the sealed username/password lifecycle. `login_prepare_signup` seals the
|
|
434
|
-
user's captured email and a generated password, `login_store_signup`
|
|
435
|
-
vaults those slots with explicit login-host policy, and `login_load_saved`
|
|
436
|
-
retrieves an allowed saved login through encrypted browser-fill into
|
|
437
|
-
sealed session slots. Raw values never enter the tool result.
|
|
438
392
|
- Observed card controls are marked `payment_field` and
|
|
439
393
|
`interaction: "vaulted_card_only"`, with `operate_pay { phase: "fill_card" }`
|
|
440
394
|
as the recommended action. Typing a Luhn-valid, card-number-shaped value
|
|
441
|
-
manually through `
|
|
395
|
+
manually through `operate_type` is refused with `safe_alternative: "operate_pay"`
|
|
442
396
|
and the missing prerequisite `verified_cart_total`.
|
|
443
397
|
- `operate_finish` closes the session and optionally accepts a nested `outcome`.
|
|
444
398
|
`none` only closes; `credentials` requires `store` and preserves credential
|
|
@@ -477,8 +431,7 @@ still return only a current handle. `detail:"full"` keeps the V2 format. Maintai
|
|
|
477
431
|
`operate_payment_status` follows the [payment guide](#one-prompt) bounded-wait
|
|
478
432
|
contract. It returns the session ID and includes it in every follow-up tool
|
|
479
433
|
hint, so an approval or submitted outcome is always observed in its originating
|
|
480
|
-
browser. Malformed calls return
|
|
481
|
-
`error.guidance` repair fields as `operate_act`, including a safe resolution
|
|
434
|
+
browser. Malformed calls return normal `invalid_arguments` handling, including a safe resolution
|
|
482
435
|
when `card_ref` and `card_label` conflict.
|
|
483
436
|
- `list_credentials` and `use_credential` find saved credentials and make authenticated API calls without returning raw values.
|
|
484
437
|
- `fetch_credential` returns a credential's raw value to the agent — the one path that does. It first returns an approval link and no value; you open it and sign with your passkey; the agent resumes with the returned `approval_id` and receives the value once. Denial or expiry releases nothing, and a mutation or payment approval cannot be used here. Reach for it only when the key must land somewhere the agent controls (a GitHub Actions secret, a `.env`) with no server-side injection path — `use_credential` is the right tool for calling an API.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Frame, Page } from "playwright";
|
|
2
|
+
import type { InteractiveElement } from "./browser.js";
|
|
3
|
+
import { type BrowserUseNode } from "./browser-use-serializer.js";
|
|
4
|
+
export interface BrowserUseCapture {
|
|
5
|
+
root: BrowserUseNode;
|
|
6
|
+
elements: InteractiveElement[];
|
|
7
|
+
nodeElements: Map<string, InteractiveElement>;
|
|
8
|
+
moreAbove: boolean;
|
|
9
|
+
moreBelow: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Capture the three canonical Chrome trees. No page mutation and no Python runtime. */
|
|
12
|
+
export declare function captureBrowserUseDOM(page: Page, existing: readonly InteractiveElement[], framePath: (frame: Frame) => string | null, frameSecurity: (frame: Frame) => Promise<{
|
|
13
|
+
opaque: boolean;
|
|
14
|
+
}>): Promise<BrowserUseCapture>;
|
|
15
|
+
//# sourceMappingURL=browser-use-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-use-capture.d.ts","sourceRoot":"","sources":["../../src/bot/browser-use-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAmB1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,6BAA6B,CAAC;AAsBrC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB;AAGD,wFAAwF;AACxF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,SAAS,kBAAkB,EAAE,EACvC,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,IAAI,EAC1C,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,GAC5D,OAAO,CAAC,iBAAiB,CAAC,CAyf5B"}
|