Documentation
¶
Index ¶
- func CLIPath() string
- func GetFinalAssistantMessage(session *copilot.Session, timeout time.Duration) (*copilot.SessionEvent, error)
- type CapiProxy
- func (p *CapiProxy) Configure(filePath, workDir string) error
- func (p *CapiProxy) GetExchanges() ([]ParsedHttpExchange, error)
- func (p *CapiProxy) Start() (string, error)
- func (p *CapiProxy) Stop() error
- func (p *CapiProxy) StopWithOptions(skipWritingCache bool) error
- func (p *CapiProxy) URL() string
- type ChatCompletionChoice
- type ChatCompletionMessage
- type ChatCompletionRequest
- type ChatCompletionResponse
- type ChatCompletionTool
- type ChatCompletionToolFunction
- type FunctionCall
- type Message
- type ParsedHttpExchange
- type TestContext
- type ToolCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLIPath ¶
func CLIPath() string
CLIPath returns the path to the Copilot CLI, discovering it once and caching.
func GetFinalAssistantMessage ¶
func GetFinalAssistantMessage(session *copilot.Session, timeout time.Duration) (*copilot.SessionEvent, error)
GetFinalAssistantMessage waits for and returns the final assistant message from a session turn.
Types ¶
type CapiProxy ¶
type CapiProxy struct {
// contains filtered or unexported fields
}
CapiProxy manages a child process that acts as a replaying proxy to AI endpoints. It spawns the shared test harness server from test/harness/server.ts.
func (*CapiProxy) GetExchanges ¶
func (p *CapiProxy) GetExchanges() ([]ParsedHttpExchange, error)
GetExchanges retrieves the captured HTTP exchanges from the proxy.
func (*CapiProxy) StopWithOptions ¶
StopWithOptions gracefully shuts down the proxy server. If skipWritingCache is true, the proxy won't write captured exchanges to disk.
type ChatCompletionChoice ¶
type ChatCompletionChoice struct {
Index int `json:"index"`
Message ChatCompletionMessage `json:"message"`
FinishReason string `json:"finish_reason"`
}
ChatCompletionChoice represents a choice in the response.
type ChatCompletionMessage ¶
type ChatCompletionMessage struct {
Role string `json:"role"`
Content string `json:"content,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
}
ChatCompletionMessage represents a message in the chat completion request.
type ChatCompletionRequest ¶
type ChatCompletionRequest struct {
Model string `json:"model"`
Messages []ChatCompletionMessage `json:"messages"`
Tools []ChatCompletionTool `json:"tools,omitempty"`
}
ChatCompletionRequest represents an OpenAI chat completion request.
type ChatCompletionResponse ¶
type ChatCompletionResponse struct {
ID string `json:"id"`
Model string `json:"model"`
Choices []ChatCompletionChoice `json:"choices"`
}
ChatCompletionResponse represents an OpenAI chat completion response.
type ChatCompletionTool ¶
type ChatCompletionTool struct {
Type string `json:"type"`
Function ChatCompletionToolFunction `json:"function"`
}
ChatCompletionTool represents a tool in the chat completion request.
type ChatCompletionToolFunction ¶
type ChatCompletionToolFunction struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
ChatCompletionToolFunction represents a function tool.
type FunctionCall ¶
FunctionCall represents the function details in a tool call.
type Message ¶
type Message = ChatCompletionMessage
Message is an alias for ChatCompletionMessage for test convenience.
type ParsedHttpExchange ¶
type ParsedHttpExchange struct {
Request ChatCompletionRequest `json:"request"`
Response *ChatCompletionResponse `json:"response,omitempty"`
}
ParsedHttpExchange represents a captured HTTP exchange.
type TestContext ¶
type TestContext struct {
CLIPath string
HomeDir string
WorkDir string
ProxyURL string
// contains filtered or unexported fields
}
TestContext holds shared resources for E2E tests.
func NewTestContext ¶
func NewTestContext(t *testing.T) *TestContext
NewTestContext creates a new test context with isolated directories and a replaying proxy.
func (*TestContext) Close ¶
func (c *TestContext) Close(testFailed bool)
Close cleans up the test context resources.
func (*TestContext) ConfigureForTest ¶
func (c *TestContext) ConfigureForTest(t *testing.T)
ConfigureForTest configures the proxy for a specific subtest. Call this at the start of each t.Run subtest.
func (*TestContext) Env ¶
func (c *TestContext) Env() []string
Env returns environment variables configured for isolated testing.
func (*TestContext) GetExchanges ¶
func (c *TestContext) GetExchanges() ([]ParsedHttpExchange, error)
GetExchanges retrieves the captured HTTP exchanges from the proxy.
func (*TestContext) NewClient ¶
func (c *TestContext) NewClient() *copilot.Client
NewClient creates a CopilotClient configured for this test context.
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type"`
Function FunctionCall `json:"function"`
}
ToolCall represents a tool call in an assistant message.