@oh-my-pi/pi-natives 18.1.22 → 18.2.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/README.md CHANGED
@@ -5,7 +5,7 @@ Native Rust functionality via N-API.
5
5
  ## What's Inside
6
6
 
7
7
  - **Grep**: Regex-based search powered by ripgrep's engine with native file walking and matching
8
- - **Find**: Glob-based file/directory discovery with gitignore support (pure TypeScript via `globPaths`)
8
+ - **Find**: Native glob-based file/directory discovery with gitignore support
9
9
  - **SIXEL**: Terminal image encoding for SIXEL-capable terminals (decode, resize, encode in one pass)
10
10
  - **Audio**: Cross-platform low-latency microphone capture and gapless speaker playback
11
11
  - **WebRTC**: Native Opus media, SDP offer/answer negotiation, and data-channel events for live sessions
@@ -10843,7 +10843,7 @@ RUST RUNTIME DEPENDENCY LICENSES
10843
10843
 
10844
10844
  Generated from Cargo.lock by cargo-about 0.8.2 in locked, offline, workspace, all-feature, all-target mode, then restricted using cargo metadata to normal and build edges reachable from the workspace (development-only edges are excluded). cargo-deny independently evaluates the complete all-target graph.
10845
10845
 
10846
- Native Opus (audiopus/audiopus_sys) and PCRE2 (pcre2/pcre2-sys) are covered by the exact crate license payloads below. inferno 0.12.8 is package-scoped as CDDL-1.0: its CDDL-covered source remains available in the locked crates.io source archive at https://crates.io/crates/inferno/0.12.8 and https://github.com/jonhoo/inferno. The full locked license text follows below.
10846
+ Native Opus (opus/opusic-sys) and PCRE2 (pcre2/pcre2-sys) are covered by the exact crate license payloads below. inferno 0.12.8 is package-scoped as CDDL-1.0: its CDDL-covered source remains available in the locked crates.io source archive at https://crates.io/crates/inferno/0.12.8 and https://github.com/jonhoo/inferno. The full locked license text follows below.
10847
10847
 
10848
10848
  -------------------------------------------------------------------------------
10849
10849
  License: Apache License 2.0 (Apache-2.0)
@@ -12509,6 +12509,58 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
12509
12509
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
12510
12510
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12511
12511
 
