Documentation
¶
Index ¶
- Constants
- Variables
- func RenderPrompt(req *Request, target *session.Session, policy Policy) string
- type Approval
- type ApprovalStore
- type ExecuteOptions
- type ExecutionMetadata
- type Policy
- type Request
- type Response
- type Store
- func (s *Store) AllowFuture(fromSession, toSession, fromPath, toPath string) error
- func (s *Store) Approvals() (*ApprovalStore, error)
- func (s *Store) ApproveAlwaysAndExecute(ctx context.Context, id string, policy Policy) (*Request, error)
- func (s *Store) ApproveAndExecute(ctx context.Context, id string, policy Policy) (*Request, error)
- func (s *Store) Create(fromSession, toSession, fromPath, toPath, question string) (*Request, error)
- func (s *Store) Deny(id string) (*Request, error)
- func (s *Store) Dir() string
- func (s *Store) Get(id string) (*Request, error)
- func (s *Store) IsAllowed(fromSession, toSession, fromPath, toPath string) (bool, error)
- func (s *Store) List() ([]*Request, error)
- func (s *Store) Pending() ([]*Request, error)
- func (s *Store) Save(req *Request) error
Constants ¶
View Source
const ( StatusPendingApproval = "pending_approval" StatusApproved = "approved" StatusRunning = "running" StatusAnswered = "answered" StatusDenied = "denied" StatusFailed = "failed" StatusTimedOut = "timed_out" )
Variables ¶
View Source
var PolicyLoader func() (Policy, error)
PolicyLoader returns the owner's responder policy. The responder runs an arbitrary local command, so the policy must come only from the owner's DevX config file, never through viper: viper gives a project .devx/config.yaml and DEVX_* environment variables precedence, which would let a repository enable the responder, drop approval, or choose the executable. cmd installs the owner-config loader at startup. Unset, or on a load error, the responder is disabled (fail closed).
Functions ¶
Types ¶
type ApprovalStore ¶
type ApprovalStore struct {
Approvals []Approval `json:"approvals"`
}
type ExecuteOptions ¶
type ExecutionMetadata ¶
type ExecutionMetadata struct {
Command string `json:"command,omitempty"`
PromptPath string `json:"prompt_path,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
LogPath string `json:"log_path,omitempty"`
}
type Policy ¶
type Policy struct {
// LoadErr is set when the owner policy could not be loaded; such a
// policy is disabled.
LoadErr error
Enabled bool
Mode string
Command string
Args []string
Timeout time.Duration
ReadOnly bool
}
func EffectivePolicy ¶
func EffectivePolicy() Policy
EffectivePolicy is the owner's responder policy, or a disabled policy carrying the load error when it cannot be read.
type Request ¶
type Request struct {
ID string `json:"id"`
FromSession string `json:"from_session"`
ToSession string `json:"to_session"`
FromPath string `json:"from_path,omitempty"`
ToPath string `json:"to_path,omitempty"`
Question string `json:"question"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Response *Response `json:"response,omitempty"`
Execution *ExecutionMetadata `json:"execution,omitempty"`
Error string `json:"error,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStoreAt ¶
func (*Store) AllowFuture ¶
func (*Store) Approvals ¶
func (s *Store) Approvals() (*ApprovalStore, error)
func (*Store) ApproveAlwaysAndExecute ¶
func (*Store) ApproveAndExecute ¶
Click to show internal directories.
Click to hide internal directories.