Capability first · transport second

LocalAIReadinessController.js

Coordinates local-AI status component checks, ensured recovery, availability projection, and teardown.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Coordinates local-AI status component checks, ensured recovery, availability projection, and teardown.

  • Artifact
    LocalAIReadinessController.js · esm
  • Classification
    public first party
  • Availability
    Browser/native hybrid
  • Normalization
    Normalized controller state and change events.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/LocalAIReadinessController.js';

The factory attaches local-ai-retry to the optional status component. check() deduplicates active work, updates chat/status presentation, calls onChange, and dispatches one result event. destroy() removes the retry listener.

Application-facing behavior: Event/error/reason constants, createLocalAIReadinessController(), and availabilityFromReport(); returned controller owns abort, refresh/ensure, subscription, and destroy() cleanup.

Protocol and host implementation

LocalAIReadiness + per-realm globalThis.arcaneEvents authority + one-way component projections This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
LOCAL_AI_READINESS_CONTROLLER_EVENT_TYPESvariable · valuevariable LOCAL_AI_READINESS_CONTROLLER_EVENT_TYPES
LOCAL_AI_READINESS_CONTROLLER_ERROR_CODESvariable · valuevariable LOCAL_AI_READINESS_CONTROLLER_ERROR_CODES
LOCAL_AI_READINESS_CONTROLLER_REASONSvariable · valuevariable LOCAL_AI_READINESS_CONTROLLER_REASONS
createLocalAIReadinessControllerfunctionfunction createLocalAIReadinessController({ chat, status, preferences, profileHref=null, onChange, ...checkOptions }={}){ chat, status, preferences, profileHref=null, onChange, ...checkOptions }={}
availabilityFromReportfunctionfunction availabilityFromReport(report={})report={}
CallableKindExact public signatureParameter syntax
createLocalAIReadinessControllerexported-functionfunction createLocalAIReadinessController({ chat, status, preferences, profileHref=null, onChange, ...checkOptions }={}){ chat, status, preferences, profileHref=null, onChange, ...checkOptions }={}
availabilityFromReportexported-functionfunction availabilityFromReport(report={})report={}

Parameter meanings and results

availabilityFromReport(report) returns complete {llm,stt,tts}, with true only when that local slot is explicitly required and ready; missing and non-local-required slots are false and grant no provider, credential, browser-authority, or model-load readiness. createLocalAIReadinessController({chat,status?,preferences,profileHref?,onChange?,...readinessOptions}) returns {check,ensure,destroy,availability,report,readyFor(name)}; check() and ensure() resolve a complete readiness report.

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

  • Dispatches local-ai-readiness-change on chat with {report}; bubbles and composes.
  • Consumes status local-ai-retry and may await local-ai-status-ready.

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

  • TypeError when chat is absent or readyFor() receives a name other than llm/stt/tts.
  • Readiness rejection propagates.

Availability and capabilities

Browser/native hybrid. Normalized controller state and change events.

No additional authority; it inherits LocalAIReadiness method admission and host behavior.

Contract example

JavaScript
import {createLocalAIReadinessController} from '/arcane/modules/LocalAIReadinessController.js';

const chat = new EventTarget();
chat.setAIAvailability = value => console.log(value);
const controller = createLocalAIReadinessController({
    chat,
    preferences:[
        'TWIN','LOCAL_SPEACH','LOCAL_SPEACH','openai-gpt-oss-120b',
        'kokoro','whisper-small'
    ],
    runtime:'browser'
});
await controller.check();
controller.destroy();

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.