Documentation
¶
Index ¶
- func NewFileService() agentdomain.FileService
- type BaseFormatter
- func (f BaseFormatter) FormatAsJSON(data any) string
- func (f BaseFormatter) FormatDuration(result *agentdomain.ToolExecutionResult) string
- func (f BaseFormatter) FormatExpanded(result *agentdomain.ToolExecutionResult, dataContent string) string
- func (f BaseFormatter) FormatStatusIcon(success bool) string
- func (f BaseFormatter) FormatToolCall(args map[string]any, expanded bool) string
- func (f BaseFormatter) GetDomainFromURL(url string) string
- func (f BaseFormatter) GetFileName(path string) string
- func (f BaseFormatter) ShouldCollapseArg(key string) bool
- func (f BaseFormatter) TruncateText(text string, maxLength int) string
- type CustomFormatter
- type DirectoryFrameSource
- type FileService
- type ImageService
- func (s *ImageService) CreateImageVariation(ctx context.Context, model, imagePath, size string) (string, error)
- func (s *ImageService) EditImage(ctx context.Context, model, prompt, imagePath, quality, size, maskPath string) (string, error)
- func (s *ImageService) GenerateImage(ctx context.Context, model, prompt, quality, size string) (string, error)
- func (s *ImageService) IsImageFile(filePath string) bool
- func (s *ImageService) ReadImageFromBinary(imageData []byte, filename string) (*agentdomain.ImageAttachment, error)
- func (s *ImageService) ReadImageFromFile(filePath string) (*agentdomain.ImageAttachment, error)
- func (s *ImageService) ReadImageFromURL(imageURL string) (*agentdomain.ImageAttachment, error)
- type MusicService
- type SFXService
- type SpeechService
- type VideoService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFileService ¶ added in v0.178.1
func NewFileService() agentdomain.FileService
NewFileService creates a new file service
Types ¶
type BaseFormatter ¶
type BaseFormatter struct {
// contains filtered or unexported fields
}
BaseFormatter provides common formatting functionality that tools can embed
func NewBaseFormatter ¶
func NewBaseFormatter(toolName string) BaseFormatter
NewBaseFormatter creates a new base formatter for a tool
func (BaseFormatter) FormatAsJSON ¶
func (f BaseFormatter) FormatAsJSON(data any) string
FormatAsJSON formats data as JSON if possible, falls back to string representation
func (BaseFormatter) FormatDuration ¶
func (f BaseFormatter) FormatDuration(result *agentdomain.ToolExecutionResult) string
FormatDuration formats a duration for display in a human-friendly way
func (BaseFormatter) FormatExpanded ¶
func (f BaseFormatter) FormatExpanded(result *agentdomain.ToolExecutionResult, dataContent string) string
FormatExpanded renders the full expanded result as a single native lipgloss/tree, replacing the hand-drawn ├─/└─ connectors that used to live across three methods. dataContent is the tool-specific result body (may be ""). Output is plain: the UI wraps and themes it (services.themeTreeLines); LLM / headless consume it as-is.
func (BaseFormatter) FormatStatusIcon ¶
func (f BaseFormatter) FormatStatusIcon(success bool) string
FormatStatusIcon returns just the status icon
func (BaseFormatter) FormatToolCall ¶
func (f BaseFormatter) FormatToolCall(args map[string]any, expanded bool) string
FormatToolCall formats a tool call for consistent display
func (BaseFormatter) GetDomainFromURL ¶
func (f BaseFormatter) GetDomainFromURL(url string) string
GetDomainFromURL extracts domain from URL
func (BaseFormatter) GetFileName ¶
func (f BaseFormatter) GetFileName(path string) string
GetFileName extracts filename from a path
func (BaseFormatter) ShouldCollapseArg ¶
func (f BaseFormatter) ShouldCollapseArg(key string) bool
ShouldCollapseArg provides default collapse behavior (can be overridden by tools)
func (BaseFormatter) TruncateText ¶
func (f BaseFormatter) TruncateText(text string, maxLength int) string
TruncateText truncates text to specified length with ellipsis
type CustomFormatter ¶
type CustomFormatter struct {
BaseFormatter
// contains filtered or unexported fields
}
CustomFormatter extends BaseFormatter with customizable collapse behavior
func NewCustomFormatter ¶
func NewCustomFormatter(toolName string, collapseFunc func(string) bool) CustomFormatter
NewCustomFormatter creates a formatter with custom collapse logic
func (CustomFormatter) FormatExpanded ¶
func (f CustomFormatter) FormatExpanded(result *agentdomain.ToolExecutionResult, dataContent string) string
FormatExpanded renders the expanded tree using the custom collapse behavior.
func (CustomFormatter) FormatToolCall ¶
func (f CustomFormatter) FormatToolCall(args map[string]any, expanded bool) string
FormatToolCall overrides BaseFormatter to use custom collapse logic
func (CustomFormatter) ShouldCollapseArg ¶
func (f CustomFormatter) ShouldCollapseArg(key string) bool
ShouldCollapseArg uses the custom collapse function if provided
type DirectoryFrameSource ¶ added in v0.178.1
type DirectoryFrameSource struct {
// contains filtered or unexported fields
}
DirectoryFrameSource serves the newest image file under a configured directory - the integration surface for camera daemons and anything else that drops frames on disk. An optional retention sweep (max_files/max_age) runs after each read; omit retention when the producer manages cleanup.
func NewDirectoryFrameSource ¶ added in v0.178.1
func NewDirectoryFrameSource(name string, cfg config.VisionSourceConfig, images agentdomain.ImageService) *DirectoryFrameSource
NewDirectoryFrameSource creates a frame source over cfg.Path. The retention max_age was validated at config load, so a parse failure here means zero (no age limit).
func (*DirectoryFrameSource) GetLatestFrame ¶ added in v0.178.1
func (d *DirectoryFrameSource) GetLatestFrame() (*agentdomain.Frame, error)
GetLatestFrame returns the newest image file in the directory by mtime.
type FileService ¶ added in v0.207.0
type FileService struct{}
FileService implements agentdomain.FileService
func (*FileService) ListProjectFiles ¶ added in v0.207.0
func (s *FileService) ListProjectFiles() ([]string, error)
ListProjectFiles returns the files under the current directory, followed by the user's ~/.infer files (as "~/.infer/<path>").
func (*FileService) ReadFile ¶ added in v0.207.0
func (s *FileService) ReadFile(path string) (string, error)
ReadFile reads the content of a file
func (*FileService) ValidateFile ¶ added in v0.207.0
func (s *FileService) ValidateFile(path string) error
ValidateFile checks if a file path is valid and accessible
type ImageService ¶ added in v0.178.1
type ImageService struct {
// contains filtered or unexported fields
}
ImageService handles image operations including file-based image loading and base64 encoding Note: Direct clipboard support requires platform-specific dependencies and is not yet implemented
func NewImageService ¶ added in v0.178.1
func NewImageService(cfg *config.Config, client sdk.Client) *ImageService
NewImageService creates a new image service
func (*ImageService) CreateImageVariation ¶ added in v0.178.1
func (s *ImageService) CreateImageVariation(ctx context.Context, model, imagePath, size string) (string, error)
CreateImageVariation creates a variation of the image at imagePath using model ("provider/name") and returns the path of the saved PNG. A blank size is omitted from the request, leaving the provider's own default.
func (*ImageService) EditImage ¶ added in v0.178.1
func (s *ImageService) EditImage(ctx context.Context, model, prompt, imagePath, quality, size, maskPath string) (string, error)
EditImage edits the image at imagePath using prompt and model ("provider/name") and returns the path of the saved PNG. A blank quality or size is omitted from the request, leaving the provider's own default. A non-empty maskPath points to a PNG whose transparent (alpha=0) areas mark the editable region; all other pixels are preserved exactly.
func (*ImageService) GenerateImage ¶ added in v0.178.1
func (s *ImageService) GenerateImage(ctx context.Context, model, prompt, quality, size string) (string, error)
GenerateImage generates an image from prompt using model ("provider/name") and returns the path of the saved PNG. A blank quality or size is omitted from the request, leaving the provider's own default.
func (*ImageService) IsImageFile ¶ added in v0.178.1
func (s *ImageService) IsImageFile(filePath string) bool
IsImageFile checks if a file is a supported image format
func (*ImageService) ReadImageFromBinary ¶ added in v0.178.1
func (s *ImageService) ReadImageFromBinary(imageData []byte, filename string) (*agentdomain.ImageAttachment, error)
ReadImageFromBinary reads an image from binary data and returns it as a base64 attachment
func (*ImageService) ReadImageFromFile ¶ added in v0.178.1
func (s *ImageService) ReadImageFromFile(filePath string) (*agentdomain.ImageAttachment, error)
ReadImageFromFile reads an image from a file path and returns it as a base64 attachment
func (*ImageService) ReadImageFromURL ¶ added in v0.178.1
func (s *ImageService) ReadImageFromURL(imageURL string) (*agentdomain.ImageAttachment, error)
ReadImageFromURL fetches an image from a URL and returns it as a base64 attachment. URLs reach this from untrusted sources (LLM tool arguments), so only http(s) to public addresses is allowed.
type MusicService ¶ added in v0.206.0
type MusicService struct {
// contains filtered or unexported fields
}
MusicService composes music clips through the gateway's Music API (POST /v1/audio/music), so requests show up in gateway logs and traces. It implements agentdomain.MusicService.
func NewMusicService ¶ added in v0.206.0
func NewMusicService(cfg *config.Config, client sdk.Client) *MusicService
NewMusicService creates a new gateway-backed music service.
func (*MusicService) Compose ¶ added in v0.206.0
func (s *MusicService) Compose(ctx context.Context, prompt, outPath string, seconds *float32, instrumental *bool) error
Compose generates a music clip for prompt using the configured text_to_music.model ("provider/model"), writing MP3 audio to outPath (the gateway music providers serve mp3; WAV is not offered by elevenlabs). A non-nil seconds caps the clip length; a non-nil instrumental requests a clip without vocals. Errors name the configured model so a gateway without the endpoint (or a provider that rejects it) is diagnosable.
type SFXService ¶ added in v0.206.0
type SFXService struct {
// contains filtered or unexported fields
}
SFXService generates sound effects through the gateway's SFX API (POST /v1/audio/sfx), so requests show up in gateway logs and traces. It implements agentdomain.SoundEffectService.
func NewSFXService ¶ added in v0.206.0
func NewSFXService(cfg *config.Config, client sdk.Client) *SFXService
NewSFXService creates a new gateway-backed sound-effect service.
func (*SFXService) Generate ¶ added in v0.206.0
func (s *SFXService) Generate(ctx context.Context, prompt, outPath string, seconds *float32, loop *bool) error
Generate produces a sound effect for prompt using the configured text_to_sfx.model ("provider/model"), writing MP3 audio to outPath. A non-nil seconds caps the clip length; a non-nil loop requests a seamless loop. Errors name the configured model so a gateway without the endpoint (or a provider that rejects it) is diagnosable.
type SpeechService ¶ added in v0.186.0
type SpeechService struct {
// contains filtered or unexported fields
}
SpeechService synthesizes speech through the gateway's Audio API (POST /v1/audio/speech), so requests show up in gateway logs and traces. It implements agentdomain.SpeechService.
func NewSpeechService ¶ added in v0.186.0
func NewSpeechService(cfg *config.Config, client sdk.Client) *SpeechService
NewSpeechService creates a new gateway-backed speech service.
func (*SpeechService) Synthesize ¶ added in v0.186.0
func (s *SpeechService) Synthesize(ctx context.Context, text, voiceSamplePath, outPath string) error
Synthesize generates speech for text using the configured text_to_speech.model ("provider/model") and voice, writing WAV audio to outPath. A non-empty voiceSamplePath is sent as a reference sample for zero-shot voice cloning on providers that support it.
type VideoService ¶ added in v0.206.0
type VideoService struct {
// contains filtered or unexported fields
}
VideoService renders video clips through the gateway's Videos API (POST /v1/videos, GET /v1/videos/{id}, GET /v1/videos/{id}/content), so requests show up in gateway logs and traces. It implements agentdomain.VideoService.
func NewVideoService ¶ added in v0.206.0
func NewVideoService(cfg *config.Config, client sdk.Client) *VideoService
NewVideoService creates a new gateway-backed video service.
func (*VideoService) Render ¶ added in v0.206.0
func (s *VideoService) Render(ctx context.Context, request agentdomain.VideoRequest, outPath string) error
Render creates the video job for request, polls it until it completes and writes the downloaded MP4 content to outPath. An avatar request (audio set) is a lip-synced talking clip rendered with text_to_video.avatar_model; any other request is rendered with text_to_video.model. Errors name the configured model so a gateway without the endpoint (or a provider that rejects it) is diagnosable.