Skip to main content

Lifecycle

componentLifecycleSnapshot treats an unloaded component as an answer rather than a failure: it comes back with COMPONENT_LIFECYCLE_STATE_NOT_LOADED and no model id.

Hugging Face token

This one has behaviour worth knowing:
  • null falls back to the environment lookup the core resolves: HF_TOKEN, then $HF_TOKEN_PATH, then $HF_HOME/token, then ~/.cache/huggingface/token. That is the order huggingface_hub uses, so hf auth login is honoured.
  • An empty string clears the token and disables that fallback.
  • The token lives in the platform secure store, not in settings, and is re-applied on the next initialize() so a gated model still downloads after a cold start.
  • It is attached only to https requests whose host is exactly huggingface.co or hf.co, never to a CDN or LFS redirect target.

Models

Download control

interrupted() after a crash or a forced quit tells you what to offer resuming, which is the difference between a user losing a 4GB download and not.

Storage

deletePlan is a dry run. Call it before delete and show the user exactly what is about to go, rather than deleting and reporting afterwards. availability answers “will this fit” before a download starts.

Logging

addDestination returns an unsubscribe function rather than taking a removal call. records() is a live stream, which is what a debug pane in the app can render directly.

LoRA

Electron carries the full catalog surface, not the short form:

Embeddings helpers

cosineSimilarity and computeNorm on the namespace are Electron-only.

Identity and telemetry

These become meaningful only once the SDK is initialized with control-plane credentials. In keyless local mode they report an unauthenticated state rather than throwing.

Model residency

ResidencyPolicy, ResidencyDecision, ResidencySlots, and ResidentModel control which models stay loaded when memory is contended. On a desktop with several models in play, this is what stops a voice session evicting the chat model on every turn.