johnandersen777.bsky.social/socialweb-computer-console
console.socialweb.computer: kcp, kubectl and ssh compiled to wasm in a browser tab with a terminal; a kcp fork
Per-VM atirc agent: opt-in cloud-init module, long token in the secrets bundle, events.guest.agentStart trigger, page + CLI (rev 6)
Context
The page (/Users/johnandersen777/src/kcp/wasm, branch kcp-wasm-memory-storage-1) signs alice in with atproto OAuth, requests a VM from the socialweb market, and gives it SSH-over-WebRTC plus a wootty web shell. We add an atirc agent per VM: a long atirc token minted when the VM request creates its RFP, named <handle-nick>-<rfp-rkey> (e.g. aliceoa-3l…), delivered through the existing requester-vault secrets bundle as ATIRC_TOKEN, and a guest systemd unit that runs the atirc README's root/new-account block and atirc agent run.
Rev 4 change (2026-10-29, user): the rev 3 trigger (an Agent button that ran a script over ssh over WebRTC, in tmux) invented a new pattern. Rev 4 follows the established wootty shell pattern (socialweb plan 0032, internal/atproto/cloudinit/tunnels.go) end to end:
| wootty (plan 0032) | atirc agent (this plan) |
|---|---|
opt-in per contract: spec.tunnels[].shell {envFile} | opt-in per contract: spec.agent {envFile} |
requester contractModules adds cloudinit.TunnelsModule | requester contractModules adds cloudinit.AgentModule |
wootty-<tag>.service + /usr/local/bin/wootty-run.sh, started by runcmd systemctl start --no-block, Restart=always, RestartSec=5, After=… SecretsReadyUnits | atirc-agent.service + /usr/local/bin/atirc-agent-run.sh, same unit shape, not started at boot |
requester→guest events (guest.signalWebRTC, guest.secrets): outbound ContractEvent → requester publishes → bidder checks (CheckGuestEvent, IsRequesterGuestEventNSID) and queues → guest agent receive | Agent button → outbound ContractEvent guest.agentStart → same path → guest agent runs systemctl start --no-block atirc-agent.service |
| run script waits for the secrets ready file and the binary, refuses a missing token | same |
binary from socialweb-guest-downloads via setup-guest-binaries.service; guestseed.GuestBinariesNeeded detects the unit path | same (atirc-<arch>; detection on atirc-agent.service) |
| token made by the page, only in the secrets bundle | token minted by the requester, written into the same bundle |
No ssh, no tmux, no rootfs bake. One new guest event type (events.guest.agentStart, user decision 2026-10-29, Option B: no harness spend until the user clicks).
User decisions (2026-10-29):
- atirc deployment
https://irc.fedfork.com(DIDdid:web:irc.fedfork.com, service#atirc); live/healthshows an iroh ticket,/.well-known/did.jsonmatches. - Add CORS to atirc, mirroring bsky.social PDS (verified: preflight 2xx,
access-control-allow-origin: *,access-control-allow-methods: GET,HEAD,PUT,PATCH,POST,DELETE,access-control-allow-headers: authorization,content-type,dpop; actual responses ACAO*). - Rev 4: trigger through user_data, not ssh.
- Rev 5: Option B — the unit is installed by user_data but started only by a requester-originated
events.guest.agentStartfrom the page's Agent button.
Repos and ownership:
- this repo — page JS, tests, wasm glue.
socialweb-computer-kcp— linux-kcp (peer agent; reached over atirc, nick containslinux-kcp) edits and re-deploys; we send requests and review. A change of this size gets a socialweb plan doc (docs/plans/0035-…yaml, the 0032 format), owned by linux-kcp.atirc— owned by atirc-dev (peer agent on the same atirc channel): CORS, irc.fedfork.com redeploy, versioned linux/amd64 binaries. linux/arm64 is out of scope for now (user).- Comms: atirc default channel
#johnandersen777_bsky_social, we post asmac-kcp. - aliceoa's agent harness on irc.fedfork.com is configured and working (user, 2026-10-29).
Design
1. atirc CORS (atirc repo; rebuild/redeploy irc.fedfork.com)
Unchanged from rev 3, still needed: the page's requester (Go in wasm, browser fetch) POSTs chat.atirc.mint cross-origin.
cli/Cargo.toml: addtower-http = { version = "0.6", features = ["cors"] }(0.6.11 already inCargo.lock; axum 0.8).cli/src/server/xrpc.rsrouter(): put/xrpc/*in a sub-router and layer only that sub-router (a whole-router layer would expose/u/{uuid}, which returns a long token, and/dl/*cross-origin):allow_origin(Any),allow_methods([GET, HEAD, PUT, PATCH, POST, DELETE]),allow_headers([header::AUTHORIZATION, header::CONTENT_TYPE, HeaderName::from_static("dpop")])— a fixed list;Anysends*, which Fetch does not apply toAuthorization.- tower-http answers preflight with 200 (not 204); Vary differs from bsky (harmless).
- Redeploy preserves the entire atirc data dir (
tokens/key,iroh/key,oauth/key,agents/<did>/config.toml,sessions/,links/,history/). The scratch Dockerfile sets no HOME, so setATIRC_DATA_DIRexplicitly and keepservice_endpoint. The deployment must include138d03b(persisted long-token key); tokens minted before it die on restart. Confirm the deployed commit/path with the owner.
2. OAuth scope (socialweb; request linux-kcp)
internal/atproto/oauth/scope.go: add to RequesterOAuthScope:
rpc:chat.atirc.mint?aud=did:web:irc.fedfork.com%23atirc
repo:com.publicdomainrelay.temp.compute.events.guest.agentStart?action=create&action=update
The repo: line (found by wasm-page, atirc seq 617): the requester publishes guest.agentStart as a record in its own repo, like guest.publicKey/guest.signalWebRTC/guest.secrets, which each have the same repo:…?action=create&action=update scope (collectionScope, beside CollectionGuestSecrets in scope.go); market.event is already granted.
Decided (linux-kcp + atirc-dev, 2026-10-30, atirc seq 587-588): exact aud, rpc:chat.atirc.mint?aud=did:web:irc.fedfork.com%23atirc; the requester calls getServiceAuth with aud did:web:irc.fedfork.com#atirc (same string; atirc verify accepts it and the bare DID). Proven at PAR/consent (2026-10-30 07:16:44Z, atirc seq 690): bsky.social granted the qr.fedfork.com client metadata holding this exact string plus the guest.agentStart repo scope (alice CLI sign-in). Proven end to end 2026-10-30 08:45:26Z (headless page run, socialweb 0ae1b2fd page build, rc120 bidders): the page requester's getServiceAuth with aud did:web:irc.fedfork.com#atirc minted aliceoa-3mz3fcnzk3b2k.aliceoa.bsky.social (requester_atirc_minted); no aud=* fallback needed. The build regenerates requester-scope.txt; existing sessions become ScopeChanged → fresh sign-in. Do not touch internal/app/compose/atprotoscope.go.
3. API: spec.agent (socialweb; request linux-kcp)
api/v1alpha1/types_computecontract.go, next to ComputeContractShell:
// spec.agent: run `atirc agent run` on the guest with ATIRC_TOKEN from the secrets bundle.
Agent *ComputeContractAgent `json:"agent,omitempty"`
type ComputeContractAgent struct {
EnvFile string `json:"envFile,omitempty" apigen:"userEndpoint,default=/etc/atirc/atirc.env"`
}
- Validation like the shell's:
spec.agentwithoutspec.secretsRefis invalid (the token comes only in the bundle). - Regenerate deepcopy/CRD/schemas; the page build syncs
socialweb-wasm/manifests(elsefield not declared in schema). - The page sets the contract through its EphemeralInfra template (plan 0029): verify the infra template schema/lexicon carries
agentthe way it carriestunnels; add it there if not.
4. Mint at VM request and persist it to the secrets bundle (socialweb; request linux-kcp)
Files: internal/market/requester/runner.go, identity.go (reuse q.oauthServiceAuth()), secrets.go, requester.go (Config), internal/services/requester/wiring.go (vault write capability).
Delivery is via the vault: the sealed fallback re-reads the OpenBao bundle (guestsecrets.go:119) and is the wasm default (Firehose + SecretsFallback: Sealed); secretsState.addEntries (replaces by path) only feeds the inbound route; the seal is one-shot and the receipt-resume path never re-runs requestOnce. Writing the minted entry into the bundle makes both delivery modes and reloads see it.
- Config default
AtircURL = "https://irc.fedfork.com"; audiencedid:web:irc.fedfork.com. - Wiring change is mandatory:
services/requester/wiring.go:200resolvesvault.CapabilityRead, and the read handle returnsErrReadOnlyon Write (controllers/vault/provider.go:262). Resolvevault.CapabilityWrite(the bidder's pattern,services/bidder/wiring.go:291; the write handle also reads). The write grant exists for<mount>/contracts/*(internal/app/marketrequester/marketrequester.go:183), which covers the page'scontracts/<name>/secrets. A write failure logs and is non-fatal. - New helper
(q *Requester) ensureAtircToken(ctx, contract, rfpURI string)— returns nothing; every failure logs and returns (an error would fail the contract viaRun):- Skip when
contract.Spec.Agent == nil(only opted-in contracts mint: long tokens are not revocable),contract.Spec.SecretsRef == nil,q.handle == ""(did:key/local identities have no handle), orq.oauthServiceAuth() == nil(nodeps.ServiceAuthwired) — log why. No identity-mode gate:oauthServiceAuth()(identity.go:46) only needsdeps.ServiceAuth, so it serves the page's OAuth identity and the CLI's PDS-account identity alike (section 7a). - Read the bundle (
q.readSecretsBundle); find the entry whose path isspec.agent.envFile; return if it has anATIRC_TOKEN=line with a non-empty value (line scan; theATIRC_TOKEN=\nplaceholder must not count). rfpURIempty → return.rkey= last path segment (a TID:createSigned→CreateSignedRecord);base= first dot-label ofq.handle, lowercased, capped to 14 chars;subhandle = base + "-" + rkey + "." + strings.ToLower(q.handle). atirc'snick_from_subhandlekeeps the label (≤32 with itsbot-prefix for a digit-leading label), so the nick is ≤32 chars, valid foruseradd.short = q.oauthServiceAuth().ServiceAuth(ctx, "did:web:irc.fedfork.com", "chat.atirc.mint"). atirc rejects replay; do not retry with the same token.POST <AtircURL>/xrpc/chat.atirc.mint,Authorization: Bearer <short>, JSON{"subhandle": …}, onq.deps.HTTPwith a bounded timeout; parsetoken.- Merge by path (
envFile, valueATIRC_TOKEN=<token>\n, mode0600),kv.Write(ctx, ref.Mount, ref.Path, map[string]any{"bundle": text})(Write replaces the data map;bundleis its only key). If a live runner exists (q.runnerFor), alsoaddEntriesafter nil-checking itssecretsState(not restored on reload). - Log
requester_atirc_minted(never the token) orrequester_atirc_mint_failed(placeholder stays).
- Skip when
- Call sites:
requestOnce: after the RFP if/else and after thewriteStatus"the RFP is submitted" line (runner.go:393), with therfpURIdeclared at :367 (the resume branch fills it at :369).Run/resume: after theSecretsRef != nil && SecretsFetchedAt == ""block (runner.go:200-205); nil-guardcontract.Status.Contractand pass itsRFPURIwhen present.
- Timing: the mint runs right after the RFP, the guest boots after accept (40-72 s to Held), so the bundle normally carries the token before the guest asks. Race: the page dies between RFP and the vault write and a restored runner writes after the guest's sealed request was answered → the guest has the placeholder;
atirc-agent.servicekeeps restarting with a clear journal line until a reboot re-requests secrets. Note it.
5. Guest module atirc-agent.service (socialweb; request linux-kcp)
Files: internal/atproto/cloudinit/agent.go (new, beside tunnels.go), internal/market/requester/secrets.go contractModules (:426), internal/guestseed/binaries.go.
cloudinit.AgentModule(AgentOptions{EnvFile})(a constructor likeTunnelsModule), added incontractModuleswhencontract.Spec.Agent != nil.- Writes, in the wootty shape (
tunnels.go:219-240,unitFile):/etc/systemd/system/atirc-agent.service:[Unit]Description=atirc agent,After=network-online.target setup-guest-binaries.service <SecretsReadyUnits>,Wants=network-online.target setup-guest-binaries.service <GuestSecretsUnit>,StartLimitIntervalSec=0[Service]Type=simple,EnvironmentFile=-<envFile>,ExecStart=/usr/local/bin/atirc-agent-run.sh,Restart=always,RestartSec=5(wootty uses 5; consider 30 since a missing token does not heal quickly), journal output.
/usr/local/bin/atirc-agent-run.sh(root:root 0700), a Go raw string likewoottyRunScript:
Use the package constants (#!/usr/bin/env bash set -euo pipefail if [ ! -f "/run/socialweb-guest-agent/secrets.ready" ] && [ ! -f "<SecretsDoneStamp>" ]; then echo "atirc-agent: the secrets bundle is not written yet; the agent waits" >&2; exit 1 fi if [ ! -x /usr/local/bin/atirc ]; then echo "atirc-agent: /usr/local/bin/atirc is not installed yet (setup-guest-binaries.service); the agent waits" >&2; exit 1 fi if [ -z "${ATIRC_TOKEN:-}" ]; then echo "atirc-agent: ATIRC_TOKEN from the secrets bundle is empty (mint failed or pending); the agent waits" >&2; exit 1 fi export ATIRC_TOKEN nick="$(/usr/local/bin/atirc nick)" getent group wheel >/dev/null || groupadd wheel mkdir -p /etc/sudoers.d printf '%%wheel ALL=(ALL) NOPASSWD: ALL\n' > /etc/sudoers.d/wheel chmod 440 /etc/sudoers.d/wheel id "$nick" >/dev/null 2>&1 || useradd -m -G wheel -s /bin/bash "$nick" exec runuser -u "$nick" -- /usr/local/bin/atirc agent runGuestSecretsReadyPath,SecretsDoneStamp,GuestBinariesUnit) aswoottyRunScriptdoes.runuser -ucannot take--login, and-w/--whitelist-environmentonly applies to--login. Without login,runuser -ukeeps the environment (and sets HOME/USER/LOGNAME/SHELL for the target), soATIRC_TOKENpasses through with no-w. (The atirc README'srunuser -w ATIRC_TOKEN -u …has the same no-op flag; tell the atirc owner.)atirc agent runsets its own working directory (a 0700 temp dir) and runs the harness as<harness> -p <prompt>; no TTY or tmux needed. A user who wants to watch readsjournalctl -u atirc-agentor the atirc channel./etc/socialweb-guest-agent/agent.json(cloudinit.GuestAgentAgentPath = GuestAgentConfigDir + "/agent.json", root:root 0644), content{"unit": "atirc-agent.service"}— the same per-feature config file pattern astunnels.json/secrets.json; it tells the guest agent it may start that unit and makes the bidder install the guest agent.RuncmdPrepend:systemctl daemon-reloadonly. Nosystemctl startand noenable: the unit starts only onguest.agentStart(section 5a).
guestseed(binaries.go:110GuestBinariesNeeded): addGuestBinaryAtirc = "atirc"andGuestBinaryNeeds.Atirc; a write_files path equal tocloudinit.GuestAgentAgentPathsetsAgent = true(installs and startssocialweb-guest-agent.service, astunnels.json/secrets.jsondo) andAtirc = true, and appendsatirc-agent.servicetoout.Units;Names()/Any()include atirc.out.Unitsonly feedsBefore=ofsetup-guest-binaries.service(binaries.go:~230), so listing the unit orders the install before it and does not start it.
5a. events.guest.agentStart (socialweb; request linux-kcp)
A requester-originated guest event, wired exactly like guest.secrets/guest.signalWebRTC:
- Lexicon
lexicons/com/publicdomainrelay/temp/compute/events/guest/agentStart.json, modeled onsecretsRequested.json: record,key: any, requiredcreatedAt, optionalsignatures; description "The requester asks the guest agent to start the guest's agent unit (spec.agent); requester-originated only; carries no secret." Regenerateinternal/atproto/market/zz_generated.lexicons.go(ComputeEventsGuestAgentStartNSID,ParseComputeEventsGuestAgentStart, the record type). internal/atproto/market/guest.go:42IsRequesterGuestEventNSID: add it (not toIsGuestOriginatedEventNSID), so the bidder refuses it from a guest (guestidentity/service.go:329) and accepts it from the requester (market/bidder/guestevents.go:82).internal/guestidentity/guestrecord.go:388CheckGuestEvent: a case that parses it and checkscreatedAt(assecretsRequested).api/v1alpha1/types_contractevent.go:45: add the NSID to theContractEventSpec.NSIDenum; regenerate the CRD and sync the wasm manifests.- Requester (
internal/market/requester/contractevents.go):validateGuestFields(:61) accepts it with no kind/tag/key/ciphertext; the encode switch (:357) buildsmarket.ComputeEventsGuestAgentStart{CreatedAt: q.nowISO()};observeOutboundContractEvent(:221) refuses it (status message, no publish) when the owning contract has nospec.agent. - Guest agent:
internal/guestagent/wire.go:AgentStartNSID = nsidPrefix + "events.guest.agentStart".config.goLoadConfig: read optionalagent.json(AgentFile),{unit}; the unit must match^[a-z0-9][a-z0-9-]*\.service$orErrConfig.subscribe.go:168receive:case record.Type == AgentStartNSID:→ with no configured unit, log debug and ignore; else runsystemctl start --no-block <unit>(exec.CommandContext, bounded timeout) and logguest_agent_startwith the result (never the env file). Idempotent:systemctl starton a running unit is a no-op,a.seenand the persisted cursor stop replays across agent restarts.
- No guest reply event: the page reads the ContractEvent's own phase (
Published/Submitted) and the nick appears on the atirc channel. Aguest.agentStartedack (likesecretsApplied) is an addition for later if the page must show unit state. - AGENTS.md: list
guest.agentStartin the "Guest events live under …" bullet with the requester-originated ones.
6. atirc in socialweb-guest-downloads (socialweb; request linux-kcp)
Replaces rev 3's rootfs bake and tmux preinstall (neither is needed). The bidder installs the binary; the guest never fetches it from irc.fedfork.com, GitHub or the internet (AGENTS.md "Guest transports").
- Pin (atirc-dev, 2026-10-30, atirc seq 585):
https://irc.fedfork.com/dl/v0.1.0-9459165, sha2569eab39c20ec84d0df9f45b085fcb77eebd65f341b115a5f5db6ef2b595e67491, 39379048 bytes (identical to the live server binary). internal/versions/versions.json:guestDownloads.files.atirc.fetch["linux/amd64"]{url, sha256}of an immutable, versioned atirc linux binary (notirc.fedfork.com/dl/{arch}, which serves whatever binary is running). The atirc owner publishes versioned release binaries; the pin follows that, as wootty's does.scripts/build-guest-downloads.sh: add anatirc-x86_64block next towootty-<arch>(fetch_pinned/sha256 check). linux/arm64 is out of scope (user): pin onlylinux/amd64and skipatirc-aarch64with an explicit guard/log line; an aarch64 bidder then finds no atirc download andsetup-guest-binariesfails forspec.agentcontracts there (document amd64-only).- Re-release
socialweb-guest-downloads, update the bidder's pin, reinstall bidders (user step, as for any guest-downloads change).
7. This repo: page
Files: scripts/browser/vmshell.js, scripts/browser/app.js, scripts/browser/vmshell_test.js.
- Opt-in control in the Compute panel next to the Comms select: an "Agent" checkbox, stored in localStorage (
socialweb.compute.agent), default on (user, 2026-10-29). Show it only when the served schema hasspec.agent(aswoottyServed()gates wootty). Next to it, a link tohttps://irc.fedfork.com("set up your agent") where the user configures the harness the Agent button runs. vmshell.js:ATIRC_ENV = "/etc/atirc/atirc.env".secretsBundle({ woottyToken, agent })stays a JSON string (ContractSecrets.Bundleis a string):[...(woottyToken ? [{path: WOOTTY_ENV, value: "WOOTTY_AUTH_TOKEN=…\n"}] : []), ...(agent ? [{path: ATIRC_ENV, value: "ATIRC_TOKEN=\n", mode: "0600"}] : [])]. The placeholder keeps the bundle non-empty (both consumers reject an empty bundle) and gives the requester the path to fill.contractManifest/infraContract({ …, agent }): setspec.agent = {}andspec.secretsRefwhenagent || wootty; return thesecretentry in that case.
app.jsrequestVM: the vault put runs whenwootty || agent(hoisted out ofif (wootty)); wootty token generation stays conditional.vmshell_test.js: wootty-only (unchanged expectations), agent-only (one entry, path, mode0600, empty value,secretsRefset,spec.agentset), both (two entries), neither (nosecretsRef,secret === null).- Agent button (
app.jsshellAction:2698): shown when the contract is Held, hasspec.agent, and!computeReleaseAsked.has(contract.name). Click creates an outbound ContractEvent through the same helper the WebRTC signaling uses (webrtc_guest.jsbuilds{apiVersion: "socialweb.computer/v1alpha1", kind: "ContractEvent", metadata: {name}, spec}at :115 and creates it through kcp):name = <contract>-agent-<suffix>,spec = {contractRef: {name: contract}, nsid: NSID_AGENT_START}. Put the builder (agentStartEvent(contract, suffix)) andNSID_AGENT_STARTinvmshell.js(tested) or next to the signaling builders inwebrtc_guest.js— whichever already exports the ContractEvent builder; do not duplicate it. Log "asked <contract> to start the atirc agent"; disable the button while that event is not yetPublishedand show the event's phase/message (a requester refusal shows here). - No ssh, no
agentScript/agentCommand, norunInTerminalchanges.
7a. CLI request flow (socialweb; request linux-kcp)
User requirement (2026-10-30, atirc seq 413): agents launch from socialweb-computer run request too, not only the page. Same requester code (sections 4-5a); the CLI adds only the opt-in and the start command, in the existing run request / run request proxy shapes.
- Opt-in:
run request --agent[=<envFile>](cmd/socialweb-computer/request.go,requestOptions:47, parsed next to--tunnelat :306) setscontract.Agent = &ComputeContractAgent{EnvFile}; add it todeploy/apps/option-map.yamlnext tosecrets. - Bundle:
--agentneeds a secretsRef. At :1066-1143 the CLI reads--secretsandPutSecretswrites it to the invocation's own OpenBao atcontracts/<RequesterContract>/secrets(internal/stack/request/request.go:48, inside the requester's<mount>/contracts/*write grant). With--agent, merge an{path: <envFile>, value: "ATIRC_TOKEN=\n", mode: "0600"}placeholder into that bundle (creating a one-entry bundle when--secretsis absent), soSecretsRefis set andensureAtircTokenfills it. - Identity: the CLI's requester signs with its MarketIdentity (PDS account / app password, or OAuth);
deps.ServiceAuthyields thechat.atirc.mintservice-auth token either way (section 4 step 1 has no OAuth-only gate). A did:key/local identity has no handle → no mint, logged. - Start: new
run request agent <name>(main.go command map next to"run request proxy":83;openRequest(ctx, vals, rest, "agent")like ssh/proxy at :1386/:1422) creates the outbound ContractEvent throughinternal/stack/request/webrtc.goContractSignaling.create(:38, name prefixcli-): addfunc (s *ContractSignaling) PublishAgentStart(ctx) error { return s.create(ctx, "agent", v1alpha1.ContractEventSpec{NSID: v1alpha1.ContractEventNSIDGuestAgentStart}) }and theContractEventNSIDGuestAgentStartconstant besideContractEventNSIDGuestPublicKey. It waits for the event to bePublished(or prints the requester's refusal) and exits;run request --agent --holdusers run it after Held. - Tests: flag →
spec.agent; bundle merge (with/without--secrets, placeholder path/mode);run request agentcreates one outbound ContractEvent with the agentStart NSID for the invocation's contract. - OAuth logins for CLI tests: the
linux-kcp-drives-oauth-*agent drives OAuth sign-ins (user, alice, bob accounts, requester association) with the creds in~/.*_source. Existing mechanism, nothing new:run request … -- --atproto-oauth-qrsets the MarketIdentity'sstatus.pendingAction(scanQr/signInAgain,internal/marketidentity/atproto/oauth.go:292) tohttps://qr.fedfork.com/#oauth=<cliDID>&n=<nonce>(oauthclient/qr.go:182) and logs it; drives-oauth opens that URL and signs in; the qr page transfers the session to the CLI (service-auth to cliDID), which logssigned in as <handle>. The CLI writes no file for it. Reference:~/.tmp/0034/acc34.shsignin(), socialwebscripts/oauth-signin.ts. Test harness hook (linux host): drives-oauth's~/.tmp/drives-oauth/signin-watch.ts --log <request.log> --account ALICE|BOB [--pid <cli pid>]tails the CLI log, signs in for each newpendingActionURL, exits onsigned in as; a CLI test teesrun requestto a log and starts it (or asks drives-oauth on atirc with log path + account). (--test-owner-sessions-fileis the app-password alternative and excludes the oauth modes,requester.go:333.)
8. Scope fallback + build/deploy (this repo)
scripts/serve-public.tsREQUESTER_SCOPE(used byscripts/kcp_wasm.tsand as the missing-file fallback): regenerate from currentRequesterOAuthScope(already missing several scopes) so it includesrpc:chat.atirc.mint?aud=*.requester-scope.txtlives inbin/wasmandpublic/(build output): regenerate viabuild-page.shwithDEPLOY=1, or pass--scope-file.- Build/deploy: our page changes committed; linux-kcp's socialweb commit reachable in
SOCIALWEB_SRC;REV=<commit> DEPLOY=1 scripts/browser-dev/build-page.shwithMAIN_CHECKOUT=/Users/johnandersen777/src/kcp/wasmif built here. Production:scripts/deploy.shregenerates/oauth-client-metadata.json(owner step).
Coordination with linux-kcp (atirc)
Over atirc with the peer whose nick contains linux-kcp (rev 3 named the old NDJSON channel 192.168.0.20:7720). One request:
scope.go: addrpc:chat.atirc.mint?aud=*.spec.agentAPI (+ infra template carries it),cloudinit.AgentModule(+agent.json),contractModuleshook,guestseedatirc need/install. 2a.events.guest.agentStart: lexicon + generated code,IsRequesterGuestEventNSID,CheckGuestEvent, ContractEvent NSID enum, requester validate/encode/refuse-without-spec.agent, guest agentagent.json+receivecase.- requester:
AtircURLdefault;ensureAtircToken(only forspec.agent) with vault write-back; wiring resolves the vault write capability. - guest-downloads: atirc pin + build block; re-release; bidder pin.
4a. CLI (section 7a):
run request --agent[=envFile], bundle placeholder merge,run request agent <name>,PublishAgentStart, option-map entry. - A
docs/plans/0035-…yamlfor 2-4 and AGENTS.md lines (next to the wootty shell bullet, andguest.agentStartin the guest-events bullet). - Commit, report
REV; we build/deploy the page with our committed changes.
To atirc-dev (same channel): CORS on the /xrpc/* sub-router only (section 1), redeploy irc.fedfork.com with 138d03b+ and the data dir preserved, publish an immutable versioned linux/amd64 binary (URL + sha256) for the guest-downloads pin; confirm chat.atirc.mint accepts aud did:web:irc.fedfork.com from an OAuth-session service-auth token.
Verification
cd scripts/browser && deno test --allow-read --allow-net(bundle/manifest cases above).deno test --allow-read --allow-write scripts/serve-public_test.tswith a new assertion thatDEFAULT_SCOPE/loadScopeoutput containsrpc:chat.atirc.mint?aud=*(the current test comparesDEFAULT_SCOPEto itself).- socialweb (linux-kcp): unit tests for
AgentModuleoutput (unit/run-script/agent.jsonpaths,After=list, runcmd has nostart),GuestBinariesNeeded(agent + atirc onagent.json),contractModuleswith/withoutspec.agent, thespec.agentwithoutsecretsRefrefusal,ensureAtircTokenskip/idempotence with a fake vault + fake atirc server (placeholder vs real token),CheckGuestEvent+ direction (bidder refusesagentStartfrom a guest, accepts it from the requester), requester refusal withoutspec.agent, guest agentreceive(starts the configured unit via a fake runner; ignores withoutagent.json; a replayed event starts nothing new). - atirc CORS after redeploy: OPTIONS
/xrpc/chat.atirc.mintwithOrigin,Access-Control-Request-Method: POST,Access-Control-Request-Headers: authorization,content-type,dpop→ 2xx, ACAO*, ACAH has all three; OPTIONS/u/<x>has no ACAO (scoping proof)./health(iroh_ticket),/.well-known/did.json. - Build with linux-kcp's
REV;bin/wasm/requester-scope.txtand the live/oauth-client-metadata.jsoncontainchat.atirc.mint. Fresh sign-in (scope change) — PAR scopes must be a subset of the client metadatascope, and bsky.social caches client metadata ~10 min, so wait ~10 min after the metadata deploy (elseinvalid_scope … not declared in the client metadata). - Request VM with Agent checked; debug log shows
requester_atirc_minted. After Held, over the existing ssh (read only, our own terminal):systemctl is-active atirc-agentisinactive. Click Agent: the ContractEvent goesPublished; thensystemctl is-active atirc-agent,journalctl -u atirc-agent -n 20,stat -c '%a %U' /etc/atirc/atirc.env,grep -c '^ATIRC_TOKEN=.' /etc/atirc/atirc.env(nevercat: terminal output streams todebug.log). The nick appears on the atirc channel. - Request VM with Agent unchecked: no mint log, no
atirc-agent.service, no atirc binary installed. 7a. CLI:socialweb-computer run request --agent --hold …(identity signed in via the drives-oauth agent or an app password) →requester_atirc_minted;run request agent <name>→ eventPublished, nick on the channel;run request release <name>. - Release the VMs.
Decision (user, 2026-10-29)
Option B (on-demand start through events.guest.agentStart) over boot-start. Cost accepted: one new lexicon and ~6 typed touch points (section 5a).
Risks / open items
- Harness: configured by the user (works). It survives an irc.fedfork.com redeploy only if the data dir is preserved (atirc-dev). The harness installs claude with
curlat runtime: guest egress to claude.ai and the model endpoint is needed (observation for the user). - iroh
endpoint: tokens may carry an iroh ticket;agent runneeds guest UDP to the n0 relay. Observation for the user. - Long tokens are not revocable; VM release leaves them valid. Follow-up (linux-kcp → atirc-dev, 2026-10-30, atirc seq 741): mint takes an optional
exp(contract/release deadline) plus revoke-by-subhandle, and the requester revokes on release; tracked with plan 0036. Only opted-in contracts mint; the idempotent vault check prevents duplicate mints on reload. - linux/arm64 out of scope → amd64 guests only.
- Agent on by default → every VM request mints a non-revocable token (user accepted).
- Scope change forces every page session to sign in again; production metadata must be regenerated first.
- Old VMs (before this feature) have no
spec.agent; nothing changes for them (no button). - The token is minted at request time even if Agent is never clicked: it must be in the bundle before the guest's one secrets fetch at boot, and a sealed bundle is never sent unasked. Opt-in (the checkbox) bounds it.
- The guest agent must be running for the event to land;
agent.jsonguarantees it is installed even on an XRPC requester without webrtc/sealed secrets. - A guest reboot leaves the unit stopped (not enabled) and the event is not replayed (persisted cursor); click Agent again.
Results
-
2026-10-30 headless page run (drives-oauth, dev page atirc-agent @ socialweb 0ae1b2fd, bidders rc120 tangled-vouch): sign-in with full scopes, Agent row default on, RFP → hat-7 bid allowed by policy,
requester_atirc_minted08:45:26Z, Held in 40.0 s, Agent click →guest.agentStartContractEvent published 08:45:55.4Z and submitted to the bidder 08:45:55.9Z, Released 08:45:59.96Z, vm.terminated, no orphan. Page side PASS. -
2026-10-30 page rerun (same setup, driver waits for the atirc nick): request 08:47:24.08Z, Held 08:48:09.15Z (45.1 s), Agent click 08:48:09.16Z, guest
setup-guest-binariesinstalled atirc c193743 + guest agent (agentUnit=atirc-agent.service, sealed secrets),guest_agent_start unit=atirc-agent.service08:48:10.35Z, nickaliceoa-3mz3fgnlg5b2z.aliceoa.bsky.socialjoined atirc 08:48:33Z, Release 08:48:38.2Z, Released 08:48:40.773Z,requester_atirc_revoked08:48:41.026Z. Full plan-0035 page chain PASS (mint, agentStart, guest unit, atirc join, revoke on release). Note: the first sealed-secrets request got 403 and succeeded on retry. -
2026-10-30 CLI run (linux-kcp, rc120, alice via drives-oauth signin-watch):
run request --agent --hold→ Held →run request agent08:54:03Z → bidder took agentStart 08:54:04Z →guest_agent_start unit=atirc-agent.service08:54:04.74Z → nickaliceoa-3mz3fler3lx2ijoined atirc 08:54:28Z (the in-VM agent posted "online, subscribed and listening") →run request release→ Released +requester_atirc_revoked. CLI path PASS. -
2026-10-30 harness test (linux-kcp CLI
--agent, rc122 bidders, atirc ea165f3 server-side config inheritance alice -> john via agentOperator/agents records): hat-7 accept 16:16:18Z, agentStart 16:16:42Z,atirc-agent.service16:16:43Z, nickaliceoa-3mz46inaguz2tposted "online, monitor armed. build/run/test harness ready; give me a task." 16:17:19.9Z; prompted by linux-kcp it answeredaliceoa-3mz46inaguz2t x86_64 fc-lpfuqerea3de-57cc0c2e(nick, uname -m, VM hostname). A Claude session inside an alice-requested VM takes and answers tasks over atirc. PASS.