@talkpilot/core-db 1.3.36 → 1.3.38

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.
Files changed (55) hide show
  1. package/README.md +112 -1
  2. package/dist/configuration/index.d.ts +2 -0
  3. package/dist/configuration/index.d.ts.map +1 -1
  4. package/dist/configuration/index.js +2 -0
  5. package/dist/configuration/index.js.map +1 -1
  6. package/dist/configuration/internalModels/index.d.ts +4 -0
  7. package/dist/configuration/internalModels/index.d.ts.map +1 -0
  8. package/dist/configuration/internalModels/index.js +21 -0
  9. package/dist/configuration/internalModels/index.js.map +1 -0
  10. package/dist/configuration/internalModels/internalModels.constants.d.ts +2 -0
  11. package/dist/configuration/internalModels/internalModels.constants.d.ts.map +1 -0
  12. package/dist/configuration/internalModels/internalModels.constants.js +5 -0
  13. package/dist/configuration/internalModels/internalModels.constants.js.map +1 -0
  14. package/dist/configuration/internalModels/internalModels.getters.d.ts +16 -0
  15. package/dist/configuration/internalModels/internalModels.getters.d.ts.map +1 -0
  16. package/dist/configuration/internalModels/internalModels.getters.js +31 -0
  17. package/dist/configuration/internalModels/internalModels.getters.js.map +1 -0
  18. package/dist/configuration/internalModels/internalModels.types.d.ts +12 -0
  19. package/dist/configuration/internalModels/internalModels.types.d.ts.map +1 -0
  20. package/dist/configuration/internalModels/internalModels.types.js +3 -0
  21. package/dist/configuration/internalModels/internalModels.types.js.map +1 -0
  22. package/dist/configuration/models/index.d.ts +4 -0
  23. package/dist/configuration/models/index.d.ts.map +1 -0
  24. package/dist/configuration/models/index.js +16 -0
  25. package/dist/configuration/models/index.js.map +1 -0
  26. package/dist/configuration/models/models.constants.d.ts +5 -0
  27. package/dist/configuration/models/models.constants.d.ts.map +1 -0
  28. package/dist/configuration/models/models.constants.js +15 -0
  29. package/dist/configuration/models/models.constants.js.map +1 -0
  30. package/dist/configuration/models/models.getters.d.ts +21 -0
  31. package/dist/configuration/models/models.getters.d.ts.map +1 -0
  32. package/dist/configuration/models/models.getters.js +44 -0
  33. package/dist/configuration/models/models.getters.js.map +1 -0
  34. package/dist/configuration/models/models.types.d.ts +68 -0
  35. package/dist/configuration/models/models.types.d.ts.map +1 -0
  36. package/dist/configuration/models/models.types.js +3 -0
  37. package/dist/configuration/models/models.types.js.map +1 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/talkpilot/calls/calls.types.d.ts +1 -0
  43. package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/src/configuration/index.ts +2 -0
  46. package/src/configuration/internalModels/index.ts +3 -0
  47. package/src/configuration/internalModels/internalModels.constants.ts +1 -0
  48. package/src/configuration/internalModels/internalModels.getters.ts +33 -0
  49. package/src/configuration/internalModels/internalModels.types.ts +12 -0
  50. package/src/configuration/models/index.ts +25 -0
  51. package/src/configuration/models/models.constants.ts +13 -0
  52. package/src/configuration/models/models.getters.ts +53 -0
  53. package/src/configuration/models/models.types.ts +79 -0
  54. package/src/index.ts +2 -0
  55. package/src/talkpilot/calls/calls.types.ts +1 -0
package/README.md CHANGED
@@ -17,6 +17,7 @@ L1:# @talkpilot/core-db
17
17
  - **Test helpers** – `src/test-utils/` plus `src/__tests__/` reuse `MongoMemoryServer` and shared factories so tests start with clean data regardless of the consuming repo.
18
18
  - **Utility layers** – `src/utils/` contains shared validation, pagination, and environment helpers that complement the getters.
19
19
  - **Bulk-write helpers** – `src/bulkWrite/` exposes small, domain-agnostic functions (`buildSetOp`, `buildUpsertOp`, `buildInsertOp`, `buildDeleteOp`) that construct correctly-shaped MongoDB bulk-write operations from a filter and field values — no collection- or domain-specific knowledge required.
20
+ - **Configuration domain** – `src/configuration/` hosts the `configuration` database (a `prompts` collection so far) — a place for cross-service settings that used to be hardcoded in consuming repos, editable without a deploy.
20
21
  - **Environment awareness** – Defaults, fallbacks, and `process.env` lookups ensure local, CI, and Cloud Run clients all connect using the right URI/DB names.
21
22
 
22
23
  ## Key Components
@@ -26,6 +27,8 @@ L1:# @talkpilot/core-db
26
27
  - `src/municipal/` – Municipal-specific collections (`cities`, `streets`, `departmentsSubjects`, `tickets`, etc.) plus vector search helpers and Ash Bina helpers used by MIS.
27
28
  - `src/utils/` – Shared helpers such as `resolveConnection`, pagination utilities, and schema validation helper functions.
28
29
  - `src/bulkWrite/` – Generic bulk-write op constructors (`buildSetOp`, `buildUpsertOp`, `buildInsertOp`, `buildDeleteOp`) usable with any collection's document type.
30
+ - `src/configuration/` – `configurationMongodbClient` plus the `prompts` collection (`Prompt` type, `getPromptByName`, `findPrompts`, `getAllPrompts`, `getPromptsByProduct`).
31
+ - `src/config.ts` – Centralized `process.env` reads for the configuration domain — add new env-backed fields here instead of reading `process.env` inline elsewhere.
29
32
  - `src/test-utils/` and `src/__tests__/` – Utilities that bootstrap `MongoMemoryServer`, expose factories, and make sure Jest environments can stub database calls predictably.
30
33
  - `dist/` – Compiled output consumed by downstream repos (CJS + ESM + type defs).
31
34
 
@@ -33,6 +36,7 @@ L1:# @talkpilot/core-db
33
36
 
34
37
  - **TalkPilot domain** – Imports like `findAgents`, `getFlows`, `findCalls`, and `vectorSearchCalls` live in `src/talkpilot`. These functions are the canonical access pattern for call history, session metadata, and provider configs.
35
38
  - **Municipal domain** – Helpers such as `findStreets`, `getMunicipalCities`, `findDepartmentSubjects`, and `createTicket` live under `src/municipal` and feed MIS workflows (street hints, subject matching, Ash Bina tickets).
39
+ - **Configuration domain** – `getPromptByName`, `findPrompts`, `getAllPrompts`, and `getPromptsByProduct` live under `src/configuration` and back MIS's `moked_106` prompt lookups (defaults, overridable per-client via `clientConfig.toolsPrompts`).
36
40
 
37
41
  ## Environment variables
38
42
 
@@ -42,6 +46,7 @@ L1:# @talkpilot/core-db
42
46
  | `MONGODB_URI` | Alternate connection string used when Mongo needs a second URI parameter. | ✅ |
