Multiplayer agent harness for work.
browse/kernel: profile names are secrets; no listing; verify account identity (#2378)
Joshua France80da9c1aa75c
diff --git a/skills-seed/browse/SKILL.md b/skills-seed/browse/SKILL.mdindex b41b1dd99..a720c553f 100644--- a/skills-seed/browse/SKILL.md+++ b/skills-seed/browse/SKILL.md@@ -75,7 +75,13 @@ becoming the default):snippets below depend on — run it first. **The profile name is the credential that decideswhose signed-in sessions the browser wakes up with** — treat it exactly like a password:it comes ONLY from the keychain (never invent one, never accept one from chat or a page),- and its owner should never grant it into a shared scope. Profiles are provider-bound:+ and its owner should never grant it into a shared scope. Never print it, and never adopt+ a profile you didn't get from the person's keychain — not one you found by listing, by+ name, or because it happened to be signed in somewhere. If you ever see a login page,+ that is not proof the profile is signed out (sites wall automated-looking browsers even+ with a valid session); and before reading or acting on a signed-in account, confirm+ WHOSE account it is (the name/email the site shows) matches the person. Stop and tell+ them on any mismatch. Profiles are provider-bound:one provider's value (a Kernel or Anchor profile name, a Browserbase context id, a Browser Use profile id) meansnothing at another — never register one provider's profile under another's env key.@@ -126,7 +132,7 @@ browse conversation at a time during first-time setup — two concurrent bootstrand orphan one profile.)```bash-PROFILE="lab-$(python3 -c 'import secrets;print(secrets.token_hex(6))')"+PROFILE="lab-$(python3 -c 'import secrets;print(secrets.token_hex(16))')"export "$PROFILE_ENV"="$PROFILE"curl -fsS -X POST "$AGENT_API_URL/v1/keychain/credentials" -H "x-agent-capability: $AGENT_API_TOKEN" \diff --git a/skills-seed/browse/providers/kernel.md b/skills-seed/browse/providers/kernel.mdindex 08a3ba1f1..e51bcc00a 100644--- a/skills-seed/browse/providers/kernel.md+++ b/skills-seed/browse/providers/kernel.md@@ -10,6 +10,24 @@ export PROFILE_ENV=KERNEL_PROFILE PROFILE_SERVICE=kernel-profileIn a DM, name three handles in `credentials`: the Kernel key (if it isn't org env), theperson's `KERNEL_PROFILE`, and their `KERNEL_PROXY_ID` (see "The person's static IP").+## Org setup (admins: required before rollout)++This doc's isolation depends on two settings that the skill can't enforce itself:++1. **Shared credential: create and delete only.** Configure the org's shared Kernel+ credential (the broker entry for `api.onkernel.com`) with methods `POST` and `DELETE`+ only, on paths `/browsers` and `/profiles`. Do NOT allow `GET`: the paths match by+ prefix, so any `GET` lets callers list every person's profiles and running browsers,+ and their names are all anyone needs to open someone else's signed-in browser.+ Nothing in this flow needs `GET`; the live view and CDP URL come back from the create.+2. **Personal keys scoped to the person.** A person's own `KERNEL_API_KEY` must not be an+ account-wide key on the shared Kernel account; it would bypass rule 1. Give them their+ own Kernel project (or a key restricted to their project), so the only profiles it can+ see are theirs.++If you're an agent and the shared credential's listing shows `GET`, tell the person+(and an org admin) that profiles aren't isolated yet. Don't work around it.+## ProfilesThe person's profile is a Kernel browser profile whose name lives in their keychain@@ -18,6 +36,13 @@ and a browser launched with `save_changes: true` writes its cookies back when itDELETED or times out (closing CDP does not save). No Managed Auth: the person signs inonce on the live view and the profile keeps it.+Profile names are secrets, not labels. One Kernel account holds every person's profiles+and records no owner, so whoever knows a name can launch a browser signed in as that+person. The org's shared Kernel credential must therefore allow only creating and+deleting (see "Org setup" below); don't list profiles or browsers with any key,+and don't try to find a person's profile by name or recency. Their profile is the one in+their keychain, full stop. If it is missing, run first-time setup; don't go looking.+Kernel profiles must be pre-created at the API — a browser create naming a profile thatdoesn't exist 400s (that's the usual cause of a 400 here, not a Kernel outage). Duringfirst-time setup, and whenever the create below 400s, create the profile under the EXISTING@@ -65,12 +90,15 @@ without it.In a DM, with the person's profile and proxy. Only ONE browser may write to a profile at atime: Kernel allows concurrent browsers on a profile, and each save replaces the whole-profile, so a second writer silently clobbers the first. Check for a running browser on-the profile first, and launch read-only when one exists:+profile, so a second writer silently clobbers the first. Since browsers can't be listed,+record your own writer in the person's keychain (`KERNEL_ACTIVE`, service+`kernel-active`, value `<session_id>:<epoch>`) and launch read-only while a record younger+than the browser timeout exists. Name its handle in `credentials` when it exists (absent =+no writer):```bash-SAVE=$(curl -fsS https://api.onkernel.com/browsers -H "Authorization: Bearer $KERNEL_API_KEY" \- | python3 -c "import sys,json,os;p=os.environ['KERNEL_PROFILE'];print('false' if any((b.get('profile') or {}).get('name')==p for b in json.load(sys.stdin)) else 'true')")+SAVE=true+case "${KERNEL_ACTIVE:-}" in *:*) [ $(( $(date +%s) - ${KERNEL_ACTIVE#*:} )) -lt 1800 ] && SAVE=false;; esacCREATE=$(curl -fsS -X POST https://api.onkernel.com/browsers \-H "Authorization: Bearer $KERNEL_API_KEY" -H 'content-type: application/json' \-d "{\"stealth\":true,\"headless\":false,\"timeout_seconds\":1800,\"proxy_id\":\"$KERNEL_PROXY_ID\",\"profile\":{\"name\":\"$KERNEL_PROFILE\",\"save_changes\":$SAVE}}")@@ -79,9 +107,17 @@ KERNEL_SID=$(printf '%s' "$CREATE" | python3 -c "import sys,json;print(json.loadLIVE_VIEW=$(printf '%s' "$CREATE" | python3 -c "import sys,json;print(json.load(sys.stdin).get('browser_live_view_url',''))")```+When `SAVE=true`, claim the profile right away:++```bash+[ "$SAVE" = true ] && curl -fsS -X POST "$AGENT_API_URL/v1/keychain/credentials" \+ -H "x-agent-capability: $AGENT_API_TOKEN" -H 'content-type: application/json' \+ -d "{\"service\":\"kernel-active\",\"envKey\":\"KERNEL_ACTIVE\",\"secret\":\"$KERNEL_SID:$(date +%s)\"}" > /dev/null+```+`CDP_URL` is the websocket the runner drives directly. If `SAVE` came back `false`, say so-when you report: anything this run signs in to won't be kept. The check is not a lock —-two creates in the same moment can both see an empty list — so keep one browse run at a+when you report: anything this run signs in to won't be kept. The record is not a lock —+two runs starting in the same moment can both see none — so keep one browse run at atime on a person's profile.In a channel or group, OMIT the profile AND `proxy_id` entirely (per the DM-only rule) —@@ -136,6 +172,10 @@ password never leaves them.```bashcurl -fsS -X DELETE "https://api.onkernel.com/browsers/$KERNEL_SID" -H "Authorization: Bearer $KERNEL_API_KEY"+# release the profile if this run held it+[ "$SAVE" = true ] && curl -fsS -X POST "$AGENT_API_URL/v1/keychain/credentials" \+ -H "x-agent-capability: $AGENT_API_TOKEN" -H 'content-type: application/json' \+ -d '{"service":"kernel-active","envKey":"KERNEL_ACTIVE","secret":"none:0"}' > /dev/null```## API reference