monomind 1.11.6 → 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/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 +9 -1
- 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/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-initializer.js +0 -42
- 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 -10
- package/packages/@monomind/guidance/package.json +1 -2
- 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,
|
|
@@ -1221,48 +1221,6 @@ export async function loadEmbeddingModel(options) {
|
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
1223
|
try {
|
|
1224
|
-
// Tier 0: @monomind/embeddings — bundles @xenova/transformers as a hard dep, so it
|
|
1225
|
-
// resolves from the CLI even when a bare `import('@xenova/transformers')` does NOT
|
|
1226
|
-
// (the CLI doesn't declare @xenova directly). Without this, the chain below falls
|
|
1227
|
-
// straight through to the hash fallback and "semantic" search is lexical-only.
|
|
1228
|
-
const embPkg = await import('@monomind/embeddings').catch(() => null);
|
|
1229
|
-
if (embPkg && typeof embPkg.createEmbeddingService === 'function') {
|
|
1230
|
-
try {
|
|
1231
|
-
const service = embPkg.createEmbeddingService({
|
|
1232
|
-
provider: 'transformers',
|
|
1233
|
-
model: 'Xenova/all-MiniLM-L6-v2',
|
|
1234
|
-
normalization: 'l2',
|
|
1235
|
-
enableCache: true,
|
|
1236
|
-
});
|
|
1237
|
-
// Probe triggers the (lazy) model load and verifies real vectors come back.
|
|
1238
|
-
const probe = await service.embed('probe');
|
|
1239
|
-
const probeVec = probe?.embedding;
|
|
1240
|
-
const dims = (probeVec && probeVec.length) || 384;
|
|
1241
|
-
if (probeVec && dims > 1) {
|
|
1242
|
-
if (verbose) {
|
|
1243
|
-
console.log(`Loaded @monomind/embeddings (Transformers MiniLM-L6, ${dims}d)...`);
|
|
1244
|
-
}
|
|
1245
|
-
embeddingModelState = {
|
|
1246
|
-
loaded: true,
|
|
1247
|
-
// Match generateEmbedding's consumer: a callable returning a plain number[]
|
|
1248
|
-
// (it accepts either `{ data }` or an Array.isArray(...) result).
|
|
1249
|
-
model: async (text) => Array.from((await service.embed(String(text))).embedding),
|
|
1250
|
-
tokenizer: null,
|
|
1251
|
-
dimensions: dims,
|
|
1252
|
-
};
|
|
1253
|
-
return {
|
|
1254
|
-
success: true,
|
|
1255
|
-
dimensions: dims,
|
|
1256
|
-
modelName: '@monomind/embeddings (transformers/MiniLM-L6)',
|
|
1257
|
-
loadTime: Date.now() - startTime,
|
|
1258
|
-
};
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
catch {
|
|
1262
|
-
// Embeddings package present but model load failed (offline / download error);
|
|
1263
|
-
// fall through to the remaining providers and ultimately the hash fallback.
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
1224
|
// Try to import @xenova/transformers for ONNX embeddings
|
|
1267
1225
|
const transformers = await import('@xenova/transformers').catch(() => null);
|
|
1268
1226
|
if (transformers) {
|
|
@@ -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
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code (headless) LLM caller for semantic-routing fallback.
|
|
3
|
+
*
|
|
4
|
+
* Monomind always runs on top of Claude Code, so low-confidence route
|
|
5
|
+
* classification is delegated to the local `claude` CLI in headless print
|
|
6
|
+
* mode — NOT to the Anthropic API with a managed key. There is no
|
|
7
|
+
* `@anthropic-ai/sdk` dependency and no `ANTHROPIC_API_KEY` requirement: the
|
|
8
|
+
* host's existing Claude Code auth is reused.
|
|
9
|
+
*
|
|
10
|
+
* The returned function matches `LLMFallbackConfig.llmCaller` from
|
|
11
|
+
* `@monomind/routing` — `(prompt: string) => Promise<string>`. When the
|
|
12
|
+
* `claude` CLI is unavailable it throws, which the routing layer already
|
|
13
|
+
* catches and degrades to the best semantic match.
|
|
14
|
+
*/
|
|
15
|
+
import { spawn, execSync } from 'child_process';
|
|
16
|
+
import { tmpdir } from 'os';
|
|
17
|
+
/** Default model for routing fallback — Haiku is fast and cheap for slug classification. */
|
|
18
|
+
const DEFAULT_ROUTING_MODEL = 'haiku';
|
|
19
|
+
/**
|
|
20
|
+
* Max time to wait for a single classification before giving up.
|
|
21
|
+
* `claude --print` is a full headless session (cold start ~10s, can spike),
|
|
22
|
+
* so this is generous; the routing layer degrades to the best semantic match
|
|
23
|
+
* on timeout rather than blocking the caller.
|
|
24
|
+
*/
|
|
25
|
+
const DEFAULT_TIMEOUT_MS = 45_000;
|
|
26
|
+
let claudeAvailable = null;
|
|
27
|
+
/** Cheap, cached check that the `claude` CLI is installed and on PATH. */
|
|
28
|
+
export function isClaudeCodeAvailable() {
|
|
29
|
+
if (claudeAvailable !== null)
|
|
30
|
+
return claudeAvailable;
|
|
31
|
+
try {
|
|
32
|
+
execSync('claude --version', { encoding: 'utf-8', stdio: 'pipe', timeout: 5000, windowsHide: true });
|
|
33
|
+
claudeAvailable = true;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
claudeAvailable = false;
|
|
37
|
+
}
|
|
38
|
+
return claudeAvailable;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build an `llmCaller` that delegates a classification prompt to a headless
|
|
42
|
+
* Claude Code agent (`claude --print --model <model> -- <prompt>`).
|
|
43
|
+
*
|
|
44
|
+
* Returns `null` when the `claude` CLI is not available, so callers can omit
|
|
45
|
+
* `llmFallback` entirely and let routing run keyword + semantic only.
|
|
46
|
+
*/
|
|
47
|
+
export function createClaudeLLMCaller(options = {}) {
|
|
48
|
+
if (!isClaudeCodeAvailable())
|
|
49
|
+
return null;
|
|
50
|
+
const model = options.model ?? DEFAULT_ROUTING_MODEL;
|
|
51
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
52
|
+
const cwd = options.cwd ?? tmpdir();
|
|
53
|
+
return (prompt) => new Promise((resolve, reject) => {
|
|
54
|
+
const env = { ...process.env };
|
|
55
|
+
// Don't let the child detect a "nested" session.
|
|
56
|
+
delete env.CLAUDE_SESSION_ID;
|
|
57
|
+
delete env.CLAUDE_PARENT_SESSION_ID;
|
|
58
|
+
// Constrain to a pure one-shot classifier:
|
|
59
|
+
// --strict-mcp-config (with no --mcp-config) loads ZERO MCP servers, so
|
|
60
|
+
// the child never loads monomind's own MCP server — avoids latency and
|
|
61
|
+
// a potential routing→MCP→routing recursion.
|
|
62
|
+
// --no-session-persistence keeps throwaway classification calls out of
|
|
63
|
+
// the user's session history.
|
|
64
|
+
// `--` terminates option parsing so a prompt can't smuggle flags.
|
|
65
|
+
const child = spawn('claude', ['--print', '--model', model, '--strict-mcp-config', '--no-session-persistence', '--', prompt], {
|
|
66
|
+
cwd,
|
|
67
|
+
env,
|
|
68
|
+
// 'ignore' closes stdin at spawn so `claude --print` doesn't block on EOF.
|
|
69
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
70
|
+
windowsHide: true,
|
|
71
|
+
});
|
|
72
|
+
let stdout = '';
|
|
73
|
+
let stderr = '';
|
|
74
|
+
let settled = false;
|
|
75
|
+
const timer = setTimeout(() => {
|
|
76
|
+
if (settled)
|
|
77
|
+
return;
|
|
78
|
+
try {
|
|
79
|
+
child.kill('SIGTERM');
|
|
80
|
+
}
|
|
81
|
+
catch { /* may already be dead */ }
|
|
82
|
+
settled = true;
|
|
83
|
+
reject(new Error(`claude routing fallback timed out after ${timeoutMs}ms`));
|
|
84
|
+
}, timeoutMs);
|
|
85
|
+
timer.unref?.();
|
|
86
|
+
child.stdout?.on('data', (d) => { stdout += d.toString(); });
|
|
87
|
+
child.stderr?.on('data', (d) => { stderr += d.toString(); });
|
|
88
|
+
child.on('error', (err) => {
|
|
89
|
+
if (settled)
|
|
90
|
+
return;
|
|
91
|
+
settled = true;
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
reject(err);
|
|
94
|
+
});
|
|
95
|
+
child.on('close', (code) => {
|
|
96
|
+
if (settled)
|
|
97
|
+
return;
|
|
98
|
+
settled = true;
|
|
99
|
+
clearTimeout(timer);
|
|
100
|
+
if (code === 0) {
|
|
101
|
+
resolve(stdout.trim());
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
reject(new Error(stderr.trim() || `claude exited with code ${code}`));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=llm-caller.js.map
|
|
@@ -6,12 +6,8 @@ import * as semver from 'semver';
|
|
|
6
6
|
// Known compatibility matrix between @monomind packages
|
|
7
7
|
const COMPATIBILITY_MATRIX = {
|
|
8
8
|
'@monomind/cli': {
|
|
9
|
-
'@monomind/embeddings': { minVersion: '3.0.0-alpha.1' },
|
|
10
9
|
'@monomind/security': { minVersion: '3.0.0-alpha.1' },
|
|
11
10
|
},
|
|
12
|
-
'@monomind/embeddings': {
|
|
13
|
-
'@monomind/cli': { minVersion: '3.0.0-alpha.50' },
|
|
14
|
-
},
|
|
15
11
|
};
|
|
16
12
|
// Known breaking changes by version
|
|
17
13
|
const BREAKING_CHANGES = {
|
|
@@ -22,12 +18,6 @@ const BREAKING_CHANGES = {
|
|
|
22
18
|
'Agent spawning now requires type parameter',
|
|
23
19
|
],
|
|
24
20
|
},
|
|
25
|
-
'@monomind/embeddings': {
|
|
26
|
-
'3.0.0': [
|
|
27
|
-
'Switched from better-sqlite3 to sql.js',
|
|
28
|
-
'New initialization required with initEmbeddings()',
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
21
|
};
|
|
32
22
|
export function validateUpdate(packageName, fromVersion, toVersion, installedPackages) {
|
|
33
23
|
const result = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -87,26 +87,20 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"ws": "^8.18.0",
|
|
89
89
|
"@noble/ed25519": "^2.1.0",
|
|
90
|
-
"@monoes/monograph": "^1.
|
|
90
|
+
"@monoes/monograph": "^1.2.0",
|
|
91
91
|
"@monomind/aidefence": "workspace:*",
|
|
92
|
-
"@monomind/embeddings": "workspace:*",
|
|
93
92
|
"@monomind/guidance": "workspace:*",
|
|
94
93
|
"@monomind/mcp": "workspace:*",
|
|
94
|
+
"@monomind/routing": "workspace:*",
|
|
95
95
|
"graphology": "^0.25.4",
|
|
96
|
-
"graphology-communities-louvain": "^2.0.1",
|
|
97
96
|
"graphology-metrics": "^2.4.0",
|
|
98
|
-
"graphology-shortest-path": "^2.0.2",
|
|
99
|
-
"graphology-traversal": "^0.3.1",
|
|
100
|
-
"graphology-types": "^0.24.7",
|
|
101
|
-
"chokidar": "^3.6.0",
|
|
102
97
|
"semver": "^7.6.0"
|
|
103
98
|
},
|
|
104
99
|
"optionalDependencies": {
|
|
105
100
|
"sql.js": "^1.14.1",
|
|
106
101
|
"@monoes/memory": "workspace:*",
|
|
107
102
|
"@monomind/plugin-gastown-bridge": "^0.1.3",
|
|
108
|
-
"agentic-flow": "^3.0.0-alpha.1"
|
|
109
|
-
"@anthropic-ai/sdk": "*"
|
|
103
|
+
"agentic-flow": "^3.0.0-alpha.1"
|
|
110
104
|
},
|
|
111
105
|
"publishConfig": {
|
|
112
106
|
"access": "public",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI Embeddings Command
|
|
3
|
-
* Vector embeddings, semantic search, similarity operations
|
|
4
|
-
*
|
|
5
|
-
* Features:
|
|
6
|
-
* - Multiple providers: OpenAI, Transformers.js, Agentic-Flow, Mock
|
|
7
|
-
* - Document chunking with overlap
|
|
8
|
-
* - L2/L1/minmax/zscore normalization
|
|
9
|
-
* - Hyperbolic embeddings (Poincaré ball)
|
|
10
|
-
* - Neural substrate integration
|
|
11
|
-
* - Persistent SQLite cache
|
|
12
|
-
*
|
|
13
|
-
* github.com/nokhodian/monomind
|
|
14
|
-
*/
|
|
15
|
-
import type { Command } from '../types.js';
|
|
16
|
-
export declare const embeddingsCommand: Command;
|
|
17
|
-
export default embeddingsCommand;
|
|
18
|
-
//# sourceMappingURL=embeddings.d.ts.map
|