om-memory-system 4.28.2 → 4.28.3

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.
@@ -27,9 +27,11 @@ export function startWebUpdate(restart, canRestart) {
27
27
  export function nodeInstallDeps() {
28
28
  return {
29
29
  execPath: process.execPath,
30
+ pathEnv: process.env.PATH,
30
31
  platform: process.platform,
31
32
  spawn: (command, args, options) => spawn(command, args, {
32
33
  shell: options.shell,
34
+ env: options.path === undefined ? undefined : { ...process.env, PATH: options.path },
33
35
  stdio: ["ignore", "ignore", "pipe"],
34
36
  windowsHide: true,
35
37
  }),
@@ -27,10 +27,13 @@ export interface WebUpdateDeps {
27
27
  log: (message: string, data: Record<string, unknown>, level?: LogLevel) => void;
28
28
  /** The runtime of this web app; npm must sit beside it. */
29
29
  execPath: string;
30
+ /** This process's PATH; npm gets the folder of `execPath` in front of it. */
31
+ pathEnv: string | undefined;
30
32
  platform: NodeJS.Platform;
31
33
  exists: (path: string) => boolean;
32
34
  spawn: (command: string, args: string[], options: {
33
35
  shell: boolean;
36
+ path?: string;
34
37
  }) => InstallChild;
35
38
  /** The version of the global install after npm ran, or null. */
36
39
  globalVersion: () => string | null;
@@ -78,7 +81,7 @@ export declare class WebUpdate {
78
81
  private install;
79
82
  }
80
83
  /** The parts of the update deps that run npm. */
81
- export type InstallDeps = Pick<WebUpdateDeps, "execPath" | "platform" | "spawn" | "killTree" | "setTimeout" | "clearTimeout">;
84
+ export type InstallDeps = Pick<WebUpdateDeps, "execPath" | "pathEnv" | "platform" | "spawn" | "killTree" | "setTimeout" | "clearTimeout">;
82
85
  /** A failure code, or null when npm exited with code 0. */
83
86
  export interface InstallResult {
84
87
  code: string | null;
@@ -86,6 +89,12 @@ export interface InstallResult {
86
89
  }
87
90
  /** The npm that installs into the prefix the launcher reads. */
88
91
  export declare function npmBesideRuntime(deps: Pick<WebUpdateDeps, "execPath" | "platform">): string;
92
+ /**
93
+ * The PATH for npm. npm starts with `#!/usr/bin/env node`, and a login item's PATH
94
+ * (`/usr/bin:/bin:/usr/sbin:/sbin` on macOS) has no node, so npm would exit with 127.
95
+ * Windows needs nothing: `npm.cmd` runs the node.exe beside itself.
96
+ */
97
+ export declare function npmSearchPath(deps: Pick<WebUpdateDeps, "execPath" | "pathEnv" | "platform">): string | undefined;
89
98
  /**
90
99
  * Run `npm install -g om-memory-system@<target>` and stop it after 5 minutes.
91
100
  * The web app's update button and `web update` share it.
@@ -120,6 +120,17 @@ export function npmBesideRuntime(deps) {
120
120
  const name = deps.platform === "win32" ? "npm.cmd" : "npm";
121
121
  return path.join(path.dirname(deps.execPath), name);
122
122
  }
123
+ /**
124
+ * The PATH for npm. npm starts with `#!/usr/bin/env node`, and a login item's PATH
125
+ * (`/usr/bin:/bin:/usr/sbin:/sbin` on macOS) has no node, so npm would exit with 127.
126
+ * Windows needs nothing: `npm.cmd` runs the node.exe beside itself.
127
+ */
128
+ export function npmSearchPath(deps) {
129
+ if (deps.platform === "win32")
130
+ return undefined;
131
+ const bin = posix.dirname(deps.execPath);
132
+ return deps.pathEnv ? `${bin}${posix.delimiter}${deps.pathEnv}` : bin;
133
+ }
123
134
  /**
124
135
  * Run `npm install -g om-memory-system@<target>` and stop it after 5 minutes.
125
136
  * The web app's update button and `web update` share it.
@@ -136,6 +147,7 @@ export function runGlobalInstall(deps, target) {
136
147
  const command = windows ? `"${npmBesideRuntime(deps)}"` : npmBesideRuntime(deps);
137
148
  child = deps.spawn(command, ["install", "-g", `om-memory-system@${target}`], {
138
149
  shell: windows,
150
+ path: npmSearchPath(deps),
139
151
  });
140
152
  }
141
153
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "om-memory-system",
3
- "version": "4.28.2",
3
+ "version": "4.28.3",
4
4
  "description": "Opinionated modular memory system for coding agents (OpenCode + Pi)",
5
5
  "type": "module",
6
6
  "main": "dist/plugin.js",