agent

package
v0.260507.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClaudeCodeRequestModels = []string{
	"tingly/cc",
	"tingly/cc-haiku",
	"tingly/cc-sonnet",
	"tingly/cc-opus",
	"tingly/cc-default",
	"tingly/cc-subagent",
}

ClaudeCodeRequestModels defines all request models for Claude Code scenario When applying claude-code agent, all these rules should be updated for convenience

View Source
var OpenCodeRequestModels = []string{
	"tingly-opencode",
}

OpenCodeRequestModels defines all request models for OpenCode scenario

Functions

func GenerateClaudeCodeEnv added in v0.260409.1540

func GenerateClaudeCodeEnv(baseURL, apiKey string, unified bool) map[string]string

GenerateClaudeCodeEnv generates environment variables for Claude Code settings. unified=true means all model slots point to "tingly/cc"; false uses separate cc-* models.

func GenerateOpenCodePayload added in v0.260409.1540

func GenerateOpenCodePayload(configBaseURL, apiKey string, models map[string]interface{}) map[string]interface{}

GenerateOpenCodePayload generates the OpenCode configuration payload. models is a map of model-name → model config object (map[string]interface{}). Pass nil or empty map to use the default single-model layout.

Types

type AgentApply

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

AgentApply handles agent configuration application This is shared logic used by both CLI and HTTP handlers

func NewAgentApply

func NewAgentApply(cfg *serverconfig.Config, host string) *AgentApply

NewAgentApply creates a new AgentApply instance

func (*AgentApply) ApplyAgent

func (aa *AgentApply) ApplyAgent(req *ApplyAgentRequest) (*ApplyAgentResult, error)

ApplyAgent applies configuration for the specified agent type

func (*AgentApply) RestoreAgent added in v0.260507.1

func (aa *AgentApply) RestoreAgent(req *RestoreAgentRequest) (*RestoreAgentResult, error)

RestoreAgent restores all config files for the given agent type from their most recent backup. Each file is handled independently — a missing backup for one file does not abort the others; per-file outcomes are summarised in the returned RestoreAgentResult.

Routing rules and other in-process state are NOT touched: backups only cover the on-disk config files. Re-run `agent apply` afterward to bring rules back in sync if needed.

type AgentInfo

type AgentInfo struct {
	// Type is the agent type
	Type AgentType

	// Name is the display name
	Name string

	// Description is a brief description
	Description string

	// ConfigFiles lists the configuration files this agent uses
	ConfigFiles []string

	// Scenario is the corresponding routing rule scenario
	Scenario string
}

AgentInfo provides information about an agent type

func GetAgentInfo

func GetAgentInfo(agentType AgentType) (AgentInfo, bool)

GetAgentInfo returns information about a specific agent type

func ListAgentInfo

func ListAgentInfo() []AgentInfo

ListAgentInfo returns information about all supported agent types

type AgentType

type AgentType string

AgentType represents the type of AI agent to configure

const (
	// AgentTypeClaudeCode represents Claude Code agent
	AgentTypeClaudeCode AgentType = "claude-code"

	// AgentTypeOpenCode represents OpenCode IDE extension
	AgentTypeOpenCode AgentType = "opencode"
)

func ParseAgentType added in v0.260507.1

func ParseAgentType(input string) (AgentType, error)

ParseAgentType parses an agent type string, supporting aliases. Returns the normalized AgentType or an error if invalid. Supported aliases:

  • "cc", "claude", "claude-code" -> AgentTypeClaudeCode
  • "oc", "opencode" -> AgentTypeOpenCode

func (AgentType) IsValid

func (at AgentType) IsValid() bool

IsValid checks if the AgentType is valid

func (AgentType) String

func (at AgentType) String() string

String returns the string representation of AgentType

type ApplyAgentRequest

type ApplyAgentRequest struct {
	// AgentType is the type of agent to configure (required)
	AgentType AgentType

	// Provider is the provider UUID to use (optional, prompts if empty)
	Provider string

	// Model is the model name to use (optional, prompts if empty)
	Model string

	// Unified specifies unified mode for claude-code (single config for all models)
	// Only applicable for AgentTypeClaudeCode
	Unified bool

	// Force skips confirmation prompts
	Force bool

	// Preview shows what would be applied without actually applying
	Preview bool

	// InstallStatusLine installs the status line script for Claude Code
	// Only applicable for AgentTypeClaudeCode
	InstallStatusLine bool
}

ApplyAgentRequest represents a request to apply agent configuration

type ApplyAgentResult

type ApplyAgentResult struct {
	// Success indicates whether the operation completed successfully
	Success bool

	// AgentType is the type of agent that was configured
	AgentType AgentType

	// ProviderName is the name of the provider that was selected
	ProviderName string

	// ProviderUUID is the UUID of the provider that was selected
	ProviderUUID string

	// Model is the model name that was selected
	Model string

	// ConfigFiles lists the files that were created or updated
	ConfigFiles []string

	// BackupPaths lists the paths to backup files created
	BackupPaths []string

	// RulesCreated indicates how many new routing rules were created
	RulesCreated int

	// RulesUpdated indicates how many existing routing rules were updated
	RulesUpdated int

	// Message contains a human-readable result message
	Message string
}

ApplyAgentResult represents the result of applying agent configuration

type RestoreAgentRequest added in v0.260507.1

type RestoreAgentRequest struct {
	// AgentType is the type of agent to restore (required)
	AgentType AgentType

	// Force skips confirmation prompts (CLI use)
	Force bool
}

RestoreAgentRequest represents a request to restore agent configuration from the most recent on-disk backup.

type RestoreAgentResult added in v0.260507.1

type RestoreAgentResult struct {
	// Success is true only when every relevant config file was restored
	// without error.
	Success bool

	// AgentType is the type of agent that was restored.
	AgentType AgentType

	// RestoredFiles lists "<original> <- <backup>" entries for files that
	// were successfully restored.
	RestoredFiles []string

	// PreRestoreBackups lists the safety snapshots taken of each live file
	// before the restore overwrote it.
	PreRestoreBackups []string

	// Failures lists per-file error messages, e.g. "no backup found".
	// Non-empty Failures with empty RestoredFiles means Success == false.
	Failures []string

	// Message is a human-readable summary suitable for CLI output.
	Message string
}

RestoreAgentResult represents the result of restoring agent configuration.

Jump to

Keyboard shortcuts

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