translator

package
v0.0.0-...-2d843e3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileSkillResources

func CompileSkillResources(template *v1alpha3.AgentTemplate) (agentplugin.Resources, []string, error)

CompileSkillResources translates portable AgentTemplate skill selections into the runtime-neutral resource contract shared by Harness adapters.

func ManagedAgentCard

func ManagedAgentCard(template *v1alpha3.AgentTemplate) *a2atype.AgentCard

ManagedAgentCard describes the common private A2A contract implemented by the kagent, Codex, and Claude harnesses. The gateway replaces the private interface while preserving these runtime capabilities.

func NewValidationError

func NewValidationError(format string, args ...any) error

NewValidationError reports invalid public API configuration.

func OtelEnvFromProcess

func OtelEnvFromProcess() []corev1.EnvVar

OtelEnvFromProcess returns the controller's supported tracing configuration for the agent runtime.

Types

type AgentInput

type AgentInput struct {
	Template            *v1alpha3.AgentTemplate
	ResolvedModelConfig *ResolvedModelConfig
	Instruction         string
	MCPTools            []ResolvedMCPTool
	Shared              []AgentInputBinding
}

AgentInput contains resolved Kubernetes inputs for one agent.

type AgentInputBinding

type AgentInputBinding struct {
	Name        string
	Description string
	Agent       *AgentInput
}

AgentInputBinding preserves the parent-specific identity of a compiled child.

type Collections

type Collections struct {
	AgentTemplates       krt.Collection[*v1alpha3.AgentTemplate]
	ResolvedModelConfigs krt.Collection[ResolvedModelConfig]
	RemoteMCPServers     krt.Collection[*v1alpha3.RemoteMCPServer]
	ConfigMaps           krt.Collection[*corev1.ConfigMap]
	Secrets              krt.Collection[*corev1.Secret]
	WorkerPools          krt.Collection[*atev1alpha1.WorkerPool]
}

Collections contains every typed input used while compiling a revision. Production supplies informer-backed collections; tests supply KRT mocks.

type CompileResult

type CompileResult struct {
	Revision
	Warnings []string
}

CompileResult contains one immutable runtime revision and the non-blocking diagnostics produced while compiling it. Diagnostics are deliberately kept outside Revision because they do not describe runtime behavior.

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

Compiler resolves public API objects into a complete, immutable runtime revision. It owns the v2 translation boundary rather than delegating to an earlier API translator.

func NewCompiler

func NewCompiler(ctx krt.HandlerContext, collections Collections, harnessCompilers map[HarnessType]HarnessCompiler) *Compiler

NewCompiler constructs the v2 runtime compiler.

func (*Compiler) CompileAgentTemplate

func (c *Compiler) CompileAgentTemplate(ctx context.Context, harness *v1alpha3.Harness, template *v1alpha3.AgentTemplate) (*CompileResult, error)

CompileAgentTemplate resolves an API v2 attachment into an immutable runtime revision and user-facing diagnostics. Nothing below this boundary needs to read the public API objects.

type HarnessCompiler

type HarnessCompiler interface {
	Compile(context.Context, *HarnessInput) (*CompileResult, error)
}

HarnessCompiler converts resolved, harness-neutral inputs into one runtime revision and its user-facing diagnostics.

type HarnessInput

type HarnessInput struct {
	Harness *v1alpha3.Harness
	Root    *AgentInput
}

HarnessInput contains the Kubernetes inputs needed by a harness compiler.

type HarnessType

type HarnessType string

HarnessType identifies the runtime selected by a Harness.

const (
	HarnessTypeKagent HarnessType = "kagent"
	HarnessTypeCodex  HarnessType = "codex"
	HarnessTypeClaude HarnessType = "claude"
	HarnessTypeBYO    HarnessType = "byo"
)

Supported Harness runtime types.

type ModelConfigFailure

type ModelConfigFailure struct {
	Reason  string
	Message string
}

ModelConfigFailure describes either an invalid ModelConfig or an unavailable Kubernetes input it references.

type ModelConfigReference

type ModelConfigReference struct {
	NamespacedName types.NamespacedName
	Kind           string
	Key            string
}

ModelConfigReference records an object consulted while resolving a ModelConfig. It intentionally contains object identity only; secret values remain in Kubernetes.

type PromptTemplateContext

type PromptTemplateContext struct {
	// AgentTemplateName is the metadata.name of the AgentTemplate.
	AgentTemplateName string
	// AgentTemplateNamespace is the metadata.namespace of the AgentTemplate.
	AgentTemplateNamespace string
	// Description is the AgentTemplate's spec.description.
	Description string
	// ToolNames contains tools selected from all configured MCP servers.
	ToolNames []string
}

