tools

package
v0.1.45 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeSDKManifestURL   = sdk.NodeSDKManifestURL
	PythonSDKManifestURL = sdk.PythonSDKManifestURL
)

Variables

View Source
var ErrSetupAborted = errors.New("setup aborted")

ErrSetupAborted is a sentinel error for checking abort status

Functions

func AbortSetup

func AbortSetup(input json.RawMessage) (string, error)

AbortSetup handles graceful exit when setup cannot proceed This is used when the agent detects an unsupported project type

func FetchManifestFromURL

func FetchManifestFromURL(url string) (string, error)

FetchManifestFromURL fetches an SDK manifest from a URL Returns the raw JSON string

func GetManifestURLForProjectType added in v0.1.34

func GetManifestURLForProjectType(projectType string) string

GetManifestURLForProjectType returns the SDK manifest URL for a given project type. Returns empty string if no manifest URL is available for the project type.

Types

type AbortError

type AbortError struct {
	Reason      string
	ProjectType string
}

AbortError wraps ErrSetupAborted with the reason and detected project type

func (*AbortError) Error

func (e *AbortError) Error() string

func (*AbortError) Is

func (e *AbortError) Is(target error) bool

type ClientInfo added in v0.1.35

type ClientInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

ClientInfo represents a Tusk client/organization

type CloudLoginResult added in v0.1.35

type CloudLoginResult struct {
	Success    bool   `json:"success"`
	Email      string `json:"email"`
	UserId     string `json:"user_id"`
	Error      string `json:"error,omitempty"`
	NeedsLogin bool   `json:"needs_login"`
}

CloudLoginResult contains the result of a cloud login operation

type CloudTools added in v0.1.35

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

CloudTools provides cloud-related operations for the agent

func NewCloudTools added in v0.1.35

func NewCloudTools() *CloudTools

NewCloudTools creates a new CloudTools instance

func (*CloudTools) CheckApiKeyExists added in v0.1.35

func (ct *CloudTools) CheckApiKeyExists(input json.RawMessage) (string, error)

CheckApiKeyExists checks if the user already has an API key configured

func (*CloudTools) CheckAuth added in v0.1.35

func (ct *CloudTools) CheckAuth(input json.RawMessage) (string, error)

CheckAuth checks if the user is already authenticated

func (*CloudTools) CreateApiKey added in v0.1.35

func (ct *CloudTools) CreateApiKey(input json.RawMessage) (string, error)

CreateApiKey creates a new API key

func (*CloudTools) CreateObservableService added in v0.1.35

func (ct *CloudTools) CreateObservableService(input json.RawMessage) (string, error)

CreateObservableService creates a new observable service in Tusk Cloud

func (*CloudTools) DetectGitRepo added in v0.1.35

func (ct *CloudTools) DetectGitRepo(input json.RawMessage) (string, error)

DetectGitRepo detects the git repository information

func (*CloudTools) GetClients added in v0.1.35

func (ct *CloudTools) GetClients(input json.RawMessage) (string, error)

GetClients returns the list of organizations/clients the user belongs to

func (*CloudTools) GetCodeHostingAuthURL added in v0.1.35

func (ct *CloudTools) GetCodeHostingAuthURL(input json.RawMessage) (string, error)

GetCodeHostingAuthURL returns the URL for GitHub/GitLab app installation

func (*CloudTools) Login added in v0.1.35

func (ct *CloudTools) Login(input json.RawMessage) (string, error)

Login initiates the device code login flow - returns device code info for agent to display The agent should then call WaitForLogin to complete the authentication

func (*CloudTools) OpenBrowser added in v0.1.35

func (ct *CloudTools) OpenBrowser(input json.RawMessage) (string, error)

OpenBrowser opens a URL in the default browser

func (*CloudTools) SaveCloudConfig added in v0.1.35

func (ct *CloudTools) SaveCloudConfig(input json.RawMessage) (string, error)

SaveCloudConfig saves the cloud configuration to .tusk/config.yaml

func (*CloudTools) SelectClient added in v0.1.35

func (ct *CloudTools) SelectClient(input json.RawMessage) (string, error)

SelectClient saves the selected client to CLI config

func (*CloudTools) VerifyRepoAccess added in v0.1.35

func (ct *CloudTools) VerifyRepoAccess(input json.RawMessage) (string, error)

VerifyRepoAccess verifies that Tusk has access to the repository

func (*CloudTools) WaitForAuth added in v0.1.35

func (ct *CloudTools) WaitForAuth(input json.RawMessage) (string, error)

WaitForAuth waits for authentication to complete with polling This is called after opening the browser for device code flow

func (*CloudTools) WaitForLogin added in v0.1.35

func (ct *CloudTools) WaitForLogin(input json.RawMessage) (string, error)

WaitForLogin polls for the device code authentication to complete

type FilesystemTools

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

FilesystemTools provides file system operations

func NewFilesystemTools

func NewFilesystemTools(workDir string) *FilesystemTools

