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
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(webhookURL string) *FeishuNotifier
func (*FeishuNotifier) Notify ¶
func (f *FeishuNotifier) Notify(req *PendingRequest, callbackBaseURL string, token string) error
type Notifier ¶
type Notifier interface {
Notify(req *PendingRequest, callbackBaseURL string, token string) error
}
Notifier sends approval notifications (e.g., Feishu 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.