PromptTemplateContext holds the v2 AgentTemplate values available to system prompt templates. It deliberately excludes legacy Agent fields and skills, which the current K3 adapter does not support.

type ResolvedAgent

type ResolvedAgent struct {
	Template *v1alpha3.AgentTemplate
	Shared   []ResolvedAgentBinding
}

ResolvedAgent is one template and its validated Shared children.

type ResolvedAgentBinding

type ResolvedAgentBinding struct {
	Name        string
	Description string
	Agent       *ResolvedAgent
}

ResolvedAgentBinding preserves the parent-specific identity of a Shared child.

type ResolvedMCPTool

type ResolvedMCPTool struct {
	Binding v1alpha3.MCPToolBinding
	Server  *v1alpha3.RemoteMCPServer
}

ResolvedMCPTool pairs an exact tool allowlist with its resolved server.

type ResolvedModelConfig

type ResolvedModelConfig struct {
	Config            *v1alpha3.ModelConfig
	References        []ModelConfigReference
	SemanticFailures  []ModelConfigFailure
	ReferenceFailures []ModelConfigFailure
}

ResolvedModelConfig is the harness-neutral ModelConfig input. Harness adapters render it into their runtime-specific model and credential configuration.

func ResolveModelConfig

func ResolveModelConfig(ctx krt.HandlerContext, collections Collections, config *v1alpha3.ModelConfig) (*ResolvedModelConfig, error)

ResolveModelConfig validates and resolves ModelConfig data shared by every harness. It does not expose secret values or produce runtime-specific inputs.

func (ResolvedModelConfig) Equals

func (*ResolvedModelConfig) Failure

Failure returns the first diagnostic suitable for reporting at a compilation boundary. Reconciliation should inspect both failure lists to report status.

func (ResolvedModelConfig) ResourceName

func (r ResolvedModelConfig) ResourceName() string

func (*ResolvedModelConfig) Usable

func (r *ResolvedModelConfig) Usable() bool

Usable reports whether every intrinsic configuration requirement and every referenced Kubernetes input was resolved.

type ResolvedTree

type ResolvedTree struct {
	Harness *v1alpha3.Harness
	Root    *ResolvedAgent
}

ResolvedTree is the validated AgentTemplate topology for one Harness.

type Revision

type Revision struct {
	// These fields identify the public attachment that produced the revision.
	Namespace         string
	AgentTemplateName string
	HarnessName       string

	// Image and Environment describe the runtime container.
	Image       string
	Command     []string
	Args        []string
	Environment []corev1.EnvVar
	// ConfigJSON is injected into the runtime container verbatim.
	// AgentCard stays typed until a runtime or public protocol boundary renders it.
	ConfigJSON []byte
	AgentCard  *a2apb.AgentCard

	// WorkerPoolName and SnapshotLocation control Substrate placement and state.
	WorkerPoolName   string
	SnapshotLocation string

	// Provenance identifies every Kubernetes input to this revision. Secret
	// values are represented only by hashes.
	Provenance json.RawMessage
	// EgressDestinations is the hostname allowlist required by this revision.
	EgressDestinations []string
}

Revision is the resolved runtime configuration for one immutable revision.

func (*Revision) Digest

func (r *Revision) Digest() (RevisionID, error)

Digest returns the immutable identity of every input that affects runtime behavior. The full digest is the database key; Kubernetes names use a short prefix only for readability.

type RevisionID

type RevisionID [sha256.Size]byte

RevisionID is the SHA-256 identity of a compiled runtime revision. Keeping the digest as a fixed-size value makes invalid lengths unrepresentable.

func (RevisionID) IsZero

func (id RevisionID) IsZero() bool

IsZero reports whether compilation has not produced an identity.

func (RevisionID) Short

func (id RevisionID) Short() string

Short returns the readable prefix used in Kubernetes names and labels.

func (RevisionID) String

func (id RevisionID) String() string

String returns the full database identity.

type ValidationError

type ValidationError struct {
	Err error
}

ValidationError marks a resolved but unsupported public configuration. The controller reports these as a compatibility condition instead of retrying them like transient Kubernetes lookup failures.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements error.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap preserves the formatted cause for errors.Is and errors.As callers.

Directories

Path Synopsis
Package claude compiles resolved v1alpha3 inputs for the native Claude Harness adapter.
Package claude compiles resolved v1alpha3 inputs for the native Claude Harness adapter.
Package codex compiles resolved v1alpha3 inputs for the native Codex Harness adapter.
Package codex compiles resolved v1alpha3 inputs for the native Codex Harness adapter.

Jump to

Keyboard shortcuts

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