@gajae-code/natives 0.11.4 → 0.11.6

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
@@ -300,6 +300,15 @@ export declare class Process {
300
300
  get ppid(): number | null
301
301
  /** Launch arguments for this process. */
302
302
  args(): Array<string>
303
+ /**
304
+ * Send `signal` only to this pinned process reference.
305
+ *
306
+ * On Linux this uses the owned pidfd; on Windows it uses the owned process
307
+ * handle. It deliberately never discovers descendants or signals a process
308
+ * group. Returns `false` when the pinned process has already exited or the
309
+ * operating system rejects delivery.
310
+ */
311
+ signalRoot(signal: number): boolean
303
312
  /**
304
313
  * Send `signal` to this process and its descendants, children first.
305
314
  *
@@ -343,6 +352,82 @@ export declare class PtySession {
343
352
  kill(): void
344
353
  }
345
354
 
355
+ /** Retained trusted-root authority for Linux recovery artifacts. */
356
+ export declare class RecoveryFsRoot {
357
+ /** Return the stable identity of the retained root descriptor. */
358
+ identity(): RecoveryFsResult
359
+ /**
360
+ * Derive a retained child-directory capability from this root and exact
361
+ * identity evidence.
362
+ */
363
+ retainManagedDirectory(relativePath: string, expectedDev: string, expectedIno: string): RecoveryFsRoot
364
+ /** Stat one existing regular, single-linked file without following links. */
365
+ stat(relativePath: string): RecoveryFsResult
366
+ /** Read one existing regular, single-linked file without following links. */
367
+ read(relativePath: string, maxBytes: number): RecoveryFsResult
368
+ /** Read one managed artifact with the managed-storage size bound. */
369
+ readManaged(relativePath: string): RecoveryFsResult
370
+ /**
371
+ * Create one previously absent regular, owner-only file and synchronously
372
+ * persist its contents. Existing entries are never replaced.
373
+ */
374
+ create(relativePath: string, data: Uint8Array): RecoveryFsResult
375
+ /** Create one managed artifact with the managed-storage size bound. */
376
+ createManaged(relativePath: string, data: Uint8Array): RecoveryFsResult
377
+ /**
378
+ * Atomically replace one exact regular file with a newly written managed
379
+ * artifact. The destination must retain the supplied identity throughout
380
+ * authorization.
381
+ */
382
+ replaceManaged(relativePath: string, data: Uint8Array, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
383
+ /**
384
+ * Synchronously append one record to an exact retained managed file without
385
+ * replacing its inode or creating recovery copies.
386
+ */
387
+ appendManaged(relativePath: string, data: Uint8Array, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
388
+ /** Remove one exact managed regular file through retained authority. */
389
+ removeManaged(relativePath: string, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
390
+ /**
391
+ * Create each absent directory component beneath the retained root with
392
+ * owner-only security. Existing components are re-opened no-follow.
393
+ */
394
+ ensureManagedDirectory(relativePath: string): RecoveryFsResult
395
+ /**
396
+ * Move an exact managed file to an absent name entirely beneath this
397
+ * retained root. The source identity is rechecked after the no-replace
398
+ * rename, and the move is rolled back on a mismatch.
399
+ */
400
+ renameManagedFileNoReplace(sourceRelativePath: string, destinationRelativePath: string, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
401
+ /** Snapshot a managed directory tree entirely through the retained root. */
402
+ snapshotManagedTree(relativePath: string): NativeDirectoryTreeResult
403
+ /**
404
+ * Move an exact managed directory tree to an absent name through retained
405
+ * authority.
406
+ */
407
+ renameManagedTreeNoReplace(sourceRelativePath: string, destinationRelativePath: string, expected: NativeDirectoryTreeSnapshot): RecoveryFsResult
408
+ /** Remove an exact managed directory tree through retained authority. */
409
+ removeManagedTree(relativePath: string, expected: NativeDirectoryTreeSnapshot): RecoveryFsResult
410
+ /**
411
+ * Atomically install an already-created regular file at an absent name.
412
+ * Both names remain relative to this retained root and are never resolved
413
+ * through a pathname after their parent descriptors are acquired.
414
+ */
415
+ install(sourceRelativePath: string, destinationRelativePath: string): RecoveryFsResult
416
+ /**
417
+ * Synchronize the retained root directory, making a preceding create or
418
+ * install durable when the filesystem supports directory fsync.
419
+ */
420
+ fsync(): RecoveryFsResult
421
+ /**
422
+ * Fsync one expected object relative to the retained root and prove
423
+ * identity.
424
+ */
425
+ fsyncExpected(relativePath: string, directory: boolean, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedSha256?: string | undefined | null): RecoveryFsResult
426
+ /** Verify owner-only directory security on the retained root descriptor. */
427
+ verifyOwnerOnlyDirectory(): RecoveryFsResult
428
+ close(): RecoveryFsResult
429
+ }
430
+
346
431
  /** Persistent brush-core shell session. */
347
432
  export declare class Shell {
348
433
  /**
@@ -385,7 +470,7 @@ export declare class Shell {
385
470
  * `packages/natives/native/index.js` (which derives the name from
386
471
  * `package.json#version`).
387
472
  */
388
- export declare function __piNativesV0_11_4(): void
473
+ export declare function __piNativesV0_11_6(): void
389
474
 
390
475
  /**
391
476
  * Apply conservative pre-execution rewrites to a bash command.
@@ -396,6 +481,13 @@ export declare function __piNativesV0_11_4(): void
396
481
  */
397
482
  export declare function applyBashFixups(command: string): BashFixupResult
398
483
 
484
+ /**
485
+ * Apply owner-only security to the exact caller descriptor and its retained
486
+ * no-follow path. The descriptor is duplicated with close-on-exec and is never
487
+ * returned to JavaScript.
488
+ */
489
+ export declare function applyOwnerOnlyFdSecurity(path: string, kind: "directory" | "file", callerFd: number): NativeOwnerOnlySecurityResult
490
+
399
491
  export declare function applyOwnerOnlyPathSecurity(path: string, kind: "directory" | "file"): NativeOwnerOnlySecurityResult
400
492
 
401
493
  /** Typed terminal acknowledgement result returned by acknowledgement promises. */
@@ -1512,6 +1604,18 @@ export interface MinimizerResult {
1512
1604
  outputBytes: number
1513
1605
  }
1514
1606
 
1607
+ /** Evidence for one Linux POSIX ACL attribute. */
1608
+ export interface NativeAclAttributeEvidence {
1609
+ clear: string
1610
+ query: string
1611
+ }
1612
+
1613
+ /** Bounded Linux POSIX ACL evidence for an owner-only result. */
1614
+ export interface NativeAclEvidence {
1615
+ access: NativeAclAttributeEvidence
1616
+ default?: NativeAclAttributeEvidence
1617
+ }
1618
+
1515
1619
  /** Classification of a read-only retained-publication observation. */
1516
1620
  export interface NativeBrokerPublicationObservation {
1517
1621
  kind: string
@@ -1545,6 +1649,7 @@ export interface NativeDirectoryTreeEntry {
1545
1649
  ino: string
1546
1650
  size: string
1547
1651
  mtimeNs: string
1652
+ ctimeNs: string
1548
1653
  sha256?: string
1549
1654
  }
1550
1655
 
@@ -1601,11 +1706,87 @@ export interface NativeExactUnlinkResult {
1601
1706
  ok: boolean
1602
1707
  code?: string
1603
1708
  detachedPath?: string
1709
+ retainedSuccessorPath?: string
1710
+ /**
1711
+ * An internal exchange-placeholder cleanup entry retained after cleanup
1712
+ * could not complete. This is never a canonical publisher successor and
1713
+ * remains recoverable only at this path.
1714
+ */
1715
+ retainedPlaceholderPath?: string
1716
+ /**
1717
+ * A retained cleanup entry whose identity could not be verified. This is
1718
+ * neither a stale detached object nor a publisher successor.
1719
+ */
1720
+ retainedUnknownPath?: string
1604
1721
  }
1605
1722
 
1606
1723
  /** Result of applying or checking owner-only path security. */
1607
1724
  export type NativeOwnerOnlySecurityResult =
1608
- | { ok: true; code?: never }
1725
+ | {
1726
+ ok: true;
1727
+ platform: "linux";
1728
+ kind: "file";
1729
+ protocol: "apply" | "verify";
1730
+ aclEvidence: {
1731
+ access: {
1732
+ clear: "cleared" | "already_absent" | "unsupported" | "not_run";
1733
+ query: "absent" | "unsupported";
1734
+ };
1735
+ default?: never;
1736
+ };
1737
+ code?: never;
1738
+ operation?: never;
1739
+ attribute?: never;
1740
+ }
1741
+ | {
1742
+ ok: true;
1743
+ platform: "linux";
1744
+ kind: "directory";
1745
+ protocol: "apply" | "verify";
1746
+ aclEvidence: {
1747
+ access: {
1748
+ clear: "cleared" | "already_absent" | "unsupported" | "not_run";
1749
+ query: "absent" | "unsupported";
1750
+ };
1751
+ default: {
1752
+ clear: "cleared" | "already_absent" | "unsupported" | "not_run";
1753
+ query: "absent" | "unsupported";
1754
+ };
1755
+ };
1756
+ code?: never;
1757
+ operation?: never;
1758
+ attribute?: never;
1759
+ }
1760
+ | {
1761
+ ok: true;
1762
+ platform?: never;
1763
+ kind?: never;
1764
+ protocol?: never;
1765
+ aclEvidence?: never;
1766
+ code?: never;
1767
+ operation?: never;
1768
+ attribute?: never;
1769
+ }
1770
+ | {
1771
+ ok: false;
1772
+ code: "acl_denied" | "acl_io_error" | "acl_present" | "acl_malformed" | "acl_unknown";
1773
+ operation: "clear" | "query";
1774
+ attribute: "access" | "default";
1775
+ platform?: never;
1776
+ kind?: never;
1777
+ protocol?: never;
1778
+ aclEvidence?: never;
1779
+ }
1780
+ | {
1781
+ ok: false;
1782
+ code: "acl_unavailable" | "acl_apply_failed" | "acl_verify_failed";
1783
+ operation?: never;
1784
+ attribute?: never;
1785
+ platform?: never;
1786
+ kind?: never;
1787
+ protocol?: never;
1788
+ aclEvidence?: never;
1789
+ }
1609
1790
  | {
1610
1791
  ok: false;
1611
1792
  code:
@@ -1613,12 +1794,17 @@ export type NativeOwnerOnlySecurityResult =
1613
1794
  | "not_directory"
1614
1795
  | "network_unsupported"
1615
1796
  | "reparse_point"
1616
- | "acl_unavailable"
1617
- | "acl_apply_failed"
1618
- | "acl_verify_failed"
1619
1797
  | "identity_unavailable"
1798
+ | "identity_mismatch"
1620
1799
  | "owner_mismatch"
1800
+ | "mode_mismatch"
1621
1801
  | "io_error";
1802
+ operation?: never;
1803
+ attribute?: never;
1804
+ platform?: never;
1805
+ kind?: never;
1806
+ protocol?: never;
1807
+ aclEvidence?: never;
1622
1808
  }
1623
1809
 
1624
1810
  /** Bound endpoint info returned from [`NotificationServer::start`]. */
@@ -1633,6 +1819,12 @@ export interface NotificationEndpoint {
1633
1819
  sessionId: string
1634
1820
  }
1635
1821
 
1822
+ /**
1823
+ * Acquire an immutable trusted-root descriptor. Linux is required; every
1824
+ * other platform returns a durable unsupported-platform result.
1825
+ */
1826
+ export declare function openRecoveryFsRoot(path: string): RecoveryFsRoot
1827
+
1636
1828
  /** Parsed Kitty keyboard protocol sequence result for a Kitty input sequence. */
1637
1829
  export interface ParsedKittyResult {
1638
1830
  /** Primary codepoint associated with the key. */
@@ -1749,6 +1941,22 @@ export declare function ptyTimeoutCount(): bigint
1749
1941
  */
1750
1942
  export declare function readImageFromClipboard(): Promise<ClipboardImage | undefined | null>
1751
1943
 
1944
+ export interface RecoveryFsIdentity {
1945
+ dev: string
1946
+ ino: string
1947
+ size: string
1948
+ mtimeNs: string
1949
+ ctimeNs: string
1950
+ sha256?: string
1951
+ }
1952
+
1953
+ export interface RecoveryFsResult {
1954
+ ok: boolean
1955
+ code?: string
1956
+ identity?: RecoveryFsIdentity
1957
+ data?: Uint8Array
1958
+ }
1959
+
1752
1960
  export declare function renameNoReplacePath(sourcePath: string, destinationPath: string): NativeExactUnlinkResult
1753
1961
 
1754
1962
  /** A client reply forwarded to the TypeScript host for gate resolution. */
@@ -1970,6 +2178,13 @@ export declare function truncateLinesToWidth(lines: Array<string>, maxWidth: num
1970
2178
 
1971
2179
  export declare function truncateToWidth(text: string, maxWidth: number, ellipsisKind: Ellipsis | undefined | null, pad: boolean | undefined | null, tabWidth: number): string
1972
2180
 
2181
+ /**
2182
+ * Verify owner-only security for the exact caller descriptor and retained
2183
+ * no-follow path. The descriptor is duplicated with close-on-exec and is never
2184
+ * returned to JavaScript.
2185
+ */
2186
+ export declare function verifyOwnerOnlyFdSecurity(path: string, kind: "directory" | "file", callerFd: number): NativeOwnerOnlySecurityResult
2187
+
1973
2188
  export declare function verifyOwnerOnlyPathSecurity(path: string, kind: "directory" | "file"): NativeOwnerOnlySecurityResult
1974
2189
 
1975
2190
  /**
package/native/index.js CHANGED
@@ -25,11 +25,13 @@ export const NotificationControlServer = nativeBindings.NotificationControlServe
25
25
  export const NotificationServer = nativeBindings.NotificationServer;
26
26
  export const Process = nativeBindings.Process;
27
27
  export const PtySession = nativeBindings.PtySession;
28
+ export const RecoveryFsRoot = nativeBindings.RecoveryFsRoot;
28
29
  export const Shell = nativeBindings.Shell;
29
30
 
30
31
  // functions
31
- export const __piNativesV0_11_4 = nativeBindings.__piNativesV0_11_4;
32
+ export const __piNativesV0_11_6 = nativeBindings.__piNativesV0_11_6;
32
33
  export const applyBashFixups = nativeBindings.applyBashFixups;
34
+ export const applyOwnerOnlyFdSecurity = nativeBindings.applyOwnerOnlyFdSecurity;
33
35
  export const applyOwnerOnlyPathSecurity = nativeBindings.applyOwnerOnlyPathSecurity;
34
36
  export const astEdit = nativeBindings.astEdit;
35
37
  export const astGrep = nativeBindings.astGrep;
@@ -69,6 +71,7 @@ export const matchesKey = nativeBindings.matchesKey;
69
71
  export const matchesKittySequence = nativeBindings.matchesKittySequence;
70
72
  export const matchesLegacySequence = nativeBindings.matchesLegacySequence;
71
73
  export const nativeBuildInfo = nativeBindings.nativeBuildInfo;
74
+ export const openRecoveryFsRoot = nativeBindings.openRecoveryFsRoot;
72
75
  export const parseKey = nativeBindings.parseKey;
73
76
  export const parseKittySequence = nativeBindings.parseKittySequence;
74
77
  export const ptyTimeoutCount = nativeBindings.ptyTimeoutCount;
@@ -82,6 +85,7 @@ export const summarizeCode = nativeBindings.summarizeCode;
82
85
  export const supportsLanguage = nativeBindings.supportsLanguage;
83
86
  export const truncateLinesToWidth = nativeBindings.truncateLinesToWidth;
84
87
  export const truncateToWidth = nativeBindings.truncateToWidth;
88
+ export const verifyOwnerOnlyFdSecurity = nativeBindings.verifyOwnerOnlyFdSecurity;
85
89
  export const verifyOwnerOnlyPathSecurity = nativeBindings.verifyOwnerOnlyPathSecurity;
86
90
  export const visibleWidth = nativeBindings.visibleWidth;
87
91
  export const visibleWidths = nativeBindings.visibleWidths;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gajae-code/natives",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "Native Rust bindings for grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
5
5
  "type": "module",
6
6
  "homepage": "https://gajae-code.com",
@@ -61,11 +61,11 @@
61
61
  "README.md"
62
62
  ],
63
63
  "optionalDependencies": {
64
- "@gajae-code/natives-darwin-arm64": "0.11.4",
65
- "@gajae-code/natives-darwin-x64": "0.11.4",
66
- "@gajae-code/natives-linux-arm64": "0.11.4",
67
- "@gajae-code/natives-linux-x64": "0.11.4",
68
- "@gajae-code/natives-win32-x64": "0.11.4"
64
+ "@gajae-code/natives-darwin-arm64": "0.11.6",
65
+ "@gajae-code/natives-darwin-x64": "0.11.6",
66
+ "@gajae-code/natives-linux-arm64": "0.11.6",
67
+ "@gajae-code/natives-linux-x64": "0.11.6",
68
+ "@gajae-code/natives-win32-x64": "0.11.6"
69
69
  },
70
70
  "exports": {
71
71
  ".": {