@linxiraos/pi-natives 1.1.3 → 1.1.5

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
@@ -61,6 +61,43 @@ export declare class DesktopSession {
61
61
  close(): Promise<undefined>
62
62
  }
63
63
 
64
+ /**
65
+ * Incrementally ingests old/new text and computes an exact line diff on a
66
+ * worker thread once both sides finish.
67
+ *
68
+ * Complete lines are observable during ingestion. Only equal leading lines
69
+ * are declared stable before EOF; future input can change Myers alignment
70
+ * after the first mismatch.
71
+ */
72
+ export declare class DiffStream {
73
+ /** Create an empty two-sided stream. */
74
+ constructor()
75
+ /** Append a JavaScript text chunk to one side. */
76
+ push(side: DiffSide, chunk: string): DiffStreamProgress
77
+ /** Append a UTF-8 subprocess/file chunk without a JS string conversion. */
78
+ pushBytes(side: DiffSide, chunk: Uint8Array): DiffStreamProgress
79
+ /** Mark one side complete; an unfinished final line then becomes visible. */
80
+ finishSide(side: DiffSide): DiffStreamProgress
81
+ /** Mark one side too large and complete without further ingestion. */
82
+ markTooLarge(side: DiffSide): DiffStreamProgress
83
+ /** Current ingestion state. */
84
+ progress(): DiffStreamProgress
85
+ /** Complete display lines from `from`, excluding newline terminators. */
86
+ lines(side: DiffSide, from: number, limit?: number | undefined | null): Array<string>
87
+ /** Snapshot all ingested text for one side. */
88
+ text(side: DiffSide): string
89
+ /**
90
+ * Read a filesystem path directly into one side on the native worker pool.
91
+ *
92
+ * JavaScript can poll [`DiffStream::progress`] and [`DiffStream::lines`]
93
+ * while this promise is pending; file bytes never need to cross into JS
94
+ * and back into the differ.
95
+ */
96
+ openFile(side: DiffSide, path: string, maxBytes?: number | undefined | null, signal?: unknown | undefined | null): Promise<DiffStreamProgress>
97
+ /** Compute exact Myers runs and unified hunks off the JavaScript thread. */
98
+ finish(context?: number | undefined | null): Promise<DiffStreamResult>
99
+ }
100
+
64
101
  /**
65
102
  * Process-owned cross-platform advisory lock.
66
103
  *
@@ -339,7 +376,7 @@ export declare function __ompInstallTokioRuntime(): void
339
376
  * `packages/natives/native/index.js` (which derives the name from
340
377
  * `package.json#version`).
341
378
  */
342
- export declare function __piNativesV1_1_3(): void
379
+ export declare function __piNativesV1_1_5(): void
343
380
 
344
381
 
345
382
  /**
@@ -856,6 +893,44 @@ export interface DiffRun {
856
893
  removed: boolean
857
894
  }
858
895
 
896
+ /** One side of a streamed line diff. */
897
+ export declare enum DiffSide {
898
+ /** Original/base text. */
899
+ Old = 'Old',
900
+ /** Updated/target text. */
901
+ New = 'New'
902
+ }
903
+
904
+ /** Observable ingestion state for [`DiffStream`]. */
905
+ export interface DiffStreamProgress {
906
+ /** Complete old-side lines available for rendering. */
907
+ oldLines: number
908
+ /** Complete new-side lines available for rendering. */
909
+ newLines: number
910
+ /** Leading complete lines proven equal on both sides. */
911
+ stableCommonLines: number
912
+ /** Whether old-side ingestion has finished. */
913
+ oldDone: boolean
914
+ /** Whether new-side ingestion has finished. */
915
+ newDone: boolean
916
+ /** Whether either side contains a NUL byte/code unit. */
917
+ binary: boolean
918
+ /** Whether either native file exceeded its caller-provided size limit. */
919
+ tooLarge: boolean
920
+ }
921
+
922
+ /** Exact line-diff output produced when a [`DiffStream`] finishes. */
923
+ export interface DiffStreamResult {
924
+ /** Line-token Myers runs used to align the complete files. */
925
+ runs: Array<DiffRun>
926
+ /** Unified hunks for the requested context. */
927
+ hunks: Array<PatchHunk>
928
+ /** Whether the old text ends in a newline. */
929
+ oldEndsNewline: boolean
930
+ /** Whether the new text ends in a newline. */
931
+ newEndsNewline: boolean
932
+ }
933
+
859
934
  /**
860
935
  * Word diff with jsdiff `diffWords(oldText, newText)` semantics (default
861
936
  * options).
@@ -1830,6 +1905,18 @@ export interface PtyStartOptions {
1830
1905
  shell?: string
1831
1906
  }
1832
1907
 
1908
+ /**
1909
+ * Rasterize SVG/SVGZ bytes into a bounded PNG without resolving local files.
1910
+ *
1911
+ * Conversion runs on the native blocking pool so parsing and rendering do not
1912
+ * stall the JavaScript event loop.
1913
+ *
1914
+ * # Errors
1915
+ * Returns an error for invalid SVG data, zero/oversized limits, allocation
1916
+ * failure, or PNG encoding failure.
1917
+ */
1918
+ export declare function rasterizeSvg(input: Uint8Array, maxWidthPx: number, maxHeightPx: number): Promise<Uint8Array>
1919
+
1833
1920
  /**
1834
1921
  * Read an image from the system clipboard.
1835
1922
  *
@@ -2159,6 +2246,9 @@ export interface VectorTopK {
2159
2246
  */
