@gajae-code/natives 0.18.12 → 0.19.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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schema": "gjc.diagnostic-artifact",
3
- "version": "0.18.12",
3
+ "version": "0.19.0",
4
4
  "artifacts": {
5
- "pi_natives.darwin-arm64.node": "afc623540979280ece88b16c57c5a5941407a98bc0344f6fd851537d886dcfee",
6
- "pi_natives.darwin-x64-baseline.node": "a1aee260794c49ed6ce8590f23ac89e899e20d93dae95900bb0b1503ff4ea159",
7
- "pi_natives.linux-arm64.node": "2d695e63e7d1f89eff9a0809bb2f417cb65c91ae75161e5fd58a405d29689322",
8
- "pi_natives.linux-x64-baseline.node": "7cada23a1841fe89670a80853ca8c35905f80783d8bb19a284a3f45821d9e56e",
9
- "pi_natives.linux-x64-modern.node": "75e7f945bf27526f1d833f6c80490d9600fabc6700de70e5eb83eea6ef8cd8ea",
10
- "pi_natives.win32-x64-baseline.node": "a88258561c1027a3d6e8477de335f903182f300091700cd3d6cfd96abc53ce95"
5
+ "pi_natives.darwin-arm64.node": "bcb20db50a480de66eed5448d63d530ce708ab84d77ab1cb1620132772690af5",
6
+ "pi_natives.darwin-x64-baseline.node": "3de5a046531495e0a0afdff4d6f0bcd4c8639fcd30fd6cff8ea9ec2efd43b63f",
7
+ "pi_natives.linux-arm64.node": "3eb72a1956e59f3134d45690c61c79a24e0eddcb9627b238deb32540ec0433ce",
8
+ "pi_natives.linux-x64-baseline.node": "d6282ea56f7c47bf659fbb1aef7f8df3fb798c9b828abc5dc3b6cf4334f3c651",
9
+ "pi_natives.linux-x64-modern.node": "8d1fd3d3bc98cc479c75cea158b6059dbed4dbd7a614a6a8c9ad60a12b7a4dae",
10
+ "pi_natives.win32-x64-baseline.node": "7d9ed748b9b6eb6e14a2c87afccbe1590498512f2830fb1e813aa3529b715bb2"
11
11
  }
12
12
  }
package/native/index.d.ts CHANGED
@@ -687,7 +687,7 @@ export declare function __piNativesPublishOutcomeV1(): void
687
687
  * `packages/natives/native/index.js` (which derives the name from
688
688
  * `package.json#version`).
689
689
  */
690
- export declare function __piNativesV0_18_12(): void
690
+ export declare function __piNativesV0_19_0(): void
691
691
 
692
692
  /**
693
693
  * Apply conservative pre-execution rewrites to a bash command.
@@ -795,6 +795,59 @@ export interface AstFindResult {
795
795
  */
796
796
  export declare function astGrep(options: AstFindOptions): Promise<AstFindResult>
797
797
 
