@gajae-code/natives 0.11.4 → 0.11.5

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
@@ -1,5 +1,12 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ /**
4
+ * macOS computer-use controller.
5
+ *
6
+ * This declaration and the named JS export are available on every platform so
7
+ * consumers can import them portably; the native controller itself is built
8
+ * only on macOS.
9
+ */
3
10
  export declare class ComputerController {
4
11
  constructor()
5
12
  screenshot(): ComputerScreenshot
@@ -300,6 +307,15 @@ export declare class Process {
300
307
  get ppid(): number | null
301
308
  /** Launch arguments for this process. */
302
309
  args(): Array<string>
310
+ /**
311
+ * Send `signal` only to this pinned process reference.
312
+ *
313
+ * On Linux this uses the owned pidfd; on Windows it uses the owned process
314
+ * handle. It deliberately never discovers descendants or signals a process
315
+ * group. Returns `false` when the pinned process has already exited or the
316
+ * operating system rejects delivery.
317
+ */
318
+ signalRoot(signal: number): boolean
303
319
  /**
304
320
  * Send `signal` to this process and its descendants, children first.
305
321
  *
@@ -343,6 +359,82 @@ export declare class PtySession {
343
359
  kill(): void
344
360
  }
345
361
 
362
+ /** Retained trusted-root authority for Linux recovery artifacts. */
363
+ export declare class RecoveryFsRoot {
364
+ /** Return the stable identity of the retained root descriptor. */
365
+ identity(): RecoveryFsResult
366
+ /**
367
+ * Derive a retained child-directory capability from this root and exact
368
+ * identity evidence.
369
+ */
370
+ retainManagedDirectory(relativePath: string, expectedDev: string, expectedIno: string): RecoveryFsRoot
371
+ /** Stat one existing regular, single-linked file without following links. */
372
+ stat(relativePath: string): RecoveryFsResult
373
+ /** Read one existing regular, single-linked file without following links. */
374
+ read(relativePath: string, maxBytes: number): RecoveryFsResult
375
+ /** Read one managed artifact with the managed-storage size bound. */
376
+ readManaged(relativePath: string): RecoveryFsResult
377
+ /**
378
+ * Create one previously absent regular, owner-only file and synchronously
379
+ * persist its contents. Existing entries are never replaced.
380
+ */
381
+ create(relativePath: string, data: Uint8Array): RecoveryFsResult
382
+ /** Create one managed artifact with the managed-storage size bound. */
383
+ createManaged(relativePath: string, data: Uint8Array): RecoveryFsResult
384
+ /**
385
+ * Atomically replace one exact regular file with a newly written managed
386
+ * artifact. The destination must retain the supplied identity throughout
387
+ * authorization.
388
+ */
389
+ replaceManaged(relativePath: string, data: Uint8Array, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
390
+ /**
391
+ * Synchronously append one record to an exact retained managed file without
392
+ * replacing its inode or creating recovery copies.
393
+ */
394
+ appendManaged(relativePath: string, data: Uint8Array, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
395
+ /** Remove one exact managed regular file through retained authority. */
396
+ removeManaged(relativePath: string, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
397
+ /**
398
+ * Create each absent directory component beneath the retained root with
399
+ * owner-only security. Existing components are re-opened no-follow.
400
+ */
401
+ ensureManagedDirectory(relativePath: string): RecoveryFsResult
402
+ /**
403
+ * Move an exact managed file to an absent name entirely beneath this
404
+ * retained root. The source identity is rechecked after the no-replace
405
+ * rename, and the move is rolled back on a mismatch.
406
+ */
407
+ renameManagedFileNoReplace(sourceRelativePath: string, destinationRelativePath: string, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedCtimeNs: string, expectedSha256: string): RecoveryFsResult
408
+ /** Snapshot a managed directory tree entirely through the retained root. */
409
+ snapshotManagedTree(relativePath: string): NativeDirectoryTreeResult
410
+ /**
411
+ * Move an exact managed directory tree to an absent name through retained
412
+ * authority.
413
+ */
414
+ renameManagedTreeNoReplace(sourceRelativePath: string, destinationRelativePath: string, expected: NativeDirectoryTreeSnapshot): RecoveryFsResult
415
+ /** Remove an exact managed directory tree through retained authority. */
416
+ removeManagedTree(relativePath: string, expected: NativeDirectoryTreeSnapshot): RecoveryFsResult
417
+ /**
418
+ * Atomically install an already-created regular file at an absent name.
419
+ * Both names remain relative to this retained root and are never resolved
420
+ * through a pathname after their parent descriptors are acquired.
421
+ */
422
+ install(sourceRelativePath: string, destinationRelativePath: string): RecoveryFsResult
423
+ /**
424
+ * Synchronize the retained root directory, making a preceding create or
425
+ * install durable when the filesystem supports directory fsync.
426
+ */
427
+ fsync(): RecoveryFsResult
428
+ /**
429
+ * Fsync one expected object relative to the retained root and prove
430
+ * identity.
431
+ */
432
+ fsyncExpected(relativePath: string, directory: boolean, expectedDev: string, expectedIno: string, expectedSize: string, expectedMtimeNs: string, expectedSha256?: string | undefined | null): RecoveryFsResult
433
+ /** Verify owner-only directory security on the retained root descriptor. */
434
+ verifyOwnerOnlyDirectory(): RecoveryFsResult
435
+ close(): RecoveryFsResult
436
+ }
437
+
346
438
  /** Persistent brush-core shell session. */
347
439
  export declare class Shell {
348
440
  /**
@@ -385,7 +477,7 @@ export declare class Shell {
385
477
  * `packages/natives/native/index.js` (which derives the name from
386
478
  * `package.json#version`).
387
479
  */
388
- export declare function __piNativesV0_11_4(): void
480
+ export declare function __piNativesV0_11_5(): void
389
481
 
390
482
  /**
391
483
  * Apply conservative pre-execution rewrites to a bash command.
@@ -396,6 +488,13 @@ export declare function __piNativesV0_11_4(): void
396
488
  */
397
489
  export declare function applyBashFixups(command: string): BashFixupResult
398
490
 
491
+ /**
492
+ * Apply owner-only security to the exact caller descriptor and its retained
493
+ * no-follow path. The descriptor is duplicated with close-on-exec and is never
494
+ * returned to JavaScript.
495
+ */
496
+ export declare function applyOwnerOnlyFdSecurity(path: string, kind: "directory" | "file", callerFd: number): NativeOwnerOnlySecurityResult
497
+
399
498
  export declare function applyOwnerOnlyPathSecurity(path: string, kind: "directory" | "file"): NativeOwnerOnlySecurityResult
400
499
 
401
500
  /** Typed terminal acknowledgement result returned by acknowledgement promises. */
@@ -1512,6 +1611,18 @@ export interface MinimizerResult {
1512
1611
  outputBytes: number
1513
1612
  }
1514
1613
 
1614
+ /** Evidence for one Linux POSIX ACL attribute. */
1615
+ export interface NativeAclAttributeEvidence {
1616
+ clear: string
1617
+ query: string
1618
+ }
1619
+
1620
+ /** Bounded Linux POSIX ACL evidence for an owner-only result. */
1621
+ export interface NativeAclEvidence {
1622
+ access: NativeAclAttributeEvidence
1623
+ default?: NativeAclAttributeEvidence
1624
+ }
1625
+
1515
1626
  /** Classification of a read-only retained-publication observation. */
1516
1627
  export interface NativeBrokerPublicationObservation {
1517
1628
  kind: string
@@ -1545,6 +1656,7 @@ export interface NativeDirectoryTreeEntry {
1545
1656
  ino: string
1546
1657
  size: string
1547
1658
  mtimeNs: string
1659
+ ctimeNs: string
1548
1660
  sha256?: string
1549
1661
  }
1550
1662
 
@@ -1601,11 +1713,87 @@ export interface NativeExactUnlinkResult {
1601
1713
  ok: boolean
1602
1714
  code?: string
1603
1715
  detachedPath?: string
1716
+ retainedSuccessorPath?: string
1717
+ /**
1718
+ * An internal exchange-placeholder cleanup entry retained after cleanup
1719
+ * could not complete. This is never a canonical publisher successor and
1720
+ * remains recoverable only at this path.
1721
+ */
1722
+ retainedPlaceholderPath?: string
1723
+ /**
1724
+ * A retained cleanup entry whose identity could not be verified. This is
1725
+ * neither a stale detached object nor a publisher successor.
1726
+ */
1727
+ retainedUnknownPath?: string
1604
1728
  }
1605
1729
 
1606
1730
  /** Result of applying or checking owner-only path security. */
1607
1731
  export type NativeOwnerOnlySecurityResult =
1608
- | { ok: true; code?: never }
1732
+ | {
1733
+ ok: true;
1734
+ platform: "linux";
1735
+ kind: "file";
1736
+ protocol: "apply" | "verify";
1737
+ aclEvidence: {
1738
+ access: {
1739
+ clear: "cleared" | "already_absent" | "unsupported" | "not_run";
1740
+ query: "absent" | "unsupported";
1741
+ };
1742
+ default?: never;
1743
+ };
1744
+ code?: never;
1745
+ operation?: never;
1746
+ attribute?: never;
1747
+ }
1748
+ | {
1749
+ ok: true;
1750
+ platform: "linux";
1751
+ kind: "directory";
1752
+ protocol: "apply" | "verify";
1753
+ aclEvidence: {
1754
+ access: {
1755
+ clear: "cleared" | "already_absent" | "unsupported" | "not_run";
1756
+ query: "absent" | "unsupported";
1757
+ };
1758
+ default: {
1759
+ clear: "cleared" | "already_absent" | "unsupported" | "not_run";
1760
+ query: "absent" | "unsupported";
1761
+ };
1762
+ };
1763
+ code?: never;
1764
+ operation?: never;
1765
+ attribute?: never;
1766
+ }
1767
+ | {
1768
+ ok: true;
1769
+ platform?: never;
1770
+ kind?: never;
1771
+ protocol?: never;
1772
+ aclEvidence?: never;
1773
+ code?: never;
1774
+ operation?: never;
1775
+ attribute?: never;
1776
+ }
1777
+ | {
1778
+ ok: false;
1779
+ code: "acl_denied" | "acl_io_error" | "acl_present" | "acl_malformed" | "acl_unknown";
1780
+ operation: "clear" | "query";
1781
+ attribute: "access" | "default";
1782
+ platform?: never;
1783
+ kind?: never;
1784
+ protocol?: never;
1785
+ aclEvidence?: never;
1786
+ }
1787
+ | {
1788
+ ok: false;
1789
+ code: "acl_unavailable" | "acl_apply_failed" | "acl_verify_failed";
1790
+ operation?: never;
1791
+ attribute?: never;
1792
+ platform?: never;
1793
+ kind?: never;
1794
+ protocol?: never;
1795
+ aclEvidence?: never;
1796
+ }
1609
1797
  | {
1610
1798
  ok: false;
1611
1799
  code:
@@ -1613,12 +1801,17 @@ export type NativeOwnerOnlySecurityResult =
1613
1801
  | "not_directory"
1614
1802
  | "network_unsupported"
1615
1803
  | "reparse_point"
1616
- | "acl_unavailable"
1617
- | "acl_apply_failed"
1618
- | "acl_verify_failed"
1619
1804
  | "identity_unavailable"
1805
+ | "identity_mismatch"
1620
1806
  | "owner_mismatch"
1807
+ | "mode_mismatch"
1621
1808
  | "io_error";
1809
+ operation?: never;
1810
+ attribute?: never;
1811
+ platform?: never;
1812
+ kind?: never;
1813
+ protocol?: never;
1814
+ aclEvidence?: never;
1622
1815
  }
1623
1816
 
1624
1817
  /** Bound endpoint info returned from [`NotificationServer::start`]. */
@@ -1633,6 +1826,12 @@ export interface NotificationEndpoint {
1633
1826
  sessionId: string
1634
1827
  }
1635
1828
 
1829
+ /**
1830
+ * Acquire an immutable trusted-root descriptor. Linux is required; every
1831
+ * other platform returns a durable unsupported-platform result.
1832
+ */
1833
+ export declare function openRecoveryFsRoot(path: string): RecoveryFsRoot
1834
+
1636
1835
  /** Parsed Kitty keyboard protocol sequence result for a Kitty input sequence. */
1637
1836
  export interface ParsedKittyResult {
1638
1837
  /** Primary codepoint associated with the key. */
@@ -1749,6 +1948,22 @@ export declare function ptyTimeoutCount(): bigint
1749
1948
  */
1750
1949
  export declare function readImageFromClipboard(): Promise<ClipboardImage | undefined | null>
1751
1950
 
1951
+ export interface RecoveryFsIdentity {
1952
+ dev: string
1953
+ ino: string
1954
+ size: string
1955
+ mtimeNs: string
1956
+ ctimeNs: string
1957
+ sha256?: string
1958
+ }
1959
+
1960
+ export interface RecoveryFsResult {
1961
+ ok: boolean
1962
+ code?: string
1963
+ identity?: RecoveryFsIdentity
1964
+ data?: Uint8Array
1965
+ }
1966
+
1752
1967
  export declare function renameNoReplacePath(sourcePath: string, destinationPath: string): NativeExactUnlinkResult
1753
1968
 
1754
1969
  /** A client reply forwarded to the TypeScript host for gate resolution. */
@@ -1970,6 +2185,13 @@ export declare function truncateLinesToWidth(lines: Array<string>, maxWidth: num
1970
2185
 
1971
2186
  export declare function truncateToWidth(text: string, maxWidth: number, ellipsisKind: Ellipsis | undefined | null, pad: boolean | undefined | null, tabWidth: number): string
1972
2187
 
2188
+ /**
2189
+ * Verify owner-only security for the exact caller descriptor and retained
2190
+ * no-follow path. The descriptor is duplicated with close-on-exec and is never
2191
+ * returned to JavaScript.
2192
+ */
2193
+ export declare function verifyOwnerOnlyFdSecurity(path: string, kind: "directory" | "file", callerFd: number): NativeOwnerOnlySecurityResult
2194
+
1973
2195
  export declare function verifyOwnerOnlyPathSecurity(path: string, kind: "directory" | "file"): NativeOwnerOnlySecurityResult
1974
2196
 
1975
2197
  /**
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_5 = nativeBindings.__piNativesV0_11_5;
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.5",
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.5",
65
+ "@gajae-code/natives-darwin-x64": "0.11.5",
66
+ "@gajae-code/natives-linux-arm64": "0.11.5",
67
+ "@gajae-code/natives-linux-x64": "0.11.5",
68
+ "@gajae-code/natives-win32-x64": "0.11.5"
69
69
  },
70
70
  "exports": {
71
71
  ".": {