plugingo

package module
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 3 Imported by: 0 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

Go plugin library (umbrella)

github.com/webong/ext/pkg/ext-go requires every part of the Go plugin library at matching versions, so a program that wants all of it takes one module. Each part is a module of its own and a program that wants less takes less:

Module For
engine the pure-Go engine: the contract, sessions, guests, packages, bridges (standard library only)
cgoengine the C engine binding, with a pure-Go build of the same API
c2goengine the C engine's portable core translated to Go by ccgo (no cgo, no C compiler)
hashicorp the HashiCorp go-plugin (gRPC) backend
wasm the engine-facing WebAssembly backend, built on the reusable res/web/host/engine/wasm runtime
inference Go host and guest bindings for inference.provider/v1
model Go host and guest bindings for model.tensor/v1
perception Go host and guest bindings for intelligence.perception/v1
realtime Go host and guest bindings for intelligence.realtime/v1

The umbrella package itself, plugingo, holds what needs more than one part: PlanGraph joins a package plan to the host graph (res/system). The core package chooses between the three engines (see below). The cmd/ext-plugin-bridge command and the cross-language conformance tests (crosslang, bench) also live here, because they need the engine and a backend together.

The wasm module requires res/web/host for protocol-neutral WebAssembly inspection, WASI execution and reactor hosting, then binds those mechanisms to engine.Backend. res/web/host never imports the plugin engine.

Choosing an engine

The engine's rules exist as the pure-Go engine (the oracle, on every platform), as the C engine through cgo (cgoengine, at native speed) and as the C translated to Go (c2goengine, no cgo). engine is the one place that knows all three:

import "github.com/webong/ext/pkg/ext-go/core"

// The best available engine that carries what the program needs, or the one EXT_ENGINE names
// (cgo, c2go, go or auto).
e, err := core.FromEnvironment(core.Sessions | core.Progress)
if err != nil { ... }

session, err := e.Open(ctx, descriptor, plugin.Options{Verify: ..., Authorize: ..., Connect: ...})
fmt.Println(session.Engine()) // which engine runs this session

leases, err := core.NewInstances(e, instance.Options[T]{...})

Engines lists them in the order Choose prefers: cgo, c2go, go. A name is never served by another engine: an engine that is not in this build (cgo needs cgo, the ext_cengine tag and the C library; c2go needs a platform it was translated for), or lacks a feature the program asked for, is an error wrapping plugin.ErrUnsupported. The features are Services (the engine's pure services by name; the go engine has none), Sessions (Open, OpenProcess, NewInstances; c2go has them except on Windows), Progress and Reverse (cgo and go; c2go does not carry them yet). The choice is made once, when a session or instance manager is opened.

See module versioning for the migration table from the earlier import paths.

Documentation

Overview

Package plugingo is the umbrella of the Go plugin library: the module that requires every part at matching versions. The parts are modules of their own, so an application imports only what it needs:

github.com/webong/ext/pkg/ext-go/engine   contract, sessions, packages, bridges (standard library only)
github.com/webong/ext/pkg/ext-go/cgoengine    the C engine binding, with a pure-Go build of the same API
github.com/webong/ext/pkg/ext-go/wasm       the engine binding for res/web/host/engine/wasm
github.com/webong/ext/pkg/ext-go/hashicorp  the HashiCorp go-plugin (gRPC) backend

What lives here, rather than in a part, is whatever needs more than one of them, such as the code that joins package plans to the host graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PlanGraph

func PlanGraph(p packagekit.Plan, namespace string) store.Transaction

PlanGraph creates a graph transaction for the caller's namespace from a resolved plan. Apply it through the host's graph policy. Records express dependencies, never permissions.

Types

This section is empty.

Directories

Path Synopsis
c2goengine module
cengine module
cgoengine module
cmd
ext-plugin-bridge command
ext-plugin-bridge exposes a reviewed HashiCorp-backed endpoint over CTX JSON lines.
ext-plugin-bridge exposes a reviewed HashiCorp-backed endpoint over CTX JSON lines.
Package core chooses which implementation of the plugin engine runs a program's sessions.
Package core chooses which implementation of the plugin engine runs a program's sessions.
engine module
examples
plugin command
This example hosts a consumer-owned contract over an in-memory duplex connection.
This example hosts a consumer-owned contract over an in-memory duplex connection.
plugin-hashicorp command
This example runs the same CTX guest over either HashiCorp RPC protocol.
This example runs the same CTX guest over either HashiCorp RPC protocol.
plugin-runtimes/cshared command
Build with -buildmode=c-shared.
Build with -buildmode=c-shared.
plugin-runtimes/echo
Package echo contains the single typed implementation shared by all runtime examples.
Package echo contains the single typed implementation shared by all runtime examples.
plugin-runtimes/host command
One host and typed contract, three dynamically loaded runtime implementations.
One host and typed contract, three dynamically loaded runtime implementations.
plugin-runtimes/nativego command
Build with: go build -buildmode=plugin -o echo.so ./pkg/ext-go/examples/plugin-runtimes/nativego
Build with: go build -buildmode=plugin -o echo.so ./pkg/ext-go/examples/plugin-runtimes/nativego
plugin-runtimes/wasi command
Build with GOOS=wasip1 GOARCH=wasm.
Build with GOOS=wasip1 GOARCH=wasm.
plugin-sdk command
A runnable host/guest template covering typed methods, configuration, instance leases, health, streams and a separately authorized host callback.
A runnable host/guest template covering typed methods, configuration, instance leases, health, streams and a separately authorized host callback.
plugin-typescript command
Run from the CTX repository root: go run ./pkg/ext-go/examples/plugin-typescript.
Run from the CTX repository root: go run ./pkg/ext-go/examples/plugin-typescript.
hashicorp module
inference module
model module
perception module
realtime module
wasm module
yaegi module

Jump to

Keyboard shortcuts

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