NewFilesystemTools creates a new FilesystemTools instance

func (*FilesystemTools) Grep

func (ft *FilesystemTools) Grep(input json.RawMessage) (string, error)

Grep searches for a pattern in files

func (*FilesystemTools) ListDirectory

func (ft *FilesystemTools) ListDirectory(input json.RawMessage) (string, error)

ListDirectory lists files and directories in a path

func (*FilesystemTools) PatchFile

func (ft *FilesystemTools) PatchFile(input json.RawMessage) (string, error)

PatchFile applies a targeted edit to a file

func (*FilesystemTools) ReadFile

func (ft *FilesystemTools) ReadFile(input json.RawMessage) (string, error)

ReadFile reads the contents of a file

func (*FilesystemTools) WriteFile

func (ft *FilesystemTools) WriteFile(input json.RawMessage) (string, error)

WriteFile writes content to a file

type HTTPTools

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

HTTPTools provides HTTP request operations

func NewHTTPTools

func NewHTTPTools() *HTTPTools

NewHTTPTools creates a new HTTPTools instance

func (*HTTPTools) Request

func (ht *HTTPTools) Request(input json.RawMessage) (string, error)

Request makes an HTTP request and returns the response

type LoginDeviceCodeResult added in v0.1.35

type LoginDeviceCodeResult struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURL string `json:"verification_url"`
	ExpiresIn       int    `json:"expires_in"`
	BrowserOpened   bool   `json:"browser_opened"`
}

LoginDeviceCodeResult contains the device code info for display

type ManagedProcess

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

ManagedProcess represents a background process

type ProcessManager

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

ProcessManager manages background processes

func NewProcessManager

func NewProcessManager(workDir string) *ProcessManager

NewProcessManager creates a new ProcessManager. Agent commands are not sandboxed - we rely on validateCommandSafety() for protection. Replay sandboxing (to detect uninstrumented packages) is handled by runner.createReplayFenceConfig().

func (*ProcessManager) StopAll

func (pm *ProcessManager) StopAll()

StopAll stops all managed processes and cleans up resources

type ProcessTools

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

ProcessTools provides process management operations

func NewProcessTools

func NewProcessTools(pm *ProcessManager, workDir string) *ProcessTools

NewProcessTools creates a new ProcessTools instance

func (*ProcessTools) GetLogs

func (pt *ProcessTools) GetLogs(input json.RawMessage) (string, error)

GetLogs returns recent logs from a background process

func (*ProcessTools) RunCommand

func (pt *ProcessTools) RunCommand(input json.RawMessage) (string, error)

RunCommand executes a command and waits for completion

func (*ProcessTools) StartBackground

func (pt *ProcessTools) StartBackground(input json.RawMessage) (string, error)

StartBackground starts a process in the background. Note: This is NOT sandboxed because it's used for: - "Confirm App Starts" phase (needs real DB connections) - "Record" mode (needs real outbound calls to capture behavior) Replay mode sandboxing is handled by the runner package, not here.

func (*ProcessTools) StopBackground

func (pt *ProcessTools) StopBackground(input json.RawMessage) (string, error)

StopBackground stops a background process

func (*ProcessTools) WaitForReady

func (pt *ProcessTools) WaitForReady(input json.RawMessage) (string, error)

WaitForReady polls a URL until it responds successfully

type RingBuffer

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

RingBuffer keeps the last N lines

func NewRingBuffer

func NewRingBuffer(size int) *RingBuffer

NewRingBuffer creates a new ring buffer

func (*RingBuffer) All

func (rb *RingBuffer) All() []string

All returns all lines

func (*RingBuffer) Lines

func (rb *RingBuffer) Lines(n int) []string

Lines returns the last n lines

func (*RingBuffer) Write

func (rb *RingBuffer) Write(line string)

Write adds a line to the buffer

type TuskTools

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

TuskTools provides Tusk CLI operations using internal runner package

func NewTuskTools

func NewTuskTools(workDir string) *TuskTools

NewTuskTools creates a new TuskTools instance

func (*TuskTools) List

func (tt *TuskTools) List(input json.RawMessage) (string, error)

List loads and lists traces from the .tusk/traces directory

func (*TuskTools) Run

func (tt *TuskTools) Run(input json.RawMessage) (string, error)

Run runs tests using the internal runner

func (*TuskTools) ValidateConfig added in v0.1.44

func (tt *TuskTools) ValidateConfig(input json.RawMessage) (string, error)

ValidateConfig validates the .tusk/config.yaml file and returns detailed results. This should be called after creating or modifying the config to catch errors early.

type UserTools

type UserTools struct{}

UserTools provides user interaction operations

func NewUserTools

func NewUserTools() *UserTools

NewUserTools creates a new UserTools instance

func (*UserTools) Ask

func (ut *UserTools) Ask(input json.RawMessage) (string, error)

Ask prompts the user with a question and returns their response

Jump to

Keyboard shortcuts

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