@futdevpro/nts-dynamo 1.15.58 → 1.15.64
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/.dynamo/logs/cicd-pipeline/output.log +1746 -1819
- package/.dynamo/logs/cicd-pipeline/status.json +37 -37
- package/.github/workflows/main.yml +432 -426
- package/build/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +6 -0
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_collections/mongo-reconnect-guard.util.d.ts +74 -0
- package/build/_collections/mongo-reconnect-guard.util.d.ts.map +1 -0
- package/build/_collections/mongo-reconnect-guard.util.js +111 -0
- package/build/_collections/mongo-reconnect-guard.util.js.map +1 -0
- package/build/_models/interfaces/global-settings.interface.d.ts +21 -0
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.d.ts.map +1 -1
- package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.js +2 -2
- package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.js.map +1 -1
- package/build/_modules/ai/_services/ai-embedding-mock.service.d.ts +1 -1
- package/build/_modules/ai/_services/ai-embedding-mock.service.d.ts.map +1 -1
- package/build/_modules/ai/_services/ai-embedding-mock.service.js.map +1 -1
- package/build/_modules/ai/_services/ai-embedding-provider.registry.d.ts.map +1 -1
- package/build/_modules/ai/_services/ai-embedding-provider.registry.js.map +1 -1
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.d.ts +1 -1
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.d.ts.map +1 -1
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.js +3 -3
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.js.map +1 -1
- package/build/_modules/ai/index.d.ts +2 -0
- package/build/_modules/ai/index.d.ts.map +1 -1
- package/build/_modules/ai/index.js +4 -0
- package/build/_modules/ai/index.js.map +1 -1
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.d.ts +17 -17
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.d.ts.map +1 -1
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.js +21 -21
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.js.map +1 -1
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.d.ts +4 -4
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.d.ts.map +1 -1
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.js +5 -5
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.js.map +1 -1
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.d.ts +4 -4
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.d.ts.map +1 -1
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.js +4 -4
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.js.map +1 -1
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.d.ts +6 -6
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.d.ts.map +1 -1
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.js +5 -5
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.js.map +1 -1
- package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.d.ts +1 -1
- package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.js +1 -1
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.d.ts +4 -4
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.d.ts.map +1 -1
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.js +6 -6
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.js.map +1 -1
- package/build/_modules/mcp/_services/dynts-mcp.adapter.d.ts +11 -11
- package/build/_modules/mcp/_services/dynts-mcp.adapter.d.ts.map +1 -1
- package/build/_modules/mcp/_services/dynts-mcp.adapter.js +16 -11
- package/build/_modules/mcp/_services/dynts-mcp.adapter.js.map +1 -1
- package/build/_modules/mcp/index.js +1 -1
- package/build/_modules/mcp/index.js.map +1 -1
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.d.ts +3 -3
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.d.ts.map +1 -1
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.js +4 -4
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.js.map +1 -1
- package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.d.ts.map +1 -1
- package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.js +9 -0
- package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.js.map +1 -1
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.d.ts +3 -3
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.d.ts.map +1 -1
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.js +1 -1
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.js.map +1 -1
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.d.ts +7 -7
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.d.ts.map +1 -1
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.js +2 -2
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.js.map +1 -1
- package/build/_services/core/global.service.d.ts.map +1 -1
- package/build/_services/core/global.service.js +15 -2
- package/build/_services/core/global.service.js.map +1 -1
- package/build/_services/server/app.server.d.ts.map +1 -1
- package/build/_services/server/app.server.js +21 -0
- package/build/_services/server/app.server.js.map +1 -1
- package/package.json +1 -1
- package/src/_collections/global-settings.const.ts +7 -0
- package/src/_collections/mongo-reconnect-guard.util.spec.ts +52 -0
- package/src/_collections/mongo-reconnect-guard.util.ts +172 -0
- package/src/_models/interfaces/global-settings.interface.ts +22 -0
- package/src/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.ts +39 -7
- package/src/_modules/ai/_services/ai-embedding-mock.service.ts +18 -4
- package/src/_modules/ai/_services/ai-embedding-provider.registry.ts +4 -0
- package/src/_modules/ai/_services/lmstudio-embedding.control-service.ts +26 -5
- package/src/_modules/ai/index.ts +5 -0
- package/src/_modules/data-readers/_collections/dynts-sqlite-reader.util.spec.ts +145 -130
- package/src/_modules/data-readers/_collections/dynts-sqlite-reader.util.ts +131 -120
- package/src/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.ts +6 -5
- package/src/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.spec.ts +35 -35
- package/src/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.ts +9 -5
- package/src/_modules/local-vector-search/_services/lvs-vector-persist.data-service.spec.ts +11 -11
- package/src/_modules/local-vector-search/_services/lvs-vector-persist.data-service.ts +19 -17
- package/src/_modules/mcp/_models/interfaces/dynts-mcp.interface.ts +1 -1
- package/src/_modules/mcp/_services/dynts-mcp-server.service-base.spec.ts +123 -114
- package/src/_modules/mcp/_services/dynts-mcp-server.service-base.ts +44 -39
- package/src/_modules/mcp/_services/dynts-mcp.adapter.ts +114 -103
- package/src/_modules/mcp/index.ts +1 -1
- package/src/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.ts +5 -4
- package/src/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.ts +0 -2
- package/src/_modules/scoped-config/_services/dynts-scoped-config.control-service.spec.ts +19 -13
- package/src/_modules/scoped-config/_services/dynts-scoped-config.control-service.ts +37 -21
- package/src/_modules/scoped-config/_services/dynts-scoped-config.data-service.spec.ts +11 -6
- package/src/_modules/scoped-config/_services/dynts-scoped-config.data-service.ts +17 -14
- package/src/_services/core/global.service.spec.ts +17 -0
- package/src/_services/core/global.service.ts +19 -5
- package/src/_services/server/app.server.ts +22 -1
|
@@ -5,12 +5,12 @@ import { DyNTS_global_settings } from '../../../_collections/global-settings.con
|
|
|
5
5
|
import { DyNTS_GlobalService } from '../../../_services/core/global.service';
|
|
6
6
|
import { LVS_Search_Mode } from '../_enums/lvs-search-mode.enum';
|
|
7
7
|
import { LVS_SearchResult } from '../_models/lvs-search-result.interface';
|
|
8
|
-
import {
|
|
8
|
+
import { DyNTS_LVS_VectorPersist } from '../_models/data-models/lvs-vector-persist.data-model';
|
|
9
9
|
import { DyNTS_LVS_VectorPersist_DataService } from './lvs-vector-persist.data-service';
|
|
10
|
-
import {
|
|
10
|
+
import { DyNTS_LVS_PersistentVectorPool_ControlService } from './lvs-persistent-vector-pool.control-service';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* BFR-AM-001 — a `
|
|
13
|
+
* BFR-AM-001 — a `DyNTS_LVS_PersistentVectorPool_ControlService` (kompozíció: in-memory pool + Mongo-persist) spec-jei.
|
|
14
14
|
*
|
|
15
15
|
* A DB-réteget egy IN-MEMORY fake-store helyettesíti: a `DyNTS_LVS_VectorPersist_DataService.prototype`
|
|
16
16
|
* `upsertVector`/`removeVector`/`findByCollectionKey` metódusait stub-oljuk (a `getDBService` eager
|
|
@@ -18,12 +18,12 @@ import { DyNTS_LVS_PersistentVectorPool } from './lvs-persistent-vector-pool.con
|
|
|
18
18
|
* így a perzisztencia memóriában modellezett, ÉLŐ Mongo nélkül (skip-guard nem szükséges). A fő bizonyíték:
|
|
19
19
|
* **persist-then-hydrate round-trip** újraépíti a VALÓDI `LVS_VectorPool_ControlService` in-memory indexét.
|
|
20
20
|
*/
|
|
21
|
-
describe('|
|
|
21
|
+
describe('| DyNTS_LVS_PersistentVectorPool_ControlService', () => {
|
|
22
22
|
|
|
23
23
|
let mockDBService: jasmine.SpyObj<{ find: () => Promise<unknown[]>; findOne: () => Promise<unknown> }>;
|
|
24
24
|
|
|
25
25
|
/** Fake tartós tár: `collectionKey` → (`vectorId` → rekord). A persist-stubok ezt írják/olvassák. */
|
|
26
|
-
let store: Map<string, Map<string,
|
|
26
|
+
let store: Map<string, Map<string, DyNTS_LVS_VectorPersist>>;
|
|
27
27
|
|
|
28
28
|
beforeAll(() => {
|
|
29
29
|
if (!DyNTS_global_settings.systemShortCodeName) {
|
|
@@ -44,16 +44,16 @@ describe('| DyNTS_LVS_PersistentVectorPool', () => {
|
|
|
44
44
|
spyOn(DyNTS_GlobalService, 'getDBService').and.returnValue(mockDBService as never);
|
|
45
45
|
|
|
46
46
|
// A fake tartós tár + a persist-service prototype-stubok (memóriában modellezett Mongo).
|
|
47
|
-
store = new Map<string, Map<string,
|
|
47
|
+
store = new Map<string, Map<string, DyNTS_LVS_VectorPersist>>();
|
|
48
48
|
|
|
49
49
|
spyOn(DyNTS_LVS_VectorPersist_DataService.prototype, 'upsertVector').and.callFake(
|
|
50
50
|
(set: { collectionKey: string; vectorId: string; embedding: number[]; metadata?: unknown }) => {
|
|
51
|
-
let coll: Map<string,
|
|
51
|
+
let coll: Map<string, DyNTS_LVS_VectorPersist> | undefined = store.get(set.collectionKey);
|
|
52
52
|
if (!coll) {
|
|
53
|
-
coll = new Map<string,
|
|
53
|
+
coll = new Map<string, DyNTS_LVS_VectorPersist>();
|
|
54
54
|
store.set(set.collectionKey, coll);
|
|
55
55
|
}
|
|
56
|
-
coll.set(set.vectorId, new
|
|
56
|
+
coll.set(set.vectorId, new DyNTS_LVS_VectorPersist({
|
|
57
57
|
collectionKey: set.collectionKey,
|
|
58
58
|
vectorId: set.vectorId,
|
|
59
59
|
embedding: set.embedding,
|
|
@@ -85,12 +85,12 @@ describe('| DyNTS_LVS_PersistentVectorPool', () => {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
it('| should persist on addVector and store the dimension', async () => {
|
|
88
|
-
const pool:
|
|
89
|
-
new
|
|
88
|
+
const pool: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
89
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
90
90
|
|
|
91
91
|
await pool.addVector('v1', [0.1, 0.2, 0.3], { tag: 'x' });
|
|
92
92
|
|
|
93
|
-
const persisted:
|
|
93
|
+
const persisted: DyNTS_LVS_VectorPersist | undefined = store.get('pool-a')?.get('v1');
|
|
94
94
|
expect(persisted).toBeDefined();
|
|
95
95
|
expect(persisted.embedding).toEqual([0.1, 0.2, 0.3]);
|
|
96
96
|
expect(persisted.dimensions).toBe(3);
|
|
@@ -101,16 +101,16 @@ describe('| DyNTS_LVS_PersistentVectorPool', () => {
|
|
|
101
101
|
|
|
102
102
|
it('| persist-then-hydrate round-trip rebuilds the in-memory pool', async () => {
|
|
103
103
|
// (1) Egy pool-ba 3 vektort persistálunk.
|
|
104
|
-
const writer:
|
|
105
|
-
new
|
|
104
|
+
const writer: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
105
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
106
106
|
await writer.addVector('v0', axis(4, 0));
|
|
107
107
|
await writer.addVector('v1', axis(4, 1));
|
|
108
108
|
await writer.addVector('v2', axis(4, 2));
|
|
109
109
|
expect(store.get('pool-a').size).toBe(3);
|
|
110
110
|
|
|
111
111
|
// (2) Egy FRISS wrapper (üres memória-pool) — szerver-restart szimuláció.
|
|
112
|
-
const rebuilt:
|
|
113
|
-
new
|
|
112
|
+
const rebuilt: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
113
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
114
114
|
expect(rebuilt.getPool().getAll().size).toBe(0);
|
|
115
115
|
|
|
116
116
|
// (3) Hidratálás Mongo-ból → a memória-pool újraépül.
|
|
@@ -126,38 +126,38 @@ describe('| DyNTS_LVS_PersistentVectorPool', () => {
|
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
it('| should only hydrate the matching collectionKey (pool partitioning)', async () => {
|
|
129
|
-
const a:
|
|
130
|
-
new
|
|
131
|
-
const b:
|
|
132
|
-
new
|
|
129
|
+
const a: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
130
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
131
|
+
const b: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
132
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-b', issuer: 'test' });
|
|
133
133
|
|
|
134
134
|
await a.addVector('a1', axis(3, 0));
|
|
135
135
|
await b.addVector('b1', axis(3, 1));
|
|
136
136
|
await b.addVector('b2', axis(3, 2));
|
|
137
137
|
|
|
138
|
-
const rebuiltA:
|
|
139
|
-
new
|
|
138
|
+
const rebuiltA: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
139
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
140
140
|
expect(await rebuiltA.hydrateFromMongo()).toBe(1);
|
|
141
141
|
expect(Array.from(rebuiltA.getPool().getAll().keys())).toEqual(['a1']);
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
it('| upsert (re-add) is reflected in both the pool and the store', async () => {
|
|
145
|
-
const pool:
|
|
146
|
-
new
|
|
145
|
+
const pool: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
146
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
147
147
|
|
|
148
148
|
await pool.addVector('v1', [1, 0, 0]);
|
|
149
149
|
await pool.updateVector('v1', [0, 1, 0], { v: 2 });
|
|
150
150
|
|
|
151
151
|
// a tárban EGY rekord van, a frissített értékkel + dimenzióval:
|
|
152
152
|
expect(store.get('pool-a').size).toBe(1);
|
|
153
|
-
const persisted:
|
|
153
|
+
const persisted: DyNTS_LVS_VectorPersist = store.get('pool-a').get('v1');
|
|
154
154
|
expect(persisted.embedding).toEqual([0, 1, 0]);
|
|
155
155
|
expect(persisted.dimensions).toBe(3);
|
|
156
156
|
expect(persisted.metadata).toEqual({ v: 2 });
|
|
157
157
|
|
|
158
158
|
// és egy friss hidratálás a frissített vektort hozza:
|
|
159
|
-
const rebuilt:
|
|
160
|
-
new
|
|
159
|
+
const rebuilt: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
160
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
161
161
|
await rebuilt.hydrateFromMongo();
|
|
162
162
|
const hits: LVS_SearchResult[] = rebuilt.search([0, 1, 0], 1, LVS_Search_Mode.cosineSimilarity);
|
|
163
163
|
expect(hits[0].id).toBe('v1');
|
|
@@ -165,8 +165,8 @@ describe('| DyNTS_LVS_PersistentVectorPool', () => {
|
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
it('| removeVector is reflected in both the pool and the store', async () => {
|
|
168
|
-
const pool:
|
|
169
|
-
new
|
|
168
|
+
const pool: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
169
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
170
170
|
|
|
171
171
|
await pool.addVector('v1', axis(3, 0));
|
|
172
172
|
await pool.addVector('v2', axis(3, 1));
|
|
@@ -181,15 +181,15 @@ describe('| DyNTS_LVS_PersistentVectorPool', () => {
|
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
it('| hydrate(records) rebuilds the pool without a Mongo read and skips incomplete records', () => {
|
|
184
|
-
const pool:
|
|
185
|
-
new
|
|
184
|
+
const pool: DyNTS_LVS_PersistentVectorPool_ControlService =
|
|
185
|
+
new DyNTS_LVS_PersistentVectorPool_ControlService({ collectionKey: 'pool-a', issuer: 'test' });
|
|
186
186
|
|
|
187
187
|
const loaded: number = pool.hydrate([
|
|
188
|
-
new
|
|
189
|
-
new
|
|
188
|
+
new DyNTS_LVS_VectorPersist({ collectionKey: 'pool-a', vectorId: 'v1', embedding: axis(2, 0) }),
|
|
189
|
+
new DyNTS_LVS_VectorPersist({ collectionKey: 'pool-a', vectorId: 'v2', embedding: axis(2, 1) }),
|
|
190
190
|
// hiányos rekordok (átugorva):
|
|
191
|
-
new
|
|
192
|
-
new
|
|
191
|
+
new DyNTS_LVS_VectorPersist({ collectionKey: 'pool-a', vectorId: 'v3', embedding: [] }),
|
|
192
|
+
new DyNTS_LVS_VectorPersist({ collectionKey: 'pool-a', embedding: axis(2, 0) }),
|
|
193
193
|
]);
|
|
194
194
|
|
|
195
195
|
expect(loaded).toBe(2);
|
package/src/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
|
3
3
|
|
|
4
4
|
import { LVS_Search_Mode } from '../_enums/lvs-search-mode.enum';
|
|
5
5
|
import { LVS_SearchResult } from '../_models/lvs-search-result.interface';
|
|
6
|
-
import {
|
|
6
|
+
import { DyNTS_LVS_VectorPersist } from '../_models/data-models/lvs-vector-persist.data-model';
|
|
7
7
|
import { DyNTS_LVS_VectorPersist_DataService } from './lvs-vector-persist.data-service';
|
|
8
8
|
import { LVS_VectorPool_ControlService } from './lvs-vector-pool.control-service';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* `
|
|
11
|
+
* `DyNTS_LVS_PersistentVectorPool_ControlService` (BFR-AM-001) — egy `LVS_VectorPool_ControlService` in-memory pool +
|
|
12
12
|
* MongoDB-perzisztencia **kompozíciója**. A FAM (fdp-agent-memory) `FAM_VectorSearch_ControlService`
|
|
13
13
|
* persist+hydrate workaround-ját generalizálja bedrock-szintre: a vektorok a SAJÁT Mongo-ban
|
|
14
14
|
* (`dynts_lvs_vector`) élnek, boot-kor a memória-pool-ba hidratálódnak — **NEM** MongoDB Atlas
|
|
@@ -24,7 +24,7 @@ import { LVS_VectorPool_ControlService } from './lvs-vector-pool.control-service
|
|
|
24
24
|
* `getDBService`-t hív, ezért a wrapper NEM tart élő data-service-mezőt — minden DB-művelet előtt lazy
|
|
25
25
|
* `new DyNTS_LVS_VectorPersist_DataService(...)` (a `getPersistService` ezt adja).
|
|
26
26
|
*/
|
|
27
|
-
export class
|
|
27
|
+
export class DyNTS_LVS_PersistentVectorPool_ControlService {
|
|
28
28
|
|
|
29
29
|
/** A wrapped in-memory pool (a Dynamo LVS engine; VÁLTOZATLAN — kompozíció, nem módosítás). */
|
|
30
30
|
private readonly pool: LVS_VectorPool_ControlService;
|
|
@@ -98,12 +98,13 @@ export class DyNTS_LVS_PersistentVectorPool {
|
|
|
98
98
|
* Visszaadja a betöltött vektorok számát. **NEM** Atlas — saját Mongo + in-memory pool.
|
|
99
99
|
*/
|
|
100
100
|
async hydrateFromMongo(): Promise<number> {
|
|
101
|
-
const records:
|
|
101
|
+
const records: DyNTS_LVS_VectorPersist[] =
|
|
102
102
|
await this.getPersistService().findByCollectionKey(this.collectionKey);
|
|
103
103
|
|
|
104
104
|
this.pool.clearPool();
|
|
105
105
|
|
|
106
106
|
let loaded: number = 0;
|
|
107
|
+
|
|
107
108
|
for (const record of records) {
|
|
108
109
|
if (!record.vectorId || !record.embedding?.length) {
|
|
109
110
|
continue;
|
|
@@ -115,6 +116,7 @@ export class DyNTS_LVS_PersistentVectorPool {
|
|
|
115
116
|
DyFM_Log.log(
|
|
116
117
|
`[DyNTS LVS hydrate] '${this.collectionKey}' pool: ${loaded} vektor betöltve az in-memory pool-ba.`,
|
|
117
118
|
);
|
|
119
|
+
|
|
118
120
|
return loaded;
|
|
119
121
|
}
|
|
120
122
|
|
|
@@ -123,9 +125,10 @@ export class DyNTS_LVS_PersistentVectorPool {
|
|
|
123
125
|
* kezében van a rekord-halmaz (pl. batch-boot). A pool-t előbb üríti (idempotens). Visszaadja a
|
|
124
126
|
* betöltött vektorok számát.
|
|
125
127
|
*/
|
|
126
|
-
hydrate(records:
|
|
128
|
+
hydrate(records: DyNTS_LVS_VectorPersist[]): number {
|
|
127
129
|
this.pool.clearPool();
|
|
128
130
|
let loaded: number = 0;
|
|
131
|
+
|
|
129
132
|
for (const record of records) {
|
|
130
133
|
if (!record.vectorId || !record.embedding?.length) {
|
|
131
134
|
continue;
|
|
@@ -133,6 +136,7 @@ export class DyNTS_LVS_PersistentVectorPool {
|
|
|
133
136
|
this.pool.addVector(record.vectorId, record.embedding);
|
|
134
137
|
loaded++;
|
|
135
138
|
}
|
|
139
|
+
|
|
136
140
|
return loaded;
|
|
137
141
|
}
|
|
138
142
|
|
|
@@ -3,7 +3,7 @@ import { DyFM_EnvironmentFlag } from '@futdevpro/fsm-dynamo';
|
|
|
3
3
|
|
|
4
4
|
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
5
5
|
import { DyNTS_GlobalService } from '../../../_services/core/global.service';
|
|
6
|
-
import {
|
|
6
|
+
import { DyNTS_LVS_VectorPersist } from '../_models/data-models/lvs-vector-persist.data-model';
|
|
7
7
|
import { DyNTS_LVS_VectorPersist_DataService } from './lvs-vector-persist.data-service';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -36,7 +36,7 @@ describe('| DyNTS_LVS_VectorPersist_DataService', () => {
|
|
|
36
36
|
describe('| constructor', () => {
|
|
37
37
|
|
|
38
38
|
it('| should create the service with a data model', () => {
|
|
39
|
-
const data:
|
|
39
|
+
const data: DyNTS_LVS_VectorPersist = new DyNTS_LVS_VectorPersist({
|
|
40
40
|
collectionKey: 'pool-a',
|
|
41
41
|
vectorId: 'v1',
|
|
42
42
|
embedding: [1, 2, 3],
|
|
@@ -56,7 +56,7 @@ describe('| DyNTS_LVS_VectorPersist_DataService', () => {
|
|
|
56
56
|
new DyNTS_LVS_VectorPersist_DataService({ issuer: 'issuer-123' });
|
|
57
57
|
|
|
58
58
|
expect(service).toBeInstanceOf(DyNTS_LVS_VectorPersist_DataService);
|
|
59
|
-
expect(service.data).toBeInstanceOf(
|
|
59
|
+
expect(service.data).toBeInstanceOf(DyNTS_LVS_VectorPersist);
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
|
|
@@ -66,12 +66,12 @@ describe('| DyNTS_LVS_VectorPersist_DataService', () => {
|
|
|
66
66
|
const service: DyNTS_LVS_VectorPersist_DataService =
|
|
67
67
|
new DyNTS_LVS_VectorPersist_DataService({ issuer: 'issuer-123' });
|
|
68
68
|
|
|
69
|
-
const records:
|
|
70
|
-
new
|
|
69
|
+
const records: DyNTS_LVS_VectorPersist[] = [
|
|
70
|
+
new DyNTS_LVS_VectorPersist({ collectionKey: 'pool-a', vectorId: 'v1', embedding: [1, 0] }),
|
|
71
71
|
];
|
|
72
72
|
const findSpy = spyOn(service, 'findDataList').and.returnValue(Promise.resolve(records));
|
|
73
73
|
|
|
74
|
-
const result:
|
|
74
|
+
const result: DyNTS_LVS_VectorPersist[] = await service.findByCollectionKey('pool-a');
|
|
75
75
|
|
|
76
76
|
expect(findSpy).toHaveBeenCalledTimes(1);
|
|
77
77
|
const filterArg = findSpy.calls.mostRecent().args[0] as { collectionKey: string };
|
|
@@ -86,7 +86,7 @@ describe('| DyNTS_LVS_VectorPersist_DataService', () => {
|
|
|
86
86
|
const service: DyNTS_LVS_VectorPersist_DataService =
|
|
87
87
|
new DyNTS_LVS_VectorPersist_DataService({ issuer: 'issuer-123' });
|
|
88
88
|
|
|
89
|
-
const existing:
|
|
89
|
+
const existing: DyNTS_LVS_VectorPersist = new DyNTS_LVS_VectorPersist({
|
|
90
90
|
collectionKey: 'pool-a', vectorId: 'v1', embedding: [1, 2, 3],
|
|
91
91
|
});
|
|
92
92
|
existing._id = 'rec-1';
|
|
@@ -118,14 +118,14 @@ describe('| DyNTS_LVS_VectorPersist_DataService', () => {
|
|
|
118
118
|
spyOn(service, 'findData').and.returnValue(Promise.resolve(null));
|
|
119
119
|
const updateSpy = spyOn(service, 'updateData').and.returnValue(Promise.resolve());
|
|
120
120
|
const saveSpy = spyOn(service, 'saveData')
|
|
121
|
-
.and.callFake((data?:
|
|
122
|
-
Promise.resolve(data as
|
|
121
|
+
.and.callFake((data?: DyNTS_LVS_VectorPersist) =>
|
|
122
|
+
Promise.resolve(data as DyNTS_LVS_VectorPersist));
|
|
123
123
|
|
|
124
124
|
await service.upsertVector({ collectionKey: 'pool-a', vectorId: 'v2', embedding: [0.1, 0.2] });
|
|
125
125
|
|
|
126
126
|
expect(updateSpy).not.toHaveBeenCalled();
|
|
127
127
|
expect(saveSpy).toHaveBeenCalledTimes(1);
|
|
128
|
-
const written = saveSpy.calls.mostRecent().args[0] as
|
|
128
|
+
const written = saveSpy.calls.mostRecent().args[0] as DyNTS_LVS_VectorPersist;
|
|
129
129
|
expect(written.vectorId).toBe('v2');
|
|
130
130
|
expect(written.collectionKey).toBe('pool-a');
|
|
131
131
|
expect(written.embedding).toEqual([0.1, 0.2]);
|
|
@@ -139,7 +139,7 @@ describe('| DyNTS_LVS_VectorPersist_DataService', () => {
|
|
|
139
139
|
const service: DyNTS_LVS_VectorPersist_DataService =
|
|
140
140
|
new DyNTS_LVS_VectorPersist_DataService({ issuer: 'issuer-123' });
|
|
141
141
|
|
|
142
|
-
const existing:
|
|
142
|
+
const existing: DyNTS_LVS_VectorPersist = new DyNTS_LVS_VectorPersist({
|
|
143
143
|
collectionKey: 'pool-a', vectorId: 'v1', embedding: [1, 0],
|
|
144
144
|
});
|
|
145
145
|
existing._id = 'rec-1';
|
|
@@ -3,8 +3,8 @@ import { DyFM_DBFilter, DyFM_DBFilterSimple } from '@futdevpro/fsm-dynamo';
|
|
|
3
3
|
|
|
4
4
|
import { DyNTS_DataService } from '../../../_services/base/data.service';
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
DyNTS_LVS_VectorPersist,
|
|
7
|
+
DyNTS_lvsVectorPersist_dataParams
|
|
8
8
|
} from '../_models/data-models/lvs-vector-persist.data-model';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -14,36 +14,36 @@ import {
|
|
|
14
14
|
*
|
|
15
15
|
* **FIGYELEM (memory: dynts_dataservice_eager_resolve):** a `DyNTS_DataService` base-ctor EAGER
|
|
16
16
|
* `getDBService`-t hív → a hívó NEM tarthat élő data-service-példányt mezőként; minden művelet előtt
|
|
17
|
-
* lazy `new DyNTS_LVS_VectorPersist_DataService(...)` kell (a `
|
|
17
|
+
* lazy `new DyNTS_LVS_VectorPersist_DataService(...)` kell (a `DyNTS_LVS_PersistentVectorPool_ControlService` így jár el).
|
|
18
18
|
*
|
|
19
19
|
* **Atomikus írás (memory: mongoose_mixed_atomic_write):** az upsert a `(collectionKey, vectorId)`
|
|
20
20
|
* logikai-kulcson MEGLÉVŐ rekordot `updateOne({...},{$set:{embedding,dimensions,metadata}})`-tel
|
|
21
21
|
* frissíti (a Mixed `metadata` `findOne→mutate→save` SILENT-DROP-ja ellen); ÚJ rekordot `saveData`-val ír.
|
|
22
22
|
*/
|
|
23
|
-
export class DyNTS_LVS_VectorPersist_DataService extends DyNTS_DataService<
|
|
23
|
+
export class DyNTS_LVS_VectorPersist_DataService extends DyNTS_DataService<DyNTS_LVS_VectorPersist> {
|
|
24
24
|
|
|
25
25
|
constructor(
|
|
26
26
|
set: {
|
|
27
|
-
data?:
|
|
27
|
+
data?: DyNTS_LVS_VectorPersist,
|
|
28
28
|
issuer: string,
|
|
29
29
|
},
|
|
30
30
|
) {
|
|
31
31
|
super(
|
|
32
|
-
set.data instanceof
|
|
32
|
+
set.data instanceof DyNTS_LVS_VectorPersist
|
|
33
33
|
? set.data
|
|
34
|
-
: new
|
|
35
|
-
|
|
34
|
+
: new DyNTS_LVS_VectorPersist(set.data),
|
|
35
|
+
DyNTS_lvsVectorPersist_dataParams,
|
|
36
36
|
set.issuer,
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Egy (logikai) pool ÖSSZES perzistált, nem-soft-delete-elt vektor-rekordja — a boot-hidratáláshoz
|
|
42
|
-
* (a `
|
|
42
|
+
* (a `DyNTS_LVS_PersistentVectorPool_ControlService.hydrateFromMongo` ezt tölti az in-memory pool-ba).
|
|
43
43
|
*/
|
|
44
|
-
async findByCollectionKey(collectionKey: string): Promise<
|
|
44
|
+
async findByCollectionKey(collectionKey: string): Promise<DyNTS_LVS_VectorPersist[]> {
|
|
45
45
|
return this.findDataList(
|
|
46
|
-
{ collectionKey: collectionKey }
|
|
46
|
+
{ collectionKey: collectionKey },
|
|
47
47
|
true,
|
|
48
48
|
);
|
|
49
49
|
}
|
|
@@ -59,14 +59,14 @@ export class DyNTS_LVS_VectorPersist_DataService extends DyNTS_DataService<DyNTS
|
|
|
59
59
|
embedding: number[],
|
|
60
60
|
metadata?: unknown,
|
|
61
61
|
}): Promise<void> {
|
|
62
|
-
const existing:
|
|
63
|
-
{ collectionKey: set.collectionKey, vectorId: set.vectorId }
|
|
62
|
+
const existing: DyNTS_LVS_VectorPersist = await this.findData(
|
|
63
|
+
{ collectionKey: set.collectionKey, vectorId: set.vectorId },
|
|
64
64
|
true,
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
if (existing?._id) {
|
|
68
68
|
await this.updateData({
|
|
69
|
-
filterBy: { _id: existing._id }
|
|
69
|
+
filterBy: { _id: existing._id },
|
|
70
70
|
update: {
|
|
71
71
|
$set: {
|
|
72
72
|
embedding: set.embedding,
|
|
@@ -75,11 +75,12 @@ export class DyNTS_LVS_VectorPersist_DataService extends DyNTS_DataService<DyNTS
|
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
|
+
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
await this.saveData(
|
|
82
|
-
new
|
|
83
|
+
new DyNTS_LVS_VectorPersist({
|
|
83
84
|
collectionKey: set.collectionKey,
|
|
84
85
|
vectorId: set.vectorId,
|
|
85
86
|
embedding: set.embedding,
|
|
@@ -95,10 +96,11 @@ export class DyNTS_LVS_VectorPersist_DataService extends DyNTS_DataService<DyNTS
|
|
|
95
96
|
* `removeVector`-ja után — a tartós tár is törli). `addArchive` nincs → `absolute` true-val töröl.
|
|
96
97
|
*/
|
|
97
98
|
async removeVector(collectionKey: string, vectorId: string): Promise<void> {
|
|
98
|
-
const existing:
|
|
99
|
-
{ collectionKey: collectionKey, vectorId: vectorId }
|
|
99
|
+
const existing: DyNTS_LVS_VectorPersist = await this.findData(
|
|
100
|
+
{ collectionKey: collectionKey, vectorId: vectorId },
|
|
100
101
|
true,
|
|
101
102
|
);
|
|
103
|
+
|
|
102
104
|
if (existing?._id) {
|
|
103
105
|
await this.deleteData(existing._id, true);
|
|
104
106
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Boundary: a `DyNTS_McpToolDefinition` + a `DyNTS_Mcp_Adapter` egyetlen `registerTool` choke-pontot
|
|
7
7
|
* ad — a hivatalos `@modelcontextprotocol/sdk` KIZÁRÓLAG az adaptor mögött él, így egy jövőbeli
|
|
8
|
-
* transport-/SDK-csere NEM-breaking (csak az adaptor cserélődik, a `
|
|
8
|
+
* transport-/SDK-csere NEM-breaking (csak az adaptor cserélődik, a `DyNTS_Mcp_Server_ServiceBase` + a
|
|
9
9
|
* consumer-tool-ok változatlanok). A consumer a SAJÁT tool-jait regisztrálja (a bedrock NEM definiál
|
|
10
10
|
* domain-tool-okat — csak a server-base + a transport + a registry).
|
|
11
11
|
*/
|