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
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
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
LOCAL_AI_READINESS_CONTROLLER_EVENT_TYPES | variable · value | variable LOCAL_AI_READINESS_CONTROLLER_EVENT_TYPES | — |
LOCAL_AI_READINESS_CONTROLLER_ERROR_CODES | variable · value | variable LOCAL_AI_READINESS_CONTROLLER_ERROR_CODES | — |
LOCAL_AI_READINESS_CONTROLLER_REASONS | variable · value | variable LOCAL_AI_READINESS_CONTROLLER_REASONS | — |
createLocalAIReadinessController | function | function createLocalAIReadinessController({
chat,
status,
preferences,
profileHref=null,
onChange,
...checkOptions
}={}) | {
chat,
status,
preferences,
profileHref=null,
onChange,
...checkOptions
}={} |
availabilityFromReport | function | function availabilityFromReport(report={}) | report={} |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
createLocalAIReadinessController | exported-function | function createLocalAIReadinessController({
chat,
status,
preferences,
profileHref=null,
onChange,
...checkOptions
}={}) | {
chat,
status,
preferences,
profileHref=null,
onChange,
...checkOptions
}={} |
availabilityFromReport | exported-function | function 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
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();
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.