aghsdk

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package aghsdk provides the public Go SDK for AGH subprocess extensions.

The SDK lets extension authors register tool-provider handlers as Go functions while the AGH daemon keeps third-party code out of process.

Index

Constants

View Source
const CapabilityToolProvider = "tool.provider"

CapabilityToolProvider is the provide surface for executable extension-host tools.

View Source
const DefaultMaxMessageBytes = 10 * 1024 * 1024

DefaultMaxMessageBytes is the default JSON-RPC line size limit.

View Source
const ExtensionServiceMethodProvideTools = "provide_tools"

ExtensionServiceMethodProvideTools is the runtime descriptor service method.

View Source
const ExtensionServiceMethodToolsCall = "tools/call"

ExtensionServiceMethodToolsCall is the tool invocation service method.

View Source
const JSONRPCVersion = "2.0"

JSONRPCVersion is the JSON-RPC protocol version used by the subprocess runtime.

View Source
const ProtocolVersion = "1"

ProtocolVersion is the AGH extension subprocess protocol version.

View Source
const SDKName = "github.com/compozy/agh/sdk/go"

SDKName is advertised during extension initialization.

View Source
const SDKVersion = "0.1.0"

SDKVersion is the public SDK protocol implementation version.

Variables

This section is empty.

Functions

func CanonicalJSON

func CanonicalJSON(raw json.RawMessage) ([]byte, error)

CanonicalJSON returns RFC 8785/JCS-compatible canonical JSON bytes.

func SchemaDigest

func SchemaDigest(raw json.RawMessage) (string, error)

SchemaDigest returns the lowercase SHA-256 digest of a canonical JSON Schema subtree.

func Tool

func Tool[TInput any](
	extension *Extension,
	handler string,
	options ToolOptions,
	fn ToolHandlerFunc[TInput],
) error

Tool registers a typed Go function as an extension-host tool handler.

Types

type AcceptedCapabilities

type AcceptedCapabilities struct {
	Provides []string        `json:"provides"`
	Actions  []HostAPIMethod `json:"actions"`
	Security []string        `json:"security"`
}

AcceptedCapabilities is the subset the extension accepted for this session.

type ActionsConfig

type ActionsConfig struct {
	Requires []HostAPIMethod `json:"requires,omitempty"`
}

ActionsConfig lists required Host API methods.

type ArtifactRef

type ArtifactRef struct {
	URI      string `json:"uri"`
	Name     string `json:"name,omitempty"`
	MIMEType string `json:"mime_type,omitempty"`
	Bytes    int64  `json:"bytes,omitempty"`
}

ArtifactRef points to a durable tool output artifact.

type CapabilitiesConfig

type CapabilitiesConfig struct {
	Provides []string `json:"provides,omitempty"`
}

CapabilitiesConfig lists extension-provided capability surfaces.

type Extension

type Extension struct {
	// contains filtered or unexported fields
}

Extension is a subprocess-hosted AGH extension runtime.

func NewExtension

func NewExtension(definition ExtensionDefinition, options ...Option) *Extension

NewExtension creates a public Go extension runtime.

func (*Extension) GetImplementedMethods

func (e *Extension) GetImplementedMethods() []string

GetImplementedMethods returns the sorted method list advertised during initialize.

func (*Extension) GetToolDescriptors

func (e *Extension) GetToolDescriptors() []ExtensionToolRuntimeDescriptor

GetToolDescriptors returns runtime descriptors registered by Tool.

func (*Extension) Handle

func (e *Extension) Handle(method string, handler ExtensionHandler) error

Handle registers one custom AGH -> extension service method.

func (*Extension) OnReady

func (e *Extension) OnReady(callback func(context.Context, *HostAPI, ExtensionSession) error)

OnReady registers a callback that runs after initialize succeeds.

func (*Extension) Run

func (e *Extension) Run(ctx context.Context) error

Run starts the JSON-RPC transport and blocks until it closes.

func (*Extension) Tool

func (e *Extension) Tool(
	handler string,
	options ToolOptions,
	fn ToolHandlerFunc[json.RawMessage],
) error

Tool registers a raw JSON tool handler on the extension.

type ExtensionContext

type ExtensionContext struct {
	Request   JSONRPCRequestEnvelope
	RequestID json.RawMessage
	Host      *HostAPI
	Session   ExtensionSession
	Logf      func(format string, args ...any)
}

