refactor: Migrate external package queries to resolution knowledge (#13523)
## Intent
Turborepo is refactoring toward a multi-language repository
architecture: ecosystem integrations contribute immutable repository
knowledge, and core owns graph/task/hash/cache/watch/prune/query policy
without ecosystem-specific branches.
This is **stack layer 1 / 5** of the JavaScript **external-resolution**
migration. Earlier work already builds a shared resolution generation at
graph construction and uses it for task hashing and lockfile
affectedness. This layer migrates **query surfaces** onto that
generation.
## Changes
- Store producer-supplied human names on `ExternalPackageIdentity`
- Lazy reverse index: external identity → internal dependents
- `turbo query` external packages / `internalDependents` read the
catalog
- N-API `packages_from_lockfile` reads the JavaScript resolution domain
## Out of scope
Prune keys, global hash, deleting `PackageInfo` resolution fields (later
layers).
## Testing
- `cargo test -p turborepo-repository --lib test_lockfile_traversal`
- `cargo test -p turborepo-repository --lib
external_dependency_reverse_index_is_lazy_and_cached`
- `cargo clippy -p turborepo-repository -p turborepo-query --all-targets
-- -D warnings`
Closes TURBO-5811.
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Anthony Shew <anthonyshew@users.noreply.github.com>