@oh-my-pi/pi-natives 18.2.11 → 18.3.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/THIRD-PARTY-NOTICES.txt +3 -3
- package/native/index.d.ts +402 -18
- package/native/index.js +60 -1
- package/package.json +11 -8
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -78,8 +78,8 @@ below.
|
|
|
78
78
|
uutils coreutils (https://github.com/uutils/coreutils), MIT
|
|
79
79
|
--------------------------------------------------------------------------------
|
|
80
80
|
Covers: base32, base64, basename, cat, cksum (shared checksum machinery),
|
|
81
|
-
b2sum, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, comm,
|
|
82
|
-
date, dirname, head, hostname, ln, ls, mkdir, mktemp, mv, nproc, paste,
|
|
81
|
+
b2sum, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, comm, cp,
|
|
82
|
+
cut, date, dirname, head, hostname, ln, ls, mkdir, mktemp, mv, nproc, paste,
|
|
83
83
|
printenv, readlink, realpath, rm, seq, sort, stat, tac, tail, tee, touch, tr,
|
|
84
84
|
truncate, uname, uniq, wc, whoami, yes.
|
|
85
85
|
|
|
@@ -293,7 +293,7 @@ MIT License
|
|
|
293
293
|
Copyright (c) 2026 Sander Land
|
|
294
294
|
(measured tokenizer vocabulary data, reconstruction model, and reference
|
|
295
295
|
implementation: https://github.com/sanderland/ctok)
|
|
296
|
-
Copyright (c) 2026 Can Bölük and the
|
|
296
|
+
Copyright (c) 2026 Can Bölük and the omp contributors
|
|
297
297
|
Copyright (c) 2026 Stencil Labs, Inc.
|
|
298
298
|
(Rust implementation and the compact binary vocabulary encoding in
|
|
299
299
|
crates/pi-natives/src/utok/claude)
|
package/native/index.d.ts
CHANGED
|
@@ -103,8 +103,10 @@ export declare class EditSession {
|
|
|
103
103
|
/**
|
|
104
104
|
* Open a session. `onPreview` (optional) receives every settled preview
|
|
105
105
|
* batch; batches are delivered one at a time, in generation order.
|
|
106
|
+
* `resolveUrl` (optional) maps an internal URL target to its backing
|
|
107
|
+
* file; without it such targets fail as unresolved.
|
|
106
108
|
*/
|
|
107
|
-
constructor(store: EditStore, policy: EditPolicy, onPreview?: ((error: Error | null, batch: EditPreviewBatch) => void) | undefined | null)
|
|
109
|
+
constructor(store: EditStore, policy: EditPolicy, onPreview?: ((error: Error | null, batch: EditPreviewBatch) => void) | undefined | null, resolveUrl?: ((error: Error | null, url: string) => Promise<EditUrlResolution>) | undefined | null)
|
|
108
110
|
/** Append a raw streamed argument fragment. */
|
|
109
111
|
push(delta: string): void
|
|
110
112
|
/** Replace the buffer with the complete argument JSON (no-delta path). */
|
|
@@ -648,7 +650,27 @@ export declare function __ompInstallTokioRuntime(): void
|
|
|
648
650
|
* `packages/natives/native/index.js` (which derives the name from
|
|
649
651
|
* `package.json#version`).
|
|
650
652
|
*/
|
|
651
|
-
export declare function
|
|
653
|
+
export declare function __piNativesV18_3_1(): void
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Reports whether the on-device model can generate, as an `availability`
|
|
657
|
+
* event JSON: `{available, reason?, contextSize?, variant?, vision?,
|
|
658
|
+
* toolCalling?}`.
|
|
659
|
+
*/
|
|
660
|
+
export declare function appleFmAvailability(): Promise<string>
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Cancels a generation; its stream then ends with a `cancelled` error event.
|
|
664
|
+
* Unknown or finished handles are ignored.
|
|
665
|
+
*/
|
|
666
|
+
export declare function appleFmCancel(handle: number): void
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Starts one model turn for a JSON request and streams JSON events to
|
|
670
|
+
* `on_event` until a terminal `done` or `error` event. Returns a handle for
|
|
671
|
+
* [`apple_fm_cancel`].
|
|
672
|
+
*/
|
|
673
|
+
export declare function appleFmGenerate(request: string, onEvent: (err: null | Error, event: string) => void): number
|
|
652
674
|
|
|
653
675
|
/**
|
|
654
676
|
* Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
|
|
@@ -684,7 +706,10 @@ export interface AstFindOptions {
|
|
|
684
706
|
patterns?: Array<string>
|
|
685
707
|
/** Language override; otherwise inferred from file extension per candidate. */
|
|
686
708
|
lang?: string
|
|
687
|
-
/**
|
|
709
|
+
/**
|
|
710
|
+
* Single file or directory to scan (combined with `glob` when set): a
|
|
711
|
+
* host path or an absolute `scheme://` URL.
|
|
712
|
+
*/
|
|
688
713
|
path?: string
|
|
689
714
|
/** Optional glob filter relative to the search root. */
|
|
690
715
|
glob?: string
|
|
@@ -707,6 +732,11 @@ export interface AstFindOptions {
|
|
|
707
732
|
signal?: unknown
|
|
708
733
|
/** Wall-clock timeout for the worker task in milliseconds. */
|
|
709
734
|
timeoutMs?: number
|
|
735
|
+
/**
|
|
736
|
+
* Filesystem candidates are resolved, walked, and read through (native
|
|
737
|
+
* when absent).
|
|
738
|
+
*/
|
|
739
|
+
filesystem?: ShellFilesystem
|
|
710
740
|
}
|
|
711
741
|
|
|
712
742
|
/** Aggregated search statistics and any parse or compile diagnostics. */
|
|
@@ -847,7 +877,10 @@ export interface AstReplaceOptions {
|
|
|
847
877
|
* mixed-language paths rewrite each file in its own language.
|
|
848
878
|
*/
|
|
849
879
|
lang?: string
|
|
850
|
-
/**
|
|
880
|
+
/**
|
|
881
|
+
* Single file or directory to rewrite: a host path or an absolute
|
|
882
|
+
* `scheme://` URL.
|
|
883
|
+
*/
|
|
851
884
|
path?: string
|
|
852
885
|
/** Optional glob filter within the search root. */
|
|
853
886
|
glob?: string
|
|
@@ -867,6 +900,11 @@ export interface AstReplaceOptions {
|
|
|
867
900
|
signal?: unknown
|
|
868
901
|
/** Wall-clock timeout for the worker task in milliseconds. */
|
|
869
902
|
timeoutMs?: number
|
|
903
|
+
/**
|
|
904
|
+
* Filesystem candidates are resolved, walked, read, and written through
|
|
905
|
+
* (native when absent).
|
|
906
|
+
*/
|
|
907
|
+
filesystem?: ShellFilesystem
|
|
870
908
|
}
|
|
871
909
|
|
|
872
910
|
/** Summary of an ast-grep rewrite pass, including whether disk writes occurred. */
|
|
@@ -1007,7 +1045,7 @@ export declare function cosineSimilarityPairs(vectors: Float64Array, count: numb
|
|
|
1007
1045
|
* use ordinary encoding (no special-token handling) and the Claude
|
|
1008
1046
|
* encodings count message content without the fixed per-message frame.
|
|
1009
1047
|
* Defaults to `o200k_base`; pass a `Claude*` encoding for exact Claude
|
|
1010
|
-
* counts, or the matching family encoding for Qwen/DeepSeek/Kimi/GLM.
|
|
1048
|
+
* counts, or the matching family encoding for Qwen/DeepSeek/Kimi/GLM/Jev.
|
|
1011
1049
|
*/
|
|
1012
1050
|
export declare function countTokens(input: string | string[], encoding?: Encoding | undefined | null): number
|
|
1013
1051
|
|
|
@@ -1335,10 +1373,15 @@ export interface EditPolicy {
|
|
|
1335
1373
|
enforceSeenLines: boolean
|
|
1336
1374
|
blockAutoGenerated: boolean
|
|
1337
1375
|
planActive: boolean
|
|
1338
|
-
/**
|
|
1339
|
-
|
|
1340
|
-
/**
|
|
1341
|
-
|
|
1376
|
+
/** Registered internal URL schemes (router spec keys). */
|
|
1377
|
+
urlSchemes: Array<string>
|
|
1378
|
+
/**
|
|
1379
|
+
* The `urlSchemes` whose single-slash `scheme:/x` spelling aliases
|
|
1380
|
+
* `scheme://x` (spec `singleSlashAlias`).
|
|
1381
|
+
*/
|
|
1382
|
+
urlAliasSchemes: Array<string>
|
|
1383
|
+
/** Plain-path roots writable in plan mode. */
|
|
1384
|
+
planWritableRoots: Array<string>
|
|
1342
1385
|
homeDir: string
|
|
1343
1386
|
/** The payload is a verbatim custom-format string, not JSON. */
|
|
1344
1387
|
rawInput: boolean
|
|
@@ -1353,11 +1396,14 @@ export interface EditPreviewBatch {
|
|
|
1353
1396
|
files: Array<EditFilePreview>
|
|
1354
1397
|
}
|
|
1355
1398
|
|
|
1356
|
-
/**
|
|
1357
|
-
export interface
|
|
1358
|
-
/**
|
|
1359
|
-
|
|
1360
|
-
|
|
1399
|
+
/** Host answer for one internal URL (`resolveUrl`). */
|
|
1400
|
+
export interface EditUrlResolution {
|
|
1401
|
+
/** Absolute backing file; null when no local file backs the URL. */
|
|
1402
|
+
path?: string
|
|
1403
|
+
/** Model-facing refusal (read-only, disabled…); wins over `path`. */
|
|
1404
|
+
error?: string
|
|
1405
|
+
/** Writable while plan mode is active (sandbox-scoped scheme). */
|
|
1406
|
+
planWritable: boolean
|
|
1361
1407
|
}
|
|
1362
1408
|
|
|
1363
1409
|
/** Host write request; the host owns the bytes. */
|
|
@@ -1451,7 +1497,9 @@ export declare enum Encoding {
|
|
|
1451
1497
|
/** Kimi K2 … K3. */
|
|
1452
1498
|
KimiK2 = 'KimiK2',
|
|
1453
1499
|
/** GLM-5.x exact; GLM-4.x near-exact. */
|
|
1454
|
-
Glm5 = 'Glm5'
|
|
1500
|
+
Glm5 = 'Glm5',
|
|
1501
|
+
/** `TypeSafe` Jev 1.13 judgment `state` (request frame excluded). */
|
|
1502
|
+
Jev = 'Jev'
|
|
1455
1503
|
}
|
|
1456
1504
|
|
|
1457
1505
|
/**
|
|
@@ -1479,7 +1527,7 @@ export declare function execReplace(argv: Array<string>): void
|
|
|
1479
1527
|
*/
|
|
1480
1528
|
export declare function executeShell(options: ShellExecuteOptions, onChunk?: ((error: Error | null, chunk: string) => void) | undefined | null): Promise<ShellRunResult>
|
|
1481
1529
|
|
|
1482
|
-
/** Locate `***
|
|
1530
|
+
/** Locate `*** Edit File: path` payloads the model emitted as plain text. */
|
|
1483
1531
|
export declare function extractInlineSloppyRegions(text: string): Array<InlineSloppyRegion>
|
|
1484
1532
|
|
|
1485
1533
|
/**
|
|
@@ -1597,7 +1645,7 @@ export interface GlobMatch {
|
|
|
1597
1645
|
export interface GlobOptions {
|
|
1598
1646
|
/** Glob pattern to match (e.g., "*.ts"). */
|
|
1599
1647
|
pattern: string
|
|
1600
|
-
/** Directory to search. */
|
|
1648
|
+
/** Directory to search: a host path or an absolute `scheme://` URL. */
|
|
1601
1649
|
path: string
|
|
1602
1650
|
/**
|
|
1603
1651
|
* Filter by file type: "file", "dir", or "symlink". Symlinks are
|
|
@@ -1625,6 +1673,11 @@ export interface GlobOptions {
|
|
|
1625
1673
|
signal?: unknown
|
|
1626
1674
|
/** Timeout in milliseconds for the operation. */
|
|
1627
1675
|
timeoutMs?: number
|
|
1676
|
+
/**
|
|
1677
|
+
* Filesystem the search root is resolved and walked through (native when
|
|
1678
|
+
* absent).
|
|
1679
|
+
*/
|
|
1680
|
+
filesystem?: ShellFilesystem
|
|
1628
1681
|
}
|
|
1629
1682
|
|
|
1630
1683
|
/** Result payload returned by a glob operation. */
|
|
@@ -1669,7 +1722,7 @@ export interface GrepMatch {
|
|
|
1669
1722
|
export interface GrepOptions {
|
|
1670
1723
|
/** Regex pattern to search for. */
|
|
1671
1724
|
pattern: string
|
|
1672
|
-
/** Directory or file to search. */
|
|
1725
|
+
/** Directory or file to search: a host path or an absolute `scheme://` URL. */
|
|
1673
1726
|
path: string
|
|
1674
1727
|
/** Glob filter for filenames (e.g., "*.ts"). */
|
|
1675
1728
|
glob?: string
|
|
@@ -1707,6 +1760,11 @@ export interface GrepOptions {
|
|
|
1707
1760
|
signal?: unknown
|
|
1708
1761
|
/** Timeout in milliseconds for the operation. */
|
|
1709
1762
|
timeoutMs?: number
|
|
1763
|
+
/**
|
|
1764
|
+
* Filesystem every path is stat'ed, walked, and read through (native when
|
|
1765
|
+
* absent).
|
|
1766
|
+
*/
|
|
1767
|
+
filesystem?: ShellFilesystem
|
|
1710
1768
|
}
|
|
1711
1769
|
|
|
1712
1770
|
/** Output mode for [`search`] and [`grep`] (string values match JS callers). */
|
|
@@ -2564,6 +2622,325 @@ export interface ShellExecuteOptions {
|
|
|
2564
2622
|
minimizer?: MinimizerOptions
|
|
2565
2623
|
/** Abort signal for cancelling the operation. */
|
|
2566
2624
|
signal?: unknown
|
|
2625
|
+
/** Filesystem backing the command (native when absent). */
|
|
2626
|
+
filesystem?: ShellFilesystem
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
/** Host filesystem injected into shell sessions. */
|
|
2630
|
+
export interface ShellFilesystem {
|
|
2631
|
+
/**
|
|
2632
|
+
* Services every routed operation; failures are returned as `error`
|
|
2633
|
+
* data rather than thrown.
|
|
2634
|
+
*/
|
|
2635
|
+
handler: (error: Error | null, request: ShellFsRequest) => Promise<ShellFsResponse>
|
|
2636
|
+
/**
|
|
2637
|
+
* When true, every path without a `scheme://` prefix — and everything
|
|
2638
|
+
* beneath it — is the ordinary host filesystem: operations there run
|
|
2639
|
+
* natively (including recursive traversal and removal) and `handler` is
|
|
2640
|
+
* never consulted, so it cannot intercept any host subtree. Only URL
|
|
2641
|
+
* paths reach `handler`. When false or absent, `handler` is a fully
|
|
2642
|
+
* injected filesystem and receives every path, host paths included.
|
|
2643
|
+
*/
|
|
2644
|
+
nativeLocalPaths?: boolean
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
/** Permissions probed by an `access` request. */
|
|
2648
|
+
export interface ShellFsAccess {
|
|
2649
|
+
read: boolean
|
|
2650
|
+
write: boolean
|
|
2651
|
+
execute: boolean
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
/** One directory entry. */
|
|
2655
|
+
export interface ShellFsDirEntry {
|
|
2656
|
+
name: string
|
|
2657
|
+
fileType: ShellFsFileType
|
|
2658
|
+
/** Entry metadata without following a final symlink, when already known. */
|
|
2659
|
+
metadata?: ShellFsMetadata
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
/** A failed operation, reported as data so its errno identity survives. */
|
|
2663
|
+
export interface ShellFsError {
|
|
2664
|
+
/** Errno name such as `ENOENT`, `EACCES`, `EROFS`, `ENOTSUP`. */
|
|
2665
|
+
code: string
|
|
2666
|
+
message?: string
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
/** File type on the filesystem wire. */
|
|
2670
|
+
export declare enum ShellFsFileType {
|
|
2671
|
+
/** Regular file. */
|
|
2672
|
+
File = 'file',
|
|
2673
|
+
/** Directory. */
|
|
2674
|
+
Dir = 'dir',
|
|
2675
|
+
/** Symbolic link. */
|
|
2676
|
+
Symlink = 'symlink',
|
|
2677
|
+
/** Named pipe. */
|
|
2678
|
+
Fifo = 'fifo',
|
|
2679
|
+
/** Unix domain socket. */
|
|
2680
|
+
Socket = 'socket',
|
|
2681
|
+
/** Character device. */
|
|
2682
|
+
Char = 'char',
|
|
2683
|
+
/** Block device. */
|
|
2684
|
+
Block = 'block'
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
/**
|
|
2688
|
+
* File metadata. Absent optional fields mean the provider has no such value;
|
|
2689
|
+
* they are never fabricated.
|
|
2690
|
+
*/
|
|
2691
|
+
export interface ShellFsMetadata {
|
|
2692
|
+
fileType: ShellFsFileType
|
|
2693
|
+
size: number | bigint
|
|
2694
|
+
/** Permission bits (`0o7777`). */
|
|
2695
|
+
mode: number
|
|
2696
|
+
/** Modification time, nanoseconds since the Unix epoch. */
|
|
2697
|
+
mtimeNs?: number | bigint
|
|
2698
|
+
/** Access time, nanoseconds since the Unix epoch. */
|
|
2699
|
+
atimeNs?: number | bigint
|
|
2700
|
+
/** Status change time, nanoseconds since the Unix epoch. */
|
|
2701
|
+
ctimeNs?: number | bigint
|
|
2702
|
+
/** Creation time, nanoseconds since the Unix epoch. */
|
|
2703
|
+
birthtimeNs?: number | bigint
|
|
2704
|
+
/** Device id; given together with `ino`. */
|
|
2705
|
+
dev?: number | bigint
|
|
2706
|
+
/** Inode number; given together with `dev`. */
|
|
2707
|
+
ino?: number | bigint
|
|
2708
|
+
nlink?: number | bigint
|
|
2709
|
+
rdev?: number | bigint
|
|
2710
|
+
/** Allocated 512-byte blocks; given together with `blksize`. */
|
|
2711
|
+
blocks?: number | bigint
|
|
2712
|
+
/** Preferred I/O block size; given together with `blocks`. */
|
|
2713
|
+
blksize?: number | bigint
|
|
2714
|
+
/** Owner user id; given together with `gid`. */
|
|
2715
|
+
uid?: number
|
|
2716
|
+
/** Owner group id; given together with `uid`. */
|
|
2717
|
+
gid?: number
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
/** Which path components `canonicalize` requires to exist. */
|
|
2721
|
+
export declare enum ShellFsMissing {
|
|
2722
|
+
/** Every component must exist (`realpath`). */
|
|
2723
|
+
Existing = 'existing',
|
|
2724
|
+
/** Every component but the last must exist. */
|
|
2725
|
+
Normal = 'normal',
|
|
2726
|
+
/** No component needs to exist. */
|
|
2727
|
+
Missing = 'missing'
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
/** Filesystem operation requested from a host [`ShellFilesystem`]. */
|
|
2731
|
+
export declare enum ShellFsOp {
|
|
2732
|
+
/** Metadata of `path`, following symlinks. Answer: `metadata`. */
|
|
2733
|
+
Metadata = 'metadata',
|
|
2734
|
+
/**
|
|
2735
|
+
* Metadata of `path` itself, not following a final symlink. Answer:
|
|
2736
|
+
* `metadata`.
|
|
2737
|
+
*/
|
|
2738
|
+
SymlinkMetadata = 'symlinkMetadata',
|
|
2739
|
+
/** Entries of directory `path`. Answer: `entries`. */
|
|
2740
|
+
ReadDir = 'readDir',
|
|
2741
|
+
/** Canonical spelling of `path` per `missing`/`resolve`. Answer: `path`. */
|
|
2742
|
+
Canonicalize = 'canonicalize',
|
|
2743
|
+
/**
|
|
2744
|
+
* Host file or directory backing `path`, for user-facing commands that
|
|
2745
|
+
* print real locations (`realpath`, `readlink -f`). Answer: `path`, or
|
|
2746
|
+
* no `path` when nothing on the host backs it. Grants no access.
|
|
2747
|
+
*/
|
|
2748
|
+
BackingPath = 'backingPath',
|
|
2749
|
+
/** Contents of symlink `path`. Answer: `path`. */
|
|
2750
|
+
ReadLink = 'readLink',
|
|
2751
|
+
/** Check `access` permissions on `path` (all false: existence). */
|
|
2752
|
+
Access = 'access',
|
|
2753
|
+
/** Open `path` with `open` flags. Answer: `handle`. */
|
|
2754
|
+
Open = 'open',
|
|
2755
|
+
/**
|
|
2756
|
+
* Read up to `length` bytes of `handle` at `offset`. Answer: `data`
|
|
2757
|
+
* (empty at end of file).
|
|
2758
|
+
*/
|
|
2759
|
+
Read = 'read',
|
|
2760
|
+
/**
|
|
2761
|
+
* Write `data` to `handle` at `offset`, or at the end when `offset` is
|
|
2762
|
+
* absent (append handles). Answer: `written`, plus `offset` (end
|
|
2763
|
+
* position after the write) for appends.
|
|
2764
|
+
*/
|
|
2765
|
+
Write = 'write',
|
|
2766
|
+
/** Flush buffered writes of `handle`. */
|
|
2767
|
+
Flush = 'flush',
|
|
2768
|
+
/** Release `handle`. Sent exactly once per opened handle. */
|
|
2769
|
+
Close = 'close',
|
|
2770
|
+
/** Metadata of the file behind `handle`. Answer: `metadata`. */
|
|
2771
|
+
FileMetadata = 'fileMetadata',
|
|
2772
|
+
/**
|
|
2773
|
+
* Query whether `handle` has a conflicting advisory write lock. Answer:
|
|
2774
|
+
* `locked`.
|
|
2775
|
+
*/
|
|
2776
|
+
IsLocked = 'isLocked',
|
|
2777
|
+
/** Truncate or extend `handle` to `size` bytes. */
|
|
2778
|
+
SetLen = 'setLen',
|
|
2779
|
+
/** Set times of `handle` (`atimeNs`/`mtimeNs`; absent = unchanged). */
|
|
2780
|
+
FileSetTimes = 'fileSetTimes',
|
|
2781
|
+
/** Set permission bits `mode` of `handle`. */
|
|
2782
|
+
FileSetPermissions = 'fileSetPermissions',
|
|
2783
|
+
/** Persist `handle` (`dataOnly`: data without metadata). */
|
|
2784
|
+
Sync = 'sync',
|
|
2785
|
+
/** Create directory `path` (`recursive`, optional `mode`). */
|
|
2786
|
+
CreateDir = 'createDir',
|
|
2787
|
+
/** Remove non-directory `path`. */
|
|
2788
|
+
RemoveFile = 'removeFile',
|
|
2789
|
+
/** Remove empty directory `path`. */
|
|
2790
|
+
RemoveDir = 'removeDir',
|
|
2791
|
+
/** Remove directory `path` and everything below it. */
|
|
2792
|
+
RemoveDirAll = 'removeDirAll',
|
|
2793
|
+
/** Rename `path` to `target`. */
|
|
2794
|
+
Rename = 'rename',
|
|
2795
|
+
/** Create hard link `target` to existing `path`. */
|
|
2796
|
+
HardLink = 'hardLink',
|
|
2797
|
+
/** Create symlink `path` whose contents are `target` (verbatim). */
|
|
2798
|
+
Symlink = 'symlink',
|
|
2799
|
+
/** Set permission bits `mode` of `path` (following symlinks). */
|
|
2800
|
+
SetPermissions = 'setPermissions',
|
|
2801
|
+
/**
|
|
2802
|
+
* Set times of `path` (`atimeNs`/`mtimeNs`; absent = unchanged;
|
|
2803
|
+
* `follow`).
|
|
2804
|
+
*/
|
|
2805
|
+
SetTimes = 'setTimes',
|
|
2806
|
+
/** Change owner `uid`/`gid` of `path` (absent = unchanged; `follow`). */
|
|
2807
|
+
Chown = 'chown',
|
|
2808
|
+
/** Statistics of the filesystem holding `path`. Answer: `statFs`. */
|
|
2809
|
+
StatFs = 'statFs',
|
|
2810
|
+
/**
|
|
2811
|
+
* Extended attribute `name` of `path`. Answer: `data`, or no `data`
|
|
2812
|
+
* when the attribute is absent.
|
|
2813
|
+
*/
|
|
2814
|
+
GetXattr = 'getXattr',
|
|
2815
|
+
/** Set extended attribute `name` of `path` to `data`. */
|
|
2816
|
+
SetXattr = 'setXattr',
|
|
2817
|
+
/** Extended attribute names of `path`. Answer: `names`. */
|
|
2818
|
+
ListXattr = 'listXattr',
|
|
2819
|
+
/** Remove extended attribute `name` of `path`. */
|
|
2820
|
+
RemoveXattr = 'removeXattr',
|
|
2821
|
+
/**
|
|
2822
|
+
* Create node `path` of `fileType` with `mode` (and `device` for
|
|
2823
|
+
* character/block devices).
|
|
2824
|
+
*/
|
|
2825
|
+
Mknod = 'mknod'
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
/** Open flags for an `open` request (std `OpenOptions` semantics). */
|
|
2829
|
+
export interface ShellFsOpenFlags {
|
|
2830
|
+
read: boolean
|
|
2831
|
+
write: boolean
|
|
2832
|
+
append: boolean
|
|
2833
|
+
truncate: boolean
|
|
2834
|
+
create: boolean
|
|
2835
|
+
createNew: boolean
|
|
2836
|
+
/** Permission bits for a newly created file. */
|
|
2837
|
+
mode?: number
|
|
2838
|
+
/** Platform open flags beyond the portable set (`O_*`); absent when none. */
|
|
2839
|
+
customFlags?: number
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
/** One filesystem request. Only the fields documented for `op` are set. */
|
|
2843
|
+
export interface ShellFsRequest {
|
|
2844
|
+
op: ShellFsOp
|
|
2845
|
+
/** Subject path, verbatim (URL spellings keep their authority). */
|
|
2846
|
+
path?: string
|
|
2847
|
+
/** Second path: rename/hard-link destination or symlink contents. */
|
|
2848
|
+
target?: string
|
|
2849
|
+
/** Provider handle id from a previous `open`. */
|
|
2850
|
+
handle?: number
|
|
2851
|
+
/** Byte offset for positional handle I/O. */
|
|
2852
|
+
offset?: bigint
|
|
2853
|
+
/** Maximum bytes to read. */
|
|
2854
|
+
length?: number
|
|
2855
|
+
/** New length for `setLen`. */
|
|
2856
|
+
size?: bigint
|
|
2857
|
+
/** Bytes to write (`write`) or attribute value (`setXattr`). */
|
|
2858
|
+
data?: Buffer
|
|
2859
|
+
open?: ShellFsOpenFlags
|
|
2860
|
+
access?: ShellFsAccess
|
|
2861
|
+
recursive?: boolean
|
|
2862
|
+
/** Permission bits (`0o7777`). */
|
|
2863
|
+
mode?: number
|
|
2864
|
+
/** Whether a final symlink is followed. */
|
|
2865
|
+
follow?: boolean
|
|
2866
|
+
/** Access time in nanoseconds since the Unix epoch. */
|
|
2867
|
+
atimeNs?: bigint
|
|
2868
|
+
/** Modification time in nanoseconds since the Unix epoch. */
|
|
2869
|
+
mtimeNs?: bigint
|
|
2870
|
+
uid?: number
|
|
2871
|
+
gid?: number
|
|
2872
|
+
/** `sync` persists data only, not metadata. */
|
|
2873
|
+
dataOnly?: boolean
|
|
2874
|
+
/** Extended attribute name. */
|
|
2875
|
+
name?: string
|
|
2876
|
+
/** Node type for `mknod`. */
|
|
2877
|
+
fileType?: ShellFsFileType
|
|
2878
|
+
/** Device number for character/block `mknod`. */
|
|
2879
|
+
device?: bigint
|
|
2880
|
+
missing?: ShellFsMissing
|
|
2881
|
+
resolve?: ShellFsResolve
|
|
2882
|
+
/**
|
|
2883
|
+
* Removal of temporary files the shell itself created, issued even after
|
|
2884
|
+
* the run was aborted. Serve it under the same policy, but without the
|
|
2885
|
+
* run's abort signal. Not a retry of a cancelled request.
|
|
2886
|
+
*/
|
|
2887
|
+
cleanup?: boolean
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
/** How `canonicalize` treats symlinks. */
|
|
2891
|
+
export declare enum ShellFsResolve {
|
|
2892
|
+
/** Resolve symlinks as encountered. */
|
|
2893
|
+
Physical = 'physical',
|
|
2894
|
+
/** Apply `..` lexically before resolving symlinks. */
|
|
2895
|
+
Logical = 'logical',
|
|
2896
|
+
/** Never resolve symlinks; normalize lexically only. */
|
|
2897
|
+
None = 'none'
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2900
|
+
/**
|
|
2901
|
+
* Provider answer. Carries `error`, a native redirect (`local` /
|
|
2902
|
+
* `localTarget`), or the op's result fields.
|
|
2903
|
+
*/
|
|
2904
|
+
export interface ShellFsResponse {
|
|
2905
|
+
error?: ShellFsError
|
|
2906
|
+
/** Run this operation natively on this host path instead. */
|
|
2907
|
+
local?: string
|
|
2908
|
+
/** Native host path replacing `target` (rename/hard-link destination). */
|
|
2909
|
+
localTarget?: string
|
|
2910
|
+
handle?: number
|
|
2911
|
+
/**
|
|
2912
|
+
* With an `open` redirect: the host file backs an immutable mount, so
|
|
2913
|
+
* the opened file refuses every mutation (EROFS), duplicates included.
|
|
2914
|
+
*/
|
|
2915
|
+
readonly?: boolean
|
|
2916
|
+
data?: Uint8Array
|
|
2917
|
+
written?: number
|
|
2918
|
+
/** Result of an `isLocked` advisory-lock query. */
|
|
2919
|
+
locked?: boolean
|
|
2920
|
+
/** Handle position after an append write. */
|
|
2921
|
+
offset?: number | bigint
|
|
2922
|
+
path?: string
|
|
2923
|
+
metadata?: ShellFsMetadata
|
|
2924
|
+
entries?: Array<ShellFsDirEntry>
|
|
2925
|
+
names?: Array<string>
|
|
2926
|
+
statFs?: ShellFsStatFs
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
/** Filesystem statistics. */
|
|
2930
|
+
export interface ShellFsStatFs {
|
|
2931
|
+
blockSize: number | bigint
|
|
2932
|
+
/** Optimal transfer size; defaults to `blockSize`. */
|
|
2933
|
+
ioSize?: number | bigint
|
|
2934
|
+
blocks: number | bigint
|
|
2935
|
+
blocksFree: number | bigint
|
|
2936
|
+
blocksAvailable: number | bigint
|
|
2937
|
+
files: number | bigint
|
|
2938
|
+
filesFree: number | bigint
|
|
2939
|
+
/** Filesystem type magic number. */
|
|
2940
|
+
fsType?: number | bigint
|
|
2941
|
+
fsTypeName?: string
|
|
2942
|
+
fsid?: number | bigint
|
|
2943
|
+
nameMax?: number | bigint
|
|
2567
2944
|
}
|
|
2568
2945
|
|
|
2569
2946
|
/** Options for configuring a persistent shell session. */
|
|
@@ -2574,6 +2951,8 @@ export interface ShellOptions {
|
|
|
2574
2951
|
snapshotPath?: string
|
|
2575
2952
|
/** Optional per-command output minimizer configuration. */
|
|
2576
2953
|
minimizer?: MinimizerOptions
|
|
2954
|
+
/** Filesystem backing every run of this session (native when absent). */
|
|
2955
|
+
filesystem?: ShellFilesystem
|
|
2577
2956
|
}
|
|
2578
2957
|
|
|
2579
2958
|
/** Options for running a shell command. */
|
|
@@ -2588,6 +2967,11 @@ export interface ShellRunOptions {
|
|
|
2588
2967
|
timeoutMs?: number
|
|
2589
2968
|
/** Abort signal for cancelling the operation. */
|
|
2590
2969
|
signal?: unknown
|
|
2970
|
+
/**
|
|
2971
|
+
* Filesystem for this run only, replacing the session's; the session's
|
|
2972
|
+
* filesystem applies again to later runs.
|
|
2973
|
+
*/
|
|
2974
|
+
filesystem?: ShellFilesystem
|
|
2591
2975
|
}
|
|
2592
2976
|
|
|
2593
2977
|
/** Result of running a shell command. */
|
package/native/index.js
CHANGED
|
@@ -45,7 +45,10 @@ export const VcsRepo = nativeBindings.VcsRepo;
|
|
|
45
45
|
|
|
46
46
|
// functions
|
|
47
47
|
export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime ?? missingNativeExport("__ompInstallTokioRuntime");
|
|
48
|
-
export const
|
|
48
|
+
export const __piNativesV18_3_1 = nativeBindings.__piNativesV18_3_1;
|
|
49
|
+
export const appleFmAvailability = nativeBindings.appleFmAvailability ?? missingNativeExport("appleFmAvailability");
|
|
50
|
+
export const appleFmCancel = nativeBindings.appleFmCancel ?? missingNativeExport("appleFmCancel");
|
|
51
|
+
export const appleFmGenerate = nativeBindings.appleFmGenerate ?? missingNativeExport("appleFmGenerate");
|
|
49
52
|
export const astEdit = nativeBindings.astEdit ?? missingNativeExport("astEdit");
|
|
50
53
|
export const astGrep = nativeBindings.astGrep ?? missingNativeExport("astGrep");
|
|
51
54
|
export const astMatch = nativeBindings.astMatch ?? missingNativeExport("astMatch");
|
|
@@ -163,6 +166,7 @@ export const Encoding = {
|
|
|
163
166
|
DeepSeekV3: "DeepSeekV3",
|
|
164
167
|
KimiK2: "KimiK2",
|
|
165
168
|
Glm5: "Glm5",
|
|
169
|
+
Jev: "Jev",
|
|
166
170
|
};
|
|
167
171
|
export const FileType = {
|
|
168
172
|
File: 1,
|
|
@@ -202,4 +206,59 @@ export const ProcessStatus = {
|
|
|
202
206
|
Running: "running",
|
|
203
207
|
Exited: "exited",
|
|
204
208
|
};
|
|
209
|
+
export const ShellFsFileType = {
|
|
210
|
+
File: "file",
|
|
211
|
+
Dir: "dir",
|
|
212
|
+
Symlink: "symlink",
|
|
213
|
+
Fifo: "fifo",
|
|
214
|
+
Socket: "socket",
|
|
215
|
+
Char: "char",
|
|
216
|
+
Block: "block",
|
|
217
|
+
};
|
|
218
|
+
export const ShellFsMissing = {
|
|
219
|
+
Existing: "existing",
|
|
220
|
+
Normal: "normal",
|
|
221
|
+
Missing: "missing",
|
|
222
|
+
};
|
|
223
|
+
export const ShellFsOp = {
|
|
224
|
+
Metadata: "metadata",
|
|
225
|
+
SymlinkMetadata: "symlinkMetadata",
|
|
226
|
+
ReadDir: "readDir",
|
|
227
|
+
Canonicalize: "canonicalize",
|
|
228
|
+
BackingPath: "backingPath",
|
|
229
|
+
ReadLink: "readLink",
|
|
230
|
+
Access: "access",
|
|
231
|
+
Open: "open",
|
|
232
|
+
Read: "read",
|
|
233
|
+
Write: "write",
|
|
234
|
+
Flush: "flush",
|
|
235
|
+
Close: "close",
|
|
236
|
+
FileMetadata: "fileMetadata",
|
|
237
|
+
IsLocked: "isLocked",
|
|
238
|
+
SetLen: "setLen",
|
|
239
|
+
FileSetTimes: "fileSetTimes",
|
|
240
|
+
FileSetPermissions: "fileSetPermissions",
|
|
241
|
+
Sync: "sync",
|
|
242
|
+
CreateDir: "createDir",
|
|
243
|
+
RemoveFile: "removeFile",
|
|
244
|
+
RemoveDir: "removeDir",
|
|
245
|
+
RemoveDirAll: "removeDirAll",
|
|
246
|
+
Rename: "rename",
|
|
247
|
+
HardLink: "hardLink",
|
|
248
|
+
Symlink: "symlink",
|
|
249
|
+
SetPermissions: "setPermissions",
|
|
250
|
+
SetTimes: "setTimes",
|
|
251
|
+
Chown: "chown",
|
|
252
|
+
StatFs: "statFs",
|
|
253
|
+
GetXattr: "getXattr",
|
|
254
|
+
SetXattr: "setXattr",
|
|
255
|
+
ListXattr: "listXattr",
|
|
256
|
+
RemoveXattr: "removeXattr",
|
|
257
|
+
Mknod: "mknod",
|
|
258
|
+
};
|
|
259
|
+
export const ShellFsResolve = {
|
|
260
|
+
Physical: "physical",
|
|
261
|
+
Logical: "logical",
|
|
262
|
+
None: "none",
|
|
263
|
+
};
|
|
205
264
|
// --- end generated native exports ---
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.3.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",
|
|
7
|
-
"author":
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Stencil Labs, Inc.",
|
|
9
|
+
"url": "https://stencil.so"
|
|
10
|
+
},
|
|
8
11
|
"license": "MIT",
|
|
9
12
|
"repository": {
|
|
10
13
|
"type": "git",
|
|
@@ -104,11 +107,11 @@
|
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
"optionalDependencies": {
|
|
107
|
-
"@oh-my-pi/pi-natives-linux-x64": "18.
|
|
108
|
-
"@oh-my-pi/pi-natives-linux-arm64": "18.
|
|
109
|
-
"@oh-my-pi/pi-natives-darwin-x64": "18.
|
|
110
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "18.
|
|
111
|
-
"@oh-my-pi/pi-natives-win32-x64": "18.
|
|
112
|
-
"@oh-my-pi/pi-natives-win32-arm64": "18.
|
|
110
|
+
"@oh-my-pi/pi-natives-linux-x64": "18.3.1",
|
|
111
|
+
"@oh-my-pi/pi-natives-linux-arm64": "18.3.1",
|
|
112
|
+
"@oh-my-pi/pi-natives-darwin-x64": "18.3.1",
|
|
113
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "18.3.1",
|
|
114
|
+
"@oh-my-pi/pi-natives-win32-x64": "18.3.1",
|
|
115
|
+
"@oh-my-pi/pi-natives-win32-arm64": "18.3.1"
|
|
113
116
|
}
|
|
114
117
|
}
|