Documentation
¶
Overview ¶
Package types provides shared type definitions used across gh-aw packages.
This package contains common data structures and interfaces that are used by multiple packages to avoid circular dependencies and maintain clean separation of concerns. The types here are focused on configuration structures that need to be shared between parsing and workflow compilation.
Key Types ¶
BaseMCPServerConfig: The foundational configuration structure for MCP (Model Context Protocol) servers. This type is embedded by both parser and workflow packages to maintain consistency while allowing each package to add domain-specific fields.
MCP servers are AI tool providers that can run as:
- stdio processes (command + args)
- HTTP endpoints (url + headers)
- Container services (container image + mounts)
Basic Usage ¶
config := types.BaseMCPServerConfig{
Type: "stdio",
Command: "npx",
Args: []string{"-y", "@modelcontextprotocol/server-filesystem"},
Env: map[string]string{
"ALLOWED_PATHS": "/workspace",
},
}
Architecture ¶
This package serves as a bridge between the parser package (which reads workflow markdown files) and the workflow package (which generates GitHub Actions YAML). By defining shared types here, we avoid circular imports and ensure consistent configuration structures.
The types are designed to be:
- Serializable to JSON and YAML
- Embeddable by other packages
- Extensible with package-specific fields
- Well-documented with struct tags
Related Packages ¶
pkg/parser - Embeds BaseMCPServerConfig in parser.MCPServerConfig
pkg/workflow - Embeds BaseMCPServerConfig in workflow.MCPServerConfig
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseMCPServerConfig ¶
type BaseMCPServerConfig struct {
// Common execution fields
Command string `json:"command,omitempty" yaml:"command,omitempty"` // Command to execute (for stdio mode)
Args []string `json:"args,omitempty" yaml:"args,omitempty"` // Arguments for the command
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` // Environment variables
// Type and version
Type string `json:"type,omitempty" yaml:"type,omitempty"` // MCP server type (stdio, http, local, remote)
Version string `json:"version,omitempty" yaml:"version,omitempty"` // Optional version/tag
// HTTP-specific fields
URL string `json:"url,omitempty" yaml:"url,omitempty"` // URL for HTTP mode MCP servers
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"` // HTTP headers for HTTP mode
Auth *MCPAuthConfig `json:"auth,omitempty" yaml:"auth,omitempty"` // Upstream authentication config (HTTP mode only)
// Container-specific fields
Container string `json:"container,omitempty" yaml:"container,omitempty"` // Container image for the MCP server
Entrypoint string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"` // Optional entrypoint override for container
EntrypointArgs []string `json:"entrypointArgs,omitempty" yaml:"entrypointArgs,omitempty"` // Arguments passed to container entrypoint
Mounts []string `json:"mounts,omitempty" yaml:"mounts,omitempty"` // Volume mounts for container (format: "source:dest:mode")
}
BaseMCPServerConfig contains the shared fields common to all MCP server configurations. This base type is embedded by both parser.MCPServerConfig and workflow.MCPServerConfig to eliminate duplication while allowing each to have domain-specific fields and struct tags.
type MCPAuthConfig ¶ added in v0.65.1
type MCPAuthConfig struct {
// Type is the authentication type. Currently only "github-oidc" is supported.
Type string `json:"type" yaml:"type"`
// Audience is the intended audience (aud claim) for the OIDC token.
// If omitted, defaults to the server's url field.
Audience string `json:"audience,omitempty" yaml:"audience,omitempty"`
}
MCPAuthConfig represents upstream authentication configuration for an HTTP MCP server. When configured, the gateway dynamically acquires tokens and injects them as Authorization headers on every outgoing request. Currently only GitHub Actions OIDC is supported.
type TokenClassWeights ¶ added in v0.65.6
type TokenClassWeights struct {
Input float64 `json:"input,omitempty"`
CachedInput float64 `json:"cached-input,omitempty"`
Output float64 `json:"output,omitempty"`
Reasoning float64 `json:"reasoning,omitempty"`
CacheWrite float64 `json:"cache-write,omitempty"`
}
TokenClassWeights holds per-token-class weights for effective token computation. Each field corresponds to one token class; a zero value means "use default". The JSON keys use hyphens to match the frontmatter schema (engine.token-weights.token-class-weights).
type TokenWeights ¶ added in v0.65.6
type TokenWeights struct {
// Multipliers maps model names to cost multipliers relative to the reference model.
// Keys are matched case-insensitively with prefix matching as a fallback.
Multipliers map[string]float64 `json:"multipliers,omitempty"`
// TokenClassWeights overrides the per-token-class weights used before the model multiplier.
// A nil pointer means no overrides; individual zero fields mean "use default".
TokenClassWeights *TokenClassWeights `json:"token-class-weights,omitempty"`
}
TokenWeights defines custom model cost information for effective token computation. It mirrors the structure of model_multipliers.json and allows per-workflow overrides. Specified under engine.token-weights in the workflow frontmatter and stored in aw_info.json at runtime.