policy

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 1 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 policy defines stable Prism governance contracts.

Index

Constants

View Source
const (
	DecisionAllow           = "allow"
	DecisionDeny            = "deny"
	DecisionWarn            = "warn"
	DecisionRequireApproval = "require_approval"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Allowed bool              `json:"allowed" yaml:"allowed"`
	Skills  []string          `json:"skills,omitempty" yaml:"skills,omitempty"`
	Plugins map[string]Plugin `json:"plugins,omitempty" yaml:"plugins,omitempty"`
}

type Bundle

type Bundle struct {
	Allowed bool `json:"allowed" yaml:"allowed"`
}

type Decision

type Decision struct {
	Decision string   `json:"decision"`
	Reason   string   `json:"reason"`
	Warnings []string `json:"warnings,omitempty"`
}

Decision is an explainable policy result.

func Allow

func Allow(reason string, warnings ...string) Decision

func Deny

func Deny(reason string) Decision

func RequireApproval

func RequireApproval(reason string) Decision

func Warn

func Warn(reason string, warnings ...string) Decision

type Defaults

type Defaults struct {
	Mode                string `json:"mode,omitempty" yaml:"mode,omitempty"`
	RawPromptCapture    bool   `json:"raw_prompt_capture" yaml:"raw_prompt_capture"`
	MaxGraphNodes       int    `json:"max_graph_nodes,omitempty" yaml:"max_graph_nodes,omitempty"`
	MaxGraphDepth       int    `json:"max_graph_depth,omitempty" yaml:"max_graph_depth,omitempty"`
	MaxParallelNodes    int    `json:"max_parallel_nodes,omitempty" yaml:"max_parallel_nodes,omitempty"`
	MaxRuntimeSeconds   int    `json:"max_runtime_seconds,omitempty" yaml:"max_runtime_seconds,omitempty"`
	MaxEvidenceBytes    int    `json:"max_evidence_bytes,omitempty" yaml:"max_evidence_bytes,omitempty"`
	RemoteModelsAllowed bool   `json:"remote_models_allowed" yaml:"remote_models_allowed"`
}

type Plugin

type Plugin struct {
	Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`
}

type Policy

type Policy struct {
	Version int `json:"version" yaml:"version"`

	Defaults   Defaults             `json:"defaults" yaml:"defaults"`
	Agents     map[string]Agent     `json:"agents" yaml:"agents"`
	Sources    map[string]Source    `json:"sources" yaml:"sources"`
	Workspaces map[string]Workspace `json:"workspaces,omitempty" yaml:"workspaces,omitempty"`
	Bundles    map[string]Bundle    `json:"bundles,omitempty" yaml:"bundles,omitempty"`

	WriteActions WriteActions `json:"write_actions" yaml:"write_actions"`
}

Policy is the YAML-backed contract used to govern Prism execution.

type Request

type Request struct {
	AgentID                   string        `json:"agent_id,omitempty" yaml:"agent_id,omitempty"`
	Skills                    []string      `json:"skills,omitempty" yaml:"skills,omitempty"`
	Plugins                   []string      `json:"plugins,omitempty" yaml:"plugins,omitempty"`
	Source                    string        `json:"source,omitempty" yaml:"source,omitempty"`
	WorkspaceID               string        `json:"workspace_id,omitempty" yaml:"workspace_id,omitempty"`
	BundleID                  string        `json:"bundle_id,omitempty" yaml:"bundle_id,omitempty"`
	Runtime                   time.Duration `json:"-" yaml:"-"`
	GraphNodes                int           `json:"graph_nodes,omitempty" yaml:"graph_nodes,omitempty"`
	GraphDepth                int           `json:"graph_depth,omitempty" yaml:"graph_depth,omitempty"`
	EvidenceBytes             int           `json:"evidence_bytes,omitempty" yaml:"evidence_bytes,omitempty"`
	RawPromptCaptureRequested bool          `json:"raw_prompt_capture_requested,omitempty" yaml:"raw_prompt_capture_requested,omitempty"`
	RemoteModelRequested      bool          `json:"remote_model_requested,omitempty" yaml:"remote_model_requested,omitempty"`
	WriteRequested            bool          `json:"write_requested,omitempty" yaml:"write_requested,omitempty"`
}

Request is the normalized policy evaluation input for one Prism action.

type Source

type Source struct {
	Allowed bool `json:"allowed" yaml:"allowed"`
}

type Workspace

type Workspace struct {
	Allowed bool `json:"allowed" yaml:"allowed"`
}

type WriteActions

type WriteActions struct {
	Allowed bool `json:"allowed" yaml:"allowed"`
}

Jump to

Keyboard shortcuts

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