798
+ /**
799
+ * Match ast-grep patterns against an in-memory source string; returns a
800
+ * promise resolved on a worker thread.
801
+ *
802
+ * This is the file-free counterpart to [`ast_grep`]: callers that already hold
803
+ * the source (streaming buffers, generated code, editor contents) avoid a
804
+ * temp-file round trip. `lang` is required since there is no path to infer it
805
+ * from.
806
+ */
807
+ export declare function astMatch(options: AstMatchOptions): Promise<AstMatchResult>
808
+
809
+ /**
810
+ * Options for `astMatch`: run ast-grep patterns against an in-memory source
811
+ * string instead of files on disk.
812
+ */
813
+ export interface AstMatchOptions {
814
+ /** Source code to match against (parsed in memory, never read from disk). */
815
+ source: string
816
+ /**
817
+ * Language of `source` (required): an alias ("ts", "rust", "python") or a
818
+ * file extension ("scss"), resolved like a path's extension.
819
+ */
820
+ lang: string
821
+ /** ast-grep patterns to search for (OR across patterns). */
822
+ patterns: Array<string>
823
+ /** Rule selector for multi-rule ast-grep configurations. */
824
+ selector?: string
825
+ /** Pattern strictness; defaults to smart matching when omitted. */
826
+ strictness?: AstMatchStrictness
827
+ /** Maximum matches to return after `offset` (default applies when omitted). */
828
+ limit?: number
829
+ /** Number of leading matches to skip before applying `limit`. */
830
+ offset?: number
831
+ /** When true, include meta-variable bindings per match. */
832
+ includeMeta?: boolean
833
+ /** Optional cancellation handle (library-specific). */
834
+ signal?: unknown
835
+ /** Wall-clock timeout for the worker task in milliseconds. */
836
+ timeoutMs?: number
837
+ }
838
+
839
+ /** Result of an in-memory `astMatch` run. */
840
+ export interface AstMatchResult {
841
+ /** Page of matches after sort, offset, and limit. */
842
+ matches: Array<AstFindMatch>
843
+ /** Total matches found before paging (can exceed `matches.length`). */
844
+ totalMatches: number
845
+ /** True when results were truncated by `limit`. */
846
+ limitReached: boolean
847
+ /** Non-fatal parse or pattern-compile errors collected during the run. */
848
+ parseErrors?: Array<string>
849
+ }
850
+
798
851
  /** ast-grep pattern strictness (controls how patterns match syntax). */
