Documentation
¶
Index ¶
- Constants
- Variables
- func Register(factory func() Interrupt)
- func RegisterDefaults()
- type AuthExpired
- type ChildWaiting
- type Interrupt
- type PayloadInitializer
- type PayloadValidator
- type PermissionOption
- type ToolPermissionInterrupt
- func (p *ToolPermissionInterrupt) Error() string
- func (p *ToolPermissionInterrupt) InitFromPayload(payload []byte) error
- func (p *ToolPermissionInterrupt) Return(payload []byte) error
- func (p *ToolPermissionInterrupt) Serialize() ([]byte, error)
- func (p *ToolPermissionInterrupt) TypeName() string
- func (p *ToolPermissionInterrupt) ValidatePayload(payload []byte) error
- type ToolPermissionPayload
- type UserChoice
- type UserSelectionInterrupt
- func (c *UserSelectionInterrupt) Error() string
- func (c *UserSelectionInterrupt) InitFromPayload(payload []byte) error
- func (c *UserSelectionInterrupt) Return(payload []byte) error
- func (c *UserSelectionInterrupt) Serialize() ([]byte, error)
- func (c *UserSelectionInterrupt) TypeName() string
- func (c *UserSelectionInterrupt) ValidatePayload(payload []byte) error
- type UserSelectionPayload
Constants ¶
const ( PermissionAllowOnce = "allow_once" PermissionAllowAlways = "allow_always" PermissionRejectOnce = "reject_once" PermissionRejectAlways = "reject_always" )
ACP PermissionOptionKind values.
const TypeAuthExpired = "auth_expired"
TypeAuthExpired parks a tool call until the host rebinds credentials on Resume.Auth.
const TypeChildWaiting = "child_waiting"
TypeChildWaiting is kept for old checkpoints. Inline specialists use JobWaitError. The payload is forwarded to the child session; Return is a no-op.
Variables ¶
var ( ErrInterruptNotFound = errors.New("interrupt not found") ErrInvalidPayload = errors.New("invalid payload") )
Functions ¶
func Register ¶
func Register(factory func() Interrupt)
Register adds a factory for an Interrupt type under its TypeName. Call at init for custom interrupts so checkpoints can rehydrate them.
func RegisterDefaults ¶ added in v0.2.0
func RegisterDefaults()
RegisterDefaults registers the built-in interrupt types. Safe to call more than once. tacklr.init calls this; New also ensures defaults so checkpoint rehydrate works without importing the root package.
Types ¶
type AuthExpired ¶ added in v0.3.1
type AuthExpired struct {
Tool string `json:"tool,omitempty"`
Provider string `json:"provider,omitempty"`
}
AuthExpired is raised when a tool or VFS mount unwraps to expired credentials. Return is a no-op; tokens travel on Resume.Auth, not the interrupt payload.
func (*AuthExpired) Error ¶ added in v0.3.1
func (p *AuthExpired) Error() string
func (*AuthExpired) Return ¶ added in v0.3.1
func (p *AuthExpired) Return([]byte) error
func (*AuthExpired) Serialize ¶ added in v0.3.1
func (p *AuthExpired) Serialize() ([]byte, error)
func (*AuthExpired) TypeName ¶ added in v0.3.1
func (p *AuthExpired) TypeName() string
func (*AuthExpired) ValidatePayload ¶ added in v0.3.1
func (p *AuthExpired) ValidatePayload([]byte) error
type ChildWaiting ¶ added in v0.2.0
ChildWaiting accepts any resume payload (child HITL forwarded through the parent session).
func (*ChildWaiting) Error ¶ added in v0.2.0
func (p *ChildWaiting) Error() string
func (*ChildWaiting) Return ¶ added in v0.2.0
func (p *ChildWaiting) Return([]byte) error
func (*ChildWaiting) Serialize ¶ added in v0.2.0
func (p *ChildWaiting) Serialize() ([]byte, error)
func (*ChildWaiting) TypeName ¶ added in v0.2.0
func (p *ChildWaiting) TypeName() string
func (*ChildWaiting) ValidatePayload ¶ added in v0.2.0
func (p *ChildWaiting) ValidatePayload([]byte) error
type Interrupt ¶
type Interrupt interface {
// TypeName returns a stable, unique name for this interrupt type. It is
// used as the JSON discriminator when persisting interrupts to session
// storage and as the lookup key in the interrupt registry.
TypeName() string
// Serialize the interrupt to a byte slice for transmission.
Serialize() ([]byte, error)
// Return the interrupt to the agent workflow with a serialized
// payload of the interrupt result.
Return([]byte) error
// Error makes Interrupt compatible with the error interface.
Error() string
}
Interrupt represents a pending interrupt in an agent workflow requesting the user for additional input or approval. Implementations must also satisfy the error interface so they can be returned from tool handlers and detected via errors.As.
type PayloadInitializer ¶
PayloadInitializer is an optional capability Interrupt types implement to populate themselves from the raw payload provided to Park.
type PayloadValidator ¶
PayloadValidator is an optional capability Interrupt types may implement for standalone payload checks. Session Resume calls Return only; types that still need field-presence checks do that inside Return.
type PermissionOption ¶
type PermissionOption struct {
OptionID string `json:"optionId"`
Name string `json:"name"`
Kind string `json:"kind"`
}
PermissionOption is a single choice offered when a tool requires user approval. Field names match ACP session/request_permission options.
func DefaultPermissionOptions ¶
func DefaultPermissionOptions() []PermissionOption
DefaultPermissionOptions are the standard ACP permission choices.
type ToolPermissionInterrupt ¶
type ToolPermissionInterrupt struct {
ToolName string `json:"toolName,omitempty"`
Title string `json:"title,omitempty"` // human-readable invocation label
Options []PermissionOption `json:"options"`
// Set by Return after the consumer selects an option. Checkpointed so a
// later activity can TakeResolved and see the decision. Serialize omits
// these so the client park payload stays unresolved.
SelectedOptionID string `json:"selectedOptionId,omitempty"`
SelectedKind string `json:"selectedKind,omitempty"`
Allowed bool `json:"allowed,omitempty"`
}
ToolPermissionInterrupt asks the user to approve or reject a tool call.
func (*ToolPermissionInterrupt) Error ¶
func (p *ToolPermissionInterrupt) Error() string
func (*ToolPermissionInterrupt) InitFromPayload ¶
func (p *ToolPermissionInterrupt) InitFromPayload(payload []byte) error
func (*ToolPermissionInterrupt) Return ¶
func (p *ToolPermissionInterrupt) Return(payload []byte) error
func (*ToolPermissionInterrupt) Serialize ¶
func (p *ToolPermissionInterrupt) Serialize() ([]byte, error)
func (*ToolPermissionInterrupt) TypeName ¶
func (p *ToolPermissionInterrupt) TypeName() string
func (*ToolPermissionInterrupt) ValidatePayload ¶
func (p *ToolPermissionInterrupt) ValidatePayload(payload []byte) error
type ToolPermissionPayload ¶
type ToolPermissionPayload struct {
InterruptId string `json:"interruptId,omitempty"`
OptionID string `json:"optionId"`
}
ToolPermissionPayload is the consumer resolution for a tool permission interrupt.
type UserChoice ¶
type UserSelectionInterrupt ¶
type UserSelectionInterrupt struct {
Question string `json:"question,omitempty"`
Options []UserChoice `json:"options"`
ConfirmedChoice *UserChoice
}
func (*UserSelectionInterrupt) Error ¶
func (c *UserSelectionInterrupt) Error() string
func (*UserSelectionInterrupt) InitFromPayload ¶
func (c *UserSelectionInterrupt) InitFromPayload(payload []byte) error
func (*UserSelectionInterrupt) Return ¶
func (c *UserSelectionInterrupt) Return(payload []byte) error
func (*UserSelectionInterrupt) Serialize ¶
func (c *UserSelectionInterrupt) Serialize() ([]byte, error)
func (*UserSelectionInterrupt) TypeName ¶
func (c *UserSelectionInterrupt) TypeName() string
func (*UserSelectionInterrupt) ValidatePayload ¶
func (c *UserSelectionInterrupt) ValidatePayload(payload []byte) error