hook

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType string
const (
	EventTypeConversationStarted   EventType = "conversation_started"
	EventTypeConversationEnded     EventType = "conversation_ended"
	EventTypeContextExceeded       EventType = "context_exceeded" // TODO: consider deprecating
	EventTypePreContextCompaction  EventType = "pre_context_compaction"
	EventTypePostContextCompaction EventType = "post_context_compaction"
	EventTypePreToolUse            EventType = "pre_tool_use"
	EventTypePostToolUse           EventType = "post_tool_use"
)

func (EventType) MarshalJSON

func (e EventType) MarshalJSON() ([]byte, error)

func (*EventType) UnmarshalJSON

func (e *EventType) UnmarshalJSON(b []byte) error

func (EventType) Validate

func (e EventType) Validate() error

type Hook

type Hook struct {
	bun.BaseModel `bun:"table:hooks"`

	ID        uuid.UUID `bun:",pk,type:uuid" json:"id"`
	EventType EventType `bun:"event_type,notnull" json:"event_type"`
	AgentName string    `bun:"agent_name" json:"agent_name"` // empty = wildcard
	Command   string    `bun:"command,notnull" json:"command"`
	Args      []string  `bun:"args,array" json:"args"`
	Enabled   bool      `bun:"enabled" json:"enabled"`
}

func GetHookByID

func GetHookByID(ctx context.Context, db bun.IDB, id uuid.UUID) (*Hook, error)

func NewHook

func NewHook(eventType EventType, agentName, command string, args []string, enabled bool) (*Hook, error)

func (*Hook) Delete

func (h *Hook) Delete(ctx context.Context, db bun.IDB) error

func (Hook) GetCursor

func (h Hook) GetCursor() string

Paginatable-style helpers

func (Hook) GetSortField

func (h Hook) GetSortField() string

func (Hook) GetSortValue

func (h Hook) GetSortValue() interface{}

func (Hook) GetUniqueField

func (h Hook) GetUniqueField() string

func (Hook) GetUniqueValue

func (h Hook) GetUniqueValue() interface{}

func (*Hook) Insert

func (h *Hook) Insert(ctx context.Context, db bun.IDB) error

CRUD

func (Hook) IsWildcard

func (h Hook) IsWildcard() bool

func (*Hook) Update

func (h *Hook) Update(ctx context.Context, db bun.IDB) error

func (*Hook) Validate

func (h *Hook) Validate() error

Validation

Jump to

Keyboard shortcuts

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