copilot

package
v1.23.13 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DisplayTitle is the user-facing brand name for the agent experience.
	// Change this single constant to rebrand across all UI text.
	DisplayTitle = "GitHub Copilot"

	// ConfigRoot is the root namespace for all Copilot agent configuration keys.
	ConfigRoot = "copilot"

	// ConfigKeyModelRoot is the root for model configuration.
	ConfigKeyModelRoot = ConfigRoot + ".model"
	// ConfigKeyModelType is the model provider type (e.g., "copilot").
	ConfigKeyModelType = ConfigKeyModelRoot + ".type"
	// ConfigKeyModel is the model name for Copilot agent sessions.
	ConfigKeyModel = ConfigKeyModelRoot

	// ConfigKeyToolsRoot is the root for tool control configuration.
	ConfigKeyToolsRoot = ConfigRoot + ".tools"
	// ConfigKeyToolsAvailable is an allowlist of tools available to the agent.
	ConfigKeyToolsAvailable = ConfigKeyToolsRoot + ".available"
	// ConfigKeyToolsExcluded is a denylist of tools blocked from the agent.
	ConfigKeyToolsExcluded = ConfigKeyToolsRoot + ".excluded"

	// ConfigKeySkillsRoot is the root for skills configuration.
	ConfigKeySkillsRoot = ConfigRoot + ".skills"
	// ConfigKeySkillsDirectories is additional skill directories to load.
	ConfigKeySkillsDirectories = ConfigKeySkillsRoot + ".directories"
	// ConfigKeySkillsDisabled is skills to disable in agent sessions.
	ConfigKeySkillsDisabled = ConfigKeySkillsRoot + ".disabled"

	// ConfigKeyMCPRoot is the root for MCP (Model Context Protocol) configuration.
	ConfigKeyMCPRoot = ConfigRoot + ".mcp"
	// ConfigKeyMCPServers is additional MCP servers to load, merged with built-in servers.
	ConfigKeyMCPServers = ConfigKeyMCPRoot + ".servers"

	// ConfigKeyReasoningEffort is the reasoning effort level (low, medium, high).
	ConfigKeyReasoningEffort = ConfigRoot + ".reasoningEffort"
	// ConfigKeySystemMessage is a custom system message appended to the default prompt.
	ConfigKeySystemMessage = ConfigRoot + ".systemMessage"
	// ConfigKeyConsent is the consent rules configuration for tool execution.
	ConfigKeyConsent = ConfigRoot + ".consent"
	// ConfigKeyLogLevel is the log level for the Copilot SDK client.
	ConfigKeyLogLevel = ConfigRoot + ".logLevel"
	// ConfigKeyMode is the default agent mode (interactive, autopilot, plan).
	ConfigKeyMode = ConfigRoot + ".mode"

	// ConfigKeyErrorHandlingRoot is the root for error handling preferences.
	ConfigKeyErrorHandlingRoot = ConfigRoot + ".errorHandling"
	// ConfigKeyErrorHandlingCategory controls the default troubleshooting scope
	// (explain, guidance, troubleshoot, skip).
	ConfigKeyErrorHandlingCategory = ConfigKeyErrorHandlingRoot + ".category"
	// ConfigKeyErrorHandlingFix controls auto-approval of agent-applied fixes.
	ConfigKeyErrorHandlingFix = ConfigKeyErrorHandlingRoot + ".fix"
)

Config key constants for the copilot.* namespace in azd user configuration. All keys are built from shared prefix constants so renaming any level requires a single change.

Variables

View Source
var FeatureCopilot = alpha.MustFeatureKey("llm")

FeatureCopilot is the feature key for the Copilot agent feature. The underlying alpha key remains "llm" for backward compatibility with existing user configurations (alpha.llm = on).

Functions

func IsFeatureEnabled

func IsFeatureEnabled(alphaManager *alpha.FeatureManager) error

IsFeatureEnabled checks if the Copilot agent feature is enabled.

Types

type CopilotCLI

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

CopilotCLI manages the Copilot CLI binary lifecycle — download, cache, and version management. Follows the same pattern as pkg/tools/bicep for on-demand tool installation.

