@remnic/cli 1.0.25 → 9.3.515
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 +253 -112
- package/package.json +22 -22
package/dist/index.js
CHANGED
|
@@ -851,7 +851,12 @@ function validateBenchFlags(action, args) {
|
|
|
851
851
|
if (!arg.startsWith("-")) {
|
|
852
852
|
continue;
|
|
853
853
|
}
|
|
854
|
-
|
|
854
|
+
const legacyEqualsPrefix = allowed.legacyEqualsPrefixes?.find((prefix) => arg.startsWith(prefix));
|
|
855
|
+
if (legacyEqualsPrefix) {
|
|
856
|
+
const value = arg.slice(legacyEqualsPrefix.length);
|
|
857
|
+
if (value.trim().length === 0) {
|
|
858
|
+
throw new Error(`ERROR: ${legacyEqualsPrefix.slice(0, -1)} requires a value.`);
|
|
859
|
+
}
|
|
855
860
|
continue;
|
|
856
861
|
}
|
|
857
862
|
if (isBenchValueFlag(arg)) {
|
|
@@ -1974,6 +1979,66 @@ function isCandidateReady(candidate, existsSync3) {
|
|
|
1974
1979
|
function resolveServerBin(options = {}) {
|
|
1975
1980
|
return resolveServerBinDetails(options).path;
|
|
1976
1981
|
}
|
|
1982
|
+
function readVerifiedDaemonPid(options) {
|
|
1983
|
+
const readFileSync3 = options.readFileSync ?? fs4.readFileSync;
|
|
1984
|
+
const unlinkSync = options.unlinkSync ?? fs4.unlinkSync;
|
|
1985
|
+
const processKill = options.processKill ?? process.kill;
|
|
1986
|
+
const execFileSync3 = options.execFileSync ?? ((command, args, execOptions) => childProcess.execFileSync(command, args, execOptions));
|
|
1987
|
+
for (const file of options.pidFiles) {
|
|
1988
|
+
let pid;
|
|
1989
|
+
try {
|
|
1990
|
+
pid = parseDaemonPid(readFileSync3(file, "utf8"));
|
|
1991
|
+
} catch {
|
|
1992
|
+
continue;
|
|
1993
|
+
}
|
|
1994
|
+
if (pid === void 0) {
|
|
1995
|
+
removePidFileBestEffort(file, unlinkSync);
|
|
1996
|
+
continue;
|
|
1997
|
+
}
|
|
1998
|
+
try {
|
|
1999
|
+
processKill(pid, 0);
|
|
2000
|
+
} catch {
|
|
2001
|
+
removePidFileBestEffort(file, unlinkSync);
|
|
2002
|
+
continue;
|
|
2003
|
+
}
|
|
2004
|
+
const command = readProcessCommand(pid, execFileSync3);
|
|
2005
|
+
if (command === void 0) {
|
|
2006
|
+
return pid;
|
|
2007
|
+
}
|
|
2008
|
+
if (doesProcessCommandLookLikeRemnicDaemon(command, options.expectedServerBin)) {
|
|
2009
|
+
return pid;
|
|
2010
|
+
}
|
|
2011
|
+
removePidFileBestEffort(file, unlinkSync);
|
|
2012
|
+
}
|
|
2013
|
+
return void 0;
|
|
2014
|
+
}
|
|
2015
|
+
function doesProcessCommandLookLikeRemnicDaemon(command, expectedServerBin) {
|
|
2016
|
+
const normalizedCommand = command.trim();
|
|
2017
|
+
const normalizedExpected = path8.resolve(expandTilde(expectedServerBin));
|
|
2018
|
+
return normalizedCommand.includes(normalizedExpected) || /(?:^|\s|[/\\])(?:remnic-server|engram-server)(?:\.js)?(?:\s|$)/.test(normalizedCommand) || /@remnic[/\\]server[/\\]/.test(normalizedCommand) || /packages[/\\]remnic-server[/\\](?:bin[/\\]remnic-server\.js|dist[/\\]index\.js|src[/\\]index\.ts)/.test(normalizedCommand);
|
|
2019
|
+
}
|
|
2020
|
+
function parseDaemonPid(raw) {
|
|
2021
|
+
const trimmed = raw.trim();
|
|
2022
|
+
if (!/^\d+$/.test(trimmed)) return void 0;
|
|
2023
|
+
const pid = Number(trimmed);
|
|
2024
|
+
return Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
|
|
2025
|
+
}
|
|
2026
|
+
function readProcessCommand(pid, execFileSync3) {
|
|
2027
|
+
try {
|
|
2028
|
+
return execFileSync3("ps", ["-p", String(pid), "-o", "command="], {
|
|
2029
|
+
encoding: "utf8",
|
|
2030
|
+
stdio: "pipe"
|
|
2031
|
+
});
|
|
2032
|
+
} catch {
|
|
2033
|
+
return void 0;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
function removePidFileBestEffort(file, unlinkSync) {
|
|
2037
|
+
try {
|
|
2038
|
+
unlinkSync(file);
|
|
2039
|
+
} catch {
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
1977
2042
|
function inspectLaunchdPlist(plistPath, options = {}) {
|
|
1978
2043
|
const existsSync3 = options.existsSync ?? fs4.existsSync;
|
|
1979
2044
|
const readFileSync3 = options.readFileSync ?? fs4.readFileSync;
|
|
@@ -2432,7 +2497,8 @@ Usage:
|
|
|
2432
2497
|
|
|
2433
2498
|
Required:
|
|
2434
2499
|
--adapter <name> One of: ${SUPPORTED_IMPORTERS.join(" | ")}
|
|
2435
|
-
--file <path> Path to
|
|
2500
|
+
--file <path> Path to a text/JSON source export. ZIP archives
|
|
2501
|
+
are not accepted by this single-file path yet. May be
|
|
2436
2502
|
omitted for API-only adapters (mem0).
|
|
2437
2503
|
|
|
2438
2504
|
Options:
|
|
@@ -2523,6 +2589,11 @@ function rejectLeftoverImportArgs(args, command) {
|
|
|
2523
2589
|
}
|
|
2524
2590
|
}
|
|
2525
2591
|
async function runImportCommand(args, io) {
|
|
2592
|
+
if (args.file && isZipFilePath(args.file)) {
|
|
2593
|
+
throw new Error(
|
|
2594
|
+
`ZIP imports are not supported by --file yet: '${args.file}'. Extract the archive first or use --all-from-bundle for supported bundle layouts.`
|
|
2595
|
+
);
|
|
2596
|
+
}
|
|
2526
2597
|
const adapter = await io.loadAdapter(args.adapter);
|
|
2527
2598
|
let input;
|
|
2528
2599
|
if (args.file) {
|
|
@@ -2575,6 +2646,16 @@ async function runImportCommand(args, io) {
|
|
|
2575
2646
|
}
|
|
2576
2647
|
return result;
|
|
2577
2648
|
}
|
|
2649
|
+
function isZipFilePath(filePath) {
|
|
2650
|
+
return pathExtension(filePath) === ".zip";
|
|
2651
|
+
}
|
|
2652
|
+
function pathExtension(filePath) {
|
|
2653
|
+
const normalized = filePath.trim().toLowerCase();
|
|
2654
|
+
const lastSlash = Math.max(normalized.lastIndexOf("/"), normalized.lastIndexOf("\\"));
|
|
2655
|
+
const base = normalized.slice(lastSlash + 1);
|
|
2656
|
+
const dot = base.lastIndexOf(".");
|
|
2657
|
+
return dot >= 0 ? base.slice(dot) : "";
|
|
2658
|
+
}
|
|
2578
2659
|
function parseImportBundleArgs(rest) {
|
|
2579
2660
|
const args = [...rest];
|
|
2580
2661
|
if (!args.includes("--all-from-bundle")) return void 0;
|
|
@@ -3837,7 +3918,8 @@ var __benchDatasetTestHooks = {
|
|
|
3837
3918
|
seed,
|
|
3838
3919
|
benchmarkOptions
|
|
3839
3920
|
);
|
|
3840
|
-
}
|
|
3921
|
+
},
|
|
3922
|
+
printBenchStatusLineForTest: printBenchStatusLine
|
|
3841
3923
|
};
|
|
3842
3924
|
function printBenchPackageSummary(result, outputPath, outputLabel = "Results saved") {
|
|
3843
3925
|
console.log(`Benchmark: ${result.meta.benchmark}`);
|
|
@@ -3852,6 +3934,13 @@ function printBenchPackageSummary(result, outputPath, outputLabel = "Results sav
|
|
|
3852
3934
|
}
|
|
3853
3935
|
console.log(`${outputLabel}: ${outputPath}`);
|
|
3854
3936
|
}
|
|
3937
|
+
function printBenchStatusLine(jsonMode, message) {
|
|
3938
|
+
if (jsonMode) {
|
|
3939
|
+
console.error(message);
|
|
3940
|
+
} else {
|
|
3941
|
+
console.log(message);
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3855
3944
|
function printStoredBenchResultSummary(result, summary) {
|
|
3856
3945
|
printBenchPackageSummary(result, summary.path, "Stored result");
|
|
3857
3946
|
console.log(`Run id: ${summary.id}`);
|
|
@@ -4672,7 +4761,8 @@ async function runBenchViaPackage(parsed, benchmarkId, runtimeProfile, benchStat
|
|
|
4672
4761
|
if (completed % 50 === 0 || completed === total) {
|
|
4673
4762
|
const elapsed = Math.round((Date.now() - benchStartTime) / 1e3);
|
|
4674
4763
|
const remaining = total && elapsed > 0 ? Math.round((total - completed) / (completed / elapsed)) : "?";
|
|
4675
|
-
|
|
4764
|
+
printBenchStatusLine(
|
|
4765
|
+
parsed.json,
|
|
4676
4766
|
` [${benchmarkId}] ${completed}/${total ?? "?"} tasks (${elapsed}s elapsed, ~${remaining}s remaining)`
|
|
4677
4767
|
);
|
|
4678
4768
|
}
|
|
@@ -8809,109 +8899,113 @@ async function cmdConnectors(action, rest, json) {
|
|
|
8809
8899
|
const remnicCfg = raw.remnic ?? raw.engram ?? raw;
|
|
8810
8900
|
const config = parseConfig(remnicCfg);
|
|
8811
8901
|
const orchestrator = new Orchestrator(config);
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
const
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8902
|
+
try {
|
|
8903
|
+
await orchestrator.initialize();
|
|
8904
|
+
await orchestrator.deferredReady;
|
|
8905
|
+
const cfg = config.connectors;
|
|
8906
|
+
const sharedIngestFn = async (docs) => {
|
|
8907
|
+
const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
8908
|
+
const turns = docs.map((doc) => ({
|
|
8909
|
+
role: "assistant",
|
|
8910
|
+
content: doc.title ? `# ${doc.title}
|
|
8820
8911
|
|
|
8821
8912
|
${doc.content}` : doc.content,
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8913
|
+
timestamp: fetchedAt
|
|
8914
|
+
}));
|
|
8915
|
+
await orchestrator.ingestBulkImportBatch(turns);
|
|
8916
|
+
};
|
|
8917
|
+
const makeWriteCursorFn = (id) => async (state) => {
|
|
8918
|
+
await writeLiveConnectorState(config.memoryDir, id, {
|
|
8919
|
+
id,
|
|
8920
|
+
cursor: state.cursor,
|
|
8921
|
+
lastSyncAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8922
|
+
lastSyncStatus: state.lastSyncStatus,
|
|
8923
|
+
...state.lastSyncError !== void 0 ? { lastSyncError: state.lastSyncError } : {},
|
|
8924
|
+
totalDocsImported: state.totalDocsImported
|
|
8925
|
+
});
|
|
8926
|
+
};
|
|
8927
|
+
let runResult;
|
|
8928
|
+
if (connectorName === GDRIVE_ID) {
|
|
8929
|
+
if (!cfg?.googleDrive?.enabled) {
|
|
8930
|
+
process.stderr.write(
|
|
8931
|
+
`connectors run: connector "${connectorName}" is disabled. Set connectors.googleDrive.enabled=true in config.
|
|
8841
8932
|
`
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8933
|
+
);
|
|
8934
|
+
process.exitCode = 1;
|
|
8935
|
+
return;
|
|
8936
|
+
}
|
|
8937
|
+
let validatedCfg;
|
|
8938
|
+
try {
|
|
8939
|
+
validatedCfg = validateGDriveCfg(cfg.googleDrive);
|
|
8940
|
+
} catch (err) {
|
|
8941
|
+
process.stderr.write(
|
|
8942
|
+
`connectors run: invalid config for "${connectorName}": ${err instanceof Error ? err.message : String(err)}
|
|
8852
8943
|
`
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8944
|
+
);
|
|
8945
|
+
process.exitCode = 1;
|
|
8946
|
+
return;
|
|
8947
|
+
}
|
|
8948
|
+
const connector = makeGDriveConnector();
|
|
8949
|
+
const state = await readLiveConnectorState(config.memoryDir, connectorName);
|
|
8950
|
+
runResult = await pollOnce({
|
|
8951
|
+
connectorId: connectorName,
|
|
8952
|
+
priorState: state,
|
|
8953
|
+
syncFn: (cursor) => connector.syncIncremental({
|
|
8954
|
+
cursor,
|
|
8955
|
+
config: validatedCfg
|
|
8956
|
+
}),
|
|
8957
|
+
ingestFn: sharedIngestFn,
|
|
8958
|
+
writeCursorFn: makeWriteCursorFn(connectorName)
|
|
8959
|
+
});
|
|
8960
|
+
} else if (connectorName === NOTION_ID) {
|
|
8961
|
+
if (!cfg?.notion?.enabled) {
|
|
8962
|
+
process.stderr.write(
|
|
8963
|
+
`connectors run: connector "${connectorName}" is disabled. Set connectors.notion.enabled=true in config.
|
|
8964
|
+
`
|
|
8965
|
+
);
|
|
8966
|
+
process.exitCode = 1;
|
|
8967
|
+
return;
|
|
8968
|
+
}
|
|
8969
|
+
let validatedCfg;
|
|
8970
|
+
try {
|
|
8971
|
+
validatedCfg = validateNotionCfg(cfg.notion);
|
|
8972
|
+
} catch (err) {
|
|
8973
|
+
process.stderr.write(
|
|
8974
|
+
`connectors run: invalid config for "${connectorName}": ${err instanceof Error ? err.message : String(err)}
|
|
8975
|
+
`
|
|
8976
|
+
);
|
|
8977
|
+
process.exitCode = 1;
|
|
8978
|
+
return;
|
|
8979
|
+
}
|
|
8980
|
+
const connector = makeNotionConnector();
|
|
8981
|
+
const state = await readLiveConnectorState(config.memoryDir, connectorName);
|
|
8982
|
+
runResult = await pollOnce({
|
|
8983
|
+
connectorId: connectorName,
|
|
8984
|
+
priorState: state,
|
|
8985
|
+
syncFn: (cursor) => connector.syncIncremental({
|
|
8986
|
+
cursor,
|
|
8987
|
+
config: validatedCfg
|
|
8988
|
+
}),
|
|
8989
|
+
ingestFn: sharedIngestFn,
|
|
8990
|
+
writeCursorFn: makeWriteCursorFn(connectorName)
|
|
8991
|
+
});
|
|
8992
|
+
} else {
|
|
8871
8993
|
process.stderr.write(
|
|
8872
|
-
`connectors run: connector "${connectorName}"
|
|
8994
|
+
`connectors run: unknown connector "${connectorName}". Known connectors: ${GDRIVE_ID}, ${NOTION_ID}.
|
|
8873
8995
|
`
|
|
8874
8996
|
);
|
|
8875
8997
|
process.exitCode = 1;
|
|
8876
8998
|
return;
|
|
8877
8999
|
}
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
} catch (err) {
|
|
8882
|
-
process.stderr.write(
|
|
8883
|
-
`connectors run: invalid config for "${connectorName}": ${err instanceof Error ? err.message : String(err)}
|
|
8884
|
-
`
|
|
8885
|
-
);
|
|
9000
|
+
const output = renderRunResult(connectorName, runResult, format);
|
|
9001
|
+
if (runResult.error !== void 0 || runResult.stateWriteError !== void 0) {
|
|
9002
|
+
process.stderr.write(output + "\n");
|
|
8886
9003
|
process.exitCode = 1;
|
|
8887
|
-
|
|
9004
|
+
} else {
|
|
9005
|
+
console.log(output);
|
|
8888
9006
|
}
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
runResult = await pollOnce({
|
|
8892
|
-
connectorId: connectorName,
|
|
8893
|
-
priorState: state,
|
|
8894
|
-
syncFn: (cursor) => connector.syncIncremental({
|
|
8895
|
-
cursor,
|
|
8896
|
-
config: validatedCfg
|
|
8897
|
-
}),
|
|
8898
|
-
ingestFn: sharedIngestFn,
|
|
8899
|
-
writeCursorFn: makeWriteCursorFn(connectorName)
|
|
8900
|
-
});
|
|
8901
|
-
} else {
|
|
8902
|
-
process.stderr.write(
|
|
8903
|
-
`connectors run: unknown connector "${connectorName}". Known connectors: ${GDRIVE_ID}, ${NOTION_ID}.
|
|
8904
|
-
`
|
|
8905
|
-
);
|
|
8906
|
-
process.exitCode = 1;
|
|
8907
|
-
return;
|
|
8908
|
-
}
|
|
8909
|
-
const output = renderRunResult(connectorName, runResult, format);
|
|
8910
|
-
if (runResult.error !== void 0 || runResult.stateWriteError !== void 0) {
|
|
8911
|
-
process.stderr.write(output + "\n");
|
|
8912
|
-
process.exitCode = 1;
|
|
8913
|
-
} else {
|
|
8914
|
-
console.log(output);
|
|
9007
|
+
} finally {
|
|
9008
|
+
await orchestrator.destroy();
|
|
8915
9009
|
}
|
|
8916
9010
|
} else {
|
|
8917
9011
|
console.log("Usage: remnic connectors <list|install|remove|doctor|marketplace|status|run> [id]");
|
|
@@ -9219,7 +9313,7 @@ async function cmdLegacyBenchmark(action, rest, json) {
|
|
|
9219
9313
|
} else if (action === "report") {
|
|
9220
9314
|
const reportPath = benchConfig.reportPath;
|
|
9221
9315
|
const suite = await runBenchSuite(service, { ...benchConfig, reportPath });
|
|
9222
|
-
|
|
9316
|
+
printBenchStatusLine(json, `Report saved to ${reportPath ?? "benchmarks/report.json"}`);
|
|
9223
9317
|
if (json) {
|
|
9224
9318
|
console.log(JSON.stringify(suite.report, null, 2));
|
|
9225
9319
|
}
|
|
@@ -9346,9 +9440,9 @@ async function cmdBench(rest) {
|
|
|
9346
9440
|
}
|
|
9347
9441
|
const completeCount = prevStatus.benchmarks.filter((b) => b.status === "complete").length;
|
|
9348
9442
|
const failedCount = prevStatus.benchmarks.filter((b) => b.status === "failed").length;
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9443
|
+
printBenchStatusLine(parsed.json, `Resuming from: ${path11.basename(latestStatusPath)}`);
|
|
9444
|
+
printBenchStatusLine(parsed.json, ` Previous run: ${prevStatus.startedAt}`);
|
|
9445
|
+
printBenchStatusLine(parsed.json, ` Benchmarks: ${prevStatus.benchmarks.length} total, ${completeCount} complete, ${failedCount} failed`);
|
|
9352
9446
|
const before = selectedBenchmarks.length;
|
|
9353
9447
|
if (parsed.resume) {
|
|
9354
9448
|
selectedWorkItems = filterBenchWorkItemsForPreviousStatus(
|
|
@@ -9357,7 +9451,7 @@ async function cmdBench(rest) {
|
|
|
9357
9451
|
"resume"
|
|
9358
9452
|
);
|
|
9359
9453
|
selectedBenchmarks = [...new Set(selectedWorkItems.map((item) => item.benchmarkId))];
|
|
9360
|
-
|
|
9454
|
+
printBenchStatusLine(parsed.json, ` Resuming: ${selectedBenchmarks.length} of ${before} benchmarks to re-run`);
|
|
9361
9455
|
} else {
|
|
9362
9456
|
selectedWorkItems = filterBenchWorkItemsForPreviousStatus(
|
|
9363
9457
|
selectedWorkItems,
|
|
@@ -9365,13 +9459,14 @@ async function cmdBench(rest) {
|
|
|
9365
9459
|
"retry-failed"
|
|
9366
9460
|
);
|
|
9367
9461
|
selectedBenchmarks = [...new Set(selectedWorkItems.map((item) => item.benchmarkId))];
|
|
9368
|
-
|
|
9462
|
+
printBenchStatusLine(parsed.json, ` Retrying: ${selectedBenchmarks.length} of ${before} selected benchmarks had failures`);
|
|
9369
9463
|
}
|
|
9370
9464
|
if (selectedWorkItems.length === 0) {
|
|
9371
9465
|
if (parsed.retryFailed) {
|
|
9372
|
-
|
|
9466
|
+
printBenchStatusLine(parsed.json, "Nothing to re-run \u2014 no selected benchmarks had failures.");
|
|
9373
9467
|
} else {
|
|
9374
|
-
|
|
9468
|
+
printBenchStatusLine(
|
|
9469
|
+
parsed.json,
|
|
9375
9470
|
"Nothing to re-run \u2014 all selected benchmarks completed successfully in the previous run."
|
|
9376
9471
|
);
|
|
9377
9472
|
}
|
|
@@ -9417,6 +9512,7 @@ async function cmdBench(rest) {
|
|
|
9417
9512
|
}
|
|
9418
9513
|
} else {
|
|
9419
9514
|
const fallbackResultPath = await runBenchViaFallback(parsed, benchmarkId, runtimeProfile);
|
|
9515
|
+
writtenPaths.push(fallbackResultPath);
|
|
9420
9516
|
try {
|
|
9421
9517
|
await updateBenchmarkCompleted(benchStatusPath, statusId, fallbackResultPath);
|
|
9422
9518
|
} catch {
|
|
@@ -9532,13 +9628,10 @@ var [LAUNCHD_PLIST_PATH] = LAUNCHD_PLIST_PATHS;
|
|
|
9532
9628
|
var SYSTEMD_UNIT_PATHS = systemdUnitPaths(resolveHomeDir());
|
|
9533
9629
|
var [SYSTEMD_UNIT_PATH] = SYSTEMD_UNIT_PATHS;
|
|
9534
9630
|
function readPid() {
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
}
|
|
9540
|
-
}
|
|
9541
|
-
return void 0;
|
|
9631
|
+
return readVerifiedDaemonPid({
|
|
9632
|
+
pidFiles: [PID_FILE, LEGACY_PID_FILE],
|
|
9633
|
+
expectedServerBin: resolveServerBin()
|
|
9634
|
+
});
|
|
9542
9635
|
}
|
|
9543
9636
|
function inferPort() {
|
|
9544
9637
|
try {
|
|
@@ -9570,6 +9663,36 @@ function isStandaloneServiceInstalled() {
|
|
|
9570
9663
|
if (isLinux()) return anyFileExists(SYSTEMD_UNIT_PATHS);
|
|
9571
9664
|
return false;
|
|
9572
9665
|
}
|
|
9666
|
+
function commandFailureDetail(error) {
|
|
9667
|
+
if (error && typeof error === "object") {
|
|
9668
|
+
const maybe = error;
|
|
9669
|
+
const stderr = maybe.stderr ? String(maybe.stderr).trim() : "";
|
|
9670
|
+
if (stderr) return stderr;
|
|
9671
|
+
const stdout = maybe.stdout ? String(maybe.stdout).trim() : "";
|
|
9672
|
+
if (stdout) return stdout;
|
|
9673
|
+
if (maybe.message) return maybe.message;
|
|
9674
|
+
}
|
|
9675
|
+
return String(error);
|
|
9676
|
+
}
|
|
9677
|
+
function failDaemonInstall(command, error) {
|
|
9678
|
+
console.error(`Error: daemon install failed while running ${command}.`);
|
|
9679
|
+
console.error(` ${commandFailureDetail(error)}`);
|
|
9680
|
+
process.exit(1);
|
|
9681
|
+
}
|
|
9682
|
+
function isLaunchdLabelLoaded(label) {
|
|
9683
|
+
return firstSuccessfulResult([label], (candidate) => {
|
|
9684
|
+
childProcess2.execSync(`launchctl list ${candidate} 2>/dev/null`, { stdio: "pipe" });
|
|
9685
|
+
return true;
|
|
9686
|
+
}) === true;
|
|
9687
|
+
}
|
|
9688
|
+
function isSystemdServiceActive() {
|
|
9689
|
+
return firstSuccessfulResult(SYSTEMD_SERVICE_CANDIDATES, (serviceName) => {
|
|
9690
|
+
const out = childProcess2.execSync(`systemctl --user is-active ${serviceName} 2>/dev/null`, {
|
|
9691
|
+
encoding: "utf8"
|
|
9692
|
+
}).trim();
|
|
9693
|
+
return out === "active" ? true : void 0;
|
|
9694
|
+
}) === true;
|
|
9695
|
+
}
|
|
9573
9696
|
function selectLaunchdInspection(openclawPluginModeConfigured) {
|
|
9574
9697
|
const canonical = inspectLaunchdPlist(LAUNCHD_PLIST_PATH);
|
|
9575
9698
|
if (canonical.installed) return canonical;
|
|
@@ -9617,7 +9740,13 @@ function daemonInstall() {
|
|
|
9617
9740
|
fs7.writeFileSync(LAUNCHD_PLIST_PATH, plist);
|
|
9618
9741
|
try {
|
|
9619
9742
|
launchdLoadPlist(LAUNCHD_PLIST_PATH);
|
|
9620
|
-
} catch {
|
|
9743
|
+
} catch (err) {
|
|
9744
|
+
if (!isLaunchdLabelLoaded(LAUNCHD_LABEL)) {
|
|
9745
|
+
failDaemonInstall(`launchctl load -w ${LAUNCHD_PLIST_PATH}`, err);
|
|
9746
|
+
}
|
|
9747
|
+
}
|
|
9748
|
+
if (!isLaunchdLabelLoaded(LAUNCHD_LABEL)) {
|
|
9749
|
+
failDaemonInstall(`launchctl list ${LAUNCHD_LABEL}`, new Error("service was not loaded after install"));
|
|
9621
9750
|
}
|
|
9622
9751
|
console.log(`Installed launchd service: ${LAUNCHD_PLIST_PATH}`);
|
|
9623
9752
|
console.log(` Label: ${LAUNCHD_LABEL}`);
|
|
@@ -9631,9 +9760,21 @@ function daemonInstall() {
|
|
|
9631
9760
|
fs7.writeFileSync(SYSTEMD_UNIT_PATH, unit);
|
|
9632
9761
|
try {
|
|
9633
9762
|
childProcess2.execSync("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
9763
|
+
} catch (err) {
|
|
9764
|
+
failDaemonInstall("systemctl --user daemon-reload", err);
|
|
9765
|
+
}
|
|
9766
|
+
try {
|
|
9634
9767
|
childProcess2.execSync(`systemctl --user enable ${SYSTEMD_SERVICE}`, { stdio: "pipe" });
|
|
9768
|
+
} catch (err) {
|
|
9769
|
+
failDaemonInstall(`systemctl --user enable ${SYSTEMD_SERVICE}`, err);
|
|
9770
|
+
}
|
|
9771
|
+
try {
|
|
9635
9772
|
childProcess2.execSync(`systemctl --user start ${SYSTEMD_SERVICE}`, { stdio: "pipe" });
|
|
9636
|
-
} catch {
|
|
9773
|
+
} catch (err) {
|
|
9774
|
+
failDaemonInstall(`systemctl --user start ${SYSTEMD_SERVICE}`, err);
|
|
9775
|
+
}
|
|
9776
|
+
if (!isSystemdServiceActive()) {
|
|
9777
|
+
failDaemonInstall(`systemctl --user is-active ${SYSTEMD_SERVICE}`, new Error("service is not active after install"));
|
|
9637
9778
|
}
|
|
9638
9779
|
console.log(`Installed systemd user service: ${SYSTEMD_UNIT_PATH}`);
|
|
9639
9780
|
console.log(` Restart: on-failure, WantedBy: default.target`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.3.515",
|
|
4
4
|
"description": "CLI for Remnic memory — init, query, doctor, daemon management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"yaml": "^2.4.2",
|
|
29
|
-
"@remnic/plugin-pi": "^
|
|
30
|
-
"@remnic/server": "^
|
|
31
|
-
"@remnic/core": "^
|
|
29
|
+
"@remnic/plugin-pi": "^9.3.515",
|
|
30
|
+
"@remnic/server": "^9.3.515",
|
|
31
|
+
"@remnic/core": "^9.3.515"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@remnic/bench": "^
|
|
35
|
-
"@remnic/export-weclone": "^
|
|
36
|
-
"@remnic/import-weclone": "^
|
|
37
|
-
"@remnic/import-chatgpt": "^
|
|
38
|
-
"@remnic/import-claude": "^
|
|
39
|
-
"@remnic/import-gemini": "^
|
|
40
|
-
"@remnic/import-lossless-claw": "^
|
|
41
|
-
"@remnic/import-mem0": "^
|
|
42
|
-
"@remnic/import-supermemory": "^
|
|
34
|
+
"@remnic/bench": "^9.3.515",
|
|
35
|
+
"@remnic/export-weclone": "^9.3.515",
|
|
36
|
+
"@remnic/import-weclone": "^9.3.515",
|
|
37
|
+
"@remnic/import-chatgpt": "^9.3.515",
|
|
38
|
+
"@remnic/import-claude": "^9.3.515",
|
|
39
|
+
"@remnic/import-gemini": "^9.3.515",
|
|
40
|
+
"@remnic/import-lossless-claw": "^9.3.515",
|
|
41
|
+
"@remnic/import-mem0": "^9.3.515",
|
|
42
|
+
"@remnic/import-supermemory": "^9.3.515"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@remnic/bench": {
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"tsup": "^8.5.1",
|
|
75
75
|
"typescript": "^5.9.3",
|
|
76
|
-
"@remnic/
|
|
77
|
-
"@remnic/
|
|
78
|
-
"@remnic/import-weclone": "
|
|
79
|
-
"@remnic/import-
|
|
80
|
-
"@remnic/import-
|
|
81
|
-
"@remnic/import-
|
|
82
|
-
"@remnic/import-lossless-claw": "
|
|
83
|
-
"@remnic/import-
|
|
84
|
-
"@remnic/import-
|
|
76
|
+
"@remnic/bench": "9.3.515",
|
|
77
|
+
"@remnic/export-weclone": "9.3.515",
|
|
78
|
+
"@remnic/import-weclone": "9.3.515",
|
|
79
|
+
"@remnic/import-claude": "9.3.515",
|
|
80
|
+
"@remnic/import-gemini": "9.3.515",
|
|
81
|
+
"@remnic/import-mem0": "9.3.515",
|
|
82
|
+
"@remnic/import-lossless-claw": "9.3.515",
|
|
83
|
+
"@remnic/import-chatgpt": "9.3.515",
|
|
84
|
+
"@remnic/import-supermemory": "9.3.515"
|
|
85
85
|
},
|
|
86
86
|
"license": "MIT",
|
|
87
87
|
"repository": {
|