Documentation
¶
Index ¶
- type Mode
- type Request
- type Response
- type Service
- func (s *Service) Grant(sessionID, toolName, action string)
- func (s *Service) IsAllowed(sessionID, toolName, action string) bool
- func (s *Service) Mode() Mode
- func (s *Service) Request(ctx context.Context, req Request) (Response, error)
- func (s *Service) Revoke(sessionID, toolName, action string)
- func (s *Service) SetMode(mode Mode)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode string
Mode represents the permission mode for tool execution.
const ( // ModeInteractive asks the user for each permission request. ModeInteractive Mode = "interactive" // ModeAutoAllow automatically approves all permission requests. ModeAutoAllow Mode = "auto_allow" // ModeAutoDeny automatically denies all permission requests. ModeAutoDeny Mode = "auto_deny" )
type Request ¶
type Request struct {
SessionID string `json:"session_id"`
ToolName string `json:"tool_name"`
Action string `json:"action"`
Description string `json:"description"`
Params json.RawMessage `json:"params"`
}
Request represents a permission request from a tool.
type Response ¶
type Response struct {
Allowed bool `json:"allowed"`
Remember bool `json:"remember"` // true = grant for rest of session
}
Response represents the user's response to a permission request.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages tool permissions for the agent.
func NewService ¶
NewService creates a new permission service.
func (*Service) IsAllowed ¶
IsAllowed checks if a tool/action is currently allowed without prompting.
func (*Service) Request ¶
Request checks if a tool action is allowed. In auto_allow mode, always returns allowed. In auto_deny mode, always returns denied. In interactive mode, checks grants first, then returns pending. The caller (agent loop) handles the actual user interaction.
Click to show internal directories.
Click to hide internal directories.