一键导入
registry
VM service discovery registry. Use when registering VMs, discovering services by role, sending heartbeats, or recovering from session loss.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
VM service discovery registry. Use when registering VMs, discovering services by role, sending heartbeats, or recovering from session loss.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Always register VM snapshots in the commit ledger. Use when committing/snapshotting VMs, before destroying VMs, during deploys, or when creating golden images. Ensures no snapshot goes untracked.
Generate a magic login link for the agent-services dashboard UI. Use when the user wants to access the dashboard, needs a login link, says "magic link," or asks for UI access.
Shared task board for coordinating work across agents. Use when creating, assigning, tracking, or querying tasks in a swarm.
Deploy a branch to a preview VM for zero-risk change review. Snapshot infra, clone it, deploy the branch on the clone, share the link. Production untouched. Use for ALL UI changes, feature demos, and PR reviews.
Commit ledger for tracking VM snapshots. Use when recording, querying, or managing Vers VM commit history — golden images, infra snapshots, rollback points.
Append-only work log for agent sessions. Use when recording what happened, what was decided, and what's next — the log is for the next session's orchestrator.
| name | registry |
| description | VM service discovery registry. Use when registering VMs, discovering services by role, sending heartbeats, or recovering from session loss. |
Service discovery for persistent Vers VMs. Agents register themselves so other agents can find them without hardcoded addresses.
VERS_INFRA_URL env var points to the infra VM running agent-services (e.g., http://abc123.vm.vers.sh:3000). All endpoints below are relative to this base URL.
curl -X POST "$VERS_INFRA_URL/registry/vms" \
-H "Content-Type: application/json" \
-d '{
"id": "abc-123-def",
"name": "billing-lt",
"role": "lieutenant",
"address": "abc-123-def.vm.vers.sh",
"registeredBy": "orchestrator",
"services": [{"name": "pi-rpc", "port": 3001}],
"metadata": {"task": "process invoices"}
}'
Returns 201 with the full entry. Returns 409 if the VM ID is already registered.
Fields: id (required, Vers VM UUID), name (required), role (required: infra|lieutenant|worker|golden|custom), address (required), registeredBy (required), status (default: running), services (optional), metadata (optional).
# All VMs
curl "$VERS_INFRA_URL/registry/vms"
# Filter by role
curl "$VERS_INFRA_URL/registry/vms?role=lieutenant"
# Filter by status
curl "$VERS_INFRA_URL/registry/vms?status=running"
# Combine filters
curl "$VERS_INFRA_URL/registry/vms?role=infra&status=running"
Returns { vms: [...], count: N }. When filtering status=running, stale VMs (no heartbeat in 5 min) are excluded.
curl "$VERS_INFRA_URL/registry/vms/abc-123-def"
curl -X PATCH "$VERS_INFRA_URL/registry/vms/abc-123-def" \
-H "Content-Type: application/json" \
-d '{"status": "paused", "metadata": {"reason": "saving resources"}}'
Updatable fields: name, status, address, services, metadata.
curl -X DELETE "$VERS_INFRA_URL/registry/vms/abc-123-def"
curl -X POST "$VERS_INFRA_URL/registry/vms/abc-123-def/heartbeat"
Returns { id, lastSeen }. Updates the lastSeen timestamp.
# Find infra VM(s)
curl "$VERS_INFRA_URL/registry/discover/infra"
# Find all lieutenants
curl "$VERS_INFRA_URL/registry/discover/lieutenant"
# Find workers
curl "$VERS_INFRA_URL/registry/discover/worker"
Returns { vms: [...], count: N }. Only returns running, non-stale VMs. This is the primary way agents find things.
After vers_lt_create, register the lieutenant so other agents can discover it:
# After creating lieutenant "billing" on VM abc-123-def
curl -X POST "$VERS_INFRA_URL/registry/vms" \
-H "Content-Type: application/json" \
-d '{
"id": "abc-123-def",
"name": "billing",
"role": "lieutenant",
"address": "abc-123-def.vm.vers.sh",
"registeredBy": "orchestrator",
"services": [{"name": "pi-rpc", "port": 3001}]
}'
INFRA=$(curl -s "$VERS_INFRA_URL/registry/discover/infra" | jq -r '.vms[0].address')
# Now use $INFRA to hit board/feed
curl "http://$INFRA:3000/board/tasks"
curl "http://$INFRA:3000/feed/events"
Send a heartbeat every 2 minutes. VMs are considered stale after 5 minutes without a heartbeat. Stale VMs are excluded from discover and ?status=running queries.
# In a loop or cron — every 2 minutes
while true; do
curl -s -X POST "$VERS_INFRA_URL/registry/vms/$MY_VM_ID/heartbeat"
sleep 120
done
List all VMs and check lastSeen to find VMs that may need cleanup:
curl -s "$VERS_INFRA_URL/registry/vms" | jq '.vms[] | select(.status == "running") | {id, name, lastSeen}'
The infra VM should register itself when starting agent-services:
VM_ID=$(hostname) # or from Vers metadata
curl -X POST "http://localhost:3000/registry/vms" \
-H "Content-Type: application/json" \
-d "{
\"id\": \"$VM_ID\",
\"name\": \"infra\",
\"role\": \"infra\",
\"address\": \"$VM_ID.vm.vers.sh\",
\"registeredBy\": \"self\",
\"services\": [
{\"name\": \"board\", \"port\": 3000, \"healthPath\": \"/health\"},
{\"name\": \"feed\", \"port\": 3000, \"healthPath\": \"/health\"},
{\"name\": \"registry\", \"port\": 3000, \"healthPath\": \"/health\"}
]
}"
The agent-services extension automatically handles registration for agents with VERS_VM_ID set:
VERS_AGENT_ROLE, defaults to worker)stoppedYou only need to manually register VMs that don't run the extension (e.g., infra VMs set up via direct SSH).
If the agent-services extension is loaded, use these tools instead of curl:
registry_register — Register a VM entryregistry_list — List/filter registered VMsregistry_discover — Discover VMs by role (preferred over list for lookups)registry_heartbeat — Send a heartbeat for a VMThese tools use VERS_INFRA_URL automatically.
interface RegisteredVM {
id: string; // Vers VM UUID
name: string; // Human/agent-readable name
role: "infra" | "lieutenant" | "worker" | "golden" | "custom";
status: "running" | "paused" | "stopped";
address: string; // e.g., "abc123.vm.vers.sh"
services?: { name: string; port: number; healthPath?: string }[];
metadata?: Record<string, unknown>;
registeredBy: string; // Who registered it
registeredAt: string; // ISO timestamp
lastSeen: string; // Updated by heartbeat
}