Skip to main content

P2P WebSockets

ValorIDE can coordinate multiple IDE instances through a shared WebSocket protocol. The protocol is designed for agent-to-agent collaboration, remote command routing, and future swarm workflows.

Message Envelope

All peer messages use a consistent envelope:

{
"sourceId": "ide-a",
"targetId": "ide-b",
"messageId": "01HV...",
"type": "user_command",
"payload": {},
"timestamp": "2026-05-22T12:00:00.000Z"
}
FieldPurpose
sourceIdSending ValorIDE instance
targetIdReceiving instance or broadcast
messageIdUnique message identifier for traceability
typePayload discriminator
payloadMessage-specific data
timestampISO-8601 send time

Message Types

user_command

Injects a command into another ValorIDE instance as if the user had typed it.

{
"taskId": null,
"command": "Inspect the failing test and propose a fix.",
"args": {}
}

llm_response

Broadcasts an assistant response or task update from one instance to its peers.

{
"taskId": "task-123",
"llmResponse": {
"role": "assistant",
"content": "The failing test is caused by..."
}
}

Collaboration Flow

Implementation Notes

The protocol depends on three responsibilities:

  • A communication service sends, receives, validates, and routes envelopes.
  • The task or chat controller accepts inbound commands as controlled user input.
  • The LLM service emits response events when a remote-visible task completes or streams meaningful progress.

Safety Requirements

Remote command handling should be explicit and auditable:

  • validate source and target identities before dispatch
  • distinguish broadcast from direct command delivery
  • log message IDs with task IDs
  • require normal ValorIDE approval gates for file edits, shell commands, and external side effects

Related guides: