@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/local-stores",
3
- "version": "3.2.12",
3
+ "version": "3.2.13",
4
4
  "description": "Local SQLite-based stores for Axiom Lattice framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,8 +25,8 @@
25
25
  "@types/sql.js": "^1.4.11",
26
26
  "sql.js": "^1.14.1",
27
27
  "uuid": "^14.0.1",
28
- "@axiom-lattice/core": "8.0.2",
29
- "@axiom-lattice/protocols": "4.10.0"
28
+ "@axiom-lattice/core": "8.1.0",
29
+ "@axiom-lattice/protocols": "4.11.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/jest": "^29.5.14",
@@ -11,6 +11,7 @@ import type {
11
11
  ModelProviderWireProtocol,
12
12
  ModelProviderApiStyle,
13
13
  ModelProviderLlmProvider,
14
+ ModelKind,
14
15
  CreateModelProviderRequest,
15
16
  UpdateModelProviderRequest,
16
17
  ProviderModelInput,
@@ -52,6 +53,7 @@ CREATE TABLE IF NOT EXISTS lt_model_provider_models (
52
53
  upstream_created TEXT,
53
54
  enabled INTEGER NOT NULL DEFAULT 1,
54
55
  stale INTEGER NOT NULL DEFAULT 0,
56
+ kind TEXT NOT NULL DEFAULT 'chat',
55
57
  raw TEXT,
56
58
  discovered_at TEXT NOT NULL,
57
59
  PRIMARY KEY (tenant_id, provider_id, model_id)
@@ -90,6 +92,7 @@ interface ModelRow {
90
92
  upstream_created: string | null;
91
93
  enabled: number;
92
94
  stale: number;
95
+ kind: string;
93
96
  discovered_at: string;
94
97
  }
95
98
 
@@ -118,6 +121,11 @@ export class LocalModelProviderStore implements ModelProviderStore {
118
121
  "stale",
119
122
  "stale INTEGER NOT NULL DEFAULT 0"
120
123
  );
124
+ this.ensureColumn(
125
+ "lt_model_provider_models",
126
+ "kind",
127
+ "kind TEXT NOT NULL DEFAULT 'chat'"
128
+ );
121
129
  }
122
130
 
123
131
  /** Add a column if it does not exist (SQLite version compatible). */
@@ -372,7 +380,7 @@ export class LocalModelProviderStore implements ModelProviderStore {
372
380
  const current = new Map(
373
381
  (await this.listModels(tenantId, providerId)).map((model) => [
374
382
  model.modelId,
375
- model.enabled,
383
+ model,
376
384
  ])
377
385
  );
378
386
 
@@ -389,8 +397,8 @@ export class LocalModelProviderStore implements ModelProviderStore {
389
397
  .prepare(
390
398
  `INSERT INTO lt_model_provider_models (
391
399
  id, tenant_id, provider_id, model_id, display_name, owned_by,
392
- upstream_created, raw, enabled, stale, discovered_at
393
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
400
+ upstream_created, raw, enabled, stale, kind, discovered_at
401
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
394
402
  ON CONFLICT (tenant_id, provider_id, model_id) DO UPDATE SET
395
403
  display_name = excluded.display_name,
396
404
  owned_by = excluded.owned_by,
@@ -398,6 +406,7 @@ export class LocalModelProviderStore implements ModelProviderStore {
398
406
  raw = excluded.raw,
399
407
  enabled = excluded.enabled,
400
408
  stale = excluded.stale,
409
+ kind = excluded.kind,
401
410
  discovered_at = excluded.discovered_at`
402
411
  )
403
412
  .run(
@@ -409,8 +418,10 @@ export class LocalModelProviderStore implements ModelProviderStore {
409
418
  model.ownedBy || null,
410
419
  model.createdAt || null,
411
420
  model.raw === undefined ? null : JSON.stringify(model.raw),
412
- model.enabled ?? current.get(model.id) ?? true ? 1 : 0,
421
+ model.enabled ?? current.get(model.id)?.enabled ?? true ? 1 : 0,
413
422
  model.stale ? 1 : 0,
423
+ // Omitted means "keep the stored kind"; a new row starts as chat.
424
+ model.kind ?? current.get(model.id)?.kind ?? "chat",
414
425
  now
415
426
  );
416
427
  }
@@ -496,6 +507,7 @@ function mapRowToModel(row: ModelRow): ModelProviderModelEntry {
496
507
  : undefined,
497
508
  enabled: row.enabled === 1,
498
509
  stale: row.stale === 1,
510
+ kind: (row.kind as ModelKind) || "chat",
499
511
  discoveredAt: parseISO(row.discovered_at),
500
512
  };
501
513
  }