workflowviz

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CategorizeAgent

func CategorizeAgent(agentID string) (category int, color string, categoryName string)

CategorizeAgent returns category info based on agent ID

func ExtractKeyInstructions

func ExtractKeyInstructions(promptTemplate string) []string

ExtractKeyInstructions extracts important instructions from prompt

func ExtractKeyMarkers

func ExtractKeyMarkers(promptTemplate string) []string

ExtractKeyMarkers identifies important markers in the prompt

func ExtractStageTitle

func ExtractStageTitle(promptTemplate string) string

ExtractStageTitle extracts the stage title from prompt template Looks for pattern: ## STAGE N: TITLE

func FindSharedMemoryConnections

func FindSharedMemoryConnections(stages []WorkflowStage) []struct{ From, To int }

FindSharedMemoryConnections detects shared memory connections between stages

func GenerateHTML

func GenerateHTML(data *VisualizationData, outputPath string) error

GenerateHTML creates the final HTML file

Types

type Category

type Category struct {
	Name      string     `json:"name"`
	ItemStyle *ItemStyle `json:"itemStyle"`
}

Category represents a node category

type ChartLink struct {
	Source    string     `json:"source"`
	Target    string     `json:"target"`
	LineStyle *LineStyle `json:"lineStyle,omitempty"`
	Label     *EdgeLabel `json:"label,omitempty"`
}

ChartLink represents an ECharts graph link

type ChartNode

type ChartNode struct {
	Name       string         `json:"name"`
	Category   int            `json:"category"`
	Value      int            `json:"value"`
	SymbolSize int            `json:"symbolSize"`
	Tooltip    NodeTooltip    `json:"tooltip"`
	Label      NodeLabel      `json:"label"`
	ItemStyle  *NodeItemStyle `json:"itemStyle,omitempty"`
}

ChartNode represents an ECharts graph node

type EdgeLabel

type EdgeLabel struct {
	Show      bool   `json:"show"`
	Formatter string `json:"formatter"`
}

EdgeLabel represents edge label

type ItemStyle

type ItemStyle struct {
	Color string `json:"color"`
}

ItemStyle represents node item style

type LineStyle

type LineStyle struct {
	Type  string `json:"type"`
	Color string `json:"color"`
	Width int    `json:"width"`
}

LineStyle represents edge line style

type NodeItemStyle

type NodeItemStyle struct {
	BorderColor string `json:"borderColor,omitempty"`
	BorderWidth int    `json:"borderWidth,omitempty"`
}

NodeItemStyle represents node visual style

type NodeLabel

type NodeLabel struct {
	Show       bool   `json:"show"`
	FontSize   int    `json:"fontSize"`
	FontWeight string `json:"fontWeight,omitempty"`
}

NodeLabel represents node label configuration

type NodeTooltip

type NodeTooltip struct {
	Formatter string `json:"formatter"`
}

NodeTooltip represents node tooltip configuration

type VisualizationData

type VisualizationData struct {
	Title          string
	Subtitle       string
	ChartTitle     string
	ChartSubtitle  string
	NodesJSON      template.JS
	LinksJSON      template.JS
	CategoriesJSON template.JS
	Categories     []struct{ Name, Color string }
}

VisualizationData holds all data needed for HTML template

func GenerateVisualization

func GenerateVisualization(workflow *Workflow) (*VisualizationData, error)

GenerateVisualization creates nodes, links, and categories from workflow

type Workflow

type Workflow struct {
	APIVersion string           `yaml:"apiVersion"`
	Kind       string           `yaml:"kind"`
	Metadata   WorkflowMetadata `yaml:"metadata"`
	Spec       WorkflowSpec     `yaml:"spec"`
}

Workflow represents the complete workflow structure

func ParseWorkflow

func ParseWorkflow(path string) (*Workflow, error)

ParseWorkflow reads and parses a workflow YAML file

type WorkflowMetadata

type WorkflowMetadata struct {
	Name        string            `yaml:"name"`
	Version     string            `yaml:"version"`
	Description string            `yaml:"description"`
	Labels      map[string]string `yaml:"labels"`
}

WorkflowMetadata represents the workflow metadata

type WorkflowPipeline

type WorkflowPipeline struct {
	InitialPrompt string          `yaml:"initial_prompt"`
	Stages        []WorkflowStage `yaml:"stages"`
}

WorkflowPipeline represents the pipeline configuration

type WorkflowSpec

type WorkflowSpec struct {
	Type            string           `yaml:"type"`
	MaxIterations   int              `yaml:"max_iterations"`
	RestartTopic    string           `yaml:"restart_topic"`
	RestartPolicy   map[string]any   `yaml:"restart_policy"`
	RestartTriggers []string         `yaml:"restart_triggers"`
	Pipeline        WorkflowPipeline `yaml:"pipeline"`
}

WorkflowSpec represents the workflow specification

type WorkflowStage

type WorkflowStage struct {
	AgentID        string `yaml:"agent_id"`
	PromptTemplate string `yaml:"prompt_template"`
}

WorkflowStage represents a single stage in the pipeline

Jump to

Keyboard shortcuts

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