feat(extension): experimental Jev WebMCP tool selection in act() - #2988
Draft
miguelg719 wants to merge 6 commits into
Draft
miguelg719 wants to merge 6 commits into
miguelg719 wants to merge 6 commits into
Conversation
🦋 Changeset detectedLatest commit: 676e2fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
miguelg719
added this pull request to stack #2966
September 19, 2026 21:22
miguelg719
force-pushed
the
jev/6-webmcp-tools
branch
from
September 21, 2026 21:13
e2fa5b2 to
6917e74
Compare
miguelg719
force-pushed
the
jev/6-webmcp-tools
branch
from
September 21, 2026 21:35
992bd46 to
56e41ee
Compare
…ulative arguments
…eep intent trace intact
miguelg719
force-pushed
the
jev/6-webmcp-tools
branch
from
September 21, 2026 21:46
56e41ee to
676e2fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
Stack: #2951 snapshot editable ids → #2952 library → #2953 act pipeline → #2954 observe + cache check → #2955 extract → this PR (6). Base:
jev/5-extract.Why
A page that registers WebMCP tools has already said what it can do. "Which of these tools fulfils the request" is a closed-set choice, which is what Jev answers in ~250 ms, and most tool arguments are words of the instruction (a span Jev can point at) or an enum/boolean. So
act("put 2 of item p_102 in my basket")can call the page'sadd_to_cartinstead of hunting for buttons.Opt-in:
experimentalJevAct.tools(default off). Sends tool names, descriptions and parameter names to TypeSafe.What
act()waits for the DOM to settle, and the tool questions ride in the intent request every Jev act already makes (pipeline.ts). A page without tools adds no question; a page with tools adds no request.jevAct/tools.ts: builds and reads those questions.tool_best,tool_strict(with "none of these"), and a guard: does the instruction name a control? "click the Add to cart button" always takes the element path even whenadd_to_cartexists; the user asked for a click. A tool is used only at ≥ 0.8 with none ≤ 0.2.queryandcategory).inference.toolArguments) for what is not a span (ISO dates, lists, nested objects): one tool in the prompt, not the catalog. The tool's own schema is the response format when every property is required; otherwise the input travels as a JSON string, because strict structured-output providers reject optional properties (found live with OpenAI). When the schema alone shows the lexical favourite will need this call, it starts alongside the Jev request.jevAct/toolAct.ts: invokes and waits. Once a tool was invoked the act is over, success or error; it never also clicks through the UI. Any doubt before that → the ordinary act continues from the intent it already has.ActResultwhose action is{ method: "webmcp", selector: "webmcp:<tool>", arguments: [<input JSON>] }with the tool output inmessage. Not cached (replay only knows element actions). Skipped for locator-scoped acts.%variables%are redacted towards TypeSafe, resolved only for the invocation, and returned as placeholders.EVAL_JEV_TOOLS=1. No SDK example: the example-parity rule wants one per language and the switch is TS-env only, so the usage snippet lives injevAct/README.md.Results
Offline (not part of this PR): 166 tool descriptors harvested through
page.tools()from six live sites (five from the webmcp.com directory, 9–57 tools each, plus our test site); 379 requests written by claude-sonnet-5 (direct + indirect phrasing per tool, plus 48 requests no tool can do, half near-misses). Tools were not invoked.Baseline for scale: gemini-3.8-flash with the full catalog, thinking off: 364/378 (96.3%) tool + arguments right, p50 1.38 s.
Live, local Chrome, caller-side time for the whole
act()(with #2993's settle overlap / without):Caveats: synthetic single-turn requests; thresholds were picked on this set; a request Jev is unsure about goes to the element path, not to an LLM tool chooser. The gain over an LLM is smaller than for element acts because a tool catalog is a small prompt; the bigger win is skipping UI work altogether.
Testing
jevTools.test.ts(stubbed Jev, throughrunJevActPipeline): no-input tool inside the intent request, span/enum/number filling in the same request, second request for a non-favourite winner, control guard, none / split choice, argument-LLM hand-off and skip without it, speculative argument call starts before Jev answers, one span in two parameters, missing required argument, variable redaction + resolution, tool error ≠ UI fallback, no WebMCP support adds no question;toolArgumentsschema-shaped and JSON-string routes. Full extension/protocol/sdk-ts/root suites, typecheck, lint, fmt,extensionpack --checkpass locally. Live runs above.