operationsgraph

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package graph provides graph-based execution graph implementation for graycode-router.

Package operationsgraph projects GraycodeRouter routing and normalized generation telemetry into the portable hawk-eco graph contract.

Index

Constants

View Source
const SchemaVersion = "graycode-router.graph/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Export

type Export struct {
	SchemaVersion string                 `json:"schema_version"`
	GeneratedAt   time.Time              `json:"generated_at"`
	Scope         graphcontracts.Scope   `json:"scope,omitempty"`
	Nodes         []graphcontracts.Node  `json:"nodes"`
	Edges         []graphcontracts.Edge  `json:"edges"`
	Events        []graphcontracts.Event `json:"events"`
}

func Build

func Build(input Input) (*Export, error)

type Input

type Input struct {
	Route           *llmcontracts.ResolvedRoute
	Usage           *llmcontracts.GraycodeRouterUsage
	FinishReason    string
	RequestID       string
	Content         string
	ToolCallCount   int
	ObservedAt      time.Time
	Scope           graphcontracts.Scope
	CorrelationID   string
	ProducerVersion string
}

type OperationEdge

type OperationEdge struct {
	From      string                 `json:"from"`
	To        string                 `json:"to"`
	Condition string                 `json:"condition,omitempty"`
	Weight    float64                `json:"weight"`
	Attrs     map[string]interface{} `json:"attrs,omitempty"`
}

OperationEdge represents an edge in the operations graph.

type OperationNode

type OperationNode struct {
	ID          string                 `json:"id"`
	Type        string                 `json:"type"` // "agent", "tool", "function", "start", "end"
	Name        string                 `json:"name"`
	Description string                 `json:"description,omitempty"`
	Handler     string                 `json:"handler,omitempty"`
	Attrs       map[string]interface{} `json:"attrs,omitempty"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
}

OperationNode represents a node in the operations graph.

type OperationsGraph

type OperationsGraph struct {
	ID    string                    `json:"id"`
	Name  string                    `json:"name"`
	Nodes map[string]*OperationNode `json:"nodes"`
	Edges []OperationEdge           `json:"edges"`
	Attrs map[string]interface{}    `json:"attrs,omitempty"`
	// contains filtered or unexported fields
}

OperationsGraph represents a graph of operations for graycode-router.

func NewOperationsGraph

func NewOperationsGraph(id, name string) *OperationsGraph

NewOperationsGraph creates a new operations graph.

func (*OperationsGraph) AddEdge

func (g *OperationsGraph) AddEdge(edge OperationEdge)

AddEdge adds an edge to the graph.

func (*OperationsGraph) AddNode

func (g *OperationsGraph) AddNode(node *OperationNode)

AddNode adds a node to the graph.

func (*OperationsGraph) FindByType

func (g *OperationsGraph) FindByType(nodeType string) []*OperationNode

FindByType finds all nodes of a specific type.

func (*OperationsGraph) GetEdges

func (g *OperationsGraph) GetEdges() []OperationEdge

GetEdges returns all edges.

func (*OperationsGraph) GetNode

func (g *OperationsGraph) GetNode(id string) (*OperationNode, bool)

GetNode retrieves a node by ID.

func (*OperationsGraph) GetNodes

func (g *OperationsGraph) GetNodes() []*OperationNode

GetNodes returns all nodes.

func (*OperationsGraph) ToGraphSpec

func (g *OperationsGraph) ToGraphSpec() *graphcontracts.GraphSpec

ToGraphSpec converts the operations graph to a portable graph spec.

Jump to

Keyboard shortcuts

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