monomind 1.15.7 → 1.16.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monomind",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"description": "Monomind - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -1213,9 +1213,9 @@ const exportCommand = {
|
|
|
1213
1213
|
{
|
|
1214
1214
|
name: 'format',
|
|
1215
1215
|
short: 'f',
|
|
1216
|
-
description: 'Export format (json, csv, binary)',
|
|
1216
|
+
description: 'Export format (json, csv, binary, okf)',
|
|
1217
1217
|
type: 'string',
|
|
1218
|
-
choices: ['json', 'csv', 'binary'],
|
|
1218
|
+
choices: ['json', 'csv', 'binary', 'okf'],
|
|
1219
1219
|
default: 'json'
|
|
1220
1220
|
},
|
|
1221
1221
|
{
|
|
@@ -1233,7 +1233,8 @@ const exportCommand = {
|
|
|
1233
1233
|
],
|
|
1234
1234
|
examples: [
|
|
1235
1235
|
{ command: 'monomind memory export -o ./backup.json', description: 'Export all to JSON' },
|
|
1236
|
-
{ command: 'monomind memory export -o ./data.csv -f csv', description: 'Export to CSV' }
|
|
1236
|
+
{ command: 'monomind memory export -o ./data.csv -f csv', description: 'Export to CSV' },
|
|
1237
|
+
{ command: 'monomind memory export -o ./knowledge -f okf', description: 'Export as OKF bundle (directory of .md files)' }
|
|
1237
1238
|
],
|
|
1238
1239
|
action: async (ctx) => {
|
|
1239
1240
|
const outputPath = ctx.flags.output;
|
|
@@ -1243,6 +1244,44 @@ const exportCommand = {
|
|
|
1243
1244
|
return { success: false, exitCode: 1 };
|
|
1244
1245
|
}
|
|
1245
1246
|
output.printInfo(`Exporting memory to ${outputPath}...`);
|
|
1247
|
+
// OKF bundle: native export — directory of .md files with YAML frontmatter
|
|
1248
|
+
if (format === 'okf') {
|
|
1249
|
+
try {
|
|
1250
|
+
const fs = await import('fs');
|
|
1251
|
+
const path = await import('path');
|
|
1252
|
+
const { listEntries, getEntry } = await import('../memory/memory-initializer.js');
|
|
1253
|
+
const namespace = ctx.flags.namespace;
|
|
1254
|
+
const listed = await listEntries({ namespace, limit: 10000 });
|
|
1255
|
+
if (!listed.success) {
|
|
1256
|
+
output.printError(`Failed to list entries: ${listed.error}`);
|
|
1257
|
+
return { success: false, exitCode: 1 };
|
|
1258
|
+
}
|
|
1259
|
+
let written = 0;
|
|
1260
|
+
for (const entry of listed.entries) {
|
|
1261
|
+
const got = await getEntry({ key: entry.key, namespace: entry.namespace });
|
|
1262
|
+
if (!got.found || !got.entry)
|
|
1263
|
+
continue;
|
|
1264
|
+
const { key, namespace: ns, content, tags, createdAt } = got.entry;
|
|
1265
|
+
const safeKey = key.replace(/[/\\:*?"<>|]/g, '-');
|
|
1266
|
+
const dir = path.join(outputPath, ns);
|
|
1267
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
1268
|
+
const yamlEscape = (s) => s.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
1269
|
+
const tagsLine = tags.length > 0 ? `tags: [${tags.join(', ')}]\n` : '';
|
|
1270
|
+
const md = `---\ntype: Memory\nkey: "${yamlEscape(key)}"\nnamespace: "${yamlEscape(ns)}"\n${tagsLine}timestamp: ${createdAt}\n---\n\n${content}`;
|
|
1271
|
+
fs.writeFileSync(path.join(dir, `${safeKey}.md`), md, 'utf-8');
|
|
1272
|
+
written++;
|
|
1273
|
+
}
|
|
1274
|
+
output.printSuccess(`Exported ${written} entries to ${outputPath}`);
|
|
1275
|
+
if (listed.total > 10000) {
|
|
1276
|
+
output.printInfo(`Note: only first 10000 of ${listed.total} entries exported`);
|
|
1277
|
+
}
|
|
1278
|
+
return { success: true, data: { written, outputPath } };
|
|
1279
|
+
}
|
|
1280
|
+
catch (error) {
|
|
1281
|
+
output.printError(`OKF export error: ${String(error)}`);
|
|
1282
|
+
return { success: false, exitCode: 1 };
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1246
1285
|
try {
|
|
1247
1286
|
const result = await callMCPTool('memory_export', {
|
|
1248
1287
|
outputPath,
|
|
@@ -1307,6 +1346,77 @@ const importCommand = {
|
|
|
1307
1346
|
return { success: false, exitCode: 1 };
|
|
1308
1347
|
}
|
|
1309
1348
|
output.printInfo(`Importing memory from ${inputPath}...`);
|
|
1349
|
+
// OKF bundle: native import — detect directory of .md files with YAML frontmatter
|
|
1350
|
+
const fsCheck = await import('fs');
|
|
1351
|
+
const isDir = fsCheck.existsSync(inputPath) && fsCheck.statSync(inputPath).isDirectory();
|
|
1352
|
+
if (isDir) {
|
|
1353
|
+
try {
|
|
1354
|
+
const fs = await import('fs');
|
|
1355
|
+
const path = await import('path');
|
|
1356
|
+
const { storeEntry } = await import('../memory/memory-initializer.js');
|
|
1357
|
+
function parseOkfFrontmatter(raw) {
|
|
1358
|
+
if (!raw.startsWith('---\n'))
|
|
1359
|
+
return { meta: {}, body: raw };
|
|
1360
|
+
const end = raw.indexOf('\n---\n', 4);
|
|
1361
|
+
if (end === -1)
|
|
1362
|
+
return { meta: {}, body: raw };
|
|
1363
|
+
const meta = {};
|
|
1364
|
+
for (const line of raw.slice(4, end).split('\n')) {
|
|
1365
|
+
const colon = line.indexOf(':');
|
|
1366
|
+
if (colon <= 0)
|
|
1367
|
+
continue;
|
|
1368
|
+
const k = line.slice(0, colon).trim();
|
|
1369
|
+
const rawV = line.slice(colon + 1).trim();
|
|
1370
|
+
const isQuoted = rawV.startsWith('"') && rawV.endsWith('"') && rawV.length >= 2;
|
|
1371
|
+
const v = isQuoted ? rawV.slice(1, -1).replace(/\\(["\\])/g, '$1') : rawV;
|
|
1372
|
+
if (v.startsWith('[') && v.endsWith(']')) {
|
|
1373
|
+
meta[k] = v.slice(1, -1).split(',').map(s => s.trim()).filter(Boolean);
|
|
1374
|
+
}
|
|
1375
|
+
else {
|
|
1376
|
+
meta[k] = v;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
return { meta, body: raw.slice(end + 5) };
|
|
1380
|
+
}
|
|
1381
|
+
function findMdFiles(dir) {
|
|
1382
|
+
const results = [];
|
|
1383
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
1384
|
+
const full = path.join(dir, entry.name);
|
|
1385
|
+
if (entry.isDirectory())
|
|
1386
|
+
results.push(...findMdFiles(full));
|
|
1387
|
+
else if (entry.name.endsWith('.md'))
|
|
1388
|
+
results.push(full);
|
|
1389
|
+
}
|
|
1390
|
+
return results;
|
|
1391
|
+
}
|
|
1392
|
+
const overrideNs = ctx.flags.namespace;
|
|
1393
|
+
const merge = ctx.flags.merge ?? true;
|
|
1394
|
+
const files = findMdFiles(inputPath);
|
|
1395
|
+
let imported = 0, skipped = 0;
|
|
1396
|
+
const start = Date.now();
|
|
1397
|
+
for (const file of files) {
|
|
1398
|
+
const raw = fs.readFileSync(file, 'utf-8');
|
|
1399
|
+
const { meta, body } = parseOkfFrontmatter(raw);
|
|
1400
|
+
const key = meta['key'] || path.basename(file, '.md');
|
|
1401
|
+
const ns = overrideNs || meta['namespace'] || path.basename(path.dirname(file));
|
|
1402
|
+
const tags = Array.isArray(meta['tags']) ? meta['tags'] : meta['tags'] ? [meta['tags']] : [];
|
|
1403
|
+
const result = await storeEntry({ key, value: body.trim(), namespace: ns, tags, upsert: !merge });
|
|
1404
|
+
if (result.success)
|
|
1405
|
+
imported++;
|
|
1406
|
+
else
|
|
1407
|
+
skipped++;
|
|
1408
|
+
}
|
|
1409
|
+
output.printSuccess(`Imported ${imported} entries from ${inputPath}`);
|
|
1410
|
+
if (skipped > 0)
|
|
1411
|
+
output.printInfo(`Skipped ${skipped} entries (duplicates or errors)`);
|
|
1412
|
+
output.printInfo(`Duration: ${Date.now() - start}ms`);
|
|
1413
|
+
return { success: true, data: { imported, skipped } };
|
|
1414
|
+
}
|
|
1415
|
+
catch (error) {
|
|
1416
|
+
output.printError(`OKF import error: ${String(error)}`);
|
|
1417
|
+
return { success: false, exitCode: 1 };
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1310
1420
|
try {
|
|
1311
1421
|
const result = await callMCPTool('memory_import', {
|
|
1312
1422
|
inputPath,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.1",
|
|
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",
|