windsurf

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentName   = agent.AgentWindsurf
	DisplayName = agent.DisplayWindsurf
)

Variables

View Source
var HookTypeMapping = map[string]events.ActionType{
	"pre_read_code":         events.ActionFileRead,
	"post_read_code":        events.ActionFileRead,
	"pre_write_code":        events.ActionFileWrite,
	"post_write_code":       events.ActionFileWrite,
	"pre_run_command":       events.ActionCommandExec,
	"post_run_command":      events.ActionCommandExec,
	"pre_mcp_tool_use":      events.ActionToolUse,
	"post_mcp_tool_use":     events.ActionToolUse,
	"pre_user_prompt":       events.ActionToolUse,
	"post_cascade_response": events.ActionNotification,
	"post_setup_worktree":   events.ActionToolUse,
}
View Source
var HookTypes = []string{
	"pre_read_code",
	"post_read_code",
	"pre_write_code",
	"post_write_code",
	"pre_run_command",
	"post_run_command",
	"pre_mcp_tool_use",
	"post_mcp_tool_use",
	"pre_user_prompt",
	"post_cascade_response",
	"post_setup_worktree",
}

Functions

func Detect

func Detect(ctx context.Context) (*agent.DetectionResult, error)

func GetHookStatus

func GetHookStatus(ctx context.Context) (*agent.HookStatus, error)

func InstallHooks

func InstallHooks(ctx context.Context, opts agent.InstallOptions) (*agent.InstallResult, error)

func Register

func Register(registry *agent.Registry, privacyChecker *events.PrivacyChecker, loggingLevel config.LoggingLevel, contentHash bool)

func ValidateHooksContent

func ValidateHooksContent(config *HooksConfig) []string

Types

type Adapter

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

func New

func New(privacyChecker *events.PrivacyChecker, loggingLevel config.LoggingLevel, contentHash bool) *Adapter

func (*Adapter) Detect

func (a *Adapter) Detect(ctx context.Context) (*agent.DetectionResult, error)

func (*Adapter) DisplayName

func (a *Adapter) DisplayName() string

func (*Adapter) Install

func (a *Adapter) Install(ctx context.Context, opts agent.InstallOptions) (*agent.InstallResult, error)

func (*Adapter) Name

func (a *Adapter) Name() string

func (*Adapter) ParseEvent

func (a *Adapter) ParseEvent(ctx context.Context, hookType string, rawData []byte) (*events.Event, error)

func (*Adapter) Status

func (a *Adapter) Status(ctx context.Context) (*agent.HookStatus, error)

func (*Adapter) Uninstall

type CodeToolInfo

type CodeToolInfo struct {
	FilePath string `json:"file_path"`
	Edits    []struct {
		OldString string `json:"old_string"`
		NewString string `json:"new_string"`
	} `json:"edits,omitempty"`
}

type CommandToolInfo

type CommandToolInfo struct {
	CommandLine string `json:"command_line"`
	Cwd         string `json:"cwd"`
}

type HookCommand

type HookCommand struct {
	Command string `json:"command"`
}

type HookDecision

type HookDecision int
const (
	HookAllow HookDecision = iota
	HookBlock
	HookError
)

type HookInput

type HookInput struct {
	AgentActionName string          `json:"agent_action_name"`
	TrajectoryID    string          `json:"trajectory_id"`
	ExecutionID     string          `json:"execution_id"`
	Timestamp       string          `json:"timestamp"`
	ToolInfo        json.RawMessage `json:"tool_info"`
}

type HookResponse

type HookResponse struct {
	Decision HookDecision
	Message  string
}

func NewAllowResponse

func NewAllowResponse() *HookResponse

func NewBlockResponse

func NewBlockResponse(message string) *HookResponse

func NewErrorResponse

func NewErrorResponse(message string) *HookResponse

func (*HookResponse) ExitCode

func (r *HookResponse) ExitCode() int

type HooksConfig

type HooksConfig struct {
	Hooks map[string][]HookCommand `json:"hooks"`
}

func GenerateHooksConfig

func GenerateHooksConfig() *HooksConfig

type MCPToolInfo

type MCPToolInfo struct {
	MCPServerName    string                 `json:"mcp_server_name"`
	MCPToolName      string                 `json:"mcp_tool_name"`
	MCPToolArguments map[string]interface{} `json:"mcp_tool_arguments"`
	MCPResult        string                 `json:"mcp_result,omitempty"`
}

type PromptToolInfo

type PromptToolInfo struct {
	UserPrompt string `json:"user_prompt,omitempty"`
	Response   string `json:"response,omitempty"`
}

type WorktreeToolInfo

type WorktreeToolInfo struct {
	WorktreePath      string `json:"worktree_path"`
	RootWorkspacePath string `json:"root_workspace_path"`
}

Jump to

Keyboard shortcuts

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