adapters

package
v0.100.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClaudeCodeClient added in v0.100.0

func NewClaudeCodeClient(cfg *config.ClaudeCodeConfig, stateManager domain.StateManager) domain.SDKClient

NewClaudeCodeClient creates a new Claude Code CLI client

func NewSDKClientAdapter added in v0.99.0

func NewSDKClientAdapter(client sdk.Client) domain.SDKClient

NewSDKClientAdapter creates a new SDK client adapter

Types

type AssistantMessage added in v0.100.0

type AssistantMessage struct {
	Content []ContentBlock `json:"content"`
	Role    string         `json:"role"`
}

AssistantMessage represents the structure of an assistant message from Claude CLI

type ClaudeCodeClient added in v0.100.0

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

ClaudeCodeClient is a wrapper around the official Claude Code CLI It implements the SDKClient interface by spawning the claude process

func (*ClaudeCodeClient) GenerateContent added in v0.100.0

func (c *ClaudeCodeClient) GenerateContent(
	ctx context.Context,
	provider sdk.Provider,
	model string,
	messages []sdk.Message,
) (*sdk.CreateChatCompletionResponse, error)

GenerateContent makes a non-streaming request to Claude Code CLI

func (*ClaudeCodeClient) GenerateContentStream added in v0.100.0

func (c *ClaudeCodeClient) GenerateContentStream(
	ctx context.Context,
	provider sdk.Provider,
	model string,
	messages []sdk.Message,
) (<-chan sdk.SSEvent, error)

GenerateContentStream makes a streaming request to Claude Code CLI

func (*ClaudeCodeClient) Wait added in v0.100.0

func (c *ClaudeCodeClient) Wait()

Wait blocks until all background goroutines have completed This should be called during shutdown to ensure clean resource cleanup

func (*ClaudeCodeClient) WithMiddlewareOptions added in v0.100.0

func (c *ClaudeCodeClient) WithMiddlewareOptions(opts *sdk.MiddlewareOptions) domain.SDKClient

WithMiddlewareOptions sets middleware options (not used in Claude Code mode)

func (*ClaudeCodeClient) WithOptions added in v0.100.0

WithOptions sets the chat completion request options

func (*ClaudeCodeClient) WithTools added in v0.100.0

func (c *ClaudeCodeClient) WithTools(tools *[]sdk.ChatCompletionTool) domain.SDKClient

WithTools sets the tools for the chat completion

type ClaudeCodeMessage added in v0.100.0

type ClaudeCodeMessage struct {
	Type      string          `json:"type"`
	Subtype   string          `json:"subtype,omitempty"`
	Message   json.RawMessage `json:"message,omitempty"`
	SessionID string          `json:"session_id,omitempty"`

	// Result fields
	TotalCostUSD float64 `json:"total_cost_usd,omitempty"`
	IsError      bool    `json:"is_error,omitempty"`
	DurationMS   int     `json:"duration_ms,omitempty"`
	NumTurns     int     `json:"num_turns,omitempty"`
}

ClaudeCodeMessage represents a message from the Claude CLI JSON output

type ContentBlock added in v0.100.0

type ContentBlock struct {
	Type     string          `json:"type"`
	Text     string          `json:"text,omitempty"`
	Thinking string          `json:"thinking,omitempty"`
	ID       string          `json:"id,omitempty"`    // For tool_use
	Name     string          `json:"name,omitempty"`  // For tool_use
	Input    json.RawMessage `json:"input,omitempty"` // For tool_use
}

ContentBlock represents a content block in the assistant message

type PersistentConversationAdapter

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

PersistentConversationAdapter adapts services.PersistentConversationRepository to shortcuts.PersistentConversationRepository

func NewPersistentConversationAdapter

func NewPersistentConversationAdapter(repo *services.PersistentConversationRepository) *PersistentConversationAdapter

NewPersistentConversationAdapter creates a new adapter

func (*PersistentConversationAdapter) DeleteSavedConversation

func (a *PersistentConversationAdapter) DeleteSavedConversation(ctx context.Context, conversationID string) error

DeleteSavedConversation delegates to the underlying repository

func (*PersistentConversationAdapter) GetCurrentConversationID

func (a *PersistentConversationAdapter) GetCurrentConversationID() string

GetCurrentConversationID delegates to the underlying repository

func (*PersistentConversationAdapter) GetCurrentConversationMetadata

func (a *PersistentConversationAdapter) GetCurrentConversationMetadata() shortcuts.ConversationMetadata

GetCurrentConversationMetadata adapts the method to return shortcuts.ConversationMetadata

func (*PersistentConversationAdapter) ListSavedConversations

func (a *PersistentConversationAdapter) ListSavedConversations(ctx context.Context, limit, offset int) ([]shortcuts.ConversationSummary, error)

ListSavedConversations adapts the method to return shortcuts.ConversationSummary

func (*PersistentConversationAdapter) LoadConversation

func (a *PersistentConversationAdapter) LoadConversation(ctx context.Context, conversationID string) error

LoadConversation delegates to the underlying repository

func (*PersistentConversationAdapter) SaveConversation

func (a *PersistentConversationAdapter) SaveConversation(ctx context.Context) error

SaveConversation delegates to the underlying repository

func (*PersistentConversationAdapter) SetConversationTitle

func (a *PersistentConversationAdapter) SetConversationTitle(title string)

SetConversationTitle delegates to the underlying repository

func (*PersistentConversationAdapter) StartNewConversation

func (a *PersistentConversationAdapter) StartNewConversation(title string) error

StartNewConversation delegates to the underlying repository

type SDKClientAdapter added in v0.99.0

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

SDKClientAdapter adapts sdk.Client to domain.SDKClient interface

func (*SDKClientAdapter) GenerateContent added in v0.99.0

func (a *SDKClientAdapter) GenerateContent(ctx context.Context, provider sdk.Provider, model string, messages []sdk.Message) (*sdk.CreateChatCompletionResponse, error)

GenerateContent wraps the SDK client's GenerateContent method

func (*SDKClientAdapter) GenerateContentStream added in v0.99.0

func (a *SDKClientAdapter) GenerateContentStream(ctx context.Context, provider sdk.Provider, model string, messages []sdk.Message) (<-chan sdk.SSEvent, error)

GenerateContentStream wraps the SDK client's GenerateContentStream method

func (*SDKClientAdapter) WithMiddlewareOptions added in v0.99.0

func (a *SDKClientAdapter) WithMiddlewareOptions(opts *sdk.MiddlewareOptions) domain.SDKClient

WithMiddlewareOptions wraps the SDK client's WithMiddlewareOptions method

func (*SDKClientAdapter) WithOptions added in v0.99.0

WithOptions wraps the SDK client's WithOptions method

func (*SDKClientAdapter) WithTools added in v0.99.0

func (a *SDKClientAdapter) WithTools(tools *[]sdk.ChatCompletionTool) domain.SDKClient

WithTools wraps the SDK client's WithTools method

type ToolResultContent added in v0.100.0

type ToolResultContent struct {
	Type      string `json:"type"`
	ToolUseID string `json:"tool_use_id"`
	Content   string `json:"content"`
}

ToolResultContent represents a tool result in the message

type ToolResultMessage added in v0.100.0

type ToolResultMessage struct {
	Role    string              `json:"role"`
	Content []ToolResultContent `json:"content"`
}

ToolResultMessage represents a user message containing tool results

Jump to

Keyboard shortcuts

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