ExtensionContext is passed to custom service handlers.

type ExtensionDefinition

type ExtensionDefinition struct {
	Name                string             `json:"name"`
	Version             string             `json:"version"`
	Description         string             `json:"description,omitempty"`
	MinAGHVersion       string             `json:"min_agh_version,omitempty"`
	Capabilities        CapabilitiesConfig `json:"capabilities"`
	Actions             ActionsConfig      `json:"actions"`
	Security            SecurityConfig     `json:"security"`
	SupportedHookEvents []string           `json:"supported_hook_events,omitempty"`
	Metadata            map[string]string  `json:"metadata,omitempty"`
}

ExtensionDefinition describes one extension process implementation.

type ExtensionHandler

type ExtensionHandler func(context.Context, ExtensionContext, json.RawMessage) (any, error)

ExtensionHandler handles one custom AGH -> extension service request.

type ExtensionProvideToolsResponse

type ExtensionProvideToolsResponse struct {
	Tools []ExtensionToolRuntimeDescriptor `json:"tools"`
}

ExtensionProvideToolsResponse is returned by provide_tools.

type ExtensionSession

type ExtensionSession struct {
	InitializeRequest    InitializeRequest
	InitializeResponse   InitializeResponse
	Runtime              InitializeRuntime
	AcceptedCapabilities AcceptedCapabilities
}

ExtensionSession is the accepted initialization state visible to handlers.

type ExtensionToolCallRequest

type ExtensionToolCallRequest struct {
	ToolID    ToolID          `json:"tool_id"`
	Handler   string          `json:"handler"`
	SessionID string          `json:"session_id,omitempty"`
	Input     json.RawMessage `json:"input"`
}

ExtensionToolCallRequest is sent by AGH for tools/call.

type ExtensionToolCallResponse

type ExtensionToolCallResponse struct {
	Result ToolResult `json:"result"`
}

ExtensionToolCallResponse wraps a tool result.

type ExtensionToolRuntimeDescriptor

type ExtensionToolRuntimeDescriptor struct {
	ID                 ToolID    `json:"id"`
	Handler            string    `json:"handler"`
	InputSchemaDigest  string    `json:"input_schema_digest"`
	OutputSchemaDigest string    `json:"output_schema_digest,omitempty"`
	ReadOnly           bool      `json:"read_only"`
	Risk               RiskClass `json:"risk"`
	Capabilities       []string  `json:"capabilities,omitempty"`
}

ExtensionToolRuntimeDescriptor is the runtime proof descriptor returned by provide_tools.

type HealthCheckResult

type HealthCheckResult struct {
	Healthy bool                       `json:"healthy"`
	Message string                     `json:"message,omitempty"`
	Details map[string]json.RawMessage `json:"details,omitempty"`
}

HealthCheckResult is returned by health_check handlers.

type HostAPI

type HostAPI struct {
	// contains filtered or unexported fields
}

HostAPI is a minimal typed client for extension Host API calls.

func NewHostAPI

func NewHostAPI(transport Transport, isReady func() bool) *HostAPI

NewHostAPI creates a Host API client over a transport.

func (*HostAPI) RawRequest

func (h *HostAPI) RawRequest(ctx context.Context, method HostAPIMethod, params any) (json.RawMessage, error)

RawRequest calls a Host API method and returns the raw JSON response.

func (*HostAPI) Request

func (h *HostAPI) Request(ctx context.Context, method HostAPIMethod, params any, result any) error

Request calls a Host API method after readiness and sensitive-value checks.

type HostAPIMethod

type HostAPIMethod string

HostAPIMethod identifies one extension -> AGH Host API request.

const (
	// HostAPIMethodSessionsList lists sessions visible to the extension.
	HostAPIMethodSessionsList HostAPIMethod = "sessions/list"
	// HostAPIMethodSessionsCreate creates a session.
	HostAPIMethodSessionsCreate HostAPIMethod = "sessions/create"
	// HostAPIMethodSessionsPrompt prompts a session.
	HostAPIMethodSessionsPrompt HostAPIMethod = "sessions/prompt"
	// HostAPIMethodSessionsStop stops a session.
	HostAPIMethodSessionsStop HostAPIMethod = "sessions/stop"
	// HostAPIMethodSessionsStatus returns session status.
	HostAPIMethodSessionsStatus HostAPIMethod = "sessions/status"
	// HostAPIMethodSessionsStatusGet returns authored-context session status.
	HostAPIMethodSessionsStatusGet HostAPIMethod = "sessions/status/get"
	// HostAPIMethodSessionsEvents returns session events.
	HostAPIMethodSessionsEvents HostAPIMethod = "sessions/events"
	// HostAPIMethodSessionsSoulRefresh refreshes a session's Soul snapshot through managed authoring.
	HostAPIMethodSessionsSoulRefresh HostAPIMethod = "sessions/soul/refresh"
	// HostAPIMethodSessionsHealthGet returns metadata-only session health.
	HostAPIMethodSessionsHealthGet HostAPIMethod = "sessions/health/get"
	// HostAPIMethodAgentsSoulGet returns a managed Soul read model.
	HostAPIMethodAgentsSoulGet HostAPIMethod = "agents/soul/get"
	// HostAPIMethodAgentsSoulValidate validates Soul content through the managed service.
	HostAPIMethodAgentsSoulValidate HostAPIMethod = "agents/soul/validate"
	// HostAPIMethodAgentsSoulPut writes SOUL.md through managed authoring.
	HostAPIMethodAgentsSoulPut HostAPIMethod = "agents/soul/put"
	// HostAPIMethodAgentsSoulDelete deletes SOUL.md through managed authoring.
	HostAPIMethodAgentsSoulDelete HostAPIMethod = "agents/soul/delete"
	// HostAPIMethodAgentsSoulHistory lists managed Soul authoring revisions.
	HostAPIMethodAgentsSoulHistory HostAPIMethod = "agents/soul/history"
	// HostAPIMethodAgentsSoulRollback rolls SOUL.md back through managed authoring.
	HostAPIMethodAgentsSoulRollback HostAPIMethod = "agents/soul/rollback"
	// HostAPIMethodAgentsHeartbeatGet returns a managed Heartbeat policy read model.
	HostAPIMethodAgentsHeartbeatGet HostAPIMethod = "agents/heartbeat/get"
	// HostAPIMethodAgentsHeartbeatValidate validates Heartbeat content through the managed service.
	HostAPIMethodAgentsHeartbeatValidate HostAPIMethod = "agents/heartbeat/validate"
	// HostAPIMethodAgentsHeartbeatPut writes HEARTBEAT.md through managed authoring.
	HostAPIMethodAgentsHeartbeatPut HostAPIMethod = "agents/heartbeat/put"
	// HostAPIMethodAgentsHeartbeatDelete deletes HEARTBEAT.md through managed authoring.
	HostAPIMethodAgentsHeartbeatDelete HostAPIMethod = "agents/heartbeat/delete"
	// HostAPIMethodAgentsHeartbeatHistory lists managed Heartbeat authoring revisions.
	HostAPIMethodAgentsHeartbeatHistory HostAPIMethod = "agents/heartbeat/history"
	// HostAPIMethodAgentsHeartbeatRollback rolls HEARTBEAT.md back through managed authoring.
	HostAPIMethodAgentsHeartbeatRollback HostAPIMethod = "agents/heartbeat/rollback"
	// HostAPIMethodAgentsHeartbeatStatus returns policy, session health, and wake audit status.
	HostAPIMethodAgentsHeartbeatStatus HostAPIMethod = "agents/heartbeat/status"
	// HostAPIMethodAgentsHeartbeatWake requests one managed advisory Heartbeat wake.
	HostAPIMethodAgentsHeartbeatWake HostAPIMethod = "agents/heartbeat/wake"
	// HostAPIMethodMemoryRecall recalls memory.
	HostAPIMethodMemoryRecall HostAPIMethod = "memory/recall"
	// HostAPIMethodMemoryStore stores memory.
	HostAPIMethodMemoryStore HostAPIMethod = "memory/store"
	// HostAPIMethodMemoryForget forgets memory.
	HostAPIMethodMemoryForget HostAPIMethod = "memory/forget"
	// HostAPIMethodObserveHealth returns daemon health.
	HostAPIMethodObserveHealth HostAPIMethod = "observe/health"
	// HostAPIMethodListLogs returns runtime logs.
	HostAPIMethodListLogs HostAPIMethod = "logs/list"
	// HostAPIMethodSkillsList lists skills.
	HostAPIMethodSkillsList HostAPIMethod = "skills/list"
	// HostAPIMethodNetworkStatus returns network runtime status.
	HostAPIMethodNetworkStatus HostAPIMethod = "network/status"
	// HostAPIMethodNetworkChannels lists network channels.
	HostAPIMethodNetworkChannels HostAPIMethod = "network/channels"
	// HostAPIMethodNetworkPeers lists visible network peers.
	HostAPIMethodNetworkPeers HostAPIMethod = "network/peers"
	// HostAPIMethodNetworkThreads lists public network threads.
	HostAPIMethodNetworkThreads HostAPIMethod = "network/threads"
	// HostAPIMethodNetworkThreadGet returns one public network thread.
	HostAPIMethodNetworkThreadGet HostAPIMethod = "network/thread/get"
	// HostAPIMethodNetworkThreadMessages lists messages inside one public network thread.
	HostAPIMethodNetworkThreadMessages HostAPIMethod = "network/thread/messages"
	// HostAPIMethodNetworkDirects lists network direct rooms.
	HostAPIMethodNetworkDirects HostAPIMethod = "network/directs"
	// HostAPIMethodNetworkDirectResolve resolves a deterministic two-party direct room.
	HostAPIMethodNetworkDirectResolve HostAPIMethod = "network/direct/resolve"
	// HostAPIMethodNetworkDirectMessages lists messages inside one direct room.
	HostAPIMethodNetworkDirectMessages HostAPIMethod = "network/direct/messages"
	// HostAPIMethodNetworkWorkGet returns one network work row.
	HostAPIMethodNetworkWorkGet HostAPIMethod = "network/work/get"
	// HostAPIMethodNetworkSend sends one network message.
	HostAPIMethodNetworkSend HostAPIMethod = "network/send"
	// HostAPIMethodResourcesList lists resources.
	HostAPIMethodResourcesList HostAPIMethod = "resources/list"
	// HostAPIMethodResourcesGet fetches one resource.
	HostAPIMethodResourcesGet HostAPIMethod = "resources/get"
	// HostAPIMethodResourcesSnapshot snapshots resources.
	HostAPIMethodResourcesSnapshot HostAPIMethod = "resources/snapshot"
)

