PtcRunner.Kernel.MissionInventory (PtcRunner v0.14.0)

Copy Markdown View Source

Builds the frozen prompt-facing inventory for one mission environment.

Version 3 contains prompt-visible prelude exports, model-visible capability schemas, mission data grants, and the mission execution limits relevant to generated programs. A separate version 2 model-contract rendering normalizes prompt-visible exports, directly callable capabilities, and mission data into one structured API list. Arrays are sorted by public form. Both UTF-8 renderings and lower-case SHA-256 hashes are frozen into PtcRunner.Kernel.RunConfig and are identical for normal runs and PtcRunner.Kernel.ReplSession.

Every bare capability entry carries a frozen call form. In the secondary model-contract projection, required input fields are expanded into the literal argument map, for example (tool/search {"query" query}); the authoritative inventory retains its generic one-map form and full schemas. Live models given only a capability name invent invalid invocation syntax, so the model projection teaches the exact required-field form.

Rendering uses PtcRunner.Kernel.DeterministicJSON. The installed ceiling is 256 KiB; callers may lower it but inventory is never truncated.

Summary

Functions

Builds one bounded version 3 mission inventory.

Summarizes per-mission grants for operator surfaces such as ptc validate.

Types

t()

@type t() :: %PtcRunner.Kernel.MissionInventory{
  bytes: non_neg_integer(),
  hash: binary(),
  model_bytes: non_neg_integer(),
  model_hash: binary(),
  model_rendered: binary(),
  model_schema_version: 2,
  rendered: binary(),
  schema_version: 3
}

Functions

build(mission, limits, opts \\ [])

@spec build(
  PtcRunner.Kernel.MissionEnvironment.t(),
  PtcRunner.Kernel.Limits.t(),
  keyword()
) ::
  {:ok, t()}
  | {:error, :invalid_mission_inventory | :mission_inventory_exceeded}

Builds one bounded version 3 mission inventory.

grant_summary(data, bundle, provider_names)

@spec grant_summary(map(), PtcRunner.Kernel.FrozenBundle.t() | nil, [binary()]) ::
  map()

Summarizes per-mission grants for operator surfaces such as ptc validate.

Lists parseable data/<name> forms, every public export ref from the mission bundle, and selected mission provider names. Capability tool names discovered only after provider acquisition are intentionally absent: validate does not activate providers.