Documentation
¶
Overview ¶
Package approval provides declarative `@approval` gates. A gate suspends execution with Kernel's DAG suspension sentinel until xctx carries a token covering the gate name.
Index ¶
Constants ¶
View Source
const ID = "approval"
Variables ¶
View Source
var Directive = compiler.Directive{
Name: "approval",
Example: "@approval finance_review {\n role: reviewer\n reason: confirm the transfer\n expires: 30m\n}",
Handler: handleDirective,
}
Directive parses an approval declaration and stores it in compiler metadata.
Functions ¶
func TokenCovers ¶
TokenCovers reports whether a Kernel approval token grants the named gate. The token grammar is `all` or a comma-separated list of case-sensitive gate names; whitespace around each name is ignored.
Types ¶
type Declaration ¶
type Declaration struct {
Name string
Role string
Reason string
Expires time.Duration
Position compiler.Position
}
Declaration describes one `@approval NAME { ... }` gate.
func DeclarationsFromMeta ¶
func DeclarationsFromMeta(meta map[string]any) []Declaration
DeclarationsFromMeta returns a copy of the approval declarations in metadata.
Click to show internal directories.
Click to hide internal directories.