type InitializeCapabilities

type InitializeCapabilities struct {
	Provides              []string        `json:"provides"`
	GrantedActions        []HostAPIMethod `json:"granted_actions"`
	GrantedSecurity       []string        `json:"granted_security"`
	GrantedResourceKinds  []string        `json:"granted_resource_kinds"`
	GrantedResourceScopes []string        `json:"granted_resource_scopes"`
}

InitializeCapabilities carries runtime-granted capabilities.

type InitializeExtension

type InitializeExtension struct {
	Name       string `json:"name"`
	Version    string `json:"version"`
	SourceTier string `json:"source_tier"`
}

InitializeExtension identifies the launched extension.

type InitializeExtensionInfo

type InitializeExtensionInfo struct {
	Name       string `json:"name"`
	Version    string `json:"version"`
	SDKName    string `json:"sdk_name,omitempty"`
	SDKVersion string `json:"sdk_version,omitempty"`
}

InitializeExtensionInfo identifies the running extension implementation.

type InitializeMethods

type InitializeMethods struct {
	DaemonRequests    []string `json:"daemon_requests"`
	ExtensionServices []string `json:"extension_services"`
}

InitializeMethods lists callable method families for the session.

type InitializeRequest

type InitializeRequest struct {
	ProtocolVersion           string                 `json:"protocol_version"`
	SupportedProtocolVersions []string               `json:"supported_protocol_versions"`
	AGHVersion                string                 `json:"agh_version"`
	SessionNonce              string                 `json:"session_nonce"`
	Extension                 InitializeExtension    `json:"extension"`
	Capabilities              InitializeCapabilities `json:"capabilities"`
	Methods                   InitializeMethods      `json:"methods"`
	Runtime                   InitializeRuntime      `json:"runtime"`
}

InitializeRequest is the AGH -> extension session contract request.

type InitializeResponse

