@axiom-lattice/pg-stores 3.3.11 → 3.3.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +24 -0
- package/dist/index.js +45 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/PGVectorStoreProvider.ts +19 -13
- package/src/createPgStoreConfig.ts +2 -0
- package/src/migrations/model_provider_migrations.ts +27 -0
- package/src/stores/PostgreSQLModelProviderStore.ts +25 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/pg-stores@3.3.
|
|
2
|
+
> @axiom-lattice/pg-stores@3.3.13 build /home/runner/work/agentic/agentic/packages/pg-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m438.60 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m820.28 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 879ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m447.25 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m820.59 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 880ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 11763ms
|
|
19
19
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m93.45 KB[39m
|
|
20
20
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m93.45 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 3.3.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b0d43d4: Tenant model providers can now offer chat, embedding and speech-to-text models from one catalog, and every model-provider or collection change takes effect without a gateway restart.
|
|
8
|
+
|
|
9
|
+
`ModelKind` (`chat` / `embedding` / `asr`) is stored on the model row rather than the provider, because one provider is one credential and one base URL and a single OpenAI-compatible endpoint commonly serves all three. Each kind keeps its own runtime lattice and lazily materialises its client from the shared store, so a tenant model resolves on every replica without replica-to-replica synchronisation. A loader guard keeps a chat consumer from ever resolving an embedding or ASR row, and the tenant default model remains chat-only.
|
|
10
|
+
|
|
11
|
+
The provider panel exposes the kind per model, offers a per-model thinking toggle (stored as `extra.disableThinking`, translated to the upstream kwargs by core), and can run one embedding inference to prove a model works and report its vector dimension. Collection and voice pickers now read the tenant catalog and fall back to the deployment's boot-registered models.
|
|
12
|
+
|
|
13
|
+
Invalidation is now uniform across kinds: a provider change evicts chat, embedding and ASR clients on every replica, and a collection change — including a new `embeddingKey` — drops the cached vector stores it invalidated, locally and across replicas through the outbox.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [b0d43d4]
|
|
16
|
+
- Updated dependencies [c57f417]
|
|
17
|
+
- @axiom-lattice/protocols@4.11.0
|
|
18
|
+
- @axiom-lattice/core@8.1.0
|
|
19
|
+
|
|
20
|
+
## 3.3.12
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [8c20011]
|
|
25
|
+
- @axiom-lattice/core@8.0.2
|
|
26
|
+
|
|
3
27
|
## 3.3.11
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -9600,19 +9600,18 @@ var PGVectorStoreProvider = class {
|
|
|
9600
9600
|
}
|
|
9601
9601
|
async create(params) {
|
|
9602
9602
|
const { tableName, embeddingKey } = params;
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
}
|
|
9603
|
+
const tenantId = params.tenantId ?? "default";
|
|
9604
|
+
const embeddings = await import_core7.embeddingsLatticeManager.getEmbeddingsClientWithTenant(
|
|
9605
|
+
tenantId,
|
|
9606
|
+
embeddingKey
|
|
9607
|
+
) ?? await import_core7.embeddingsLatticeManager.getEmbeddingsClientWithTenant(
|
|
9608
|
+
tenantId,
|
|
9609
|
+
"default"
|
|
9610
|
+
);
|
|
9611
|
+
if (!embeddings) {
|
|
9612
|
+
throw new Error(
|
|
9613
|
+
`No embedding model "${embeddingKey}" registered for tenant "${tenantId}", and no deployment default. Configure one in the model provider panel.`
|
|
9614
|
+
);
|
|
9616
9615
|
}
|
|
9617
9616
|
return import_pgvector.PGVectorStore.initialize(embeddings, {
|
|
9618
9617
|
postgresConnectionOptions: { connectionString: this.connectionString },
|
|
@@ -10472,6 +10471,21 @@ var addModelProviderModelDefault = {
|
|
|
10472
10471
|
`);
|
|
10473
10472
|
}
|
|
10474
10473
|
};
|
|
10474
|
+
var addModelProviderModelKind = {
|
|
10475
|
+
version: 193,
|
|
10476
|
+
name: "add_model_provider_model_kind",
|
|
10477
|
+
up: async (client) => {
|
|
10478
|
+
await client.query(`
|
|
10479
|
+
ALTER TABLE lattice_model_provider_models
|
|
10480
|
+
ADD COLUMN IF NOT EXISTS kind VARCHAR(16) NOT NULL DEFAULT 'chat'
|
|
10481
|
+
`);
|
|
10482
|
+
},
|
|
10483
|
+
down: async (client) => {
|
|
10484
|
+
await client.query(`
|
|
10485
|
+
ALTER TABLE lattice_model_provider_models DROP COLUMN IF EXISTS kind
|
|
10486
|
+
`);
|
|
10487
|
+
}
|
|
10488
|
+
};
|
|
10475
10489
|
|
|
10476
10490
|
// src/stores/PostgreSQLCapabilityBundleStore.ts
|
|
10477
10491
|
var import_crypto4 = require("crypto");
|
|
@@ -11465,6 +11479,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11465
11479
|
this.migrationManager.register(addModelProviderModelStale);
|
|
11466
11480
|
this.migrationManager.register(addModelProviderModelExtra);
|
|
11467
11481
|
this.migrationManager.register(addModelProviderModelDefault);
|
|
11482
|
+
this.migrationManager.register(addModelProviderModelKind);
|
|
11468
11483
|
if (options.autoMigrate !== false) {
|
|
11469
11484
|
this.initialize().catch((error) => {
|
|
11470
11485
|
console.error("Failed to initialize PostgreSQLModelProviderStore:", error);
|
|
@@ -11711,7 +11726,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11711
11726
|
const result = providerId ? await this.pool.query(
|
|
11712
11727
|
`
|
|
11713
11728
|
SELECT id, tenant_id, provider_id, model_id, display_name, owned_by,
|
|
11714
|
-
upstream_created, enabled, stale, extra, is_default, discovered_at
|
|
11729
|
+
upstream_created, enabled, stale, extra, kind, is_default, discovered_at
|
|
11715
11730
|
FROM lattice_model_provider_models
|
|
11716
11731
|
WHERE tenant_id = $1 AND provider_id = $2
|
|
11717
11732
|
ORDER BY model_id ASC
|
|
@@ -11720,7 +11735,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11720
11735
|
) : await this.pool.query(
|
|
11721
11736
|
`
|
|
11722
11737
|
SELECT id, tenant_id, provider_id, model_id, display_name, owned_by,
|
|
11723
|
-
upstream_created, enabled, stale, extra, is_default, discovered_at
|
|
11738
|
+
upstream_created, enabled, stale, extra, kind, is_default, discovered_at
|
|
11724
11739
|
FROM lattice_model_provider_models
|
|
11725
11740
|
WHERE tenant_id = $1
|
|
11726
11741
|
ORDER BY model_id ASC
|
|
@@ -11739,7 +11754,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11739
11754
|
const result = await this.pool.query(
|
|
11740
11755
|
`
|
|
11741
11756
|
SELECT id, tenant_id, provider_id, model_id, display_name, owned_by,
|
|
11742
|
-
upstream_created, enabled, stale, extra, is_default, discovered_at
|
|
11757
|
+
upstream_created, enabled, stale, extra, kind, is_default, discovered_at
|
|
11743
11758
|
FROM lattice_model_provider_models
|
|
11744
11759
|
WHERE tenant_id = $1 AND provider_id = $2 AND model_id = $3
|
|
11745
11760
|
`,
|
|
@@ -11772,7 +11787,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11772
11787
|
await client.query("BEGIN");
|
|
11773
11788
|
const current = await client.query(
|
|
11774
11789
|
`
|
|
11775
|
-
SELECT model_id, enabled, extra, is_default FROM lattice_model_provider_models
|
|
11790
|
+
SELECT model_id, enabled, extra, kind, is_default FROM lattice_model_provider_models
|
|
11776
11791
|
WHERE tenant_id = $1 AND provider_id = $2
|
|
11777
11792
|
`,
|
|
11778
11793
|
[tenantId, providerId]
|
|
@@ -11783,6 +11798,9 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11783
11798
|
const currentExtra = new Map(
|
|
11784
11799
|
current.rows.map((row) => [row.model_id, row.extra])
|
|
11785
11800
|
);
|
|
11801
|
+
const currentKind = new Map(
|
|
11802
|
+
current.rows.map((row) => [row.model_id, row.kind])
|
|
11803
|
+
);
|
|
11786
11804
|
const currentIsDefault = new Map(
|
|
11787
11805
|
current.rows.map((row) => [row.model_id, row.is_default])
|
|
11788
11806
|
);
|
|
@@ -11797,6 +11815,9 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11797
11815
|
const effectiveExtra = rows.map(
|
|
11798
11816
|
(model) => model.extra ?? currentExtra.get(model.id) ?? {}
|
|
11799
11817
|
);
|
|
11818
|
+
const effectiveKind = rows.map(
|
|
11819
|
+
(model) => model.kind ?? currentKind.get(model.id) ?? "chat"
|
|
11820
|
+
);
|
|
11800
11821
|
const namesDefault = rows.some((model) => model.isDefault === true);
|
|
11801
11822
|
if (namesDefault) {
|
|
11802
11823
|
await client.query(
|
|
@@ -11833,15 +11854,15 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11833
11854
|
`
|
|
11834
11855
|
INSERT INTO lattice_model_provider_models (
|
|
11835
11856
|
id, tenant_id, provider_id, model_id, display_name, owned_by,
|
|
11836
|
-
upstream_created, raw, enabled, stale, extra, is_default, discovered_at
|
|
11857
|
+
upstream_created, raw, enabled, stale, extra, kind, is_default, discovered_at
|
|
11837
11858
|
)
|
|
11838
11859
|
SELECT * FROM unnest(
|
|
11839
11860
|
$1::text[], $2::text[], $3::text[], $4::text[], $5::text[],
|
|
11840
11861
|
$6::text[], $7::timestamp[], $8::jsonb[], $9::boolean[], $10::boolean[],
|
|
11841
|
-
$11::jsonb[], $12::
|
|
11862
|
+
$11::jsonb[], $12::text[], $13::boolean[], $14::timestamp[]
|
|
11842
11863
|
) AS t(
|
|
11843
11864
|
id, tenant_id, provider_id, model_id, display_name, owned_by,
|
|
11844
|
-
upstream_created, raw, enabled, stale, extra, is_default, discovered_at
|
|
11865
|
+
upstream_created, raw, enabled, stale, extra, kind, is_default, discovered_at
|
|
11845
11866
|
)
|
|
11846
11867
|
ON CONFLICT (tenant_id, provider_id, model_id) DO UPDATE SET
|
|
11847
11868
|
display_name = EXCLUDED.display_name,
|
|
@@ -11851,6 +11872,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11851
11872
|
enabled = EXCLUDED.enabled,
|
|
11852
11873
|
stale = EXCLUDED.stale,
|
|
11853
11874
|
extra = EXCLUDED.extra,
|
|
11875
|
+
kind = EXCLUDED.kind,
|
|
11854
11876
|
is_default = EXCLUDED.is_default,
|
|
11855
11877
|
discovered_at = EXCLUDED.discovered_at
|
|
11856
11878
|
`,
|
|
@@ -11870,6 +11892,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11870
11892
|
effectiveEnabled,
|
|
11871
11893
|
rows.map((model) => model.stale ?? false),
|
|
11872
11894
|
effectiveExtra.map((extra) => JSON.stringify(extra)),
|
|
11895
|
+
effectiveKind,
|
|
11873
11896
|
effectiveIsDefault,
|
|
11874
11897
|
rows.map(() => (/* @__PURE__ */ new Date()).toISOString())
|
|
11875
11898
|
]
|
|
@@ -11976,6 +11999,7 @@ var PostgreSQLModelProviderStore = class {
|
|
|
11976
11999
|
enabled: row.enabled,
|
|
11977
12000
|
stale: row.stale,
|
|
11978
12001
|
extra: extraOrUndefined(row.extra),
|
|
12002
|
+
kind: row.kind || "chat",
|
|
11979
12003
|
isDefault: row.is_default,
|
|
11980
12004
|
discoveredAt: row.discovered_at
|
|
11981
12005
|
};
|
|
@@ -12406,6 +12430,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
12406
12430
|
mm.register(dropPluginDeploymentAuthToken);
|
|
12407
12431
|
mm.register(addModelProviderModelExtra);
|
|
12408
12432
|
mm.register(addModelProviderModelDefault);
|
|
12433
|
+
mm.register(addModelProviderModelKind);
|
|
12409
12434
|
await mm.migrate();
|
|
12410
12435
|
const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
|
|
12411
12436
|
checkpoint.setup().catch((err) => {
|