2160
2247
  export declare function visibleWidth(text: string, tabWidth: number): number
2161
2248
 
2249
+ /** Warm syntax grammars and scope matchers on the native worker pool. */
2250
+ export declare function warmHighlighter(): Promise<undefined>
2251
+
2162
2252
  /** Profiling results returned to JavaScript. */
2163
2253
  export interface WorkProfile {
2164
2254
  /** Folded stack format for flamegraph tools. */
package/native/index.js CHANGED
@@ -20,6 +20,7 @@ const nativeBindings = loadNative();
20
20
  export const AudioCapture = nativeBindings.AudioCapture;
21
21
  export const AudioPlayback = nativeBindings.AudioPlayback;
22
22
  export const DesktopSession = adaptDesktopSession(nativeBindings.DesktopSession);
23
+ export const DiffStream = nativeBindings.DiffStream;
23
24
  export const FileLock = nativeBindings.FileLock;
24
25
  export const HighlightStream = nativeBindings.HighlightStream;
25
26
  export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
@@ -32,8 +33,7 @@ export const TtyWriter = nativeBindings.TtyWriter;
32
33
 
33
34
  // functions
34
35
  export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
35
- export const __piNativesV1_1_3 = nativeBindings.__piNativesV1_1_3;
36
- export const pdfToMarkdown = nativeBindings.pdfToMarkdown;
36
+ export const __piNativesV1_1_5 = nativeBindings.__piNativesV1_1_5;
37
37
  export const astEdit = nativeBindings.astEdit;
38
38
  export const astGrep = nativeBindings.astGrep;
39
39
  export const astMatch = nativeBindings.astMatch;
@@ -79,6 +79,8 @@ export const mmrRerankIndices = nativeBindings.mmrRerankIndices;
79
79
  export const nodeChainAt = nativeBindings.nodeChainAt;
80
80
  export const parseKey = nativeBindings.parseKey;
81
81
  export const parseKittySequence = nativeBindings.parseKittySequence;
82
+ export const pdfToMarkdown = nativeBindings.pdfToMarkdown;
83
+ export const rasterizeSvg = nativeBindings.rasterizeSvg;
82
84
  export const readImageFromClipboard = nativeBindings.readImageFromClipboard;
83
85
  export const renderSnapcompactPng = nativeBindings.renderSnapcompactPng;
84
86
  export const search = nativeBindings.search;
@@ -91,6 +93,7 @@ export const supportsLanguage = nativeBindings.supportsLanguage;
91
93
  export const truncateToWidth = nativeBindings.truncateToWidth;
92
94
  export const vectorIndexTopK = nativeBindings.vectorIndexTopK;
93
95
  export const visibleWidth = nativeBindings.visibleWidth;
96
+ export const warmHighlighter = nativeBindings.warmHighlighter;
94
97
  export const wrapTextWithAnsi = nativeBindings.wrapTextWithAnsi;
95
98
 
96
99
  // string/numeric enums (napi-rs string_enum produces TS-only const enum)
@@ -102,6 +105,10 @@ export const AstMatchStrictness = {
102
105
  Signature: "signature",
103
106
  Template: "template",
104
107
  };
108
+ export const DiffSide = {
109
+ Old: "Old",
110
+ New: "New",
111
+ };
105
112
  export const Ellipsis = {
106
113
  Unicode: 0,
107
114
  Ascii: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linxiraos/pi-natives",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
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://linxira-os.github.io/zeta/",
@@ -92,10 +92,10 @@
92
92
  }
93
93
  },
94
94
  "optionalDependencies": {
95
- "@linxiraos/pi-natives-linux-x64": "1.1.3",
96
- "@linxiraos/pi-natives-linux-arm64": "1.1.3",
97
- "@linxiraos/pi-natives-darwin-x64": "1.1.3",
98
- "@linxiraos/pi-natives-darwin-arm64": "1.1.3",
99
- "@linxiraos/pi-natives-win32-x64": "1.1.3"
95
+ "@linxiraos/pi-natives-linux-x64": "1.1.5",
96
+ "@linxiraos/pi-natives-linux-arm64": "1.1.5",
97
+ "@linxiraos/pi-natives-darwin-x64": "1.1.5",
98
+ "@linxiraos/pi-natives-darwin-arm64": "1.1.5",
99
+ "@linxiraos/pi-natives-win32-x64": "1.1.5"
100
100
  }
101
101
  }