Help us shape the future of Go! Take the 2026 Go Developer Survey

approval

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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 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