Skip to main content

Module selection

Module selection 

Source
Expand description

Item selection: which Agents, skills and package-level documents of a settled dependency graph a consumer installs.

A pure pass over the graph the resolver settled. It seeds items from the consumer’s own requests and from unfiltered manifest edges, then closes over the skills the selected Agents name. Nothing here reads the filesystem, so the answer does not depend on the order the resolver met the packages in. Items are identified by package, kind and slug; the names they install under (renames, collision suffixes) are the caller’s.

The rule, in three steps:

  1. Seeds. Each of the consumer’s requests seeds its package, and so does each entry of the root package’s manifest, as the consumer’s own request. The root package itself is selected whole. A request that takes everything also opens its package: every unfiltered entry of an open package’s manifest seeds its target in turn and opens it. A filtered entry of a dependency’s manifest seeds nothing, and its exclude blocks nothing; only the consumer’s own exclude (or the root’s) does.
  2. Items per request. All takes every item; Include takes Agents and skills by kind and slug, and the package’s bootstrap documents; Exclude takes all but the items it names by slug or path; only_skills and only_agents take one kind. Hooks are taken by All and Exclude only.
  3. Skill refs. Every selected Agent’s skills resolve to a package: its own, then its dependencies breadth first, then any other package in registry order. The skill is selected unless the consumer excluded it, and a package it lands in also selects its bootstrap documents. A ref <skill>__<provider> that no package ships is skipped when the requester declares the provider, and is a MissingSkill otherwise.

Registry order is computed here, not supplied: a depth-first walk from the root package (if any), then each request in order, descending each package’s manifest entries in declaration order. GraphView::packages is a set. A package no request reaches is never selected from and never supplies a skill.

Structs§

Definition
An Agent or skill of a package, with the skills an Agent names.
GraphView
Item
An item of a package, found by the caller: what the crate does not prepare (bootstrap documents, hooks). MCP servers are selected outside this pass, by the caller.
MissingSkill
A skill ref no package ships.
PackageInput
A package as a caller holds it across the JSON boundary: the crate::prepare::Prepared it got earlier (prepare’s result, as serialized) and the items preparation does not read. Only prepared.selection is read; the rest is ignored.
PackageView
Request
A dependency entry as selection sees it: the package it names and the items it asks for.
SelectedItem
SelectionFacts
What selection reads of a prepared package. prepare computes it (Prepared::selection), so a caller on the other side of the JSON boundary passes prepare’s result and derives nothing.
SelectionResult

Enums§

Requester
Why an item is selected.

Functions§

select