management

package
v1.0.310 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 2 Imported by: 0 modules, 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 management implements the fixed, reviewed Management MCP tool catalog and its dispatch boundary (tools/list + tools/call) for PR-9. The catalog is READ-ONLY plus stateless draft/validate/simulate — there is NO mutation, activation, publication, credential, config-write, secret, log/trace-export, command-execution or arbitrary-access tool, and none can be added without a compile-time catalog change that the tests would reject (MCP-MGMT-001/003).

Every call is independently re-authorized (a client gains no authority by remembering a tool a prior tools/list returned), tenant-scoped (MCP-MGMT-002), and its result is byte-bounded before a JSON-RPC response is built (MCP-MGMT-004). A Gateway-scoped token can never call a Management tool.

Index

Constants

View Source
const (
	ScopeInventoryRead = "mgmt.inventory.read"
	ScopeDecisionRead  = "mgmt.decision.read"
	ScopePolicyRead    = "mgmt.policy.read"
	ScopePolicyDraft   = "mgmt.policy.draft"
	ScopeApprovalRead  = "mgmt.approval.read"
	ScopeHealthRead    = "mgmt.health.read"
)

Management scope names (capability-local; NOT a generic "mcp" scope).

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Invoke(tool string, id Identity, input []byte) ([]byte, error)
}

Backend produces the safe, already-redacted DTO bytes for a tool invocation. The adminapi adapter implements it; management never sees raw data. The backend must itself enforce tenant scoping from id.Tenant.

type Class

type Class uint8

Class classifies a Management tool. Only these two classes exist — there is no mutation class.

const (
	// ClassReadOnly is a bounded, redacted read.
	ClassReadOnly Class = iota
	// ClassDraft is a stateless draft/validate/simulate that persists nothing.
	ClassDraft
)

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher enforces the Management boundary around a Backend.

func NewDispatcher

func NewDispatcher(backend Backend, maxInputBytes, maxOutputBytes int) *Dispatcher

NewDispatcher builds a bounded Management dispatcher.

func (*Dispatcher) ToolsCall

func (d *Dispatcher) ToolsCall(id Identity, name string, input []byte) ([]byte, error)

ToolsCall independently authorizes and dispatches one tool invocation, bounding both input and output. An unknown or unauthorized tool fails closed; an oversized result fails closed (never truncated unsafely).

func (*Dispatcher) ToolsList

func (d *Dispatcher) ToolsList(id Identity) []ToolSpec

ToolsList returns only the tools id is authorized to see, sorted by name. A client cannot gain authority by remembering an omitted tool — tools/call re-authorizes independently.

type Identity

type Identity struct {
	Tenant     string
	Role       Role
	Scopes     map[string]bool
	Capability string
}

Identity is the resolved Management caller context. Capability MUST be "management"; a Gateway token is rejected.

type Role

type Role uint8

Role is a Management authorization role. It mirrors the admin-UI role ladder but is enforced independently per tool.

const (
	// RoleNone is the invalid zero value (fails closed).
	RoleNone Role = iota
	// RoleViewer may call read-only tools.
	RoleViewer
	// RoleOperator may additionally call draft/validate/simulate tools.
	RoleOperator
	// RoleAdmin may call everything a Management token is ever allowed to.
	RoleAdmin
)

type ToolSpec

type ToolSpec struct {
	Name    string
	MinRole Role
	Scope   string
	Class   Class
}

ToolSpec is one entry in the fixed Management catalog.

func Catalog

func Catalog() []ToolSpec

Catalog returns a copy of the full fixed catalog (for tests and the GUI Management-access panel). It is not authorization — ToolsList/ToolsCall gate.

Jump to

Keyboard shortcuts

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