adapter

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BridgeEvaluate added in v0.5.0

func BridgeEvaluate(script string) (any, error)

BridgeEvaluate executes JavaScript in the browser via the extension bridge.

func BridgeNavigate added in v0.5.0

func BridgeNavigate(url string) error

BridgeNavigate opens a URL in the browser via the extension bridge.

func BridgeScreenshot added in v0.7.0

func BridgeScreenshot() (string, error)

BridgeScreenshot captures a screenshot of the current browser tab via the extension bridge. Returns the base64-encoded PNG data.

func BridgeStatus added in v0.5.0

func BridgeStatus() (connected bool, version string)

BridgeStatus checks if the AnyClaw browser extension is connected.

func EnsureDaemon added in v0.5.0

func EnsureDaemon()

EnsureDaemon starts the daemon if it's not already running.

func ReadDaemonPID added in v0.5.0

func ReadDaemonPID() int

ReadDaemonPID reads the saved daemon PID.

func RemoveDaemonPID added in v0.5.0

func RemoveDaemonPID()

RemoveDaemonPID removes the PID file.

func WriteDaemonPID added in v0.5.0

func WriteDaemonPID(pid int)

WriteDaemonPID saves daemon PID to a file for management.

Types

type Adapter

type Adapter interface {
	Execute(ctx context.Context, cmd *pkg.Command, params map[string]any, packageDir string) (*Result, error)
}

Adapter executes a command with given parameters.

func New

func New(adapterType string) (Adapter, error)

New creates an adapter based on the manifest's adapter type.

type CLIAdapter

type CLIAdapter struct{}

CLIAdapter executes commands by shelling out to CLI tools.

func (*CLIAdapter) Execute

func (a *CLIAdapter) Execute(ctx context.Context, cmd *pkg.Command, params map[string]any, packageDir string) (*Result, error)

type Daemon added in v0.5.0

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

Daemon bridges the browser extension (WebSocket) and CLI commands (HTTP). Bridges the AnyClaw browser extension and CLI commands.

func NewDaemon added in v0.5.0

func NewDaemon(port int) *Daemon

NewDaemon creates a daemon on the given port.

func (*Daemon) Start added in v0.5.0

func (d *Daemon) Start() error

Start starts the daemon HTTP/WebSocket server.

type OpenAPIAdapter

type OpenAPIAdapter struct{}

OpenAPIAdapter executes commands via HTTP API calls.

func (*OpenAPIAdapter) Execute

func (a *OpenAPIAdapter) Execute(ctx context.Context, cmd *pkg.Command, params map[string]any, packageDir string) (*Result, error)

type PipelineAdapter

type PipelineAdapter struct{}

PipelineAdapter executes YAML pipelines.

func (*PipelineAdapter) Execute

func (a *PipelineAdapter) Execute(ctx context.Context, cmd *pkg.Command, params map[string]any, packageDir string) (*Result, error)

type Result

type Result struct {
	Content string         // human-readable text
	Data    map[string]any // structured data (optional)
}

Result holds the output of a command execution.

type ScriptAdapter

type ScriptAdapter struct{}

ScriptAdapter executes commands by running Python or Node scripts. Convention: script reads JSON params from stdin, writes result to stdout.

func (*ScriptAdapter) Execute

func (a *ScriptAdapter) Execute(ctx context.Context, cmd *pkg.Command, params map[string]any, packageDir string) (*Result, error)

Jump to

Keyboard shortcuts

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