@remnic/cli 9.3.556 → 9.3.557

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.
Files changed (2) hide show
  1. package/dist/index.js +44 -3
  2. package/package.json +22 -22
package/dist/index.js CHANGED
@@ -1983,6 +1983,7 @@ function readVerifiedDaemonPid(options) {
1983
1983
  const readFileSync3 = options.readFileSync ?? fs4.readFileSync;
1984
1984
  const unlinkSync = options.unlinkSync ?? fs4.unlinkSync;
1985
1985
  const processKill = options.processKill ?? process.kill;
1986
+ const platform = options.platform ?? process.platform;
1986
1987
  const execFileSync3 = options.execFileSync ?? ((command, args, execOptions) => childProcess.execFileSync(command, args, execOptions));
1987
1988
  for (const file of options.pidFiles) {
1988
1989
  let pid;
@@ -2001,9 +2002,10 @@ function readVerifiedDaemonPid(options) {
2001
2002
  removePidFileBestEffort(file, unlinkSync);
2002
2003
  continue;
2003
2004
  }
2004
- const command = readProcessCommand(pid, execFileSync3);
2005
+ const command = readProcessCommand(pid, execFileSync3, platform);
2005
2006
  if (command === void 0) {
2006
- return pid;
2007
+ removePidFileBestEffort(file, unlinkSync);
2008
+ continue;
2007
2009
  }
2008
2010
  if (doesProcessCommandLookLikeRemnicDaemon(command, options.expectedServerBin)) {
2009
2011
  return pid;
@@ -2023,7 +2025,13 @@ function parseDaemonPid(raw) {
2023
2025
  const pid = Number(trimmed);
2024
2026
  return Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
2025
2027
  }
2026
- function readProcessCommand(pid, execFileSync3) {
2028
+ function readProcessCommand(pid, execFileSync3, platform) {
2029
+ if (platform === "win32") {
2030
+ return readWindowsProcessCommand(pid, execFileSync3);
2031
+ }
2032
+ return readPosixProcessCommand(pid, execFileSync3);
2033
+ }
2034
+ function readPosixProcessCommand(pid, execFileSync3) {
2027
2035
  try {
2028
2036
  return execFileSync3("ps", ["-p", String(pid), "-o", "command="], {
2029
2037
  encoding: "utf8",
@@ -2033,6 +2041,39 @@ function readProcessCommand(pid, execFileSync3) {
2033
2041
  return void 0;
2034
2042
  }
2035
2043
  }
2044
+ function readWindowsProcessCommand(pid, execFileSync3) {
2045
+ const powerShellCommand = `$process = Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}"; if ($null -ne $process) { $process.CommandLine }`;
2046
+ for (const command of ["powershell.exe", "powershell", "pwsh"]) {
2047
+ try {
2048
+ const output = execFileSync3(
2049
+ command,
2050
+ ["-NoProfile", "-NonInteractive", "-Command", powerShellCommand],
2051
+ {
2052
+ encoding: "utf8",
2053
+ stdio: "pipe"
2054
+ }
2055
+ );
2056
+ if (output.trim() !== "") {
2057
+ return output;
2058
+ }
2059
+ } catch {
2060
+ }
2061
+ }
2062
+ try {
2063
+ const output = execFileSync3(
2064
+ "wmic",
2065
+ ["process", "where", ["processid", String(pid)].join("="), "get", "CommandLine", "/value"],
2066
+ {
2067
+ encoding: "utf8",
2068
+ stdio: "pipe"
2069
+ }
2070
+ );
2071
+ const match = /^CommandLine=(.*)$/m.exec(output);
2072
+ return match?.[1];
2073
+ } catch {
2074
+ return void 0;
2075
+ }
2076
+ }
2036
2077
  function removePidFileBestEffort(file, unlinkSync) {
2037
2078
  try {
2038
2079
  unlinkSync(file);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/cli",
3
- "version": "9.3.556",
3
+ "version": "9.3.557",
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/server": "^9.3.556",
30
- "@remnic/plugin-pi": "^9.3.556",
31
- "@remnic/core": "^9.3.556"
29
+ "@remnic/core": "^9.3.557",
30
+ "@remnic/plugin-pi": "^9.3.557",
31
+ "@remnic/server": "^9.3.557"
32
32
  },
33
33
  "peerDependencies": {
34
- "@remnic/bench": "^9.3.556",
35
- "@remnic/export-weclone": "^9.3.556",
36
- "@remnic/import-weclone": "^9.3.556",
37
- "@remnic/import-chatgpt": "^9.3.556",
38
- "@remnic/import-claude": "^9.3.556",
39
- "@remnic/import-gemini": "^9.3.556",
40
- "@remnic/import-lossless-claw": "^9.3.556",
41
- "@remnic/import-mem0": "^9.3.556",
42
- "@remnic/import-supermemory": "^9.3.556"
34
+ "@remnic/bench": "^9.3.557",
35
+ "@remnic/export-weclone": "^9.3.557",
36
+ "@remnic/import-weclone": "^9.3.557",
37
+ "@remnic/import-chatgpt": "^9.3.557",
38
+ "@remnic/import-claude": "^9.3.557",
39
+ "@remnic/import-gemini": "^9.3.557",
40
+ "@remnic/import-lossless-claw": "^9.3.557",
41
+ "@remnic/import-mem0": "^9.3.557",
42
+ "@remnic/import-supermemory": "^9.3.557"
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/bench": "9.3.556",
77
- "@remnic/export-weclone": "9.3.556",
78
- "@remnic/import-weclone": "9.3.556",
79
- "@remnic/import-claude": "9.3.556",
80
- "@remnic/import-gemini": "9.3.556",
81
- "@remnic/import-lossless-claw": "9.3.556",
82
- "@remnic/import-mem0": "9.3.556",
83
- "@remnic/import-chatgpt": "9.3.556",
84
- "@remnic/import-supermemory": "9.3.556"
76
+ "@remnic/bench": "9.3.557",
77
+ "@remnic/export-weclone": "9.3.557",
78
+ "@remnic/import-weclone": "9.3.557",
79
+ "@remnic/import-claude": "9.3.557",
80
+ "@remnic/import-lossless-claw": "9.3.557",
81
+ "@remnic/import-mem0": "9.3.557",
82
+ "@remnic/import-gemini": "9.3.557",
83
+ "@remnic/import-supermemory": "9.3.557",
84
+ "@remnic/import-chatgpt": "9.3.557"
85
85
  },
86
86
  "license": "MIT",
87
87
  "repository": {