imagetool

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageTool added in v0.7.0

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

ImageTool is an instance-owned image tool runner. It centralizes path resolution and sandbox policy:

  • workBaseDir: base for resolving relative paths
  • allowedRoots: optional restriction; if empty/nil, allow all

func NewImageTool added in v0.7.0

func NewImageTool(opts ...ImageToolOption) (*ImageTool, error)

func (*ImageTool) ReadImage added in v0.7.0

func (it *ImageTool) ReadImage(ctx context.Context, args ReadImageArgs) (*ReadImageOut, error)

func (*ImageTool) ReadImageTool added in v0.7.0

func (it *ImageTool) ReadImageTool() spec.Tool

func (*ImageTool) Tools added in v0.7.0

func (it *ImageTool) Tools() []spec.Tool

type ImageToolOption added in v0.7.0

type ImageToolOption func(*ImageTool) error

func WithAllowedRoots added in v0.7.0

func WithAllowedRoots(roots []string) ImageToolOption

func WithWorkBaseDir added in v0.7.0

func WithWorkBaseDir(base string) ImageToolOption

type ReadImageArgs added in v0.3.0

type ReadImageArgs struct {
	Path              string `json:"path"`
	IncludeBase64Data bool   `json:"includeBase64Data"`
}

type ReadImageOut added in v0.3.0

type ReadImageOut struct {
	Path      string     `json:"path"`
	Name      string     `json:"name"`
	Exists    bool       `json:"exists"`
	SizeBytes int64      `json:"sizeBytes,omitempty"`
	ModTime   *time.Time `json:"modTime,omitempty"`

	Width    int    `json:"width,omitempty"`
	Height   int    `json:"height,omitempty"`
	Format   string `json:"format,omitempty"`   // "png", "jpeg", ...
	MIMEType string `json:"mimeType,omitempty"` // "image/png", ...

	// Optional content.
	Base64Data string `json:"base64Data,omitempty"`
}

Jump to

Keyboard shortcuts

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