@omercnet/paseo-omp 5.1.1-next.346.1 → 5.1.1-next.352.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": "@omercnet/paseo-omp",
3
- "version": "5.1.1-next.346.1",
3
+ "version": "5.1.1-next.352.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -1,9 +1,11 @@
1
- import { execFileSync } from "node:child_process";
1
+ import { execSync } from "node:child_process";
2
2
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
 
6
6
  const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
7
+ // Run through the shell so Windows resolves npm.cmd: Node refuses to spawn .cmd files without one.
8
+ const INSTALL_COMMAND = "npm ci --omit=dev --ignore-scripts --workspaces=false";
7
9
 
8
10
  function loadRootCatalog(root) {
9
11
  for (let directory = root; ; directory = dirname(directory)) {
@@ -27,6 +29,8 @@ function stageManifest(root, catalog, install) {
27
29
  manifest.dependencies[name] = catalog[name];
28
30
  }
29
31
  delete manifest.devDependencies;
32
+ // npm-shrinkwrap.json is generated without overrides, so npm ci rejects a manifest that keeps them.
33
+ delete manifest.overrides;
30
34
 
31
35
  writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
32
36
  try {
@@ -36,18 +40,11 @@ function stageManifest(root, catalog, install) {
36
40
  }
37
41
  }
38
42
 
39
- export function prepareDependencies(root = projectRoot, execute = execFileSync) {
43
+ export function prepareDependencies(root = projectRoot, execute = execSync) {
40
44
  const catalog = loadRootCatalog(root);
41
45
  if (!catalog) return false;
42
46
  stageManifest(root, catalog, () => {
43
- execute(
44
- process.platform === "win32" ? "npm.cmd" : "npm",
45
- ["ci", "--omit=dev", "--ignore-scripts", "--workspaces=false"],
46
- {
47
- cwd: root,
48
- stdio: "inherit",
49
- },
50
- );
47
+ execute(INSTALL_COMMAND, { cwd: root, stdio: "inherit" });
51
48
  });
52
49
  return true;
53
50
  }
@@ -1,2 +1,2 @@
1
1
  /** Release Please keeps this bundle-safe constant aligned with package.json. */
2
- export const PASEO_OMP_PACKAGE_VERSION = "5.1.1-next.346.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.1.1-next.352.1"; // x-release-please-version
@@ -64,12 +64,15 @@ export async function terminatePosixProcessTree(
64
64
 
65
65
  export type ProcessTreeCleanup = "verified" | "uncertain" | "failed";
66
66
 
67
- export async function stopWindowsTree(pid: number): Promise<ProcessTreeCleanup> {
67
+ export async function stopWindowsTree(
68
+ pid: number,
69
+ spawnTaskkill: typeof spawn = spawn,
70
+ ): Promise<ProcessTreeCleanup> {
68
71
  const result = Promise.withResolvers<ProcessTreeCleanup>();
69
72
  const systemRoot = process.env.SystemRoot ?? WINDOWS_DEFAULT_SYSTEM_ROOT;
70
73
  let taskkill: ChildProcessWithoutNullStreams;
71
74
  try {
72
- taskkill = spawn(
75
+ taskkill = spawnTaskkill(
73
76
  join(systemRoot, "System32", "taskkill.exe"),
74
77
  ["/PID", String(pid), "/T", "/F"],
75
78
  {
@@ -99,13 +102,10 @@ export async function stopWindowsTree(pid: number): Promise<ProcessTreeCleanup>
99
102
  }, PROCESS_STOP_TIMEOUT_MS);
100
103
  taskkill.once("error", () => finish("failed"));
101
104
  taskkill.once("close", (code, signal) => {
102
- finish(
103
- code === 0 && signal === null
104
- ? "verified"
105
- : code === 128 && signal === null
106
- ? "uncertain"
107
- : "failed",
108
- );
105
+ // 128 means taskkill found no such process because it already exited; retrying only repeats
106
+ // 128. Callers still wait for the root OMP process's own exit, so a live root cannot pass.
107
+ // Descendants of an already exited root cannot be enumerated by taskkill and are not checked.
108
+ finish((code === 0 || code === 128) && signal === null ? "verified" : "failed");
109
109
  });
110
110
  return result.promise;
111
111
  }
@@ -118,6 +118,7 @@ export interface OmpProviderOptions {
118
118
  timelineScheduler?: OmpTimelineScheduler;
119
119
  replayTimeoutMs?: number;
120
120
  environment?: NodeJS.ProcessEnv;
121
+ platform?: NodeJS.Platform;
121
122
  /** Fixed, non-secret profile/store identity for providers whose configuration is server-owned. */
122
123
  catalogIdentity?: Readonly<Record<string, string>>;
123
124
  mcpInitializationTimeoutMs?: number;
@@ -156,6 +157,7 @@ export function createOmpProvider(options: OmpProviderOptions = {}): ProviderReg
156
157
  });
157
158
  const nativeReservations = new OmpNativeSessionReservations();
158
159
  const sessionLimit = options.sessionLimit ?? new OmpSessionLimit();
160
+ const platform = options.platform ?? process.platform;
159
161
  const checkAvailability: NonNullable<ProviderRegistrationCompat["checkAvailability"]> = async (
160
162
  catalogOptions,
161
163
  context,
@@ -165,6 +167,12 @@ export function createOmpProvider(options: OmpProviderOptions = {}): ProviderReg
165
167
  }
166
168
  const providerOptions = parseOmpProviderOptions(catalogOptions.providerOptions);
167
169
  const environment = { ...(options.environment ?? process.env), ...providerOptions.env };
170
+ // Windows env names are case-insensitive, but a copy keeps only the literal key (often
171
+ // `Path`), so `environment.PATH` would miss it and OMP would look not installed.
172
+ if (platform === "win32" && environment.PATH === undefined) {
173
+ const pathKey = Object.keys(environment).find((name) => name.toUpperCase() === "PATH");
174
+ if (pathKey !== undefined) environment.PATH = environment[pathKey];
175
+ }
168
176
  const configuredCommand: readonly [string, ...string[]] = providerOptions.command?.[0]
169
177
  ? [providerOptions.command[0], ...providerOptions.command.slice(1)]
170
178
  : [environment.OMP_COMMAND || "omp"];
@@ -173,6 +181,7 @@ export function createOmpProvider(options: OmpProviderOptions = {}): ProviderReg
173
181
  cwd:
174
182
  catalogOptions.scope === "workspace" && catalogOptions.cwd ? catalogOptions.cwd : homedir(),
175
183
  environment,
184
+ platform,
176
185
  timeoutMs: context?.timeoutMs,
177
186
  });
178
187
  };