openclaw

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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentName   = agent.AgentOpenClaw
	DisplayName = agent.DisplayOpenClaw
)

Variables

View Source
var HookTypes = []string{
	"before_tool_call",
	"after_tool_call",
	"session_start",
	"session_end",
}
View Source
var ToolNameMapping = map[string]events.ActionType{
	"read":           events.ActionFileRead,
	"grep":           events.ActionFileRead,
	"glob":           events.ActionFileRead,
	"list":           events.ActionFileRead,
	"write":          events.ActionFileWrite,
	"edit":           events.ActionFileWrite,
	"exec":           events.ActionCommandExec,
	"bash":           events.ActionCommandExec,
	"message":        events.ActionToolUse,
	"browser":        events.ActionToolUse,
	"web_search":     events.ActionToolUse,
	"web_fetch":      events.ActionToolUse,
	"image":          events.ActionToolUse,
	"cron":           events.ActionToolUse,
	"tts":            events.ActionToolUse,
	"canvas":         events.ActionToolUse,
	"sessions_spawn": events.ActionToolUse,
	"sessions_list":  events.ActionToolUse,
	"sessions_send":  events.ActionToolUse,
	"agents_list":    events.ActionToolUse,
	"session_status": events.ActionToolUse,
	"nodes":          events.ActionToolUse,
	"gateway":        events.ActionToolUse,
}

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)

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 HookDecision

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

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

func (*HookResponse) JSON

func (r *HookResponse) JSON() []byte

func (*HookResponse) Stderr

func (r *HookResponse) Stderr() string

type SessionEventInput

type SessionEventInput struct {
	HookType     string `json:"hook_type"`
	SessionID    string `json:"session_id"`
	AgentID      string `json:"agent_id,omitempty"`
	MessageCount int    `json:"message_count,omitempty"`
	DurationMs   int64  `json:"duration_ms,omitempty"`
}

type ToolEventInput

type ToolEventInput struct {
	HookType   string                 `json:"hook_type"`
	Tool       string                 `json:"tool"`
	Args       map[string]interface{} `json:"args"`
	Result     interface{}            `json:"result,omitempty"`
	Error      string                 `json:"error,omitempty"`
	DurationMs int64                  `json:"duration_ms,omitempty"`
	SessionID  string                 `json:"session_id"`
	AgentID    string                 `json:"agent_id,omitempty"`
}

Jump to

Keyboard shortcuts

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