@oh-my-pi/pi-natives 18.16.0 → 18.17.0

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.
@@ -9,56 +9,6 @@ governs only the material it names.
9
9
  VENDORED SOURCE AND DATA
10
10
  ========================
11
11
 
12
- -------------------------------------------------------------------------------
13
- brush-core 0.5.0 — crates/vendor/brush-core
14
-
15
- This directory contains a vendored, locally-patched copy of brush-core from the
16
- brush shell project (https://github.com/reubeno/brush), used under the MIT
17
- License. It is wired into the workspace via `[patch.crates-io]` so these
18
- modifications can be maintained against the published release (brush-core
19
- 0.5.0).
20
-
21
- Copyright (c) 2024 reuben olinsky
22
-
23
- Local modifications include: Windows path handling fixes (drive-alias and
24
- rooted-path normalization in globs), an async background-PID fix for the nohup
25
- wrapper, treating `/dev/null` as poll-ready to avoid an infinite poll on macOS,
26
- and indentation/formatting standardization. The remaining logic tracks upstream
27
- so behavior matches the published crate.
28
-
29
- MIT License
30
-
31
- Permission is hereby granted, free of charge, to any person obtaining a copy
32
- of this software and associated documentation files (the "Software"), to deal
33
- in the Software without restriction, including without limitation the rights
34
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
- copies of the Software, and to permit persons to whom the Software is
36
- furnished to do so, subject to the following conditions:
37
-
38
- The above copyright notice and this permission notice shall be included in all
39
- copies or substantial portions of the Software.
40
-
41
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
- SOFTWARE.
48
-
49
- -------------------------------------------------------------------------------
50
- brush-builtins — crates/pi-builtins
51
-
52
- The POSIX/bash builtins began as a locally-patched copy of brush-builtins from
53
- the brush shell project (https://github.com/reubeno/brush), used under the MIT
54
- License; the full license text is reproduced with brush-core above.
55
-
56
- Copyright (c) 2024 reuben olinsky
57
-
58
- Local modifications include: implementing previously-stubbed builtins, the
59
- `wait` builtin (PID targeting plus the `-f`/`-n`/`-p` flags), and cancellation
60
- support for the `read` builtin via poll.
61
-
62
12
  -------------------------------------------------------------------------------
63
13
  Command-line utilities — crates/pi-builtins
64
14
 
@@ -11855,35 +11805,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11855
11805
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11856
11806
  SOFTWARE.
11857
11807
 
11858
- -------------------------------------------------------------------------------
11859
- License: MIT License (MIT)
11860
- Used by:
11861
- - brush-parser 0.4.0 (https://github.com/reubeno/brush)
11862
-
11863
- Full license text:
11864
-
11865
- MIT License
11866
-
11867
- Copyright (c) 2024 reuben olinsky
11868
-
11869
- Permission is hereby granted, free of charge, to any person obtaining a copy
11870
- of this software and associated documentation files (the "Software"), to deal
11871
- in the Software without restriction, including without limitation the rights
11872
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11873
- copies of the Software, and to permit persons to whom the Software is
11874
- furnished to do so, subject to the following conditions:
11875
-
11876
- The above copyright notice and this permission notice shall be included in all
11877
- copies or substantial portions of the Software.
11878
-
11879
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11880
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11881
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11882
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11883
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11884
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11885
- SOFTWARE.
11886
-
11887
11808
  -------------------------------------------------------------------------------
11888
11809
  License: MIT License (MIT)
11889
11810
  Used by:
@@ -12098,7 +12019,6 @@ SOFTWARE.
12098
12019
  -------------------------------------------------------------------------------
12099
12020
  License: MIT License (MIT)
12100
12021
  Used by:
12101
- - brush-core 0.5.0 (https://github.com/reubeno/brush)
12102
12022
  - napi 3.14.2 (https://github.com/napi-rs/napi-rs)
12103
12023
  - asn1-rs-impl 0.2.0 (https://github.com/rusticata/asn1-rs.git)
12104
12024
  - ast-grep-core 0.39.9 (https://github.com/ast-grep/ast-grep)
package/native/index.d.ts CHANGED
@@ -87,8 +87,8 @@ export declare class DesktopSession {
87
87
  retire(): void
88
88
  /**
89
89
  * Sets when the current run ends, `remaining_ms` from now; each run sets
90
- * it before its first call. On macOS, input waiting for the user to pause
91
- * in its app gives up shortly before it.
90
+ * it before its first call. Input waiting for the user to pause in its app
91
+ * (macOS) or for a Wayland permission prompt gives up shortly before it.
92
92
  */
93
93
  setRunDeadline(remainingMs: number): void
94
94
  capture(target: string, caps?: CaptureCaps | undefined | null): Promise<DesktopCapture>
@@ -567,7 +567,46 @@ export declare class PtySession {
567
567
  kill(): void
568
568
  }
569
569
 
570
- /** Persistent brush-core shell session. */
570
+ /**
571
+ * Actual command state, source units and bounded history for one shell run,
572
+ * including observed assignments and producer-attributed output.
573
+ *
574
+ * Create one over the command text and
575
+ * pass it as [`ShellRunOptions::trace`]; poll [`RunTrace::version`] while the
576
+ * run is in flight and take [`RunTrace::snapshot`] when it changed.
577
+ */
578
+ export declare class RunTrace {
579
+ /** A trace of `script`, the exact command text about to run. */
580
+ constructor(script: string)
581
+ /**
582
+ * Revision of semantic events, assignments and visible output; unchanged
583
+ * means `snapshot()` is unchanged, even when adjacent output coalesces.
584
+ */
585
+ version(): number
586
+ /**
587
+ * The `ShellTrace` JSON with byte-offset layout, current node states and
588
+ * ordered replay `history`. The newest 20,000 records retain at most
589
+ * 2 MiB visible output and 8 MiB payload; `historyTruncated` explicitly
590
+ * reports eviction. History timestamps are measured ns since `RunStart`;
591
+ * output identifies its real producer (`u`, `n`, `command`) when known.
592
+ * Semantic entries carry their actual `vpid`; `rootVpid` distinguishes
593
+ * root lifecycle from owned tool children even after journal trimming.
594
+ * A UTF-8 scalar spanning producers has exact byte `contributors`
595
+ * instead of an invented primary producer. Decoding ends at capture EOF.
596
+ * Segmented minimizer submissions share one epoch and final status;
597
+ * their history carries `segment`, with `logicalEnd`/`logicalStatus`
598
+ * finalizing the last actual root RunEnd after output draining.
599
+ * Serialization borrows the locked model rather than cloning its history.
600
+ */
601
+ snapshot(): string
602
+ /**
603
+ * Render directly over the borrowed native state; no snapshot or syntax
604
+ * roundtrip.
605
+ */
606
+ present(options: ShellVizOptions): string
607
+ }
608
+
609
+ /** Persistent embedded bash engine (pi-shell) shell session. */
571
610
  export declare class Shell {
572
611
  /**
573
612
  * Create a new shell session from optional configuration.
@@ -607,6 +646,15 @@ export declare class Shell {
607
646
  pids(): Array<number>
608
647
  }
609
648
 
649
+ /**
650
+ * Persisted native visualization, restored once rather than reparsed on each
651
+ * frame.
652
+ */
653
+ export declare class ShellVisualization {
654
+ constructor(snapshot: string)
655
+ present(options: ShellVizOptions): string
656
+ }
657
+
610
658
  /** One word-completion engine running on its own thread. */
611
659
  export declare class TextPredictor {
612
660
  /**
@@ -1442,10 +1490,8 @@ export declare function countTokens(input: string | string[], encoding?: Encodin
1442
1490
  /**
1443
1491
  * Decode one complete SIXEL control string into a PNG on the calling thread.
1444
1492
  *
1445
- * The decoder is deliberately bounded before handing the stream to
1446
- * `icy_sixel`: raster declarations, repeats, and row advances are scanned
1447
- * first so hostile dimensions cannot make the dependency allocate its much
1448
- * larger internal maximum.
1493
+ * Raster declarations, repeats, and row advances are bounded before allocating
1494
+ * the decoded RGBA buffer.
1449
1495
  */
1450
1496
  export declare function decodeSixelToPng(bytes: Uint8Array): Uint8Array
1451
1497
 
@@ -2035,7 +2081,7 @@ export declare enum Encoding {
2035
2081
  export declare function execReplace(argv: Array<string>): void
2036
2082
 
2037
2083
  /**
2038
- * Execute a brush shell command.
2084
+ * Execute a command in the embedded bash engine (pi-shell).
2039
2085
  *
2040
2086
  * Creates a fresh session for each call. The `on_chunk` callback receives
2041
2087
  * streamed stdout/stderr output. Returns the exit code when the command
@@ -3364,6 +3410,19 @@ export declare function renderMermaidAscii(text: string, options?: MermaidRender
3364
3410
  */
3365
3411
  export declare function renderSnapcompactPng(text: string, options: SnapcompactRenderOptions): Promise<string>
3366
3412
 
3413
+ /**
3414
+ * Run the pi-shell engine as a process shell in this process (`omp zsh`,
3415
+ * `omp bash`, `omp sh`): `argv` is the shell's whole command line,
3416
+ * `argv[0]` naming it (`zsh`, `bash` or `sh` pick the dialect), as a real
3417
+ * shell gets it. Synchronous: blocks the calling thread until the shell
3418
+ * exits and returns the status the process should exit with (0–255; 101
3419
+ * after a panic). The shell uses the process's own stdin, stdout, stderr,
3420
+ * terminal and inherited descriptors (duplicated, never taken over); the
3421
+ * job-control and termination signals the runtime handles are reset to
3422
+ * their defaults for the run and restored after it.
3423
+ */
3424
+ export declare function runShellMain(argv: Array<string>): number
3425
+
3367
3426
  /**
3368
3427
  * Search content for a pattern (one-shot, compiles pattern each time).
3369
3428
  * For repeated searches with the same pattern, use [`grep`] with file filters.
@@ -3415,7 +3474,10 @@ export interface SearchResult {
3415
3474
 
3416
3475
  export declare function setHangulCompatJamoWidthOverride(value: number): void
3417
3476
 
3418
- /** Options for executing a shell command via brush-core. */
3477
+ /**
3478
+ * Options for executing a shell command via the embedded bash engine
3479
+ * (pi-shell).
3480
+ */
3419
3481
  export interface ShellExecuteOptions {
3420
3482
  /** Command string to execute in the shell. */
3421
3483
  command: string
@@ -3785,6 +3847,8 @@ export interface ShellRunOptions {
3785
3847
  filesystem?: ShellFilesystem
3786
3848
  /** Receives a copy of every byte crossing the run's pipeline pipes. */
3787
3849
  streams?: PipeStreams
3850
+ /** Folds the run's engine events into a live model of the command. */
3851
+ trace?: RunTrace
3788
3852
  }
3789
3853
 
3790
3854
  /** Result of running a shell command. */
@@ -3806,6 +3870,28 @@ export interface ShellRunResult {
3806
3870
  workingDir?: string
3807
3871
  }
3808
3872
 
3873
+ /** Native non-executing visualization transformations. */
3874
+ export interface ShellVizLayers {
3875
+ color: boolean
3876
+ inline: boolean
3877
+ idioms: boolean
3878
+ effects: boolean
3879
+ unwrap: boolean
3880
+ }
3881
+
3882
+ /** Native presentation controls. Node identities are opaque engine keys. */
3883
+ export interface ShellVizOptions {
3884
+ view: 'raw' | 'pseudo'
3885
+ layers: ShellVizLayers
3886
+ split: boolean
3887
+ cursor?: number
3888
+ cursorSeq?: number
3889
+ playing: boolean
3890
+ speed: number
3891
+ selectedNode?: string
3892
+ expandedNodes: Array<string>
3893
+ }
3894
+
3809
3895
  /**
3810
3896
  * Visible slice of a line after ANSI-aware column selection
3811
3897
  * (`sliceWithWidth`).
package/native/index.js CHANGED
@@ -42,7 +42,9 @@ export const PipeStreams = nativeBindings.PipeStreams;
42
42
  export const PowerAssertion = nativeBindings.PowerAssertion;
43
43
  export const Process = nativeBindings.Process;
44
44
  export const PtySession = nativeBindings.PtySession;
45
+ export const RunTrace = nativeBindings.RunTrace;
45
46
  export const Shell = nativeBindings.Shell;
47
+ export const ShellVisualization = nativeBindings.ShellVisualization;
46
48
  export const TextPredictor = nativeBindings.TextPredictor;
47
49
  export const TtyWriter = nativeBindings.TtyWriter;
48
50
  export const VcsGitRepo = nativeBindings.VcsGitRepo;
@@ -135,6 +137,7 @@ export const readImageFromClipboard = nativeBindings.readImageFromClipboard ?? m
135
137
  export const readTextFromClipboard = nativeBindings.readTextFromClipboard ?? missingNativeExport("readTextFromClipboard");
136
138
  export const renderMermaidAscii = nativeBindings.renderMermaidAscii ?? missingNativeExport("renderMermaidAscii");
137
139
  export const renderSnapcompactPng = nativeBindings.renderSnapcompactPng ?? missingNativeExport("renderSnapcompactPng");
140
+ export const runShellMain = nativeBindings.runShellMain ?? missingNativeExport("runShellMain");
138
141
  export const search = nativeBindings.search ?? missingNativeExport("search");
139
142
  export const setHangulCompatJamoWidthOverride = nativeBindings.setHangulCompatJamoWidthOverride ?? missingNativeExport("setHangulCompatJamoWidthOverride");
140
143
  export const sliceWithWidth = nativeBindings.sliceWithWidth ?? missingNativeExport("sliceWithWidth");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "18.16.0",
3
+ "version": "18.17.0",
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",
@@ -35,7 +35,7 @@
35
35
  "build": "bun ../../scripts/bazel-natives.ts host --dest native",
36
36
  "build:bindings": "bun scripts/build-bindings.ts",
37
37
  "check": "oxlint . && oxfmt --check --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts' && bun run check:types",
38
- "check:types": "tsgo -p tsconfig.json --noEmit",
38
+ "check:types": "bun check --no-script -p tsconfig.json",
39
39
  "lint": "oxlint .",
40
40
  "test": "bun test --parallel",
41
41
  "fix": "oxlint --fix --fix-suggestions . && bun run fmt",
@@ -49,7 +49,6 @@
49
49
  "@napi-rs/cli": "3.7.2",
50
50
  "@types/bun": "^1.3.14",
51
51
  "cli-truncate": "6.1.1",
52
- "diff": "9.0.0",
53
52
  "gpt-tokenizer": "4.0.0",
54
53
  "mitata": "1.0.34",
55
54
  "slice-ansi": "9.0.0",
@@ -121,11 +120,11 @@
121
120
  }
122
121
  },
123
122
  "optionalDependencies": {
124
- "@oh-my-pi/pi-natives-linux-x64": "18.16.0",
125
- "@oh-my-pi/pi-natives-linux-arm64": "18.16.0",
126
- "@oh-my-pi/pi-natives-darwin-x64": "18.16.0",
127
- "@oh-my-pi/pi-natives-darwin-arm64": "18.16.0",
128
- "@oh-my-pi/pi-natives-win32-x64": "18.16.0",
129
- "@oh-my-pi/pi-natives-win32-arm64": "18.16.0"
123
+ "@oh-my-pi/pi-natives-linux-x64": "18.17.0",
124
+ "@oh-my-pi/pi-natives-linux-arm64": "18.17.0",
125
+ "@oh-my-pi/pi-natives-darwin-x64": "18.17.0",
126
+ "@oh-my-pi/pi-natives-darwin-arm64": "18.17.0",
127
+ "@oh-my-pi/pi-natives-win32-x64": "18.17.0",
128
+ "@oh-my-pi/pi-natives-win32-arm64": "18.17.0"
130
129
  }
131
130
  }