copilot

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolvePendingTool added in v0.4.0

func ResolvePendingTool(ctx context.Context, session *copilot.Session, requestID, result string) error

ResolvePendingTool delivers a result for a pending external tool call on a live session. A declaration-only tool (nil handler) leaves the model's call pending — surfaced as a *copilot.ExternalToolRequestedData carrying a RequestID — instead of running a handler. Calling this resolves that exact pending call from outside any handler, letting the original agent loop continue to its final answer. This is the mechanism behind faithful OpenAI tool round-trips ("session parking"): the turn-1 session is kept alive and its pending call is resolved on turn-2 with the client-supplied result.

requestID comes from the ExternalToolRequestedData event captured on turn-1.

Types

type Client

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

Client wraps the Copilot SDK client with lifecycle management.

func NewClient

func NewClient(cliPath string, githubToken string, logger *slog.Logger) *Client

NewClient creates a new Copilot SDK client wrapper.

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, cfg *copilot.SessionConfig) (*copilot.Session, error)

CreateSession creates a new Copilot session with the given configuration.

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context) ([]copilot.ModelInfo, error)

ListModels returns the available models from the Copilot CLI.

func (*Client) NewChatSession added in v0.2.0

func (c *Client) NewChatSession(ctx context.Context, model, systemMessage string, streaming bool) (*copilot.Session, error)

NewChatSession creates a new Copilot chat session with common defaults. This is a convenience method that both OpenAI and Ollama handlers can use without depending on each other's types.

func (*Client) NewChatSessionWithTools added in v0.4.0

func (c *Client) NewChatSessionWithTools(ctx context.Context, model, systemMessage string, streaming bool, tools []copilot.Tool) (*copilot.Session, error)

NewChatSessionWithTools is like NewChatSession but also exposes caller-defined tools to the model. When tools is non-empty, only those tools are made available (built-in agentic tools stay disabled); when it is empty the behavior is identical to NewChatSession.

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

Start starts the underlying Copilot CLI server.

func (*Client) Stop

func (c *Client) Stop()

Stop stops the underlying Copilot CLI server.

Jump to

Keyboard shortcuts

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