@devvibex/aiflow 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvibex/aiflow",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "First-party LLM gateway SDK for apps generated on the VibeX platform — chat, streaming, image, video, music (Lyria), sound effects (ElevenLabs), embeddings and real-time speech translation (Gemini Live) without shipping any third-party API key.",
5
5
  "keywords": [
6
6
  "ai",
package/src/index.d.ts CHANGED
@@ -543,6 +543,12 @@ export interface AiflowConfig {
543
543
  /** Real-time translate models, when configured. */
544
544
  translate?: string[];
545
545
  };
546
+ /**
547
+ * The STORED default per feature, verbatim. On a module whose owner chose
548
+ * "User Selection" this is the `__user_selection__` sentinel, NOT a model
549
+ * id — never send it as a request `model` and never preselect it in a
550
+ * dropdown. Use `resolvedDefaults` for that.
551
+ */
546
552
  defaults: {
547
553
  chat: string;
548
554
  image: string;
@@ -553,6 +559,34 @@ export interface AiflowConfig {
553
559
  /** Default real-time translate model, when configured. */
554
560
  translate?: string;
555
561
  };
562
+ /**
563
+ * The EFFECTIVE model per feature — always a real, callable id, with the
564
+ * "User Selection" sentinel already resolved. This is what runs when a
565
+ * request omits `model`, and what an end-user model picker should
566
+ * preselect. Absent on gateways older than the field.
567
+ */
568
+ resolvedDefaults?: {
569
+ chat: string;
570
+ image: string;
571
+ embed: string;
572
+ video: string;
573
+ audio: string;
574
+ sfx: string;
575
+ translate: string;
576
+ };
577
+ /**
578
+ * This module's own feature — use it to index `models`, `defaults`,
579
+ * `resolvedDefaults` and `userSelectable` without hardcoding a key.
580
+ */
581
+ feature?: string | null;
582
+ /**
583
+ * True when this module's default model is "User Selection": nothing is
584
+ * pinned and the app should render a model picker sourced from
585
+ * `models[feature]`, seeded from `resolvedDefaults[feature]`.
586
+ */
587
+ modelUserSelectable?: boolean;
588
+ /** Per-feature form of `modelUserSelectable`. */
589
+ userSelectable?: Record<string, boolean>;
556
590
  limits: {
557
591
  maxTokens: number;
558
592
  maxImageN: number;
package/src/index.js CHANGED
@@ -236,7 +236,14 @@ export class AIFlowClient {
236
236
  const userOverride = this._userDefaults[kind];
237
237
  if (userOverride) return userOverride;
238
238
  const cfg = await this.getConfig();
239
- return cfg.defaults[kind];
239
+ // `resolvedDefaults` is the EFFECTIVE model: `defaults` reports the
240
+ // stored value verbatim, so on a module whose owner chose "User
241
+ // Selection" it is the `__user_selection__` sentinel — not a model.
242
+ // Sending that does not fail loudly; the gateway reads it as "no model
243
+ // specified" and substitutes its own default, so the request silently
244
+ // runs on something the caller never saw. Fall back to `defaults` only
245
+ // for a gateway too old to send the resolved map.
246
+ return cfg.resolvedDefaults?.[kind] ?? cfg.defaults[kind];
240
247
  }
241
248
 
242
249
  /**