Skip to content

Protocol Reference

This is the authoritative protocol reference for Pinix. It covers the Connect-RPC API, ProviderStream wire format, and IPC v2 protocol.

All Hub communication uses Connect-RPC (HTTP/2, Protocol Buffers). The Hub exposes these RPCs:

RPCTypeDescription
InvokeUnaryInvoke a Clip command
InvokeStreamServer streamInvoke with streaming response
ListClipsUnaryList all registered Clips
GetClipManifestUnaryGet a Clip’s full manifest
GetClipWebUnaryProxy Clip Web UI resources
AddClipUnaryInstall a Clip from Registry
RemoveClipUnaryUninstall a Clip
ProviderStreamBidirectionalProvider connection (registration + invoke forwarding)
RuntimeStreamBidirectionalRuntime lifecycle management
GetLogsServer streamStream Clip logs
HubInfoUnaryHub metadata (version, mode)
DataReadUnaryRead Clip data
DataWriteUnaryWrite Clip data

Three token types:

TokenScopeUse case
Hub TokenUser scope (@username)CLI, Console, Cloud Hub
Clip TokenSingle ClipClip-to-Hub communication
Super TokenFull accessLocal development

Tokens are passed via Authorization: Bearer <token> header.

The ProviderStream is a bidirectional stream between a Provider and the Hub.

type ProviderMessage =
| { type: "RegisterClips"; clips: ClipInfo[] }
| { type: "UnregisterClips"; aliases: string[] }
| { type: "InvokeResponse"; requestId: string; output: any }
| { type: "InvokeStreamChunk"; requestId: string; chunk: any }
| { type: "InvokeStreamEnd"; requestId: string }
| { type: "Heartbeat" }
| { type: "Log"; alias: string; level: string; message: string };
type HubMessage =
| { type: "ProviderHello"; sessionId: string }
| { type: "InvokeRequest"; requestId: string; alias: string; command: string; input: any }
| { type: "Heartbeat" }
| { type: "RuntimeInstall"; package: string; version: string }
| { type: "RuntimeUninstall"; alias: string };
  • Format: UUID v4
  • Unique per invocation
  • Used to match InvokeRequestInvokeResponse
  • Must be included in all response and streaming messages

Communication between the Runtime and SDK Clips uses NDJSON (newline-delimited JSON) over stdin/stdout.

{"type":"invoke","id":"req-1","command":"list","input":{}}

One JSON object per line, terminated by \n.

TypeDirectionPurpose
invokeRuntime → ClipInvoke a command
responseClip → RuntimeCommand result
streamClip → RuntimeStreaming chunk
stream_endClip → RuntimeEnd of stream
invoke_clipClip → RuntimeCross-Clip invocation request
invoke_clip_responseRuntime → ClipCross-Clip result
logClip → RuntimeStructured log message
Runtime Clip (Bun process)
│ │
│─── {"type":"invoke","id":"r1", ───►│
│ "command":"list","input":{}} │
│ │
│◄── {"type":"response","id":"r1", ───│
│ "output":{"items":[...]}} │
│ │
Runtime Clip A Clip B
│ │ │
│── invoke ──────────►│ │
│ │ │
│ │── invoke_clip ────────►│ (via Runtime + Hub)
│ │ │
│ │◄─ invoke_clip_response─│
│ │ │
│◄── response ───────│ │
CodeMeaning
NOT_FOUNDClip or command not found
INVALID_ARGUMENTMissing or invalid input parameter
PERMISSION_DENIEDToken doesn’t have access
UNAVAILABLEClip is offline or Provider disconnected
INTERNALClip handler threw an error
DEADLINE_EXCEEDEDInvocation timed out

Errors are returned as structured objects:

{
"error": {
"code": "NOT_FOUND",
"message": "Clip 'my-clip' not found"
}
}
Provider Hub
│ │
│── ProviderStream (connect) ──►│
│◄── ProviderHello ────────────│
│ │
│── RegisterClips ─────────────►│
│ [{package, alias, commands}]│
│ │
│ Hub adds to routing table │
│ │
Client Hub Provider Clip
│ │ │ │
│─Invoke─►│ │ │
│ │─InvokeReq►│ │
│ │ │─invoke──►│
│ │ │◄─response│
│ │◄InvokeRes─│ │
│◄─result─│ │ │
Client Hub Provider Clip
│ │ │ │
│─Stream─►│ │ │
│ │─InvokeReq►│ │
│ │ │─invoke──►│
│ │ │◄─stream──│ (chunk 1)
│ │◄StreamChk─│ │
│◄─chunk──│ │ │
│ │ │◄─stream──│ (chunk 2)
│ │◄StreamChk─│ │
│◄─chunk──│ │ │
│ │ │◄stream_end│
│ │◄StreamEnd─│ │
│◄─end────│ │ │