type InitializeResponse struct {
	ProtocolVersion      string                  `json:"protocol_version"`
	ExtensionInfo        InitializeExtensionInfo `json:"extension_info"`
	AcceptedCapabilities AcceptedCapabilities    `json:"accepted_capabilities"`
	ImplementedMethods   []string                `json:"implemented_methods"`
	SupportedHookEvents  []string                `json:"supported_hook_events"`
	Supports             InitializeSupports      `json:"supports"`
}

InitializeResponse is the extension -> AGH initialize acknowledgment.

type InitializeRuntime

type InitializeRuntime struct {
	HealthCheckIntervalMS int64           `json:"health_check_interval_ms"`
	HealthCheckTimeoutMS  int64           `json:"health_check_timeout_ms"`
	ShutdownTimeoutMS     int64           `json:"shutdown_timeout_ms"`
	DefaultHookTimeoutMS  int64           `json:"default_hook_timeout_ms"`
	Bridge                json.RawMessage `json:"bridge,omitempty"`
}

InitializeRuntime carries runtime intervals and deadlines.

type InitializeSupports

type InitializeSupports struct {
	HealthCheck bool `json:"health_check"`
}

InitializeSupports advertises optional protocol features.

type JSONRPCErrorObject

type JSONRPCErrorObject struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

JSONRPCErrorObject is the wire error object used by JSON-RPC 2.0.

type JSONRPCRequestEnvelope

type JSONRPCRequestEnvelope struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

JSONRPCRequestEnvelope is the public request metadata visible to handlers.

type Option

type Option func(*Extension)

Option configures an Extension.

func WithSDKVersion

func WithSDKVersion(version string) Option

WithSDKVersion overrides the advertised SDK version.

func WithStderr

func WithStderr(stderr io.Writer) Option

WithStderr sets the log sink used by ExtensionContext.Logf.

func WithStdio

func WithStdio(input io.Reader, output io.Writer) Option

WithStdio configures stdio input and output streams.

func WithTransport

func WithTransport(transport Transport) Option

WithTransport sets a custom JSON-RPC transport.

type RPCError

type RPCError struct {
	Code    int
	Message string
	Data    json.RawMessage
}

RPCError is a typed JSON-RPC error.

func NewCapabilityDeniedError

func NewCapabilityDeniedError(data map[string]any) *RPCError

NewCapabilityDeniedError creates a capability denied error.

func NewInternalError

func NewInternalError(reason string) *RPCError

NewInternalError creates an Internal error.

func NewInvalidParamsError

func NewInvalidParamsError(reason string, data map[string]any) *RPCError

NewInvalidParamsError creates an Invalid params error.

func NewInvalidRequestError

func NewInvalidRequestError(reason string) *RPCError

NewInvalidRequestError creates an Invalid request error.

func NewMethodNotFoundError

func NewMethodNotFoundError(method string) *RPCError

NewMethodNotFoundError creates a Method not found error.

func NewNotInitializedError

func NewNotInitializedError() *RPCError

NewNotInitializedError creates a not-initialized error.

func NewRPCError

func NewRPCError(code int, message string, data any) *RPCError

NewRPCError creates a typed JSON-RPC error with optional data.

func NewShutdownInProgressError

func NewShutdownInProgressError(deadlineMS int64) *RPCError

NewShutdownInProgressError creates a shutdown-in-progress error.

func NewToolExecutionError

func NewToolExecutionError(data map[string]any) *RPCError

NewToolExecutionError creates a tool execution error.

func (*RPCError) Error

func (e *RPCError) Error() string

Error returns the stable error message.

type Redaction

type Redaction struct {
	Path   string `json:"path"`
	Reason string `json:"reason"`
	Bytes  int64  `json:"bytes,omitempty"`
}

Redaction records a redaction applied to a result.

type RiskClass

type RiskClass string

RiskClass classifies tool execution safety.

const (
	// RiskRead marks read-only behavior.
	RiskRead RiskClass = "read"
	// RiskMutating marks state-changing behavior.
	RiskMutating RiskClass = "mutating"
	// RiskDestructive marks destructive state-changing behavior.
	RiskDestructive RiskClass = "destructive"
)

type SecurityConfig

type SecurityConfig struct {
	Capabilities []string `json:"capabilities,omitempty"`
}

SecurityConfig lists required security grants.

