Skip to content

Reposition feature as a generic communication tool? #236

Description

@jakearchibald

I only read through the spec and explainers on a plane, so apologies if this is stuff that's already been discussed.

I wonder if it would be better to reposition this idea as a general way to call functions in other environments.

Right now, it's a pain in the arse to do simple function calls between environments (windows, workers, etc). So much so, that there are popular libraries to try and make it easier.

When I was looking at the API, I thought "haha I could totally abuse this to be like a built-in comlink", but then I thought "maybe it doesn't have to be an abuse".

Let's say the whole tool registering thing is just a way for one environment to expose function calls to another. Then, add in the ability to expose particular functions to particular other origins. There's your comlink.

Then, add in the ability to expose particular functions to "the browser" - this would make the function available via WebDriver, and whatever tooling the browser chooses to provide. This is where the schema and description comes in. This means the browser could expose this functionality via its own interface, and build a form for the parameters. Or, sure, an LLM could do all that transparently. I think it might be an easier sell like this - the LLM capability just falls out of the other capabilities provided.

Developers could simply use this as an easier way to call functions in a worker - nothing to do with LLMs. Or they could do it to expose site functionality to the outside world.

A service worker could register functions at install time, meaning these things can be callable without a window open. They may choose to open a window (or interact with another window). All they'd be doing is calling (probably private) tools on the window. With some feature that allows a tool to return "don't return until I've navigated and the next page is dom-ready" - now you have a single public tool in a service worker that can perform MPA automations.

Just don't call it Web Intents I guess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions