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

johnandersen777.bsky.social/atlibs-socialweb-computer-requester

socialweb.computer market requester and policy modules for atlibs, with its web pages and lexicons

0
0
main
753 lines · 20.6 KB Raw History
{
	"name": "requester",
	"description": "Request compute on the socialweb.computer market: sign and publish an RFP, collect bids, accept one, release the VM.",
	"actions": [
		{
			"entry": "contract",
			"label": "Run a contract",
			"fields": [
				{
					"key": "bidders",
					"type": "array",
					"label": "Bidder DIDs",
					"required": true,
					"description": "Bidder DIDs to submit the rfp to (at most 10)."
				},
				{
					"key": "user_data",
					"type": "string",
					"label": "cloud-init user data",
					"description": "cloud-init for the VM. Omitted: the userData hook builds it from shell, webrtc_ssh, iroh and ssh_key (default: a guest agent serving the MCP shell); a JSON #cloud-config's tunnels.json tags are read for webrtc reports."
				},
				{
					"key": "shell",
					"type": "boolean",
					"label": "MCP shell",
					"description": "Without user_data: the guest agent's MCP shell service and its \"shell\" webrtc tunnel (default true)."
				},
				{
					"key": "webrtc_ssh",
					"type": "boolean",
					"label": "ssh over webrtc",
					"description": "Without user_data: an \"ssh\" webrtc tunnel to sshd (needs ssh_key; default false)."
				},
				{
					"key": "iroh",
					"type": "boolean",
					"label": "ssh over iroh",
					"description": "Without user_data: dumbpipe in front of sshd, its ticket the guest's onNetwork report (needs ssh_key; default false)."
				},
				{
					"key": "ssh_key",
					"type": "string",
					"label": "SSH public key",
					"description": "Without user_data: the OpenSSH public key for root, with webrtc_ssh or iroh."
				},
				{
					"key": "tunnels",
					"type": "array",
					"label": "More tunnels",
					"description": "Without user_data: datachannel tunnels to local TCP ports on the VM, [{tag, port, transport: \"webrtc\"}] (the user-data module's)."
				},
				{
					"key": "kind",
					"type": "string",
					"label": "Compute kind",
					"values": {
						"enum": [
							"vm",
							"deno"
						],
						"default": "vm"
					},
					"description": "What the bidder runs: vm, a firecracker VM (default), or deno, a sandbox running user_data as its program. Always written to the vm record."
				},
				{
					"key": "role",
					"type": "string",
					"label": "Role",
					"description": "RBAC role the compute runs under (default compute)."
				},
				{
					"key": "cpus",
					"type": "integer",
					"label": "vCPUs",
					"description": "Number of vCPUs."
				},
				{
					"key": "mem",
					"type": "string",
					"label": "Memory",
					"description": "Memory request, e.g. 4G; a number is GiB."
				},
				{
					"key": "disk",
					"type": "string",
					"label": "Disk",
					"description": "Disk request (default 50G)."
				},
				{
					"key": "network",
					"type": "string",
					"label": "Network quota",
					"description": "Network throughput or quota, e.g. 500G."
				},
				{
					"key": "expires_at",
					"type": "string",
					"label": "Expires at",
					"description": "When the bidder ends the VM, an RFC 3339 datetime (compute.vm expiresAt; without it a bidder ends it a day after the accept)."
				},
				{
					"key": "policies",
					"type": "array",
					"label": "Policy strong refs",
					"description": "Strong refs {uri, cid} to policies the rfp names."
				},
				{
					"key": "via",
					"type": "string",
					"label": "iroh or webrtc",
					"description": "Wait for what this transport needs (iroh: ticket and host keys; webrtc: the tag's fingerprint) and run command over it."
				},
				{
					"key": "tag",
					"type": "string",
					"label": "webrtc tag",
					"description": "The webrtc tag to wait for and run command on (default ssh; shell for the MCP shell channel, without command)."
				},
				{
					"key": "tags",
					"type": "array",
					"label": "webrtc tags",
					"description": "Tags whose onNetwork reports to read (default ssh, shell), besides user_data's tunnels and tag."
				},
				{
					"key": "command",
					"type": "string",
					"label": "Command",
					"description": "Run on the guest once ready (needs via)."
				},
				{
					"key": "stdin",
					"type": "string",
					"label": "Command stdin",
					"description": "The command's stdin (secrets go here, not in command); at most 65536 bytes."
				},
				{
					"key": "hold_ms",
					"type": "integer",
					"label": "Hold (ms)",
					"description": "Keep the VM this long before releasing (max 3600000)."
				},
				{
					"key": "release",
					"type": "boolean",
					"label": "Release",
					"description": "false keeps the VM: the result has mcp servers and records for a later release (default true)."
				},
				{
					"key": "cleanup",
					"type": "boolean",
					"label": "Clean up",
					"description": "Delete the records the run created after release (default true)."
				},
				{
					"key": "reason",
					"type": "string",
					"label": "Release reason",
					"description": "vm.delete reason (default session_ended)."
				},
				{
					"key": "accept_paid",
					"type": "boolean",
					"label": "Accept paid bids",
					"description": "Accept a bid that is not free (default false)."
				},
				{
					"key": "poll_ms",
					"type": "integer",
					"label": "Poll interval (ms)",
					"description": "Re-read interval while waiting (default 3000, max 60000)."
				},
				{
					"key": "max_polls",
					"type": "integer",
					"label": "Poll budget",
					"description": "Reads per wait before giving up (default 40, max 200)."
				}
			],
			"description": "One run: create the vm and a signed rfp, submitRfp to each bidder, accept the first free bid, wait for the receipt and the guest's reports, optionally run a command over iroh or webrtc, hold, release, delete its records. release: false keeps the VM; the result names its MCP servers (mcp)."
		},
		{
			"entry": "bind_key",
			"label": "Bind attestation key",
			"fields": [],
			"description": "Publish the badgeBlueKeys record binding the host's attestation did:key to you, so bidders accept your signed RFPs."
		},
		{
			"entry": "associate",
			"label": "Associate",
			"fields": [
				{
					"key": "peer",
					"type": "string",
					"label": "Peer DID",
					"required": true,
					"description": "The requester or bidder DID."
				},
				{
					"key": "role",
					"type": "string",
					"label": "Role (requester or bidder)",
					"description": "The peer's role (default requester)."
				}
			],
			"description": "Confirm an association with a requester or bidder DID (associateConfirm through its #<role>_associate service)."
		},
		{
			"entry": "offerings",
			"label": "Find bidders",
			"fields": [
				{
					"key": "bidders",
					"type": "array",
					"label": "Bidder DIDs",
					"required": true,
					"description": "Bidder DIDs (at most 10)."
				}
			],
			"readOnly": true,
			"description": "Each bidder DID's compute offering as { did, endpoints } (pass them as request's bidders: the host picks iroh, then https)."
		},
		{
			"entry": "request",
			"label": "Request compute",
			"fields": [
				{
					"key": "user_data",
					"type": "string",
					"label": "cloud-init user data",
					"description": "cloud-init for the VM. Omitted: the userData hook builds it from shell, webrtc_ssh, iroh and ssh_key (default: a guest agent serving the MCP shell)."
				},
				{
					"key": "shell",
					"type": "boolean",
					"label": "MCP shell",
					"description": "Without user_data: the guest agent's MCP shell service and its \"shell\" webrtc tunnel (default true)."
				},
				{
					"key": "webrtc_ssh",
					"type": "boolean",
					"label": "ssh over webrtc",
					"description": "Without user_data: an \"ssh\" webrtc tunnel to sshd (needs ssh_key; default false)."
				},
				{
					"key": "iroh",
					"type": "boolean",
					"label": "ssh over iroh",
					"description": "Without user_data: dumbpipe in front of sshd, its ticket the guest's onNetwork report (needs ssh_key; default false)."
				},
				{
					"key": "ssh_key",
					"type": "string",
					"label": "SSH public key",
					"description": "Without user_data: the OpenSSH public key for root, with webrtc_ssh or iroh."
				},
				{
					"key": "tunnels",
					"type": "array",
					"label": "More tunnels",
					"description": "Without user_data: datachannel tunnels to local TCP ports on the VM, [{tag, port, transport: \"webrtc\"}] (the user-data module's)."
				},
				{
					"key": "bidders",
					"type": "array",
					"label": "Bidder endpoints",
					"description": "https origins or DIDs to submitRfp to; none just creates the records."
				},
				{
					"key": "kind",
					"type": "string",
					"label": "Compute kind",
					"values": {
						"enum": [
							"vm",
							"deno"
						],
						"default": "vm"
					},
					"description": "What the bidder runs: vm, a firecracker VM (default), or deno, a sandbox running user_data as its program. Always written to the vm record."
				},
				{
					"key": "role",
					"type": "string",
					"label": "Role",
					"description": "RBAC role the compute runs under (default compute)."
				},
				{
					"key": "cpus",
					"type": "integer",
					"label": "vCPUs",
					"description": "Number of vCPUs."
				},
				{
					"key": "mem",
					"type": "string",
					"label": "Memory",
					"description": "Memory request, e.g. 4G; a number is GiB."
				},
				{
					"key": "disk",
					"type": "string",
					"label": "Disk",
					"description": "Disk request (default 50G)."
				},
				{
					"key": "network",
					"type": "string",
					"label": "Network quota",
					"description": "Network throughput or quota, e.g. 500G."
				},
				{
					"key": "expires_at",
					"type": "string",
					"label": "Expires at",
					"description": "When the bidder ends the VM, an RFC 3339 datetime (compute.vm expiresAt; without it a bidder ends it a day after the accept)."
				},
				{
					"key": "policies",
					"type": "array",
					"label": "Policy strong refs",
					"description": "Strong refs {uri, cid} to policies the rfp names."
				},
				{
					"key": "onBehalfOf",
					"type": "object",
					"label": "On behalf of",
					"description": "Strong ref {uri, cid} the rfp names as its principal."
				}
			],
			"description": "Create a compute.vm and a signed market.rfp, then submitRfp to each bidder endpoint."
		},
		{
			"entry": "bids",
			"label": "Collect bids",
			"fields": [
				{
					"key": "rfp",
					"type": "object",
					"label": "RFP strong ref",
					"required": true,
					"description": "{uri, cid} of the rfp."
				},
				{
					"key": "bidders",
					"type": "array",
					"label": "Bidder DIDs",
					"description": "Bidders whose bid on this rfp to read (at the key a bidder gives it)."
				},
				{
					"key": "bids",
					"type": "array",
					"label": "Bid URIs",
					"description": "Bid at:// URIs to read exactly."
				}
			],
			"readOnly": true,
			"description": "Bids on an RFP from these bidder DIDs, and the winner (first free, else lowest cost)."
		},
		{
			"entry": "accept",
			"label": "Accept bid",
			"fields": [
				{
					"key": "rfp",
					"type": "object",
					"label": "RFP strong ref",
					"required": true,
					"description": "{uri, cid} of the rfp."
				},
				{
					"key": "bid",
					"type": "object",
					"label": "Bid strong ref",
					"required": true,
					"description": "{uri, cid} of the bid."
				},
				{
					"key": "submitAccept",
					"type": "string",
					"label": "Bid submitAccept",
					"description": "The bid's submitAccept (https origin or did#service)."
				}
			],
			"description": "Create a signed market.accept and submitAccept to the bid's submitAccept, returning the receipt."
		},
		{
			"entry": "receipt",
			"label": "Find receipt",
			"fields": [
				{
					"key": "bidder",
					"type": "string",
					"label": "Bidder DID",
					"required": true
				},
				{
					"key": "accept",
					"type": "object",
					"label": "Accept strong ref",
					"required": true,
					"description": "{uri, cid} of the accept."
				}
			],
			"readOnly": true,
			"description": "The winner's receipt for an accept, read at the key the winner gives it."
		},
		{
			"entry": "guest",
			"label": "Guest",
			"fields": [
				{
					"key": "bidder",
					"type": "string",
					"label": "Bidder DID",
					"required": true
				},
				{
					"key": "receipt",
					"type": "string",
					"label": "Receipt URI",
					"required": true,
					"description": "The receipt's at:// URI."
				},
				{
					"key": "tags",
					"type": "array",
					"label": "webrtc tags",
					"description": "Tags whose onNetwork reports to read (default ssh, shell)."
				}
			],
			"readOnly": true,
			"description": "What the bidder reports about the VM for a receipt: iroh ticket, webrtc fingerprints, host keys, signals, termination."
		},
		{
			"entry": "watch",
			"label": "Watch guest",
			"fields": [
				{
					"key": "bidder",
					"type": "string",
					"label": "Bidder DID",
					"required": true
				},
				{
					"key": "receipt",
					"type": "string",
					"label": "Receipt URI",
					"required": true,
					"description": "The receipt's at:// URI."
				},
				{
					"key": "via",
					"type": "string",
					"label": "iroh or webrtc",
					"description": "Ready when this transport's reports are there."
				},
				{
					"key": "tag",
					"type": "string",
					"label": "webrtc tag",
					"description": "Tag for via webrtc and until answer (default ssh)."
				},
				{
					"key": "tags",
					"type": "array",
					"label": "webrtc tags",
					"description": "Tags whose onNetwork reports to read (default ssh, shell)."
				},
				{
					"key": "until",
					"type": "string",
					"label": "until",
					"description": "terminated or answer instead of via's readiness."
				},
				{
					"key": "poll_ms",
					"type": "integer",
					"label": "Poll interval (ms)",
					"description": "Re-read interval while waiting (default 3000, max 60000)."
				},
				{
					"key": "max_polls",
					"type": "integer",
					"label": "Poll budget",
					"description": "Reads per wait before giving up (default 40, max 200)."
				}
			],
			"readOnly": true,
			"description": "Re-read the guest's reports and event streams for a receipt until what `via` needs (or `until`: terminated, answer) is there."
		},
		{
			"entry": "release",
			"label": "Release VM",
			"fields": [
				{
					"key": "receipt",
					"type": "object",
					"label": "Receipt strong ref",
					"required": true,
					"description": "{uri, cid, submitEvent?}: the contract result's receipt."
				},
				{
					"key": "records",
					"type": "array",
					"label": "Kept records",
					"description": "A kept contract's records to delete; without it they are found from the receipt."
				},
				{
					"key": "submitEvent",
					"type": "string",
					"label": "Receipt submitEvent",
					"description": "https origin or did#service (default: the receipt's)."
				},
				{
					"key": "reason",
					"type": "string",
					"label": "Reason",
					"description": "vm.delete reason (default session_ended)."
				},
				{
					"key": "cleanup",
					"type": "boolean",
					"label": "Clean up",
					"description": "false keeps every record (default true)."
				},
				{
					"key": "poll_ms",
					"type": "integer",
					"label": "Poll interval (ms)",
					"description": "Re-read interval while waiting (default 3000, max 60000)."
				},
				{
					"key": "max_polls",
					"type": "integer",
					"label": "Poll budget",
					"description": "Reads per wait before giving up (default 40, max 200)."
				}
			],
			"description": "Sign vm.delete and market.event for a receipt and submitEvent them, wait for vm.terminated, then delete the kept records (records, else found from the receipt: accept, rfp, vm in your repo), its own and the signal records."
		},
		{
			"entry": "signal",
			"label": "Signal guest",
			"fields": [
				{
					"key": "receipt",
					"type": "object",
					"label": "Receipt strong ref",
					"required": true,
					"description": "{uri, cid}"
				},
				{
					"key": "tag",
					"type": "string",
					"label": "Tunnel tag",
					"required": true
				},
				{
					"key": "offer",
					"type": "string",
					"label": "Sealed offer (age armored)"
				},
				{
					"key": "key",
					"type": "string",
					"label": "age publicKey"
				},
				{
					"key": "submitEvent",
					"type": "string",
					"label": "Receipt submitEvent"
				}
			],
			"description": "Send the VM's guest agent a sealed webrtc offer (or an age publicKey) as signed guest.* and market.event records."
		},
		{
			"entry": "shell",
			"label": "Shell on guest",
			"fields": [
				{
					"key": "receipt",
					"type": "object",
					"label": "Receipt strong ref",
					"required": true,
					"description": "{uri, cid}"
				},
				{
					"key": "command",
					"type": "string",
					"label": "Command",
					"description": "Required over iroh; none over webrtc just opens the channel."
				},
				{
					"key": "stdin",
					"type": "string",
					"label": "Command stdin",
					"description": "At most 65536 bytes."
				},
				{
					"key": "via",
					"type": "string",
					"label": "Transport (webrtc or iroh)",
					"description": "Default webrtc."
				},
				{
					"key": "tag",
					"type": "string",
					"label": "Tunnel tag (webrtc, default ssh)"
				}
			],
			"description": "Run a command on the VM over a host transport: webrtc (the host signals and opens the datachannel; tag ssh; no command just opens it) or iroh (ssh over the guest's iroh ticket, host keys pinned)."
		}
	],
	"config": [
		{
			"key": "bidders",
			"type": "array",
			"label": "Bidder DIDs",
			"description": "The bidders to ask, by DID (at most 10)."
		},
		{
			"key": "kind",
			"label": "Compute kind",
			"description": "vm (a firecracker VM, the default) or deno."
		},
		{
			"key": "cpus",
			"type": "integer",
			"label": "vCPUs",
			"description": "vCPUs a contract asks for."
		},
		{
			"key": "mem",
			"type": "integer",
			"label": "Memory (GiB)",
			"description": "Memory a contract asks for, in GiB."
		},
		{
			"key": "ssh_key",
			"label": "SSH public key",
			"description": "Without user_data: root's OpenSSH public key."
		},
		{
			"key": "shell",
			"type": "boolean",
			"label": "MCP shell",
			"description": "Without user_data: the guest agent's MCP shell."
		},
		{
			"key": "iroh",
			"type": "boolean",
			"label": "ssh over iroh",
			"description": "Without user_data: dumbpipe in front of sshd."
		},
		{
			"key": "tunnels",
			"type": "array",
			"label": "More tunnels",
			"description": "Without user_data: datachannel tunnels to local TCP ports, [{tag, port, transport: \"webrtc\"}]."
		},
		{
			"key": "via",
			"label": "iroh or webrtc",
			"description": "The transport a contract waits for."
		},
		{
			"key": "release",
			"type": "boolean",
			"label": "Release",
			"description": "false keeps the VM after a contract."
		},
		{
			"key": "poll_ms",
			"type": "integer",
			"label": "Poll interval (ms)",
			"description": "Re-read interval while waiting."
		},
		{
			"key": "max_polls",
			"type": "integer",
			"label": "Poll budget",
			"description": "Reads per wait before giving up."
		},
		{
			"key": "reason",
			"label": "Release reason",
			"description": "vm.delete reason."
		}
	],
	"calls": [
		"com.atproto.repo.createRecord",
		"com.atproto.repo.deleteRecord",
		"com.atproto.repo.getRecord",
		"com.fedfork.exec.attest",
		"com.fedfork.exec.webrtc.connect",
		"com.fedfork.exec.iroh.connect",
		"com.publicdomainrelay.temp.requester.associateConfirm",
		"com.publicdomainrelay.temp.market.submitRfp",
		"com.publicdomainrelay.temp.market.submitAccept",
		"com.publicdomainrelay.temp.market.submitEvent"
	],
	"session": "requester",
	"hooks": [
		{
			"nsid": "com.publicdomainrelay.temp.market.evaluatePolicy",
			"reason": "kcp: each bid's bidder in scope mode, then the chosen winner in full mode with the rfp and bid refs, before the accept; every routed policy must allow",
			"combine": "all-allow",
			"default": "policy-requester-tangled-vouch",
			"required": true
		},
		{
			"nsid": "com.fedfork.exec.iroh.connect",
			"reason": "shell and contract with via iroh (the default): the host's iroh transport; a host without it fails that call"
		},
		{
			"nsid": "com.fedfork.exec.webrtc.connect",
			"reason": "shell and contract with via webrtc: a host with a webrtc transport (the pages); a host without it fails that call"
		},
		{
			"nsid": "computer.socialweb.vm.userData",
			"reason": "request and contract without user_data: cloud-init from shell, webrtc_ssh, iroh and ssh_key (the user-data module)",
			"default": "user-data",
			"entries": [
				"request",
				"contract"
			]
		}
	],
	"implements": [
		{
			"nsid": "computer.socialweb.vm.provision",
			"entry": "contract"
		},
		{
			"nsid": "computer.socialweb.vm.release",
			"entry": "release"
		},
		{
			"nsid": "com.fedfork.market.contract",
			"entry": "contract"
		},
		{
			"nsid": "com.fedfork.market.release",
			"entry": "release"
		},
		{
			"nsid": "com.fedfork.market.watch",
			"entry": "watch"
		}
	],
	"uri": "at://did:plc:ocnuqjlzgohypj3zoznermms/com.fedfork.exec.wasm.module/requester"
}