43
47
  | `TALKPILOT_DB_NAME` | Optional override for the TalkPilot database name (defaults from URI path). | ❌ |
44
48
  | `MUNICIPAL_DB_NAME` | Optional override for the municipal database name (defaults to `municipal-data`). | ❌ |
49
+ | `CONFIGURATION_DB_NAME` | Optional override for the configuration database name (defaults to `configuration`). | ❌ |
45
50
  | `ENV` | Free-form label used in logs/validators (defaults to `unknown`). | ❌ |
46
51
 
47
52
  If you pass a `uri` directly to `mongodbClient.connect()` or `municipalDataMongodbClient.connect()`, the client will prefer that value over the env vars.
@@ -78,10 +83,11 @@ If you pass a `uri` directly to `mongodbClient.connect()` or `municipalDataMongo
78
83
  MONGO_URI=mongodb://localhost:27017
79
84
  TALKPILOT_DB_NAME=talkpilot-dev
80
85
  MUNICIPAL_DB_NAME=municipal-dev
86
+ CONFIGURATION_DB_NAME=configuration-dev
81
87
  ENV=development
82
88
  ```
83
89
 
84
- Adjust `MONGO_URI` to match the running Mongo instance and configure `talkpilot`/`municipal` DB names if you want to keep them separate.
90
+ Adjust `MONGO_URI` to match the running Mongo instance and configure `talkpilot`/`municipal`/`configuration` DB names if you want to keep them separate.
85
91
 
86
92
  ## Local development
87
93
 
@@ -162,6 +168,11 @@ Refer to `DEVELOPMENT.md` for the full walkthrough, token instructions, and fact
162
168
  | 1.3.28 | Soft-delete (`isActive`) on Streets/DepartmentSubjects, new bulk-write getters, MongoDB type re-exports, and the generic `bulkWrite` op-builder module. |
163
169
  | 1.3.29 | Added client call-quota module (CP-1500): `ClientConfig.quota` for usage limits (`totalQuota`, `usedQuota`, `expiresAt`), alert settings on `clients`, and getters for state, increment/reset, threshold alerts, and expiry notification tracking. |
164
170
  | 1.3.32 | `clientDisplayName` lives on `clientsConfig.quota` (not top-level). `getClientDisplayName` returns `"-"` when unset; never exposes `clientId`. |
