// node socialweb-computer-vm-mcp.compose.ts > socialweb-computer-vm-mcp.composition.json import { composition, host } from "../../atlibs/javascript/src/compose/build.js"; import { irohUserData, policyBidPayload, policyRequesterTangledVouch, processMcp, requester, userData, vmMcp } from "./atlibs.modules.js"; const c = composition({ name: "socialweb.computer VMs for a model", description: "vm-mcp's four tools (vm_create, vm_list, vm_exec, vm_release) over the requester (bids judged by tangled-vouch and bid-payload; user-data and iroh-user-data make the cloud-init) and process-mcp (the guest agent's shell over iroh). Serve vm's actions as MCP.", limits: { depth: 4, calls: 100000 }, }); const bidders = c.param("bidders", { label: "Bidder DIDs", type: "array", description: "The bidders to ask, by DID.", values: { default: ["did:plc:7q5lnitxv4meizdon5fmhzrq", "did:plc:4vcig7s43z3nyqrnepmcfzqt", "did:plc:2l2wdry77c7jtucbslstagkj"] }, }); const pool = c.param("pool", { label: "Pool", description: "The record key of the VM list (one per agent session that should not see another's).", values: { default: "self" } }); const max_vms = c.param("max_vms", { label: "VMs kept at most", type: "integer", minimum: 1, maximum: 10, values: { default: 2 } }); const max_cpus = c.param("max_cpus", { label: "vCPUs at most", type: "integer", minimum: 1, maximum: 16, values: { default: 4 } }); const max_mem = c.param("max_mem", { label: "Memory at most (GiB)", type: "integer", minimum: 1, maximum: 64, values: { default: 8 } }); const max_hold_minutes = c.param("max_hold_minutes", { label: "Hold at most (minutes)", type: "integer", minimum: 1, maximum: 1440, values: { default: 240 } }); const vm = c.instance("vm", vmMcp, { input: { bidders, via: "iroh", pool, max_vms, max_cpus, max_mem, max_hold_minutes } }); const machine = c.instance("machine", requester, { session: "requester", input: { kind: "vm", shell: true, iroh: true, ssh_key: host("sshPublicKey"), reason: "vm-mcp" } }); const user_data = c.instance("user_data", userData); const iroh_user_data = c.instance("iroh_user_data", irohUserData); const vouch = c.instance("vouch", policyRequesterTangledVouch); const payload = c.instance("payload", policyBidPayload); const process_ = c.instance("process", processMcp); c.route(vm, "computer.socialweb.vm.provision", machine, "vm_create rents the VM and keeps it"); c.route(vm, "computer.socialweb.vm.release", machine, "vm_release gives it back"); c.route(vm, "computer.socialweb.cicd.process.exec", process_, "vm_exec runs the command on the VM"); c.route(machine, "com.publicdomainrelay.temp.market.evaluatePolicy", vouch, "the requester or its operator vouched for the bidder"); c.route(machine, "com.publicdomainrelay.temp.market.evaluatePolicy", payload, "only free bids"); c.route(machine, "computer.socialweb.vm.userData", user_data, "the VM's cloud-init: the guest agent's shell, iroh in front of sshd"); c.route(user_data, "computer.socialweb.vm.irohUserData", iroh_user_data, "root ssh with the host's key, dumbpipe in front of sshd"); process.stdout.write(await c.json());