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

socialweb.computer/socialweb-computer-kcp

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

1 collaborator
0
0

docs: lexicon tables and the glossary are generated from lexicons/

Merged johnandersen777.bsky.social asked to merge into main from socialweb.computer/socialweb-computer-kcp:phase-2
docs/protocol/glossary.md+20−95
@@ -1,113 +1,38 @@
# glossary: every NSID on the wire
- one line each, grouped by namespace; the lexicon file is `lexicons/<nsid with / for .>.json` unless the line says "no file"
- namespaces: market and relay `com.publicdomainrelay.temp.*`; runtime and host contracts `com.fedfork.exec.*`; deployments, ingress and peers `computer.socialweb.*`; releases `software.release.*`; associations `link.ident.*`; signatures `network.attested.*`
- every NSID that has a lexicon file is listed from the lexicons themselves: its type and the first sentence of its
description, grouped by namespace, with the docs pages that name it. On the site the list is generated in place:
https://socialweb.computer/docs/protocol/glossary.html (each NSID's own page: https://socialweb.computer/docs/lexicons/)
- below that list, by hand: the NSIDs we use that have no lexicon file here, and the ones other projects own
- namespaces: market and relay `com.publicdomainrelay.temp.*`; runtime and host contracts `com.fedfork.exec.*`;
deployments, ingress and peers `computer.socialweb.*`; releases `software.release.*`; associations `link.ident.*`;
signatures `network.attested.*`
- names in other docs drop `com.publicdomainrelay.temp.` (`market.rfp`)
## com.publicdomainrelay.temp.market
## From the lexicons
| NSID | type | one line | doc |
|---|---|---|---|
| `market.rfp` | record | signed request for proposals: `payload` -> `compute.vm`, `policies[]`, `submitBid`, `ingress[]` | [flow.md](flow.md#s3-policy-vm-rfp) |
| `market.bid` | record | signed bid on an RFP: `rfp`, `payload` -> `bids.*`, `config` -> `compute.config.wif.simple`; rkey `BidRKey` | [flow.md](flow.md#s4-bid) |
| `market.bids.free` | record | bid terms at no cost `{reason, cost: 0}` | [market.md](market.md) |
| `market.bids.x402` | record | bid terms paid over x402 `{cost, currency, frequency, prepay, url}`; defined, not written | [lexicons-market.md](lexicons-market.md#marketbidsx402) |
| `market.accept` | record | signed accept of one bid: `rfp`, `bid`, `submitEvent`, `ingress[]` | [flow.md](flow.md#s5-accept) |
| `market.accepts.free`, `market.accepts.x402` | record | accept terms; defined, not written | [lexicons-market.md](lexicons-market.md) |
| `market.receipt` | record | the bidder's signed receipt; `cid` binds it to the accept; `payload` -> the `compute.vm` | [flow.md](flow.md#s6-receipt) |
| `market.receipts.free`, `market.receipts.x402` | record | receipt terms; defined, not written | [lexicons-market.md](lexicons-market.md) |
| `market.event` | record | signed event envelope under a receipt: `receipt`, `payload` -> a `compute.events.*` record | [guest-events.md](guest-events.md) |
| `market.offering` | record (`self`) | what a bidder bids on and where it takes calls: `appliesTo`, `endpoints[]`, `maxCpus`, `maxMem`, `nestedVirt`, `images` | [market.md](market.md#discovery) |
| `market.heartbeat` | record (`self`) | a bidder's liveness beat, fresh for 300 s; `version` of the running binary | [market.md](market.md#discovery) |
| `market.relays` | record (`self`) | relays a participant crawls; read in discovery, no Go writer | [market.md](market.md#discovery) |
| `market.association` | record | the grant: the repo trusts `agent` (rkey = the agent DID); `contract` and `expiresAt` scope it | [identity.md](identity.md#associations-identlink) |
| `market.associationRequest` | record | a guest requester asks the principal to grant it for one contract (rkey = the principal DID, `nonce`) | [identity.md](identity.md#guest-requester-r2) |
| `market.submitRfp` | procedure | requester -> bidder: an RFP; 200 `{name, phase, declined?}`, 409 `RFPClosed` | [market.md](market.md#xrpc-procedures) |
| `market.submitBid` | procedure | bidder -> requester: a bid it wrote | [market.md](market.md#xrpc-procedures) |
| `market.submitAccept` | procedure | requester -> bidder: an accept; 202, 409 `CapacityExceeded` | [market.md](market.md#xrpc-procedures) |
| `market.submitEvent` | procedure | either party -> the other: a `market.event` it wrote | [market.md](market.md#xrpc-procedures) |
| `market.policies.denoWorker` | record (no file) | a policy record type the engine denies | [policy.md](policy.md) |
## com.publicdomainrelay.temp.compute
[glossary: generated from lexicons/](https://socialweb.computer/docs/protocol/glossary.html)
| NSID | type | one line | doc |
|---|---|---|---|
| `compute.vm` | record | the VM asked for: `role`, `kind`, `cpus`, `mem`, `disk`, `nestedVirt`, `image`, `user_data`, `net`, `expiresAt` | [flow.md](flow.md#s3-policy-vm-rfp) |
| `compute.config.wif.simple` | record (no file) | a bid's workload identity config: OIDC issuer and `sub` format of the VM | [guest-events.md](guest-events.md#secrets-getsecrets-or-sealed-fallback) |
| `compute.secrets.getSecrets` | query (no file; route `/xrpc/<nsid>/<contract>`) | the guest fetches its secrets bundle from the requester with a workload identity token | [guest-events.md](guest-events.md#secrets-getsecrets-or-sealed-fallback) |
| `compute.guest.subscribeEvents` | subscription | the guest's WebSocket at its bidder for requester-authored `compute.events.guest.*` | [guest-events.md](guest-events.md#computeguestsubscribeevents) |
| `compute.events.vm.onNetwork` | record | an address of the VM: iroh ticket, https tunnel URL, webrtc DTLS fingerprint | [guest-events.md](guest-events.md#each-kind) |
| `compute.events.vm.hostKeys` | record | the VM's ssh host keys | [guest-events.md](guest-events.md#each-kind) |
| `compute.events.vm.delete` | record | the requester asks the bidder to delete the VM (`reason: released`) | [market.md](market.md#release-and-termination) |
| `compute.events.vm.terminated` | record | the bidder reports the VM stopped, with a reason | [market.md](market.md#release-and-termination) |
| `compute.events.vm.sandbox` | record | a deno sandbox ended, with its output | [guest-events.md](guest-events.md#each-kind) |
| `compute.events.vm.memoryPressure`, `vm.oomKilled` | record | the VM's host cgroup crossed a memory threshold / OOM-killed | [guest-events.md](guest-events.md#each-kind) |
| `compute.events.vm.started`, `vm.registerIdentity` | record | defined, no writer | [lexicons-market.md](lexicons-market.md) |
| `compute.events.guest.publicKey` | record | an age-x25519 key per tag, either side | [guest-events.md](guest-events.md#sealed-signaling-webrtc-tunnels) |
| `compute.events.guest.signalWebRTC` | record | a sealed WebRTC offer or answer for one tag | [guest-events.md](guest-events.md#sealed-signaling-webrtc-tunnels) |
| `compute.events.guest.secrets` | record | the requester's bundle sealed to the guest's key (only when asked) | [guest-events.md](guest-events.md#secrets-getsecrets-or-sealed-fallback) |
| `compute.events.guest.secretsRequested` | record | the guest asks for the sealed bundle | same |
| `compute.events.guest.secretsApplied` | record | the guest wrote its bundle (`via`) | same |
| `compute.events.guest.secretsUpdated` | record | the bundle changed; fetch again | same |
| `compute.events.guest.agentStart` | record | start the guest's atirc agent unit | [guest-events.md](guest-events.md#agent-start-and-atirc-mint) |
| `compute.events.guest.requesterDid` | record | the guest reports its guest requester's DID | [identity.md](identity.md#guest-requester-r2) |
| `compute.events.guest.r2Start` | record | start the guest requester unit | same |
| `compute.events.guest.r2Release` | record | release the guest requester's contracts | same |
| `compute.events.guest.r2Released` | record | the guest requester released them | same |
| `compute.events.guest.memoryPressure`, `guest.oomKill` | record | the guest's PSI or swap threshold / an OOM kill | [guest-events.md](guest-events.md#each-kind) |
| `compute.events.guest.image` | record | the marker of the image the guest booted | [guest-events.md](guest-events.md#each-kind) |
## Lexicons without a description
## com.publicdomainrelay.temp (other)
Kept here until the lexicon file has one.
| NSID | type | one line | doc |
|---|---|---|---|
| `ingress.webRTC` | record | the requester's WebRTC ingress listen record (rkey `webrtc`) named in `ingress[]` | [lexicons-market.md](lexicons-market.md#ingresswebrtc) |
| `badgeBlueKeys` | record | binds a signing key (or an ssh key) to the repo DID | [identity.md](identity.md#badgebluekeys) |
| `cluster.createCluster`, `deleteCluster`, `controlPlaneUp`, `controlPlaneDown`, `getKubeconfig`, `listClusters`, `listKubeconfigs`, `revokeKubeconfig`, `revokeIdentity`, `subscribeClusters` | XRPC | the gateway's tenant cluster API | [infra.md](infra.md#compublicdomainrelaytempcluster) |
| `auth.allowlist.rbacDid` | scope only (no file) | an OAuth scope; nothing writes it | [outside.md](outside.md#scope-only-collections) |
| NSID | type | one line |
|---|---|---|
| `software.release.defs` | defs | `httpArtifact`, `target` |
## com.fedfork.exec
## Ours, no lexicon file
| NSID | type | one line | doc |
|---|---|---|---|
| `ops.listVms`, `ops.getVm`, `ops.getVmMemory`, `ops.getBidder`, `ops.getHealth`, `ops.getLog` | query | a bidder's read-only operations routes (bearer: the ops read secret) | [../SYSTEM.md](../SYSTEM.md#xrpc) |
| `ops.getRequesterLog` | query | the ssh gateway's requester log lines of one DID | same |
| `binding`, `pins` | record (no file here; knotless) | CI executor bindings and the tested atlibs pin set, in the release account's repo | [../ci-debug.md](../ci-debug.md) |
## computer.socialweb
| NSID | type | one line | doc |
|---|---|---|---|
| `computer.socialweb.infra` | record | a long-lived deployment: contracts with their wanted state; index at `self` | [infra.md](infra.md) |
| `computer.socialweb.ephemeralInfra` | record | a short-lived deployment that ends at `createdAt + ttlSeconds` | [infra.md](infra.md) |
| `computer.socialweb.ingress.listen` | record | a WebRTC answerer's keys (rkey: the listen name, `market` for a bidder) | [market.md](market.md#xrpc-procedures) |
| `computer.socialweb.ingress.offer` | record | a sealed WebRTC offer, rkey `<answerer DID>.<tid>` | same |
| `computer.socialweb.ingress.answer` | record | the sealed answer, rkey `<offerer DID>.<tid>` | same |
| `computer.socialweb.peer` | record | how to reach one subhandle directly (iroh ticket) | [lexicons-market.md](lexicons-market.md#computersocialwebpeer) |
| `computer.socialweb.mesh.roster` | record | one socialweb-meshd overlay's roster | `lexicons/computer/socialweb/mesh/roster.json` |
| `computer.socialweb.k8s.kubectlApplyServerSide`, `k8s.getJob` | XRPC | the gateway's k8s API | [infra.md](infra.md#computersocialwebk8s) |
| `com.publicdomainrelay.temp.market.policies.denoWorker` | record (no file) | a policy record type the engine denies | [policy.md](policy.md) |
| `com.publicdomainrelay.temp.compute.config.wif.simple` | record (no file) | a bid's workload identity config: OIDC issuer and `sub` format of the VM | [guest-events.md](guest-events.md#secrets-getsecrets-or-sealed-fallback) |
| `com.publicdomainrelay.temp.compute.secrets.getSecrets` | query (no file; route `/xrpc/<nsid>/<contract>`) | the guest fetches its secrets bundle from the requester with a workload identity token | [guest-events.md](guest-events.md#secrets-getsecrets-or-sealed-fallback) |
| `com.publicdomainrelay.temp.auth.allowlist.rbacDid` | scope only (no file) | an OAuth scope; nothing writes it | [outside.md](outside.md#scope-only-collections) |
| `com.fedfork.exec.binding`, `com.fedfork.exec.pins` | record (no file here; knotless) | CI executor bindings and the tested atlibs pin set, in the release account's repo | [../ci-debug.md](../ci-debug.md) |
| `computer.socialweb.temp.policy.ghalite` | record (no file) | the requester's published policy workflow, strongRef'd by the RFP | [policy.md](policy.md) |
| `computer.socialweb.temp.policy.typescript` | record (no file) | a policy type the engine denies | [policy.md](policy.md) |
## software.release
| NSID | type | one line | doc |
|---|---|---|---|
| `software.release.project` | record | a released piece of software | [release.md](release.md) |
| `software.release.manifest` | record | the artifacts of one build, each with its CID | [release.md](release.md) |
| `software.release.version` | record | a named version: its manifest and `previous` | [release.md](release.md) |
| `software.release.channel` | record | `rc` or `stable`: the version followers track | [release.md](release.md) |
| `software.release.defs` | defs | `httpArtifact`, `target` | [release.md](release.md) |
## link.ident, network.attested, com.atproto
| NSID | type | one line | doc |
|---|---|---|---|
| `link.ident.endorsement` | record | the principal confirms an agent (rkey = the agent DID); vendored from ident.link | [identity.md](identity.md#associations-identlink) |
| `network.attested.signature` | object | the inline signature on market records | [identity.md](identity.md#networkattested) |
| `network.attested.proof`, `network.attested.verify` | record, query | defined, not written or served | [identity.md](identity.md#networkattested) |
| `com.atproto.repo.strongRef` | object | `{uri, cid}` (a vendored copy) | [outside.md](outside.md#comatprotorepostrongref) |
## Used, Not Ours
| NSID | owner | one line | doc |
docs/protocol/guest-events.md+69−23
@@ -113,29 +113,75 @@ sequenceDiagram
## Each Kind
| NSID tail | key fields | notes |
|---|---|---|
| `vm.onNetwork` | `kind` iroh / https / webrtc / sandbox, `address`, `tag` | kind absent: iroh without tag, https with tag (`market.OnNetworkKind`). webrtc address = the guest agent DTLS fingerprint `sha-256 AB:CD:...` |
| `vm.hostKeys` | `keys[] {type, publicKey, fingerprint}`, `observedAt` | at most 8 keys, an ed25519 key required (`internal/guestidentity/guestrecord.go`) |
| `vm.sandbox` | `exitCode`, `timedOut`, `stdout`, `stderr` | `compute.vm.kind: deno` only (`internal/market/bidder/sandbox.go`) |
| `vm.delete` | `reason` | requester writes `released` |
| `vm.terminated` | `reason`, `exitCode`, `observedAt`, `request?` | reasons: [market.md](market.md#release-and-termination); `request` is optional: a `deleted_on_request` without one is a delete on the bidder |
| `vm.memoryPressure` | `kind`, `threshold`, `observed`, `observedAt` | the VM unit's cgroup `memory.events` high or max rose |
| `vm.oomKilled` | `kills`, `total`, `limit`, `observedAt` | its `oom_kill` rose |
| `guest.publicKey` | `kind: age-x25519`, `tag`, `key` (age1...) | one per tag per side; anything sealed for a tag goes to the other side's latest key |
| `guest.signalWebRTC` | `kind` offer / answer, `tag`, `ciphertext` | plaintext `{sdp, replyTo}`; non-trickle ICE, one offer, one answer |
| `guest.secrets` | `ciphertext` | age armored, at most 65536 bytes (`MaxGuestSecretsCiphertext`); plaintext = the getSecrets JSON array |
| `guest.secretsRequested` | none | only with `secretsFallback: Sealed` |
| `guest.secretsApplied` | `via` getSecrets / sealed, `count` | |
| `guest.secretsUpdated` | none | the bundle changed (atirc mint, association ref) |
| `guest.agentStart` | none | needs `spec.agent` (`contractevents.go`) |
| `guest.requesterDid` | `did` | did:plc only, never the authority's own DID (`market.ValidGuestRequesterDID`) |
| `guest.r2Start` | `name` (DNS label), `agent`, `hold` | needs `spec.association.fromGuest` |
| `guest.r2Release` | none | |
| `guest.r2Released` | `ok`, `message` | |
| `guest.memoryPressure` | `kind` psi / swap, `threshold`, `psiSomeAvg10`, `psiFullAvg10`, `swapUsed`, `swapTotal`, `observedAt` | every VM whose bidder serves the guest agent (`memory.json`); edge-triggered: PSI some avg10 >= 10.00% or swap >= 10% in use, re-armed after 5 min under half; one per kind per 10 min, ten memory events per contract (agent and bidder) |
| `guest.oomKill` | `kills` (since the last one), `total` (oom_kill since boot), `observedAt` | one per /proc/vmstat oom_kill rise, same caps |
| `guest.image` | `marker` (first line of `/etc/swc-image`; any length within the event's 24 KiB) | once at agent start, when the file exists; the bidder publishes one per contract |
What the code does with each kind; the fields of each are its lexicon's, included below.
| NSID tail | notes |
|---|---|
| `vm.onNetwork` | kind absent: iroh without tag, https with tag (`market.OnNetworkKind`). webrtc address = the guest agent DTLS fingerprint `sha-256 AB:CD:...` |
| `vm.hostKeys` | at most 8 keys, an ed25519 key required (`internal/guestidentity/guestrecord.go`) |
| `vm.sandbox` | `compute.vm.kind: deno` only (`internal/market/bidder/sandbox.go`) |
| `vm.delete` | requester writes `released` |
| `vm.terminated` | reasons: [market.md](market.md#release-and-termination); `request` is optional: a `deleted_on_request` without one is a delete on the bidder |
| `vm.memoryPressure` | the VM unit's cgroup `memory.events` high or max rose |
| `vm.oomKilled` | its `oom_kill` rose |
| `guest.publicKey` | one per tag per side; anything sealed for a tag goes to the other side's latest key |
| `guest.signalWebRTC` | plaintext `{sdp, replyTo}`; non-trickle ICE, one offer, one answer |
| `guest.secrets` | age armored, at most 65536 bytes (`MaxGuestSecretsCiphertext`); plaintext = the getSecrets JSON array |
| `guest.secretsRequested` | only with `secretsFallback: Sealed` |
| `guest.secretsApplied` | |
| `guest.secretsUpdated` | the bundle changed (atirc mint, association ref) |
| `guest.agentStart` | needs `spec.agent` (`contractevents.go`) |
| `guest.requesterDid` | did:plc only, never the authority's own DID (`market.ValidGuestRequesterDID`) |
| `guest.r2Start` | needs `spec.association.fromGuest` |
| `guest.r2Release` | |
| `guest.r2Released` | |
| `guest.memoryPressure` | every VM whose bidder serves the guest agent (`memory.json`); edge-triggered: PSI some avg10 >= 10.00% or swap >= 10% in use, re-armed after 5 min under half; one per kind per 10 min, ten memory events per contract (agent and bidder) |
| `guest.oomKill` | one per /proc/vmstat oom_kill rise, same caps |
| `guest.image` | once at agent start, when the file exists; the bidder publishes one per contract |
### Fields
[lexicon: com.publicdomainrelay.temp.compute.events.vm.onNetwork](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.onNetwork.html)
[lexicon: com.publicdomainrelay.temp.compute.events.vm.hostKeys](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.hostKeys.html)
[lexicon: com.publicdomainrelay.temp.compute.events.vm.sandbox](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.sandbox.html)
[lexicon: com.publicdomainrelay.temp.compute.events.vm.delete](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.delete.html)
[lexicon: com.publicdomainrelay.temp.compute.events.vm.terminated](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.terminated.html)
[lexicon: com.publicdomainrelay.temp.compute.events.vm.memoryPressure](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.memoryPressure.html)
[lexicon: com.publicdomainrelay.temp.compute.events.vm.oomKilled](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.oomKilled.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.publicKey](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.publicKey.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.signalWebRTC](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.signalWebRTC.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.secrets](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secrets.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.secretsRequested](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secretsRequested.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.secretsApplied](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secretsApplied.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.secretsUpdated](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.secretsUpdated.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.agentStart](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.agentStart.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.requesterDid](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.requesterDid.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.r2Start](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.r2Start.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.r2Release](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.r2Release.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.r2Released](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.r2Released.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.memoryPressure](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.memoryPressure.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.oomKill](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.oomKill.html)
[lexicon: com.publicdomainrelay.temp.compute.events.guest.image](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.guest.image.html)
## Boot: hostKeys And onNetwork
docs/protocol/identity.md+14−15
@@ -48,15 +48,17 @@ The operator writes the pair once: by signing in at the bidder's MarketIdentity
## Lexicons And NSIDs In This File
| NSID | type | rkey | used |
|---|---|---|---|
| `network.attested.signature` | object (and `#signatures` array) | - | inline on every market and compute event record |
| `network.attested.proof` | record, key `tid` | - | defined, not written |
| `network.attested.verify` | query | - | defined, not served or called |
| `com.publicdomainrelay.temp.badgeBlueKeys` | record, key `any` | see [below](#badgebluekeys) | signer key binding, ssh key claim |
| `link.ident.endorsement` | record, key `any` (ident.link `74d22dc`, vendored) | the agent DID | principal confirms an agent, [below](#associations-identlink) |
| `com.publicdomainrelay.temp.market.association` | record | the agent DID | the grant, [below](#associations-identlink) |
| `com.publicdomainrelay.temp.market.associationRequest` | record | [lexicons-market.md](lexicons-market.md#marketassociationrequest) | flow [below](#contract-scoped-association) |
| NSID | rkey | used |
|---|---|---|
| `network.attested.signature` | - | inline on every market and compute event record |
| `network.attested.proof` | - | defined, not written |
| `network.attested.verify` | - | defined, not served or called |
| `com.publicdomainrelay.temp.badgeBlueKeys` | see [below](#badgebluekeys) | signer key binding, ssh key claim |
| `link.ident.endorsement` (ident.link `74d22dc`, vendored) | the agent DID | principal confirms an agent, [below](#associations-identlink) |
| `com.publicdomainrelay.temp.market.association` | the agent DID | the grant, [below](#associations-identlink) |
| `com.publicdomainrelay.temp.market.associationRequest` | [lexicons-market.md](lexicons-market.md#marketassociationrequest) | flow [below](#contract-scoped-association) |
Types and fields: each NSID's page in the [lexicon reference](https://socialweb.computer/docs/lexicons/).
## network.attested
@@ -98,12 +100,9 @@ flowchart LR
## badgeBlueKeys
| field | value |
|---|---|
| NSID | `com.publicdomainrelay.temp.badgeBlueKeys` |
| type | record, key `any` |
| key fields | `keyId` (the bound key), `challenge` (the repo DID it binds to), `service`, `createdAt`; optional `nonce`, `name` (the signer binding writes neither) |
| Go | `internal/atproto/market/badgeblue.go` |
[lexicon: com.publicdomainrelay.temp.badgeBlueKeys](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.badgeBlueKeys.html)
Go: `internal/atproto/market/badgeblue.go`; the signer binding writes neither `nonce` nor `name`.
One collection, two uses. Each has its own rkey and `service`.
docs/protocol/lexicons-market.md+133−224
@@ -1,114 +1,61 @@
# lexicons-market: one row per lexicon
- reference rows for every lexicon under `lexicons/com/publicdomainrelay/temp/` except `cluster.*` ([infra.md](infra.md#compublicdomainrelaytempcluster)) and `badgeBlueKeys` ([identity.md](identity.md#badgebluekeys)), plus the two NSIDs here that have no lexicon file
- 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)), plus the two NSIDs here that have no lexicon file
- 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
## Columns
## Rows
| column | meaning |
| row | meaning |
|---|---|
| type | lexicon `defs.main.type`: record, procedure, query, subscription |
| key fields | required fields first (`*`), then the fields the code reads |
| 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 |
## Coverage
| file | section | done |
|---|---|---|
| `market/rfp.json` | [market.rfp](#marketrfp) | x |
| `market/bid.json` | [market.bid](#marketbid) | x |
| `market/bids/free.json` | [market.bids.free](#marketbidsfree) | x |
| `market/bids/x402.json` | [market.bids.x402](#marketbidsx402) | x |
| `market/accept.json` | [market.accept](#marketaccept) | x |
| `market/accepts/free.json` | [market.accepts.free](#marketacceptsfree) | x |
| `market/accepts/x402.json` | [market.accepts.x402](#marketacceptsx402) | x |
| `market/receipt.json` | [market.receipt](#marketreceipt) | x |
| `market/receipts/free.json` | [market.receipts.free](#marketreceiptsfree) | x |
| `market/receipts/x402.json` | [market.receipts.x402](#marketreceiptsx402) | x |
| `market/event.json` | [market.event](#marketevent) | x |
| `market/offering.json` | [market.offering](#marketoffering) | x |
| `market/heartbeat.json` | [market.heartbeat](#marketheartbeat) | x |
| `market/relays.json` | [market.relays](#marketrelays) | x |
| `market/association.json` | [market.association](#marketassociation) | x |
| `market/associationRequest.json` | [market.associationRequest](#marketassociationrequest) | x |
| `computer/socialweb/peer.json` | [computer.socialweb.peer](#computersocialwebpeer) | x |
| `link/ident/endorsement.json` (ident.link `74d22dc`, vendored verbatim) | [identity.md](identity.md#associations-identlink) | x |
| `market/submitRfp.json` | [market.submitRfp](#marketsubmitrfp) | x |
| `market/submitBid.json` | [market.submitBid](#marketsubmitbid) | x |
| `market/submitAccept.json` | [market.submitAccept](#marketsubmitaccept) | x |
| `market/submitEvent.json` | [market.submitEvent](#marketsubmitevent) | x |
| `compute/vm.json` | [compute.vm](#computevm) | x |
| `compute/events/vm/delete.json` | [compute.events.vm.delete](#computeeventsvmdelete) | x |
| `compute/events/vm/hostKeys.json` | [compute.events.vm.hostKeys](#computeeventsvmhostkeys) | x |
| `compute/events/vm/onNetwork.json` | [compute.events.vm.onNetwork](#computeeventsvmonnetwork) | x |
| `compute/events/vm/registerIdentity.json` | [compute.events.vm.registerIdentity](#computeeventsvmregisteridentity) | x |
| `compute/events/vm/sandbox.json` | [compute.events.vm.sandbox](#computeeventsvmsandbox) | x |
| `compute/events/vm/started.json` | [compute.events.vm.started](#computeeventsvmstarted) | x |
| `compute/events/vm/terminated.json` | [compute.events.vm.terminated](#computeeventsvmterminated) | x |
| `compute/events/vm/memoryPressure.json` | [compute.events.vm.memoryPressure](#computeeventsvmmemorypressure) | x |
| `compute/events/vm/oomKilled.json` | [compute.events.vm.oomKilled](#computeeventsvmoomkilled) | x |
| `compute/events/guest/publicKey.json` | [compute.events.guest.publicKey](#computeeventsguestpublickey) | x |
| `compute/events/guest/signalWebRTC.json` | [compute.events.guest.signalWebRTC](#computeeventsguestsignalwebrtc) | x |
| `compute/events/guest/secrets.json` | [compute.events.guest.secrets](#computeeventsguestsecrets) | x |
| `compute/events/guest/secretsRequested.json` | [compute.events.guest.secretsRequested](#computeeventsguestsecretsrequested) | x |
| `compute/events/guest/secretsApplied.json` | [compute.events.guest.secretsApplied](#computeeventsguestsecretsapplied) | x |
| `compute/events/guest/secretsUpdated.json` | [compute.events.guest.secretsUpdated](#computeeventsguestsecretsupdated) | x |
| `compute/events/guest/agentStart.json` | [compute.events.guest.agentStart](#computeeventsguestagentstart) | x |
| `compute/events/guest/requesterDid.json` | [compute.events.guest.requesterDid](#computeeventsguestrequesterdid) | x |
| `compute/events/guest/r2Start.json` | [compute.events.guest.r2Start](#computeeventsguestr2start) | x |
| `compute/events/guest/r2Release.json` | [compute.events.guest.r2Release](#computeeventsguestr2release) | x |
| `compute/events/guest/r2Released.json` | [compute.events.guest.r2Released](#computeeventsguestr2released) | x |
| `compute/events/guest/memoryPressure.json` | [compute.events.guest.memoryPressure](#computeeventsguestmemorypressure) | x |
| `compute/events/guest/oomKill.json` | [compute.events.guest.oomKill](#computeeventsguestoomkill) | x |
| `compute/events/guest/image.json` | [compute.events.guest.image](#computeeventsguestimage) | x |
| `compute/guest/subscribeEvents.json` | [compute.guest.subscribeEvents](#computeguestsubscribeevents) | x |
| `ingress/webRTC.json` | [ingress.webRTC](#ingresswebrtc) | x |
| no file (`SecretsNSID`) | [compute.secrets.getSecrets](#computesecretsgetsecrets) | x |
| no file (`WIFSimpleNSID`) | [compute.config.wif.simple](#computeconfigwifsimple) | x |
## Summary
| NSID tail | type | rkey written | written by | step |
|---|---|---|---|---|
| `market.rfp` | record | TID | requester | S3 |
| `market.bid` | record | `market.BidRKey` | bidder | S4 |
| `market.bids.free` | record | `<bid rkey>-payload` | bidder | S4 |
| `market.bids.x402` | record | none | defined, not written | S4 |
| `market.accept` | record | `SessionRKey("accept", ...)` | requester | S5 |
| `market.accepts.free`, `market.accepts.x402` | record | none | defined, not written | S5 |
| `market.receipt` | record | `market.ReceiptRKey` | bidder | S6 |
| `market.receipts.free`, `market.receipts.x402` | record | none | defined, not written | S6 |
| `market.event` | record | per kind | both | S7-S9 |
| `market.offering` | record | `self` | bidder | S3 (discovery) |
| `market.heartbeat` | record | `self` (literal) | bidder | S3 (discovery) |
| `market.relays` | record | `self` | no Go writer here | S3 (discovery) |
| `market.association` | record | the agent DID | principal | S5, S8 |
| `market.associationRequest` | record | the principal DID | guest requester | S8 |
| `computer.socialweb.peer` | record | the subhandle | guest requester (its own and each co-located account's); requester (each spec.agent contract's atirc agent) | S8 |
| `market.submitRfp` | procedure | - | served by bidder | S3 |
| `market.submitBid` | procedure | - | served by requester | S4 |
| `market.submitAccept` | procedure | - | served by bidder | S5 |
| `market.submitEvent` | procedure | - | served by both | S7-S9 |
| `compute.vm` | record | TID | requester | S3 |
| `compute.events.vm.*` | record | per kind | bidder (vm.delete: requester) | S7, S9 |
| `compute.events.guest.*` | record | per kind | requester or bidder for the guest | S8 |
| `compute.guest.subscribeEvents` | subscription | - | served by bidder GuestControlPlane | S8 |
| `ingress.webRTC` | record | `webrtc` (listen), TID (offer, answer) | requester, bidder | S3-S6 |
| `compute.secrets.getSecrets` | query (route, no file) | - | served by requester | S8 |
| `compute.config.wif.simple` | record (no file) | `<bid rkey>-config` | bidder | S4 |
| 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 |
|---|---|
| file | `market/rfp.json` |
| type | record, key any |
| key fields | `payload`* (strongRef -> `compute.vm`), `signatures`*, `domain` (`compute`), `submitBid`, `ingress[]`, `policies[]`, `createdAt` |
| 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`) |
@@ -116,11 +63,10 @@
## market.bid
[lexicon: com.publicdomainrelay.temp.market.bid](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.bid.html)
| item | value |
|---|---|
| file | `market/bid.json` |
| type | record, key any |
| key fields | `rfp`*, `payload`* (-> `market.bids.free`), `signatures`*, `config` (-> `compute.config.wif.simple`), `ingress[]`, `createdAt` |
| 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 |
@@ -128,11 +74,10 @@
## market.bids.free
[lexicon: com.publicdomainrelay.temp.market.bids.free](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.bids.free.html)
| item | value |
|---|---|
| file | `market/bids/free.json` |
| type | record, key any |
| key fields | `reason`* (`free`), `signatures`*, `cost` (0), `createdAt` |
| 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`) |
@@ -140,11 +85,10 @@
## market.bids.x402
[lexicon: com.publicdomainrelay.temp.market.bids.x402](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.bids.x402.html)
| item | value |
|---|---|
| file | `market/bids/x402.json` |
| type | record, key any |
| key fields | `cost`*, `currency`*, `frequency`*, `prepay`*, `url`*, `signatures`* |
| 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`) |
@@ -152,11 +96,11 @@
## market.accept
[lexicon: com.publicdomainrelay.temp.market.accept](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.accept.html)
| item | value |
|---|---|
| file | `market/accept.json` |
| type | record, key any |
| key fields | `rfp`*, `bid`*, `signatures`*, `payload` (unset by the code), `submitEvent`, `ingress[]`, `createdAt` |
| 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 |
@@ -164,11 +108,10 @@
## market.accepts.free
[lexicon: com.publicdomainrelay.temp.market.accepts.free](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.accepts.free.html)
| item | value |
|---|---|
| file | `market/accepts/free.json` |
| type | record, key any |
| key fields | `bid`*, `signatures`*, `payload`, `createdAt` |
| rkey | none: defined, not written |
| written by | no Go writer (`AcceptsFreeNSID` constant only) |
| read by | none |
@@ -176,11 +119,10 @@
## market.accepts.x402
[lexicon: com.publicdomainrelay.temp.market.accepts.x402](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.accepts.x402.html)
| item | value |
|---|---|
| file | `market/accepts/x402.json` |
| type | record, key any |
| key fields | `bid`*, `signatures`*, `payload` (the payment), `createdAt` |
| rkey | none: defined, not written |
| written by | no Go writer (`AcceptsX402NSID` constant only) |
| read by | none |
@@ -188,11 +130,11 @@
## market.receipt
[lexicon: com.publicdomainrelay.temp.market.receipt](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.receipt.html)
| item | value |
|---|---|
| file | `market/receipt.json` |
| type | record, key any |
| key fields | `rfp`*, `bid`*, `accept`*, `cid`*, `signatures`*, `payload` (-> the RFP's `compute.vm`; `null` when none), `submitEvent` (copied from the accept when the bidder serves inbound XRPC), `ingress[]` |
| 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`) |
@@ -200,11 +142,10 @@
## market.receipts.free
[lexicon: com.publicdomainrelay.temp.market.receipts.free](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.receipts.free.html)
| item | value |
|---|---|
| file | `market/receipts/free.json` |
| type | record, key any |
| key fields | `accept`*, `cid`*, `signatures`*, `createdAt` |
| rkey | none: defined, not written |
| written by | no Go writer (`ReceiptsFreeNSID` constant; named in OAuth scopes, `internal/atproto/oauth/scope.go`) |
| read by | none |
@@ -212,11 +153,10 @@
## market.receipts.x402
[lexicon: com.publicdomainrelay.temp.market.receipts.x402](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.receipts.x402.html)
| item | value |
|---|---|
| file | `market/receipts/x402.json` |
| type | record, key any |
| key fields | `accept`*, `cid`*, `signatures`*, `createdAt` |
| rkey | none: defined, not written |
| written by | no Go writer (`ReceiptsX402NSID` constant; named in OAuth scopes) |
| read by | none |
@@ -224,11 +164,10 @@
## market.event
[lexicon: com.publicdomainrelay.temp.market.event](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.event.html)
| item | value |
|---|---|
| file | `market/event.json` |
| type | record, key any |
| key fields | `receipt`*, `payload`* (-> a `compute.events.*` record in the same repo), `signatures`*, `createdAt` |
| 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` |
@@ -236,11 +175,10 @@
## market.offering
[lexicon: com.publicdomainrelay.temp.market.offering](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.offering.html)
| item | value |
|---|---|
| file | `market/offering.json` |
| type | record, key any (writers use `self`) |
| key fields | `appliesTo`* (holds `compute.vm`), `createdAt`*, `endpoints[]` (`{kind: iroh|webrtc|https, address}`), `ingress[]`, `maxCpus`, `maxMem`, `nestedVirt`, `images` (boots a requester image), `refreshedAt`, `withdrawnAt` |
| 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` |
@@ -248,11 +186,10 @@
## market.heartbeat
[lexicon: com.publicdomainrelay.temp.market.heartbeat](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.heartbeat.html)
| item | value |
|---|---|
| file | `market/heartbeat.json` |
| type | record, key `literal:self` |
| key fields | `offering`* (at-uri of the offering in the same repo), `createdAt`* |
| 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` |
@@ -260,11 +197,10 @@
## market.relays
[lexicon: com.publicdomainrelay.temp.market.relays](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.relays.html)
| item | value |
|---|---|
| file | `market/relays.json` |
| type | record, key any (writers use `self`, readers read only `self`) |
| key fields | `relays`* (HTTP(S) relay base URLs), `createdAt`* |
| 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` |
@@ -272,11 +208,10 @@
## market.association
[lexicon: com.publicdomainrelay.temp.market.association](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.association.html)
| item | value |
|---|---|
| file | `market/association.json` |
| type | record, key any |
| key fields | `agent`* (== rkey), `createdAt`*, `expiresAt`, `contract` (-> `market.accept`, needs `expiresAt`) |
| 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 renter 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`) |
@@ -286,11 +221,10 @@
## market.associationRequest
[lexicon: com.publicdomainrelay.temp.market.associationRequest](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.associationRequest.html)
| item | value |
|---|---|
| file | `market/associationRequest.json` |
| type | record, key any |
| key fields | `principal`*, `contract`* (the principal's accept uri), `nonce`*, `createdAt`*, `accounts` (the co-located DIDs) |
| 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` |
@@ -298,11 +232,11 @@
## computer.socialweb.peer
[lexicon: computer.socialweb.peer](https://socialweb.computer/docs/lexicons/computer.socialweb.peer.html)
| item | value |
|---|---|
| file | `computer/socialweb/peer.json` |
| type | record, key any |
| key fields | `createdAt`*, `iroh` (short ticket); the lexicon also has `webrtc` (the DID answering ingress offers) and `channels`, which no writer sets |
| 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 |
@@ -311,10 +245,10 @@
## market.submitRfp
[lexicon: com.publicdomainrelay.temp.market.submitRfp](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitRfp.html)
| item | value |
|---|---|
| file | `market/submitRfp.json` |
| type | procedure, service auth `lxm` = the NSID, issuer = requester |
| 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); errors `InvalidRequest`, `Unauthorized`, `Forbidden`, `Unavailable`; the code also answers 409 `RFPClosed` |
| served by | bidder: `handleSubmitRFP` in `internal/services/bidder/routes.go` -> `Bidder.SubmitRFP` |
@@ -323,10 +257,10 @@
## market.submitBid
[lexicon: com.publicdomainrelay.temp.market.submitBid](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitBid.html)
| item | value |
|---|---|
| file | `market/submitBid.json` |
| type | procedure, issuer = bidder |
| 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 |
@@ -335,10 +269,10 @@
## market.submitAccept
[lexicon: com.publicdomainrelay.temp.market.submitAccept](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitAccept.html)
| item | value |
|---|---|
| file | `market/submitAccept.json` |
| type | procedure, issuer = requester |
| input | `{acceptUri, acceptCid, ingress?}` |
| output | 202 `{ok, id, acceptUri, acceptCid}`; lexicon also has `uri`, `cid`, `submitEvent`, `ingress` (never returned); errors add `InternalError`; the code also answers 409 `CapacityExceeded` (not in the lexicon) |
| served by | bidder: `handleSubmitAccept` -> `Bidder.SubmitAccept` (provisioning StateSync) |
@@ -347,10 +281,10 @@
## market.submitEvent
[lexicon: com.publicdomainrelay.temp.market.submitEvent](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.market.submitEvent.html)
| item | value |
|---|---|
| file | `market/submitEvent.json` |
| type | procedure, issuer = the accept author (to a bidder) or the receipt author (to a requester) |
| 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`) |
@@ -359,11 +293,10 @@
## compute.vm
[lexicon: com.publicdomainrelay.temp.compute.vm](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.vm.html)
| item | value |
|---|---|
| file | `compute/vm.json` |
| type | record, key any |
| key fields | `role`* (VM name in the contract), `kind` (`vm` default, `deno`), `cpus` (2), `mem` (`4G`), `disk` (`50G`), `nestedVirt`, `image` (`{url, sha256}`: an https base holding `image.json`, sha256 of that file), `network`, `location`, `user_data`, `createdAt` |
| 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) |
@@ -371,11 +304,10 @@
## 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 |
|---|---|
| file | `compute/events/vm/delete.json` |
| type | record, key any |
| key fields | `reason`* (`released`), `createdAt`*, `signatures` |
| 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 |
@@ -383,11 +315,10 @@
## 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 |
|---|---|
| file | `compute/events/vm/hostKeys.json` |
| type | record, key any; def `hostKey {type*, publicKey*, fingerprint*}` |
| key fields | `keys[]`*, `observedAt`*, `createdAt`* |
| 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` |
@@ -395,11 +326,10 @@
## 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 |
|---|---|
| file | `compute/events/vm/onNetwork.json` |
| type | record, key any |
| key fields | `createdAt`*, `kind` (`iroh`, `https`, `webrtc`, `sandbox`), `address`, `tag` |
| 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` |
@@ -407,11 +337,10 @@
## compute.events.vm.registerIdentity
[lexicon: com.publicdomainrelay.temp.compute.events.vm.registerIdentity](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.registerIdentity.html)
| item | value |
|---|---|
| file | `compute/events/vm/registerIdentity.json` |
| type | record, key any |
| key fields | `createdAt`* |
| rkey | none: defined, not written |
| written by | no Go writer (`ComputeEventsVMRegisterIdentityNSID` constant only) |
| read by | none |
@@ -419,11 +348,10 @@
## 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 |
|---|---|
| file | `compute/events/vm/sandbox.json` |
| type | record, key any |
| key fields | `exitCode`* (-1 = killed), `createdAt`*, `timedOut`, `stdout`, `stderr` (capped) |
| 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`) |
@@ -431,11 +359,10 @@
## compute.events.vm.started
[lexicon: com.publicdomainrelay.temp.compute.events.vm.started](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.compute.events.vm.started.html)
| item | value |
|---|---|
| file | `compute/events/vm/started.json` |
| type | record, key any |
| key fields | `createdAt`*, `observedAt` |
| rkey | none: defined, not written |
| written by | no Go writer (`ComputeEventsVMStartedNSID` constant only) |
| read by | none |
@@ -443,11 +370,10 @@
## 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 |
|---|---|
| file | `compute/events/vm/memoryPressure.json` |
| type | record, key any |
| key fields | `kind`* (`high` or `max`), `threshold`* (bytes), `observed`* (memory.current bytes), `observedAt`*, `createdAt`* |
| 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 (renters and the watch page) |
@@ -455,11 +381,10 @@
## 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 |
|---|---|
| file | `compute/events/vm/oomKilled.json` |
| type | record, key any |
| key fields | `kills`* (new kills), `total`*, `limit`* (memory.max bytes), `observedAt`*, `createdAt`* |
| 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 |
@@ -467,11 +392,10 @@
## 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 |
|---|---|
| file | `compute/events/vm/terminated.json` |
| type | record, key any |
| key fields | `reason`* (`market.VMTerminatedReasons`), `observedAt`*, `createdAt`*, `exitCode`, `request` (-> the `vm.delete`) |
| 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 |
@@ -479,11 +403,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/publicKey.json` |
| type | record, key any |
| key fields | `kind`* (`age-x25519`), `tag`*, `key`* (age1...), `createdAt`* |
| 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) |
@@ -491,11 +414,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/signalWebRTC.json` |
| type | record, key any |
| key fields | `kind`* (`offer`, `answer`), `tag`*, `ciphertext`* (age armored `{sdp, replyTo}`), `createdAt`* |
| 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) |
@@ -503,11 +425,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/secrets.json` |
| type | record, key any |
| key fields | `ciphertext`* (age armored bundle, at most 65536 bytes), `createdAt`* |
| 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 |
@@ -515,11 +436,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/secretsRequested.json` |
| type | record, key any |
| key fields | `createdAt`* |
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent (`secretsFallback: Sealed` only) |
| read by | requester: `status.contract.secretsRequested`, then `sealGuestSecrets` |
@@ -527,11 +447,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/secretsApplied.json` |
| type | record, key any |
| key fields | `via`* (`getSecrets`, `sealed`), `createdAt`*, `count` |
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent |
| read by | requester: `status.contract.secretsApplied`, condition `SecretsApplied` |
@@ -539,11 +458,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/secretsUpdated.json` |
| type | record, key any |
| key fields | `createdAt`* |
| 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 |
@@ -551,11 +469,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/agentStart.json` |
| type | record, key any |
| key fields | `createdAt`* |
| 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`) |
@@ -563,11 +480,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/requesterDid.json` |
| type | record, key any |
| key fields | `did`* (did:plc only), `createdAt`* |
| 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`) |
@@ -575,11 +491,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/r2Start.json` |
| type | record, key any |
| key fields | `name`* (DNS label), `createdAt`*, `agent`, `hold` |
| 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`) |
@@ -587,11 +502,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/r2Release.json` |
| type | record, key any |
| key fields | `createdAt`* |
| rkey | `SessionRKey("contract-event", uid)` |
| written by | requester only: `releaseGuestRequester` (`internal/market/requester/guestrequester.go`) |
| read by | guest agent: `socialweb-r2-release.service` |
@@ -599,11 +513,10 @@
## 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 |
|---|---|
| file | `compute/events/guest/r2Released.json` |
| type | record, key any |
| key fields | `ok`*, `createdAt`*, `message` |
| rkey | bidder `EventRKeys("guest:...")` |
| written by | bidder for the guest agent |
| read by | requester: `status.contract.r2Release`, condition GuestRequesterReleased |
@@ -611,43 +524,40 @@
## 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 |
|---|---|
| file | `compute/events/guest/memoryPressure.json` |
| type | record, key any |
| key fields | `kind`* psi / swap, `threshold`*, `psiSomeAvg10`, `psiFullAvg10`, `swapUsed`*, `swapTotal`*, `observedAt`*, `createdAt`* (percentages in hundredths) |
| 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 |
|---|---|
| file | `compute/events/guest/oomKill.json` |
| type | record, key any |
| key fields | `kills`*, `total`*, `observedAt`*, `createdAt`* |
| 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 |
|---|---|
| file | `compute/events/guest/image.json` |
| type | record, key any |
| key fields | `marker`* (the first line of the guest's `/etc/swc-image`), `createdAt`* |
| 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 |
|---|---|
| file | `compute/guest/subscribeEvents.json` |
| type | subscription; param `cursor`; message `#event {seq*, uri*, cid*, record*}`; error `FutureCursor` |
| 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 |
@@ -655,11 +565,10 @@
## ingress.webRTC
[lexicon: com.publicdomainrelay.temp.ingress.webRTC](https://socialweb.computer/docs/lexicons/com.publicdomainrelay.temp.ingress.webRTC.html)
| item | value |
|---|---|
| file | `ingress/webRTC.json` |
| type | record, key any |
| key fields | `kind`* (`webrtc`), `mode`* (`listen`, `offer`, `answer`), `id`* (hex sha256 of the requester repo DID), `createdAt`*, `peer`, `session`, `descriptor` (-> the listen record), `sdp`, `stunUrls` |
| 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`) |
docs/protocol/README.md+7−6
@@ -23,15 +23,16 @@
| [policy.md](policy.md) | policy records (gha-lite workflows), the strongRefs an RFP attaches, tangled-vouch |
| [outside.md](outside.md) | lexicons we use but do not own: `sh.tangled.graph.vouch`, `chat.atirc.*`, `com.atproto.*`, `app.bsky.*`, `com.fedproxy.*`, OAuth scopes per role |
## How To Read A Lexicon Row
## The Lexicon Reference
Every lexicon section in this tree carries the same fields.
The lexicon files under `lexicons/` are the one source of every record's and method's fields. The reference is generated
from them: https://socialweb.computer/docs/lexicons/ (one page per NSID: type, key, fields, refs, errors, the raw schema
and the docs pages that name it) and https://socialweb.computer/docs/xrpc/ (the XRPC methods). A docs page that shows a
lexicon's fields includes the generated table (a `[lexicon: <nsid>](https://socialweb.computer/docs/lexicons/<nsid>.html)`
line, rendered as the table on the site) and adds only what the code does with it:
| field | meaning |
| row | meaning |
|---|---|
| NSID | the full id, as in the `id` of the lexicon file |
| type | `record`, `query`, `procedure`, `subscription` or `object` |
| key fields | the fields a reader acts on; the lexicon file has the rest |
| rkey | `self`, a deterministic key (named), `tid`, or `any` with the scheme the writer uses |
| written by / read by | the application role and the Go package |
| step | the step of the [end-to-end sequence](#end-to-end-sequence) where it appears |
docs/protocol/release.md+16−6
@@ -7,12 +7,22 @@
## Records
| NSID | rkey | holds | strongRefs |
|---|---|---|---|
| `software.release.project` | `socialweb-computer` | `name`, `description` | - |
| `software.release.manifest` | `socialweb-computer:<rc version>` as written today (the lexicon says `tid`) | `commit`, `artifacts[]` `software.release.defs#httpArtifact {name, url, cid, size, target {os, arch}}` | `project` (at-uri) |
| `software.release.version` | `socialweb-computer:<version>` | `version` | `manifest`, `previous` (the version it replaced) |
| `software.release.channel` | `socialweb-computer:rc`, `socialweb-computer:stable` | `name`, `updatedAt` | `version` |
| NSID | rkey |
|---|---|
| `software.release.project` | `socialweb-computer` |
| `software.release.manifest` | `socialweb-computer:<rc version>` as written today (the lexicon says `tid`) |
| `software.release.version` | `socialweb-computer:<version>`; `previous` is the version it replaced |
| `software.release.channel` | `socialweb-computer:rc`, `socialweb-computer:stable` |
[lexicon: software.release.project](https://socialweb.computer/docs/lexicons/software.release.project.html)
[lexicon: software.release.manifest](https://socialweb.computer/docs/lexicons/software.release.manifest.html)
[lexicon: software.release.version](https://socialweb.computer/docs/lexicons/software.release.version.html)
[lexicon: software.release.channel](https://socialweb.computer/docs/lexicons/software.release.channel.html)
[lexicon: software.release.defs](https://socialweb.computer/docs/lexicons/software.release.defs.html)
An artifact's `cid` is a CIDv1 raw sha2-256 of the file's bytes: the sha256 of the binary, checked after download.
docs/README.md+2−0
@@ -24,6 +24,8 @@ Start at the [README](../README.md). Agents: [../AGENTS.md](../AGENTS.md) first.
| [protocol/compute-contract-flow-map.md](protocol/compute-contract-flow-map.md) | the compute contract flow map: every layer from the lexicons to the guest transport |
| [SYSTEM.md](SYSTEM.md) | the whole system: repos, hosts, apps, market protocol, guests, identity, ssh gateway, atirc, clusters |
| [protocol/README.md](protocol/README.md) | the atproto lexicons and the end-to-end sequence; [protocol/glossary.md](protocol/glossary.md): every NSID |
| [lexicon reference](https://socialweb.computer/docs/lexicons/) | every record, object and method, generated from [../lexicons/](../lexicons/) (on the site) |
| [XRPC reference](https://socialweb.computer/docs/xrpc/) | the XRPC methods, generated from the same files (on the site) |
| [KCP.md](KCP.md) | how every app uses kcp |
| [ARCHITECTURE.md](ARCHITECTURE.md) | decisions, measurements, invariants (open a section by heading) |
| [../deploy/market-network/README.md](../deploy/market-network/README.md) | the one-kcp market network |
site/build.ts+49−5
@@ -1,7 +1,7 @@
import { Marked } from "marked";
import puppeteer from "puppeteer-core";
import { createHighlighter } from "shiki";
import { lexiconOut, loadLexicons, nsidLookup, referencePages } from "./lexref.ts";
import { lexiconKit, lexiconOut, loadLexicons, nsidLookup, type UsedIn } from "./lexref.ts";
const REPO = "https://knotless.dev/socialweb.computer/socialweb-computer-kcp";
const REF = "main";
@@ -27,6 +27,7 @@ const DOCS = [
"docs/protocol/guest-events.md",
"docs/protocol/release.md",
"docs/protocol/glossary.md",
"docs/protocol/lexicons-market.md",
];
const FANCY = [
["index", "Compute Contracts"],
@@ -66,6 +67,7 @@ const LEXICONS = await loadLexicons(root);
for (const lex of LEXICONS.values()) OUT_OF.set(lex.file, lexiconOut(lex.id));
OUT_OF.set("lexicons", "docs/lexicons/index.html");
const findNsid = nsidLookup(LEXICONS);
const KIT = lexiconKit(LEXICONS, { esc: escape, rel: relative, hl: highlight });
const LANGS: Record<string, string> = {
sh: "bash", bash: "bash", shell: "bash", console: "bash", zsh: "bash",
@@ -94,6 +96,15 @@ function readableOn(hex: string): string {
return fixed;
}
const SITE_URL = "https://socialweb.computer/";
const GLOSSARY = "docs/protocol/glossary.md";
const used = new Map<string, Set<string>>();
function noteUse(nsid: string, page: Page) {
if (page.src === GLOSSARY) return;
if (!used.has(nsid)) used.set(nsid, new Set());
used.get(nsid)!.add(page.out);
}
function highlight(code: string, info: string): string {
const word = (info ?? "").trim().split(/\s+/)[0].toLowerCase();
const lang = LANGS[word];
@@ -140,6 +151,12 @@ function isDir(path: string): boolean {
}
function rewrite(page: Page, href: string): string {
if (href.startsWith(SITE_URL)) {
const u = new URL(href);
let path = u.pathname.slice(1);
if (path === "" || path.endsWith("/")) path += "index.html";
return relative(page.out, path) + u.hash;
}
if (/^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("#")) return href;
const hash = href.indexOf("#");
const path = hash < 0 ? href : href.slice(0, hash);
@@ -219,7 +236,18 @@ async function render(page: Page): Promise<Rendered> {
const marked = new Marked({ gfm: true });
marked.use({
walkTokens(token) {
if (token.type === "link") token.href = rewrite(page, token.href);
const quiet = (t: { tokens?: unknown[] }) => (t.tokens ?? []).forEach((c) => { (c as { noLink?: boolean }).noLink = true; });
if (token.type === "link") {
const m = token.href.match(/^https:\/\/socialweb\.computer\/docs\/lexicons\/([\w.]+)\.html/);
if (m && LEXICONS.has(m[1])) noteUse(m[1], page);
token.href = rewrite(page, token.href);
quiet(token);
}
if (token.type === "heading") quiet(token);
if (token.type === "codespan") {
const nsid = findNsid(token.text.replace(/&amp;/g, "&"));
if (nsid) noteUse(nsid, page);
}
},
renderer: {
heading({ tokens, depth, text }) {
@@ -245,12 +273,25 @@ async function render(page: Page): Promise<Rendered> {
}
return highlight(text, lang ?? "");
},
codespan({ text }) {
if (page.src !== "docs/protocol/glossary.md") return false;
codespan(token) {
const text = token.text;
if (page.section === "root" || (token as { noLink?: boolean }).noLink) return false;
const nsid = findNsid(text.replace(/&amp;/g, "&"));
if (!nsid) return false;
return `<a class="nsid-link" href="${escape(relative(page.out, lexiconOut(nsid)))}"><code>${text}</code></a>`;
},
paragraph({ tokens }) {
const only = tokens.length === 1 && tokens[0].type === "link" ? tokens[0] as { href: string; text: string } : undefined;
const inc = only?.text.match(/^lexicon: ([\w.]+)$/);
if (inc) {
const want = relative(page.out, lexiconOut(inc[1]));
if (only!.href !== want) throw new Error(`${page.src}: include ${inc[1]} links ${only!.href}, not ${SITE_URL}${lexiconOut(inc[1])}`);
noteUse(inc[1], page);
return KIT.include(inc[1], page.out);
}
if (only?.text === "glossary: generated from lexicons/") return "<!--glossary-->\n";
return false;
},
blockquote({ tokens }) {
const body = this.parser.parse(tokens);
const m = body.match(/^<p>\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*(<\/p>\s*)?/);
@@ -461,7 +502,10 @@ const tagline = (readme.split(/\n\s*\n/).find((p) => p.trim() && !p.startsWith("
const rendered: Rendered[] = [];
for (const page of PAGES) rendered.push(await render(page));
for (const ref of referencePages(LEXICONS, { esc: escape, rel: relative, hl: highlight })) {
const titles = new Map(rendered.map((r) => [r.page.out, r.title]));
const usedIn: UsedIn = new Map([...used].map(([nsid, outs]) => [nsid, [...outs].sort().map((o) => ({ out: o, title: titles.get(o) ?? o }))]));
for (const r of rendered) r.body = r.body.replace("<!--glossary-->", () => KIT.glossary(r.page.out, usedIn));
for (const ref of KIT.pages(usedIn)) {
const src = ref.out;
rendered.push({ page: { src, as: src, out: ref.out, raw: false, section: "docs" }, title: ref.title, body: ref.body, aside: ref.aside });
}
site/lexref.ts+59−2
@@ -114,7 +114,14 @@ function groups(list: Lexicon[]): Map<string, Map<string, Lexicon[]>> {
return fams;
}
export function referencePages(lexs: Map<string, Lexicon>, h: Helpers): RefPage[] {
export type UsedIn = Map<string, { out: string; title: string }[]>;
export function notInUse(lex: Lexicon): boolean {
const d = (lex.defs.main?.description ?? lex.description ?? "").trim();
return /^(not in use|defined, not (written|served|called|used))\b/i.test(d);
}
export function lexiconKit(lexs: Map<string, Lexicon>, h: Helpers) {
const { esc, rel } = h;
const list = sorted(lexs);
const fams = groups(list);
@@ -250,6 +257,50 @@ export function referencePages(lexs: Map<string, Lexicon>, h: Helpers): RefPage[
return parts.join("\n");
}
const unused = `<span class="badge t-unused" title="the lexicon's description says it is defined but not written or served today">not in use</span>`;
function include(nsid: string, here: string): string {
const lex = lexs.get(nsid);
if (!lex) throw new Error(`${here}: include of ${nsid}: no such lexicon`);
const main = lex.defs.main;
const href = rel(here, lexiconOut(nsid));
const meta = [badge(mainType(lex))];
if (main?.key) meta.push(`<span class="kv">key <code>${esc(String(main.key))}</code></span>`);
if (notInUse(lex)) meta.push(unused);
const prefix = `inc-${nsid.replace(/\./g, "-")}-`;
const inner = main
? defSection(here, lex, "main", main)
.replace(/<h3 id="[^"]+">([^<]*)<\/h3>/g, '<p class="lexinc-sub">$1</p>')
.replace(/ id="/g, ` id="${prefix}`)
: "";
const others = Object.keys(lex.defs).filter((n) => n !== "main");
const more = others.length ? `<p class="lexinc-more">also: ${others.map((n) => `<a href="${esc(href)}#${esc(n)}"><code>#${esc(n)}</code></a>`).join(" ")}</p>` : "";
const desc = main?.description ?? lex.description;
return `<div class="lexinc"><p class="lexinc-head"><a href="${esc(href)}"><code>${esc(nsid)}</code></a> ${meta.join(" ")}</p>${desc ? `<p class="lexinc-desc">${esc(desc)}</p>` : ""}${inner}${more}</div>\n`;
}
function usedList(here: string, nsid: string, usedIn: UsedIn): string {
const pages = (usedIn.get(nsid) ?? []).filter((p) => p.out !== here);
return pages.map((p) => `<a href="${esc(rel(here, p.out))}">${esc(p.title)}</a>`).join(", ");
}
function glossary(here: string, usedIn: UsedIn): string {
const out: string[] = [];
for (const [fam, gs] of fams) {
for (const [g, items] of gs) {
out.push(`<h3 id="${esc(g)}">${esc(g)}</h3><div class="table"><table class="props"><thead><tr><th>NSID</th><th>type</th><th>what</th><th>docs</th></tr></thead><tbody>`);
for (const l of items) {
const d = firstSentence(l.defs.main?.description ?? l.description);
out.push(`<tr><td class="pn"><a href="${esc(rel(here, lexiconOut(l.id)))}"><code>${esc(l.id.slice(g.length + 1))}</code></a></td><td>${badge(mainType(l))}${notInUse(l) ? ` ${unused}` : ""}</td><td>${esc(d)}</td><td>${usedList(here, l.id, usedIn)}</td></tr>`);
}
out.push(`</tbody></table></div>`);
}
void fam;
}
return out.join("\n");
}
function pages(usedIn: UsedIn): RefPage[] {
const pages: RefPage[] = [];
for (const lex of list) {
const here = lexiconOut(lex.id);
@@ -260,6 +311,8 @@ export function referencePages(lexs: Map<string, Lexicon>, h: Helpers): RefPage[
if (main?.type === "query") meta.push(`<span class="kv">HTTP <code>GET /xrpc/${esc(lex.id)}</code></span>`);
if (main?.type === "procedure") meta.push(`<span class="kv">HTTP <code>POST /xrpc/${esc(lex.id)}</code></span>`);
if (main?.type === "subscription") meta.push(`<span class="kv">WebSocket <code>/xrpc/${esc(lex.id)}</code></span>`);
if (notInUse(lex)) meta.push(unused);
const used = usedList(here, lex.id, usedIn);
const others = Object.keys(lex.defs).filter((n) => n !== "main");
const toc = others.length
? `<p class="toc">definitions: ${others.map((n) => `<a href="#${esc(n)}"><code>#${esc(n)}</code></a>`).join(" ")}</p>`
@@ -274,6 +327,7 @@ export function referencePages(lexs: Map<string, Lexicon>, h: Helpers): RefPage[
desc ? `<p class="lede">${esc(desc)}</p>` : "",
toc,
...sections,
`<h2 id="used-in" class="def">used in</h2><p>${used || "no page of these docs names it yet."}</p>`,
`<details id="raw" class="raw"><summary>raw schema: <code>${esc(lex.file)}</code></summary>${raw}</details>`,
].join("\n");
pages.push({ out: here, title: lex.id, body, aside: aside(here, XRPC.has(t) ? "xrpc" : "lexicons") });
@@ -290,7 +344,7 @@ export function referencePages(lexs: Map<string, Lexicon>, h: Helpers): RefPage[
for (const [g, items] of gs) {
index.push(`<h3 id="${esc(g)}">${esc(g)}</h3><div class="table"><table class="props"><tbody>`);
for (const l of items) {
index.push(`<tr><td class="pn"><a href="${esc(rel(LEX_INDEX, lexiconOut(l.id)))}"><code>${esc(l.id.slice(g.length + 1))}</code></a></td><td>${badge(mainType(l))}</td><td>${esc(firstSentence(l.defs.main?.description ?? l.description))}</td></tr>`);
index.push(`<tr><td class="pn"><a href="${esc(rel(LEX_INDEX, lexiconOut(l.id)))}"><code>${esc(l.id.slice(g.length + 1))}</code></a></td><td>${badge(mainType(l))}${notInUse(l) ? ` ${unused}` : ""}</td><td>${esc(firstSentence(l.defs.main?.description ?? l.description))}</td></tr>`);
}
index.push(`</tbody></table></div>`);
}
@@ -316,6 +370,9 @@ export function referencePages(lexs: Map<string, Lexicon>, h: Helpers): RefPage[
}
pages.push({ out: XRPC_INDEX, title: "XRPC", body: xi.join("\n"), aside: aside(XRPC_INDEX, "xrpc") });
return pages;
}
return { include, glossary, pages };
}
export function nsidLookup(lexs: Map<string, Lexicon>): (text: string) => string | undefined {
site/style.css+42−0
@@ -457,6 +457,7 @@ h1.nsid .ns {
.badge.t-query { color: #1c5aa8; background: #e8f0fb; }
.badge.t-procedure { color: #8a4b00; background: #fdf1e2; }
.badge.t-subscription { color: #6b3fa0; background: #f3ecfb; }
.badge.t-unused { color: #8a2c0d; background: #fdecea; }
.badge.t-object, .badge.t-token, .badge.t-string, .badge.t-array, .badge.t-defs { color: #4b5563; background: var(--soft); }
h2.def {
@@ -509,6 +510,47 @@ table.props .desc {
color: var(--muted);
}
.lexinc {
margin: 1em 0 1.4em;
padding: 8px 12px 4px;
border: 1px solid var(--rule);
border-left: 4px solid var(--mark);
border-radius: 6px;
}
.lexinc-head {
display: flex;
flex-wrap: wrap;
gap: 6px 12px;
align-items: center;
margin: 0.2em 0;
overflow-wrap: anywhere;
}
.lexinc-desc {
margin: 0.3em 0;
color: var(--muted);
overflow-wrap: anywhere;
}
.lexinc-sub {
margin: 0.8em 0 0.2em;
font-weight: 700;
}
.lexinc-more {
font-size: 0.9em;
color: var(--muted);
}
.lexinc table.props td.pn {
white-space: nowrap;
}
table.props a.ref code {
overflow-wrap: anywhere;
}
details.raw {
margin: 2em 0 1em;
}