799
852
  export declare enum AstMatchStrictness {
800
853
  /** Match at the concrete syntax tree level. */
@@ -1189,10 +1242,11 @@ export declare function encodeSixel(bytes: Uint8Array, targetWidthPx: number, ta
1189
1242
 
1190
1243
  /**
1191
1244
  * Remove a directory tree only when a fresh descriptor-relative snapshot
1192
- * exactly equals the persisted snapshot. POSIX first no-replace detaches the
1193
- * verified root to its deterministic `.removing` sibling; the reopened
1194
- * detached descriptor remains authoritative throughout payload scrubbing and
1195
- * replay.
1245
+ * exactly equals the persisted snapshot. POSIX removal no-replace detaches the
1246
+ * verified root to its deterministic `.removing` sibling before scrubbing. On
1247
+ * Windows, callers that need retirement semantics must request a detach-only
1248
+ * pass, then replay exact removal at the returned sibling; ordinary Windows
1249
+ * removal never vacates the caller's path before scrubbing completes.
1196
1250
  */
1197
1251
  export declare function exactRemoveDirectoryTree(path: string, snapshot: NativeDirectoryTreeSnapshot, parentIdentity?: NativeDirectoryParentIdentity | undefined | null, detachOnly?: boolean | undefined | null): NativeExactUnlinkResult
1198
1252
 
@@ -1295,6 +1349,17 @@ export declare function exactUnlinkDirect(path: string, identity: NativeExactFil
1295
1349
  */
1296
1350
  export declare function exactUnlinkDirectDetached(path: string, identity: NativeExactFileIdentity): boolean
1297
1351
 
1352
+ /**
1353
+ * Delete only the empty regular file opened by the caller's retained
1354
+ * descriptor.
1355
+ *
1356
+ * This is used when a newly created staging file cannot be statted through the
1357
+ * host API. Native code derives identity from the open descriptor and verifies
1358
+ * the public entry still names that object before using the platform's exact
1359
+ * unlink protocol.
1360
+ */
1361
+ export declare function exactUnlinkOpenFile(path: string, callerFd: number, quarantineName: string): NativeExactUnlinkResult
1362
+
1298
1363
  /**
1299
1364
  * Execute a brush shell command.
1300
1365
  *
@@ -2106,7 +2171,7 @@ export type NativeCanonicalDirectoryIdentity =
2106
2171
  ok: false;
2107
2172
  platform?: never;
2108
2173
  canonicalPath?: never;
2109
- code: "not_found" | "not_directory" | "not_utf8" | "network_unsupported" | "identity_unavailable" | "io_error";
2174
+ code: "access_denied" | "not_found" | "not_directory" | "not_utf8" | "network_unsupported" | "identity_unavailable" | "io_error";
2110
2175
  }
2111
2176
 
2112
2177
  /** Bytes copied out of one read-only broker publication observation. */
@@ -2322,6 +2387,7 @@ export type NativeOwnerOnlySecurityResult =
2322
2387
  | {
2323
2388
  ok: false;
2324
2389
  code:
2390
+ | "access_denied"
2325
2391
  | "not_found"
2326
2392
  | "not_directory"
2327
2393
  | "network_unsupported"
package/native/index.js CHANGED
@@ -35,12 +35,13 @@ export const TtyWriter = nativeBindings.TtyWriter;
35
35
  // functions
36
36
  export const __gjcInstallTokioRuntime = nativeBindings.__gjcInstallTokioRuntime;
37
37
  export const __piNativesPublishOutcomeV1 = nativeBindings.__piNativesPublishOutcomeV1;
38
- export const __piNativesV0_18_12 = nativeBindings.__piNativesV0_18_12;
38
+ export const __piNativesV0_19_0 = nativeBindings.__piNativesV0_19_0;
39
39
  export const applyBashFixups = nativeBindings.applyBashFixups;
40
40
  export const applyOwnerOnlyFdSecurity = nativeBindings.applyOwnerOnlyFdSecurity;
41
41
  export const applyOwnerOnlyPathSecurity = nativeBindings.applyOwnerOnlyPathSecurity;
42
42
  export const astEdit = nativeBindings.astEdit;
43
43
  export const astGrep = nativeBindings.astGrep;
44
+ export const astMatch = nativeBindings.astMatch;
44
45
  export const canonicalExistingDirectoryIdentity = nativeBindings.canonicalExistingDirectoryIdentity;
45
46
  export const computerScreenshot = nativeBindings.computerScreenshot;
46
47
  export const copyToClipboard = nativeBindings.copyToClipboard;
@@ -64,6 +65,7 @@ export const exactSwapManagedLink = nativeBindings.exactSwapManagedLink;
64
65
  export const exactUnlink = nativeBindings.exactUnlink;
65
66
  export const exactUnlinkDirect = nativeBindings.exactUnlinkDirect;
66
67
  export const exactUnlinkDirectDetached = nativeBindings.exactUnlinkDirectDetached;
68
+ export const exactUnlinkOpenFile = nativeBindings.exactUnlinkOpenFile;
67
69
  export const executeShell = nativeBindings.executeShell;
68
70
  export const extractSegments = nativeBindings.extractSegments;
69
71
  export const fuzzyFind = nativeBindings.fuzzyFind;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gajae-code/natives",
3
- "version": "0.18.12",
3
+ "version": "0.19.0",
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",
@@ -66,11 +66,11 @@
66
66
  "README.md"
67
67
  ],
68
68
  "optionalDependencies": {
69
- "@gajae-code/natives-darwin-arm64": "0.18.12",
70
- "@gajae-code/natives-darwin-x64": "0.18.12",
71
- "@gajae-code/natives-linux-arm64": "0.18.12",
72
- "@gajae-code/natives-linux-x64": "0.18.12",
73
- "@gajae-code/natives-win32-x64": "0.18.12"
69
+ "@gajae-code/natives-darwin-arm64": "0.19.0",
70
+ "@gajae-code/natives-darwin-x64": "0.19.0",
71
+ "@gajae-code/natives-linux-arm64": "0.19.0",
72
+ "@gajae-code/natives-linux-x64": "0.19.0",
73
+ "@gajae-code/natives-win32-x64": "0.19.0"
74
74
  },
75
75
  "exports": {
76
76
  ".": {