perception

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Perception plugin bridge

src/ctn/perception exposes the src/ctn/contract/perception domain through the language-neutral intelligence.perception/v1 Ext plugin contract. Go guests register a provider with RegisterProvider and serve it with ServeStdio or ServeCurrentExecutable. Go hosts call Info, Observe, and Interpret through Client after their own install, trust, and authorization checks.

The contract operations are capabilities, observe, interpret, and close. Providers may implement only observation or interpretation; an unsupported operation returns an explicit error. Every request names a model. Responses preserve request IDs and source indexes, and are validated at both guest and host boundaries. No tool proposal is executed by this bridge.

The JSON files in testdata/v1 are transport-independent fixtures for other host and guest languages. CTN's perception command exercises package, install, trust, invoke, and revoke through a real subprocess.

For a guest executable provider, the CTN flow is:

ext ctn perception package example 1.0.0 ./provider ./example-package
ext ctn perception install ./example-package
ext ctn perception trust example
ext ctn perception capabilities --provider example
ext ctn perception observe --provider example --model model-id --input ./image-request.json
ext ctn perception untrust example

The request file contains an image byte array encoded as base64 and a mediaType such as image/png. CTN fills apiVersion and the selected model. EXT_INT_PACKAGE_ROOT selects a different package store; trust is scoped to the perception protocol and the exact installed package digest.

Documentation

Overview

Package perception binds the portable intelligence.perception/v1 contract to Ext plugin sessions. Its wire payloads are defined by src/ctn/contract/perception.

Index

Constants

View Source
const ContractName = "intelligence.perception"
View Source
const ContractVersion = "v1"
View Source
const Protocol = ContractName + "/" + ContractVersion

Variables

View Source
var ContractRef = plugin.ContractRef{Name: ContractName, Version: ContractVersion}

Functions

func Descriptor

func Descriptor(identity plugin.Identity) plugin.Descriptor

Descriptor is the stable provider surface used by process hosts.

func PackageExecutable

func PackageExecutable(options ExecutablePackage) (packagekit.Manifest, error)

PackageExecutable seals a provider for the current or selected platform. The descriptor declares the complete surface; runtime capabilities still decide which optional operations the provider serves.

func RegisterProvider

func RegisterProvider(registry *author.Registry, provider domain.Provider, authorize func(context.Context, plugin.Request) error) (*plugin.Descriptor, error)

RegisterProvider declares the stable surface. An unsupported optional operation returns a typed remote error. Authorize is required on every call.

func ServeCurrentExecutable

func ServeCurrentExecutable(ctx context.Context, id, version string, provider domain.Provider, authorize func(context.Context, plugin.Request) error) error

func ServeStdio

func ServeStdio(ctx context.Context, identity plugin.Identity, provider domain.Provider, authorize func(context.Context, plugin.Request) error) error

Types

type Client

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

Client invokes a provider through an already authorized plugin session.

func NewClient

func NewClient(caller author.Caller) *Client

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

func (*Client) Info

func (c *Client) Info(ctx context.Context) (domain.Info, error)

func (*Client) Interpret

func (*Client) Observe

func (c *Client) Observe(ctx context.Context, request domain.ObserveRequest) (domain.ObserveResponse, error)

type ExecutablePackage

type ExecutablePackage struct {
	ID, Version, Binary, OutputDir, OS, Arch string
}

Jump to

Keyboard shortcuts

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