approval

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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,
	OpaqueBlock: true,
}

Directive parses an approval declaration and stores it in compiler metadata.

Functions

func Bundle

func Bundle(_ map[string]string) compiler.Bundle

Bundle installs approval declarations and their materialized gate actions.

func TokenCovers

func TokenCovers(token, gate string) bool

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.

Jump to

Keyboard shortcuts

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