@oh-my-pi/pi-natives 18.8.8 → 18.9.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.
package/README.md CHANGED
@@ -11,6 +11,7 @@ Native Rust functionality via N-API.
11
11
  - **WebRTC**: Native Opus media, SDP offer/answer negotiation, and data-channel events for live sessions
12
12
  - **File locking**: Process-owned cross-process locks with in-memory kernel names on Linux/Windows and `flock(2)` sidecars on other Unix platforms
13
13
  - **PDF**: In-memory PDF-to-Markdown extraction with OCR-page classification via `pdf-inspector`
14
+ - **Binary patches**: `applyBinaryPatch(oldPath, patchPath, outPath)` applies an HDiffPatch single-stream patch (HDIFFSF20, zstd or uncompressed), streaming from files; callers verify digests
14
15
 
15
16
  General-purpose image processing (decode/resize/encode for files and buffers)
16
17
  lives in [`Bun.Image`](https://bun.com/docs/runtime/image) on the JS side; this
package/native/index.d.ts CHANGED
@@ -38,6 +38,11 @@ export declare class DesktopSession {
38
38
  * behind it.
39
39
  */
40
40
  get capabilities(): DesktopCapabilities
41
+ /**
42
+ * Lock and display-sleep state read on the calling thread, never queued
43
+ * behind the worker, so it answers at once even while a request is stuck.
44
+ */
45
+ get screenState(): DesktopScreenState
41
46
  listDisplays(): Promise<Array<DesktopDisplay>>
42
47
  listWindows(): Promise<Array<DesktopWindow>>
43
48
  listApplications(options?: ApplicationQuery | undefined | null): Promise<Array<Application>>
@@ -789,6 +794,15 @@ export interface ApplicationQuery {
789
794
  runningOnly?: boolean
790
795
  }
791
796
 
797
+ /**
798
+ * Applies an `HDiffPatch` single-stream patch to `oldPath`, writing `outPath`.
799
+ *
800
+ * Accepts HDIFFSF20 patches, zstd-compressed or uncompressed; `outPath` is
801
+ * created or truncated. Resolves to the result's size in bytes. Rejects on I/O
802
+ * failure, a damaged or unsupported patch, or a patch made for other old data.
803
+ */
804
+ export declare function applyBinaryPatch(oldPath: string, patchPath: string, outPath: string): Promise<number>
805
+
792
806
  /**
793
807
  * Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
794
808
  * a promise.
@@ -1234,6 +1248,16 @@ export interface DesktopCapabilities {
1234
1248
  inputPermission: string
1235
1249
  axPermission: string
1236
1250
  displayCount: number
1251
+ /**
1252
+ * The user session is locked (lock screen up). Only macOS detects this;
1253
+ * other backends report `false`.
1254
+ */
1255
+ screenLocked: boolean
1256
+ /**
1257
+ * The display is asleep, so nothing can be captured until it wakes. Only
1258
+ * macOS detects this; other backends report `false`.
1259
+ */
1260
+ displayAsleep: boolean
1237
1261
  }
1238
1262
 
1239
1263
  export interface DesktopCapture {
@@ -1259,6 +1283,12 @@ export interface DesktopCapture {
1259
1283
  displays: Array<DesktopDisplay>
1260
1284
  backend: string
1261
1285
  displayServer?: string
1286
+ /**
1287
+ * The user session was locked when this frame was taken: a display
1288
+ * capture shows the lock screen, and a window capture shows the window's
1289
+ * last frame behind it. Only macOS detects this; others report `false`.
1290
+ */
1291
+ screenLocked: boolean
1262
1292
  }
1263
1293
 
1264
1294
  export interface DesktopControlState {
@@ -1307,6 +1337,15 @@ export interface DesktopPoint {
1307
1337
  y: number
1308
1338
  }
1309
1339
 
1340
+ /**
1341
+ * Lock and display-sleep state of the user session, read live per call.
1342
+ * Only macOS detects either; other platforms report both as `false`.
1343
+ */
1344
+ export interface DesktopScreenState {
1345
+ screenLocked: boolean
1346
+ displayAsleep: boolean
1347
+ }
1348
+
1310
1349
  export interface DesktopSessionOptions {
1311
1350
  display?: string
1312
1351
  }
@@ -1925,6 +1964,11 @@ export interface GrepMatch {
1925
1964
  contextAfter?: Array<ContextLine>
1926
1965
  /** Whether the line was truncated. */
1927
1966
  truncated?: boolean
1967
+ /**
1968
+ * 1-indexed character column where the first match on a truncated line
1969
+ * starts; the truncated `line` shows a window around it.
1970
+ */
1971
+ column?: number
1928
1972
  /** Per-file match count (count mode only). */
1929
1973
  matchCount?: number
1930
1974
  }
@@ -2368,6 +2412,11 @@ export interface Match {
2368
2412
  contextAfter?: Array<ContextLine>
2369
2413
  /** Whether the line was truncated. */
2370
2414
  truncated?: boolean
2415
+ /**
2416
+ * 1-indexed character column where the first match on a truncated line
2417
+ * starts; the truncated `line` shows a window around it.
2418
+ */
2419
+ column?: number
2371
2420
  }
2372
2421
 
2373
2422
  /**
@@ -3410,9 +3459,8 @@ export interface SummarySegment {
3410
3459
  }
3411
3460
 
3412
3461
  /**
3413
- * Check if a language is supported for highlighting.
3414
- * Returns true if the language has either direct support or a fallback
3415
- * mapping.
3462
+ * Check if a language resolves to a grammar (by name, extension or alias),
3463
+ * i.e. whether `highlightCode` colors it rather than echoing it.
3416
3464
  */
3417
3465
  export declare function supportsLanguage(lang: string): boolean
3418
3466
 
package/native/index.js CHANGED
@@ -51,6 +51,7 @@ export const __piNativesBuildVersion = nativeBindings.__piNativesBuildVersion;
51
51
  export const appleFmAvailability = nativeBindings.appleFmAvailability ?? missingNativeExport("appleFmAvailability");
52
52
  export const appleFmCancel = nativeBindings.appleFmCancel ?? missingNativeExport("appleFmCancel");
53
53
  export const appleFmGenerate = nativeBindings.appleFmGenerate ?? missingNativeExport("appleFmGenerate");
54
+ export const applyBinaryPatch = nativeBindings.applyBinaryPatch ?? missingNativeExport("applyBinaryPatch");
54
55
  export const astEdit = nativeBindings.astEdit ?? missingNativeExport("astEdit");
55
56
  export const astGrep = nativeBindings.astGrep ?? missingNativeExport("astGrep");
56
57
  export const astMatch = nativeBindings.astMatch ?? missingNativeExport("astMatch");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "18.8.8",
3
+ "version": "18.9.0",
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",
@@ -112,11 +112,11 @@
112
112
  }
113
113
  },
114
114
  "optionalDependencies": {
115
- "@oh-my-pi/pi-natives-linux-x64": "18.8.8",
116
- "@oh-my-pi/pi-natives-linux-arm64": "18.8.8",
117
- "@oh-my-pi/pi-natives-darwin-x64": "18.8.8",
118
- "@oh-my-pi/pi-natives-darwin-arm64": "18.8.8",
119
- "@oh-my-pi/pi-natives-win32-x64": "18.8.8",
120
- "@oh-my-pi/pi-natives-win32-arm64": "18.8.8"
115
+ "@oh-my-pi/pi-natives-linux-x64": "18.9.0",
116
+ "@oh-my-pi/pi-natives-linux-arm64": "18.9.0",
117
+ "@oh-my-pi/pi-natives-darwin-x64": "18.9.0",
118
+ "@oh-my-pi/pi-natives-darwin-arm64": "18.9.0",
119
+ "@oh-my-pi/pi-natives-win32-x64": "18.9.0",
120
+ "@oh-my-pi/pi-natives-win32-arm64": "18.9.0"
121
121
  }
122
122
  }