func NewCopilotCLI

func NewCopilotCLI(console input.Console, runner azdexec.CommandRunner, transporter policy.Transporter) *CopilotCLI

NewCopilotCLI creates a new CopilotCLI manager.

func (*CopilotCLI) CheckInstalled

func (c *CopilotCLI) CheckInstalled(ctx context.Context) error

CheckInstalled verifies the Copilot CLI is available, downloading it if needed.

func (*CopilotCLI) InstallPlugin

func (c *CopilotCLI) InstallPlugin(ctx context.Context, source string) error

InstallPlugin installs a plugin by source reference.

func (*CopilotCLI) InstallUrl

func (c *CopilotCLI) InstallUrl() string

InstallUrl returns the documentation URL for manual installation.

func (*CopilotCLI) ListPlugins

func (c *CopilotCLI) ListPlugins(ctx context.Context) (map[string]bool, error)

ListPlugins returns a map of installed plugin names. First tries "copilot plugin list" CLI command. If that returns no results (known issue: CLI may not detect plugins installed by a different version), falls back to scanning the plugin directory on disk.

func (*CopilotCLI) Login

func (c *CopilotCLI) Login(ctx context.Context) error

Login runs the copilot login command (OAuth device flow).

func (*CopilotCLI) Name

func (c *CopilotCLI) Name() string

Name returns the display name of the tool.

func (*CopilotCLI) Path

func (c *CopilotCLI) Path(ctx context.Context) (string, error)

Path returns the path to the Copilot CLI binary, downloading it if necessary. Safe to call multiple times; installation only happens once.

type CopilotClientManager

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

CopilotClientManager manages the lifecycle of a Copilot SDK client. It wraps copilot.Client with azd-specific configuration and error handling.

func NewCopilotClientManager

func NewCopilotClientManager(options *CopilotClientOptions, cli *CopilotCLI) *CopilotClientManager

NewCopilotClientManager creates a new CopilotClientManager with the given options. If options is nil, defaults are used.

func (*CopilotClientManager) Client

func (m *CopilotClientManager) Client() *copilot.Client

Client returns the underlying copilot.Client for session creation.

func (*CopilotClientManager) GetAuthStatus

GetAuthStatus checks whether the user is authenticated with GitHub Copilot.

func (*CopilotClientManager) ListModels

func (m *CopilotClientManager) ListModels(ctx context.Context) ([]copilot.ModelInfo, error)

ListModels returns the list of available models from the Copilot service.

func (*CopilotClientManager) Start

func (m *CopilotClientManager) Start(ctx context.Context) error

Start initializes the Copilot SDK client and establishes a connection to the copilot-agent-runtime process.

func (*CopilotClientManager) State

State returns the current connection state of the client.

func (*CopilotClientManager) Stop

func (m *CopilotClientManager) Stop() error

Stop gracefully shuts down the Copilot SDK client and terminates the agent runtime process.

type CopilotClientOptions

type CopilotClientOptions struct {
	// LogLevel controls SDK logging verbosity (e.g., "info", "debug", "error").
	LogLevel string
	// CLIPath overrides the path to the Copilot CLI binary.
	// If empty, the managed CopilotCLI handles download and caching.
	CLIPath string
}

CopilotClientOptions configures the CopilotClientManager.

type SessionConfigBuilder

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

SessionConfigBuilder builds a copilot.SessionConfig from azd user configuration. It reads copilot.* config keys and merges MCP server configurations from built-in, extension, and user sources.

func NewSessionConfigBuilder

func NewSessionConfigBuilder(userConfigManager config.UserConfigManager) *SessionConfigBuilder

NewSessionConfigBuilder creates a new SessionConfigBuilder.

func (*SessionConfigBuilder) Build

func (b *SessionConfigBuilder) Build(
	ctx context.Context,
	builtInServers map[string]*mcp.ServerConfig,
) (*copilot.SessionConfig, error)

Build reads azd config and produces a copilot.SessionConfig. Built-in MCP servers from builtInServers are merged with user-configured servers.

Jump to

Keyboard shortcuts

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