@remnic/cli 1.0.7 → 1.0.8
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/dist/index.js +77 -51
- package/package.json +11 -6
package/dist/index.js
CHANGED
|
@@ -1298,7 +1298,8 @@ var SUPPORTED_IMPORTERS = [
|
|
|
1298
1298
|
"chatgpt",
|
|
1299
1299
|
"claude",
|
|
1300
1300
|
"gemini",
|
|
1301
|
-
"mem0"
|
|
1301
|
+
"mem0",
|
|
1302
|
+
"supermemory"
|
|
1302
1303
|
];
|
|
1303
1304
|
function isSupportedImporterName(value) {
|
|
1304
1305
|
return SUPPORTED_IMPORTERS.includes(value);
|
|
@@ -3702,6 +3703,16 @@ function parseOpenclawPluginState(existingConfig, configPath) {
|
|
|
3702
3703
|
const slots = rawSlots ?? {};
|
|
3703
3704
|
return { plugins, entries, slots };
|
|
3704
3705
|
}
|
|
3706
|
+
function readOpenclawHooksPolicy(value) {
|
|
3707
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
3708
|
+
}
|
|
3709
|
+
function buildRemnicOpenclawHooksPolicy(legacyHooks, existingHooks) {
|
|
3710
|
+
return {
|
|
3711
|
+
...readOpenclawHooksPolicy(legacyHooks),
|
|
3712
|
+
...readOpenclawHooksPolicy(existingHooks),
|
|
3713
|
+
allowConversationAccess: true
|
|
3714
|
+
};
|
|
3715
|
+
}
|
|
3705
3716
|
function resolveOpenclawInstallMemoryDir(args) {
|
|
3706
3717
|
const existingMemoryDir = (typeof args.existingNewEntryConfig.memoryDir === "string" ? args.existingNewEntryConfig.memoryDir : void 0) || (args.migrateLegacy && typeof args.legacyConfigToMerge.memoryDir === "string" ? args.legacyConfigToMerge.memoryDir : void 0);
|
|
3707
3718
|
if (args.requestedMemoryDir) {
|
|
@@ -3924,56 +3935,59 @@ async function cmdQuery(queryText, json, explain) {
|
|
|
3924
3935
|
const config = parseConfig(remnicCfg);
|
|
3925
3936
|
const orchestrator = new Orchestrator(config);
|
|
3926
3937
|
await orchestrator.initialize();
|
|
3927
|
-
await orchestrator.deferredReady;
|
|
3928
3938
|
const service = new EngramAccessService(orchestrator);
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3939
|
+
try {
|
|
3940
|
+
if (explain) {
|
|
3941
|
+
const bench = await tryLoadBenchModule();
|
|
3942
|
+
if (bench?.runExplain) {
|
|
3943
|
+
const result2 = await bench.runExplain(service, queryText);
|
|
3944
|
+
if (json) {
|
|
3945
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
3946
|
+
} else {
|
|
3947
|
+
console.log(`Query: ${result2.query}`);
|
|
3948
|
+
console.log(`Tiers used: ${result2.tiersUsed.join(" \u2192 ")}`);
|
|
3949
|
+
console.log(`Total duration: ${result2.totalDurationMs}ms`);
|
|
3950
|
+
for (const t of result2.tierResults) {
|
|
3951
|
+
console.log(` ${t.tier}: ${t.latencyMs}ms (${t.resultsCount} results)`);
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
return;
|
|
3955
|
+
}
|
|
3956
|
+
const explainStart = Date.now();
|
|
3957
|
+
const recallResult = await service.recall({ query: queryText, mode: "auto" });
|
|
3958
|
+
const totalDurationMs = Date.now() - explainStart;
|
|
3959
|
+
const resultsCount = typeof recallResult.count === "number" ? recallResult.count : Array.isArray(recallResult.results) ? recallResult.results.length : 0;
|
|
3960
|
+
const minimalExplain = {
|
|
3961
|
+
query: queryText,
|
|
3962
|
+
totalDurationMs,
|
|
3963
|
+
resultsCount,
|
|
3964
|
+
note: "Install @remnic/bench for a full tier-level explain breakdown."
|
|
3965
|
+
};
|
|
3933
3966
|
if (json) {
|
|
3934
|
-
console.log(JSON.stringify(
|
|
3967
|
+
console.log(JSON.stringify(minimalExplain, null, 2));
|
|
3935
3968
|
} else {
|
|
3936
|
-
console.log(`Query: ${
|
|
3937
|
-
console.log(`
|
|
3938
|
-
console.log(`
|
|
3939
|
-
|
|
3940
|
-
console.log(` ${t.tier}: ${t.latencyMs}ms (${t.resultsCount} results)`);
|
|
3941
|
-
}
|
|
3969
|
+
console.log(`Query: ${minimalExplain.query}`);
|
|
3970
|
+
console.log(`Total duration: ${minimalExplain.totalDurationMs}ms`);
|
|
3971
|
+
console.log(`Results: ${minimalExplain.resultsCount}`);
|
|
3972
|
+
console.log(`Note: ${minimalExplain.note}`);
|
|
3942
3973
|
}
|
|
3943
3974
|
return;
|
|
3944
3975
|
}
|
|
3945
|
-
const
|
|
3946
|
-
const recallResult = await service.recall({ query: queryText, mode: "auto" });
|
|
3947
|
-
const totalDurationMs = Date.now() - explainStart;
|
|
3948
|
-
const resultsCount = typeof recallResult.count === "number" ? recallResult.count : Array.isArray(recallResult.results) ? recallResult.results.length : 0;
|
|
3949
|
-
const minimalExplain = {
|
|
3950
|
-
query: queryText,
|
|
3951
|
-
totalDurationMs,
|
|
3952
|
-
resultsCount,
|
|
3953
|
-
note: "Install @remnic/bench for a full tier-level explain breakdown."
|
|
3954
|
-
};
|
|
3976
|
+
const result = await service.recall({ query: queryText, mode: "auto" });
|
|
3955
3977
|
if (json) {
|
|
3956
|
-
console.log(JSON.stringify(
|
|
3978
|
+
console.log(JSON.stringify(result, null, 2));
|
|
3957
3979
|
} else {
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
if (json) {
|
|
3967
|
-
console.log(JSON.stringify(result, null, 2));
|
|
3968
|
-
} else {
|
|
3969
|
-
const memories = result.memories ?? [];
|
|
3970
|
-
if (memories.length === 0) {
|
|
3971
|
-
console.log("No results.");
|
|
3972
|
-
return;
|
|
3973
|
-
}
|
|
3974
|
-
for (const m of memories) {
|
|
3975
|
-
console.log(`- ${m.content}`);
|
|
3980
|
+
const memories = result.memories ?? [];
|
|
3981
|
+
if (memories.length === 0) {
|
|
3982
|
+
console.log("No results.");
|
|
3983
|
+
return;
|
|
3984
|
+
}
|
|
3985
|
+
for (const m of memories) {
|
|
3986
|
+
console.log(`- ${m.content}`);
|
|
3987
|
+
}
|
|
3976
3988
|
}
|
|
3989
|
+
} finally {
|
|
3990
|
+
orchestrator.abortDeferredInit();
|
|
3977
3991
|
}
|
|
3978
3992
|
}
|
|
3979
3993
|
function extractXrayRawArgs(rest) {
|
|
@@ -4031,14 +4045,18 @@ async function cmdXray(rest) {
|
|
|
4031
4045
|
await orchestrator.initialize();
|
|
4032
4046
|
await orchestrator.deferredReady;
|
|
4033
4047
|
const service = new EngramAccessService(orchestrator);
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4048
|
+
try {
|
|
4049
|
+
await runXrayCommand(rest, {
|
|
4050
|
+
recallXray: (request) => service.recallXray(request),
|
|
4051
|
+
writeFile: async (filePath, data) => {
|
|
4052
|
+
const { writeFile: fsWriteFile } = await import("fs/promises");
|
|
4053
|
+
await fsWriteFile(filePath, data, "utf8");
|
|
4054
|
+
},
|
|
4055
|
+
stdout: (line) => console.log(line)
|
|
4056
|
+
});
|
|
4057
|
+
} finally {
|
|
4058
|
+
orchestrator.abortDeferredInit();
|
|
4059
|
+
}
|
|
4042
4060
|
}
|
|
4043
4061
|
async function cmdVersions(rest) {
|
|
4044
4062
|
initLogger();
|
|
@@ -6464,6 +6482,7 @@ async function cmdOpenclawInstall(opts) {
|
|
|
6464
6482
|
const existingNewEntry = entries[REMNIC_OPENCLAW_PLUGIN_ID];
|
|
6465
6483
|
const legacyConfigToMerge = migrateLegacy && legacyEntry?.config && typeof legacyEntry.config === "object" ? legacyEntry.config : {};
|
|
6466
6484
|
const existingNewEntryConfig = existingNewEntry?.config && typeof existingNewEntry.config === "object" ? existingNewEntry.config : {};
|
|
6485
|
+
const defaultModelSource = !hasNew && !migrateLegacy ? "gateway" : "plugin";
|
|
6467
6486
|
const memoryDir = resolveOpenclawInstallMemoryDir({
|
|
6468
6487
|
requestedMemoryDir: opts.memoryDir,
|
|
6469
6488
|
existingNewEntryConfig,
|
|
@@ -6482,7 +6501,12 @@ async function cmdOpenclawInstall(opts) {
|
|
|
6482
6501
|
const newEntry = {
|
|
6483
6502
|
...legacyNonConfigFields,
|
|
6484
6503
|
...existingNewEntryFields,
|
|
6504
|
+
hooks: buildRemnicOpenclawHooksPolicy(
|
|
6505
|
+
legacyNonConfigFields.hooks,
|
|
6506
|
+
existingNewEntryFields.hooks
|
|
6507
|
+
),
|
|
6485
6508
|
config: {
|
|
6509
|
+
modelSource: defaultModelSource,
|
|
6486
6510
|
...legacyConfigToMerge,
|
|
6487
6511
|
...existingNewEntryConfig,
|
|
6488
6512
|
memoryDir
|
|
@@ -6503,6 +6527,7 @@ async function cmdOpenclawInstall(opts) {
|
|
|
6503
6527
|
const changes = [];
|
|
6504
6528
|
if (!hasNew) changes.push(`+ Added plugins.entries["${REMNIC_OPENCLAW_PLUGIN_ID}"]`);
|
|
6505
6529
|
else changes.push(`~ Updated plugins.entries["${REMNIC_OPENCLAW_PLUGIN_ID}"].config.memoryDir`);
|
|
6530
|
+
changes.push(`~ Set plugins.entries["${REMNIC_OPENCLAW_PLUGIN_ID}"].hooks.allowConversationAccess = true`);
|
|
6506
6531
|
if (!slotIsActiveLegacy && currentSlot !== REMNIC_OPENCLAW_PLUGIN_ID) {
|
|
6507
6532
|
changes.push(`~ Set plugins.slots.memory = "${REMNIC_OPENCLAW_PLUGIN_ID}" (was: ${currentSlot ?? "(unset)"})`);
|
|
6508
6533
|
} else if (slotIsActiveLegacy) {
|
|
@@ -6519,7 +6544,8 @@ async function cmdOpenclawInstall(opts) {
|
|
|
6519
6544
|
const dryRunEntries = dryRunPlugins.entries;
|
|
6520
6545
|
const entrySummary = dryRunEntries ? Object.keys(dryRunEntries).map((k) => {
|
|
6521
6546
|
const cfg = dryRunEntries[k]?.config;
|
|
6522
|
-
|
|
6547
|
+
const hooks = dryRunEntries[k]?.hooks;
|
|
6548
|
+
return ` ${k}: { hooks: { allowConversationAccess: ${hooks?.allowConversationAccess ?? "(unset)"} }, config: { memoryDir: ${cfg?.memoryDir ?? "(unset)"}, ... } }`;
|
|
6523
6549
|
}).join("\n") : " (none)";
|
|
6524
6550
|
console.log("\nResulting plugins.entries:");
|
|
6525
6551
|
console.log(entrySummary);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "CLI for Remnic memory — init, query, doctor, daemon management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"yaml": "^2.4.2",
|
|
28
|
-
"@remnic/core": "^1.1.
|
|
28
|
+
"@remnic/core": "^1.1.9"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@remnic/bench": "^1.0.0",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"@remnic/import-claude": "^0.1.0",
|
|
36
36
|
"@remnic/import-gemini": "^0.1.0",
|
|
37
37
|
"@remnic/import-lossless-claw": "^0.1.1",
|
|
38
|
-
"@remnic/import-mem0": "^0.1.0"
|
|
38
|
+
"@remnic/import-mem0": "^0.1.0",
|
|
39
|
+
"@remnic/import-supermemory": "^0.1.1"
|
|
39
40
|
},
|
|
40
41
|
"peerDependenciesMeta": {
|
|
41
42
|
"@remnic/bench": {
|
|
@@ -61,6 +62,9 @@
|
|
|
61
62
|
},
|
|
62
63
|
"@remnic/import-mem0": {
|
|
63
64
|
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"@remnic/import-supermemory": {
|
|
67
|
+
"optional": true
|
|
64
68
|
}
|
|
65
69
|
},
|
|
66
70
|
"devDependencies": {
|
|
@@ -68,12 +72,13 @@
|
|
|
68
72
|
"typescript": "^5.9.3",
|
|
69
73
|
"@remnic/bench": "1.0.1",
|
|
70
74
|
"@remnic/export-weclone": "1.0.1",
|
|
71
|
-
"@remnic/import-weclone": "1.0.1",
|
|
72
75
|
"@remnic/import-chatgpt": "0.1.0",
|
|
76
|
+
"@remnic/import-weclone": "1.0.1",
|
|
73
77
|
"@remnic/import-claude": "0.1.0",
|
|
74
|
-
"@remnic/import-
|
|
78
|
+
"@remnic/import-mem0": "0.1.0",
|
|
75
79
|
"@remnic/import-lossless-claw": "0.1.1",
|
|
76
|
-
"@remnic/import-
|
|
80
|
+
"@remnic/import-supermemory": "0.1.1",
|
|
81
|
+
"@remnic/import-gemini": "0.1.0"
|
|
77
82
|
},
|
|
78
83
|
"license": "MIT",
|
|
79
84
|
"repository": {
|