monomind 1.11.5 → 1.11.7
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/README.md +0 -1
- package/package.json +11 -4
- package/packages/@monomind/cli/README.md +0 -1
- package/packages/@monomind/cli/dist/src/commands/agent.js +8 -1
- package/packages/@monomind/cli/dist/src/commands/benchmark.js +17 -45
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -2
- package/packages/@monomind/cli/dist/src/commands/index.js +0 -7
- package/packages/@monomind/cli/dist/src/commands/monograph.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/plugins.js +1 -2
- package/packages/@monomind/cli/dist/src/commands/route.js +27 -36
- package/packages/@monomind/cli/dist/src/index.js +6 -26
- package/packages/@monomind/cli/dist/src/mcp-server.js +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +0 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +2 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.d.ts +4 -313
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +11 -1051
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +25 -25
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +4 -30
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +1 -2
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +7 -115
- package/packages/@monomind/cli/dist/src/monovector/index.d.ts +1 -8
- package/packages/@monomind/cli/dist/src/monovector/index.js +1 -13
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +0 -33
- package/packages/@monomind/cli/dist/src/routing/llm-caller.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/routing/llm-caller.js +109 -0
- package/packages/@monomind/cli/dist/src/update/checker.js +0 -1
- package/packages/@monomind/cli/dist/src/update/validator.js +0 -10
- package/packages/@monomind/cli/package.json +4 -11
- package/packages/@monomind/guidance/package.json +1 -2
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js +0 -73
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +0 -120
- package/packages/@monomind/cli/bundled-graph/package.json +0 -57
- package/packages/@monomind/cli/dist/src/commands/embeddings.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/commands/embeddings.js +0 -1628
|
@@ -51,7 +51,7 @@ const monographQueryTool = {
|
|
|
51
51
|
},
|
|
52
52
|
handler: async (input) => {
|
|
53
53
|
const { openDb, closeDb, ftsSearch } = await import('@monoes/monograph');
|
|
54
|
-
const { hybridQuery } = await import('
|
|
54
|
+
const { hybridQuery } = await import('@monoes/monograph');
|
|
55
55
|
const db = openDb(getDbPath());
|
|
56
56
|
try {
|
|
57
57
|
const limit = input.limit ?? 20;
|
|
@@ -290,7 +290,7 @@ const monographSuggestTool = {
|
|
|
290
290
|
},
|
|
291
291
|
handler: async (input) => {
|
|
292
292
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
293
|
-
const { hybridQuery } = await import('
|
|
293
|
+
const { hybridQuery } = await import('@monoes/monograph');
|
|
294
294
|
const db = openDb(getDbPath());
|
|
295
295
|
try {
|
|
296
296
|
const limit = input.limit ?? 10;
|
|
@@ -460,7 +460,7 @@ const monographStalenessTool = {
|
|
|
460
460
|
},
|
|
461
461
|
},
|
|
462
462
|
handler: async (input) => {
|
|
463
|
-
const { getMonographStaleness } = await import('
|
|
463
|
+
const { getMonographStaleness } = await import('@monoes/monograph');
|
|
464
464
|
const repoPath = input.path ?? getProjectCwd();
|
|
465
465
|
const report = await getMonographStaleness(repoPath);
|
|
466
466
|
return text(JSON.stringify(report, null, 2));
|
|
@@ -548,7 +548,7 @@ const monographContextTool = {
|
|
|
548
548
|
},
|
|
549
549
|
handler: async (input) => {
|
|
550
550
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
551
|
-
const { getMonographContext } = await import('
|
|
551
|
+
const { getMonographContext } = await import('@monoes/monograph');
|
|
552
552
|
const db = openDb(getDbPath());
|
|
553
553
|
try {
|
|
554
554
|
const result = getMonographContext(db, {
|
|
@@ -577,7 +577,7 @@ const monographImpactTool = {
|
|
|
577
577
|
},
|
|
578
578
|
handler: async (input) => {
|
|
579
579
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
580
|
-
const { getMonographImpact } = await import('
|
|
580
|
+
const { getMonographImpact } = await import('@monoes/monograph');
|
|
581
581
|
const db = openDb(getDbPath());
|
|
582
582
|
try {
|
|
583
583
|
const result = getMonographImpact(db, {
|
|
@@ -605,7 +605,7 @@ const monographDetectChangesTool = {
|
|
|
605
605
|
},
|
|
606
606
|
handler: async (input) => {
|
|
607
607
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
608
|
-
const { detectMonographChanges } = await import('
|
|
608
|
+
const { detectMonographChanges } = await import('@monoes/monograph');
|
|
609
609
|
const db = openDb(getDbPath());
|
|
610
610
|
try {
|
|
611
611
|
const result = detectMonographChanges(db, {
|
|
@@ -635,7 +635,7 @@ const monographRenameTool = {
|
|
|
635
635
|
},
|
|
636
636
|
handler: async (input) => {
|
|
637
637
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
638
|
-
const { getMonographRename } = await import('
|
|
638
|
+
const { getMonographRename } = await import('@monoes/monograph');
|
|
639
639
|
const db = openDb(getDbPath());
|
|
640
640
|
try {
|
|
641
641
|
const result = getMonographRename(db, {
|
|
@@ -665,7 +665,7 @@ const monographRouteMapTool = {
|
|
|
665
665
|
},
|
|
666
666
|
handler: async (input) => {
|
|
667
667
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
668
|
-
const { getMonographRouteMap } = await import('
|
|
668
|
+
const { getMonographRouteMap } = await import('@monoes/monograph');
|
|
669
669
|
const db = openDb(getDbPath());
|
|
670
670
|
try {
|
|
671
671
|
const result = getMonographRouteMap(db, {
|
|
@@ -694,7 +694,7 @@ const monographApiImpactTool = {
|
|
|
694
694
|
},
|
|
695
695
|
handler: async (input) => {
|
|
696
696
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
697
|
-
const { getMonographApiImpact } = await import('
|
|
697
|
+
const { getMonographApiImpact } = await import('@monoes/monograph');
|
|
698
698
|
const db = openDb(getDbPath());
|
|
699
699
|
try {
|
|
700
700
|
const result = getMonographApiImpact(db, {
|
|
@@ -721,7 +721,7 @@ const monographEmbedTool = {
|
|
|
721
721
|
},
|
|
722
722
|
handler: async (input) => {
|
|
723
723
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
724
|
-
const { runEmbed } = await import('
|
|
724
|
+
const { runEmbed } = await import('@monoes/monograph');
|
|
725
725
|
const db = openDb(getDbPath());
|
|
726
726
|
try {
|
|
727
727
|
const result = await runEmbed(db, { codeOnly: input.codeOnly ?? false, force: input.force ?? false });
|
|
@@ -752,7 +752,7 @@ const monographCypherTool = {
|
|
|
752
752
|
},
|
|
753
753
|
handler: async (input) => {
|
|
754
754
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
755
|
-
const { getMonographCypher } = await import('
|
|
755
|
+
const { getMonographCypher } = await import('@monoes/monograph');
|
|
756
756
|
const db = openDb(getDbPath());
|
|
757
757
|
try {
|
|
758
758
|
const result = getMonographCypher(db, input.query);
|
|
@@ -780,7 +780,7 @@ const monographGroupListTool = {
|
|
|
780
780
|
},
|
|
781
781
|
},
|
|
782
782
|
handler: async (input) => {
|
|
783
|
-
const { getGroupList } = await import('
|
|
783
|
+
const { getGroupList } = await import('@monoes/monograph');
|
|
784
784
|
const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
|
|
785
785
|
const result = await getGroupList(configPath);
|
|
786
786
|
return text(JSON.stringify(result, null, 2));
|
|
@@ -800,7 +800,7 @@ const monographGroupQueryTool = {
|
|
|
800
800
|
required: ['query'],
|
|
801
801
|
},
|
|
802
802
|
handler: async (input) => {
|
|
803
|
-
const { runGroupQuery } = await import('
|
|
803
|
+
const { runGroupQuery } = await import('@monoes/monograph');
|
|
804
804
|
const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
|
|
805
805
|
const results = await runGroupQuery(configPath, input.query, input.limit);
|
|
806
806
|
if (results.length === 0)
|
|
@@ -821,7 +821,7 @@ const monographWikiTool = {
|
|
|
821
821
|
},
|
|
822
822
|
handler: async (input) => {
|
|
823
823
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
824
|
-
const { getWikiToolResult } = await import('
|
|
824
|
+
const { getWikiToolResult } = await import('@monoes/monograph');
|
|
825
825
|
const db = openDb(getDbPath());
|
|
826
826
|
try {
|
|
827
827
|
const result = getWikiToolResult(db, { communityId: input.communityId });
|
|
@@ -846,7 +846,7 @@ const monographWikiBuildTool = {
|
|
|
846
846
|
},
|
|
847
847
|
handler: async (input) => {
|
|
848
848
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
849
|
-
const { runWikiBuildTool } = await import('
|
|
849
|
+
const { runWikiBuildTool } = await import('@monoes/monograph');
|
|
850
850
|
const db = openDb(getDbPath());
|
|
851
851
|
try {
|
|
852
852
|
const result = await runWikiBuildTool(db, {
|
|
@@ -874,7 +874,7 @@ const monographServeTool = {
|
|
|
874
874
|
},
|
|
875
875
|
handler: async (input) => {
|
|
876
876
|
const { openDb } = await import('@monoes/monograph');
|
|
877
|
-
const { serveMonograph } = await import('
|
|
877
|
+
const { serveMonograph } = await import('@monoes/monograph');
|
|
878
878
|
const db = openDb(getDbPath());
|
|
879
879
|
const result = await serveMonograph({
|
|
880
880
|
port: input.port ?? 7374,
|
|
@@ -896,7 +896,7 @@ const monographToolMapTool = {
|
|
|
896
896
|
},
|
|
897
897
|
handler: async (input) => {
|
|
898
898
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
899
|
-
const { getToolMap } = await import('
|
|
899
|
+
const { getToolMap } = await import('@monoes/monograph');
|
|
900
900
|
const db = openDb(getDbPath());
|
|
901
901
|
try {
|
|
902
902
|
const results = getToolMap(db, { tool: input.tool });
|
|
@@ -922,7 +922,7 @@ const monographShapeCheckTool = {
|
|
|
922
922
|
},
|
|
923
923
|
handler: async (input) => {
|
|
924
924
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
925
|
-
const { getShapeCheck } = await import('
|
|
925
|
+
const { getShapeCheck } = await import('@monoes/monograph');
|
|
926
926
|
const db = openDb(getDbPath());
|
|
927
927
|
const repoPath = getProjectCwd();
|
|
928
928
|
try {
|
|
@@ -948,7 +948,7 @@ const monographGroupSyncTool = {
|
|
|
948
948
|
},
|
|
949
949
|
},
|
|
950
950
|
handler: async (input) => {
|
|
951
|
-
const { runGroupSync } = await import('
|
|
951
|
+
const { runGroupSync } = await import('@monoes/monograph');
|
|
952
952
|
const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
|
|
953
953
|
try {
|
|
954
954
|
const result = await runGroupSync(configPath);
|
|
@@ -974,7 +974,7 @@ const monographAugmentTool = {
|
|
|
974
974
|
required: ['query'],
|
|
975
975
|
},
|
|
976
976
|
handler: async (input) => {
|
|
977
|
-
const { augmentContext } = await import('
|
|
977
|
+
const { augmentContext } = await import('@monoes/monograph');
|
|
978
978
|
const repoPath = getProjectCwd();
|
|
979
979
|
const result = await augmentContext({
|
|
980
980
|
query: input.query,
|
|
@@ -1000,7 +1000,7 @@ const monographInjectContextTool = {
|
|
|
1000
1000
|
},
|
|
1001
1001
|
},
|
|
1002
1002
|
handler: async (input) => {
|
|
1003
|
-
const { injectAiContext } = await import('
|
|
1003
|
+
const { injectAiContext } = await import('@monoes/monograph');
|
|
1004
1004
|
const repoPath = getProjectCwd();
|
|
1005
1005
|
const result = await injectAiContext({
|
|
1006
1006
|
repoPath,
|
|
@@ -1020,7 +1020,7 @@ const monographSkillGenTool = {
|
|
|
1020
1020
|
},
|
|
1021
1021
|
},
|
|
1022
1022
|
handler: async (input) => {
|
|
1023
|
-
const { generateSkillFiles } = await import('
|
|
1023
|
+
const { generateSkillFiles } = await import('@monoes/monograph');
|
|
1024
1024
|
const repoPath = getProjectCwd();
|
|
1025
1025
|
const allowedRoot = resolve(repoPath);
|
|
1026
1026
|
if (input.outputDir) {
|
|
@@ -1056,7 +1056,7 @@ const monographInstallSkillsTool = {
|
|
|
1056
1056
|
},
|
|
1057
1057
|
handler: async (input) => {
|
|
1058
1058
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
1059
|
-
const { installSkillsForPlatform } = await import('
|
|
1059
|
+
const { installSkillsForPlatform } = await import('@monoes/monograph');
|
|
1060
1060
|
const rawRepoPath = input.repoPath ?? getProjectCwd();
|
|
1061
1061
|
const repoPath = resolve(rawRepoPath);
|
|
1062
1062
|
const allowedRoot = resolve(getProjectCwd());
|
|
@@ -1149,7 +1149,7 @@ const monographDoctorTool = {
|
|
|
1149
1149
|
properties: {},
|
|
1150
1150
|
},
|
|
1151
1151
|
handler: async (_input) => {
|
|
1152
|
-
const { runDoctor } = await import('
|
|
1152
|
+
const { runDoctor } = await import('@monoes/monograph');
|
|
1153
1153
|
const repoPath = getProjectCwd();
|
|
1154
1154
|
const result = await runDoctor(repoPath);
|
|
1155
1155
|
const lines = result.checks.map(c => `${c.status === 'ok' ? '✅' : c.status === 'warn' ? '⚠️' : '❌'} ${c.name}: ${c.message}`);
|
|
@@ -1167,7 +1167,7 @@ const monographListReposTool = {
|
|
|
1167
1167
|
properties: {},
|
|
1168
1168
|
},
|
|
1169
1169
|
handler: async (_input) => {
|
|
1170
|
-
const { listRepos } = await import('
|
|
1170
|
+
const { listRepos } = await import('@monoes/monograph');
|
|
1171
1171
|
const repos = listRepos();
|
|
1172
1172
|
if (repos.length === 0)
|
|
1173
1173
|
return text('No repositories registered. Run monograph build in a repo to register it.');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* V2 Compatibility - Neural network and ML tools
|
|
5
5
|
*
|
|
6
6
|
* ✅ HYBRID Implementation:
|
|
7
|
-
* - Uses
|
|
7
|
+
* - Uses agentic-flow/reasoningbank for REAL ML embeddings when available
|
|
8
8
|
* - Falls back to deterministic hash-based embeddings when ML model not installed
|
|
9
9
|
* - Pattern storage and search with cosine similarity (real math in all tiers)
|
|
10
10
|
* - Training stores patterns as searchable embeddings (not simulated)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* V2 Compatibility - Neural network and ML tools
|
|
5
5
|
*
|
|
6
6
|
* ✅ HYBRID Implementation:
|
|
7
|
-
* - Uses
|
|
7
|
+
* - Uses agentic-flow/reasoningbank for REAL ML embeddings when available
|
|
8
8
|
* - Falls back to deterministic hash-based embeddings when ML model not installed
|
|
9
9
|
* - Pattern storage and search with cosine similarity (real math in all tiers)
|
|
10
10
|
* - Training stores patterns as searchable embeddings (not simulated)
|
|
@@ -16,42 +16,16 @@ import { existsSync, readFileSync, writeFileSync, renameSync, mkdirSync, statSyn
|
|
|
16
16
|
import { join } from 'node:path';
|
|
17
17
|
const MAX_NEURAL_STORE_BYTES = 50 * 1024 * 1024; // 50 MB
|
|
18
18
|
const NEURAL_RESERVED_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
19
|
-
// Try to import real embeddings —
|
|
19
|
+
// Try to import real embeddings — agentic-flow v1 ReasoningBank when available,
|
|
20
|
+
// otherwise the deterministic hash fallback below.
|
|
20
21
|
let realEmbeddings = null;
|
|
21
22
|
let embeddingServiceName = 'none';
|
|
22
23
|
try {
|
|
23
|
-
// Tier 1: agentic-flow v1 ReasoningBank (fastest — WASM-accelerated)
|
|
24
24
|
const rb = await import('agentic-flow/reasoningbank').catch(() => null);
|
|
25
25
|
if (rb?.computeEmbedding) {
|
|
26
26
|
realEmbeddings = { embed: async (text) => Array.from(await rb.computeEmbedding(text)) };
|
|
27
27
|
embeddingServiceName = 'agentic-flow/reasoningbank';
|
|
28
28
|
}
|
|
29
|
-
// Tier 2: @monomind/embeddings
|
|
30
|
-
if (!realEmbeddings) {
|
|
31
|
-
const embeddingsModule = await import('@monomind/embeddings').catch(() => null);
|
|
32
|
-
if (embeddingsModule?.createEmbeddingService) {
|
|
33
|
-
try {
|
|
34
|
-
const service = embeddingsModule.createEmbeddingService({ provider: 'agentic-flow' });
|
|
35
|
-
realEmbeddings = {
|
|
36
|
-
embed: async (text) => {
|
|
37
|
-
const result = await service.embed(text);
|
|
38
|
-
return Array.from(result.embedding);
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
embeddingServiceName = 'agentic-flow';
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
const service = embeddingsModule.createEmbeddingService({ provider: 'mock' });
|
|
45
|
-
realEmbeddings = {
|
|
46
|
-
embed: async (text) => {
|
|
47
|
-
const result = await service.embed(text);
|
|
48
|
-
return Array.from(result.embedding);
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
embeddingServiceName = 'mock';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
29
|
}
|
|
56
30
|
catch {
|
|
57
31
|
// No embedding provider available, will use fallback
|
|
@@ -646,7 +620,7 @@ export const neuralTools = [
|
|
|
646
620
|
const patterns = Object.values(store.patterns);
|
|
647
621
|
return {
|
|
648
622
|
_realEmbeddings: !!realEmbeddings,
|
|
649
|
-
embeddingProvider: realEmbeddings ?
|
|
623
|
+
embeddingProvider: realEmbeddings ? embeddingServiceName : 'hash-based (deterministic)',
|
|
650
624
|
models: {
|
|
651
625
|
total: models.length,
|
|
652
626
|
ready: models.filter(m => m.status === 'ready').length,
|
|
@@ -416,8 +416,7 @@ export declare function bridgeContextSynthesize(params: {
|
|
|
416
416
|
}): Promise<any>;
|
|
417
417
|
/**
|
|
418
418
|
* Route via SemanticRouter.
|
|
419
|
-
* Available since agentdb 3.0.0-alpha.10 —
|
|
420
|
-
* semantic matching with keyword fallback.
|
|
419
|
+
* Available since agentdb 3.0.0-alpha.10 — semantic matching with keyword fallback.
|
|
421
420
|
*/
|
|
422
421
|
export declare function bridgeSemanticRoute(params: {
|
|
423
422
|
input: string;
|
|
@@ -1671,8 +1671,7 @@ export async function bridgeContextSynthesize(params) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
/**
|
|
1673
1673
|
* Route via SemanticRouter.
|
|
1674
|
-
* Available since agentdb 3.0.0-alpha.10 —
|
|
1675
|
-
* semantic matching with keyword fallback.
|
|
1674
|
+
* Available since agentdb 3.0.0-alpha.10 — semantic matching with keyword fallback.
|
|
1676
1675
|
*/
|
|
1677
1676
|
export async function bridgeSemanticRoute(params) {
|
|
1678
1677
|
const registry = await getRegistry();
|
|
@@ -378,121 +378,13 @@ export async function getHNSWIndex(options) {
|
|
|
378
378
|
}
|
|
379
379
|
hnswInitializing = true;
|
|
380
380
|
try {
|
|
381
|
-
//
|
|
382
|
-
//
|
|
383
|
-
//
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
hnswInitializing = false;
|
|
387
|
-
return null; // HNSW not available — pure-JS fallback path
|
|
388
|
-
}
|
|
389
|
-
// ESM returns { default: { VectorDb, ... } }, CJS returns { VectorDb, ... }
|
|
390
|
-
const monovectorCore = monovectorModule.default || monovectorModule;
|
|
391
|
-
if (!monovectorCore?.VectorDb) {
|
|
392
|
-
hnswInitializing = false;
|
|
393
|
-
return null; // VectorDb not found
|
|
394
|
-
}
|
|
395
|
-
const { VectorDb } = monovectorCore;
|
|
396
|
-
// Persistent storage paths — resolve to absolute to survive CWD changes
|
|
397
|
-
const swarmDir = path.resolve(process.cwd(), '.swarm');
|
|
398
|
-
if (!fs.existsSync(swarmDir)) {
|
|
399
|
-
fs.mkdirSync(swarmDir, { recursive: true });
|
|
400
|
-
}
|
|
401
|
-
const hnswPath = path.join(swarmDir, 'hnsw.index');
|
|
402
|
-
const metadataPath = path.join(swarmDir, 'hnsw.metadata.json');
|
|
403
|
-
const dbPath = options?.dbPath ? path.resolve(options.dbPath) : path.join(swarmDir, 'memory.db');
|
|
404
|
-
// Create HNSW index with persistent storage
|
|
405
|
-
// @monoes/core uses string enum for distanceMetric: 'Cosine', 'Euclidean', 'DotProduct', 'Manhattan'
|
|
406
|
-
const db = new VectorDb({
|
|
407
|
-
dimensions,
|
|
408
|
-
distanceMetric: 'Cosine',
|
|
409
|
-
storagePath: hnswPath // Persistent storage!
|
|
410
|
-
});
|
|
411
|
-
// Load metadata (entry info) if exists
|
|
412
|
-
const entries = new Map();
|
|
413
|
-
if (fs.existsSync(metadataPath)) {
|
|
414
|
-
try {
|
|
415
|
-
const metadataJson = fs.readFileSync(metadataPath, 'utf-8');
|
|
416
|
-
const metadata = JSON.parse(metadataJson);
|
|
417
|
-
for (const [key, value] of metadata) {
|
|
418
|
-
entries.set(key, value);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
catch {
|
|
422
|
-
// Metadata load failed, will rebuild
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
hnswIndex = {
|
|
426
|
-
db,
|
|
427
|
-
entries,
|
|
428
|
-
dimensions,
|
|
429
|
-
initialized: false
|
|
430
|
-
};
|
|
431
|
-
// Check if index already has data (from persistent storage)
|
|
432
|
-
const existingLen = await db.len();
|
|
433
|
-
if (existingLen > 0 && entries.size > 0) {
|
|
434
|
-
// Index loaded from disk, skip SQLite sync
|
|
435
|
-
hnswIndex.initialized = true;
|
|
436
|
-
hnswInitializing = false;
|
|
437
|
-
return hnswIndex;
|
|
438
|
-
}
|
|
439
|
-
if (fs.existsSync(dbPath)) {
|
|
440
|
-
try {
|
|
441
|
-
// Reject symlinks and oversized DB files. Without this a symlink at the
|
|
442
|
-
// dbPath pointing at /dev/zero or a 100GB sparse file would OOM the CLI
|
|
443
|
-
// on the next memory operation.
|
|
444
|
-
const stat = fs.lstatSync(dbPath);
|
|
445
|
-
if (stat.isSymbolicLink() || stat.size > 256 * 1024 * 1024) {
|
|
446
|
-
return null;
|
|
447
|
-
}
|
|
448
|
-
const initSqlJs = (await import('sql.js')).default;
|
|
449
|
-
const SQL = await initSqlJs();
|
|
450
|
-
const fileBuffer = fs.readFileSync(dbPath);
|
|
451
|
-
const sqlDb = new SQL.Database(fileBuffer);
|
|
452
|
-
// Load all entries with embeddings
|
|
453
|
-
const result = sqlDb.exec(`
|
|
454
|
-
SELECT id, key, namespace, content, embedding
|
|
455
|
-
FROM memory_entries
|
|
456
|
-
WHERE status = 'active' AND embedding IS NOT NULL
|
|
457
|
-
LIMIT 10000
|
|
458
|
-
`);
|
|
459
|
-
if (result[0]?.values) {
|
|
460
|
-
for (const row of result[0].values) {
|
|
461
|
-
const [id, key, ns, content, embeddingJson] = row;
|
|
462
|
-
if (embeddingJson) {
|
|
463
|
-
try {
|
|
464
|
-
const embedding = safeParseEmbeddingLocal(embeddingJson);
|
|
465
|
-
if (!embedding)
|
|
466
|
-
continue;
|
|
467
|
-
const vector = new Float32Array(embedding);
|
|
468
|
-
await db.insert({
|
|
469
|
-
id: String(id),
|
|
470
|
-
vector
|
|
471
|
-
});
|
|
472
|
-
hnswIndex.entries.set(String(id), {
|
|
473
|
-
id: String(id),
|
|
474
|
-
key: key || String(id),
|
|
475
|
-
namespace: ns || 'default',
|
|
476
|
-
content: content || ''
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
catch {
|
|
480
|
-
// Skip invalid embeddings
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
sqlDb.close();
|
|
486
|
-
}
|
|
487
|
-
catch {
|
|
488
|
-
// SQLite load failed, start with empty index
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
// initialized = true even on empty DB — absence of vectors is a valid ready state,
|
|
492
|
-
// not a failure. The concurrent-waiter null-check at line ~395 relies on this.
|
|
493
|
-
hnswIndex.initialized = true;
|
|
381
|
+
// Native @monoes/core HNSW (WASM VectorDb) was removed in the lean teardown.
|
|
382
|
+
// This function is kept for callers that check its return value — all callers
|
|
383
|
+
// already handle null by falling back to the pure-JS / brute-force path.
|
|
384
|
+
// The AgentDB bridge (memory-bridge.ts) provides HNSW via agentdb instead.
|
|
385
|
+
// Native backend removed — return null so callers use the pure-JS fallback.
|
|
494
386
|
hnswInitializing = false;
|
|
495
|
-
return
|
|
387
|
+
return null;
|
|
496
388
|
}
|
|
497
389
|
catch {
|
|
498
390
|
hnswInitializing = false;
|
|
@@ -576,7 +468,7 @@ export async function searchHNSWIndex(queryEmbedding, options) {
|
|
|
576
468
|
continue;
|
|
577
469
|
}
|
|
578
470
|
// Convert cosine distance to similarity score (1 - distance)
|
|
579
|
-
// Cosine distance
|
|
471
|
+
// Cosine distance convention: 0 = identical, 2 = opposite
|
|
580
472
|
const score = 1 - (result.score / 2);
|
|
581
473
|
filtered.push({
|
|
582
474
|
id: entry.id.substring(0, 12),
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MonoVector Integration Module for Monomind CLI (lean)
|
|
3
3
|
*
|
|
4
|
-
* After the SONA / native / WASM teardown this module provides
|
|
5
|
-
* lightweight surface:
|
|
6
|
-
* - Capability probing: getCapabilities() — stubbed, always reports JS-only
|
|
4
|
+
* After the SONA / native / WASM teardown this module provides:
|
|
7
5
|
* - Initialization state: createInitState()
|
|
8
6
|
* - Keyword-based task routing: createKeywordRouter()
|
|
9
7
|
* - Route recommendation→outcome records: recordRoute(), joinOutcome(), accuracy
|
|
@@ -11,7 +9,6 @@
|
|
|
11
9
|
*
|
|
12
10
|
* @module @monomind/cli/monovector
|
|
13
11
|
*/
|
|
14
|
-
export { getCapabilities, getCachedCapabilities, resetCapabilitiesCache, refreshCapabilities, type MonoesCapabilities } from './capabilities.js';
|
|
15
12
|
export { createInitState, type InitState, type InitStatus } from './init-state.js';
|
|
16
13
|
export { recordRoute, joinOutcome, joinLatestUnresolved, readOutcomes, computeRoutingAccuracy, computeAdherence, type RouteOutcomeRecord, type RoutingAccuracy, } from './route-outcomes.js';
|
|
17
14
|
export { DiffClassifier, createDiffClassifier, analyzeDiff, analyzeDiffSync, assessFileRisk, assessOverallRisk, classifyDiff, suggestReviewers, getGitDiffNumstat, getGitDiffNumstatAsync, clearDiffCache, clearAllDiffCaches, type DiffClassification, type DiffHunk, type DiffChange, type FileDiff, type DiffAnalysis, type DiffClassifierConfig, type DiffFile, type RiskLevel, type FileRisk, type OverallRisk, type DiffAnalysisResult, } from './diff-classifier.js';
|
|
@@ -54,8 +51,4 @@ export interface KeywordRouterConfig {
|
|
|
54
51
|
discountFactor?: number;
|
|
55
52
|
}
|
|
56
53
|
export declare function createKeywordRouter(_config?: KeywordRouterConfig): KeywordRouter;
|
|
57
|
-
/** @deprecated Use (await getCapabilities()).sona */
|
|
58
|
-
export declare function isMonovectorAvailable(): Promise<boolean>;
|
|
59
|
-
/** @deprecated Use (await getCapabilities()).learningWasm */
|
|
60
|
-
export declare function isWasmBackendAvailable(): Promise<boolean>;
|
|
61
54
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MonoVector Integration Module for Monomind CLI (lean)
|
|
3
3
|
*
|
|
4
|
-
* After the SONA / native / WASM teardown this module provides
|
|
5
|
-
* lightweight surface:
|
|
6
|
-
* - Capability probing: getCapabilities() — stubbed, always reports JS-only
|
|
4
|
+
* After the SONA / native / WASM teardown this module provides:
|
|
7
5
|
* - Initialization state: createInitState()
|
|
8
6
|
* - Keyword-based task routing: createKeywordRouter()
|
|
9
7
|
* - Route recommendation→outcome records: recordRoute(), joinOutcome(), accuracy
|
|
@@ -11,8 +9,6 @@
|
|
|
11
9
|
*
|
|
12
10
|
* @module @monomind/cli/monovector
|
|
13
11
|
*/
|
|
14
|
-
import { getCapabilities } from './capabilities.js';
|
|
15
|
-
export { getCapabilities, getCachedCapabilities, resetCapabilitiesCache, refreshCapabilities } from './capabilities.js';
|
|
16
12
|
export { createInitState } from './init-state.js';
|
|
17
13
|
export { recordRoute, joinOutcome, joinLatestUnresolved, readOutcomes, computeRoutingAccuracy, computeAdherence, } from './route-outcomes.js';
|
|
18
14
|
export { DiffClassifier, createDiffClassifier, analyzeDiff, analyzeDiffSync, assessFileRisk, assessOverallRisk, classifyDiff, suggestReviewers, getGitDiffNumstat, getGitDiffNumstatAsync, clearDiffCache, clearAllDiffCaches, } from './diff-classifier.js';
|
|
@@ -56,12 +52,4 @@ export function createKeywordRouter(_config) {
|
|
|
56
52
|
import() { },
|
|
57
53
|
};
|
|
58
54
|
}
|
|
59
|
-
/** @deprecated Use (await getCapabilities()).sona */
|
|
60
|
-
export async function isMonovectorAvailable() {
|
|
61
|
-
return (await getCapabilities()).sona;
|
|
62
|
-
}
|
|
63
|
-
/** @deprecated Use (await getCapabilities()).learningWasm */
|
|
64
|
-
export async function isWasmBackendAvailable() {
|
|
65
|
-
return (await getCapabilities()).learningWasm;
|
|
66
|
-
}
|
|
67
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -278,38 +278,6 @@ export class PluginDiscoveryService {
|
|
|
278
278
|
issues: [],
|
|
279
279
|
},
|
|
280
280
|
},
|
|
281
|
-
{
|
|
282
|
-
id: '@monomind/embeddings',
|
|
283
|
-
name: '@monomind/embeddings',
|
|
284
|
-
displayName: 'Vector Embeddings',
|
|
285
|
-
description: 'Vector embeddings service with sql.js, document chunking, and hyperbolic embeddings',
|
|
286
|
-
version: '3.0.0',
|
|
287
|
-
cid: 'bafybeiembeddingsplugin',
|
|
288
|
-
size: 320000,
|
|
289
|
-
checksum: 'sha256:ghi789embeddings',
|
|
290
|
-
author: officialAuthor,
|
|
291
|
-
license: 'MIT',
|
|
292
|
-
categories: ['ai-ml'],
|
|
293
|
-
tags: ['embeddings', 'vectors', 'search', 'sqlite', 'hyperbolic'],
|
|
294
|
-
keywords: ['embeddings', 'vectors'],
|
|
295
|
-
downloads: 8500,
|
|
296
|
-
rating: 4.7,
|
|
297
|
-
ratingCount: 156,
|
|
298
|
-
lastUpdated: baseTime,
|
|
299
|
-
createdAt: '2024-02-01T00:00:00Z',
|
|
300
|
-
minMonomindVersion: '3.0.0',
|
|
301
|
-
dependencies: [
|
|
302
|
-
{ name: '@monomind/core', version: '^3.0.0' },
|
|
303
|
-
{ name: 'sql.js', version: '^1.8.0' },
|
|
304
|
-
],
|
|
305
|
-
type: 'core',
|
|
306
|
-
hooks: ['embeddings:embed', 'embeddings:search'],
|
|
307
|
-
commands: ['embeddings embed', 'embeddings batch', 'embeddings search'],
|
|
308
|
-
permissions: ['memory', 'filesystem'],
|
|
309
|
-
exports: ['EmbeddingsService', 'VectorStore', 'DocumentChunker'],
|
|
310
|
-
verified: true,
|
|
311
|
-
trustLevel: 'official',
|
|
312
|
-
},
|
|
313
281
|
{
|
|
314
282
|
id: '@monomind/claims',
|
|
315
283
|
name: '@monomind/claims',
|
|
@@ -712,7 +680,6 @@ export class PluginDiscoveryService {
|
|
|
712
680
|
'@monomind/claims',
|
|
713
681
|
'@monomind/security',
|
|
714
682
|
'@monomind/plugins',
|
|
715
|
-
'@monomind/embeddings',
|
|
716
683
|
'@monomind/performance',
|
|
717
684
|
'@monomind/teammate-plugin',
|
|
718
685
|
// Gas Town Bridge
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Cheap, cached check that the `claude` CLI is installed and on PATH. */
|
|
2
|
+
export declare function isClaudeCodeAvailable(): boolean;
|
|
3
|
+
export interface ClaudeLLMCallerOptions {
|
|
4
|
+
/** Routing model alias passed to `claude --model` (default: "haiku"). */
|
|
5
|
+
model?: 'haiku' | 'sonnet' | 'opus';
|
|
6
|
+
/** Per-call timeout in milliseconds (default: 20s). */
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Working directory for the spawned process. Defaults to the OS temp dir so
|
|
10
|
+
* the child does NOT inherit the host project's `.claude/` hooks (e.g.
|
|
11
|
+
* monomind's own SessionStart graph build), which would add seconds of
|
|
12
|
+
* unrelated startup work to every fallback classification.
|
|
13
|
+
*/
|
|
14
|
+
cwd?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build an `llmCaller` that delegates a classification prompt to a headless
|
|
18
|
+
* Claude Code agent (`claude --print --model <model> -- <prompt>`).
|
|
19
|
+
*
|
|
20
|
+
* Returns `null` when the `claude` CLI is not available, so callers can omit
|
|
21
|
+
* `llmFallback` entirely and let routing run keyword + semantic only.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createClaudeLLMCaller(options?: ClaudeLLMCallerOptions): ((prompt: string) => Promise<string>) | null;
|
|
24
|
+
//# sourceMappingURL=llm-caller.d.ts.map
|