@oh-my-pi/pi-natives 18.15.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.
- package/THIRD-PARTY-NOTICES.txt +0 -80
- package/native/index.d.ts +147 -9
- package/native/index.js +12 -0
- package/native/sqlite-locks.d.ts +12 -0
- package/native/sqlite-locks.js +26 -0
- package/package.json +15 -9
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -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.
|
|
91
|
-
*
|
|
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>
|
|
@@ -428,6 +428,24 @@ export declare class MacAppearanceObserver {
|
|
|
428
428
|
stop(): void
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
/** The app the user had in front when `macOSFrontApp()` read it. */
|
|
432
|
+
export declare class MacOSFrontApp {
|
|
433
|
+
/**
|
|
434
|
+
* Puts this app back in front, without raising its windows, each time the
|
|
435
|
+
* app that took the front from it takes it again during the next
|
|
436
|
+
* `durationMs`. Ends early once a hardware mouse button or ⌘/⌃ is used
|
|
437
|
+
* after the app was read, the app came from a launcher or Spotlight panel,
|
|
438
|
+
* or a different app comes forward: that is the user picking an app.
|
|
439
|
+
* Typing does not end it, and a hand-back macOS refuses for a key typed
|
|
440
|
+
* meanwhile is asked again. Holds nothing when called over a second after
|
|
441
|
+
* the latest read, as picks made since then went unwatched. Owns desktop
|
|
442
|
+
* input/focus control only for each hand-back, and rejects if another
|
|
443
|
+
* operation owns it then. Resolves how many times it put the app back.
|
|
444
|
+
*/
|
|
445
|
+
keepInFront(durationMs: number): Promise<number>
|
|
446
|
+
}
|
|
447
|
+
export type MacosFrontApp = MacOSFrontApp
|
|
448
|
+
|
|
431
449
|
/** A transactional, process-owned native OAuth callback receiver. */
|
|
432
450
|
export declare class NativeOAuthCallback {
|
|
433
451
|
/** Create a receiver without touching the filesystem or OS registration. */
|
|
@@ -549,7 +567,46 @@ export declare class PtySession {
|
|
|
549
567
|
kill(): void
|
|
550
568
|
}
|
|
551
569
|
|
|
552
|
-
/**
|
|
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. */
|
|
553
610
|
export declare class Shell {
|
|
554
611
|
/**
|
|
555
612
|
* Create a new shell session from optional configuration.
|
|
@@ -589,6 +646,15 @@ export declare class Shell {
|
|
|
589
646
|
pids(): Array<number>
|
|
590
647
|
}
|
|
591
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
|
+
|
|
592
658
|
/** One word-completion engine running on its own thread. */
|
|
593
659
|
export declare class TextPredictor {
|
|
594
660
|
/**
|
|
@@ -1424,10 +1490,8 @@ export declare function countTokens(input: string | string[], encoding?: Encodin
|
|
|
1424
1490
|
/**
|
|
1425
1491
|
* Decode one complete SIXEL control string into a PNG on the calling thread.
|
|
1426
1492
|
*
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1429
|
-
* first so hostile dimensions cannot make the dependency allocate its much
|
|
1430
|
-
* larger internal maximum.
|
|
1493
|
+
* Raster declarations, repeats, and row advances are bounded before allocating
|
|
1494
|
+
* the decoded RGBA buffer.
|
|
1431
1495
|
*/
|
|
1432
1496
|
export declare function decodeSixelToPng(bytes: Uint8Array): Uint8Array
|
|
1433
1497
|
|
|
@@ -2017,7 +2081,7 @@ export declare enum Encoding {
|
|
|
2017
2081
|
export declare function execReplace(argv: Array<string>): void
|
|
2018
2082
|
|
|
2019
2083
|
/**
|
|
2020
|
-
* Execute a
|
|
2084
|
+
* Execute a command in the embedded bash engine (pi-shell).
|
|
2021
2085
|
*
|
|
2022
2086
|
* Creates a fresh session for each call. The `on_chunk` callback receives
|
|
2023
2087
|
* streamed stdout/stderr output. Returns the exit code when the command
|
|
@@ -2377,6 +2441,25 @@ export declare function hashlineStripPrefixes(lines: Array<string>): Array<strin
|
|
|
2377
2441
|
*/
|
|
2378
2442
|
export declare function hasMatch(content: string | Uint8Array, pattern: string | Uint8Array, ignoreCase?: boolean | undefined | null, multiline?: boolean | undefined | null): boolean
|
|
2379
2443
|
|
|
2444
|
+
/**
|
|
2445
|
+
* How `path` is held by this process: open through another descriptor and
|
|
2446
|
+
* locked. `null` when it is not, and always outside Linux.
|
|
2447
|
+
*
|
|
2448
|
+
* Looks at the path's inode through the descriptors already open, without
|
|
2449
|
+
* opening the file.
|
|
2450
|
+
*/
|
|
2451
|
+
export declare function heldFileKind(path: string): HeldFileKind | null
|
|
2452
|
+
|
|
2453
|
+
/** What a file this process holds locked is. */
|
|
2454
|
+
export declare enum HeldFileKind {
|
|
2455
|
+
/** A SQLite database this process has open with its locks. */
|
|
2456
|
+
Database = 'database',
|
|
2457
|
+
/** A SQLite WAL-index (`-shm`) file this process has open with its locks. */
|
|
2458
|
+
WalIndex = 'wal-index',
|
|
2459
|
+
/** Another file this process holds open with a record lock. */
|
|
2460
|
+
Locked = 'locked'
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2380
2463
|
/**
|
|
2381
2464
|
* Highlight code and return ANSI-colored lines.
|
|
2382
2465
|
*
|
|
@@ -2467,6 +2550,15 @@ export interface InlineSloppyRegion {
|
|
|
2467
2550
|
payload: string
|
|
2468
2551
|
}
|
|
2469
2552
|
|
|
2553
|
+
/**
|
|
2554
|
+
* Moves this process's SQLite record locks onto open-file-description locks.
|
|
2555
|
+
*
|
|
2556
|
+
* No other close of the file can release those (see `ofd_locks.rs`). Call it
|
|
2557
|
+
* before the process opens any SQLite database. Returns whether SQLite now
|
|
2558
|
+
* uses them: `false` outside Linux, or when Bun's SQLite is not found.
|
|
2559
|
+
*/
|
|
2560
|
+
export declare function installSqliteLockShim(): boolean
|
|
2561
|
+
|
|
2470
2562
|
/** Options for `IpcConnection.connect`. */
|
|
2471
2563
|
export interface IpcConnectOptions {
|
|
2472
2564
|
/**
|
|
@@ -2739,6 +2831,12 @@ export declare function macOSAutocorrectWord(text: string, start: number, length
|
|
|
2739
2831
|
*/
|
|
2740
2832
|
export declare function macOSCheckSpelling(text: string): Promise<Array<SpellingRange>>
|
|
2741
2833
|
|
|
2834
|
+
/**
|
|
2835
|
+
* The app macOS `WindowServer` has in front. `null` off macOS and when the
|
|
2836
|
+
* front-process SPI is unavailable.
|
|
2837
|
+
*/
|
|
2838
|
+
export declare function macOSFrontApp(): MacOSFrontApp | null
|
|
2839
|
+
|
|
2742
2840
|
/** Whether the host can use Apple's native spelling service. */
|
|
2743
2841
|
export declare function macOSSpellCheckerAvailable(): boolean
|
|
2744
2842
|
|
|
@@ -3312,6 +3410,19 @@ export declare function renderMermaidAscii(text: string, options?: MermaidRender
|
|
|
3312
3410
|
*/
|
|
3313
3411
|
export declare function renderSnapcompactPng(text: string, options: SnapcompactRenderOptions): Promise<string>
|
|
3314
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
|
+
|
|
3315
3426
|
/**
|
|
3316
3427
|
* Search content for a pattern (one-shot, compiles pattern each time).
|
|
3317
3428
|
* For repeated searches with the same pattern, use [`grep`] with file filters.
|
|
@@ -3363,7 +3474,10 @@ export interface SearchResult {
|
|
|
3363
3474
|
|
|
3364
3475
|
export declare function setHangulCompatJamoWidthOverride(value: number): void
|
|
3365
3476
|
|
|
3366
|
-
/**
|
|
3477
|
+
/**
|
|
3478
|
+
* Options for executing a shell command via the embedded bash engine
|
|
3479
|
+
* (pi-shell).
|
|
3480
|
+
*/
|
|
3367
3481
|
export interface ShellExecuteOptions {
|
|
3368
3482
|
/** Command string to execute in the shell. */
|
|
3369
3483
|
command: string
|
|
@@ -3733,6 +3847,8 @@ export interface ShellRunOptions {
|
|
|
3733
3847
|
filesystem?: ShellFilesystem
|
|
3734
3848
|
/** Receives a copy of every byte crossing the run's pipeline pipes. */
|
|
3735
3849
|
streams?: PipeStreams
|
|
3850
|
+
/** Folds the run's engine events into a live model of the command. */
|
|
3851
|
+
trace?: RunTrace
|
|
3736
3852
|
}
|
|
3737
3853
|
|
|
3738
3854
|
/** Result of running a shell command. */
|
|
@@ -3754,6 +3870,28 @@ export interface ShellRunResult {
|
|
|
3754
3870
|
workingDir?: string
|
|
3755
3871
|
}
|
|
3756
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
|
+
|
|
3757
3895
|
/**
|
|
3758
3896
|
* Visible slice of a line after ANSI-aware column selection
|
|
3759
3897
|
* (`sliceWithWidth`).
|
package/native/index.js
CHANGED
|
@@ -36,12 +36,15 @@ export const IpcServer = nativeBindings.IpcServer;
|
|
|
36
36
|
export const LineMatcher = nativeBindings.LineMatcher;
|
|
37
37
|
export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
|
|
38
38
|
export const MacAppearanceObserver = nativeBindings.MacAppearanceObserver;
|
|
39
|
+
export const MacOSFrontApp = nativeBindings.MacOSFrontApp;
|
|
39
40
|
export const NativeOAuthCallback = nativeBindings.NativeOAuthCallback;
|
|
40
41
|
export const PipeStreams = nativeBindings.PipeStreams;
|
|
41
42
|
export const PowerAssertion = nativeBindings.PowerAssertion;
|
|
42
43
|
export const Process = nativeBindings.Process;
|
|
43
44
|
export const PtySession = nativeBindings.PtySession;
|
|
45
|
+
export const RunTrace = nativeBindings.RunTrace;
|
|
44
46
|
export const Shell = nativeBindings.Shell;
|
|
47
|
+
export const ShellVisualization = nativeBindings.ShellVisualization;
|
|
45
48
|
export const TextPredictor = nativeBindings.TextPredictor;
|
|
46
49
|
export const TtyWriter = nativeBindings.TtyWriter;
|
|
47
50
|
export const VcsGitRepo = nativeBindings.VcsGitRepo;
|
|
@@ -100,8 +103,10 @@ export const hashlineFormatNumberedLines = nativeBindings.hashlineFormatNumbered
|
|
|
100
103
|
export const hashlineIsReadTruncationNotice = nativeBindings.hashlineIsReadTruncationNotice ?? missingNativeExport("hashlineIsReadTruncationNotice");
|
|
101
104
|
export const hashlineStripPrefixes = nativeBindings.hashlineStripPrefixes ?? missingNativeExport("hashlineStripPrefixes");
|
|
102
105
|
export const hasMatch = nativeBindings.hasMatch ?? missingNativeExport("hasMatch");
|
|
106
|
+
export const heldFileKind = nativeBindings.heldFileKind ?? missingNativeExport("heldFileKind");
|
|
103
107
|
export const highlightCode = nativeBindings.highlightCode ?? missingNativeExport("highlightCode");
|
|
104
108
|
export const htmlToMarkdown = nativeBindings.htmlToMarkdown ?? missingNativeExport("htmlToMarkdown");
|
|
109
|
+
export const installSqliteLockShim = nativeBindings.installSqliteLockShim ?? missingNativeExport("installSqliteLockShim");
|
|
105
110
|
export const ipcEndpoint = nativeBindings.ipcEndpoint ?? missingNativeExport("ipcEndpoint");
|
|
106
111
|
export const isoBackend = nativeBindings.isoBackend ?? missingNativeExport("isoBackend");
|
|
107
112
|
export const isoDiff = nativeBindings.isoDiff ?? missingNativeExport("isoDiff");
|
|
@@ -113,6 +118,7 @@ export const isoStop = nativeBindings.isoStop ?? missingNativeExport("isoStop");
|
|
|
113
118
|
export const listWorkspace = nativeBindings.listWorkspace ?? missingNativeExport("listWorkspace");
|
|
114
119
|
export const macOSAutocorrectWord = nativeBindings.macOSAutocorrectWord ?? missingNativeExport("macOSAutocorrectWord");
|
|
115
120
|
export const macOSCheckSpelling = nativeBindings.macOSCheckSpelling ?? missingNativeExport("macOSCheckSpelling");
|
|
121
|
+
export const macOSFrontApp = nativeBindings.macOSFrontApp ?? missingNativeExport("macOSFrontApp");
|
|
116
122
|
export const macOSSpellCheckerAvailable = nativeBindings.macOSSpellCheckerAvailable ?? missingNativeExport("macOSSpellCheckerAvailable");
|
|
117
123
|
export const macOSSpellingGuesses = nativeBindings.macOSSpellingGuesses ?? missingNativeExport("macOSSpellingGuesses");
|
|
118
124
|
export const matchesKey = nativeBindings.matchesKey ?? missingNativeExport("matchesKey");
|
|
@@ -131,6 +137,7 @@ export const readImageFromClipboard = nativeBindings.readImageFromClipboard ?? m
|
|
|
131
137
|
export const readTextFromClipboard = nativeBindings.readTextFromClipboard ?? missingNativeExport("readTextFromClipboard");
|
|
132
138
|
export const renderMermaidAscii = nativeBindings.renderMermaidAscii ?? missingNativeExport("renderMermaidAscii");
|
|
133
139
|
export const renderSnapcompactPng = nativeBindings.renderSnapcompactPng ?? missingNativeExport("renderSnapcompactPng");
|
|
140
|
+
export const runShellMain = nativeBindings.runShellMain ?? missingNativeExport("runShellMain");
|
|
134
141
|
export const search = nativeBindings.search ?? missingNativeExport("search");
|
|
135
142
|
export const setHangulCompatJamoWidthOverride = nativeBindings.setHangulCompatJamoWidthOverride ?? missingNativeExport("setHangulCompatJamoWidthOverride");
|
|
136
143
|
export const sliceWithWidth = nativeBindings.sliceWithWidth ?? missingNativeExport("sliceWithWidth");
|
|
@@ -198,6 +205,11 @@ export const GrepOutputMode = {
|
|
|
198
205
|
Count: "count",
|
|
199
206
|
FilesWithMatches: "filesWithMatches",
|
|
200
207
|
};
|
|
208
|
+
export const HeldFileKind = {
|
|
209
|
+
Database: "database",
|
|
210
|
+
WalIndex: "wal-index",
|
|
211
|
+
Locked: "locked",
|
|
212
|
+
};
|
|
201
213
|
export const IsoBackendKind = {
|
|
202
214
|
Apfs: 0,
|
|
203
215
|
Btrfs: 1,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HeldFileKind } from "./index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lazily loading forms of the SQLite lock exports in `index.d.ts`: the addon
|
|
5
|
+
* loads on the first call instead of at import.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Moves this process's SQLite record locks onto open-file-description locks; `false` when unavailable. */
|
|
9
|
+
export declare function installSqliteLockShim(): boolean;
|
|
10
|
+
|
|
11
|
+
/** How `path` is held by this process (open elsewhere and locked), or `null`. */
|
|
12
|
+
export declare function heldFileKind(path: string): HeldFileKind | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { loadNative } from "./loader-state.js";
|
|
2
|
+
|
|
3
|
+
let bindings;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Load the addon on first use, so importing this module (pi-utils' SQLite
|
|
7
|
+
* helpers) costs nothing in processes that never open a database. An addon
|
|
8
|
+
* built before these exports existed (a stale local build, or PR CI, which
|
|
9
|
+
* tests against main's newest addon) yields `undefined`: the store still opens,
|
|
10
|
+
* unprotected, and `ensureSqliteLockShim` reports it.
|
|
11
|
+
*/
|
|
12
|
+
function native(symbolName) {
|
|
13
|
+
bindings ??= loadNative();
|
|
14
|
+
const value = bindings[symbolName];
|
|
15
|
+
return typeof value === "function" ? value : undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** See `installSqliteLockShim` in `index.d.ts`; `false` from an addon predating it. */
|
|
19
|
+
export function installSqliteLockShim() {
|
|
20
|
+
return native("installSqliteLockShim")?.() ?? false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** See `heldFileKind` in `index.d.ts`; `null` from an addon predating it. */
|
|
24
|
+
export function heldFileKind(path) {
|
|
25
|
+
return native("heldFileKind")?.(path) ?? null;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "18.
|
|
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": "
|
|
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",
|
|
@@ -78,6 +77,8 @@
|
|
|
78
77
|
"native/loader-state.d.ts",
|
|
79
78
|
"native/path.js",
|
|
80
79
|
"native/path.d.ts",
|
|
80
|
+
"native/sqlite-locks.js",
|
|
81
|
+
"native/sqlite-locks.d.ts",
|
|
81
82
|
"native/vcs.js",
|
|
82
83
|
"native/vcs.d.ts",
|
|
83
84
|
"native/embedded-addon.js",
|
|
@@ -111,14 +112,19 @@
|
|
|
111
112
|
"types": "./native/vcs.d.ts",
|
|
112
113
|
"import": "./native/vcs.js",
|
|
113
114
|
"default": "./native/vcs.js"
|
|
115
|
+
},
|
|
116
|
+
"./sqlite-locks": {
|
|
117
|
+
"types": "./native/sqlite-locks.d.ts",
|
|
118
|
+
"import": "./native/sqlite-locks.js",
|
|
119
|
+
"default": "./native/sqlite-locks.js"
|
|
114
120
|
}
|
|
115
121
|
},
|
|
116
122
|
"optionalDependencies": {
|
|
117
|
-
"@oh-my-pi/pi-natives-linux-x64": "18.
|
|
118
|
-
"@oh-my-pi/pi-natives-linux-arm64": "18.
|
|
119
|
-
"@oh-my-pi/pi-natives-darwin-x64": "18.
|
|
120
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "18.
|
|
121
|
-
"@oh-my-pi/pi-natives-win32-x64": "18.
|
|
122
|
-
"@oh-my-pi/pi-natives-win32-arm64": "18.
|
|
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"
|
|
123
129
|
}
|
|
124
130
|
}
|