Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/agentenv-protocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,31 @@ are the profile's template. The base class adds:
- `files/choose {paths}`, files in `~/Uploads` for the file chooser open on it, which headless, and so
alone, it intercepts;
- `page/state`, the active tab's id, URL and title and the dialog or file chooser open on it.
- `cookies/get {urls?}`, `cookies/set {cookies}` and `cookies/delete {name?, domain?, path?}`, on its default
context, each cookie as Playwright's `storageState` has it, CDP's `Network.Cookie` fields (`name`, `value`,
`domain`, `path`, `expires`, `httpOnly`, `secure`, `sameSite`), so a storage state exported from Playwright loads
as is, and a partitioned cookie's `partitionKey` (`{topLevelSite, hasCrossSiteAncestor}`), without which it would
be another cookie. `get` returns the cookies a request to any of `urls` would send, as Playwright picks them, else
every one; `set` takes a `url`, or a `domain` and a `path` (`/` by default), and may carry `max_age` in place of
`expires`: seconds from when it's set, on the computer's clock, which the browser's cookies are judged by. It sets
them all at once, so a cookie the browser refuses leaves none set. `delete` removes every cookie with all the
fields it's given, every cookie with none, partitioned or not, and says how many. A cookie refused names its
fields, never its value;
- `local_storage/get {origins?}`, `local_storage/set {origins}` and `local_storage/clear {origins?}`, each origin
as `storageState` has it, `{origin, localStorage: [{name, value}]}`. CDP reaches an origin's local storage only
through a page of it, so each goes through a hidden page agentenv sends to the origin and serves itself, past any
service worker of the origin: the site gets no request and runs no script. The origins answered are as the browser
names them (`https://xn--bcher-kva.de` for `https://bücher.de`). With no `origins`, every origin a page or a
same-site frame loaded since its server started, and those agentenv set. A cross-site iframe's local storage is
partitioned under the site that embeds it, and isn't read, as Playwright's `storageState` doesn't read it either.
Agents' CDP connections see each hidden page come and go as a target of type `other`;
- `downloads/list` and `downloads/get {guid, write_namespace?}`, a download and, completed, its file: uploaded
under the `write_namespace` grant when there is one, else inline, as `data/get` returns files. Inline, the whole
file is read into memory and sent base64 in one answer, so a large one belongs under a grant.

The record's entries are the models in `agentenv_protocol.website_browser` (`OpenTab`, with the tab that opened
it as `opener`; `ClosedTab`; `Download`; `Dialog`; `LaunchEntry`; `BrowserRecord`), every field present and null
until it's known.
- `cdp {user}`, `user`'s CDP address once the browser is ready, `http_url` to discover from and
`ws_url` to connect to, both at the address the call reached it at with a token agentenv mints in
the path: the same one each time it's asked for. Through the driver they're under
Expand Down
984 changes: 0 additions & 984 deletions packages/agentenv-protocol/src/agentenv_protocol/website_browser.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""WebsiteBrowserEnvironment: a website browser as a computer app, run inside a computer or alone. A subclass says how
its build installs and starts; this class adds what agentenv owns, the same in both: its flags after the subclass's
command, the unattended-use policies, a CDP connection over the browser's debugging pipe, the settings every browser
takes, a fresh cache and the deploy's prompt answers at every launch, another window for a launch while it runs, its
skill and ``browser/v1`` on its card. It runs alone, headless, on a computer with no display, a browser computer's,
whose screen is its page; which site proxy it goes through comes from a variable agentenv sets, never from its
settings."""
from .control import (ACTIVE_CHECK_TIMEOUT_S, AGENT, AGENTENV, CAPTURE_TIMEOUT_S, DOWNLOADS, EXIT, HASH_CHUNK_BYTES,
PAGE_INPUT, PAGES, PIN_TIMEOUT_S, STOP, UNKNOWN, UNNAVIGATED_CAPTURE_TIMEOUT_S, UPLOADS,
BrowserControl)
from .devtools import MAX_MESSAGE_BYTES, PIPE_IN, PIPE_OUT, DevToolsError, DevToolsPipe
from .environment import (ALONE_BYPASS, BLOCK, BROWSER, COMPUTER_BYPASS, OWNED_FLAGS, POLICIES, READY_POLL_S,
SHM_MIN_BYTES, SITE_PROXY_ENV, SKILL, BrowserSettings, WebsiteBrowserEnvironment, Window)
from .shapes import (BrowserRecord, ClosedTab, Cookie, CookieToSet, Dialog, Download, LaunchEntry, OpenTab,
OriginStorage, PartitionKey, StorageItem, origin_of)

__all__ = ["ACTIVE_CHECK_TIMEOUT_S", "AGENT", "AGENTENV", "ALONE_BYPASS", "BLOCK", "BROWSER", "CAPTURE_TIMEOUT_S",
"COMPUTER_BYPASS", "DOWNLOADS", "EXIT", "HASH_CHUNK_BYTES", "MAX_MESSAGE_BYTES", "OWNED_FLAGS", "PAGE_INPUT",
"PAGES", "PIN_TIMEOUT_S", "PIPE_IN", "PIPE_OUT", "POLICIES", "READY_POLL_S", "SHM_MIN_BYTES",
"SITE_PROXY_ENV", "SKILL", "STOP", "UNKNOWN", "UNNAVIGATED_CAPTURE_TIMEOUT_S", "UPLOADS", "BrowserControl",
"BrowserSettings", "DevToolsError", "DevToolsPipe", "WebsiteBrowserEnvironment", "Window",
"BrowserRecord", "ClosedTab", "Cookie", "CookieToSet", "Dialog", "Download", "LaunchEntry", "OpenTab",
"OriginStorage", "PartitionKey", "StorageItem", "origin_of"]
Loading
Loading