Skip to content

Instance Lifecycle ​

An Avatar instance is an active desktop application process that presents a Runtime-authorized LocalAgent. The launcher can also reattach to an existing Avatar instance. Agent session continuity and binding associations are authoritatively managed by Runtime; the Avatar shell manages local windowing and renderer lifecycles.

Launch Target ​

The caller submits an AvatarHostHandoffRequest through the formal Avatar Host port. Its target identifies the current session's Agent and, when needed, the exact Conversation. The target fields are:

FieldInputPurpose
agentHandleRequired stringCurrent-session handle matching agent_ref_ followed by 43 base64url characters; revalidated through the caller's App session and Runtime
conversationAnchorIdOptional string or nullExact Conversation anchor, when the caller supplies one
avatarInstanceIdRequired key; string or nullUntrusted hint for an existing Avatar instance
launchSourceRequired key; string or nullBounded source label; does not authorize an action
switchIntentRefRequired key; string or nullOne-time reference returned with a switch confirmation request; resubmit only after user confirmation
committedPresentationRefRequired key; string or nullOpaque reference to a committed presentation
temporaryCustodyRefRequired key; string or nullOpaque reference to temporary custody

Use null for nullable fields when no value applies. Every field remains untrusted targeting intent until the caller's App session and Runtime revalidate it. Raw Agent identifiers (agentId), account credentials, Realm endpoints, session histories, model files, calibration parameters, and local paths are excluded. Only the Desktop Host launches or focuses the native Avatar process and authorizes materialization under the protected data root.

The renderer receives a separate launch context containing agentHandle, a required conversationAnchorId, and nullable avatarInstanceId and launchSource. It receives no Host-private target reference or account credentials. The handed-off handle remains a targeting hint; it must not be reused as an Agent selector in Avatar's own App session.

Session and Conversation Binding ​

Runtime owns Agent identity and Conversation continuity. Desktop keeps the private launch and instance information needed by the native host. Avatar first verifies its credential-free protected App session, then uses the exact handed-off Conversation anchor to resolve an Agent handle minted for that session. Operations use this session's handle and typed Runtime results.

A missing or invalid session, launch context, or Runtime binding prevents product interaction. The shell displays diagnostic information so the caller can restore the session or retry.

Readiness and Local Diagnostics ​

Avatar chooses its shell view from the current session, driver, model, and launch prerequisites. The current App-local CompositionState values help diagnose that choice:

Diagnostic valueMeaning
loadingShell or Runtime preparation is incomplete
readySession, driver, and model prerequisites permit the product view; interaction also requires a ready backend presentation
fixture_not_verifiedA development model can render, but product readiness remains false
degraded_reauth_requiredThe protected App session needs authentication or renewal
degraded_cloud_offlineThe required Realm transport is unavailable
degraded_runtime_unavailableA Runtime binding, driver, or model prerequisite is unavailable; inspect the diagnostic reason
degraded_launch_context_invalidThe renderer launch context failed validation
error_bootstrap_fatalBootstrap failed with an error outside the classified session, launch, or Runtime failures

The model view mounts when the local composition is renderable. This includes an explicitly marked development preview, which cannot accept product interaction and does not prove a valid Runtime binding. Product interaction and the Companion surface additionally require Runtime-backed composition and a ready backend presentation. When prerequisites prevent rendering, Avatar shows the relevant diagnostic view.

Typical Scenario: Launching Avatar from Desktop ​

  1. Submit the target: The caller sends the current session's agentHandle through the Avatar Host port, with the exact Conversation anchor when needed.
  2. Revalidate the request: Desktop and Runtime validate the caller and target. Desktop launches or focuses the matching instance; switching to another Agent requires user confirmation and the returned one-time switch reference.
  3. Resolve the session's Agent: Avatar verifies its own protected App session, then resolves that session's Agent handle against the required Conversation anchor from the renderer launch context.
  4. Load authorized assets: The Desktop Host authorizes materialization of the exact Runtime-validated visual package under the protected data root.
  5. Graphics initialization: Avatar initializes the active graphics branch (e.g. Live2D) and awaits the first rendered frame.
  6. Enable interaction: The shell enables product interaction when the session, driver, model, and backend presentation are ready.

Launch requests and renderer launch contexts carry no raw asset files, private keys, or account tokens.

Typical Scenario: Runtime Becomes Unavailable ​

  1. Heartbeat failure: A required Runtime service drops connection while Avatar is running.
  2. Show diagnostics: The current Runtime binding or driver becomes unavailable, so product interaction stops and the shell shows the corresponding reason.
  3. Remove the product surface: While the composition is not renderable, the model stage and Companion surface are unmounted.
  4. Retry: Once Runtime is available, use the restart action to establish a fresh session. Interaction resumes only after the binding and presentation checks succeed.

Ownership Summary ​

ConcernOwner
LocalAgent cognitive execution and continuityRuntime
Agent-handle and Conversation revalidationRuntime through the caller's App session
Native instance launch, focus, and materialization authorizationDesktop Host Control Plane
Renderer launch-context validationAvatar using the Kit parser
Desktop window lifecycle and interaction presentationAvatar
Graphics resource compilation and teardownAvatar backend branch

Source Basis ​

Documentation for Nimi — the installable, open-source, local-first personal AI product.