@linxiraos/pi-natives 1.4.0 → 1.4.2

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
@@ -57,6 +57,14 @@ without applying alpha twice. Fully transparent pixels remain transparent;
57
57
  unscaled images retain their existing blending path. Re-encode when the terminal
58
58
  background RGB changes.
59
59
 
60
+ ### PTY dimensions
61
+
62
+ `normalizePtyDimensions(cols, rows)` returns `{ cols, rows }` with fractional
63
+ values truncated toward zero and dimensions clamped to 20–400 columns and
64
+ 5–200 rows. It shares the native bounds used by `PtySession.start`,
65
+ `startArgv`, and `resize`. Use the returned dimensions when sizing a screen
66
+ emulator so its viewport matches the native PTY.
67
+
60
68
  ### Lazy Windows path helpers
61
69
 
62
70
  Import `expandWindowsLongPath` and `getWindowsShortPath` from
package/native/index.d.ts CHANGED
@@ -355,6 +355,29 @@ export declare class IpcServer {
355
355
  unref(): void
356
356
  }
357
357
 
358
+ /** Native multi-pattern line matcher returning named captures per line. */
359
+ export declare class LineMatcher {
360
+ /**
361
+ * Throws when a pattern fails to compile; message names the failing index
362
+ * and the regex error, e.g. `pattern 2: regex parse error: ...`.
363
+ *
364
+ * # Errors
365
+ * Returns an error when any pattern fails to compile.
366
+ */
367
+ constructor(patterns: Array<string>)
368
+ /**
369
+ * Named groups of each pattern, in pattern order: the layout of a match's
370
+ * `start, end` pairs in [`LineMatches::spans`].
371
+ */
372
+ groupNames(): Array<Array<string>>
373
+ /**
374
+ * Matches every line (split on `
375
+ `) against every pattern; first match
376
+ * per line per pattern; ordered by line then pattern index.
377
+ */
378
+ matchLines(text: string): LineMatches
379
+ }
380
+
358
381
  /** WebRTC peer that accepts 16 kHz mono PCM and renders remote Opus audio. */
