typ

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 15 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

typ

go get github.com/holon-sh/typ

typ.wasm is built from src/ with the pinned Rust toolchain:

scripts/build

Tests:

go test ./...
cargo test

The type checks in go test run when tooling/ is installed:

npm ci --prefix tooling
uv sync --project tooling
(cd tooling && go mod download)

Documentation

Index

Constants

View Source
const (
	Marker    = "holon-generated-apps-v1"
	MediaType = "application/vnd.holon.mcp-contract.v1+json"
)
View Source
const PythonOwnTypes = "_own.py"
View Source
const TypeScriptDeclarations = "index.d.mts"
View Source
const TypeScriptModule = "index.mjs"

Variables

This section is empty.

Functions

func Changes

func Changes(expected, published *Metadata) ([]string, error)

func CheckTools

func CheckTools(tools []Tool) error

CheckTools requires each tool to have a valid MCP name and an MCP Tool inputSchema that is an object of type object.

func Generate

func Generate(ctx context.Context, options GenerateRequest) (map[string][]byte, error)

func Load added in v0.0.4

func Load() error

func SameContract

func SameContract(a, b *Contract) (bool, error)

Types

type Contract

type Contract struct {
	Tools     []Tool     `json:"tools"`
	Resources []Resource `json:"resources,omitempty"`
	Events    []Event    `json:"events,omitempty"`
}

func (Contract) MarshalJSON

func (c Contract) MarshalJSON() ([]byte, error)

type Event

type Event struct {
	Name    string          `json:"name"`
	Input   json.RawMessage `json:"inputSchema"`
	Payload json.RawMessage `json:"payloadSchema"`
}

type GenerateRequest

type GenerateRequest struct {
	Target    string               `json:"target"`
	Identity  Identity             `json:"identity"`
	Requires  map[string]Identity  `json:"requires,omitempty"`
	Contracts map[string]*Contract `json:"contracts,omitempty"`
	Own       string               `json:"own,omitempty"`
	OwnTools  *Contract            `json:"own_tools,omitempty"`
	App       string               `json:"app,omitempty"`
	GoModule  string               `json:"go_module,omitempty"`
}

type Identity

type Identity struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type Metadata

type Metadata struct {
	Identity Identity          `json:"identity"`
	Schema   *Contract         `json:"schema,omitempty"`
	Requires map[string]string `json:"requires,omitempty"`
}

func ParseMetadata

func ParseMetadata(data []byte) (*Metadata, error)

type Resource

type Resource struct {
	URI    string          `json:"uri"`
	Output json.RawMessage `json:"outputSchema"`
}

type Tool

type Tool struct {
	Name   string          `json:"name"`
	Input  json.RawMessage `json:"inputSchema"`
	Output json.RawMessage `json:"outputSchema,omitempty"`
}

Jump to

Keyboard shortcuts

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