Documentation
¶
Overview ¶
Package protocol is rig/1, the plugin protocol: its schema, the types generated from it, and a validator. The schema is the contract; sdk/ and the Python and TypeScript SDKs are generated from it.
Index ¶
- Constants
- Variables
- func CheckFrame(f *Frame) error
- func Def(name string) map[string]any
- func Methods() []string
- func Unmet(err error) bool
- func Validate(def string, raw []byte) []string
- type AIParams
- type AIResult
- type Ack
- type ActionSpec
- type Args
- type AskParams
- type AskResult
- type Binding
- type CancelParams
- type Change
- type Check
- type CompleteParams
- type CompleteResult
- type Completion
- type ConfigureParams
- type Context
- type DoctorParams
- type DoctorResult
- type Empty
- type Error
- type ErrorData
- type Event
- type Field
- type Frame
- type FrameMeta
- type Hit
- type HostCapabilities
- type HostInfo
- type ImportParams
- type ImportResult
- type ImporterSpec
- type InitializeParams
- type InitializeResult
- type Link
- type LogParams
- type Message
- type MethodSpec
- type Node
- type Progress
- type Provides
- type QueryParams
- type Ref
- type RenderParams
- type ResolveParams
- type Resolved
- type RunParams
- type RunResult
- type Schema
- type Scope
- type SearchParams
- type SearchResult
- type SecretParams
- type SecretSetParams
- type SecretValue
- type Size
- type SourceSpec
- type StateGetParams
- type StateSetParams
- type StateValue
- type StreamBatch
- type StreamParams
- type TimeRange
- type ViewEventParams
- type ViewSpec
- type WidgetRenderParams
- type WidgetRenderResult
Constants ¶
const ( MethodInitialize = "initialize" MethodConfigure = "configure" MethodQuery = "query" MethodStream = "stream" MethodRun = "run" MethodPlan = "plan" MethodImport = "import" MethodComplete = "complete" MethodRender = "render" MethodViewEvent = "view.event" MethodWidgetRender = "widget.render" MethodResolve = "resolve" MethodSearch = "search" MethodDoctor = "doctor" MethodEvent = "event" MethodShutdown = "shutdown" MethodHostQuery = "host/query" MethodHostRun = "host/run" MethodHostAsk = "host/ask" MethodHostAI = "host/ai" MethodHostStateGet = "host/state.get" MethodHostStateSet = "host/state.set" MethodHostSecret = "host/secret" MethodHostSecretSet = "host/secret.set" MethodHostEmit = "host/emit" MethodHostLog = "host/log" MethodNotifyCancel = "$/cancel" MethodNotifyProgress = "$/progress" MethodNotifyStream = "$/stream" MethodNotifyAck = "$/ack" )
const ( CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternal = -32603 CodeDenied = -32001 CodeNotFound = -32002 CodeConflict = -32004 CodeNeedsInput = -32005 )
const ( EffectDanger = "danger" EffectRead = "read" EffectWrite = "write" KindConfirm = "confirm" KindInput = "input" KindPick = "pick" KindSecret = "secret" LevelDebug = "debug" LevelError = "error" LevelInfo = "info" LevelWarn = "warn" OpCreate = "create" OpDelete = "delete" OpRun = "run" OpUpdate = "update" TypeBool = "bool" TypeBytes = "bytes" TypeDuration = "duration" TypeInt = "int" TypeJSON = "json" TypeNumber = "number" TypeRef = "ref" TypeString = "string" TypeTime = "time" )
const Version = "rig/1"
Version is the protocol this package speaks.
Variables ¶
var SchemaJSON []byte
Functions ¶
func CheckFrame ¶
CheckFrame validates a frame beyond its schema: one column per field, all of one length.
Types ¶
type ActionSpec ¶
type ActionSpec struct {
Description string `json:"description,omitempty"`
Effect string `json:"effect"`
Args Schema `json:"args,omitempty"`
// Supports a dry run.
Plan bool `json:"plan,omitempty"`
Keys []string `json:"keys,omitempty"`
// Schemes, kinds or sources whose menus list it.
On []string `json:"on,omitempty"`
}
type CancelParams ¶
type CancelParams struct {
// The request id, or a stream id.
ID any `json:"id"`
}
type CompleteParams ¶
type CompleteResult ¶
type CompleteResult struct {
Items []Completion `json:"items"`
}
type Completion ¶
type ConfigureParams ¶
type Context ¶
type Context struct {
Project string `json:"project,omitempty"`
Env string `json:"env,omitempty"`
User string `json:"user,omitempty"`
Roles []string `json:"roles,omitempty"`
Scope *Scope `json:"scope,omitempty"`
TraceID string `json:"trace_id,omitempty"`
// RFC 3339.
Deadline string `json:"deadline,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
}
Travels with every call.
type DoctorParams ¶
type DoctorParams struct {
Context *Context `json:"context,omitempty"`
}
type DoctorResult ¶
type DoctorResult struct {
Checks []Check `json:"checks"`
}
type Error ¶
type ErrorData ¶
type ErrorData struct {
// What to do about it, such as the tool to install.
Hint string `json:"hint,omitempty"`
}
type Frame ¶
type Frame struct {
Name string `json:"name,omitempty"`
Fields []Field `json:"fields"`
Columns [][]any `json:"columns"`
Meta *FrameMeta `json:"meta,omitempty"`
}
Columnar, typed, renderer-neutral data. columns[i] holds every value of fields[i]. time is Unix seconds, duration is seconds.
type HostCapabilities ¶
type ImportParams ¶
type ImportResult ¶
type ImporterSpec ¶
type InitializeParams ¶
type InitializeParams struct {
Host HostInfo `json:"host"`
// Protocol versions the host speaks, such as rig/1.
Protocols []string `json:"protocols"`
Capabilities *HostCapabilities `json:"capabilities,omitempty"`
}
type InitializeResult ¶
type InitializeResult struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
// The protocol version chosen from the host's list.
Protocol string `json:"protocol"`
Provides *Provides `json:"provides,omitempty"`
// Optional methods and features the plugin supports, such as stream or plan.
Capabilities []string `json:"capabilities,omitempty"`
}
type Message ¶
type Message struct {
Jsonrpc string `json:"jsonrpc"`
// A number or a string; absent on notifications.
ID any `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params any `json:"params,omitempty"`
Result any `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
One JSON-RPC 2.0 message: a request (id and method), a notification (method only) or a response (id and result or error).
type MethodSpec ¶
type MethodSpec struct {
From string `json:"from"`
Params string `json:"params"`
Result string `json:"result"`
Notify bool `json:"notify"`
}
MethodSpec is one entry of the schema's method table.
func Method ¶
func Method(name string) (MethodSpec, bool)
type Node ¶
type Node struct {
// A widget kind, optionally versioned: table@1.
Widget string `json:"widget"`
ID string `json:"id,omitempty"`
Props Args `json:"props,omitempty"`
Bind *Binding `json:"bind,omitempty"`
Children []Node `json:"children,omitempty"`
// What a host without this widget renders.
Fallback *Node `json:"fallback,omitempty"`
}
A widget tree node.
type Provides ¶
type Provides struct {
Sources map[string]SourceSpec `json:"sources,omitempty"`
Actions map[string]ActionSpec `json:"actions,omitempty"`
Importers map[string]ImporterSpec `json:"importers,omitempty"`
Views map[string]ViewSpec `json:"views,omitempty"`
Widgets []string `json:"widgets,omitempty"`
Schemes []string `json:"schemes,omitempty"`
Languages []string `json:"languages,omitempty"`
Implements []string `json:"implements,omitempty"`
Events []string `json:"events,omitempty"`
Search bool `json:"search,omitempty"`
}
type QueryParams ¶
type Ref ¶
type Ref = string
A URI whose scheme a plugin or core owns: svc://api, k8s://ns/deployment/api.
type RenderParams ¶
type ResolveParams ¶
type Resolved ¶
type Resolved struct {
Ref Ref `json:"ref"`
Kind string `json:"kind,omitempty"`
Title string `json:"title,omitempty"`
View string `json:"view,omitempty"`
URL string `json:"url,omitempty"`
Fields Args `json:"fields,omitempty"`
Actions []string `json:"actions,omitempty"`
Links []Link `json:"links,omitempty"`
}
type SearchParams ¶
type SearchResult ¶
type SearchResult struct {
Hits []Hit `json:"hits"`
}
type SecretParams ¶
type SecretParams struct {
Name string `json:"name"`
}
type SecretSetParams ¶ added in v0.38.0
type SecretValue ¶
type SecretValue struct {
Value string `json:"value"`
}
type SourceSpec ¶
type StateGetParams ¶
type StateGetParams struct {
Key string `json:"key"`
}
type StateSetParams ¶
type StateValue ¶
type StreamBatch ¶
type StreamParams ¶
type ViewEventParams ¶
type WidgetRenderParams ¶
type WidgetRenderResult ¶
type WidgetRenderResult struct {
// At most size.h lines of at most size.w cells; ANSI SGR allowed.
Lines []string `json:"lines"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conformance checks a plugin speaks rig/1: what every plugin must do, and what each capability it declares promises.
|
Package conformance checks a plugin speaks rig/1: what every plugin must do, and what each capability it declares promises. |
|
Package rpc is the host's end of rig/1: newline-delimited JSON-RPC 2.0 to one plugin process.
|
Package rpc is the host's end of rig/1: newline-delimited JSON-RPC 2.0 to one plugin process. |
|
Package transcript records and replays rig/1 sessions as JSONL: one {"dir":">","msg":{...}} per message, ">" from the host to the plugin and "<" back.
|
Package transcript records and replays rig/1 sessions as JSONL: one {"dir":">","msg":{...}} per message, ">" from the host to the plugin and "<" back. |