* feat(desktop): record embedded managed resources and UniFFI export names The desktop scan now records a managed assembly's CLI Resources directory, read on its own so an image that backs only the CLI header prefix records nothing more than before, and searches a PE library's export directory (up to 256 KiB) for UniFFI scaffolding names, keeping the namespace its contract-version function names. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(desktop): point resources, protobuf schemas and UniFFI engines at their readers inspect_desktop_application now proposes inspect_artifact for assemblies that embed manifest resources, counting localized satellite assemblies as one deferred group; recover_protobuf_descriptors for the release's own assemblies when Google.Protobuf ships with it; and inspect_uniffi_library for libraries with UniFFI exports. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(desktop): cover the reader probes and the extra resource facts Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(desktop): describe the resource, protobuf and UniFFI probes Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(desktop): find UniFFI exports through the shared export reader The scan read the export directory's declared range as text and searched it with a regular expression. Size does not bound the exported names, the range also holds padding and the DLL name, and the expression backtracked on repeated prefixes. The scan now reads the names with the export parser inspect_native_exports uses, through the desktop's budgeted reader, and matches each name with fixed prefix and suffix checks. Libraries above 8,192 names or 256 KiB of export data, and malformed export directories, are skipped. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(desktop): classify resource and UniFFI facts once and keep ownership first The fact classifier now records manifest resources and UniFFI exports, so its switch covers every fact kind. Managed probes come from one loop: assemblies the release names as its own keep all their probes, satellite assemblies are deferred for both operations, and an assembly's probes stay together. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(desktop): cover unmarked libraries and satellite deferral Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(desktop): state the UniFFI export scan bounds and ownership precedence Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(desktop): yield and honour cancellation during the UniFFI export scan The scan passed the export parser a pause that never yielded, and reads served from cached blocks skipped the cancellation check. It now takes the caller's pause, which yields to the event loop and checks the scan's abort signal, at the parser's checkpoints and after every 64 reads. Bytes served from cache are capped at 4 MiB, so repeated name pointers into the same blocks end the scan instead of running unbounded. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(desktop): cover the UniFFI export scan's namespace and propagation Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(desktop): list resource probes in the .NET ranking expectation Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
14 KiB
Desktop installation directories
Use inspect_desktop_application when an installation directory is the target
and its runtime is unknown. It reads directory entries, selected headers and
bounded metadata, then reports runtime candidates, supporting files, component
path markers and concrete follow-up operations. No native provider or active
binary session is needed. It does not run the application, extract archives,
follow child symlinks, contact services or change target files.
MCP
{ "path": "/artifacts/MyApplication" }
Default detail: "summary" retains complete source Evidence in the session and
returns candidates with representative supporting paths, counts, coverage,
limitations and grouped next probes. normalized_result.parent_evidence_id
identifies the complete record. A server without Evidence retention refuses
summary delivery before reading the target; select detail: "complete" to
receive every retained fact inline.
Read exact files in one request:
{
"source": {
"kind": "retained-evidence",
"evidence_id": "ev_<parent-sha256>"
},
"view": {
"kind": "desktop-application",
"collection": "files",
"paths": ["Game_Data/Managed/Assembly-CSharp.dll", "GameAssembly.dll"],
"fields": ["path", "read_status", "ranges", "facts", "issues"],
"offset": 0,
"limit": 16
}
}
Collections are files, omissions, candidates, components and next_probes.
Files and omissions accept exact paths and batched file_ids / omission_ids.
Files also accept has_issues: true to select probe diagnostics directly, or
false to select rows without reported issues. This filter uses the retained
issue facts; it does not re-read targets or infer that uninspected files are healthy.
When both are supplied, all filters apply; an empty selection returns no rows.
Omission records retain the observed path, kind and stable omission_id; their
payloads are not read, and other special-entry metadata remains unavailable.
candidates accepts exact families.
Omitted selectors match all retained rows; an empty selector matches none.
Every collection supports fields, offset and limit; its stable row ID is
always included. Selection changes delivery, not source inspection. Pages keep
source coverage and parent Evidence links. Page exhaustion does not establish
absence in a partial source. Complete Evidence remains accessible through
get_evidence_bundle and Evidence bundle export.
The summary's probe_issues counts files with reported issues and their retained
issue entries. It previews at most two such files, including stable file_id,
read status and the first issue. Path/reason previews use at most 256 UTF-16 units
each without splitting surrogate pairs; text_truncated marks shortened text,
and preview_truncated marks additional files. These are display prefixes;
full caller paths and all reasons remain in Evidence. Counts describe retained
observations, while source coverage still identifies partial inspection.
Use inspect_analysis_view with collection: "files", has_issues: true and
fields: ["path", "read_status", "issues"] for exact reasons, with the usual
paging and parent links. It intersects with exact paths and batched file IDs.
An ASAR inventory probe first selects its exact path with open_binary; then
call inspect_artifact on that active target. Directory inspection itself does
not select or replace the session target. The JavaScript application workflow
accepts its own selected path directly: the ASAR, or the unpacked
resources/app folder.
CLI
The one-shot CLI returns complete Evidence by default. For compact output, explicitly retain it in a bundle:
rea inspect-desktop-application /artifacts/MyApplication \
--detail summary --evidence_output /reports/application.evidence.json --json
This returns summary Evidence and an evidence_bundle publication receipt.
Existing output files are never overwritten. Summary delivery requires
--evidence_output, checked before analysis. inspect-evidence-bundle selects
saved records; an exact saved record can also feed inspect-analysis-view.
--detail complete returns source Evidence inline and can optionally write the
same bundle. Export writes only the caller-selected output file.
Facts and uncertainty
| Family | Evidence used |
|---|---|
| .NET | A PE optional header declares a nonempty CLI directory. |
| Unity Mono | A PE file below *_Data/Managed or Contents/Resources/Data/Managed has an exact UnityEngine assembly reference in the probed metadata. |
| Unity IL2CPP | A recognized IL2CPP metadata magic (with the raw version when complete) coexists with a conventionally named native GameAssembly.dll, GameAssembly.so, GameAssembly.dylib or libil2cpp.so image. Build correspondence remains unknown. |
| Godot | A GDPC header at file start or a validated executable trailer offset. |
| GameMaker | A bounded FORM container starts with a GEN8 chunk. The scan probes conventional data.win, game.unx, and game.ios data files for that header. |
| Unreal | Content/Paks path conventions or an IoStore TOC signature; arbitrary .pak filenames are insufficient. |
| Electron | A resources/app.asar or resources/default_app.asar path convention, or an unpacked resources/app/package.json; archive validity is unverified. |
| Native | Only when no family above applies: PE .exe, or ELF or Mach-O images without a library extension, at the shallowest depth any of them occupies. The UI stack comes from component markers; the code is unexamined. |
When the four-byte metadata magic is present but version bytes are incomplete,
the fact retains raw_version: null; it does not offer an IL2CPP metadata
inspection probe. A complete magic/version prefix with supported raw version
24, 27, 29, 31 or 39 offers an inspect_il2cpp_metadata follow-up at its
admitted file path, including when no native library was found. This probe does
not establish full metadata validity or correspondence to a native binary;
version 24 inspection still applies only to supported header layouts. See
IL2CPP metadata.
The Unity Mono probe reads the mapped CLI header prefix and follows its metadata
directory to look for an AssemblyRef witness. A readable prefix and reference
can support this candidate while the rest of the declared CLI header extent
remains unverified. Use inspect_managed_artifact to check the complete CLI
header and managed metadata for that file.
In a managed directory with a Unity Mono witness, Assembly-CSharp.dll and
Assembly-CSharp-firstpass.dll get an inspect_managed_members probe listed
first; project-named asmdef assemblies keep only the ordinary managed probes.
The same probe is offered for those names in Managed/ of a
<Product>_BackUpThisFolder_ButDontShipItWithYourGame folder (or when that
folder is the root); whether its IL matches the shipped IL2CPP code is unknown.
Point the scan at the game folder: a root that is the <Product>_Data or
Managed folder itself has no Mono witness path and gets no member probe.
Candidates are derived or inferred from these facts and do not prove loading or execution. BepInEx, MelonLoader, Easy Anti-Cheat and BattlEye labels identify path conventions only; runtime presence stays unknown. No bypass is provided.
Component markers also name native UI stacks and runtimes from the files a
release ships: Qt (Qt5Core.dll, Qt6Core.dll, platforms/qwindows.dll,
qt.conf), SDL (SDL2.dll, SDL3.dll), wxWidgets, GTK (ui-framework) and
the Microsoft Visual C++ runtime (vcruntime140.dll, msvcp140.dll;
runtime-library). They are file-name conventions with
runtime_presence: "unknown". A native candidate's main executables get
inspect_pe_imports and inspect_pe_resources (resource-tree inventory) probes
(ELF and Mach-O get inspect_binary_hardening and open_binary). Headers are
read for host-marked executables, for Contents/MacOS/ entries and for
extensionless files at the root, so Unix mains are found on a Windows host too. Each Godot pack carrier, including
an executable with a trailer pack, gets an open_binary probe that selects it
for inspect_artifact.
Probe ranking
Each probe has a priority. application probes come first. They read code the
release names as its own:
- a managed assembly whose stem matches a
<name>.runtimeconfig.json,<name>.deps.jsonor<name>.pdbin the same directory; - Unity script-assembly member probes;
- native main executables and Godot packs;
- the Electron application ASAR or unpacked
resources/appfolder, so managed or native helpers it bundles do not lead.
Three probes point at readers for content the scan recognises:
inspect_artifactfor a managed assembly whose CLI header declares a Resources directory, such as a WPF assembly with its.g.resources. Extract that set, then decode its.bamlviews withinspect_baml. Localized satellite assemblies (*.resources.dll) get no probe of either kind;deferred_probescounts them as onesatellite-resourcesgroup.recover_protobuf_descriptorsfor each of the release's own assemblies whenGoogle.Protobuf.dllships with it.inspect_uniffi_libraryfor a PE library that exports UniFFI scaffolding (ffi_<namespace>_uniffi_contract_versionorUNIFFI_META_*). The scan reads the export names with the same reader asinspect_native_exports; it skips a library with more than 8,192 names, more than 256 KiB of export data, or a malformed export directory. The rationale names the namespace when the contract function is found.
An assembly the release names as its own keeps all of its probes even when its name matches a runtime or satellite pattern.
dependency probes read the other managed assemblies. Runtime and framework
facades (System.*, Microsoft.*, mscorlib, netstandard, WPF assemblies,
Mono.*, UnityEngine.*) get no probe each. Instead, deferred_probes counts
them as one runtime-facade group with an example file, and the default summary
keeps that group. For example, a
self-contained OpenRA release lists 25 managed probes, led by OpenRA.Game.dll,
plus a deferred group of 167.
file_id includes the admitted root namespace, recorded path and available filesystem identity. The caller-selected root path and admitted canonical path/root identity are both retained; local_path identifies each observed file for follow-up operations. The selected root may be a symlink; child symlinks are not followed. Exact
metadata integers remain decimal strings. Read ranges have offsets, byte counts
and SHA-256 digests; typed facts expose CLI RVAs, metadata/pack versions and
assembly tokens. Directory and symlink identities unavailable from traversal
remain null.
The directory's snapshot_sha256 commits to retained paths, omission kinds,
available metadata and range digests, composed through the admitted root,
entry and omission identities. Caller ceilings, coverage counters, diagnostic
wording and interpretation facts remain in Evidence, outside source identity.
The same observations under different generous limits share a snapshot digest;
Evidence IDs still preserve request parameters and reported coverage. Different
retained entries or read ranges change the source snapshot.
Omission records share the entry and representation budgets and can be fetched
independently through their view.
Evidence records the directory subject as unknown because the snapshot covers only the examined metadata and read ranges. These are sequential stable entry
observations, not an atomic directory snapshot. Unread bytes remain unknown.
Resource bounds and reuse
Defaults are 20,000 examined entries and 8 MiB of total probe reads. Callers may select up to 100,000 entries and 64 MiB. A separate 32 MiB representation budget bounds retained rows, paths and facts before growth. Each retained path is charged at the larger of its UTF-16 heap size and its escaped JSON size, so typical macOS bundle paths fit about 20,000 rows, and control-character paths fewer. Limits and failed probes produce partial coverage. Traversal and reads are serial. Each reader admits one inspection at a time; overlapping requests receive a retryable capacity refusal without cancelling the admitted caller.
Unity reference decoding stops after a witness in each Data/Managed directory;
other assemblies' references remain unexamined, while their headers are still
checked. AssemblyRef facts decode names and tokens only; they do not decode or
hash unrelated key/culture/hash payloads or establish runtime binding. Pack contents, encrypted data, metadata/address correspondence and
section-embedded PCKs without a trailer are separate capabilities.
Filesystem results are not cached across calls. Retained views reuse validated immutable metadata without rescanning files or retaining another inventory.