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 ¶
- func NotNone(raw json.RawMessage) bool
- func OnlyNone(egress []string) bool
- func Subagents(manifestJSON []byte) (agents []manifest.AgentDependency, ok bool)
- type Caps
- func (c Caps) Browser() (b *manifest.Browser, declared, ok bool)
- func (c Caps) BrowserHosts() []string
- func (c Caps) Desktop() (d *manifest.Desktop, declared, ok bool)
- func (c Caps) Persistent() (p *manifest.Persistent, declared, ok bool)
- func (c Caps) RemoteServerHosts() []string
- func (c Caps) ServerEgress() map[string]string
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 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 ¶
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 ¶
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 ¶
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
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 ¶
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 ¶
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.