@axiom-lattice/local-stores 3.2.12 → 3.2.13

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/dist/index.mjs CHANGED
@@ -2523,6 +2523,7 @@ CREATE TABLE IF NOT EXISTS lt_model_provider_models (
2523
2523
  upstream_created TEXT,
2524
2524
  enabled INTEGER NOT NULL DEFAULT 1,
2525
2525
  stale INTEGER NOT NULL DEFAULT 0,
2526
+ kind TEXT NOT NULL DEFAULT 'chat',
2526
2527
  raw TEXT,
2527
2528
  discovered_at TEXT NOT NULL,
2528
2529
  PRIMARY KEY (tenant_id, provider_id, model_id)
@@ -2544,6 +2545,11 @@ var LocalModelProviderStore = class {
2544
2545
  "stale",
2545
2546
  "stale INTEGER NOT NULL DEFAULT 0"
2546
2547
  );
2548
+ this.ensureColumn(
2549
+ "lt_model_provider_models",
2550
+ "kind",
2551
+ "kind TEXT NOT NULL DEFAULT 'chat'"
2552
+ );
2547
2553
  }
2548
2554
  /** Add a column if it does not exist (SQLite version compatible). */
2549
2555
  ensureColumn(table, column, ddl2) {
@@ -2706,7 +2712,7 @@ var LocalModelProviderStore = class {
2706
2712
  const current = new Map(
2707
2713
  (await this.listModels(tenantId, providerId)).map((model) => [
2708
2714
  model.modelId,
2709
- model.enabled
2715
+ model
2710
2716
  ])
2711
2717
  );
2712
2718
  const placeholders = rows2.map(() => "?").join(", ");
@@ -2718,8 +2724,8 @@ var LocalModelProviderStore = class {
2718
2724
  this.db.prepare(
2719
2725
  `INSERT INTO lt_model_provider_models (
2720
2726
  id, tenant_id, provider_id, model_id, display_name, owned_by,
2721
- upstream_created, raw, enabled, stale, discovered_at
2722
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2727
+ upstream_created, raw, enabled, stale, kind, discovered_at
2728
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2723
2729
  ON CONFLICT (tenant_id, provider_id, model_id) DO UPDATE SET
2724
2730
  display_name = excluded.display_name,
2725
2731
  owned_by = excluded.owned_by,
@@ -2727,6 +2733,7 @@ var LocalModelProviderStore = class {
2727
2733
  raw = excluded.raw,
2728
2734
  enabled = excluded.enabled,
2729
2735
  stale = excluded.stale,
2736
+ kind = excluded.kind,
2730
2737
  discovered_at = excluded.discovered_at`
2731
2738
  ).run(
2732
2739
  `${providerId}:${model.id}`,
@@ -2737,8 +2744,10 @@ var LocalModelProviderStore = class {
2737
2744
  model.ownedBy || null,
2738
2745
  model.createdAt || null,
2739
2746
  model.raw === void 0 ? null : JSON.stringify(model.raw),
2740
- model.enabled ?? current.get(model.id) ?? true ? 1 : 0,
2747
+ model.enabled ?? current.get(model.id)?.enabled ?? true ? 1 : 0,
2741
2748
  model.stale ? 1 : 0,
2749
+ // Omitted means "keep the stored kind"; a new row starts as chat.
2750
+ model.kind ?? current.get(model.id)?.kind ?? "chat",
2742
2751
  now
2743
2752
  );
2744
2753
  }
@@ -2798,6 +2807,7 @@ function mapRowToModel(row) {
2798
2807
  upstreamCreatedAt: row.upstream_created ? parseISO(row.upstream_created) : void 0,
2799
2808
  enabled: row.enabled === 1,
2800
2809
  stale: row.stale === 1,
2810
+ kind: row.kind || "chat",
2801
2811
  discoveredAt: parseISO(row.discovered_at)
2802
2812
  };
2803
2813
  }