Advertise CultNet transport profiles

This commit is contained in:
Meta Vens 2026-06-14 21:20:52 +01:00
commit a2bc9aeab4
21 changed files with 539 additions and 7 deletions

View file

@ -161,6 +161,7 @@ def daemon_ready_document(server: CultMeshLocalServer) -> dict[str, Any]:
"supportedDocumentTypes": [document.type for document in server.node.documents],
"supportedMessageVersions": list(hello_response.get("supportedMessageVersions") or ()),
"supportedMutationContracts": list(hello_response.get("supportedMutationContracts") or ()),
"transportProfiles": list(hello_response.get("transportProfiles") or ()),
"snapshotLimits": {
"maxSnapshotDocuments": server.max_snapshot_documents,
"maxSnapshotBytes": server.max_snapshot_bytes,

View file

@ -308,6 +308,28 @@ class CultMeshLocalServer:
if self.observation_hub is not None
else []
),
"transportProfiles": [
{
"schemaVersion": "cultnet.transport_profile.v0",
"runtimeId": self.node.runtime_id,
"transports": [
{
"transportId": "cultmesh-local-tcp",
"protocol": "tcp_framed",
"host": self.host,
"port": self.port,
"wireContracts": ["cultnet.schema.v0"],
"channels": [
{
"channelId": "schema",
"delivery": "reliable",
"ordering": "ordered",
}
],
}
],
}
],
"supportsSchemaCatalog": True,
}

View file

@ -569,6 +569,28 @@ def discovery_loop(sock: socket.socket, advertise_host: str, tcp_port: int, stat
"tcpHost": advertise_host,
"tcpPort": tcp_port,
"wireContract": INTEROP_WIRE_CONTRACT,
"transportProfiles": [
{
"schemaVersion": "cultnet.transport_profile.v0",
"runtimeId": state.runtime_id,
"transports": [
{
"transportId": "interop-tcp",
"protocol": "tcp_framed",
"host": advertise_host,
"port": tcp_port,
"wireContracts": [INTEROP_WIRE_CONTRACT],
"channels": [
{
"channelId": "schema",
"delivery": "reliable",
"ordering": "ordered",
}
],
}
],
}
],
"supportedDocumentTypes": [INTEROP_DOCUMENT_TYPE],
"supportsSchemaCatalog": True,
}

View file

@ -37,6 +37,7 @@ def hello(
supported_wire_contracts: list[str] | None = None,
supported_schema_versions: list[str] | None = None,
supported_mutation_contracts: list[dict[str, Any]] | None = None,
transport_profiles: list[dict[str, Any]] | None = None,
) -> CultNetMessage:
return CultNetMessage(
"cultnet.hello.v0",
@ -45,6 +46,7 @@ def hello(
"supportedWireContracts": supported_wire_contracts or ["cultnet.schema.v0"],
"supportedSchemaVersions": supported_schema_versions or [],
"supportedMutationContracts": supported_mutation_contracts or [],
"transportProfiles": transport_profiles or [],
},
)

View file

@ -332,6 +332,12 @@ def wire_message_schema_properties(schema_version: str) -> dict[str, Any]:
},
},
"supportedMessageVersions": string_array,
"transportProfiles": {
"type": "array",
"items": {
"$ref": TRANSPORT_PROFILE_SCHEMA_ID,
},
},
"supportsSchemaCatalog": {"type": "boolean"},
},
"cultnet.error.v0": {