Help us shape the future of Go! Take the 2026 Go Developer Survey

media

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToolViewImage   = "view_image"
	ToolFilePublish = "file_publish"
)

Variables

This section is empty.

Functions

func InputSchema added in v0.8.2

func InputSchema(name string) (map[string]any, bool)

func OutputSchema added in v0.8.2

func OutputSchema(name string) (map[string]any, bool)

Types

type CommandEnv

type CommandEnv func(extra map[string]string) ([]string, error)

type ControlPath

type ControlPath struct {
	Abs     string
	Display string
}

type CropRequest added in v0.8.2

type CropRequest struct {
	X      int `json:"x,omitempty"`
	Y      int `json:"y,omitempty"`
	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`
}

CropRequest 是 view_image 的可选裁剪矩形。

type FilePublishRequest added in v0.8.2

type FilePublishRequest struct {
	File             any    `json:"file,omitempty"`
	Path             string `json:"path,omitempty"`
	RetentionSeconds *int   `json:"retention_seconds,omitempty"`
}

FilePublishRequest.File 是 connector 文件重写产生的动态叶子;Path 是普通本地路径入口。

type Result

type Result = toolcore.Result

type Service

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

func New

func New(cfg config.Config, ws *workspace.Workspace, commandEnv CommandEnv) *Service

func (*Service) FilePublish

func (s *Service) FilePublish(ctx context.Context, request FilePublishRequest) (Result, error)

func (*Service) PublishBrowserScreenshot added in v0.7.4

func (s *Service) PublishBrowserScreenshot(ctx context.Context, png []byte, retentionSeconds int) (map[string]any, error)

PublishBrowserScreenshot 只负责把 Go CDP Service 返回的 PNG 发布为现有 Artifact。 浏览器包因此无需了解公开 URL、签名或媒体存储实现。

func (*Service) ViewImage

func (s *Service) ViewImage(ctx context.Context, request ViewImageRequest) (Result, error)

type ToolError

type ToolError = toolcore.ToolError

type ViewImageRequest added in v0.8.2

type ViewImageRequest struct {
	ArtifactID      string       `json:"artifact_id,omitempty"`
	Path            string       `json:"path,omitempty"`
	URL             string       `json:"url,omitempty"`
	MaxSourceBytes  *int         `json:"max_source_bytes,omitempty"`
	SourceTimeoutMS *int         `json:"source_timeout_ms,omitempty"`
	MaxBytes        *int         `json:"max_bytes,omitempty"`
	MaxWidth        *int         `json:"max_width,omitempty"`
	MaxHeight       *int         `json:"max_height,omitempty"`
	AutoResize      *bool        `json:"auto_resize,omitempty"`
	Format          string       `json:"format,omitempty"`
	Quality         *int         `json:"quality,omitempty"`
	Crop            *CropRequest `json:"crop,omitempty"`
}

ViewImageRequest 是 view_image 进入媒体 capability 后的稳定输入契约。

Jump to

Keyboard shortcuts

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