@futdevpro/fdp-agent-memory 0.1.0 → 1.1.14
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/LICENSE +21 -0
- package/README.md +7 -7
- package/build/package.json +6 -5
- package/build/src/_cli/_collections/fam-arg.util.js +48 -0
- package/build/src/_cli/_collections/fam-cli.const.js +40 -0
- package/build/src/_cli/_collections/fam-output.util.js +86 -0
- package/build/src/_cli/_collections/fam-project-discovery.util.js +98 -0
- package/build/src/_cli/_commands/capture.command.js +73 -0
- package/build/src/_cli/_commands/config.command.js +93 -0
- package/build/src/_cli/_commands/doctor.command.js +124 -0
- package/build/src/_cli/_commands/errors.command.js +66 -0
- package/build/src/_cli/_commands/export.command.js +65 -0
- package/build/src/_cli/_commands/find-duplicates.command.js +97 -0
- package/build/src/_cli/_commands/import.command.js +136 -0
- package/build/src/_cli/_commands/init.command.js +147 -0
- package/build/src/_cli/_commands/read.command.js +109 -0
- package/build/src/_cli/_commands/scan-projects.command.js +138 -0
- package/build/src/_cli/_commands/scan.command.js +98 -0
- package/build/src/_cli/_commands/seed.command.js +40 -0
- package/build/src/_cli/_commands/serve.command.js +373 -0
- package/build/src/_cli/_commands/start.command.js +134 -0
- package/build/src/_cli/_commands/stats.command.js +54 -0
- package/build/src/_cli/_commands/write.command.js +103 -0
- package/build/src/_cli/_models/interfaces/fam-cli-global-options.interface.js +2 -0
- package/build/src/_cli/_models/interfaces/fam-cli-output.interface.js +9 -0
- package/build/src/_cli/_models/interfaces/fam-client-result.interface.js +2 -0
- package/build/src/_cli/_services/fam-client.service.js +140 -0
- package/build/src/_cli/register-commands.js +86 -0
- package/build/src/_collections/config-catalog.const.js +67 -1
- package/build/src/_collections/fam-console.util.js +367 -0
- package/build/src/_collections/fam-entry-bootstrap.util.js +158 -4
- package/build/src/_collections/fam-error-factory.util.js +0 -9
- package/build/src/_collections/fam-mcp-bridge.util.js +49 -0
- package/build/src/_collections/fam-reference-code.util.js +105 -0
- package/build/src/_collections/fam-version.const.js +10 -0
- package/build/src/_models/data-models/fam-entry-base-properties.const.js +1 -0
- package/build/src/_models/data-models/fam-entry.data-model.js +6 -0
- package/build/src/_models/data-models/fam-ingest-run.data-model.js +3 -1
- package/build/src/_models/data-models/fam-reference.data-model.js +7 -0
- package/build/src/_modules/capture/_collections/fam-capture.const.js +11 -0
- package/build/src/_modules/capture/_services/fam-auto-capture.control-service.js +87 -0
- package/build/src/_modules/capture/index.js +8 -0
- package/build/src/_modules/embedding/_collections/fam-embedding-prefix.util.js +77 -0
- package/build/src/_modules/embedding/_services/fam-duplicate-scan.control-service.js +202 -0
- package/build/src/_modules/embedding/_services/fam-embedding-pipeline.control-service.js +33 -9
- package/build/src/_modules/embedding/_services/fam-embedding.control-service.js +21 -2
- package/build/src/_modules/embedding/_services/fam-entry.data-service.js +135 -0
- package/build/src/_modules/embedding/_services/fam-vector-search.control-service.js +42 -32
- package/build/src/_modules/embedding/index.js +4 -1
- package/build/src/_modules/export/_collections/fam-export.const.js +22 -0
- package/build/src/_modules/export/_services/fam-export.control-service.js +64 -0
- package/build/src/_modules/export/index.js +8 -0
- package/build/src/_modules/ingest/_collections/fam-famignore.util.js +83 -0
- package/build/src/_modules/ingest/_collections/fam-file-routing.util.js +59 -48
- package/build/src/_modules/ingest/_collections/fam-git-repo.util.js +193 -0
- package/build/src/_modules/ingest/_collections/fam-project-identity.util.js +134 -0
- package/build/src/_modules/ingest/_collections/fam-scan-progress.util.js +57 -0
- package/build/src/_modules/ingest/_collections/fam-scan-summary.util.js +60 -0
- package/build/src/_modules/ingest/_collections/fam-scan-weight.util.js +53 -0
- package/build/src/_modules/ingest/_collections/fam-secret-exclude.util.js +37 -14
- package/build/src/_modules/ingest/_collections/fam-sliding-chunker.util.js +34 -0
- package/build/src/_modules/ingest/_collections/fam-ts-chunker.util.js +200 -14
- package/build/src/_modules/ingest/_services/fam-delta-compare.util.js +4 -1
- package/build/src/_modules/ingest/_services/fam-ingest-run.data-service.js +7 -4
- package/build/src/_modules/ingest/_services/fam-ingest.control-service.js +349 -17
- package/build/src/_modules/ingest/_services/fam-scan.control-service.js +25 -2
- package/build/src/_modules/ingest/index.js +3 -1
- package/build/src/_modules/mcp/_collections/fam-active-rules.util.js +56 -0
- package/build/src/_modules/mcp/_collections/fam-core-tools.const.js +47 -6
- package/build/src/_modules/mcp/_services/fam-capabilities-tool.service.js +4 -4
- package/build/src/_modules/mcp/_services/fam-capability-registry.service.js +224 -18
- package/build/src/_modules/mcp/_services/fam-mcp-adapter.service.js +4 -4
- package/build/src/_modules/mcp/_services/fam-mcp-server.service.js +4 -4
- package/build/src/_modules/mcp/_services/fam-read-tool.service.js +53 -1
- package/build/src/_modules/mcp/_services/fam-write-tool.service.js +104 -8
- package/build/src/_modules/mcp/index.js +4 -4
- package/build/src/_modules/migration/_collections/fam-claude-mem-normalize.util.js +66 -3
- package/build/src/_modules/migration/_collections/fam-prompt-aggregate.util.js +143 -0
- package/build/src/_modules/migration/_collections/fam-target-mapping.util.js +19 -0
- package/build/src/_modules/migration/_enums/fam-claude-mem-source.type-enum.js +6 -0
- package/build/src/_modules/migration/_models/interfaces/fam-claude-mem.interface.js +5 -0
- package/build/src/_modules/migration/_services/fam-agent-memory-reader.service.js +125 -0
- package/build/src/_modules/migration/_services/fam-claude-mem-import.control-service.js +101 -18
- package/build/src/_modules/migration/_services/fam-import-dedup.data-service.js +53 -0
- package/build/src/_modules/migration/index.js +3 -1
- package/build/src/_modules/retrieval/_services/fam-retrieval-candidate.data-service.js +78 -4
- package/build/src/_modules/retrieval/_services/fam-retrieval.control-service.js +293 -50
- package/build/src/_modules/scope-reference/_collections/fam-scope-normalize.util.js +6 -3
- package/build/src/_modules/scope-reference/_services/fam-reference.data-service.js +18 -0
- package/build/src/_modules/scope-reference/_services/fam-scope-resolver.control-service.js +79 -20
- package/build/src/_routes/server/api/api.controller.js +34 -2
- package/build/src/_routes/server/client-app/client-app.control-service.js +1 -1
- package/build/src/_routes/server/server-status/server-status.controller.js +2 -1
- package/build/src/app.server.js +13 -1
- package/build/src/environments/environment.js +1 -1
- package/build/src/index.js +1 -1
- package/client-dist/{chunk-GHKRM4SM.js → chunk-I77GXVAQ.js} +1 -1
- package/client-dist/{chunk-LMTL7GA3.js → chunk-YXHWCJ5O.js} +1 -1
- package/client-dist/index.html +1 -1
- package/client-dist/{main-2KWB3QYK.js → main-PJPEDVJT.js} +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FAM_ActiveRules_Util = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* `FAM_ActiveRules_Util` (FEAT-005/006 P1) — a `get_active_rules` capability **pure** (DB-/provider-mentes)
|
|
6
|
+
* magja: a zóna-aktív `rules`-entry-k DETERMINISZTIKUS rendezése + kompakt row-ba képezése. A capability-
|
|
7
|
+
* handler (`FAM_CapabilityRegistry_Service.getActiveRules`) végzi a DB-orchestrációt (`expandForRead` +
|
|
8
|
+
* `loadCandidates`), és erre a util-ra delegálja a rendezést + a row-map-et — így a determinisztikus-sorrend
|
|
9
|
+
* szerződés (reprodukálható kimenet) önállóan unit-tesztelhető.
|
|
10
|
+
*
|
|
11
|
+
* **A `rules` per-tár mezők (`category`/`isActive`/`applicableScopes`/`dimensions`) a `FAM_Entry` bázison
|
|
12
|
+
* NINCSENEK** — a Mongo-doc-on igen; a loose `Partial<FAM_Rules_DataModel>` view a meglévő `as`-konvenció
|
|
13
|
+
* szerint olvassa (mint a retrieval `source`/`scopePath`).
|
|
14
|
+
*/
|
|
15
|
+
class FAM_ActiveRules_Util {
|
|
16
|
+
/**
|
|
17
|
+
* A zóna-aktív szabályok DETERMINISZTIKUS komparátora (a `sort` callback-je): weight DESC → category ASC →
|
|
18
|
+
* recency (`__lastModified`) DESC → `_id` ASC. A teljes lánc garantálja a stabil, reprodukálható sorrendet
|
|
19
|
+
* (nincs nondeterminizmus két azonos-súlyú szabálynál sem).
|
|
20
|
+
*/
|
|
21
|
+
static compare(a, b) {
|
|
22
|
+
const weightDiff = (b.weight ?? 1) - (a.weight ?? 1);
|
|
23
|
+
if (weightDiff !== 0) {
|
|
24
|
+
return weightDiff;
|
|
25
|
+
}
|
|
26
|
+
const catA = a.category ?? '';
|
|
27
|
+
const catB = b.category ?? '';
|
|
28
|
+
if (catA !== catB) {
|
|
29
|
+
return catA < catB ? -1 : 1;
|
|
30
|
+
}
|
|
31
|
+
const recA = a.__lastModified ? new Date(a.__lastModified).getTime() : 0;
|
|
32
|
+
const recB = b.__lastModified ? new Date(b.__lastModified).getTime() : 0;
|
|
33
|
+
if (recA !== recB) {
|
|
34
|
+
return recB - recA;
|
|
35
|
+
}
|
|
36
|
+
return (a._id ?? '') < (b._id ?? '') ? -1 : 1;
|
|
37
|
+
}
|
|
38
|
+
/** Egy aktív `rules`-entry → kompakt `FAM_ActiveRuleRow` (a per-tár rule-mezőkkel; a `content` opcionális). */
|
|
39
|
+
static toRow(entry, includeContent) {
|
|
40
|
+
const rule = entry;
|
|
41
|
+
return {
|
|
42
|
+
id: entry._id,
|
|
43
|
+
content: includeContent ? entry.content : undefined,
|
|
44
|
+
kind: entry.kind,
|
|
45
|
+
category: rule.category,
|
|
46
|
+
isActive: rule.isActive ?? true,
|
|
47
|
+
applicableScopes: (rule.applicableScopes ?? []),
|
|
48
|
+
dimensions: rule.dimensions ?? [],
|
|
49
|
+
tags: entry.tags ?? [],
|
|
50
|
+
weight: entry.weight ?? 1,
|
|
51
|
+
scopePath: (entry.scopePath ?? []),
|
|
52
|
+
lastModifiedMs: entry.__lastModified ? new Date(entry.__lastModified).getTime() : 0,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.FAM_ActiveRules_Util = FAM_ActiveRules_Util;
|
|
@@ -9,7 +9,7 @@ const fam_capabilities_tool_service_1 = require("../_services/fam-capabilities-t
|
|
|
9
9
|
* A 3 ADVERTISED MCP core-tool definíciója (SP-6.1/6.2/6.3/6.4, dsgn-003 §2/§3/§4/§5). EZ a
|
|
10
10
|
* single-source a `read`/`write`/`capabilities` hirdetett tool-listához — a stdio `tools/list` PONTOSAN
|
|
11
11
|
* ezt a 3-at adja vissza (dsgn-003 §6.1), a speciális eszközök NEM kerülnek ide (csak a
|
|
12
|
-
* `
|
|
12
|
+
* `FAM_CapabilityRegistry_Service`-ben élnek — diszjunkció, dsgn-003 §6.6).
|
|
13
13
|
*
|
|
14
14
|
* Minden tool: agent-barát `description` (mely tár milyen tudást tárol, dsgn-003 §5) + JSON-schema
|
|
15
15
|
* input + handler (a transport-agnosztikus core-service-re delegál; a REST UGYANEZT hívja).
|
|
@@ -57,6 +57,15 @@ const READ_INPUT_SCHEMA = {
|
|
|
57
57
|
scopeFilter: SCOPE_LAYER_ARRAY,
|
|
58
58
|
tagFilter: { type: 'array', items: { type: 'string' }, description: 'Tag-szűrő (OR).' },
|
|
59
59
|
kindFilter: { type: 'string', description: 'Egyetlen kind-szűrő.' },
|
|
60
|
+
excludeIds: {
|
|
61
|
+
type: 'array', items: { type: 'string' },
|
|
62
|
+
description: 'A MÁR injektált bejegyzés-_id-k (FEAT-006 dedup): ezeket a találatból kizárjuk.',
|
|
63
|
+
},
|
|
64
|
+
depth: {
|
|
65
|
+
type: 'string', enum: ['normal', 'deep'],
|
|
66
|
+
description: 'Feltárás-mélység: `deep` → mély feltárás (sokkal több chunk; a `read.deepTopK` '
|
|
67
|
+
+ 'az alap topK helyett). Default `normal`. Az explicit `topK` mindig felülír.',
|
|
68
|
+
},
|
|
60
69
|
},
|
|
61
70
|
required: ['tables', 'query'],
|
|
62
71
|
additionalProperties: false,
|
|
@@ -67,6 +76,13 @@ const READ_INPUT_SCHEMA = {
|
|
|
67
76
|
description: 'Default true: a hit-ek `content`-tel térnek vissza (single-pass). false → kompakt lista.',
|
|
68
77
|
},
|
|
69
78
|
globalScopeFilter: SCOPE_LAYER_ARRAY,
|
|
79
|
+
basePath: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description: 'Opcionális abszolút bázis-útvonal (pl. a hívó agent workspace-gyökere): a találatok '
|
|
82
|
+
+ '`sourceFilePath`-ja EHHEZ relatívan jön vissza (a kanonikus `absolutePath` belül tárolt, mindig '
|
|
83
|
+
+ 'visszaadott). Enélkül a `sourceFilePath` a scan-gyökérhez relatív. Több workspace-locationről '
|
|
84
|
+
+ 'futtatott agentekhez (FAM-REV-050).',
|
|
85
|
+
},
|
|
70
86
|
},
|
|
71
87
|
required: ['queries'],
|
|
72
88
|
additionalProperties: false,
|
|
@@ -82,7 +98,10 @@ const WRITE_INPUT_SCHEMA = {
|
|
|
82
98
|
operation: {
|
|
83
99
|
type: 'string',
|
|
84
100
|
enum: ['create', 'update', 'delete', 'scan-file', 'scan-folder', 'scan-project', 're-embed', 'import'],
|
|
85
|
-
description: 'A művelet (create/update/delete/scan-*/re-embed/import).'
|
|
101
|
+
description: 'A művelet (create/update/delete/scan-*/re-embed/import). ⚠️ scan-folder/scan-project ELŐTT '
|
|
102
|
+
+ 'KÖTELEZŐ lépés: tegyél `.fdpfamignore`-t a scan-gyökérbe (node_modules/Library/__pycache__/'
|
|
103
|
+
+ 'site-packages/dist/build/Logs… kizárása) — tisztán szkennelni OLCSÓBB, mint a beszkennelt junkot '
|
|
104
|
+
+ 'utólag kitakarítani (törlés + re-embed drága).',
|
|
86
105
|
},
|
|
87
106
|
scopePath: SCOPE_LAYER_ARRAY,
|
|
88
107
|
kind: { type: 'string', description: 'Opcionális kind (per-tár default).' },
|
|
@@ -93,9 +112,10 @@ const WRITE_INPUT_SCHEMA = {
|
|
|
93
112
|
importance: { type: 'number', description: 'Opcionális kvalitatív hangsúly (0..1).' },
|
|
94
113
|
target: {
|
|
95
114
|
type: 'object',
|
|
96
|
-
description: 'update/delete cél-azonosítás.'
|
|
115
|
+
description: 'update/delete cél-azonosítás. DELETE-nél a `sourceFilePath`/`absolutePath` BULK '
|
|
116
|
+
+ '(egy fájl ÖSSZES chunkja); az `absolutePath` a kanonikus egész-fájl-azonosító (FAM-REV-051).',
|
|
97
117
|
properties: {
|
|
98
|
-
by: { type: 'string', enum: ['id', 'sourceFilePath', 'query'] },
|
|
118
|
+
by: { type: 'string', enum: ['id', 'sourceFilePath', 'absolutePath', 'query'] },
|
|
99
119
|
value: { type: 'string' },
|
|
100
120
|
},
|
|
101
121
|
required: ['by', 'value'],
|
|
@@ -103,12 +123,31 @@ const WRITE_INPUT_SCHEMA = {
|
|
|
103
123
|
},
|
|
104
124
|
scan: {
|
|
105
125
|
type: 'object',
|
|
106
|
-
description: 'scan-* opciók (a scan-gyökér + glob-szűrők + dryRun).'
|
|
126
|
+
description: 'scan-* opciók (a scan-gyökér + glob-szűrők + dryRun + súly-kiemelés). ⚠️ TISZTA SCAN '
|
|
127
|
+
+ 'ELŐFELTÉTEL: (1) ELŐBB hozz létre `.fdpfamignore`-t a `path`-ban (a node_modules/Library/'
|
|
128
|
+
+ '__pycache__/site-packages/dist/build/coverage/Logs/obj/bin stb. kizárására — a default-ignore '
|
|
129
|
+
+ 'fedi a gyakori junkot, de a projekt-specifikus mappákat ITT add hozzá); (2) futtass `dryRun:true`-t '
|
|
130
|
+
+ 'ELLENŐRZÉSRE (fájl/chunk-szám). A beszkennelt junkot utólag kitakarítani (törlés + re-embed) '
|
|
131
|
+
+ 'lényegesen drágább, mint eleve tisztán szkennelni.',
|
|
107
132
|
properties: {
|
|
108
133
|
path: { type: 'string', description: 'A scan-gyökér (file/folder/project).' },
|
|
109
134
|
include: { type: 'array', items: { type: 'string' } },
|
|
110
135
|
exclude: { type: 'array', items: { type: 'string' } },
|
|
111
136
|
dryRun: { type: 'boolean', description: 'Csak felderítés (NINCS embed+persist).' },
|
|
137
|
+
weights: {
|
|
138
|
+
type: 'array',
|
|
139
|
+
description: 'Súly-kiemelés (FAM-REV-055): glob→súly, hogy a FONTOSABB fájlok chunkjai nagyobb '
|
|
140
|
+
+ 'retrieval-súlyt kapjanak (first-match-wins). Pl. [{pattern:"**/README.md", weight:5}].',
|
|
141
|
+
items: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
properties: {
|
|
144
|
+
pattern: { type: 'string', description: 'Glob-minta (projekt-relatív útra).' },
|
|
145
|
+
weight: { type: 'number', description: 'Retrieval-súly (>0; finalScore = score × weight).' },
|
|
146
|
+
},
|
|
147
|
+
required: ['pattern', 'weight'],
|
|
148
|
+
additionalProperties: false,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
112
151
|
},
|
|
113
152
|
required: ['path'],
|
|
114
153
|
additionalProperties: false,
|
|
@@ -164,7 +203,9 @@ exports.FAM_CORE_TOOLS = [
|
|
|
164
203
|
name: 'write',
|
|
165
204
|
description: 'Tudás mentése / módosítása / törlése / scan / re-embed / import — explicit, PONTOSAN 1 tár. '
|
|
166
205
|
+ 'A scope KÖTELEZŐ minden tartalom-műveletnél (create/scan-*/import). ' + TABLE_GUIDE
|
|
167
|
-
+ ' A `delete` soft-delete; a scan automatikusan chunkol + embeddel (idempotens delta).'
|
|
206
|
+
+ ' A `delete` soft-delete; a scan automatikusan chunkol + embeddel (idempotens delta). '
|
|
207
|
+
+ '⚠️ scan-folder/scan-project ELŐTT: készíts `.fdpfamignore`-t a scan-gyökérbe + `dryRun:true`-zal '
|
|
208
|
+
+ 'ellenőrizz (lásd a `scan` opciókat) — tisztán szkennelni olcsóbb, mint utólag takarítani.',
|
|
168
209
|
inputSchema: WRITE_INPUT_SCHEMA,
|
|
169
210
|
handler: async (args) => {
|
|
170
211
|
const data = await fam_write_tool_service_1.FAM_WriteTool_Service.getInstance().handle(args);
|
|
@@ -9,7 +9,7 @@ const fam_capability_registry_service_1 = require("./fam-capability-registry.ser
|
|
|
9
9
|
* Singleton. EGY belépési pont (`handle`), amit MIND az MCP-tool, MIND a REST `POST /capabilities` hív.
|
|
10
10
|
*
|
|
11
11
|
* Három action (dsgn-003 §4.1):
|
|
12
|
-
* - `list` → kategóriák + tool-nevek + egysoros leírás (a `
|
|
12
|
+
* - `list` → kategóriák + tool-nevek + egysoros leírás (a `FAM_CapabilityRegistry_Service`-ből, single-source),
|
|
13
13
|
* - `describe(name)` → a tool teljes input-schema-ja + kategória + leírás,
|
|
14
14
|
* - `invoke(name, arguments)` → a capability handler futtatása + eredmény (vagy strukturált hiba).
|
|
15
15
|
*
|
|
@@ -52,7 +52,7 @@ class FAM_CapabilitiesTool_Service {
|
|
|
52
52
|
}
|
|
53
53
|
/** `list` → kategória → tool-nevek + egysoros leírás (a registry single-source-ból). */
|
|
54
54
|
handleList(category) {
|
|
55
|
-
const descriptors = fam_capability_registry_service_1.
|
|
55
|
+
const descriptors = fam_capability_registry_service_1.FAM_CapabilityRegistry_Service.getInstance().list(category);
|
|
56
56
|
const byCategory = {};
|
|
57
57
|
for (const descriptor of descriptors) {
|
|
58
58
|
const bucket = byCategory[descriptor.category] ?? [];
|
|
@@ -94,9 +94,9 @@ class FAM_CapabilitiesTool_Service {
|
|
|
94
94
|
context: { operation: operation },
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
const descriptor = fam_capability_registry_service_1.
|
|
97
|
+
const descriptor = fam_capability_registry_service_1.FAM_CapabilityRegistry_Service.getInstance().get(name);
|
|
98
98
|
if (!descriptor) {
|
|
99
|
-
const known = fam_capability_registry_service_1.
|
|
99
|
+
const known = fam_capability_registry_service_1.FAM_CapabilityRegistry_Service.getInstance().names();
|
|
100
100
|
throw fam_error_factory_util_1.FAM_Error_Util.create({
|
|
101
101
|
errorCode: error_codes_const_1.FAM_ERROR_CODES.mcpDispatchUnknownCapability,
|
|
102
102
|
message: `Ismeretlen capability: '${name}'. Elérhető (${known.length}): ${known.slice(0, 12).join(', ')}…. `
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FAM_CapabilityRegistry_Service = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const mongoose_1 = tslib_1.__importDefault(require("mongoose"));
|
|
4
6
|
const fam_table_type_enum_1 = require("../../../_enums/fam-table.type-enum");
|
|
5
7
|
const error_codes_const_1 = require("../../../_collections/error-codes.const");
|
|
6
8
|
const fam_error_factory_util_1 = require("../../../_collections/fam-error-factory.util");
|
|
@@ -9,14 +11,18 @@ const config_data_service_1 = require("../../../_routes/server/config/config.dat
|
|
|
9
11
|
const errors_control_service_1 = require("../../../_routes/server/errors/errors.control-service");
|
|
10
12
|
const embedding_1 = require("../../embedding");
|
|
11
13
|
const ingest_1 = require("../../ingest");
|
|
14
|
+
const export_1 = require("../../export");
|
|
15
|
+
const capture_1 = require("../../capture");
|
|
12
16
|
const retrieval_1 = require("../../retrieval");
|
|
13
17
|
const migration_1 = require("../../migration");
|
|
14
18
|
const scope_reference_1 = require("../../scope-reference");
|
|
19
|
+
const fam_reference_data_model_1 = require("../../../_models/data-models/fam-reference.data-model");
|
|
15
20
|
const fam_mcp_interface_1 = require("../_models/interfaces/fam-mcp.interface");
|
|
21
|
+
const fam_active_rules_util_1 = require("../_collections/fam-active-rules.util");
|
|
16
22
|
/** A főtár-nevek a `list_tables` / `get_table_stats` capability-khez. */
|
|
17
23
|
const MAIN_TABLES = embedding_1.FAM_STORE_REGISTRY.map((entry) => entry.table);
|
|
18
24
|
/**
|
|
19
|
-
* `
|
|
25
|
+
* `FAM_CapabilityRegistry_Service` (SP-6.4, dsgn-003 §4.2) — a **discoverable speciális eszközök** belső
|
|
20
26
|
* registry-je. Singleton. A 6 kategória (config-diagnostics / high-level-stats / inspection /
|
|
21
27
|
* maintenance / import-migration / debug) minden eszköze ITT él (név + kategória + leírás + schema +
|
|
22
28
|
* handler), és **kizárólag** a `capabilities` tool-on át érhető el (`list`/`describe`/`invoke`).
|
|
@@ -30,20 +36,20 @@ const MAIN_TABLES = embedding_1.FAM_STORE_REGISTRY.map((entry) => entry.table);
|
|
|
30
36
|
* Az import/migration + néhány még-nem-épült engine handler **late-bind** (clear "pending MP-X" hiba az
|
|
31
37
|
* `invoke`-on; a `list`/`describe` ettől teljes).
|
|
32
38
|
*/
|
|
33
|
-
class
|
|
39
|
+
class FAM_CapabilityRegistry_Service {
|
|
34
40
|
static _instance;
|
|
35
41
|
/** A capability-eszközök `name` → deszkriptor map-je (a single-source katalógus). */
|
|
36
42
|
registry = new Map();
|
|
37
43
|
/** Default issuer (a capability-hibák issuer-éhez; dsgn-008). */
|
|
38
|
-
issuer = '
|
|
44
|
+
issuer = 'FAM_CapabilityRegistry_Service';
|
|
39
45
|
constructor() {
|
|
40
46
|
this.registerAll();
|
|
41
47
|
}
|
|
42
48
|
static getInstance() {
|
|
43
|
-
if (!
|
|
44
|
-
|
|
49
|
+
if (!FAM_CapabilityRegistry_Service._instance) {
|
|
50
|
+
FAM_CapabilityRegistry_Service._instance = new FAM_CapabilityRegistry_Service();
|
|
45
51
|
}
|
|
46
|
-
return
|
|
52
|
+
return FAM_CapabilityRegistry_Service._instance;
|
|
47
53
|
}
|
|
48
54
|
// =========================================================================
|
|
49
55
|
// Public registry API (a `capabilities` tool — SP-6.4 — fogyasztja)
|
|
@@ -92,13 +98,15 @@ class FAM_CapabilityRegistry {
|
|
|
92
98
|
});
|
|
93
99
|
this.register({
|
|
94
100
|
name: 'get_embedding_config', category: category,
|
|
95
|
-
description: 'A feloldott embedding-provider + modell + dimenzió + batch-méret
|
|
101
|
+
description: 'A feloldott embedding-provider + modell + (deklarált + megfigyelt) dimenzió + batch-méret.',
|
|
96
102
|
inputSchema: this.objectSchema({ table: this.tableSchema(false) }),
|
|
97
103
|
handler: async (args) => {
|
|
98
104
|
const input = this.asObject(args);
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
const table = this.optionalTable(input.table);
|
|
106
|
+
const probe = await embedding_1.FAM_Embedding_ControlService.getInstance().testProvider({ table: table });
|
|
107
|
+
// FAM-REV-044: a deklarált `dims` gyakran null (modell-natív); a `observedDims` a runtime-valóság
|
|
108
|
+
// a vektor-pool-ból (pl. 2560 a qwen3-4b-nél) — informatív + modell-váltás-detekció alapja.
|
|
109
|
+
return this.ok({ ...probe.resolved, observedDims: this.observedPoolDim(table) });
|
|
102
110
|
},
|
|
103
111
|
});
|
|
104
112
|
this.register({
|
|
@@ -283,6 +291,25 @@ class FAM_CapabilityRegistry {
|
|
|
283
291
|
return this.ok(await this.recentWrites(this.optionalTable(input.table), this.asNumber(input.limit)));
|
|
284
292
|
},
|
|
285
293
|
});
|
|
294
|
+
// get_active_rules (FEAT-005/006 P1) — egy zóna AKTÍV szabályai DETERMINISZTIKUSAN (vektor NÉLKÜL):
|
|
295
|
+
// a context-injekció adat-primitívje, amit a (jövőbeli) hook zóna-belépéskor hív. REUSE: `expandForRead`
|
|
296
|
+
// (scope→subtree) + `loadCandidates` (a beépített `isActive≠false` + soft-delete guarddal) — NEM új query-logika.
|
|
297
|
+
this.register({
|
|
298
|
+
name: 'get_active_rules', category: category,
|
|
299
|
+
description: 'Egy zóna (scope) AKTÍV szabályai — DETERMINISZTIKUS, vektorkeresés NÉLKÜLI lista '
|
|
300
|
+
+ '(`isActive≠false` + a scope-subtree-be eső `rules`-entry-k), súly (weight) szerint rendezve, '
|
|
301
|
+
+ 'mindegyik a `category`/`isActive`/`applicableScopes`-szal. A FEAT-005/006 kontextus-injekció '
|
|
302
|
+
+ 'adat-primitívje: a hook ezt hívja zóna-belépéskor (a „mindig-aktív szabályok" forrása). '
|
|
303
|
+
+ 'scopePath nélkül → a teljes `rules` tár aktív szabályai.',
|
|
304
|
+
inputSchema: this.objectSchema({
|
|
305
|
+
scopePath: this.scopeLayerArraySchema(),
|
|
306
|
+
includeContent: { type: 'boolean', description: 'A szabály-content visszaadása (default true).' },
|
|
307
|
+
}),
|
|
308
|
+
handler: async (args) => {
|
|
309
|
+
const input = this.asObject(args);
|
|
310
|
+
return this.ok(await this.getActiveRules(this.asScopeLayers(input.scopePath), input.includeContent !== false));
|
|
311
|
+
},
|
|
312
|
+
});
|
|
286
313
|
}
|
|
287
314
|
/** maintenance → MP-2 (re-embed) + MP-3 (rebuild reference index). */
|
|
288
315
|
registerMaintenance() {
|
|
@@ -318,6 +345,54 @@ class FAM_CapabilityRegistry {
|
|
|
318
345
|
inputSchema: this.objectSchema({}),
|
|
319
346
|
handler: async () => this.ok(await scope_reference_1.FAM_ScopeResolver_ControlService.getInstance().rebuildReferenceIndex()),
|
|
320
347
|
});
|
|
348
|
+
this.register({
|
|
349
|
+
name: 'export_authored', category: category,
|
|
350
|
+
description: 'FEAT-007: a non-file-derived (kézzel/agent-írt, `source.type ∈ {manual, agent}`) bejegyzések '
|
|
351
|
+
+ 'exportja MINDEN tárból — a re-scan-nel NEM regenerálható, pótolhatatlan kurált érték biztonsági '
|
|
352
|
+
+ 'mentése (a `contentVector` nélkül; a hívó/CLI JSON-fájlba írja).',
|
|
353
|
+
inputSchema: this.objectSchema({}),
|
|
354
|
+
handler: async () => this.ok(await new export_1.FAM_Export_ControlService().exportAuthored()),
|
|
355
|
+
});
|
|
356
|
+
this.register({
|
|
357
|
+
name: 'auto_capture', category: category,
|
|
358
|
+
description: 'FEAT-006: hook-vezérelt outbound session-observation auto-write a `memory`-tárba, '
|
|
359
|
+
+ 'content-hash deduppal (idempotens — azonos tartalom NEM duplikálódik). Agent-provenance + '
|
|
360
|
+
+ 'auto-embed; a scope default-ol, ha nincs megadva. A claude-mem auto-capture-paritás magja.',
|
|
361
|
+
inputSchema: this.objectSchema({
|
|
362
|
+
content: { type: 'string', description: 'A megfigyelés vektorizálandó szövege (kötelező).' },
|
|
363
|
+
scopePath: this.scopeLayerArraySchema(),
|
|
364
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Opcionális tagek.' },
|
|
365
|
+
kind: { type: 'string', description: 'Opcionális kind (default `observation`).' },
|
|
366
|
+
sessionId: { type: 'string', description: 'Opcionális session-azonosító (provenance a `source.path`-ban).' },
|
|
367
|
+
}),
|
|
368
|
+
handler: async (args) => {
|
|
369
|
+
const input = this.asObject(args);
|
|
370
|
+
return this.ok(await capture_1.FAM_AutoCapture_ControlService.getInstance().capture({
|
|
371
|
+
content: input.content,
|
|
372
|
+
scopePath: this.asScopeLayers(input.scopePath),
|
|
373
|
+
tags: Array.isArray(input.tags) ? input.tags : undefined,
|
|
374
|
+
kind: typeof input.kind === 'string' ? input.kind : undefined,
|
|
375
|
+
sessionId: typeof input.sessionId === 'string' ? input.sessionId : undefined,
|
|
376
|
+
}));
|
|
377
|
+
},
|
|
378
|
+
});
|
|
379
|
+
this.register({
|
|
380
|
+
name: 'manage_reference', category: category,
|
|
381
|
+
description: 'Reference (alias-/fogalom-feloldás, disambiguáció) létrehozása/frissítése: `canonicalTerm` '
|
|
382
|
+
+ '+ `aliasTerms` (ezek → a canonical) + `negativeAliases` (ezeket a reference EXPLICIT NEM oldja fel '
|
|
383
|
+
+ '— „ne keverj dolgokat") + opcionális scope-kötés (`scopePath` → canonicalScopeRef). A friss '
|
|
384
|
+
+ 'reference AZONNAL feloldódik (index-rebuild). Idempotens: `id` VAGY a `canonicalTerm` alapján upsert.',
|
|
385
|
+
inputSchema: this.objectSchema({
|
|
386
|
+
canonicalTerm: { type: 'string', description: 'A canonical (helyes) terminus — KÖTELEZŐ.' },
|
|
387
|
+
aliasTerms: { type: 'array', items: { type: 'string' }, description: 'Pozitív aliasok (typo/rövid/variáns → a canonical).' },
|
|
388
|
+
negativeAliases: { type: 'array', items: { type: 'string' }, description: 'NEGATÍV aliasok: ezeket a reference EXPLICIT NEM oldja fel (disambiguáció).' },
|
|
389
|
+
description: { type: 'string', description: 'Mit jelent / mire való (a vektor-fuzzy-hoz is).' },
|
|
390
|
+
referenceCategory: { type: 'string', description: 'A reference kategóriája (project|package|concept|person|organization).' },
|
|
391
|
+
scopePath: this.scopeLayerArraySchema(),
|
|
392
|
+
id: { type: 'string', description: 'Meglévő reference _id (frissítéshez; egyébként canonicalTerm-upsert).' },
|
|
393
|
+
}),
|
|
394
|
+
handler: async (args) => this.ok(await this.manageReference(this.asObject(args))),
|
|
395
|
+
});
|
|
321
396
|
// repair_scope_links / deduplicate_entries (MP-12) — DRY-RUN-ONLY MVP1 (safe). A destruktív
|
|
322
397
|
// write-ág (entry-mutáció / soft-delete-összevonás) BACKLOG: vak destruktív bulk-op TILOS
|
|
323
398
|
// (dsgn-003 §4.2), ezért a `dryRun:false` kérés clear "BACKLOG" hibát ad — a `dryRun:true` (default)
|
|
@@ -641,9 +716,37 @@ class FAM_CapabilityRegistry {
|
|
|
641
716
|
}
|
|
642
717
|
return Array.from(byLayer.entries()).map(([layer, bucket]) => ({ layer: layer, ...bucket }));
|
|
643
718
|
}
|
|
719
|
+
/**
|
|
720
|
+
* A megfigyelt (runtime) embedding-dimenzió a vektor-pool-ból (FAM-REV-044). A megadott tár pool-dim-je,
|
|
721
|
+
* vagy tár nélkül az első nem-null fő-tár dim. `null`, ha minden pool üres (még nem volt embed).
|
|
722
|
+
*/
|
|
723
|
+
observedPoolDim(table) {
|
|
724
|
+
const vectorSearch = embedding_1.FAM_VectorSearch_ControlService.getInstance();
|
|
725
|
+
if (table) {
|
|
726
|
+
return vectorSearch.getPoolDim(table);
|
|
727
|
+
}
|
|
728
|
+
for (const candidate of MAIN_TABLES) {
|
|
729
|
+
const dim = vectorSearch.getPoolDim(candidate);
|
|
730
|
+
if (dim !== null) {
|
|
731
|
+
return dim;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Egy modell-névhez (`dataName`) a TÉNYLEGES Mongoose-collection-név (FAM-REV-043). A Mongoose
|
|
738
|
+
* pluralizál (pl. `fam_codebase` → `fam_codebases`); a már regisztrált modellből olvassuk ki a valós
|
|
739
|
+
* nevet (a `storageUsage` a data-service-eket előbb példányosítja, így a modell regisztrált). Fallback a
|
|
740
|
+
* `dataName`, ha a modell még nincs regisztrálva (no-regression).
|
|
741
|
+
*/
|
|
742
|
+
realCollectionName(dataName) {
|
|
743
|
+
const model = mongoose_1.default.models[dataName];
|
|
744
|
+
return model?.collection?.collectionName ?? dataName;
|
|
745
|
+
}
|
|
644
746
|
/**
|
|
645
747
|
* `get_storage_usage` (MP-12) — a fő RAG-tárak + a helper collection-ök aktív doc-száma. A Dynamo
|
|
646
748
|
* base-nek nincs natív `count`, ezért aktív-elemszám (`findDataList(...).length`) — collection-méret-becslés.
|
|
749
|
+
* A `collection` a TÉNYLEGES (Mongoose-pluralizált) név (FAM-REV-043).
|
|
647
750
|
*/
|
|
648
751
|
async storageUsage() {
|
|
649
752
|
const collections = [];
|
|
@@ -651,21 +754,110 @@ class FAM_CapabilityRegistry {
|
|
|
651
754
|
for (const registryEntry of embedding_1.FAM_STORE_REGISTRY) {
|
|
652
755
|
const dataService = new embedding_1.FAM_Entry_DataService({ dataParams: registryEntry.dataParams, issuer: this.issuer });
|
|
653
756
|
const entries = await dataService.findHydratableList({});
|
|
654
|
-
collections.push({ collection:
|
|
757
|
+
collections.push({ collection: this.realCollectionName(registryEntry.dataParams.dataName), activeDocs: entries.length });
|
|
655
758
|
}
|
|
656
|
-
// Helper collection-ök (reference / scope / ingest-run / config).
|
|
759
|
+
// Helper collection-ök (reference / scope / ingest-run / config) — a DS-példányosítás regisztrálja a modellt.
|
|
657
760
|
const reference_DS = new scope_reference_1.FAM_Reference_DataService({ issuer: this.issuer });
|
|
658
|
-
collections.push({ collection: 'fam_reference', activeDocs: (await reference_DS.findActive()).length });
|
|
761
|
+
collections.push({ collection: this.realCollectionName('fam_reference'), activeDocs: (await reference_DS.findActive()).length });
|
|
659
762
|
const scope_DS = new scope_reference_1.FAM_Scope_DataService({ issuer: this.issuer });
|
|
660
|
-
collections.push({ collection: 'fam_scopes', activeDocs: (await scope_DS.findAllActive()).length });
|
|
763
|
+
collections.push({ collection: this.realCollectionName('fam_scopes'), activeDocs: (await scope_DS.findAllActive()).length });
|
|
661
764
|
const run_DS = new ingest_1.FAM_IngestRun_DataService({ issuer: this.issuer });
|
|
662
|
-
collections.push({ collection: 'fam_ingest_runs', activeDocs: (await run_DS.listRuns()).length });
|
|
765
|
+
collections.push({ collection: this.realCollectionName('fam_ingest_runs'), activeDocs: (await run_DS.listRuns()).length });
|
|
663
766
|
const config_DS = new config_data_service_1.FAM_Config_DataService({ issuer: this.issuer });
|
|
664
|
-
collections.push({ collection: 'fam_config', activeDocs: (await config_DS.findActiveList({})).length });
|
|
767
|
+
collections.push({ collection: this.realCollectionName('fam_config'), activeDocs: (await config_DS.findActiveList({})).length });
|
|
665
768
|
const totalActiveDocs = collections.reduce((sum, entry) => sum + entry.activeDocs, 0);
|
|
666
769
|
return { collections: collections, totalActiveDocs: totalActiveDocs };
|
|
667
770
|
}
|
|
668
771
|
// =========================================================================
|
|
772
|
+
// FEAT-005/006 P1: get_active_rules (zóna-aktív szabályok — determinisztikus)
|
|
773
|
+
// =========================================================================
|
|
774
|
+
/**
|
|
775
|
+
* `get_active_rules` (FEAT-005/006 P1) — egy zóna (scope) AKTÍV szabályainak DETERMINISZTIKUS, vektor-
|
|
776
|
+
* keresés NÉLKÜLI listája. REUSE (nincs új query-logika): a `expandForRead` a scope-filtert subtree-
|
|
777
|
+
* scopeId-halmazzá oldja (UGYANÚGY, mint a `read`), a `loadCandidates` pedig a `rules`-tárból a beépített
|
|
778
|
+
* `isActive≠false` + soft-delete guarddal szűr — itt NINCS vektor-lépés, az ÖSSZES aktív szabály visszajön.
|
|
779
|
+
* Rendezés: weight DESC → category ASC → recency DESC → `_id` ASC (stabil, reprodukálható). scopePath
|
|
780
|
+
* nélkül → a teljes `rules` tár (scopeIdSet=null). Ez a primitív, amit a FEAT-006 hook zóna-belépéskor hív.
|
|
781
|
+
*/
|
|
782
|
+
async getActiveRules(rawScope, includeContent) {
|
|
783
|
+
const expand = await scope_reference_1.FAM_ScopeResolver_ControlService.getInstance()
|
|
784
|
+
.expandForRead(rawScope.length ? rawScope : undefined);
|
|
785
|
+
const candidates = await new retrieval_1.FAM_RetrievalCandidate_DataService().loadCandidates({
|
|
786
|
+
table: fam_table_type_enum_1.FAM_Table.rules,
|
|
787
|
+
scopeIdSet: expand.scopeIdSet,
|
|
788
|
+
});
|
|
789
|
+
candidates.sort(fam_active_rules_util_1.FAM_ActiveRules_Util.compare);
|
|
790
|
+
return {
|
|
791
|
+
scopeFilter: rawScope.map((layer) => ({ layer: layer.layer, rawName: layer.rawName })),
|
|
792
|
+
count: candidates.length,
|
|
793
|
+
deterministic: true,
|
|
794
|
+
rules: candidates.map((entry) => fam_active_rules_util_1.FAM_ActiveRules_Util.toRow(entry, includeContent)),
|
|
795
|
+
uncertaintyNotes: expand.uncertaintyNotes,
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* `manage_reference` — reference (alias-/fogalom-feloldás + disambiguáció) idempotens upsert-je. A
|
|
800
|
+
* `negativeAliases` a „ne keverj dolgokat" veto (a reference EXPLICIT nem oldja fel azokat a tokeneket).
|
|
801
|
+
* Idempotencia: `id` VAGY a normalizált `canonicalTerm` alapján. Opcionális `scopePath` → `canonicalScopeRef`
|
|
802
|
+
* (a write-resolve leaf-je). A `saveData` után index-rebuild → a friss reference AZONNAL feloldódik.
|
|
803
|
+
*/
|
|
804
|
+
async manageReference(input) {
|
|
805
|
+
const canonicalTerm = this.asString(input.canonicalTerm);
|
|
806
|
+
if (!canonicalTerm) {
|
|
807
|
+
throw fam_error_factory_util_1.FAM_Error_Util.create({
|
|
808
|
+
errorCode: error_codes_const_1.FAM_ERROR_CODES.mcpDispatchUnknownCapability,
|
|
809
|
+
message: 'A `manage_reference`-hez a `canonicalTerm` (string) KÖTELEZŐ.',
|
|
810
|
+
issuer: this.issuer, context: { operation: 'capability-invoke:manage_reference' },
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
const referenceDataService = new scope_reference_1.FAM_Reference_DataService({ issuer: this.issuer });
|
|
814
|
+
// Opcionális scope-kötés → canonicalScopeRef (a write-resolve leaf-je).
|
|
815
|
+
let canonicalScopeRef;
|
|
816
|
+
let scopeLayer;
|
|
817
|
+
const rawScope = this.asScopeLayers(input.scopePath);
|
|
818
|
+
if (rawScope.length) {
|
|
819
|
+
const resolved = await scope_reference_1.FAM_ScopeResolver_ControlService.getInstance().resolveForWrite(rawScope);
|
|
820
|
+
canonicalScopeRef = resolved.scopePath[resolved.scopePath.length - 1];
|
|
821
|
+
scopeLayer = canonicalScopeRef?.layer;
|
|
822
|
+
}
|
|
823
|
+
// Meglévő reference (id VAGY normalizált canonicalTerm) → upsert.
|
|
824
|
+
const id = this.asString(input.id);
|
|
825
|
+
let existing;
|
|
826
|
+
if (id) {
|
|
827
|
+
existing = await referenceDataService.findReferenceById(id);
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
const target = scope_reference_1.FAM_ScopeNormalize_Util.normalize(canonicalTerm);
|
|
831
|
+
existing = (await referenceDataService.findActive())
|
|
832
|
+
.find((reference) => scope_reference_1.FAM_ScopeNormalize_Util.normalize(reference.canonicalTerm) === target);
|
|
833
|
+
}
|
|
834
|
+
const model = new fam_reference_data_model_1.FAM_Reference_DataModel({
|
|
835
|
+
_id: existing?._id,
|
|
836
|
+
canonicalTerm: canonicalTerm,
|
|
837
|
+
aliasTerms: this.asStringList(input.aliasTerms),
|
|
838
|
+
negativeAliases: this.asStringList(input.negativeAliases),
|
|
839
|
+
description: this.asString(input.description),
|
|
840
|
+
category: this.asString(input.referenceCategory) ?? 'concept',
|
|
841
|
+
scopeLayer: scopeLayer,
|
|
842
|
+
canonicalScopeRef: canonicalScopeRef,
|
|
843
|
+
});
|
|
844
|
+
const saved = await referenceDataService.saveData(model);
|
|
845
|
+
await scope_reference_1.FAM_ScopeResolver_ControlService.getInstance().rebuildReferenceIndex();
|
|
846
|
+
return {
|
|
847
|
+
ok: true, referenceId: saved._id, created: !existing, canonicalTerm: canonicalTerm,
|
|
848
|
+
aliasTerms: model.aliasTerms, negativeAliases: model.negativeAliases,
|
|
849
|
+
scope: canonicalScopeRef?.canonicalName,
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
/** Egy érték string-tömbként (a nem-string elemek kiszűrve; üres/nem-tömb → undefined). */
|
|
853
|
+
asStringList(value) {
|
|
854
|
+
if (!Array.isArray(value)) {
|
|
855
|
+
return undefined;
|
|
856
|
+
}
|
|
857
|
+
const list = value.filter((item) => typeof item === 'string' && item.length > 0);
|
|
858
|
+
return list.length ? list : undefined;
|
|
859
|
+
}
|
|
860
|
+
// =========================================================================
|
|
669
861
|
// MP-12 inspection: kinds/tags / recent-writes
|
|
670
862
|
// =========================================================================
|
|
671
863
|
/** `list_kinds_tags` (MP-12) — per-tár distinct kind/tag eloszlás (előfordulás-szám) az aktív entry-kből. */
|
|
@@ -1017,6 +1209,16 @@ class FAM_CapabilityRegistry {
|
|
|
1017
1209
|
},
|
|
1018
1210
|
path: { type: 'string', description: 'export-JSON/SQLite útvonal VAGY worker base-URL.' },
|
|
1019
1211
|
includePrompts: { type: 'boolean', description: 'A user_prompt-ok be-importálása (default false).' },
|
|
1212
|
+
excludeTypes: {
|
|
1213
|
+
type: 'array', items: { type: 'string' },
|
|
1214
|
+
description: 'Kurált-subset (L3 „A"): kihagyandó observation-type-ok, pl. ["discovery","change"] '
|
|
1215
|
+
+ '(a low-signal bulk; a summary/prompt marad). A preview is a szűrt halmazt mutatja.',
|
|
1216
|
+
},
|
|
1217
|
+
maxRecords: {
|
|
1218
|
+
type: 'number',
|
|
1219
|
+
description: 'Teszt-/biztonsági limit: a beolvasott+szűrt rekordok max-száma (a többi levágva), '
|
|
1220
|
+
+ 'pl. egy kis teszt-import a pipeline ellenőrzésére a teljes import előtt.',
|
|
1221
|
+
},
|
|
1020
1222
|
});
|
|
1021
1223
|
}
|
|
1022
1224
|
/** A map/run import-schema: a forrás-schema + az `overrides` blokk (byType/byId/scope/includePrompts). */
|
|
@@ -1039,6 +1241,10 @@ class FAM_CapabilityRegistry {
|
|
|
1039
1241
|
from: this.asImportFrom(input.from),
|
|
1040
1242
|
path: this.asString(input.path),
|
|
1041
1243
|
includePrompts: typeof input.includePrompts === 'boolean' ? input.includePrompts : undefined,
|
|
1244
|
+
excludeTypes: Array.isArray(input.excludeTypes)
|
|
1245
|
+
? input.excludeTypes.filter((value) => typeof value === 'string')
|
|
1246
|
+
: undefined,
|
|
1247
|
+
maxRecords: typeof input.maxRecords === 'number' ? input.maxRecords : undefined,
|
|
1042
1248
|
overrides: this.asImportOverrides(input.overrides),
|
|
1043
1249
|
};
|
|
1044
1250
|
}
|
|
@@ -1177,4 +1383,4 @@ class FAM_CapabilityRegistry {
|
|
|
1177
1383
|
return { table: table, scopePath: expand.scopePath };
|
|
1178
1384
|
}
|
|
1179
1385
|
}
|
|
1180
|
-
exports.
|
|
1386
|
+
exports.FAM_CapabilityRegistry_Service = FAM_CapabilityRegistry_Service;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FAM_Mcp_Adapter_Service = void 0;
|
|
4
4
|
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
5
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
6
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
7
7
|
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
8
8
|
/**
|
|
9
|
-
* `
|
|
9
|
+
* `FAM_Mcp_Adapter_Service` (SP-6.1, BFR-AM-003 workaround) — a hivatalos `@modelcontextprotocol/sdk` köré
|
|
10
10
|
* épített **vékony adaptor-réteg**. EGY `registerTool` choke-pont + a `tools/list` / `tools/call`
|
|
11
11
|
* JSON-RPC handler-ek bekötése — semmi domain-logika. Így a bedrock `DyNTS_Mcp_ServerBase` (MP-15)
|
|
12
12
|
* landolásakor CSAK ez az osztály cserélődik; a 3 core tool + a capability-registry kód változatlan.
|
|
@@ -19,7 +19,7 @@ const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
|
19
19
|
* strukturált `CallToolResult { isError:true, content }`-tá fordul — soha nem néma, soha nem crash-el
|
|
20
20
|
* a szerver. A handler `FAM_McpToolOutcome.isError` is ide képződik.
|
|
21
21
|
*/
|
|
22
|
-
class
|
|
22
|
+
class FAM_Mcp_Adapter_Service {
|
|
23
23
|
/** A SDK MCP-szerver (a transport-agnosztikus protocol-réteg). */
|
|
24
24
|
server;
|
|
25
25
|
/** A regisztrált tool-definíciók `name` → def map-je (a `tools/call` dispatch-hez). */
|
|
@@ -120,4 +120,4 @@ class FAM_Mcp_Adapter {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
exports.
|
|
123
|
+
exports.FAM_Mcp_Adapter_Service = FAM_Mcp_Adapter_Service;
|
|
@@ -7,7 +7,7 @@ const fam_capability_registry_service_1 = require("./fam-capability-registry.ser
|
|
|
7
7
|
const fam_mcp_adapter_service_1 = require("./fam-mcp-adapter.service");
|
|
8
8
|
/**
|
|
9
9
|
* `FAM_McpServer_Service` (SP-6.1, dsgn-003 §1/§5/§6) — az MCP-szerver orchestrátora. Singleton.
|
|
10
|
-
* Felelősség: a `
|
|
10
|
+
* Felelősség: a `FAM_Mcp_Adapter_Service`-be regisztrálja a **PONTOSAN 3** advertised core-tool-t
|
|
11
11
|
* (`read`/`write`/`capabilities`), példányosítja a capability-registry-t (a discoverable speciális
|
|
12
12
|
* eszközök single-source-a — diszjunkt halmaz, dsgn-003 §6.6), és a stdio transporton elindítja a
|
|
13
13
|
* szervert (`start`).
|
|
@@ -35,14 +35,14 @@ class FAM_McpServer_Service {
|
|
|
35
35
|
* smoke: a szerver felépül + 3 tool-t hirdet, transport nélkül).
|
|
36
36
|
*/
|
|
37
37
|
build(set) {
|
|
38
|
-
const adapter = new fam_mcp_adapter_service_1.
|
|
38
|
+
const adapter = new fam_mcp_adapter_service_1.FAM_Mcp_Adapter_Service({ name: set.name, version: set.version });
|
|
39
39
|
// A PONTOSAN 3 advertised core-tool regisztrálása (a single-source `FAM_CORE_TOOLS`-ból).
|
|
40
40
|
for (const tool of fam_core_tools_const_1.FAM_CORE_TOOLS) {
|
|
41
41
|
adapter.registerTool(tool);
|
|
42
42
|
}
|
|
43
43
|
// A capability-registry példányosítása (a discoverable speciális eszközök katalógusa) — ezek
|
|
44
44
|
// NEM advertised tool-ok, csak a `capabilities` tool-on át elérhetők (diszjunkció).
|
|
45
|
-
fam_capability_registry_service_1.
|
|
45
|
+
fam_capability_registry_service_1.FAM_CapabilityRegistry_Service.getInstance();
|
|
46
46
|
this.adapter = adapter;
|
|
47
47
|
return adapter;
|
|
48
48
|
}
|
|
@@ -63,7 +63,7 @@ class FAM_McpServer_Service {
|
|
|
63
63
|
}
|
|
64
64
|
/** A discoverable capability-nevek (a diszjunkció-teszthez: ezek SOHA nem advertised). */
|
|
65
65
|
getCapabilityNames() {
|
|
66
|
-
return fam_capability_registry_service_1.
|
|
66
|
+
return fam_capability_registry_service_1.FAM_CapabilityRegistry_Service.getInstance().names();
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
exports.FAM_McpServer_Service = FAM_McpServer_Service;
|