permissions

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package permissions holds Alaska's per-tool permission policy.

For each tool the model wants to invoke, the policy is consulted:

  • Allow — run silently
  • Deny — refuse with a tool_result error, don't ask
  • Ask — prompt the user once, optionally remember their answer

Rules live in config.toml under permissions; the REPL has a /permissions slash command to tweak them interactively.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns the absolute path to permissions.toml (lives next to config.toml).

func Save

func Save(p *Policy) error

Save writes permissions.toml.

Types

type Mode

type Mode string
const (
	ModeAsk   Mode = "ask"   // default — prompt user
	ModeAllow Mode = "allow" // auto-run
	ModeDeny  Mode = "deny"  // refuse without prompting
)

func ParseMode

func ParseMode(s string) (Mode, error)

ParseMode parses user input into a Mode, accepting loose spellings.

type Policy

type Policy struct {
	DefaultMode Mode            `toml:"default"`
	Tools       map[string]Mode `toml:"tools"`
}

Policy is the user's current per-tool rules. Unknown tools fall back to DefaultMode (ask).

func Default

func Default() *Policy

func Load

func Load() (*Policy, error)

Load reads permissions.toml. Missing file → Default().

func (*Policy) Mode

func (p *Policy) Mode(tool string) Mode

Mode returns the effective mode for a tool.

func (*Policy) Set

func (p *Policy) Set(tool string, mode Mode) error

Set updates one tool's rule. Pass "" to revert to default.

func (*Policy) SetDefault

func (p *Policy) SetDefault(mode Mode) error

SetDefault changes the fallback for unrecognised tools.

func (*Policy) SortedTools

func (p *Policy) SortedTools() []string

SortedTools returns the configured tool rules in a stable order.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL