Documentation
¶
Overview ¶
Package ipc carries the wire protocol between Praxis and a praxis-pluginhost child process. The transport is line-delimited JSON over stdin/stdout — no protobuf, no gRPC, no third-party runtime dependency. Each line is one Frame; request and response share the same shape and are correlated by ID.
Phase 4 out-of-process loader.
Index ¶
- Constants
- func DecodeParams(raw json.RawMessage, v any) error
- func DecodeResult(raw json.RawMessage, v any) error
- func EncodeParams(v any) (json.RawMessage, error)
- func EncodeResult(v any) (json.RawMessage, error)
- type CapabilitiesResult
- type CapabilityDescriptor
- type Codec
- type ExecuteParams
- type ExecuteResult
- type Frame
- type ManifestParams
- type ManifestResult
Constants ¶
const ( MethodManifest = "manifest" MethodCapabilities = "capabilities" MethodExecute = "execute" MethodSimulate = "simulate" )
Method enumerates the four RPCs the host binary serves. Strings are part of the wire contract; never rename without bumping a protocol version (this protocol has none yet — additive RPCs are safe).
Variables ¶
This section is empty.
Functions ¶
func DecodeParams ¶
func DecodeParams(raw json.RawMessage, v any) error
DecodeParams unmarshals a Frame's Params into a typed struct.
func DecodeResult ¶
func DecodeResult(raw json.RawMessage, v any) error
DecodeResult is DecodeParams for response payloads.
func EncodeParams ¶
func EncodeParams(v any) (json.RawMessage, error)
EncodeParams serialises a typed params struct into RawMessage for embedding in a Frame.
func EncodeResult ¶
func EncodeResult(v any) (json.RawMessage, error)
EncodeResult is EncodeParams for response payloads.
Types ¶
type CapabilitiesResult ¶
type CapabilitiesResult struct {
Capabilities []CapabilityDescriptor `json:"capabilities"`
}
CapabilitiesResult lists the capabilities the loaded plugin declares.
type CapabilityDescriptor ¶
type CapabilityDescriptor struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema any `json:"input_schema,omitempty"`
OutputSchema any `json:"output_schema,omitempty"`
Permissions []string `json:"permissions,omitempty"`
Simulatable bool `json:"simulatable,omitempty"`
Idempotent bool `json:"idempotent,omitempty"`
}
CapabilityDescriptor is the minimal capability shape transferred over IPC. Mirrors the fields the parent needs to reconstruct a domain.Capability without pulling the full struct (and its non-JSON fields) across the boundary.
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec wraps a paired Reader/Writer with newline-framing and a write mutex so concurrent goroutines can call Send safely. Decode is expected to run in a single dispatcher goroutine on each side.
func NewCodec ¶
NewCodec wraps r and w as a JSON line-delimited codec. The decoder uses json.Decoder's streaming behaviour so it advances one frame at a time without buffering the rest of the stream.
type ExecuteParams ¶
type ExecuteParams struct {
Capability string `json:"capability"`
Payload map[string]any `json:"payload,omitempty"`
}
ExecuteParams identifies which capability to call and carries its JSON-encoded payload.
type ExecuteResult ¶
ExecuteResult is the handler's output map.
type Frame ¶
type Frame struct {
ID string `json:"id"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error string `json:"error,omitempty"`
}
Frame is the one-line envelope. Either Method+Params is set (request) or Result/Error is set (response). ID correlates the pair; the parent owns ID generation.
type ManifestParams ¶
type ManifestParams struct{}
ManifestParams is the request body for MethodManifest. No fields today; reserved for future extension.
type ManifestResult ¶
type ManifestResult struct {
Name string `json:"name"`
Version string `json:"version"`
Author string `json:"author,omitempty"`
Description string `json:"description,omitempty"`
Homepage string `json:"homepage,omitempty"`
License string `json:"license,omitempty"`
}
ManifestResult is the response body for MethodManifest. Mirrors plugin.Manifest.