Skip to content

About

The Go SDK for XiHan Framework: primitives, manifests, invocation context, execution pipeline, operation contracts and the out-of-process plugin runtime.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

XiHan Framework SDK for Go

Out-of-process plugins and remote providers in Go, verified by the same conformance vectors as the .NET host

CI Go Reference Go version MIT License GitHub Stars

Docs · Getting Started · Specification · Reference Implementation

English | 简体中文

The Go implementation of XiHan Spec: the primitives layer, manifests, the invocation context, the pipeline, operation contracts and the out-of-process plugin runtime, plus the plugin side of the caching.distributed@1 remote provider. Use it to write Go plugins that run in the .NET host (XiHan.Framework), or to use the same primitives in Go applications; the spec lives in spec/ as a submodule, and conformance is verified by the vectors and black-box runner of the spec repository.

Modules

Package Contents Spec
primitives Error and error codes, Result[T], Maybe[T], ID[Tag, V], lifecycle, pipeline stages, Baggage keys, message keys and templates RFC-0001, RFC-0010
manifest The xihan.manifest.json model, reading, canonical output and validation RFC-0002
invocation The invocation context: cancellation and deadlines, W3C tracing, registered Baggage RFC-0003
pipeline The eleven-stage pipeline and its ordering rules RFC-0004
operation Operation contracts, the registry, and an invoker that runs through the full pipeline RFC-0011
plugin The out-of-process plugin runtime Serve and the host callback client Host RFC-0017
plugin/v1 Protocol code generated from spec/plugin/plugin.proto plugin/plugin.proto
caching The plugin side of the caching.distributed@1 remote provider: the store contract, a bounded in-memory store and the operation set RFC-0019
examples/echo An echo plugin; cmd/echo-go is the executable entry point —
examples/cache A remote cache provider plugin; cmd/cache-go is the executable entry point —

Installation

go get github.com/xihanfun/framework-sdk-go

Getting Started

package main

import (
	"context"
	_ "embed"
	"os"

	"github.com/xihanfun/framework-sdk-go/invocation"
	"github.com/xihanfun/framework-sdk-go/operation"
	"github.com/xihanfun/framework-sdk-go/plugin"
	"github.com/xihanfun/framework-sdk-go/primitives"
)

//go:embed xihan.manifest.json
var manifest []byte

type CreateRequest struct{ Text string `json:"text"` }
type CreateResponse struct{ Text, Tenant string }

func main() {
	registry := operation.NewRegistry()
	_ = operation.Add(registry, operation.Contract{ID: "echoes.create", Stability: primitives.Experimental, Expose: []string{operation.ExposeHTTP}},
		operation.HandlerFunc[CreateRequest, CreateResponse](func(ctx *invocation.Context, request CreateRequest) primitives.Result[CreateResponse] {
			return primitives.Ok(CreateResponse{Text: request.Text, Tenant: ctx.Tenant()})
		}), nil, "")

	if err := plugin.Serve(context.Background(), plugin.Options{Manifest: manifest, Operations: registry}); err != nil {
		os.Exit(1)
	}
}

Put the manifest xihan.manifest.json in the same directory as the built executable and the host can load it; verify it with the black-box runner of the spec repository, xihan-conformance plugin --dir <output-dir>. How to write the manifest, message catalogs, subscriptions, callbacks and logs is covered in Write a plugin in the docs.

Documentation

The documentation site is in Chinese.

Where Contents
Go SDK Modules, writing a plugin, behavior shared with the host, language mapping, conformance, breaking changes and migration
Out-of-process plugins The protocol, handshake and lifecycle, loading and callbacks on the host side, remote providers
Spec and languages How the spec is organized, conformance profiles, the state of each language SDK
XiHan Spec RFCs, vocabulary, protocol mappings, conformance vectors and the black-box runner

Status

Claimed conformance profiles (RFC-0024): core, plugin and provider:caching.distributed@1, with no gaps; the pinned spec version is the one in the spec/ submodule and the spec module in go.mod. The maturity is Stable: releases are pinned to a formal spec tag; streaming operations and the Wasm carrier are out of scope. Details are in Conformance in the docs.

Ecosystem

Project Description
framework-spec XiHan Spec: RFCs, vocabulary, protocol mappings and conformance vectors
XiHan.Framework The .NET reference implementation
framework-sdk-typescript TypeScript SDK
framework-sdk-rust Rust SDK
framework-sdk-java Java SDK
framework-sdk-python Python SDK
framework-sdk-php PHP SDK

Contributing

Issues and pull requests are welcome. Changes to public contracts are not made in the SDK repositories: they go through the RFC process of framework-spec first and are then synced to each SDK. Development conventions, gates and the release process are in AGENTS.md.

License

MIT © 2021-Present XiHanFun and contributors.

About

The Go SDK for XiHan Framework: primitives, manifests, invocation context, execution pipeline, operation contracts and the out-of-process plugin runtime.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages