ir

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ir provides a stable, deterministic intermediate representation (IR) used as the sole input to loom-mcp code generation templates.

The IR is constructed from evaluated Goa roots and exists to decouple template rendering from Goa expression graphs, enabling cleaner generation logic and more predictable outputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// Name is the DSL name of the agent.
	Name string `json:"name"`
	// Slug is the filesystem-safe token derived from Name.
	Slug string `json:"slug"`
	// Service is the owning service of the agent.
	Service *Service `json:"service"`
}

Agent describes an agent declaration anchored to a Goa service.

type Design

type Design struct {
	// Genpkg is the import path root for generated code (typically "<module>/gen").
	Genpkg string `json:"genpkg"`
	// Services is the set of Goa services referenced by the design.
	Services []*Service `json:"services"`
	// Agents is the set of declared agents, sorted by service then agent name.
	Agents []*Agent `json:"agents"`
	// Toolsets is the set of defining toolsets, sorted by toolset name.
	Toolsets []*Toolset `json:"toolsets"`
}

Design is the deterministic, generator-facing intermediate representation of a loom-mcp agent/toolset design.

Design is intended to be stable and ordered deterministically so generators can iterate it without relying on map iteration order.

func Build

func Build(genpkg string, roots []eval.Root) (*Design, error)

Build constructs a Design IR from evaluated Goa roots.

type Owner

type Owner struct {
	// Kind identifies which anchor owns this toolset's generated specs/codecs.
	// Toolsets may be declared globally (top-level) but still require a concrete
	// owner anchor to avoid duplicate emission and to keep package layout stable.
	Kind OwnerKind `json:"kind"`

	// ServiceName is the Goa service name that owns the generated package.
	ServiceName string `json:"service_name"`
	// ServicePathName is the Goa service path name used in gen/ layout.
	ServicePathName string `json:"service_path_name"`

	// AgentName is set when Kind is OwnerKindAgentExport.
	AgentName string `json:"agent_name,omitempty"`
	// AgentSlug is set when Kind is OwnerKindAgentExport.
	AgentSlug string `json:"agent_slug,omitempty"`
}

Owner describes the selected anchor for a defining toolset.

type OwnerKind

type OwnerKind string

OwnerKind identifies the generation anchor for a toolset.

const (
	// OwnerKindService indicates a service-owned toolset whose specs/codecs live under
	// gen/<service>/toolsets/<toolset>/...
	OwnerKindService OwnerKind = "service"
	// OwnerKindAgentExport indicates a toolset exported by an agent whose specs/codecs
	// live under gen/<service>/agents/<agent>/exports/<toolset>/...
	OwnerKindAgentExport OwnerKind = "agent_export"
)

type Service

type Service struct {
	// Name is the Goa service name.
	Name string `json:"name"`
	// PathName is the Goa service path name used in generated directories.
	PathName string `json:"path_name"`

	Goa *service.Data `json:"-"`
}

Service describes a Goa service used to anchor ownership and output layout.

type Toolset

type Toolset struct {
	// Name is the globally unique toolset identifier in the design.
	Name string `json:"name"`
	// Slug is the filesystem-safe token derived from Name.
	Slug string `json:"slug"`
	// Owner identifies where this toolset's specs/codecs are generated.
	Owner Owner `json:"owner"`
}

Toolset describes a defining toolset (Origin == nil) together with its chosen ownership anchor for generation.

Jump to

Keyboard shortcuts

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