manifestcaps

package
v0.7.7-dev.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package manifestcaps decodes the capabilities block of a canonical manifest's JSON the one way every reader of it in the registry does: the scanner's stages, the gate's inputs, and the derivations pkg/gatecases publishes for clients that restate the gate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotNone

func NotNone(raw json.RawMessage) bool

NotNone reports whether a filesystem or exec JSON value declares more than "none" (the string "none" is false; an object or a list is true).

func OnlyNone

func OnlyNone(egress []string) bool

OnlyNone reports whether an egress list names nothing but "none".

func Subagents added in v0.6.1002

func Subagents(manifestJSON []byte) (agents []manifest.AgentDependency, ok bool)

Subagents reads a persistent release's subagents from the canonical manifest JSON: dependencies.agents when its modes include persistent, nil otherwise. Bytes that are not a JSON object declare none, as they declare no capability. ok is false when the object's modes or, in a persistent release, its dependencies do not decode, which the callers read as subagents declared.

Types

type Caps

type Caps struct {
	Network struct {
		Egress manifest.Egress `json:"egress"`
	} `json:"network"`
	Filesystem struct {
		Read  json.RawMessage `json:"read"`
		Write json.RawMessage `json:"write"`
	} `json:"filesystem"`
	Exec        json.RawMessage      `json:"exec"`
	Secrets     []string             `json:"secrets"`
	MCPServers  []manifest.MCPServer `json:"mcpServers"`
	TargetHosts []string             `json:"targetHosts"`
	// Browser is kept raw and read by Browser(), so a value of an odd
	// shape cannot fail the whole decode and leave every other capability
	// undeclared.
	BrowserLine json.RawMessage `json:"browser"`
	// PersistentBlock is capabilities.persistent, kept raw and read by
	// Persistent() for the same reason.
	PersistentBlock json.RawMessage `json:"persistent"`
	// DesktopLine is capabilities.desktop, kept raw and read by Desktop()
	// for the same reason.
	DesktopLine json.RawMessage `json:"desktop"`
}

Caps is the capabilities block of the canonical manifest JSON, decoded once. Egress is pkg/manifest's own union type, because the canonical form carries `egress: none` as the JSON string "none" and a host list as an array; decoding it into a []string failed the whole decode, and every capability of such a manifest read as undeclared to S6, S9, the gate and namespace policy.

func Read

func Read(manifestJSON []byte) (caps Caps, ok bool)

Read decodes the capabilities block. ok is false when the manifest is not JSON or has no capabilities block; an unreadable manifest reads as nothing declared.

func (Caps) Browser

func (c Caps) Browser() (b *manifest.Browser, declared, ok bool)

Browser reads the browser line. declared is false when there is none; ok is false when there is one that does not decode, which the callers read the strict way: a browser, on any public site.

func (Caps) BrowserHosts

func (c Caps) BrowserHosts() []string

BrowserHosts are the hosts the manifest's browser line declares, lowercased, exact or "*.": none for a line that does not read.

func (Caps) Desktop added in v0.7.7

func (c Caps) Desktop() (d *manifest.Desktop, declared, ok bool)

Desktop reads the line for the person's computer. declared is false when there is none; ok is false when there is one that does not decode, which the callers read the strict way: computer use and every server.

func (Caps) Persistent added in v0.6.1002

func (c Caps) Persistent() (p *manifest.Persistent, declared, ok bool)

Persistent reads capabilities.persistent. declared is false when there is none; ok is false when there is one that does not decode, which the callers read the strict way: every key declared.

func (Caps) RemoteServerHosts

func (c Caps) RemoteServerHosts() []string

RemoteServerHosts are the hosts of the manifest's remote MCP servers: network the release reaches, through the runner's bridge, as surely as through network.egress.

func (Caps) ServerEgress

func (c Caps) ServerEgress() map[string]string

ServerEgress maps each host a declared package MCP server's own egress names (lowercased, "*" kept) to the server that names it first. It is network the release reaches, from the server's container rather than the agent's, so it counts for policy and S9 and never marks an agent script's own host as declared (S6 does not read it). An application server the desktop line uses counts the same way, keyed "desktop:<id> <pin>", with the hosts the catalogue lists for it: network the release reaches from the person's own computer rather than from any container of the run.

Jump to

Keyboard shortcuts

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