359
382
  export declare class LiveWebRtcPeer {
360
383
  /**
@@ -414,6 +437,27 @@ export declare class NativeOAuthCallback {
414
437
  dispose(): Promise<undefined>
415
438
  }
416
439
 
440
+ /**
441
+ * The bytes crossing one shell run's pipeline pipes, during and after the run.
442
+ *
443
+ * For `cargo build 2>&1 | tail -5`, stream 1 holds what `cargo` has written
444
+ * so far while `tail` still holds it back. Create one per run and pass it as
445
+ * [`ShellRunOptions::streams`]. Streams are numbered from 1 in the order the
446
+ * run opened its pipes; each keeps its most recent 1 MiB, and a run keeps its
447
+ * 4 newest finished streams.
448
+ */
449
+ export declare class PipeStreams {
450
+ constructor()
451
+ /** The run's retained streams, oldest first. */
452
+ list(): Array<PipeStreamInfo>
453
+ /**
454
+ * Retained bytes of stream `id` from stream offset `from` on (all of them
455
+ * without it), or `null` for a stream the run never opened or no longer
456
+ * keeps.
457
+ */
458
+ read(id: number, from?: number | undefined | null): PipeStreamChunk | null
459
+ }
460
+
417
461
  /**
418
462
  * Long-lived cross-platform power assertion.
419
463
  *
@@ -1305,11 +1349,12 @@ export interface ClipboardImage {
1305
1349
  }
1306
1350
 
1307
1351
  /**
1308
- * Invalidates this process's event taps; for a host about to
1309
- * exit, after which no desktop session here sees the user's input again. A
1310
- * macOS tap that dies with its process while the user types makes
1311
- * `WindowServer` deliver their key again; Bun's `process.exit` runs no native
1312
- * exit hook, so the host calls this from its exit handler.
1352
+ * Invalidates this process's event taps before it exits.
1353
+ *
1354
+ * No desktop session here sees the user's input again afterwards. A macOS tap
1355
+ * that dies with its process while the user types makes `WindowServer`
1356
+ * deliver their key again; Bun's `process.exit` runs no native exit hook, so
1357
+ * the host calls this from its exit handler.
1313
1358
  */
1314
1359
  export declare function closeDesktopEventTaps(): void
1315
1360
 
@@ -1468,6 +1513,12 @@ export interface DesktopDisplay {
1468
1513
  isPrimary: boolean
1469
1514
  }
1470
1515
 
1516
+ /**
1517
+ * Physical-Escape stops counted under `key` by every desktop session created
1518
+ * with it, including closed ones, until the key is forgotten.
1519
+ */
1520
+ export declare function desktopEscapeStops(key: string): number
1521
+
1471
1522
  /**
1472
1523
  * Where focus ended after a takeover input call, as `WindowServer` reports
1473
1524
  * it. Input calls resolve to it on macOS when they took over; other
@@ -1514,12 +1565,6 @@ export interface DesktopScreenState {
1514
1565
  displayAsleep: boolean
1515
1566
  }
1516
1567
 
1517
- /**
1518
- * Physical-Escape stops counted under `key` by every desktop session created
1519
- * with it, including closed ones, until the key is forgotten.
1520
- */
1521
- export declare function desktopEscapeStops(key: string): number
1522
-
1523
1568
  export interface DesktopSessionOptions {
1524
1569
  display?: string
1525
1570
  /**
@@ -1782,6 +1827,12 @@ export interface EditPolicy {
1782
1827
  allowFuzzy: boolean
1783
1828
  fuzzyThreshold: number
1784
1829
  enforceSeenLines: boolean
1830
+ /**
1831
+ * Narrowest per-line display cap any tool applies, in UTF-8 bytes (0: no
1832
+ * tool cuts lines). Without recorded read provenance, hashline anchors on
1833
+ * longer lines are rejected.
1834
+ */
1835
+ maxColumns: number
1785
1836
  blockAutoGenerated: boolean
1786
1837
  planActive: boolean
1787
1838
  /** Registered internal URL schemes (router spec keys). */
@@ -2372,6 +2423,12 @@ export interface HtmlToMarkdownOptions {
2372
2423
  cleanContent?: boolean
2373
2424
  /** Skip images during conversion. */
2374
2425
  skipImages?: boolean
2426
+ /**
2427
+ * Hidden content to keep: "drop" (default) omits it, "reachable" keeps
2428
+ * content the page can reveal (collapsed sections, inactive tab panels),
2429
+ * "all" also keeps `<template>` and `<noscript>` content.
2430
+ */
2431
+ hiddenContent?: string
2375
2432
  }
2376
2433
 
2377
2434
  /** One stray sloppy payload region inside prose (UTF-16 offsets). */
@@ -2547,6 +2604,25 @@ export declare enum KeyEventType {
2547
2604
  Release = 3
2548
2605
  }
2549
2606
 
2607
+ /**
2608
+ * Matches of one [`LineMatcher::match_lines`] call, column-wise.
2609
+ *
2610
+ * Match `i` is on line `lines[i]` for pattern `rules[i]`, and its named
2611
+ * groups (in [`LineMatcher::group_names`] order for that pattern) are the
2612
+ * next `start, end` pairs of `spans`.
2613
+ */
2614
+ export interface LineMatches {
2615
+ /** 0-based line index per match. */
2616
+ lines: Uint32Array
2617
+ /** Pattern index per match. */
2618
+ rules: Uint32Array
2619
+ /**
2620
+ * Per match and named group: UTF-16 start and end within the line, `-1, -1`
2621
+ * when the group did not participate.
2622
+ */
2623
+ spans: Int32Array
2624
+ }
2625
+
2550
2626
  export interface LineRange {
2551
2627
  /** 1-indexed inclusive first visible line. */
2552
2628
  startLine: number
@@ -2838,12 +2914,15 @@ export interface NodeSpan {
2838
2914
  kind: string
2839
2915
  }
2840
2916
 
2917
+ /**
2918
+ * Truncate and clamp dimensions to the same limits used by PTY start and
2919
+ * resize.
2920
+ */
2921
+ export declare function normalizePtyDimensions(cols: number, rows: number): PtyDimensions
2922
+
2841
2923
  /** Decode notebook JSON into the editable cell-marker text. */
2842
2924
  export declare function notebookToEditableText(json: string, displayPath: string): string
2843
2925
 
2844
- /** Check syntax through the shared parse cache without constructing a summary. */
2845
- export declare function parseCodeStatus(options: ParseStatusOptions): ParseStatus
2846
-
2847
2926
  /**
2848
2927
  * An opened application: its [`Application`] fields and the window it
2849
2928
  * shows. On macOS `window` is its frontmost window once one is on screen;
@@ -2858,6 +2937,9 @@ export interface OpenedApplication {
2858
2937
  window?: DesktopWindow
2859
2938
  }
2860
2939
 
2940
+ /** Check syntax through the shared parse cache without constructing a summary. */
2941
+ export declare function parseCodeStatus(options: ParseStatusOptions): ParseStatus
2942
+
2861
2943
  /** Parsed Kitty keyboard protocol sequence result for a Kitty input sequence. */
2862
2944
  export interface ParsedKittyResult {
2863
2945
  /** Primary codepoint associated with the key. */
@@ -2946,6 +3028,35 @@ export interface PdfMarkdownResult {
2946
3028
  */
2947
3029
  export declare function pdfToMarkdown(input: Uint8Array): Promise<PdfMarkdownResult>
2948
3030
 
3031
+ /** Retained bytes of a stream, as stream offsets `start..end`. */
3032
+ export interface PipeStreamChunk {
3033
+ /**
3034
+ * Stream offset of `data`'s first byte; past 0 once older bytes were
3035
+ * dropped.
3036
+ */
3037
+ start: number
3038
+ /** Stream offset just past `data`: the next read's `from`. */
3039
+ end: number
3040
+ /** The bytes `start..end`. */
3041
+ data: Buffer
3042
+ /** Whether bytes may still arrive. */
3043
+ open: boolean
3044
+ }
3045
+
3046
+ /** A tapped pipe of a run. */
3047
+ export interface PipeStreamInfo {
3048
+ /** Stream number, from 1. */
3049
+ id: number
3050
+ /** Source text of the stage writing into the pipe. */
3051
+ producer: string
3052
+ /** Source text of the stage reading from it. */
3053
+ consumer: string
3054
+ /** Bytes written so far, including those no longer retained. */
3055
+ total: number
3056
+ /** Whether bytes may still arrive. */
3057
+ open: boolean
3058
+ }
3059
+
2949
3060
  export interface PointerOptions {
2950
3061
  button?: string
2951
3062
  count?: number
@@ -3062,6 +3173,12 @@ export interface PtyArgvStartOptions {
3062
3173
  rows?: number
3063
3174
  }
3064
3175
 
3176
+ /** Effective terminal dimensions shared by PTY sessions and screen emulators. */
3177
+ export interface PtyDimensions {
3178
+ cols: number
3179
+ rows: number
3180
+ }
3181
+
3065
3182
  /** Result of a PTY command run. */
3066
3183
  export interface PtyRunResult {
3067
3184
  /** Exit code when the command completes. */
@@ -3589,6 +3706,8 @@ export interface ShellRunOptions {
3589
3706
  * filesystem applies again to later runs.
3590
3707
  */
3591
3708
  filesystem?: ShellFilesystem
3709
+ /** Receives a copy of every byte crossing the run's pipeline pipes. */
3710
+ streams?: PipeStreams
3592
3711
  }
3593
3712
 
3594
3713
  /** Result of running a shell command. */
package/native/index.js CHANGED
@@ -33,9 +33,11 @@ export const FileLock = nativeBindings.FileLock;
33
33
  export const HighlightStream = nativeBindings.HighlightStream;
34
34
  export const IpcConnection = nativeBindings.IpcConnection;
35
35
  export const IpcServer = nativeBindings.IpcServer;
36
+ export const LineMatcher = nativeBindings.LineMatcher;
36
37
  export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
37
38
  export const MacAppearanceObserver = nativeBindings.MacAppearanceObserver;
38
39
  export const NativeOAuthCallback = nativeBindings.NativeOAuthCallback;
40
+ export const PipeStreams = nativeBindings.PipeStreams;
39
41
  export const PowerAssertion = nativeBindings.PowerAssertion;
40
42
  export const Process = nativeBindings.Process;
41
43
  export const PtySession = nativeBindings.PtySession;
@@ -118,6 +120,7 @@ export const matchesKittySequence = nativeBindings.matchesKittySequence ?? missi
118
120
  export const matchesLegacySequence = nativeBindings.matchesLegacySequence ?? missingNativeExport("matchesLegacySequence");
119
121
  export const mmrRerankIndices = nativeBindings.mmrRerankIndices ?? missingNativeExport("mmrRerankIndices");
120
122
  export const nodeChainAt = nativeBindings.nodeChainAt ?? missingNativeExport("nodeChainAt");
123
+ export const normalizePtyDimensions = nativeBindings.normalizePtyDimensions ?? missingNativeExport("normalizePtyDimensions");
121
124
  export const notebookToEditableText = nativeBindings.notebookToEditableText ?? missingNativeExport("notebookToEditableText");
122
125
  export const parseCodeStatus = nativeBindings.parseCodeStatus ?? missingNativeExport("parseCodeStatus");
123
126
  export const parseKey = nativeBindings.parseKey ?? missingNativeExport("parseKey");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linxiraos/pi-natives",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
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/",
@@ -110,7 +110,7 @@
110
110
  }
111
111
  },
112
112
  "optionalDependencies": {
113
- "@linxiraos/pi-natives-linux-x64": "1.4.0",
114
- "@linxiraos/pi-natives-win32-x64": "1.4.0"
113
+ "@linxiraos/pi-natives-linux-x64": "1.4.2",
114
+ "@linxiraos/pi-natives-win32-x64": "1.4.2"
115
115
  }
116
116
  }