type ShutdownRequest

type ShutdownRequest struct {
	Reason     string `json:"reason"`
	DeadlineMS int64  `json:"deadline_ms"`
}

ShutdownRequest is sent before signal escalation.

type ShutdownResponse

type ShutdownResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

ShutdownResponse acknowledges cooperative shutdown.

type StdioTransport

type StdioTransport struct {
	// contains filtered or unexported fields
}

StdioTransport is a newline-delimited JSON-RPC 2.0 transport over stdio.

func NewStdioTransport

func NewStdioTransport(options StdioTransportOptions) *StdioTransport

NewStdioTransport creates a stdio JSON-RPC transport.

func (*StdioTransport) Call

func (t *StdioTransport) Call(ctx context.Context, method string, params any, result any) error

Call sends one JSON-RPC request and decodes its response into result.

func (*StdioTransport) Close

func (t *StdioTransport) Close() error

Close closes the transport and rejects pending calls.

func (*StdioTransport) Handle

func (t *StdioTransport) Handle(method string, handler TransportHandler)

Handle registers or replaces an inbound method handler.

func (*StdioTransport) Run

func (t *StdioTransport) Run(ctx context.Context) error

Run starts the transport read loop and blocks until close or context cancellation.

type StdioTransportOptions

type StdioTransportOptions struct {
	Input           io.Reader
	Output          io.Writer
	MaxMessageBytes int
}

StdioTransportOptions configures a StdioTransport.

type ToolContent

type ToolContent struct {
	Type     string                     `json:"type"`
	Text     string                     `json:"text,omitempty"`
	Data     json.RawMessage            `json:"data,omitempty"`
	MIMEType string                     `json:"mime_type,omitempty"`
	Metadata map[string]json.RawMessage `json:"metadata,omitempty"`
}

ToolContent is one typed content block returned by a tool.

type ToolHandlerFunc

type ToolHandlerFunc[TInput any] func(context.Context, ToolRequest[TInput]) (ToolResult, error)

ToolHandlerFunc handles one typed tool request.

type ToolID

type ToolID string

ToolID is the canonical public tool identity.

func (ToolID) Validate

func (id ToolID) Validate() error

Validate ensures the tool id follows the canonical AGH grammar.

type ToolOptions

type ToolOptions struct {
	ID                   ToolID
	Description          string
	InputSchema          any
	OutputSchema         any
	ReadOnly             bool
	Risk                 RiskClass
	Capabilities         []string
	SensitiveInputFields []string
}

ToolOptions configures one function-backed extension tool.

type ToolRequest

type ToolRequest[TInput any] struct {
	Input    TInput
	RawInput json.RawMessage
	Context  ExtensionContext
	Host     *HostAPI
	Session  ExtensionSession
	ToolID   ToolID
	Handler  string
}

ToolRequest is passed to a typed tool handler.

type ToolResult

type ToolResult struct {
	Content    []ToolContent              `json:"content,omitempty"`
	Structured json.RawMessage            `json:"structured,omitempty"`
	Preview    string                     `json:"preview,omitempty"`
	Artifacts  []ArtifactRef              `json:"artifacts,omitempty"`
	Metadata   map[string]json.RawMessage `json:"metadata,omitempty"`
	Redactions []Redaction                `json:"redactions,omitempty"`
	Truncated  bool                       `json:"truncated"`
	Bytes      int64                      `json:"bytes"`
	DurationMS int64                      `json:"duration_ms"`
}

ToolResult is the canonical result envelope for tool handlers.

func EmptyResult

func EmptyResult() ToolResult

EmptyResult returns an empty successful tool result.

func StructuredResult

func StructuredResult(value any) (ToolResult, error)

StructuredResult marshals a structured payload into the result envelope.

func TextResult

func TextResult(text string) ToolResult

TextResult returns a text content result.

type Transport

type Transport interface {
	Handle(method string, handler TransportHandler)
	Call(ctx context.Context, method string, params any, result any) error
	Run(ctx context.Context) error
	Close() error
}

Transport is the bidirectional JSON-RPC runtime used by Extension.

type TransportHandler

type TransportHandler func(context.Context, json.RawMessage, JSONRPCRequestEnvelope) (any, error)

TransportHandler handles one inbound JSON-RPC request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL