@oh-my-pi/pi-natives 17.2.4 → 17.2.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/README.md +1 -0
- package/native/clipboard.d.ts +9 -0
- package/native/clipboard.js +11 -0
- package/native/index.d.ts +122 -56
- package/native/index.js +2 -1
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Native Rust functionality via N-API.
|
|
|
9
9
|
- **SIXEL**: Terminal image encoding for SIXEL-capable terminals (decode, resize, encode in one pass)
|
|
10
10
|
- **Audio**: Cross-platform low-latency microphone capture and gapless speaker playback
|
|
11
11
|
- **WebRTC**: Native Opus media, SDP offer/answer negotiation, and data-channel events for live sessions
|
|
12
|
+
- **File locking**: Process-owned cross-process locks with in-memory kernel names on Linux/Windows and `flock(2)` sidecars on other Unix platforms
|
|
12
13
|
|
|
13
14
|
General-purpose image processing (decode/resize/encode for files and buffers)
|
|
14
15
|
lives in [`Bun.Image`](https://bun.com/docs/runtime/image) on the JS side; this
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClipboardImage } from "./index.js";
|
|
2
|
+
|
|
3
|
+
export type { ClipboardImage } from "./index.js";
|
|
4
|
+
|
|
5
|
+
/** Copy text to the clipboard, loading the native addon on first use. */
|
|
6
|
+
export declare function copyToClipboard(text: string): void;
|
|
7
|
+
|
|
8
|
+
/** Read an image from the clipboard, loading the native addon on first use. */
|
|
9
|
+
export declare function readImageFromClipboard(): Promise<ClipboardImage | undefined | null>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { loadNative } from "./loader-state.js";
|
|
2
|
+
|
|
3
|
+
/** Copy text to the clipboard, loading the native addon on first use. */
|
|
4
|
+
export function copyToClipboard(text) {
|
|
5
|
+
return loadNative().copyToClipboard(text);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Read an image from the clipboard, loading the native addon on first use. */
|
|
9
|
+
export function readImageFromClipboard() {
|
|
10
|
+
return loadNative().readImageFromClipboard();
|
|
11
|
+
}
|
package/native/index.d.ts
CHANGED
|
@@ -28,22 +28,55 @@ export declare class AudioPlayback {
|
|
|
28
28
|
stop(): void
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/** Persistent, serialized native desktop capture/input session. */
|
|
31
|
+
/** Persistent, serialized native desktop capture/input/accessibility session. */
|
|
32
32
|
export declare class DesktopSession {
|
|
33
33
|
constructor(options?: DesktopSessionOptions | undefined | null)
|
|
34
|
-
/** Current backend capability and permission state. */
|
|
35
34
|
get capabilities(): DesktopCapabilities
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
listDisplays(): Promise<Array<DesktopDisplay>>
|
|
36
|
+
listWindows(): Promise<Array<DesktopWindow>>
|
|
37
|
+
capture(target: string, caps?: CaptureCaps | undefined | null): Promise<DesktopCapture>
|
|
38
|
+
click(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
39
|
+
moveMouse(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
40
|
+
drag(target: string, path: Array<DesktopPoint>, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
41
|
+
scroll(target: string, x: number, y: number, dx: number, dy: number, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
42
|
+
typeText(target: string, text: string, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
43
|
+
keyChord(target: string, keys: Array<string>, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
44
|
+
raiseWindow(windowId: string): Promise<undefined>
|
|
45
|
+
axSnapshot(target: string, opts?: AxSnapshotOptions | undefined | null): Promise<AxSnapshot>
|
|
46
|
+
axQuery(target: string, query: AxQuery): Promise<Array<AxNode>>
|
|
38
47
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
48
|
+
* Accessibility hit-test at global logical desktop coordinates; needs no
|
|
49
|
+
* prior capture.
|
|
41
50
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
axElementAt(target: string, x: number, y: number): Promise<AxNode | undefined | null>
|
|
52
|
+
axFocused(): Promise<AxNode | undefined | null>
|
|
53
|
+
axNode(reference: string): Promise<AxNode>
|
|
54
|
+
axAttributes(reference: string): Promise<Array<[string, string]>>
|
|
55
|
+
axChildren(reference: string): Promise<Array<AxNode>>
|
|
56
|
+
axParent(reference: string): Promise<AxNode | undefined | null>
|
|
57
|
+
axPerform(reference: string, action: string): Promise<undefined>
|
|
58
|
+
axSetValue(reference: string, value: string): Promise<undefined>
|
|
59
|
+
axFocus(reference: string): Promise<undefined>
|
|
60
|
+
axClick(reference: string, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
44
61
|
close(): Promise<undefined>
|
|
45
62
|
}
|
|
46
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Process-owned cross-platform advisory lock.
|
|
66
|
+
*
|
|
67
|
+
* `tryAcquire()` is non-blocking; its returned handle reports whether it won
|
|
68
|
+
* through `acquired`. Ownership ends on `release()`, garbage collection, or
|
|
69
|
+
* process exit; `release()` is idempotent.
|
|
70
|
+
*/
|
|
71
|
+
export declare class FileLock {
|
|
72
|
+
/** Try to acquire `path` without blocking. */
|
|
73
|
+
static tryAcquire(path: string): FileLock
|
|
74
|
+
/** Whether this handle owns the requested lock. */
|
|
75
|
+
get acquired(): boolean
|
|
76
|
+
/** Release this handle's ownership without affecting a successor. */
|
|
77
|
+
release(): void
|
|
78
|
+
}
|
|
79
|
+
|
|
47
80
|
/** WebRTC peer that accepts 16 kHz mono PCM and renders remote Opus audio. */
|
|
48
81
|
export declare class LiveWebRtcPeer {
|
|
49
82
|
/**
|
|
@@ -246,7 +279,7 @@ export declare function __ompInstallTokioRuntime(): void
|
|
|
246
279
|
* `packages/natives/native/index.js` (which derives the name from
|
|
247
280
|
* `package.json#version`).
|
|
248
281
|
*/
|
|
249
|
-
export declare function
|
|
282
|
+
export declare function __piNativesV17_2_6(): void
|
|
250
283
|
|
|
251
284
|
/**
|
|
252
285
|
* Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
|
|
@@ -487,6 +520,42 @@ export interface AstReplaceResult {
|
|
|
487
520
|
parseErrors?: Array<string>
|
|
488
521
|
}
|
|
489
522
|
|
|
523
|
+
export interface AxNode {
|
|
524
|
+
ref: string
|
|
525
|
+
role: string
|
|
526
|
+
nativeRole: string
|
|
527
|
+
title?: string
|
|
528
|
+
value?: string
|
|
529
|
+
description?: string
|
|
530
|
+
enabled: boolean
|
|
531
|
+
focused: boolean
|
|
532
|
+
x?: number
|
|
533
|
+
y?: number
|
|
534
|
+
width?: number
|
|
535
|
+
height?: number
|
|
536
|
+
actions?: Array<string>
|
|
537
|
+
childCount: number
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export interface AxQuery {
|
|
541
|
+
role?: string
|
|
542
|
+
title?: string
|
|
543
|
+
value?: string
|
|
544
|
+
limit?: number
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export interface AxSnapshot {
|
|
548
|
+
text: string
|
|
549
|
+
nodeCount: number
|
|
550
|
+
truncated: boolean
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
export interface AxSnapshotOptions {
|
|
554
|
+
maxDepth?: number
|
|
555
|
+
maxNodes?: number
|
|
556
|
+
all?: boolean
|
|
557
|
+
}
|
|
558
|
+
|
|
490
559
|
export interface BlockRange {
|
|
491
560
|
/** 1-indexed inclusive first line of the resolved block. */
|
|
492
561
|
startLine: number
|
|
@@ -514,6 +583,11 @@ export interface BlockRangeOptions {
|
|
|
514
583
|
line: number
|
|
515
584
|
}
|
|
516
585
|
|
|
586
|
+
export interface CaptureCaps {
|
|
587
|
+
maxWidth?: number
|
|
588
|
+
maxHeight?: number
|
|
589
|
+
}
|
|
590
|
+
|
|
517
591
|
/** Clipboard image payload encoded as PNG bytes. */
|
|
518
592
|
export interface ClipboardImage {
|
|
519
593
|
/** PNG-encoded image bytes. */
|
|
@@ -566,59 +640,35 @@ export declare function cosineSimilarityPairs(vectors: Float64Array, count: numb
|
|
|
566
640
|
*/
|
|
567
641
|
export declare function countTokens(input: string | Array<string>, encoding?: Encoding | undefined | null): number
|
|
568
642
|
|
|
569
|
-
/**
|
|
570
|
-
* One `OpenAI` GA computer action.
|
|
571
|
-
*
|
|
572
|
-
* This is an optional-field carrier because napi-rs object generation cannot
|
|
573
|
-
* emit TypeScript discriminated unions. Native validation enforces the exact
|
|
574
|
-
* fields required and allowed by each `type` before any input is emitted.
|
|
575
|
-
*/
|
|
576
|
-
export interface DesktopAction {
|
|
577
|
-
type: string
|
|
578
|
-
x?: number
|
|
579
|
-
y?: number
|
|
580
|
-
button?: string
|
|
581
|
-
path?: Array<DesktopPoint>
|
|
582
|
-
keys?: Array<string>
|
|
583
|
-
scroll_x?: number
|
|
584
|
-
scroll_y?: number
|
|
585
|
-
text?: string
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
/** Native desktop backend and permission state. */
|
|
589
643
|
export interface DesktopCapabilities {
|
|
590
|
-
/**
|
|
591
|
-
* Concrete selected backend: `quartz`, `x11`, `wayland`, `win32`, or
|
|
592
|
-
* `unavailable`.
|
|
593
|
-
*/
|
|
594
644
|
backend: string
|
|
595
|
-
/** OS display-server endpoint or subsystem label. */
|
|
596
645
|
displayServer?: string
|
|
597
|
-
/** Whether screen capture is currently usable. */
|
|
598
646
|
capture: boolean
|
|
599
|
-
/** Whether native input is currently usable. */
|
|
600
647
|
input: boolean
|
|
601
|
-
|
|
648
|
+
ax: boolean
|
|
649
|
+
backgroundWindowInput: boolean
|
|
650
|
+
deliveryModes: Array<string>
|
|
602
651
|
capturePermission: string
|
|
603
|
-
/** `granted`, `denied`, `unknown`, or `unavailable`. */
|
|
604
652
|
inputPermission: string
|
|
605
|
-
|
|
653
|
+
axPermission: string
|
|
606
654
|
displayCount: number
|
|
607
655
|
}
|
|
608
656
|
|
|
609
|
-
/**
|
|
610
|
-
* A PNG composite and the exact geometry needed to map its pixels back to the
|
|
611
|
-
* global logical desktop.
|
|
612
|
-
*/
|
|
613
657
|
export interface DesktopCapture {
|
|
614
658
|
data: Uint8Array
|
|
615
659
|
width: number
|
|
616
660
|
height: number
|
|
661
|
+
/** Pre-scaling capture width in native pixels; equals `width` when unscaled. */
|
|
662
|
+
sourceWidth: number
|
|
663
|
+
/**
|
|
664
|
+
* Pre-scaling capture height in native pixels; equals `height` when
|
|
665
|
+
* unscaled.
|
|
666
|
+
*/
|
|
667
|
+
sourceHeight: number
|
|
668
|
+
target: string
|
|
617
669
|
displays: Array<DesktopDisplay>
|
|
618
670
|
backend: string
|
|
619
671
|
displayServer?: string
|
|
620
|
-
capturePermission: string
|
|
621
|
-
inputPermission: string
|
|
622
672
|
}
|
|
623
673
|
|
|
624
674
|
/**
|
|
@@ -640,25 +690,34 @@ export interface DesktopDisplay {
|
|
|
640
690
|
isPrimary: boolean
|
|
641
691
|
}
|
|
642
692
|
|
|
643
|
-
/** One point in a drag path, in pixels of the preceding screenshot. */
|
|
644
693
|
export interface DesktopPoint {
|
|
645
694
|
x: number
|
|
646
695
|
y: number
|
|
647
696
|
}
|
|
648
697
|
|
|
649
|
-
/** Options for a persistent native desktop session. */
|
|
650
698
|
export interface DesktopSessionOptions {
|
|
699
|
+
display?: string
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/** One capturable top-level window in global logical desktop coordinates. */
|
|
703
|
+
export interface DesktopWindow {
|
|
651
704
|
/**
|
|
652
|
-
*
|
|
653
|
-
*
|
|
705
|
+
* Stable numeric window id, valid as a capture target while the window
|
|
706
|
+
* lives.
|
|
654
707
|
*/
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
|
|
708
|
+
id: string
|
|
709
|
+
/** Window title; may be empty for untitled windows. */
|
|
710
|
+
title: string
|
|
711
|
+
/** Owning application name. */
|
|
712
|
+
app: string
|
|
713
|
+
/** Owning process id when the platform exposes it. */
|
|
714
|
+
pid?: number
|
|
715
|
+
x: number
|
|
716
|
+
y: number
|
|
717
|
+
width: number
|
|
718
|
+
height: number
|
|
719
|
+
/** Whether the window currently holds input focus. */
|
|
720
|
+
focused: boolean
|
|
662
721
|
}
|
|
663
722
|
|
|
664
723
|
/**
|
|
@@ -1517,6 +1576,13 @@ export interface PatchHunk {
|
|
|
1517
1576
|
lines: Array<string>
|
|
1518
1577
|
}
|
|
1519
1578
|
|
|
1579
|
+
export interface PointerOptions {
|
|
1580
|
+
button?: string
|
|
1581
|
+
count?: number
|
|
1582
|
+
modifiers?: Array<string>
|
|
1583
|
+
deliveryMode?: string
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1520
1586
|
/** Current state of a process reference. */
|
|
1521
1587
|
export declare enum ProcessStatus {
|
|
1522
1588
|
/** The referenced process is still running. */
|
package/native/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const nativeBindings = loadNative();
|
|
|
19
19
|
export const AudioCapture = nativeBindings.AudioCapture;
|
|
20
20
|
export const AudioPlayback = nativeBindings.AudioPlayback;
|
|
21
21
|
export const DesktopSession = nativeBindings.DesktopSession;
|
|
22
|
+
export const FileLock = nativeBindings.FileLock;
|
|
22
23
|
export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
|
|
23
24
|
export const MacAppearanceObserver = nativeBindings.MacAppearanceObserver;
|
|
24
25
|
export const MacOSPowerAssertion = nativeBindings.MacOSPowerAssertion;
|
|
@@ -28,7 +29,7 @@ export const Shell = nativeBindings.Shell;
|
|
|
28
29
|
|
|
29
30
|
// functions
|
|
30
31
|
export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
|
|
31
|
-
export const
|
|
32
|
+
export const __piNativesV17_2_6 = nativeBindings.__piNativesV17_2_6;
|
|
32
33
|
export const astEdit = nativeBindings.astEdit;
|
|
33
34
|
export const astGrep = nativeBindings.astGrep;
|
|
34
35
|
export const astMatch = nativeBindings.astMatch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.6",
|
|
4
4
|
"description": "Native Rust bindings for 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",
|
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
"files": [
|
|
57
57
|
"native/index.js",
|
|
58
58
|
"native/index.d.ts",
|
|
59
|
+
"native/clipboard.js",
|
|
60
|
+
"native/clipboard.d.ts",
|
|
59
61
|
"native/desktop.js",
|
|
60
62
|
"native/desktop.d.ts",
|
|
61
63
|
"native/loader-state.js",
|
|
@@ -71,13 +73,17 @@
|
|
|
71
73
|
"./desktop": {
|
|
72
74
|
"types": "./native/desktop.d.ts",
|
|
73
75
|
"import": "./native/desktop.js"
|
|
76
|
+
},
|
|
77
|
+
"./clipboard": {
|
|
78
|
+
"types": "./native/clipboard.d.ts",
|
|
79
|
+
"import": "./native/clipboard.js"
|
|
74
80
|
}
|
|
75
81
|
},
|
|
76
82
|
"optionalDependencies": {
|
|
77
|
-
"@oh-my-pi/pi-natives-linux-x64": "17.2.
|
|
78
|
-
"@oh-my-pi/pi-natives-linux-arm64": "17.2.
|
|
79
|
-
"@oh-my-pi/pi-natives-darwin-x64": "17.2.
|
|
80
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "17.2.
|
|
81
|
-
"@oh-my-pi/pi-natives-win32-x64": "17.2.
|
|
83
|
+
"@oh-my-pi/pi-natives-linux-x64": "17.2.6",
|
|
84
|
+
"@oh-my-pi/pi-natives-linux-arm64": "17.2.6",
|
|
85
|
+
"@oh-my-pi/pi-natives-darwin-x64": "17.2.6",
|
|
86
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "17.2.6",
|
|
87
|
+
"@oh-my-pi/pi-natives-win32-x64": "17.2.6"
|
|
82
88
|
}
|
|
83
89
|
}
|