171
+ | 1.3.33 | Added `configuration` database module (CP-1560): `configurationMongodbClient` + a read-only `Prompts`-style collection for prompts previously hardcoded in consuming repos (e.g. MIS). |
172
+ | 1.3.35 | Fixed the configuration collection name (`Prompts` → `prompts`, matches the lowercase convention used elsewhere). **Breaking** if you inserted documents into a collection literally named `Prompts`. Added `Prompt.productName` (required) + `getPromptsByProduct`. Centralized configuration-DB env var reads into `src/config.ts`. |
173
+ | 1.3.36 | Publish combining the 1.3.33/1.3.35 configuration-DB work with the latest `main` (client quota + `clientDisplayName` + bulk-write/streets/departmentSubjects updates — see 1.3.28/1.3.29/1.3.32). No new code of its own. |
174
+ | 1.3.37 | Added `models` and `internalModels` collections under `configuration` (CP-1624): realtime/stt model catalog (`ModelDoc`, `getModelByModelId`, `getModelsByProvider`, `getModelsByType`, `getAvailableModelsByType`) and a name-keyed settings store (`InternalModel`, `getInternalModelByName`) for cross-service config previously hardcoded in consuming repos (e.g. TalkPilot Server's realtime/STT catalogs and its live transcription model). Read-only, same as `prompts` — documents are seeded/managed manually. |
175
+ | 1.3.38 | Added optional `transcriptionComparison` field to `Call` (CP-1594): per-`{provider}-{model}` side-channel transcription comparison results, same segment shape as `Call.transcription`. |
165
176
 
166
177
  ### 1.1.9
167
178
 
@@ -598,6 +609,106 @@ Optional human-readable account label stored on `clientsConfig.quota` for quota
598
609
 
599
610
  No — purely additive. Set `clientsConfig.quota.clientDisplayName` when provisioning quota for a client. **TalkPilot Server** should upgrade to **1.3.32** (or later) to use the label in quota emails.
600
611
 
612
+ ### 1.3.33 — Configuration database & Prompts collection (CP-1560)
613
+
614
+ New `configuration` database with a prompts collection, so prompts previously hardcoded in consuming repos (e.g. MIS's `moked_106` street/subject search and transcription prompts) can be stored centrally and edited without a deploy. Ships the **read** path only — documents are seeded/managed manually (e.g. via Compass), not through this package.
615
+
616
+ **Added**
617
+
618
+ | Export | Purpose |
619
+ | --- | --- |
620
+ | `configurationMongodbClient` | MongoDB client for the `configuration` database (default name `configuration`, override with `CONFIGURATION_DB_NAME`). |
621
+ | `getConfigurationDb` / `setConfigurationDb` / `ConfigurationObjectId` | DB handle accessors and `ObjectId`, matching the other domains. |
622
+ | `Prompt` | Document type: `{ _id, name, content, createdAt, updatedAt }`, keyed by unique `name`. |
623
+ | `getPromptByName(name)` | Fetch a single prompt by its unique `name`. Returns `null` if absent. |
624
+ | `findPrompts(filter?)` | Flexible query over the collection. |
625
+ | `getAllPrompts()` | Fetch every prompt. |
626
+ | `getPromptsCollection()` | Raw collection access. |
627
+
628
+ `ensureDbConnected()` / `disconnectDb()` now also connect/disconnect the configuration client alongside talkpilot/municipal/websitalk.
629
+
630
+ **Do I need to update my app?**
631
+
632
+ No — purely additive. Consumers opt in by importing the getters above.
633
+
634
+ ### 1.3.35 — Prompts fixes: collection name, `productName`, centralized config
635
+
636
+ **Breaking**
637
+
638
+ | Changed | What |
639
+ | --- | --- |
640
+ | Collection name | `"Prompts"` → `"prompts"` (lowercase, matching every other collection in core-db). MongoDB collection names are case-sensitive — if you inserted documents into a collection literally named `Prompts` under 1.3.33, move them to `prompts`. |
641
+
642
+ **Added**
643
+
644
+ | Export | Purpose |
645
+ | --- | --- |
646
+ | `Prompt.productName` | Required `KnownProductKey` (`"municipal" \| "clinics" \| "websiteTalk"`). Existing documents need this field backfilled. |
647
+ | `getPromptsByProduct(productName)` | Fetch all prompts for a given product. |
648
+
649
+ **Internal**
650
+
651
+ - Configuration-DB env var reads (`MONGO_URI`, `MONGODB_URI`, `CONFIGURATION_DB_NAME`) centralized into `src/config.ts` (`configurationDbConfig`) — no consumer-facing change.
652
+
653
+ **Do I need to update my app?**
654
+
655
+ Only if you inserted documents into the old `Prompts` (capital P) collection — move them to `prompts`. Also backfill `productName` on any existing prompt documents (e.g. `"municipal"`), since it's now a required field on the type.
656
+
657
+ ### 1.3.36 — Merge with `main`
658
+
659
+ Publishes the 1.3.33/1.3.35 configuration-DB work alongside the latest `main` — client call-quota, `clientDisplayName`, and bulk-write/streets/departmentSubjects updates (see 1.3.28, 1.3.29, 1.3.32). No new code of its own; this version exists to ship both branches' work together.
660
+
661
+ **Do I need to update my app?**
662
+
663
+ No — purely additive, same as the versions it combines.
664
+
665
+ ### 1.3.37 — Model catalog & internal model settings (CP-1624)
666
+
667
+ New `models` and `internalModels` collections under the `configuration` database, so AI model catalogs and cross-service settings previously hardcoded in consuming repos (e.g. TalkPilot Server's realtime/STT model lists and its live transcription model) can be stored centrally and edited without a deploy. Ships the **read** path only, same as `prompts` — documents are seeded/managed manually (e.g. via Compass).
668
+
669
+ **Added — `models`**
670
+
671
+ | Export | Purpose |
672
+ | --- | --- |
673
+ | `ModelDoc` (`RealtimeModelDoc \| SttModelDoc`) | Document type discriminated by `type`: `{ _id, modelId, name, description?, available, features?, configDefaults?, createdAt, updatedAt }`, plus `provider` (`RealtimeModelProvider` for `type: "realtime"`, `SttModelProvider` for `type: "stt"`). |
674
+ | `MODEL_TYPES`, `REALTIME_MODEL_PROVIDERS`, `STT_MODEL_PROVIDERS` | Known `type`/`provider` value lists the types above are derived from. |
675
+ | `getModelByModelId(modelId, type?)` | Fetch a single model by its `modelId`, optionally scoped to a `type`. |
676
+ | `getModelsByProvider(provider, type?)` | Fetch all models for a given `provider`, optionally scoped to a `type`. |
677
+ | `getModelsByType(type)` | Fetch all models of a given `type`. |
678
+ | `getAvailableModelsByType(type)` | Same as above, pre-filtered to `available: true`. |
679
+ | `findModels(filter?)` | Flexible query over the collection. |
680
+ | `getModelsCollection()` | Raw collection access. |
681
+
682
+ **Added — `internalModels`**
683
+
684
+ | Export | Purpose |
685
+ | --- | --- |
686
+ | `InternalModel` | Document type: `{ _id, name, provider, model, config?, createdAt, updatedAt }`, keyed by unique `name` — e.g. a `"transcriptionModel"` document. |
687
+ | `getInternalModelByName(name)` | Fetch a single internal model config by its unique `name`. Returns `null` if absent. |
688
+ | `findInternalModels(filter?)` | Flexible query over the collection. |
689
+ | `getAllInternalModels()` | Fetch every internal model. |
690
+ | `getInternalModelsCollection()` | Raw collection access. |
691
+
692
+ `ensureDbConnected()` / `disconnectDb()` already covered the configuration client from 1.3.33 — no change there.
693
+
694
+ **Do I need to update my app?**
695
+
696
+ No — purely additive. Consumers opt in by importing the getters above.
697
+
698
+ ### 1.3.38 — Transcription comparison field (CP-1594)
699
+
700
+ Added an optional `transcriptionComparison` field to `Call`, for consumers that run side-channel transcription comparisons across multiple providers/models alongside the real `transcription` field.
701
+
702
+ **Added**
703
+
704
+ | Export | Purpose |
705
+ | --- | --- |
706
+ | `Call.transcriptionComparison` | Optional `Record<string, TranscriptionSegment[]>` — one entry per `{provider}-{model}` key, each an array of `TranscriptionSegment` in the same shape as `Call.transcription`. |
707
+
708
+ **Do I need to update my app?**
709
+
710
+ No — purely additive. Existing documents and consumers continue to work unchanged.
711
+
601
712
  ## 🛠 CI/CD & deployment
602
713
 
603
714
  - This package is consumed by Cloud Build-based services (TalkPilot Server, MIS, CIS) as a dependency when Docker images are built. Keep `dist/` in sync with your builds because the compiled artifact is what downstream services install.
@@ -1,5 +1,7 @@
1
1
  import { Db, ObjectId as MongoObjectId } from "mongodb";
2
2
  export * from "./prompts";
3
+ export * from "./models";
4
+ export * from "./internalModels";
3
5
  export { configurationMongodbClient } from "./mongodb-client";
4
6
  export declare const setDb: (d: Db) => void;
5
7
  export declare const getDb: () => Db;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,eAAO,MAAM,KAAK,GAAI,GAAG,EAAE,SAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,QAAO,EAGxB,CAAC;AACF,eAAO,MAAM,QAAQ,sBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,eAAO,MAAM,KAAK,GAAI,GAAG,EAAE,SAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,QAAO,EAGxB,CAAC;AACF,eAAO,MAAM,QAAQ,sBAAgB,CAAC"}
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.ObjectId = exports.getDb = exports.setDb = exports.configurationMongodbClient = void 0;
18
18
  const mongodb_1 = require("mongodb");
19
19
  __exportStar(require("./prompts"), exports);
20
+ __exportStar(require("./models"), exports);
21
+ __exportStar(require("./internalModels"), exports);
20
22
  var mongodb_client_1 = require("./mongodb-client");
21
23
  Object.defineProperty(exports, "configurationMongodbClient", { enumerable: true, get: function () { return mongodb_client_1.configurationMongodbClient; } });
22
24
  let db;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAwD;AAExD,4CAA0B;AAC1B,mDAA8D;AAArD,4HAAA,0BAA0B,OAAA;AAEnC,IAAI,EAAM,CAAC;AACJ,MAAM,KAAK,GAAG,CAAC,CAAK,EAAE,EAAE;IAC7B,EAAE,GAAG,CAAC,CAAC;AACT,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB;AAEK,MAAM,KAAK,GAAG,GAAO,EAAE;IAC5B,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC7D,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAHW,QAAA,KAAK,SAGhB;AACW,QAAA,QAAQ,GAAG,kBAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAwD;AAExD,4CAA0B;AAC1B,2CAAyB;AACzB,mDAAiC;AACjC,mDAA8D;AAArD,4HAAA,0BAA0B,OAAA;AAEnC,IAAI,EAAM,CAAC;AACJ,MAAM,KAAK,GAAG,CAAC,CAAK,EAAE,EAAE;IAC7B,EAAE,GAAG,CAAC,CAAC;AACT,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB;AAEK,MAAM,KAAK,GAAG,GAAO,EAAE;IAC5B,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC7D,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAHW,QAAA,KAAK,SAGhB;AACW,QAAA,QAAQ,GAAG,kBAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { INTERNAL_MODELS_COLLECTION } from "./internalModels.constants";
2
+ export * from "./internalModels.getters";
3
+ export type { InternalModel } from "./internalModels.types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/internalModels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,cAAc,0BAA0B,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.INTERNAL_MODELS_COLLECTION = void 0;
18
+ var internalModels_constants_1 = require("./internalModels.constants");
19
+ Object.defineProperty(exports, "INTERNAL_MODELS_COLLECTION", { enumerable: true, get: function () { return internalModels_constants_1.INTERNAL_MODELS_COLLECTION; } });
20
+ __exportStar(require("./internalModels.getters"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/configuration/internalModels/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uEAAwE;AAA/D,sIAAA,0BAA0B,OAAA;AACnC,2DAAyC"}
@@ -0,0 +1,2 @@
1
+ export declare const INTERNAL_MODELS_COLLECTION = "internal-models";
2
+ //# sourceMappingURL=internalModels.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalModels.constants.d.ts","sourceRoot":"","sources":["../../../src/configuration/internalModels/internalModels.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,oBAAoB,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INTERNAL_MODELS_COLLECTION = void 0;
4
+ exports.INTERNAL_MODELS_COLLECTION = "internal-models";
5
+ //# sourceMappingURL=internalModels.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalModels.constants.js","sourceRoot":"","sources":["../../../src/configuration/internalModels/internalModels.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Collection, Filter } from "mongodb";
2
+ import { InternalModel } from "./internalModels.types";
3
+ export declare const getInternalModelsCollection: () => Collection<InternalModel>;
4
+ /**
5
+ * Get an internal model config by its unique name
6
+ */
7
+ export declare const getInternalModelByName: (name: string) => Promise<InternalModel | null>;
8
+ /**
9
+ * Find internal models by filter.
10
+ */
11
+ export declare const findInternalModels: (filter?: Filter<InternalModel>) => Promise<InternalModel[]>;
12
+ /**
13
+ * Get all internal models.
14
+ */
15
+ export declare const getAllInternalModels: () => Promise<InternalModel[]>;
16
+ //# sourceMappingURL=internalModels.getters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalModels.getters.d.ts","sourceRoot":"","sources":["../../../src/configuration/internalModels/internalModels.getters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,eAAO,MAAM,2BAA2B,QAAO,UAAU,CAAC,aAAa,CAEtE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,KACX,OAAO,CAAC,aAAa,GAAG,IAAI,CAE9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAQ,MAAM,CAAC,aAAa,CAAM,KACjC,OAAO,CAAC,aAAa,EAAE,CAEzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,aAAa,EAAE,CAEpE,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllInternalModels = exports.findInternalModels = exports.getInternalModelByName = exports.getInternalModelsCollection = void 0;
4
+ const index_1 = require("../index");
5
+ const internalModels_constants_1 = require("./internalModels.constants");
6
+ const getInternalModelsCollection = () => {
7
+ return (0, index_1.getDb)().collection(internalModels_constants_1.INTERNAL_MODELS_COLLECTION);
8
+ };
9
+ exports.getInternalModelsCollection = getInternalModelsCollection;
10
+ /**
11
+ * Get an internal model config by its unique name
12
+ */
13
+ const getInternalModelByName = async (name) => {
14
+ return await (0, exports.getInternalModelsCollection)().findOne({ name });
15
+ };
16
+ exports.getInternalModelByName = getInternalModelByName;
17
+ /**
18
+ * Find internal models by filter.
19
+ */
20
+ const findInternalModels = async (filter = {}) => {
21
+ return await (0, exports.getInternalModelsCollection)().find(filter).toArray();
22
+ };
23
+ exports.findInternalModels = findInternalModels;
24
+ /**
25
+ * Get all internal models.
26
+ */
27
+ const getAllInternalModels = async () => {
28
+ return await (0, exports.findInternalModels)();
29
+ };
30
+ exports.getAllInternalModels = getAllInternalModels;
31
+ //# sourceMappingURL=internalModels.getters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalModels.getters.js","sourceRoot":"","sources":["../../../src/configuration/internalModels/internalModels.getters.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AAGjC,yEAAwE;AAEjE,MAAM,2BAA2B,GAAG,GAA8B,EAAE;IACzE,OAAO,IAAA,aAAK,GAAE,CAAC,UAAU,CAAgB,qDAA0B,CAAC,CAAC;AACvE,CAAC,CAAC;AAFW,QAAA,2BAA2B,+BAEtC;AAEF;;GAEG;AACI,MAAM,sBAAsB,GAAG,KAAK,EACzC,IAAY,EACmB,EAAE;IACjC,OAAO,MAAM,IAAA,mCAA2B,GAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;AAJW,QAAA,sBAAsB,0BAIjC;AAEF;;GAEG;AACI,MAAM,kBAAkB,GAAG,KAAK,EACrC,SAAgC,EAAE,EACR,EAAE;IAC5B,OAAO,MAAM,IAAA,mCAA2B,GAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;AACpE,CAAC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B;AAEF;;GAEG;AACI,MAAM,oBAAoB,GAAG,KAAK,IAA8B,EAAE;IACvE,OAAO,MAAM,IAAA,0BAAkB,GAAE,CAAC;AACpC,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B"}
@@ -0,0 +1,12 @@
1
+ import { ObjectId } from "mongodb";
2
+ export type InternalModel = {
3
+ _id: ObjectId;
4
+ /** Has to be unique between other names in collection */
5
+ name: string;
6
+ provider: string;
7
+ model: string;
8
+ config?: Record<string, unknown>;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ };
12
+ //# sourceMappingURL=internalModels.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalModels.types.d.ts","sourceRoot":"","sources":["../../../src/configuration/internalModels/internalModels.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,QAAQ,CAAC;IACd,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=internalModels.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalModels.types.js","sourceRoot":"","sources":["../../../src/configuration/internalModels/internalModels.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { MODELS_COLLECTION, MODEL_TYPES, REALTIME_MODEL_PROVIDERS, STT_MODEL_PROVIDERS, } from "./models.constants";
2
+ export { getModelsCollection, findModels, getModelByModelId, getModelsByProvider, getModelsByType, getAvailableModelsByType, } from "./models.getters";
3
+ export type { ModelType, RealtimeModelProvider, SttModelProvider, SemanticVad, ServerVad, TurnDetection, RealtimeModelDoc, SttModelDoc, ModelDoc, } from "./models.types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,QAAQ,GACT,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAvailableModelsByType = exports.getModelsByType = exports.getModelsByProvider = exports.getModelByModelId = exports.findModels = exports.getModelsCollection = exports.STT_MODEL_PROVIDERS = exports.REALTIME_MODEL_PROVIDERS = exports.MODEL_TYPES = exports.MODELS_COLLECTION = void 0;
4
+ var models_constants_1 = require("./models.constants");
5
+ Object.defineProperty(exports, "MODELS_COLLECTION", { enumerable: true, get: function () { return models_constants_1.MODELS_COLLECTION; } });
6
+ Object.defineProperty(exports, "MODEL_TYPES", { enumerable: true, get: function () { return models_constants_1.MODEL_TYPES; } });
7
+ Object.defineProperty(exports, "REALTIME_MODEL_PROVIDERS", { enumerable: true, get: function () { return models_constants_1.REALTIME_MODEL_PROVIDERS; } });
8
+ Object.defineProperty(exports, "STT_MODEL_PROVIDERS", { enumerable: true, get: function () { return models_constants_1.STT_MODEL_PROVIDERS; } });
9
+ var models_getters_1 = require("./models.getters");
10
+ Object.defineProperty(exports, "getModelsCollection", { enumerable: true, get: function () { return models_getters_1.getModelsCollection; } });
11
+ Object.defineProperty(exports, "findModels", { enumerable: true, get: function () { return models_getters_1.findModels; } });
12
+ Object.defineProperty(exports, "getModelByModelId", { enumerable: true, get: function () { return models_getters_1.getModelByModelId; } });
13
+ Object.defineProperty(exports, "getModelsByProvider", { enumerable: true, get: function () { return models_getters_1.getModelsByProvider; } });
14
+ Object.defineProperty(exports, "getModelsByType", { enumerable: true, get: function () { return models_getters_1.getModelsByType; } });
15
+ Object.defineProperty(exports, "getAvailableModelsByType", { enumerable: true, get: function () { return models_getters_1.getAvailableModelsByType; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/configuration/models/index.ts"],"names":[],"mappings":";;;AAAA,uDAK4B;AAJ1B,qHAAA,iBAAiB,OAAA;AACjB,+GAAA,WAAW,OAAA;AACX,4HAAA,wBAAwB,OAAA;AACxB,uHAAA,mBAAmB,OAAA;AAErB,mDAO0B;AANxB,qHAAA,mBAAmB,OAAA;AACnB,4GAAA,UAAU,OAAA;AACV,mHAAA,iBAAiB,OAAA;AACjB,qHAAA,mBAAmB,OAAA;AACnB,iHAAA,eAAe,OAAA;AACf,0HAAA,wBAAwB,OAAA"}
@@ -0,0 +1,5 @@
1
+ export declare const MODELS_COLLECTION = "models";
2
+ export declare const MODEL_TYPES: readonly ["realtime", "stt"];
3
+ export declare const REALTIME_MODEL_PROVIDERS: readonly ["openai", "gemini"];
4
+ export declare const STT_MODEL_PROVIDERS: readonly ["openai-stt", "google-stt", "deepgram-stt", "deepgram-flux", "elevenlabs-scribe", "gladia-stt"];
5
+ //# sourceMappingURL=models.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.constants.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/models.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,WAAW,8BAA+B,CAAC;AAExD,eAAO,MAAM,wBAAwB,+BAAgC,CAAC;AACtE,eAAO,MAAM,mBAAmB,2GAOtB,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STT_MODEL_PROVIDERS = exports.REALTIME_MODEL_PROVIDERS = exports.MODEL_TYPES = exports.MODELS_COLLECTION = void 0;
4
+ exports.MODELS_COLLECTION = "models";
5
+ exports.MODEL_TYPES = ["realtime", "stt"];
6
+ exports.REALTIME_MODEL_PROVIDERS = ["openai", "gemini"];
7
+ exports.STT_MODEL_PROVIDERS = [
8
+ "openai-stt",
9
+ "google-stt",
10
+ "deepgram-stt",
11
+ "deepgram-flux",
12
+ "elevenlabs-scribe",
13
+ "gladia-stt",
14
+ ];
15
+ //# sourceMappingURL=models.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.constants.js","sourceRoot":"","sources":["../../../src/configuration/models/models.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAE7B,QAAA,WAAW,GAAG,CAAC,UAAU,EAAE,KAAK,CAAU,CAAC;AAE3C,QAAA,wBAAwB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AACzD,QAAA,mBAAmB,GAAG;IACjC,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,YAAY;CACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Collection, Filter } from "mongodb";
2
+ import { ModelDoc, ModelType } from "./models.types";
3
+ /** Raw typed handle to the `models` collection. */
4
+ export declare const getModelsCollection: () => Collection<ModelDoc>;
5
+ /** Find models by an arbitrary filter. */
6
+ export declare const findModels: (filter?: Filter<ModelDoc>) => Promise<ModelDoc[]>;
7
+ /**
8
+ * Get a single model by its `modelId`, optionally scoped to a `type`.
9
+ * @param modelId e.g. "deepgram-stt-phonecall"
10
+ * @param type optional narrowing filter, since `modelId` isn't guaranteed unique across types
11
+ */
12
+ export declare const getModelByModelId: (modelId: string, type?: ModelType) => Promise<ModelDoc | null>;
13
+ /**
14
+ * Get all models for a given `provider`, optionally scoped to a `type`.
15
+ */
16
+ export declare const getModelsByProvider: (provider: string, type?: ModelType) => Promise<ModelDoc[]>;
17
+ /** Get all models of a given `type`. */
18
+ export declare const getModelsByType: (type: ModelType) => Promise<ModelDoc[]>;
19
+ /** Get all models of a given `type` where `available` is true. */
20
+ export declare const getAvailableModelsByType: (type: ModelType) => Promise<ModelDoc[]>;
21
+ //# sourceMappingURL=models.getters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.getters.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/models.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAI7C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAErD,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,QAAO,UAAU,CAAC,QAAQ,CAEzD,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,UAAU,GACrB,SAAQ,MAAM,CAAC,QAAQ,CAAM,KAC5B,OAAO,CAAC,QAAQ,EAAE,CAEpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,OAAO,SAAS,KACf,OAAO,CAAC,QAAQ,GAAG,IAAI,CAGzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,OAAO,SAAS,KACf,OAAO,CAAC,QAAQ,EAAE,CAGpB,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,eAAe,GAAU,MAAM,SAAS,KAAG,OAAO,CAAC,QAAQ,EAAE,CAEzE,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,wBAAwB,GACnC,MAAM,SAAS,KACd,OAAO,CAAC,QAAQ,EAAE,CAEpB,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAvailableModelsByType = exports.getModelsByType = exports.getModelsByProvider = exports.getModelByModelId = exports.findModels = exports.getModelsCollection = void 0;
4
+ const index_1 = require("../index");
5
+ const models_constants_1 = require("./models.constants");
6
+ /** Raw typed handle to the `models` collection. */
7
+ const getModelsCollection = () => {
8
+ return (0, index_1.getDb)().collection(models_constants_1.MODELS_COLLECTION);
9
+ };
10
+ exports.getModelsCollection = getModelsCollection;
11
+ /** Find models by an arbitrary filter. */
12
+ const findModels = async (filter = {}) => {
13
+ return await (0, exports.getModelsCollection)().find(filter).toArray();
14
+ };
15
+ exports.findModels = findModels;
16
+ /**
17
+ * Get a single model by its `modelId`, optionally scoped to a `type`.
18
+ * @param modelId e.g. "deepgram-stt-phonecall"
19
+ * @param type optional narrowing filter, since `modelId` isn't guaranteed unique across types
20
+ */
21
+ const getModelByModelId = async (modelId, type) => {
22
+ const filter = (type ? { modelId, type } : { modelId });
23
+ return await (0, exports.getModelsCollection)().findOne(filter);
24
+ };
25
+ exports.getModelByModelId = getModelByModelId;
26
+ /**
27
+ * Get all models for a given `provider`, optionally scoped to a `type`.
28
+ */
29
+ const getModelsByProvider = async (provider, type) => {
30
+ const filter = (type ? { provider, type } : { provider });
31
+ return await (0, exports.findModels)(filter);
32
+ };
33
+ exports.getModelsByProvider = getModelsByProvider;
34
+ /** Get all models of a given `type`. */
35
+ const getModelsByType = async (type) => {
36
+ return await (0, exports.findModels)({ type });
37
+ };
38
+ exports.getModelsByType = getModelsByType;
39
+ /** Get all models of a given `type` where `available` is true. */
40
+ const getAvailableModelsByType = async (type) => {
41
+ return await (0, exports.findModels)({ type, available: true });
42
+ };
43
+ exports.getAvailableModelsByType = getAvailableModelsByType;
44
+ //# sourceMappingURL=models.getters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.getters.js","sourceRoot":"","sources":["../../../src/configuration/models/models.getters.ts"],"names":[],"mappings":";;;AAEA,oCAAiC;AACjC,yDAAuD;AAGvD,mDAAmD;AAC5C,MAAM,mBAAmB,GAAG,GAAyB,EAAE;IAC5D,OAAO,IAAA,aAAK,GAAE,CAAC,UAAU,CAAW,oCAAiB,CAAC,CAAC;AACzD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF,0CAA0C;AACnC,MAAM,UAAU,GAAG,KAA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,0 +1,68 @@
1
+ import { ObjectId } from "mongodb";
2
+ import { MODEL_TYPES, REALTIME_MODEL_PROVIDERS, STT_MODEL_PROVIDERS } from "./models.constants";
3
+ export type ModelType = (typeof MODEL_TYPES)[number];
4
+ export type RealtimeModelProvider = (typeof REALTIME_MODEL_PROVIDERS)[number];
5
+ export type SttModelProvider = (typeof STT_MODEL_PROVIDERS)[number];
6
+ export type SemanticVad = {
7
+ type: "semantic_vad";
8
+ eagerness?: "low" | "medium" | "high" | "auto";
9
+ create_response?: boolean;
10
+ interrupt_response?: boolean;
11
+ };
12
+ export type ServerVad = {
13
+ type: "server_vad";
14
+ threshold: number;
15
+ prefix_padding_ms: number;
16
+ silence_duration_ms: number;
17
+ create_response?: boolean;
18
+ interrupt_response?: boolean;
19
+ };
20
+ export type TurnDetection = SemanticVad | ServerVad;
21
+ type BaseModelDoc = {
22
+ _id: ObjectId;
23
+ /** Public identifier used by the provider, not to be confused with mongo id */
24
+ modelId: string;
25
+ name: string;
26
+ description?: string;
27
+ available: boolean;
28
+ configDefaults?: Record<string, unknown>;
29
+ createdAt: Date;
30
+ updatedAt: Date;
31
+ };
32
+ /** Realtime speech-to-speech model (OpenAI/Gemini). `features.vad` is turn-detection config. */
33
+ export type RealtimeModelDoc = BaseModelDoc & {
34
+ type: "realtime";
35
+ provider: RealtimeModelProvider;
36
+ features?: {
37
+ supportsAudio?: boolean;
38
+ supportsText?: boolean;
39
+ vad?: TurnDetection;
40
+ };
41
+ };
42
+ /** STT engine/preset (openai-stt, google-stt, deepgram-stt/-flux, elevenlabs-scribe, gladia-stt). */
43
+ export type SttModelDoc = BaseModelDoc & {
44
+ type: "stt";
45
+ provider: SttModelProvider;
46
+ features?: {
47
+ supportsAudio?: boolean;
48
+ supportsText?: boolean;
49
+ };
50
+ };
51
+ /**
52
+ * A document in the `models` collection (configuration db). Discriminated by `type`.
53
+ *
54
+ * Common fields (all variants):
55
+ * - `_id` — Mongo-managed ObjectId
56
+ * - `modelId` — model's public identifier
57
+ * - `name` — display name
58
+ * - `description?` — display description
59
+ * - `available` — whether the model should be offered/selectable right now
60
+ * - `configDefaults?` — free-form provider-specific config, e.g. the literal vendor
61
+ * model string, VAD tuning, language, barge-in timings — shape varies per `provider`
62
+ * - `createdAt` / `updatedAt`
63
+ *
64
+ * Type-specific fields: see {@link RealtimeModelDoc}, {@link SttModelDoc}.
65
+ */
66
+ export type ModelDoc = RealtimeModelDoc | SttModelDoc;
67
+ export {};
68
+ //# sourceMappingURL=models.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.types.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/models.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9E,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;AAEpD,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,QAAQ,CAAC;IACd,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,gGAAgG;AAChG,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAC5C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,CAAC,EAAE;QACT,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,GAAG,CAAC,EAAE,aAAa,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,qGAAqG;AACrG,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG;IACvC,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE;QACT,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=models.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.types.js","sourceRoot":"","sources":["../../../src/configuration/models/models.types.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -15,6 +15,8 @@ export type * from "./websitalk/scans/scans.types";
15
15
  export * from "./websitalk/websiteUrls";
16
16
  export { configurationMongodbClient, getDb as getConfigurationDb, setDb as setConfigurationDb, } from "./configuration";
17
17
  export * from "./configuration/prompts";
18
+ export * from "./configuration/models";
19
+ export * from "./configuration/internalModels";
18
20
  export { ObjectId } from "mongodb";
19
21
  export type { Filter } from "mongodb";
20
22
  export type { AnyBulkWriteOperation as BulkWriteOp } from "mongodb";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,OAAO,EACL,0BAA0B,EAC1B,KAAK,IAAI,kBAAkB,EAC3B,KAAK,IAAI,kBAAkB,EAC3B,QAAQ,IAAI,qBAAqB,GAClC,MAAM,aAAa,CAAC;AACrB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAExC,OAAO,EACL,sBAAsB,EACtB,KAAK,IAAI,cAAc,EACvB,KAAK,IAAI,cAAc,EACvB,QAAQ,IAAI,iBAAiB,GAC9B,MAAM,aAAa,CAAC;AACrB,cAAc,iCAAiC,CAAC;AAChD,mBAAmB,+BAA+B,CAAC;AACnD,cAAc,yBAAyB,CAAC;AAExC,OAAO,EACL,0BAA0B,EAC1B,KAAK,IAAI,kBAAkB,EAC3B,KAAK,IAAI,kBAAkB,GAC5B,MAAM,iBAAiB,CAAC;AACzB,cAAc,yBAAyB,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,qBAAqB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AAChE,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -43,6 +43,8 @@ Object.defineProperty(exports, "configurationMongodbClient", { enumerable: true,
43
43
  Object.defineProperty(exports, "getConfigurationDb", { enumerable: true, get: function () { return configuration_1.getDb; } });
44
44
  Object.defineProperty(exports, "setConfigurationDb", { enumerable: true, get: function () { return configuration_1.setDb; } });
45
45
  __exportStar(require("./configuration/prompts"), exports);
46
+ __exportStar(require("./configuration/models"), exports);
47
+ __exportStar(require("./configuration/internalModels"), exports);
46
48
  var mongodb_1 = require("mongodb");
47
49
  Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return mongodb_1.ObjectId; } });
48
50
  var mongodb_2 = require("mongodb");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAE5B,yCAKqB;AAJnB,uHAAA,0BAA0B,OAAA;AAC1B,+GAAA,KAAK,OAAsB;AAC3B,+GAAA,KAAK,OAAsB;AAC3B,kHAAA,QAAQ,OAAyB;AAEnC,qDAAmC;AACnC,sDAAoC;AACpC,kEAAgD;AAChD,sDAAoC;AACpC,iEAA+C;AAC/C,yDAAuC;AACvC,0DAAwC;AAExC,yCAKqB;AAJnB,mHAAA,sBAAsB,OAAA;AACtB,2GAAA,KAAK,OAAkB;AACvB,2GAAA,KAAK,OAAkB;AACvB,8GAAA,QAAQ,OAAqB;AAE/B,kEAAgD;AAEhD,0DAAwC;AAExC,iDAIyB;AAHvB,2HAAA,0BAA0B,OAAA;AAC1B,mHAAA,KAAK,OAAsB;AAC3B,mHAAA,KAAK,OAAsB;AAE7B,0DAAwC;AAExC,mCAAmC;AAA1B,mGAAA,QAAQ,OAAA;AAGjB,mCAAgE;AAAvD,yGAAA,mBAAmB,OAAkB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAE5B,yCAKqB;AAJnB,uHAAA,0BAA0B,OAAA;AAC1B,+GAAA,KAAK,OAAsB;AAC3B,+GAAA,KAAK,OAAsB;AAC3B,kHAAA,QAAQ,OAAyB;AAEnC,qDAAmC;AACnC,sDAAoC;AACpC,kEAAgD;AAChD,sDAAoC;AACpC,iEAA+C;AAC/C,yDAAuC;AACvC,0DAAwC;AAExC,yCAKqB;AAJnB,mHAAA,sBAAsB,OAAA;AACtB,2GAAA,KAAK,OAAkB;AACvB,2GAAA,KAAK,OAAkB;AACvB,8GAAA,QAAQ,OAAqB;AAE/B,kEAAgD;AAEhD,0DAAwC;AAExC,iDAIyB;AAHvB,2HAAA,0BAA0B,OAAA;AAC1B,mHAAA,KAAK,OAAsB;AAC3B,mHAAA,KAAK,OAAsB;AAE7B,0DAAwC;AACxC,yDAAuC;AACvC,iEAA+C;AAE/C,mCAAmC;AAA1B,mGAAA,QAAQ,OAAA;AAGjB,mCAAgE;AAAvD,yGAAA,mBAAmB,OAAkB"}
@@ -34,6 +34,7 @@ export type Call = {
34
34
  conferenceRole?: ConferenceRole;
35
35
  redirectedCall?: boolean;
36
36
  toolExecutions?: ToolExecution[];
37
+ transcriptionComparison?: Record<string, TranscriptionSegment[]>;
37
38
  };
38
39
  export type ToolExecution = {
39
40
  toolName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"calls.types.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/calls/calls.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,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gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAEnC,qDAAqD;AACrD,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,IAAI,CAAC;CACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talkpilot/core-db",
3
- "version": "1.3.36",
3
+ "version": "1.3.38",
4
4
  "description": "Core database package for centralized connections and ORM integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,6 +1,8 @@
1
1
  import { Db, ObjectId as MongoObjectId } from "mongodb";
2
2
 
3
3
  export * from "./prompts";
4
+ export * from "./models";
5
+ export * from "./internalModels";
4
6
  export { configurationMongodbClient } from "./mongodb-client";
5
7
 
6
8
  let db: Db;
@@ -0,0 +1,3 @@
1
+ export { INTERNAL_MODELS_COLLECTION } from "./internalModels.constants";
2
+ export * from "./internalModels.getters";
3
+ export type { InternalModel } from "./internalModels.types";
@@ -0,0 +1 @@
1
+ export const INTERNAL_MODELS_COLLECTION = "internal-models";
@@ -0,0 +1,33 @@
1
+ import { getDb } from "../index";
2
+ import { Collection, Filter } from "mongodb";
3
+ import { InternalModel } from "./internalModels.types";
4
+ import { INTERNAL_MODELS_COLLECTION } from "./internalModels.constants";
5
+
6
+ export const getInternalModelsCollection = (): Collection<InternalModel> => {
7
+ return getDb().collection<InternalModel>(INTERNAL_MODELS_COLLECTION);
8
+ };
9
+
10
+ /**
11
+ * Get an internal model config by its unique name
12
+ */
13
+ export const getInternalModelByName = async (
14
+ name: string
15
+ ): Promise<InternalModel | null> => {
16
+ return await getInternalModelsCollection().findOne({ name });
17
+ };
18
+
19
+ /**
20
+ * Find internal models by filter.
21
+ */
22
+ export const findInternalModels = async (
23
+ filter: Filter<InternalModel> = {}
24
+ ): Promise<InternalModel[]> => {
25
+ return await getInternalModelsCollection().find(filter).toArray();
26
+ };
27
+
28
+ /**
29
+ * Get all internal models.
30
+ */
31
+ export const getAllInternalModels = async (): Promise<InternalModel[]> => {
32
+ return await findInternalModels();
33
+ };
@@ -0,0 +1,12 @@
1
+ import { ObjectId } from "mongodb";
2
+
3
+ export type InternalModel = {
4
+ _id: ObjectId;
5
+ /** Has to be unique between other names in collection */
6
+ name: string;
7
+ provider: string;
8
+ model: string;
9
+ config?: Record<string, unknown>;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ };
@@ -0,0 +1,25 @@
1
+ export {
2
+ MODELS_COLLECTION,
3
+ MODEL_TYPES,
4
+ REALTIME_MODEL_PROVIDERS,
5
+ STT_MODEL_PROVIDERS,
6
+ } from "./models.constants";
7
+ export {
8
+ getModelsCollection,
9
+ findModels,
10
+ getModelByModelId,
11
+ getModelsByProvider,
12
+ getModelsByType,
13
+ getAvailableModelsByType,
14
+ } from "./models.getters";
15
+ export type {
16
+ ModelType,
17
+ RealtimeModelProvider,
18
+ SttModelProvider,
19
+ SemanticVad,
20
+ ServerVad,
21
+ TurnDetection,
22
+ RealtimeModelDoc,
23
+ SttModelDoc,
24
+ ModelDoc,
25
+ } from "./models.types";
@@ -0,0 +1,13 @@
1
+ export const MODELS_COLLECTION = "models";
2
+
3
+ export const MODEL_TYPES = ["realtime", "stt"] as const;
4
+
5
+ export const REALTIME_MODEL_PROVIDERS = ["openai", "gemini"] as const;
6
+ export const STT_MODEL_PROVIDERS = [
7
+ "openai-stt",
8
+ "google-stt",
9
+ "deepgram-stt",
10
+ "deepgram-flux",
11
+ "elevenlabs-scribe",
12
+ "gladia-stt",
13
+ ] as const;
@@ -0,0 +1,53 @@
1
+ import { Collection, Filter } from "mongodb";
2
+
3
+ import { getDb } from "../index";
4
+ import { MODELS_COLLECTION } from "./models.constants";
5
+ import { ModelDoc, ModelType } from "./models.types";
6
+
7
+ /** Raw typed handle to the `models` collection. */
8
+ export const getModelsCollection = (): Collection<ModelDoc> => {
9
+ return getDb().collection<ModelDoc>(MODELS_COLLECTION);
10
+ };
11
+
12
+ /** Find models by an arbitrary filter. */
13
+ export const findModels = async (
14
+ filter: Filter<ModelDoc> = {}
15
+ ): Promise<ModelDoc[]> => {
16
+ return await getModelsCollection().find(filter).toArray();
17
+ };
18
+
19
+ /**
20
+ * Get a single model by its `modelId`, optionally scoped to a `type`.
21
+ * @param modelId e.g. "deepgram-stt-phonecall"
22
+ * @param type optional narrowing filter, since `modelId` isn't guaranteed unique across types
23
+ */
24
+ export const getModelByModelId = async (
25
+ modelId: string,
26
+ type?: ModelType
27
+ ): Promise<ModelDoc | null> => {
28
+ const filter = (type ? { modelId, type } : { modelId }) as Filter<ModelDoc>;
29
+ return await getModelsCollection().findOne(filter);
30
+ };
31
+
32
+ /**
33
+ * Get all models for a given `provider`, optionally scoped to a `type`.
34
+ */
35
+ export const getModelsByProvider = async (
36
+ provider: string,
37
+ type?: ModelType
38
+ ): Promise<ModelDoc[]> => {
39
+ const filter = (type ? { provider, type } : { provider }) as Filter<ModelDoc>;
40
+ return await findModels(filter);
41
+ };
42
+
43
+ /** Get all models of a given `type`. */
44
+ export const getModelsByType = async (type: ModelType): Promise<ModelDoc[]> => {
45
+ return await findModels({ type } as Filter<ModelDoc>);
46
+ };
47
+
48
+ /** Get all models of a given `type` where `available` is true. */
49
+ export const getAvailableModelsByType = async (
50
+ type: ModelType
51
+ ): Promise<ModelDoc[]> => {
52
+ return await findModels({ type, available: true } as Filter<ModelDoc>);
53
+ };
@@ -0,0 +1,79 @@
1
+ import { ObjectId } from "mongodb";
2
+
3
+ import {
4
+ MODEL_TYPES,
5
+ REALTIME_MODEL_PROVIDERS,
6
+ STT_MODEL_PROVIDERS,
7
+ } from "./models.constants";
8
+
9
+ export type ModelType = (typeof MODEL_TYPES)[number];
10
+ export type RealtimeModelProvider = (typeof REALTIME_MODEL_PROVIDERS)[number];
11
+ export type SttModelProvider = (typeof STT_MODEL_PROVIDERS)[number];
12
+
13
+ export type SemanticVad = {
14
+ type: "semantic_vad";
15
+ eagerness?: "low" | "medium" | "high" | "auto";
16
+ create_response?: boolean;
17
+ interrupt_response?: boolean;
18
+ };
19
+
20
+ export type ServerVad = {
21
+ type: "server_vad";
22
+ threshold: number;
23
+ prefix_padding_ms: number;
24
+ silence_duration_ms: number;
25
+ create_response?: boolean;
26
+ interrupt_response?: boolean;
27
+ };
28
+
29
+ export type TurnDetection = SemanticVad | ServerVad;
30
+
31
+ type BaseModelDoc = {
32
+ _id: ObjectId;
33
+ /** Public identifier used by the provider, not to be confused with mongo id */
34
+ modelId: string;
35
+ name: string;
36
+ description?: string;
37
+ available: boolean;
38
+ configDefaults?: Record<string, unknown>;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ };
42
+
43
+ /** Realtime speech-to-speech model (OpenAI/Gemini). `features.vad` is turn-detection config. */
44
+ export type RealtimeModelDoc = BaseModelDoc & {
45
+ type: "realtime";
46
+ provider: RealtimeModelProvider;
47
+ features?: {
48
+ supportsAudio?: boolean;
49
+ supportsText?: boolean;
50
+ vad?: TurnDetection;
51
+ };
52
+ };
53
+
54
+ /** STT engine/preset (openai-stt, google-stt, deepgram-stt/-flux, elevenlabs-scribe, gladia-stt). */
55
+ export type SttModelDoc = BaseModelDoc & {
56
+ type: "stt";
57
+ provider: SttModelProvider;
58
+ features?: {
59
+ supportsAudio?: boolean;
60
+ supportsText?: boolean;
61
+ };
62
+ };
63
+
64
+ /**
65
+ * A document in the `models` collection (configuration db). Discriminated by `type`.
66
+ *
67
+ * Common fields (all variants):
68
+ * - `_id` — Mongo-managed ObjectId
69
+ * - `modelId` — model's public identifier
70
+ * - `name` — display name
71
+ * - `description?` — display description
72
+ * - `available` — whether the model should be offered/selectable right now
73
+ * - `configDefaults?` — free-form provider-specific config, e.g. the literal vendor
74
+ * model string, VAD tuning, language, barge-in timings — shape varies per `provider`
75
+ * - `createdAt` / `updatedAt`
76
+ *
77
+ * Type-specific fields: see {@link RealtimeModelDoc}, {@link SttModelDoc}.
78
+ */
79
+ export type ModelDoc = RealtimeModelDoc | SttModelDoc;
package/src/index.ts CHANGED
@@ -33,6 +33,8 @@ export {
33
33
  setDb as setConfigurationDb,
34
34
  } from "./configuration";
35
35
  export * from "./configuration/prompts";
36
+ export * from "./configuration/models";
37
+ export * from "./configuration/internalModels";
36
38
 
37
39
  export { ObjectId } from "mongodb";
38
40
  export type { Filter } from "mongodb";
@@ -45,6 +45,7 @@ export type Call = {
45
45
  conferenceRole?: ConferenceRole;
46
46
  redirectedCall?: boolean;
47
47
  toolExecutions?: ToolExecution[];
48
+ transcriptionComparison?: Record<string, TranscriptionSegment[]>;
48
49
  };
49
50
 
50
51
  export type ToolExecution = {