Capability first · transport second

AIPreferenceTuple.js

Normalizes and compares the six provider/model preference slots.

SDK 0.97.1Runtime 0.8.12Protocol arcane/1
On this page

Overview

Normalizes and compares the six provider/model preference slots.

  • Artifact
    AIPreferenceTuple.js · esm
  • Classification
    public first party
  • Availability
    Cross-host
  • Normalization
    Mutable slot-order array and normalized tuple. Existing token trimming, aliases, caller-selected allowed values, and defaults remain unchanged; selection controllers can reuse the order independently of token normalization.

Import and lifecycle

JavaScript
import * as module from '/node_modules/arcane-os/runtime/arcane/modules/AIPreferenceTuple.js';

Pure in-process normalization and comparison with no persistence or host calls.

Application-facing behavior: AIPREFERENCESLOTKEYS, normalizeAIPreferenceTuple(), aiPreferenceTuplesEqual().

Protocol and host implementation

In-process only This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
AI_PREFERENCE_SLOT_KEYSvariable · valuevariable AI_PREFERENCE_SLOT_KEYS—
normalizeAIPreferenceTuplefunctionfunction normalizeAIPreferenceTuple( value, { defaults, allowedValues=[], aliases=[] }={} ) value, { defaults, allowedValues=[], aliases=[] }={}
aiPreferenceTuplesEqualfunctionfunction aiPreferenceTuplesEqual(left,right)left,right
CallableKindExact public signatureParameter syntax
normalizeAIPreferenceTupleexported-functionfunction normalizeAIPreferenceTuple( value, { defaults, allowedValues=[], aliases=[] }={} ) value, { defaults, allowedValues=[], aliases=[] }={}
aiPreferenceTuplesEqualexported-functionfunction aiPreferenceTuplesEqual(left,right)left,right

Parameter meanings and results

AI_PREFERENCE_SLOT_KEYS is the mutable six-slot order array. normalizeAIPreferenceTuple(value, {defaults, allowedValues, aliases}) returns a mutable normalized six-element array in that order; existing token trimming, aliases, caller-selected allowed values, and default selection are unchanged. aiPreferenceTuplesEqual(left, right) requires two six-entry arrays with exact values. AIModelSelectionController uses the shared order without applying this token normalizer to saved selection values.

Events, side effects, and errors

Source-literal CustomEvent dispatches

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

Lifecycle and event flow

This artifact has no additional documented lifecycle event flow.

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

  • TypeError for invalid defaults, allowed-value collections, or disallowed defaults

Availability and capabilities

Cross-host. Mutable slot-order array and normalized tuple. Existing token trimming, aliases, caller-selected allowed values, and defaults remain unchanged; selection controllers can reuse the order independently of token normalization.

Normalizes profile tokens only; Core admission remains a separate status and catalog concern.

Contract example

JavaScript
import {AI_PREFERENCE_SLOT_KEYS, normalizeAIPreferenceTuple, aiPreferenceTuplesEqual} from '/node_modules/arcane-os/runtime/arcane/modules/AIPreferenceTuple.js';

const defaults=[
    'TWIN','LOCAL_SPEACH','LOCAL_SPEACH',
    'openai-gpt-oss-120b','kokoro','whisper-small'
];
const tuple=normalizeAIPreferenceTuple(['OLLAMA'],{defaults});
console.log(AI_PREFERENCE_SLOT_KEYS,aiPreferenceTuplesEqual(tuple,tuple));

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