~ knotless Search/
↑↓ move↵ open⇧↵ all results

socialweb.computer/socialweb-computer-kcp

socialweb.computer: a compute market on atproto (kcp)

1 collaborator
0
0
581 lines · 32.3 KB Raw History
# lexicons-market: one row per lexicon

- the fields of every lexicon come from the lexicon files: each section below includes its generated field table
  (the `lexicon:` link; on https://socialweb.computer/docs/protocol/lexicons-market.html the table is rendered in place)
  and adds what the code does with it: the rkey it writes, who writes and reads it, and the step
- every lexicon, generated: https://socialweb.computer/docs/lexicons/ (XRPC methods: https://socialweb.computer/docs/xrpc/)
- covers every lexicon under `lexicons/com/publicdomainrelay/temp/` except `cluster.*` ([infra.md](infra.md#compublicdomainrelaytempcluster)) and `badgeBlueKeys` ([identity.md](identity.md#badgebluekeys)), with `compute.secrets.getSecrets` and `compute.config.wif.simple` at the end
- the flows: [market.md](market.md) (rfp to release), [guest-events.md](guest-events.md) (events under a receipt); steps S3 to S9: [README.md](README.md#end-to-end-sequence)
- headings drop the prefix `com.publicdomainrelay.temp.`; file paths are under `lexicons/com/publicdomainrelay/temp/`
- the Go types are generated from these files into `internal/atproto/market/zz_generated.lexicons.go` (`go generate` in `internal/atproto/market/nsid.go`)
- "defined, not written": the lexicon and its NSID constant exist, but no Go code in this repo writes the record

## Rows

| row | meaning |
|---|---|
| rkey | what the code writes, not only the lexicon `key` |
| written by / read by | role and the Go function |
| code notes | what the code does with a field, where it differs from what the lexicon allows |
| step | the README step it belongs to |

## Summary

| NSID tail | rkey written | written by | step |
|---|---|---|---|
| `market.rfp` | TID | requester | S3 |
| `market.bid` | `market.BidRKey` | bidder | S4 |
| `market.bids.free` | `<bid rkey>-payload` | bidder | S4 |
| `market.bids.x402` | none | defined, not written | S4 |
| `market.accept` | `SessionRKey("accept", ...)` | requester | S5 |
| `market.accepts.free`, `market.accepts.x402` | none | defined, not written | S5 |
| `market.receipt` | `market.ReceiptRKey` | bidder | S6 |
| `market.receipts.free`, `market.receipts.x402` | none | defined, not written | S6 |
| `market.event` | per kind | both | S7-S9 |
| `market.offering` | `self` | bidder | S3 (discovery) |
| `market.heartbeat` | `self` (literal) | bidder | S3 (discovery) |
| `market.relays` | `self` | no Go writer here | S3 (discovery) |
| `market.association` | the agent DID | principal | S5, S8 |
| `market.associationRequest` | the principal DID | guest requester | S8 |
| `computer.socialweb.peer` | the subhandle | guest requester (its own and each co-located account's); requester (each spec.agent contract's atirc agent) | S8 |
| `market.submitRfp` | - | served by bidder | S3 |
| `market.submitBid` | - | served by requester | S4 |
| `market.submitAccept` | - | served by bidder | S5 |
| `market.submitEvent` | - | served by both | S7-S9 |
| `compute.vm` | TID | requester | S3 |
| `compute.events.vm.*` | per kind | bidder (vm.delete: requester) | S7, S9 |
| `compute.events.guest.*` | per kind | requester or bidder for the guest | S8 |
| `compute.guest.subscribeEvents` | - | served by bidder GuestControlPlane | S8 |
| `ingress.webRTC` | `webrtc` (listen), TID (offer, answer) | requester, bidder | S3-S6 |
| `compute.secrets.getSecrets` | - | served by requester | S8 |
| `compute.config.wif.simple` | `<bid rkey>-config` | bidder | S4 |

## market.rfp

[lexicon: com.publicdomainrelay.temp.market.rfp](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.rfp.html)

| item | value |
|---|---|
| rkey | TID (`putRFP` puts the signed record at a TID it makes) |
| written by | requester: `contractRunner` in `internal/market/requester/runner.go` `putRFP` (`market.BuildRFP`, `market.SignRecord`, putRecord) |
| read by | bidder: stream or `submitRfp`, then `getRecord` (`internal/market/bidder/submit.go` `SubmitRFP`, `acceptContract` in `internal/market/bidder/adapters.go`); bid window from `createdAt` (`internal/atproto/market/rfpwindow.go`) |
| step | [S3](README.md#step-s3) |

## market.bid

[lexicon: com.publicdomainrelay.temp.market.bid](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.bid.html)

| item | value |
|---|---|
| rkey | `market.BidRKey(bidderDID, rfpURI, rfpCID)` = `bid-<20 hex>`; also the Bid object name |
| written by | bidder: `writeBidRecord` in `internal/market/bidder/bids.go` (`market.BuildBid`, `market.SignRecord`) |
| read by | requester: `submitBid` (`Requester.SubmitBid` in `internal/market/requester/callbacks.go`), stream, catch-up `getRecord` at `BidRKey` (`internal/market/requester/bidcatchup.go`); bidder at accept time |
| step | [S4](README.md#step-s4) |

## market.bids.free

[lexicon: com.publicdomainrelay.temp.market.bids.free](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.bids.free.html)

| item | value |
|---|---|
| rkey | `<bid rkey>-payload` |
| written by | bidder: `writeBidRecord` |
| read by | requester: free detection for `firstFree` (`internal/market/requester/accept.go`, `internal/market/requester/inbox.go`) |
| step | [S4](README.md#step-s4) |

## market.bids.x402

[lexicon: com.publicdomainrelay.temp.market.bids.x402](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.bids.x402.html)

| item | value |
|---|---|
| rkey | none: defined, not written |
| written by | no Go writer |
| read by | requester reads `cost` when a bid names one (`internal/market/requester/accept.go`, `internal/market/requester/inbox.go`) |
| step | [S4](README.md#step-s4) |

## market.accept

[lexicon: com.publicdomainrelay.temp.market.accept](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.accept.html)

| item | value |
|---|---|
| code notes | `payload` is never set by the code |
| rkey | `acceptRKeyFor` -> `market.SessionRKey("accept", repoDID, contract, rfpURI, rfpCID, bidURI, bidCID)` (`internal/market/requester/secrets.go`) |
| written by | requester: `putAccept` in `runner.go` (`market.SignRecord`, putRecord) |
| read by | bidder: `submitAccept` or stream -> provisioning StateSync (`SubmitAccept` in `internal/market/bidder/submit.go`, `acceptContract`); the receipt `cid` binds it |
| step | [S5](README.md#step-s5) |

## market.accepts.free

[lexicon: com.publicdomainrelay.temp.market.accepts.free](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.accepts.free.html)

| item | value |
|---|---|
| rkey | none: defined, not written |
| written by | no Go writer (`AcceptsFreeNSID` constant only) |
| read by | none |
| step | [S5](README.md#step-s5) |

## market.accepts.x402

[lexicon: com.publicdomainrelay.temp.market.accepts.x402](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.accepts.x402.html)

| item | value |
|---|---|
| rkey | none: defined, not written |
| written by | no Go writer (`AcceptsX402NSID` constant only) |
| read by | none |
| step | [S5](README.md#step-s5) |

## market.receipt

[lexicon: com.publicdomainrelay.temp.market.receipt](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.receipt.html)

| item | value |
|---|---|
| code notes | `submitEvent` is copied from the accept when the bidder serves inbound XRPC; `payload` is the RFP's `compute.vm` (`null` when none) |
| rkey | `market.ReceiptRKey(acceptURI, acceptCID)` = `receipt-<32 hex>` |
| written by | bidder: `createReceipt` in `internal/market/bidder/submit.go` -> `market.CreateReceiptRecordAt` (`internal/atproto/market/attest.go`) |
| read by | requester: `FindReceipt` (one `getRecord`, `internal/market/requester/market.go`), `market.VerifyReceipt` in `acceptReceipt`; policy trust (`internal/policyengine/trust/association.go`) |
| step | [S6](README.md#step-s6) |

## market.receipts.free

[lexicon: com.publicdomainrelay.temp.market.receipts.free](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.receipts.free.html)

| item | value |
|---|---|
| rkey | none: defined, not written |
| written by | no Go writer (`ReceiptsFreeNSID` constant; named in OAuth scopes, `internal/atproto/oauth/scope.go`) |
| read by | none |
| step | [S6](README.md#step-s6) |

## market.receipts.x402

[lexicon: com.publicdomainrelay.temp.market.receipts.x402](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.receipts.x402.html)

| item | value |
|---|---|
| rkey | none: defined, not written |
| written by | no Go writer (`ReceiptsX402NSID` constant; named in OAuth scopes) |
| read by | none |
| step | [S6](README.md#step-s6) |

## market.event

[lexicon: com.publicdomainrelay.temp.market.event](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.event.html)

| item | value |
|---|---|
| rkey | bidder: `market.EventRKeys(key)` second value `<prefix>-event-<32 hex>`; requester: `SessionRKey("event", receiptURI)` for vm.delete, `SessionRKey("contract-event-envelope", uid)` for ContractEvents |
| written by | bidder event adapter (`writeMarketEvent` in `internal/market/bidder/adapters.go`); requester `destroyEnvelope` (`runner.go`), `publishContractEvent` (`internal/market/requester/contractevents.go`); both via `market.PutEvent` |
| read by | the other party: `submitEvent` or stream; requester `FindTermination` |
| step | [S7](README.md#step-s7), [S8](README.md#step-s8), [S9](README.md#step-s9) |

## market.offering

[lexicon: com.publicdomainrelay.temp.market.offering](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.offering.html)

| item | value |
|---|---|
| rkey | `self` (`market.OfferingRKey`) |
| written by | bidder: `putOffering`, `withdraw` in `internal/market/bidder/offering.go` |
| read by | requester: `market.ReadOffering` (`self`, else the rkey the heartbeat names), `market.OfferingApplies`; relays list its repos by `listReposByCollection` |
| step | [S3](README.md#step-s3) (discovery) |

## market.heartbeat

[lexicon: com.publicdomainrelay.temp.market.heartbeat](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.heartbeat.html)

| item | value |
|---|---|
| rkey | `self` |
| written by | bidder: `beat` in `internal/market/bidder/offering.go`, every `HeartbeatInterval` (60 s) |
| read by | requester: `market.HeartbeatCache.FreshDIDs` (fresh = at most `HeartbeatTTL` 300 s old); `internal/marketpresence` |
| step | [S3](README.md#step-s3) (discovery) |

## market.relays

[lexicon: com.publicdomainrelay.temp.market.relays](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.relays.html)

| item | value |
|---|---|
| rkey | `self` (`market.RelaysRKey`) |
| written by | no Go writer in this repo |
| read by | requester discovery: `market.RelayURLsOf` from `relaySources` in `internal/market/requester/discovery.go` |
| step | [S3](README.md#step-s3) (discovery) |

## market.association

[lexicon: com.publicdomainrelay.temp.market.association](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.association.html)

| item | value |
|---|---|
| rkey | the agent DID |
| meaning | the grant beside the `link.ident.endorsement` at the same rkey: [identity.md](identity.md#associations-identlink) |
| written by | the operator (standing, no `contract`: `compose.ApplyOperatorPair`, `scripts/associate-bidder.ts`); the requester for its guest requester (`contract` = the accept `{uri, cid}`, `expiresAt` = accept + 24 h: `internal/market/requester/association.go`); the guest requester for its co-located accounts (R2's contract and expiresAt: `internal/app/compose/peer.go`) |
| read by | `internal/identlink` walk: policy trust, bidder lifetime cap (`internal/market/bidder/association.go`, ComputeVM `spec.associationExpiresAt` = the walk `expiresAt`; `spec.associationContracts` = the contracts (accept + receipt) of its contract-scoped grants at accept, and the VM ends `association_ended` once each of them has its `vm.terminated` or `vm.delete`), requester discovery, MarketIdentity |
| chain | from the agent's DID document (`alsoKnownAs` agent-of), up to `maxDepth` (AssociationPolicy `maxDepth`, 1 to 100, default 100), 256 getRecords per walk. `socialweb-computer internal association <did>` prints the walk |
| step | [S5](README.md#step-s5), [S8](README.md#step-s8); release deletes only its own |

## market.associationRequest

[lexicon: com.publicdomainrelay.temp.market.associationRequest](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.associationRequest.html)

| item | value |
|---|---|
| rkey | the principal DID (`compose.ApplyAssociationRequestRecord`) |
| written by | the guest requester: an AtprotoRecord object from `internal/app/compose/records.go` |
| read by | the authority requester: one `getRecord` in the DID the guest reported (`internal/market/requester/association.go`); `cmd/socialweb-computer/requestassociation.go` |
| step | [S8](README.md#step-s8); flow: [identity.md](identity.md#associations-identlink) |

## computer.socialweb.peer

[lexicon: computer.socialweb.peer](https://socialweb.computer/docs/lexicons/computer.socialweb.peer.html)

| item | value |
|---|---|
| code notes | only `createdAt` and `iroh` are written; no writer sets `webrtc` or `channels` |
| rkey | the subhandle: the guest requester's atirc subhandle (`r2-<accept rkey>.<owner handle>`, its handle without one); `<name>.<that>` for a co-located account; `<label>-<rfp rkey>.<handle>` for a contract's atirc agent (label: the handle's first label, at most 14 characters) |
| iroh | the short ticket of the node that is that identity: for an account a PDS hosts, the PDS's XRPC endpoint (ingress-iroh); for an atirc agent identity, its `atirc mesh run` daemon (ALPN `atirc/mesh/1`). One identity, one node; the dialer picks the protocol by ALPN |
| written by | the guest requester (`run request --guest-requester [--colocated a,b]`): AtprotoRecord objects of `internal/app/compose/peer.go` in its own repo and each co-located account's, present only while its association ref verifies. The requester of a spec.agent contract writes no peer record: after the verified receipt it puts the agent's iroh key (a 32-byte ed25519 seed, `/etc/atirc/iroh_key.hex`, 0600) and, for a guest requester, `R2_COLOCATED=<nick>=<ticket>` (`/etc/socialweb-computer/r2-agent.env`) into the bundle (`internal/market/requester/agentpeer.go` `publishAgentPeer`), and R2 writes the agent's peer record |
| read by | mesh peers: one `getRecord(DID, computer.socialweb.peer, subhandle)`, never listRecords; trusted only while the walk of the repo DID reaches the owner |
| release | the guest requester's `run request release` sets `spec.peer.retire`: the peer, association and endorsement records are deleted, each local account deactivated and its did:plc tombstoned (best effort; expiry covers a skipped cleanup) |

## market.submitRfp

[lexicon: com.publicdomainrelay.temp.market.submitRfp](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitRfp.html)

| item | value |
|---|---|
| input | `{rfpUri, rfpCid, ingress?}` (ingress = `ingress.webRTC` offers) |
| output | `{ok, name, phase, ingress?, declined?: {kind, reason}}` (`declined`: the bidder will not bid; kind `capacity` = full now, `unservable` = nothing but another bidder will do); 409 `RFPClosed` once the bid window is over; every error is in the lexicon |
| served by | bidder: `handleSubmitRFP` in `internal/services/bidder/routes.go` -> `Bidder.SubmitRFP` |
| called by | requester: `solicitBids` -> `HTTPMarket.SubmitRFP` (`internal/market/requester/runner.go`, `market.go`) |
| step | [S3](README.md#step-s3) |

## market.submitBid

[lexicon: com.publicdomainrelay.temp.market.submitBid](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitBid.html)

| item | value |
|---|---|
| input | `{uri, cid, record}` of the `market.bid`, `ingress?` |
| output | `{ok, ingress?}`; errors `InvalidRequest`, `Unauthorized`, `Forbidden`, `Unavailable` |
| served by | requester ingress: `internal/services/requester/routes.go` -> `Requester.SubmitBid`; the bidder route only parses it |
| called by | bidder: `submitBid` in `internal/market/bidder/submit.go` to the RFP's `submitBid` |
| step | [S4](README.md#step-s4) |

## market.submitAccept

[lexicon: com.publicdomainrelay.temp.market.submitAccept](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitAccept.html)

| item | value |
|---|---|
| input | `{acceptUri, acceptCid, ingress?}` |
| output | 202 `{ok, id, acceptUri, acceptCid}`; 409 `CapacityExceeded` when the accept would overcommit the host; every error is in the lexicon |
| served by | bidder: `handleSubmitAccept` -> `Bidder.SubmitAccept` (provisioning StateSync) |
| called by | requester: `submitAcceptAndWait` (`internal/market/requester/accept.go`) |
| step | [S5](README.md#step-s5) |

## market.submitEvent

[lexicon: com.publicdomainrelay.temp.market.submitEvent](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitEvent.html)

| item | value |
|---|---|
| input | `{uri, cid, record}` of the `market.event`, `ingress?` |
| output | `{ok, ingress?}`; 403 `Forbidden` "not the accept author" |
| served by | bidder `handleSubmitEvent` -> `Bidder.SubmitEvent`; requester `Requester.SubmitEvent` (`callbacks.go`) |
| called by | requester `releaseContract`, `publishContractEvent`; bidder event adapter (`internal/market/bidder/adapters.go`) |
| step | [S7](README.md#step-s7), [S8](README.md#step-s8), [S9](README.md#step-s9) |

## compute.vm

[lexicon: com.publicdomainrelay.temp.compute.vm](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.vm.html)

| item | value |
|---|---|
| rkey | TID (`putSetupRecord`: putRecord at a TID; unsigned) |
| written by | requester: `runner.go` with `DefaultComputeCPUs`, `DefaultComputeMem`, `DefaultComputeDisk` (`internal/market/requester/requester.go`); `user_data` from `cloudinit.BuildUserData` (`internal/atproto/cloudinit`) |
| read by | bidder through `rfp.payload`: kind check (`rfpKind` in `submit.go`), boot (`acceptContract`, `internal/guestseed` adds the binaries unit) |
| step | [S3](README.md#step-s3) |

## compute.events.vm.delete

[lexicon: com.publicdomainrelay.temp.compute.events.vm.delete](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.delete.html)

| item | value |
|---|---|
| rkey | `market.ReleasePayloadRKey(receiptURI)` = `SessionRKey("delete", receiptURI)` |
| written by | requester: `destroyEnvelope` in `internal/market/requester/runner.go` |
| read by | bidder: `verifyInboundDelete`, `applyRelease` (`internal/market/bidder/adapters.go`); policy trust |
| step | [S9](README.md#step-s9) |

## compute.events.vm.hostKeys

[lexicon: com.publicdomainrelay.temp.compute.events.vm.hostKeys](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.hostKeys.html)

| item | value |
|---|---|
| rkey | `EventRKeys("hostKeys:<receipt>")` -> `hostkeys-payload-<32 hex>` |
| written by | bidder: `report` in `internal/market/bidder/report.go` from the host key bound at login (`RecordBoundHostKey` in `internal/guestidentity/service.go`) |
| read by | requester: `waitGuest` -> `status.contract.hostKeys` |
| step | [S7](README.md#step-s7) |

## compute.events.vm.onNetwork

[lexicon: com.publicdomainrelay.temp.compute.events.vm.onNetwork](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.onNetwork.html)

| item | value |
|---|---|
| rkey | `EventRKeys("onNetwork:<receipt>")` or `EventRKeys("onNetwork:<tag>:<receipt>")` |
| written by | bidder: `report` (`internal/market/bidder/report.go`) from the guest POST (`Guest.onNetwork` in `internal/guestidentity/service.go`); sandbox: `internal/market/bidder/sandbox.go` |
| read by | requester: `waitGuest` -> `status.contract.vmAddress`, `status.contract.networks` |
| step | [S7](README.md#step-s7) |

## compute.events.vm.sandbox

[lexicon: com.publicdomainrelay.temp.compute.events.vm.sandbox](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.sandbox.html)

| item | value |
|---|---|
| rkey | `EventRKeys("<nsid>:<receipt>")` |
| written by | bidder: `internal/market/bidder/sandbox.go` (`compute.vm.kind: deno`) |
| read by | requester: `status.contract.sandbox` (`internal/market/requester/events.go`, `runner.go`) |
| step | [S7](README.md#step-s7) |

## compute.events.vm.memoryPressure

[lexicon: com.publicdomainrelay.temp.compute.events.vm.memoryPressure](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.memoryPressure.html)

| item | value |
|---|---|
| rkey | from the report StateSync key `<nsid>:<kind>-<n>:<receipt>` |
| written by | bidder: `internal/market/bidder/memory.go` (edge-triggered from the VM cgroup's memory.events: one per crossing, re-armed after 5 min below 90% of the threshold, at most 1 per kind per 10 min and 10 memory events per contract) |
| read by | none in Go (requesters and the watch page) |
| step | [S7](README.md#step-s7) |

## compute.events.vm.oomKilled

[lexicon: com.publicdomainrelay.temp.compute.events.vm.oomKilled](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.oomKilled.html)

| item | value |
|---|---|
| rkey | from the report StateSync key `<nsid>:oom-<n>:<receipt>` |
| written by | bidder: `internal/market/bidder/memory.go` (one per new oom_kill count, inside the same 10-per-contract cap) |
| read by | none in Go |
| step | [S7](README.md#step-s7) |

## compute.events.vm.terminated

[lexicon: com.publicdomainrelay.temp.compute.events.vm.terminated](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.terminated.html)

| item | value |
|---|---|
| rkey | `EventRKeys(TerminationKey(receiptURI))` -> `termination-payload-<32 hex>` |
| written by | bidder: termination StateSync (`internal/computevm/termination.go`, `internal/controllers/computevm/controller.go`), adapter `atproto.market.event` |
| read by | requester `FindTermination` (`market.go`); atirc via the token lease (`contractLease` in `internal/market/requester/atirc.go`); policy trust |
| step | [S9](README.md#step-s9) |

## compute.events.guest.publicKey

[lexicon: com.publicdomainrelay.temp.compute.events.guest.publicKey](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.publicKey.html)

| item | value |
|---|---|
| rkey | requester: `SessionRKey("contract-event", uid)`; bidder: `EventRKeys("guest:...")` |
| written by | requester (outbound ContractEvent, `contractevents.go`); bidder for the guest (`PublishGuestEvent` in `internal/market/bidder/guestevents.go`) |
| read by | guest agent (`internal/guestagent/subscribe.go`); requester (inbound ContractEvent) |
| step | [S8](README.md#step-s8) |

## compute.events.guest.signalWebRTC

[lexicon: com.publicdomainrelay.temp.compute.events.guest.signalWebRTC](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.signalWebRTC.html)

| item | value |
|---|---|
| rkey | as `guest.publicKey` |
| written by | requester (CLI / browser ContractEvent, `internal/stack/request/webrtc.go`); bidder for the guest |
| read by | guest agent (`internal/guestagent/session.go`, `subscribe.go`); requester (inbound ContractEvent) |
| step | [S8](README.md#step-s8) |

## compute.events.guest.secrets

[lexicon: com.publicdomainrelay.temp.compute.events.guest.secrets](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secrets.html)

| item | value |
|---|---|
| rkey | `SessionRKey("contract-event", uid)` of ContractEvent `secrets-<contract>` |
| written by | requester only, on demand: `sealGuestSecrets` in `internal/market/requester/guestsecrets.go` |
| read by | guest agent (`internal/guestagent/secrets.go`); the bidder forwards it unopened |
| step | [S8](README.md#step-s8) |

## compute.events.guest.secretsRequested

[lexicon: com.publicdomainrelay.temp.compute.events.guest.secretsRequested](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secretsRequested.html)

| item | value |
|---|---|
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent (comms mode Firehose with `secretsFallback: Sealed` only) |
| read by | requester: `status.contract.secretsRequested`, then `sealGuestSecrets` |
| step | [S8](README.md#step-s8) |

## compute.events.guest.secretsApplied

[lexicon: com.publicdomainrelay.temp.compute.events.guest.secretsApplied](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secretsApplied.html)

| item | value |
|---|---|
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent |
| read by | requester: `status.contract.secretsApplied`, condition `SecretsApplied` |
| step | [S8](README.md#step-s8) |

## compute.events.guest.secretsUpdated

[lexicon: com.publicdomainrelay.temp.compute.events.guest.secretsUpdated](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secretsUpdated.html)

| item | value |
|---|---|
| rkey | `SessionRKey("contract-event", uid)` of ContractEvent `secrets-updated-<SessionRKey("secretsUpdated", contract, ref)>` |
| written by | requester only: `notifySecretsUpdated` (`internal/market/requester/association.go`), every fresh atirc mint |
| read by | guest agent: fetch the bundle again |
| step | [S8](README.md#step-s8) |

## compute.events.guest.agentStart

[lexicon: com.publicdomainrelay.temp.compute.events.guest.agentStart](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.agentStart.html)

| item | value |
|---|---|
| rkey | `SessionRKey("contract-event", uid)` |
| written by | requester only (`run request agent <name>` -> ContractEvent; needs `spec.agent`) |
| read by | guest agent: `systemctl start --no-block atirc-agent.service` (`internal/guestagent/agentstart.go`) |
| step | [S8](README.md#step-s8) |

## compute.events.guest.requesterDid

[lexicon: com.publicdomainrelay.temp.compute.events.guest.requesterDid](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.requesterDid.html)

| item | value |
|---|---|
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent (`internal/guestagent/association.go`) |
| read by | requester: `status.contract.guestRequester` (`internal/market/requester/association.go`, `market.ValidGuestRequesterDID`) |
| step | [S8](README.md#step-s8) |

## compute.events.guest.r2Start

[lexicon: com.publicdomainrelay.temp.compute.events.guest.r2Start](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.r2Start.html)

| item | value |
|---|---|
| rkey | `SessionRKey("contract-event", uid)` |
| written by | requester only (`run request r2 <name>`; needs `spec.association.fromGuest`) |
| read by | guest agent: starts `socialweb-r2.service` (`internal/guestagent/association.go`) |
| step | [S8](README.md#step-s8) |

## compute.events.guest.r2Release

[lexicon: com.publicdomainrelay.temp.compute.events.guest.r2Release](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.r2Release.html)

| item | value |
|---|---|
| rkey | `SessionRKey("contract-event", uid)` |
| written by | requester only: `releaseGuestRequester` (`internal/market/requester/guestrequester.go`) |
| read by | guest agent: `socialweb-r2-release.service` |
| step | [S9](README.md#step-s9) |

## compute.events.guest.r2Released

[lexicon: com.publicdomainrelay.temp.compute.events.guest.r2Released](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.r2Released.html)

| item | value |
|---|---|
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent |
| read by | requester: `status.contract.r2Release`, condition GuestRequesterReleased |
| step | [S9](README.md#step-s9) |

## compute.events.guest.memoryPressure

[lexicon: com.publicdomainrelay.temp.compute.events.guest.memoryPressure](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.memoryPressure.html)

| item | value |
|---|---|
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent (`internal/guestagent/memory.go`), capped by `memoryEventCapped` |
| read by | requester (`requester_market_event`), the test modules (readings.memory), the watch page |

## compute.events.guest.oomKill

[lexicon: com.publicdomainrelay.temp.compute.events.guest.oomKill](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.oomKill.html)

| item | value |
|---|---|
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent (`internal/guestagent/memory.go`), capped by `memoryEventCapped` |
| read by | requester (`requester_market_event`), the test modules (fail the run), the watch page |

## compute.events.guest.image

[lexicon: com.publicdomainrelay.temp.compute.events.guest.image](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.image.html)

| item | value |
|---|---|
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent (`internal/guestagent/image.go`), one per contract |
| read by | requester: `requester_guest_image` {marker, expected, ok}; a contract with an image releases on a mismatch |

## compute.guest.subscribeEvents

[lexicon: com.publicdomainrelay.temp.compute.guest.subscribeEvents](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.guest.subscribeEvents.html)

| item | value |
|---|---|
| served by | bidder GuestControlPlane: `handleSubscribeEvents` in `internal/services/guestcontrolplane/subscribe.go`, queue `internal/guestcp/queue` |
| called by | guest agent: `internal/guestagent/subscribe.go` (bearer = workload identity token) |
| carries | requester-authored `compute.events.guest.*` payloads, in order; keepalive every 25 s |
| step | [S8](README.md#step-s8) |

## ingress.webRTC

[lexicon: com.publicdomainrelay.temp.ingress.webRTC](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.ingress.webRTC.html)

| item | value |
|---|---|
| rkey | requester listen: `webrtc` (`ingressDescriptor` in `internal/market/requester/requester.go`); offer: TID (`createIngressOffer` in `internal/market/requester/market.go`); bidder answer: TID (`AnswerIngressRecords` in `internal/market/bidder/submit.go`) |
| written by | requester (listen, offer), bidder (answer) |
| read by | the other side through `ingress[]` on rfp, bid, accept, receipt, offering and the submit calls; only refs to this NSID are allowed (`validateIngressList` in `internal/atproto/market/records.go`) |
| step | [S3](README.md#step-s3) to [S6](README.md#step-s6) |

## compute.secrets.getSecrets

[lexicon: com.publicdomainrelay.temp.compute.secrets.getSecrets](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.secrets.getSecrets.html)

| item | value |
|---|---|
| file | `compute/secrets/getSecrets.json`; `SecretsNSID` = `com.publicdomainrelay.temp.compute.secrets`, `SecretsRoute` in `internal/market/requester/secrets.go` |
| type | query-shaped HTTP route: `GET /xrpc/com.publicdomainrelay.temp.compute.secrets.getSecrets/<contract>` |
| auth | `Authorization: Bearer <workload identity token>`; audience `api://ATProto?actx=<requester DID>`; subject claim must match the contract's grant |
| output | JSON array `[{path, value, mode?}]`; 401 `AuthenticationRequired`, `InvalidToken`; 404 `NotFound`; 503 `NotReady`; 500 `InternalError` |
| served by | requester ingress: `internal/services/requester/routes.go` -> `Requester.Secrets` |
| called by | guest `setup-secrets.service` (`internal/atproto/cloudinit`) |
| step | [S8](README.md#step-s8); fallback: [guest-events.md](guest-events.md#secrets-getsecrets-or-sealed-fallback) |

## compute.config.wif.simple

[lexicon: com.publicdomainrelay.temp.compute.config.wif.simple](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.config.wif.simple.html)

| item | value |
|---|---|
| file | `compute/config/wif/simple.json`; `WIFSimpleNSID` in `internal/guestidentity/bidconfig.go` |
| type | record (bid config) |
| key fields | `accept_path`, `issuer_uri`, `to_issue` (`openbao-identity-oidc`), `actx`, `token_path`, `url_path`, `url_route` (`/v1/identity/oidc/token`), `subject` (`actx:{actx}:plc:{did-plc-key}:role:{role}`), `createdAt` |
| rkey | `<bid rkey>-config` |
| written by | bidder: `writeBidRecord` via `guests.BidConfig` (`internal/services/bidder/guests.go`, `guestidentity.BidConfigFor`) |
| read by | requester: `resolveBidConfig` and `prepareWorkloadGrant` (`internal/market/requester/secrets.go`) to build the workload identity grant; bidder at accept time |
| step | [S4](README.md#step-s4) |