PtcRunner.Kernel.Environment (PtcRunner v0.14.0)

Copy Markdown View Source

Internal shared validator for workflow and mission environment constructors.

It verifies bundle attestations, JSON-like data, capability identity, reserved routes, and bundle tool requirements. The public environment structs remain distinct even though they share this validation path.

Summary

Functions

Validates common environment fields and returns normalized attributes.

Returns the whole-environment capability view.

Returns the single-capability view one dispatch callback needs.

Returns sorted model-visible capability metadata for one environment.

Functions

assemble(bundle, capabilities, data, kind)

Validates common environment fields and returns normalized attributes.

capability_view(map)

Returns the whole-environment capability view.

Dispatch reads nothing from an environment but :capabilities. A callback handed to a sandboxed evaluation must capture a view rather than the environment itself: spawn does not preserve sharing, so capturing the environment would copy its frozen bundle once per capability callback.

Only the discovery routes need every capability. A callback that dispatches one capability must capture capability_view/2 instead — capturing the whole map from each of them costs the hand-over O(capabilities²), which a tool-rich MCP environment can blow the sandbox setup ceiling with before evaluation starts.

capability_view(name, capability)

Returns the single-capability view one dispatch callback needs.

Dispatcher.dispatch/8 resolves name against the :capabilities of the value it is given and reads nothing else from it, so a callback bound to one capability can carry only that capability and dispatch identically.

metadata(map)

Returns sorted model-visible capability metadata for one environment.