Table of Contents

Namespace Qavren.Edge.Onnx

Classes

BundledOnnxModelSource

An app-packaged asset, copied out once. The opener is the consumer's - in MAUI that is FileSystem.OpenAppPackageFileAsync - so this package never references MAUI.

CoreMlProviderOptions

CoreML execution-provider options, as ORT's string-keyed provider dictionary spells them.

DefaultEdgeModelPaths

net10.0 and Windows: <IEdgePaths.Data>/models and <IEdgePaths.Data>/ort-cache.

EdgeAiEventIds

Continues SP1's EdgeEventIds numbering. 600-899 is sub-project 2's range.

EdgeAiStartupOrder

The order registry for every SP2 startup task. The constants are published from L0 because that is the lowest package all three share; the task that USES each order is registered by the package named in the comment, and spec 14.1 is the authority on which is which.

EdgeModelProvisioningException

A model file could not be produced: missing asset, short disk, failed download, or a digest that did not match the manifest.

EdgeOnnxException

Every ONNX-runtime failure that is not a provisioning failure: an unsupported RID, a refused execution provider, a memory pre-flight refusal, a signature mismatch, a session that would not create, and the OnnxStaticShapesUnpinned guard.

EdgeResourceSnapshot

One reading. Every nullable member means UNKNOWN, never "no". AvailableMemoryBytes null on a desktop where GC.GetGCMemoryInfo() reports nothing usable is not a refusal, and the session host's memory pre-flight is required to skip its check rather than fail it.

ExecutionProviderAttempt

One attempt. Accepted means AppendExecutionProvider returned without throwing - it does NOT mean this provider executed every node. ORT exposes no managed API for per-node EP assignment; ProfileComputePlan is the only truthful signal for that.

ExecutionProviderReport

The outcome of applying an OnnxExecutionProviderPolicy to one session.

FileOnnxModelSource

Files already on disk, in the model root or an explicit directory. AddOnnx registers this one last, as the fallback every other source falls through to.

HttpOnnxModelSource

Resumable, verified HTTP provisioning. Foreground-only by design: an iOS download that survives backgrounding needs NSUrlSessionConfiguration.CreateBackgroundSessionConfiguration, which HttpClient does not map onto.

HttpOnnxModelSourceOptions

How HttpOnnxModelSource fetches. BaseAddress and UrlTemplate together are the ONLY place a Hugging Face URL is constructed - nothing else in this suite concatenates one - so a consumer pointing at a mirror or a corporate proxy changes exactly these two properties.

OnnxEdgeBuilderExtensions

Registers ONNX Runtime hosting on the Qavren.Edge builder.

OnnxExecutionProviderPolicy

How a session picks and configures its execution providers.

OnnxModelFile

One file a model needs on disk.

OnnxModelManifest

Everything needed to put one model on disk and prove it is the right one.

OnnxOptions

Process-wide ONNX Runtime settings, applied by the order-200 startup task.

OnnxSessionInfo

One session, as diagnostics and a consumer see it.

OnnxSessionLease

A borrowed session. Dispose() releases the lease; the underlying InferenceSession is disposed only when the last lease returns after a drop.

OnnxSessionOptions

Per-model session settings. One instance per registered model.

OnnxSessionSignature

What the loaded graph actually declares, read from ORT after creation rather than assumed from a preset. This is what turns "somebody pointed a preset at a different export" from silently wrong vectors into a message naming the file.

ProvisionedModel

A model that is on disk, verified and ready to hand to ORT.

XnnPackProviderOptions

XNNPACK execution-provider options.

Structs

ModelProvisioningProgress

One progress report, for a determinate bar.

Interfaces

IEdgeModelPaths

Where a 23-137 MB re-derivable blob belongs. Deliberately NOT Data (backed up on all three platforms; Android's Auto Backup quota is 25 MB per app, so one model there consumes the whole quota and stops the user's real database being backed up) and deliberately NOT Cache (the OS may purge it mid-session, converting a purge into a re-download).

IEdgeResourceMonitor

Apple: os_proc_available_memory() (0 means unknown or already over - treated as unknown, never as a refusal) and ProcessInfo.ThermalState/IsLowPowerModeEnabled. Android: ActivityManager.GetMemoryInfo (availMem, lowMemory), PowerManager.CurrentThermalStatus and GetThermalHeadroom(10). Desktop: GC.GetGCMemoryInfo(), advisory only. Reads are cached for one second: Android's GetThermalHeadroom is rate-limited to ~1 Hz and returns NaN when polled faster.

IOnnxModelSource

One way of getting a model's files onto the device. Sources are probed in registration order and every one of them is contractually required to produce a real filesystem path, even on Android where an app-package asset is a pathless AssetManager stream: spec 9.1 creates sessions from paths, never from byte arrays.

IOnnxModelStore

The one thing that decides whether a model is on disk. Idempotent, concurrency-safe, and the only writer of the .qavren-model.json marker.

IOnnxSessionHost

Owns every InferenceSession in the process. There is deliberately NO byte-array entry point: a byte[] overload holds the managed array and ORT's copy of the initializers simultaneously during creation (about 180 MB transient for fp32 MiniLM) and degrades ORT's CoreML cache key from the model-URL hash to a hash of graph inputs and node outputs, which collides across quantization variants of one architecture. A consumer cannot take that path.

Enums

EdgeExecutionProvider

The providers SP2 can actually append. NNAPI is deliberately absent - see spec 9.2 and ADR 0004: ORT's portable AppendExecutionProvider(string, Dictionary<string,string>) overload documents support for "QNN", "SNPE", "XNNPACK", "CoreML" and "AZURE" only, so NNAPI is not reachable through the one code path this package uses. The typed helpers are never called: AppendExecutionProvider_CoreML calls a native entry point deprecated in ORT 1.20.0, and AppendExecutionProvider_Nnapi is compiled inside #if ANDROID and throws on every other build.

EdgeThermalState

The device's thermal state, as the platform reports it.

ModelProvisioningSource

Where a provisioned model's bytes came from.

OnnxModelFileRole

What a file in a model manifest is for.