Define the formal network graph schema for Web4 so mesh routing, trust propagation, service invocation, and observability are interoperable across implementations.
A Node represents an agent, service, or infrastructure peer.
{
"id": "node-a",
"kind": "agent|service|router",
"address": "local://node-a",
"capabilities": ["cip", "mesh", "service"],
"metadata": {
"version": "1.0",
"tags": ["edge", "demo"]
}
}id(string)kind(string)address(string)
An Edge represents a directed relationship between nodes.
{
"id": "edge-a-c",
"source": "node-a",
"target": "node-c",
"relation": "routes|trusts|invokes",
"weight": 1.0,
"state": "active|inactive",
"metadata": {
"latency_ms": 5,
"bandwidth": "low"
}
}id(string)source(string)target(string)relation(string)
TrustFSM states and transitions for a single peer:
unknown→probingon handshakeprobing→trustedon verificationprobing→blockedon conflicttrusted→probingon conflict- Any →
blockedon malicious signal
Distributed trust propagates over trusted edges:
- If node A trusts node C, and node C introduces node B, node A sets node B to
probing. - Propagation MUST NOT auto-promote to
trustedwithout local verification.
MeshEnvelope is the transport carrier for graph-aware routing.
{
"mesh": "1.0",
"id": "<uuid>",
"type": "MESH_HELLO|SERVICE_INVOKE",
"origin": "node-a",
"destination": "node-b",
"payload": {},
"hops": ["node-c"],
"created_at": "2025-01-01T00:00:00Z"
}Required fields: mesh, id, type, origin, destination, payload, hops, created_at.
- If
destinationequalsorigin, route locally. - Drop if destination already in
hops(loop prevention). - Drop if hop count exceeds policy limit.
- Drop if destination trust state is
blocked. - Only route to destinations present in the peer registry.
Events are emitted as graph-aware records:
{
"event_type": "mesh_routed|trust_updated|service_invoked",
"node": "node-a",
"peer": "node-b",
"payload": {},
"occurred_at": "2025-01-01T00:00:00Z"
}Service invocation extends the graph with invokes edges:
relation:invokesmetadata:{ "service": "service-b", "version": "1.0" }
Services are nodes with kind: "service" and MUST expose a handler.