@gajae-code/natives 0.11.3 → 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
@@ -52,6 +59,18 @@ export declare class MacOSPowerAssertion {
52
59
  stop(): void
53
60
  }
54
61
 
62
+ /** Retained no-follow authority for the SDK publication namespace. */
63
+ export declare class NativeRetainedBrokerPublication {
64
+ observe(): NativeBrokerPublicationObservation
65
+ heartbeat(heartbeatAt: string): NativeBrokerPublicationOperation
66
+ sync(): NativeBrokerPublicationOperation
67
+ /**
68
+ * Close discovery, owner record, lock directory, and SDK root in that
69
+ * order.
70
+ */
71
+ close(): NativeBrokerPublicationOperation
72
+ }
73
+
55
74
  /**
56
75
  * In-process, session-independent lifecycle **control** server exposed to TS.
57
76
  *
@@ -288,6 +307,15 @@ export declare class Process {
288
307
  get ppid(): number | null
289
308
  /** Launch arguments for this process. */
290
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
291
319
  /**
292
320
  * Send `signal` to this process and its descendants, children first.
293
321
  *
@@ -331,6 +359,82 @@ export declare class PtySession {
331
359
  kill(): void
332
360
  }
333
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
+
334
438
  /** Persistent brush-core shell session. */
335
439
  export declare class Shell {
336
440
  /**
@@ -373,7 +477,7 @@ export declare class Shell {
373
477
  * `packages/natives/native/index.js` (which derives the name from
374
478
  * `package.json#version`).
375
479
  */
376
- export declare function __piNativesV0_11_3(): void
480
+ export declare function __piNativesV0_11_5(): void
377
481
 
378
482
  /**
379
483
  * Apply conservative pre-execution rewrites to a bash command.
@@ -384,6 +488,13 @@ export declare function __piNativesV0_11_3(): void
384
488
  */
385
489
  export declare function applyBashFixups(command: string): BashFixupResult
386
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
+
387
498
  export declare function applyOwnerOnlyPathSecurity(path: string, kind: "directory" | "file"): NativeOwnerOnlySecurityResult
388
499
 
389
500
  /** Typed terminal acknowledgement result returned by acknowledgement promises. */
@@ -1500,6 +1611,28 @@ export interface MinimizerResult {
1500
1611
  outputBytes: number
1501
1612
  }
1502
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
+
1626
+ /** Classification of a read-only retained-publication observation. */
1627
+ export interface NativeBrokerPublicationObservation {
1628
+ kind: string
1629
+ }
1630
+
1631
+ /** Result of a retained positional heartbeat write or sync. */
1632
+ export interface NativeBrokerPublicationOperation {
1633
+ kind: string
1634
+ }
1635
+
1503
1636
  export declare function nativeBuildInfo(): BuildInfo
1504
1637
 
1505
1638
  /** Result of resolving an existing directory to its stable platform identity. */
@@ -1523,6 +1656,7 @@ export interface NativeDirectoryTreeEntry {
1523
1656
  ino: string
1524
1657
  size: string
1525
1658
  mtimeNs: string
1659
+ ctimeNs: string
1526
1660
  sha256?: string
1527
1661
  }
1528
1662
 
@@ -1579,11 +1713,87 @@ export interface NativeExactUnlinkResult {
1579
1713
  ok: boolean
1580
1714
  code?: string
1581
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
1582
1728
  }
1583
1729
 
1584
1730
  /** Result of applying or checking owner-only path security. */
1585
1731
  export type NativeOwnerOnlySecurityResult =
1586
- | { 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
+ }
1587
1797
  | {
1588
1798
  ok: false;
1589
1799
  code:
@@ -1591,12 +1801,17 @@ export type NativeOwnerOnlySecurityResult =
1591
1801
  | "not_directory"
1592
1802
  | "network_unsupported"
1593
1803
  | "reparse_point"
1594
- | "acl_unavailable"
1595
- | "acl_apply_failed"
1596
- | "acl_verify_failed"
1597
1804
  | "identity_unavailable"
1805
+ | "identity_mismatch"
1598
1806
  | "owner_mismatch"
1807
+ | "mode_mismatch"
1599
1808
  | "io_error";
1809
+ operation?: never;
1810
+ attribute?: never;
1811
+ platform?: never;
1812
+ kind?: never;
1813
+ protocol?: never;
1814
+ aclEvidence?: never;
1600
1815
  }
1601
1816
 
1602
1817
  /** Bound endpoint info returned from [`NotificationServer::start`]. */
@@ -1611,6 +1826,12 @@ export interface NotificationEndpoint {
1611
1826
  sessionId: string
1612
1827
  }
1613
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
+
1614
1835
  /** Parsed Kitty keyboard protocol sequence result for a Kitty input sequence. */
1615
1836
  export interface ParsedKittyResult {
1616
1837
  /** Primary codepoint associated with the key. */
@@ -1727,6 +1948,22 @@ export declare function ptyTimeoutCount(): bigint
1727
1948
  */
1728
1949
  export declare function readImageFromClipboard(): Promise<ClipboardImage | undefined | null>
1729
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
+
1730
1967
  export declare function renameNoReplacePath(sourcePath: string, destinationPath: string): NativeExactUnlinkResult
1731
1968
 
1732
1969
  /** A client reply forwarded to the TypeScript host for gate resolution. */
@@ -1744,6 +1981,12 @@ export interface ReplyEvent {
1744
1981
  replyReceiptId: string
1745
1982
  }
1746
1983
 
1984
+ /**
1985
+ * Retain the existing no-follow SDK publication objects after one-time
1986
+ * publication.
1987
+ */
1988
+ export declare function retainBrokerPublication(agentDir: string): NativeRetainedBrokerPublication
1989
+
1747
1990
  /** Public status of exact direct retirement. Claims and receipts remain native. */
1748
1991
  export interface RetireIfUnclaimedResult {
1749
1992
  status: 'retired' | 'already_terminal' | 'claimed' | 'stale'
@@ -1942,6 +2185,13 @@ export declare function truncateLinesToWidth(lines: Array<string>, maxWidth: num
1942
2185
 
1943
2186
  export declare function truncateToWidth(text: string, maxWidth: number, ellipsisKind: Ellipsis | undefined | null, pad: boolean | undefined | null, tabWidth: number): string
1944
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
+
1945
2195
  export declare function verifyOwnerOnlyPathSecurity(path: string, kind: "directory" | "file"): NativeOwnerOnlySecurityResult
1946
2196
 
1947
2197
  /**
package/native/index.js CHANGED
@@ -20,15 +20,18 @@ nativeBindings.initNativeCrashDiagnostics?.();
20
20
  export const ComputerController = nativeBindings.ComputerController;
21
21
  export const MacAppearanceObserver = nativeBindings.MacAppearanceObserver;
22
22
  export const MacOSPowerAssertion = nativeBindings.MacOSPowerAssertion;
23
+ export const NativeRetainedBrokerPublication = nativeBindings.NativeRetainedBrokerPublication;
23
24
  export const NotificationControlServer = nativeBindings.NotificationControlServer;
24
25
  export const NotificationServer = nativeBindings.NotificationServer;
25
26
  export const Process = nativeBindings.Process;
26
27
  export const PtySession = nativeBindings.PtySession;
28
+ export const RecoveryFsRoot = nativeBindings.RecoveryFsRoot;
27
29
  export const Shell = nativeBindings.Shell;
28
30
 
29
31
  // functions
30
- export const __piNativesV0_11_3 = nativeBindings.__piNativesV0_11_3;
32
+ export const __piNativesV0_11_5 = nativeBindings.__piNativesV0_11_5;
31
33
  export const applyBashFixups = nativeBindings.applyBashFixups;
34
+ export const applyOwnerOnlyFdSecurity = nativeBindings.applyOwnerOnlyFdSecurity;
32
35
  export const applyOwnerOnlyPathSecurity = nativeBindings.applyOwnerOnlyPathSecurity;
33
36
  export const astEdit = nativeBindings.astEdit;
34
37
  export const astGrep = nativeBindings.astGrep;
@@ -68,11 +71,13 @@ export const matchesKey = nativeBindings.matchesKey;
68
71
  export const matchesKittySequence = nativeBindings.matchesKittySequence;
69
72
  export const matchesLegacySequence = nativeBindings.matchesLegacySequence;
70
73
  export const nativeBuildInfo = nativeBindings.nativeBuildInfo;
74
+ export const openRecoveryFsRoot = nativeBindings.openRecoveryFsRoot;
71
75
  export const parseKey = nativeBindings.parseKey;
72
76
  export const parseKittySequence = nativeBindings.parseKittySequence;
73
77
  export const ptyTimeoutCount = nativeBindings.ptyTimeoutCount;
74
78
  export const readImageFromClipboard = nativeBindings.readImageFromClipboard;
75
79
  export const renameNoReplacePath = nativeBindings.renameNoReplacePath;
80
+ export const retainBrokerPublication = nativeBindings.retainBrokerPublication;
76
81
  export const search = nativeBindings.search;
77
82
  export const sliceWithWidth = nativeBindings.sliceWithWidth;
78
83
  export const snapshotDirectoryTree = nativeBindings.snapshotDirectoryTree;
@@ -80,6 +85,7 @@ export const summarizeCode = nativeBindings.summarizeCode;
80
85
  export const supportsLanguage = nativeBindings.supportsLanguage;
81
86
  export const truncateLinesToWidth = nativeBindings.truncateLinesToWidth;
82
87
  export const truncateToWidth = nativeBindings.truncateToWidth;
88
+ export const verifyOwnerOnlyFdSecurity = nativeBindings.verifyOwnerOnlyFdSecurity;
83
89
  export const verifyOwnerOnlyPathSecurity = nativeBindings.verifyOwnerOnlyPathSecurity;
84
90
  export const visibleWidth = nativeBindings.visibleWidth;
85
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.3",
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.3",
65
- "@gajae-code/natives-darwin-x64": "0.11.3",
66
- "@gajae-code/natives-linux-arm64": "0.11.3",
67
- "@gajae-code/natives-linux-x64": "0.11.3",
68
- "@gajae-code/natives-win32-x64": "0.11.3"
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
  ".": {