12512
+ -------------------------------------------------------------------------------
12513
+ License: BSD 3-Clause "New" or "Revised" License (BSD-3-Clause)
12514
+ Used by:
12515
+ - opusic-sys 0.7.5 (https://github.com/DoumanAsh/opusic-sys)
12516
+
12517
+ Full license text:
12518
+
12519
+ Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic,
12520
+ Jean-Marc Valin, Timothy B. Terriberry,
12521
+ CSIRO, Gregory Maxwell, Mark Borgerding,
12522
+ Erik de Castro Lopo, Mozilla, Amazon
12523
+
12524
+ Redistribution and use in source and binary forms, with or without
12525
+ modification, are permitted provided that the following conditions
12526
+ are met:
12527
+
12528
+ - Redistributions of source code must retain the above copyright
12529
+ notice, this list of conditions and the following disclaimer.
12530
+
12531
+ - Redistributions in binary form must reproduce the above copyright
12532
+ notice, this list of conditions and the following disclaimer in the
12533
+ documentation and/or other materials provided with the distribution.
12534
+
12535
+ - Neither the name of Internet Society, IETF or IETF Trust, nor the
12536
+ names of specific contributors, may be used to endorse or promote
12537
+ products derived from this software without specific prior written
12538
+ permission.
12539
+
12540
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12541
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
12542
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
12543
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
12544
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
12545
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
12546
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
12547
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
12548
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
12549
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
12550
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12551
+
12552
+ Opus is subject to the royalty-free patent licenses which are
12553
+ specified at:
12554
+
12555
+ Xiph.Org Foundation:
12556
+ https://datatracker.ietf.org/ipr/1524/
12557
+
12558
+ Microsoft Corporation:
12559
+ https://datatracker.ietf.org/ipr/1914/
12560
+
12561
+ Broadcom Corporation:
12562
+ https://datatracker.ietf.org/ipr/1526/
12563
+
12512
12564
  -------------------------------------------------------------------------------
12513
12565
  License: BSD 3-Clause "New" or "Revised" License (BSD-3-Clause)
12514
12566
  Used by:
@@ -13290,29 +13342,6 @@ jurisdiction of the Federal Courts of the Northern District of
13290
13342
  California and the state courts of the State of California, with
13291
13343
  venue lying in Santa Clara County, California.
13292
13344
 
13293
- -------------------------------------------------------------------------------
13294
- License: ISC License (ISC)
13295
- Used by:
13296
- - audiopus_sys 0.2.2 (https://github.com/lakelezz/audiopus_sys.git)
13297
-
13298
- Full license text:
13299
-
13300
- ISC License
13301
-
13302
- Copyright (c) 2019, Lakelezz
13303
-
13304
- Permission to use, copy, modify, and/or distribute this software for any
13305
- purpose with or without fee is hereby granted, provided that the above
13306
- copyright notice and this permission notice appear in all copies.
13307
-
13308
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13309
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13310
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13311
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13312
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13313
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13314
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13315
-
13316
13345
  -------------------------------------------------------------------------------
13317
13346
  License: ISC License (ISC)
13318
13347
  Used by:
@@ -18734,7 +18763,7 @@ DEALINGS IN THE SOFTWARE.
18734
18763
  -------------------------------------------------------------------------------
18735
18764
  License: MIT License (MIT)
18736
18765
  Used by:
18737
- - opus 0.3.1 (https://github.com/SpaceManiac/opus-rs)
18766
+ - opus 0.4.0 (https://github.com/SpaceManiac/opus-rs)
18738
18767
 
18739
18768
  Full license text:
18740
18769
 
package/native/index.d.ts CHANGED
@@ -648,7 +648,7 @@ export declare function __ompInstallTokioRuntime(): void
648
648
  * `packages/natives/native/index.js` (which derives the name from
649
649
  * `package.json#version`).
650
650
  */
651
- export declare function __piNativesV18_1_22(): void
651
+ export declare function __piNativesV18_2_1(): void
652
652
 
653
653
  /**
654
654
  * Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
@@ -1753,6 +1753,9 @@ export declare function hashlineFormatHeader(path: string, tag: string): string
1753
1753
  /** `N:line` numbered display rows starting at `startLine` (default 1). */
1754
1754
  export declare function hashlineFormatNumberedLines(text: string, startLine?: number | undefined | null): string
1755
1755
 
1756
+ /** Whether a row is a truncation notice emitted by `read`. */
1757
+ export declare function hashlineIsReadTruncationNotice(line: string): boolean
1758
+
1756
1759
  /** Count of one canonical hashline op header shape in a payload. */
1757
1760
  export interface HashlineOpCount {
1758
1761
  label: string
@@ -2773,11 +2776,24 @@ export interface VcsDiffOptions {
2773
2776
  files?: Array<string>
2774
2777
  context?: number
2775
2778
  binary?: boolean
2779
+ /**
2780
+ * Fail with an `OutputTooLarge` `VcsError` once the rendered patch exceeds
2781
+ * this many bytes, instead of buffering an arbitrarily large string.
2782
+ * Carried as a double so a budget past 2^32 reaches the renderer intact
2783
+ * (a `u32` field would wrap it); values beyond `usize` saturate.
2784
+ */
2785
+ maxBytes?: number
2776
2786
  }
2777
2787
 
2778
2788
  /** Discover the repository owning a directory. */
2779
2789
  export declare function vcsDiscover(dir: string): VcsRepo | null
2780
2790
 
2791
+ /**
2792
+ * Discover the repository presenting a directory: equal-root jj+git ties
2793
+ * prefer Jujutsu. Git-safe automation must keep using [`vcs_discover`].
2794
+ */
2795
+ export declare function vcsDiscoverForDisplay(dir: string): VcsRepo | null
2796
+
2781
2797
  /** Clone a Git repository. */
2782
2798
  export declare function vcsGitClone(url: string, target: string, options: VcsCloneOptions, signal?: unknown | undefined | null): Promise<void>
2783
2799
 
package/native/index.js CHANGED
@@ -39,7 +39,7 @@ export const VcsRepo = nativeBindings.VcsRepo;
39
39
 
40
40
  // functions
41
41
  export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
42
- export const __piNativesV18_1_22 = nativeBindings.__piNativesV18_1_22;
42
+ export const __piNativesV18_2_1 = nativeBindings.__piNativesV18_2_1;
43
43
  export const astEdit = nativeBindings.astEdit;
44
44
  export const astGrep = nativeBindings.astGrep;
45
45
  export const astMatch = nativeBindings.astMatch;
@@ -73,6 +73,7 @@ export const hashlineCountOps = nativeBindings.hashlineCountOps;
73
73
  export const hashlineFileHash = nativeBindings.hashlineFileHash;
74
74
  export const hashlineFormatHeader = nativeBindings.hashlineFormatHeader;
75
75
  export const hashlineFormatNumberedLines = nativeBindings.hashlineFormatNumberedLines;
76
+ export const hashlineIsReadTruncationNotice = nativeBindings.hashlineIsReadTruncationNotice;
76
77
  export const hashlineStripPrefixes = nativeBindings.hashlineStripPrefixes;
77
78
  export const hasMatch = nativeBindings.hasMatch;
78
79
  export const highlightCode = nativeBindings.highlightCode;
@@ -113,6 +114,7 @@ export const supportsLanguage = nativeBindings.supportsLanguage;
113
114
  export const truncateToWidth = nativeBindings.truncateToWidth;
114
115
  export const vcsDetachGitDir = nativeBindings.vcsDetachGitDir;
115
116
  export const vcsDiscover = nativeBindings.vcsDiscover;
117
+ export const vcsDiscoverForDisplay = nativeBindings.vcsDiscoverForDisplay;
116
118
  export const vcsGitClone = nativeBindings.vcsGitClone;
117
119
  export const vcsGitDiscover = nativeBindings.vcsGitDiscover;
118
120
  export const vcsGitRepoInfo = nativeBindings.vcsGitRepoInfo;
@@ -6,6 +6,7 @@ import * as path from "node:path";
6
6
  import * as zlib from "node:zlib";
7
7
  import packageJson from "../package.json" with { type: "json" };
8
8
  import { embeddedAddon } from "./embedded-addon.js";
9
+ import { containsVersionSentinel, versionSentinelFor } from "./version-sentinel.js";
9
10
 
10
11
  /**
11
12
  * Native addon loader for `@oh-my-pi/pi-natives`.
@@ -703,7 +704,7 @@ export function validateLoadedBindings(ctx, bindings, candidate) {
703
704
  // the current sentinel; otherwise a restart would simply reload stale disk.
704
705
  let diskHasExpectedSentinel = false;
705
706
  try {
706
- diskHasExpectedSentinel = fs.readFileSync(candidate).includes(ctx.versionSentinelExport);
707
+ diskHasExpectedSentinel = containsVersionSentinel(fs.readFileSync(candidate), ctx.versionSentinelExport);
707
708
  } catch {
708
709
  // The successful require above normally guarantees readability. If the
709
710
  // file disappears concurrently, retain the safe reinstall diagnosis.
@@ -837,7 +838,7 @@ export function initLoaderContext(overrides = {}) {
837
838
  // physically cannot expose the symbol this loader is looking for. That
838
839
  // turns the silent `<sym> is not a function` crash from a Windows
839
840
  // locked-file update into an actionable load-time error.
840
- const versionSentinelExport = `__piNativesV${packageVersion.replace(/[^A-Za-z0-9]/g, "_")}`;
841
+ const versionSentinelExport = versionSentinelFor(packageVersion);
841
842
 
842
843
  return {
843
844
  platformTag,
package/native/vcs.d.ts CHANGED
@@ -31,7 +31,8 @@ export interface VcsError extends Error {
31
31
  | "Io"
32
32
  | "Backend"
33
33
  | "Canceled"
34
- | "Unsupported";
34
+ | "Unsupported"
35
+ | "OutputTooLarge";
35
36
  exitCode: number;
36
37
  stdout: string;
37
38
  stderr: string;
@@ -47,6 +48,8 @@ export declare function isEmptyCherryPick(error: unknown): error is VcsError & {
47
48
  export declare function git(dir: string): VcsGitRepo | null;
48
49
  /** Discover the repository owning `dir`; `null` outside any repository. */
49
50
  export declare function repo(dir: string): VcsRepo | null;
51
+ /** Like {@link repo}, but equal-root jj+git ties prefer Jujutsu for display. Git-safe automation must keep using {@link repo}. */
52
+ export declare function repoForDisplay(dir: string): VcsRepo | null;
50
53
 
51
54
  /** Like {@link repo}, asserting any requested backend capabilities. */
52
55
  export declare function require(dir: string, ...features: VcsFeature[]): VcsRepo;
package/native/vcs.js CHANGED
@@ -41,6 +41,11 @@ export function repo(dir) {
41
41
  return api().vcsDiscover(dir);
42
42
  }
43
43
 
44
+ /** Like {@link repo}, but equal-root jj+git ties prefer Jujutsu for display. Git-safe automation must keep using {@link repo}. */
45
+ export function repoForDisplay(dir) {
46
+ return api().vcsDiscoverForDisplay(dir);
47
+ }
48
+
44
49
  /** Like {@link repo}, asserting any requested backend capabilities. */
45
50
  export function require(dir, ...features) {
46
51
  const discovered = repo(dir);
@@ -0,0 +1,5 @@
1
+ /** Return the native-addon export expected for a package version. */
2
+ export function versionSentinelFor(packageVersion: string): string;
3
+
4
+ /** Check whether addon bytes contain the exact expected version sentinel. */
5
+ export function containsVersionSentinel(bytes: Buffer, expected: string): boolean;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Version-sentinel helpers shared by the native loader and the embed pipeline.
3
+ *
4
+ * Kept in its own module so `scripts/embed-native.ts` can reuse the exact-match
5
+ * logic without importing `loader-state.js` — which pulls in the generated
6
+ * `embedded-addon.js` and its `with { type: "file" }` archive import. That
7
+ * chain fails to resolve when the archive is missing, which would break
8
+ * `gen:native:reset` on an inconsistent tree (populated manifest, deleted
9
+ * archive) before it can restore the checked-in null stub.
10
+ */
11
+
12
+ /**
13
+ * Return the version sentinel exported by an addon built for `packageVersion`.
14
+ * @param {string} packageVersion
15
+ * @returns {string}
16
+ */
17
+ export function versionSentinelFor(packageVersion) {
18
+ return `__piNativesV${packageVersion.replace(/[^A-Za-z0-9]/g, "_")}`;
19
+ }
20
+
21
+ /**
22
+ * Check for an exact version sentinel rather than a longer sentinel with the
23
+ * expected value as its prefix (e.g. `__piNativesV18_1_10` must not satisfy a
24
+ * lookup for `__piNativesV18_1_1`).
25
+ * @param {Buffer} bytes
26
+ * @param {string} expected
27
+ * @returns {boolean}
28
+ */
29
+ export function containsVersionSentinel(bytes, expected) {
30
+ if (expected.length === 0) return false;
31
+ let offset = 0;
32
+ while (offset < bytes.length) {
33
+ const index = bytes.indexOf(expected, offset);
34
+ if (index === -1) return false;
35
+ const next = bytes[index + expected.length];
36
+ const isIdentifierByte =
37
+ next === 95 || (next >= 48 && next <= 57) || (next >= 65 && next <= 90) || (next >= 97 && next <= 122);
38
+ if (!isIdentifierByte) return true;
39
+ offset = index + expected.length;
40
+ }
41
+ return false;
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "18.1.22",
3
+ "version": "18.2.1",
4
4
  "description": "Native Rust bindings for PDF conversion, 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",
@@ -70,6 +70,8 @@
70
70
  "native/desktop.d.ts",
71
71
  "native/desktop-adapter.js",
72
72
  "native/desktop-adapter.d.ts",
73
+ "native/version-sentinel.js",
74
+ "native/version-sentinel.d.ts",
73
75
  "native/loader-state.js",
74
76
  "native/loader-state.d.ts",
75
77
  "native/vcs.js",
@@ -98,11 +100,11 @@
98
100
  }
99
101
  },
100
102
  "optionalDependencies": {
101
- "@oh-my-pi/pi-natives-linux-x64": "18.1.22",
102
- "@oh-my-pi/pi-natives-linux-arm64": "18.1.22",
103
- "@oh-my-pi/pi-natives-darwin-x64": "18.1.22",
104
- "@oh-my-pi/pi-natives-darwin-arm64": "18.1.22",
105
- "@oh-my-pi/pi-natives-win32-x64": "18.1.22",
106
- "@oh-my-pi/pi-natives-win32-arm64": "18.1.22"
103
+ "@oh-my-pi/pi-natives-linux-x64": "18.2.1",
104
+ "@oh-my-pi/pi-natives-linux-arm64": "18.2.1",
105
+ "@oh-my-pi/pi-natives-darwin-x64": "18.2.1",
106
+ "@oh-my-pi/pi-natives-darwin-arm64": "18.2.1",
107
+ "@oh-my-pi/pi-natives-win32-x64": "18.2.1",
108
+ "@oh-my-pi/pi-natives-win32-arm64": "18.2.1"
107
109
  }
108
110
  }