Documentation
¶
Overview ¶
Package permission is the capability boundary for human-in-the-loop decisions routed through the inbound platform (tool approval, ask_user, etc.).
Index ¶
Constants ¶
const DefaultTimeout = 10 * time.Minute
DefaultTimeout is the wait limit when Request.Timeout and Capability.DefaultTimeout are both unset.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowDenyMatch ¶
AllowDenyMatch is the parsed allow/deny reply.
type AnswerScope ¶
type AnswerScope string
const ( ScopeAsker AnswerScope = "asker" ScopeAnyone AnswerScope = "anyone" )
type Capability ¶
type Capability struct {
Interactive bool
MultiSelect bool
DefaultTimeout time.Duration
AnswerScope AnswerScope
}
Capability describes how a platform renders and collects permission replies.
type CapabilityRouter ¶
type CapabilityRouter interface {
PermissionCapabilityFor(platformID string) Capability
}
CapabilityRouter is implemented by platforms that aggregate multiple leaf platforms.
type Capable ¶
type Capable interface {
PermissionCapability() Capability
}
Capable is implemented by leaf platforms that can render permission requests.
type QuestionResult ¶
type Reply ¶
type Reply struct {
RequestID string `json:"requestId"`
UserID string `json:"userId,omitempty"`
// Decision is for KindAllowDeny only ("allow"/"deny", or y/n/yes/no).
Decision string `json:"decision,omitempty"`
Selected []int `json:"selected,omitempty"`
Text string `json:"text,omitempty"`
UpdatedInput map[string]any `json:"updatedInput,omitempty"`
Cancelled bool `json:"cancelled,omitempty"`
}
Reply is the inbound answer to a permission/request.
Field usage by request Kind:
- KindAllowDeny: Decision ("allow"/"deny", or y/n/yes/no); Text is a CLI fallback when Decision is empty. UpdatedInput carries human-edited tool arguments. Cancelled means the user explicitly declined.
- KindQuestion: Text and/or Selected only; do not set Decision.
type Request ¶
type Request struct {
ID string `json:"id"`
Kind Kind `json:"kind"`
Reason string `json:"reason,omitempty"`
ToolCall *agentkit.ToolCall `json:"toolCall,omitempty"`
Question *Question `json:"question,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
AskedBy string `json:"askedBy,omitempty"`
}
type RequestPayload ¶
type RequestPayload struct {
Request
// Conversation is the Loop history/lock key; platforms echo it on card replies
// so permission answers route back to the turn that created the pending request.
Conversation string `json:"conversation,omitempty"`
}
RequestPayload is emitted on permission/request.
type Result ¶
type Result struct {
ID string `json:"id,omitempty"`
Outcome Outcome `json:"outcome"`
Allow bool `json:"allow,omitempty"`
Answer *QuestionResult `json:"answer,omitempty"`
UpdatedInput map[string]any `json:"updatedInput,omitempty"`
Reason string `json:"reason,omitempty"`
Guidance string `json:"guidance,omitempty"`
}
Result is the outcome of Broker.Await. ID is set on permission/resolved events.