Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackHandler ¶
type CallbackHandler struct {
// contains filtered or unexported fields
}
CallbackHandler handles HTTP callbacks for approval actions.
func NewCallbackHandler ¶
func NewCallbackHandler(store *Store) *CallbackHandler
NewCallbackHandler creates a handler for approval callback URLs.
func (*CallbackHandler) ServeHTTP ¶
func (h *CallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles GET /callback/approval?id=xxx&action=approve|reject&token=xxx
type FeishuNotifier ¶
type FeishuNotifier struct {
// contains filtered or unexported fields
}
FeishuNotifier sends interactive card messages to Feishu via webhook.
func NewFeishuNotifier ¶
func NewFeishuNotifier(cfgMgr *config.Manager) *FeishuNotifier
NewFeishuNotifier creates a notifier that sends interactive cards to Feishu. The webhook URL is read from config on each Notify call, supporting hot reload.
func (*FeishuNotifier) Notify ¶
func (f *FeishuNotifier) Notify(req *PendingRequest, callbackBaseURL string, token string) error
Notify sends an approval request card to Feishu with approve/reject buttons.
type GenericWebhookNotifier ¶ added in v0.1.4
type GenericWebhookNotifier struct {
// contains filtered or unexported fields
}
GenericWebhookNotifier sends a standard JSON POST to any webhook URL.
func NewGenericWebhookNotifier ¶ added in v0.1.4
func NewGenericWebhookNotifier(cfgMgr *config.Manager) *GenericWebhookNotifier
NewGenericWebhookNotifier creates a notifier that POSTs JSON to any webhook URL. The webhook URL is read from config on each Notify call, supporting hot reload.
func (*GenericWebhookNotifier) Notify ¶ added in v0.1.4
func (g *GenericWebhookNotifier) Notify(req *PendingRequest, callbackBaseURL string, token string) error
Notify sends an approval request payload to the generic webhook endpoint.
type MultiNotifier ¶ added in v0.1.4
type MultiNotifier struct {
// contains filtered or unexported fields
}
MultiNotifier wraps multiple notifiers and sends to all of them.
func NewMultiNotifier ¶ added in v0.1.4
func NewMultiNotifier(notifiers ...Notifier) *MultiNotifier
NewMultiNotifier creates a notifier that sends to all wrapped notifiers.
func (*MultiNotifier) Notify ¶ added in v0.1.4
func (m *MultiNotifier) Notify(req *PendingRequest, callbackBaseURL string, token string) error
Notify sends the approval request to all wrapped notifiers, joining any errors.
type Notifier ¶
type Notifier interface {
Notify(req *PendingRequest, callbackBaseURL string, token string) error
}
Notifier sends approval notifications (e.g., Feishu webhook, generic webhook).
type PendingRequest ¶
type PendingRequest struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
ToolName string `json:"tool_name"`
Arguments string `json:"arguments"`
CreatedAt time.Time `json:"created_at"`
// contains filtered or unexported fields
}
PendingRequest represents a request awaiting human approval.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages pending approval requests.
func (*Store) GenerateToken ¶
GenerateToken creates an HMAC-SHA256 token for a request ID.
func (*Store) ListPending ¶
func (s *Store) ListPending() []*PendingRequest
ListPending returns all pending approval requests.
func (*Store) RequestApproval ¶
RequestApproval creates a pending request, sends notification, and blocks until approved/rejected/timeout.
func (*Store) Resolve ¶
Resolve approves or rejects a pending request. Returns false if the request was not found or the requester already timed out.
func (*Store) ValidateToken ¶
ValidateToken checks the HMAC token for a request ID.