@oh-my-pi/pi-natives 17.2.9 → 17.2.11

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/native/index.d.ts CHANGED
@@ -279,7 +279,7 @@ export declare function __ompInstallTokioRuntime(): void
279
279
  * `packages/natives/native/index.js` (which derives the name from
280
280
  * `package.json#version`).
281
281
  */
282
- export declare function __piNativesV17_2_9(): void
282
+ export declare function __piNativesV17_2_11(): void
283
283
 
284
284
  /**
285
285
  * Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
@@ -702,8 +702,10 @@ export interface DesktopSessionOptions {
702
702
  /** One capturable top-level window in global logical desktop coordinates. */
703
703
  export interface DesktopWindow {
704
704
  /**
705
- * Stable numeric window id, valid as a capture target while the window
706
- * lives.
705
+ * Backend-defined opaque window id, valid as a capture target while the
706
+ * window lives. Numeric on X11/Win32/macOS; a composite AT-SPI string on
707
+ * Wayland (e.g. `atspi::1.31:/org/a11y/atspi/accessible/1`). Never parse
708
+ * it.
707
709
  */
708
710
  id: string
709
711
  /** Window title; may be empty for untitled windows. */
package/native/index.js CHANGED
@@ -29,7 +29,7 @@ export const Shell = nativeBindings.Shell;
29
29
 
30
30
  // functions
31
31
  export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
32
- export const __piNativesV17_2_9 = nativeBindings.__piNativesV17_2_9;
32
+ export const __piNativesV17_2_11 = nativeBindings.__piNativesV17_2_11;
33
33
  export const astEdit = nativeBindings.astEdit;
34
34
  export const astGrep = nativeBindings.astGrep;
35
35
  export const astMatch = nativeBindings.astMatch;
@@ -324,13 +324,39 @@ function detectAvx2Support() {
324
324
  }
325
325
 
326
326
  if (process.platform === "win32") {
327
- const output = runCommand("powershell.exe", [
328
- "-NoProfile",
329
- "-NonInteractive",
330
- "-Command",
331
- "[System.Runtime.Intrinsics.X86.Avx2]::IsSupported",
332
- ]);
333
- return output && output.toLowerCase() === "true";
327
+ // Under Bun, ask the kernel: PF_AVX2_INSTRUCTIONS_AVAILABLE == 40. Exact,
328
+ // and ~0.5 ms against ~270 ms for the PowerShell spawn it replaces on the
329
+ // startup path.
330
+ if (typeof Bun !== "undefined") {
331
+ try {
332
+ const { dlopen, FFIType } = createRequire(import.meta.url)("bun:ffi");
333
+ const kernel32 = dlopen("kernel32.dll", {
334
+ IsProcessorFeaturePresent: { args: [FFIType.u32], returns: FFIType.i32 },
335
+ });
336
+ try {
337
+ return kernel32.symbols.IsProcessorFeaturePresent(40) !== 0;
338
+ } finally {
339
+ kernel32.close();
340
+ }
341
+ } catch {
342
+ // No FFI (embedder policy, unusual host): fall through to the shell probe.
343
+ }
344
+ }
345
+ // Node embeds have no `bun:ffi`. `[System.Runtime.Intrinsics.X86.Avx2]`
346
+ // exists only on .NET Core, so `pwsh` (PowerShell 7) answers correctly
347
+ // while a stock `powershell.exe` (Windows PowerShell 5.1, .NET Framework)
348
+ // raises TypeNotFound and pins such hosts to the baseline addon.
349
+ for (const shell of ["pwsh.exe", "powershell.exe"]) {
350
+ const output = runCommand(shell, [
351
+ "-NoProfile",
352
+ "-NonInteractive",
353
+ "-Command",
354
+ "[System.Runtime.Intrinsics.X86.Avx2]::IsSupported",
355
+ ]);
356
+ if (output && output.toLowerCase() === "true") return true;
357
+ if (output && output.toLowerCase() === "false") return false;
358
+ }
359
+ return false;
334
360
  }
335
361
 
336
362
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "17.2.9",
3
+ "version": "17.2.11",
4
4
  "description": "Native Rust bindings for audio, WebRTC, grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
5
5
  "type": "module",
6
6
  "homepage": "https://omp.sh",
@@ -80,10 +80,10 @@
80
80
  }
81
81
  },
82
82
  "optionalDependencies": {
83
- "@oh-my-pi/pi-natives-linux-x64": "17.2.9",
84
- "@oh-my-pi/pi-natives-linux-arm64": "17.2.9",
85
- "@oh-my-pi/pi-natives-darwin-x64": "17.2.9",
86
- "@oh-my-pi/pi-natives-darwin-arm64": "17.2.9",
87
- "@oh-my-pi/pi-natives-win32-x64": "17.2.9"
83
+ "@oh-my-pi/pi-natives-linux-x64": "17.2.11",
84
+ "@oh-my-pi/pi-natives-linux-arm64": "17.2.11",
85
+ "@oh-my-pi/pi-natives-darwin-x64": "17.2.11",
86
+ "@oh-my-pi/pi-natives-darwin-arm64": "17.2.11",
87
+ "@oh-my-pi/pi-natives-win32-x64": "17.2.11"
88
88
  }
89
89
  }