@oh-my-pi/pi-natives 17.1.0 → 17.1.2
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 +2 -3
- package/native/index.d.ts +187 -1
- package/native/index.js +6 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@ Native Rust functionality via N-API.
|
|
|
7
7
|
- **Grep**: Regex-based search powered by ripgrep's engine with native file walking and matching
|
|
8
8
|
- **Find**: Glob-based file/directory discovery with gitignore support (pure TypeScript via `globPaths`)
|
|
9
9
|
- **SIXEL**: Terminal image encoding for SIXEL-capable terminals (decode, resize, encode in one pass)
|
|
10
|
+
- **Audio**: Cross-platform low-latency microphone capture and gapless speaker playback
|
|
11
|
+
- **WebRTC**: Native Opus media, SDP offer/answer negotiation, and data-channel events for live sessions
|
|
10
12
|
|
|
11
13
|
General-purpose image processing (decode/resize/encode for files and buffers)
|
|
12
14
|
lives in [`Bun.Image`](https://bun.com/docs/runtime/image) on the JS side; this
|
|
@@ -67,9 +69,6 @@ native/ # Core loader files and local/CI native build outputs
|
|
|
67
69
|
npm/<platform>-<arch>/ # Generated at publish time, not committed
|
|
68
70
|
package.json # @oh-my-pi/pi-natives-<platform>-<arch>
|
|
69
71
|
*.node # Only that platform's addon binary or x64 ISA variants
|
|
70
|
-
src/ # TypeScript wrappers and generated declarations source
|
|
71
|
-
native.ts
|
|
72
|
-
index.ts
|
|
73
72
|
```
|
|
74
73
|
|
|
75
74
|
The published core package contains only the JS loader, declarations, README,
|
package/native/index.d.ts
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Default-microphone capture converted to mono `f32` at the requested sample
|
|
5
|
+
* rate.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AudioCapture {
|
|
8
|
+
/** Open the default microphone and deliver low-latency mono PCM chunks. */
|
|
9
|
+
constructor(sampleRate: number, onAudio: (error: Error | null, samples: Float32Array) => void)
|
|
10
|
+
/** Stop capture immediately and release the microphone. */
|
|
11
|
+
stop(): void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Gapless mono `f32` playback through the default speaker. */
|
|
15
|
+
export declare class AudioPlayback {
|
|
16
|
+
/** Open the default speaker at the requested logical sample rate. */
|
|
17
|
+
constructor(sampleRate: number)
|
|
18
|
+
/** Queue mono floating-point PCM in playback order. */
|
|
19
|
+
write(samples: Float32Array): void
|
|
20
|
+
/** Scale audio at render time so gain changes affect already queued samples. */
|
|
21
|
+
setGain(gain: number): void
|
|
22
|
+
/**
|
|
23
|
+
* Close input, wait until queued samples reach the speaker, then release
|
|
24
|
+
* it.
|
|
25
|
+
*/
|
|
26
|
+
end(): Promise<void>
|
|
27
|
+
/** Stop immediately and discard all queued samples. */
|
|
28
|
+
stop(): void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Persistent, serialized native desktop capture/input session. */
|
|
32
|
+
export declare class DesktopSession {
|
|
33
|
+
constructor(options?: DesktopSessionOptions | undefined | null)
|
|
34
|
+
/** Current backend capability and permission state. */
|
|
35
|
+
get capabilities(): DesktopCapabilities
|
|
36
|
+
/** Capture a fresh PNG composite of the selected display(s). */
|
|
37
|
+
capture(): Promise<DesktopCapture>
|
|
38
|
+
/**
|
|
39
|
+
* Execute a validated action batch in order, then return a fresh
|
|
40
|
+
* screenshot.
|
|
41
|
+
*/
|
|
42
|
+
execute(actions: Array<DesktopAction>): Promise<DesktopCapture>
|
|
43
|
+
/** Close the worker and native platform connections. Idempotent and bounded. */
|
|
44
|
+
close(): Promise<undefined>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** WebRTC peer that accepts 16 kHz mono PCM and renders remote Opus audio. */
|
|
48
|
+
export declare class LiveWebRtcPeer {
|
|
49
|
+
/**
|
|
50
|
+
* Create an idle peer and register its event, output-level, and failure
|
|
51
|
+
* callbacks.
|
|
52
|
+
*/
|
|
53
|
+
constructor(onEvent: (error: Error | null, payload: string) => void, onLevel: (error: Error | null, level: number) => void, onFailure: (error: Error | null, message: string) => void)
|
|
54
|
+
/** Start the native media peer and return its SDP offer. */
|
|
55
|
+
createOffer(): Promise<string>
|
|
56
|
+
/** Apply the remote SDP answer returned by Codex signaling. */
|
|
57
|
+
acceptAnswer(sdp: string): Promise<void>
|
|
58
|
+
/** Wait until the `oai-events` data channel is open. */
|
|
59
|
+
waitForOpen(timeoutMs?: number | undefined | null): Promise<void>
|
|
60
|
+
/** Queue 16 kHz mono floating-point PCM for Opus transmission. */
|
|
61
|
+
pushAudio(samples: Float32Array): void
|
|
62
|
+
/**
|
|
63
|
+
* Enable or disable microphone transmission, discarding partial muted
|
|
64
|
+
* frames.
|
|
65
|
+
*/
|
|
66
|
+
setMuted(muted: boolean): void
|
|
67
|
+
/** Close media, the data channel, the peer connection, and speaker playback. */
|
|
68
|
+
close(): Promise<void>
|
|
69
|
+
}
|
|
70
|
+
|
|
3
71
|
/**
|
|
4
72
|
* Long-lived macOS appearance observer.
|
|
5
73
|
*
|
|
@@ -178,7 +246,7 @@ export declare function __ompInstallTokioRuntime(): void
|
|
|
178
246
|
* `packages/natives/native/index.js` (which derives the name from
|
|
179
247
|
* `package.json#version`).
|
|
180
248
|
*/
|
|
181
|
-
export declare function
|
|
249
|
+
export declare function __piNativesV17_1_2(): void
|
|
182
250
|
|
|
183
251
|
/**
|
|
184
252
|
* Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
|
|
@@ -495,12 +563,130 @@ export declare function cosineSimilarityPairs(vectors: Float64Array, count: numb
|
|
|
495
563
|
*/
|
|
496
564
|
export declare function countTokens(input: string | Array<string>, encoding?: Encoding | undefined | null): number
|
|
497
565
|
|
|
566
|
+
/**
|
|
567
|
+
* One `OpenAI` GA computer action.
|
|
568
|
+
*
|
|
569
|
+
* This is an optional-field carrier because napi-rs object generation cannot
|
|
570
|
+
* emit TypeScript discriminated unions. Native validation enforces the exact
|
|
571
|
+
* fields required and allowed by each `type` before any input is emitted.
|
|
572
|
+
*/
|
|
573
|
+
export interface DesktopAction {
|
|
574
|
+
type: string
|
|
575
|
+
x?: number
|
|
576
|
+
y?: number
|
|
577
|
+
button?: string
|
|
578
|
+
path?: Array<DesktopPoint>
|
|
579
|
+
keys?: Array<string>
|
|
580
|
+
scroll_x?: number
|
|
581
|
+
scroll_y?: number
|
|
582
|
+
text?: string
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/** Native desktop backend and permission state. */
|
|
586
|
+
export interface DesktopCapabilities {
|
|
587
|
+
/**
|
|
588
|
+
* Concrete selected backend: `quartz`, `x11`, `wayland`, `win32`, or
|
|
589
|
+
* `unavailable`.
|
|
590
|
+
*/
|
|
591
|
+
backend: string
|
|
592
|
+
/** OS display-server endpoint or subsystem label. */
|
|
593
|
+
displayServer?: string
|
|
594
|
+
/** Whether screen capture is currently usable. */
|
|
595
|
+
capture: boolean
|
|
596
|
+
/** Whether native input is currently usable. */
|
|
597
|
+
input: boolean
|
|
598
|
+
/** `granted`, `denied`, `unknown`, or `unavailable`. */
|
|
599
|
+
capturePermission: string
|
|
600
|
+
/** `granted`, `denied`, `unknown`, or `unavailable`. */
|
|
601
|
+
inputPermission: string
|
|
602
|
+
/** Number of selected displays observed by the most recent successful probe. */
|
|
603
|
+
displayCount: number
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* A PNG composite and the exact geometry needed to map its pixels back to the
|
|
608
|
+
* global logical desktop.
|
|
609
|
+
*/
|
|
610
|
+
export interface DesktopCapture {
|
|
611
|
+
data: Uint8Array
|
|
612
|
+
width: number
|
|
613
|
+
height: number
|
|
614
|
+
displays: Array<DesktopDisplay>
|
|
615
|
+
backend: string
|
|
616
|
+
displayServer?: string
|
|
617
|
+
capturePermission: string
|
|
618
|
+
inputPermission: string
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Monitor geometry in both global logical desktop coordinates and composite
|
|
623
|
+
* screenshot pixels.
|
|
624
|
+
*/
|
|
625
|
+
export interface DesktopDisplay {
|
|
626
|
+
id: string
|
|
627
|
+
name: string
|
|
628
|
+
x: number
|
|
629
|
+
y: number
|
|
630
|
+
width: number
|
|
631
|
+
height: number
|
|
632
|
+
scale: number
|
|
633
|
+
pixelX: number
|
|
634
|
+
pixelY: number
|
|
635
|
+
pixelWidth: number
|
|
636
|
+
pixelHeight: number
|
|
637
|
+
isPrimary: boolean
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/** One point in a drag path, in pixels of the preceding screenshot. */
|
|
641
|
+
export interface DesktopPoint {
|
|
642
|
+
x: number
|
|
643
|
+
y: number
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/** Options for a persistent native desktop session. */
|
|
647
|
+
export interface DesktopSessionOptions {
|
|
648
|
+
/**
|
|
649
|
+
* Backend preference. `auto` and `native` both prohibit non-native
|
|
650
|
+
* fallback.
|
|
651
|
+
*/
|
|
652
|
+
backend?: string
|
|
653
|
+
/** `all` or a monitor id returned in `DesktopDisplay.id`. */
|
|
654
|
+
display?: string
|
|
655
|
+
/** Maximum composite screenshot width in pixels. */
|
|
656
|
+
maxWidth?: number
|
|
657
|
+
/** Maximum composite screenshot height in pixels. */
|
|
658
|
+
maxHeight?: number
|
|
659
|
+
}
|
|
660
|
+
|
|
498
661
|
/**
|
|
499
662
|
* Detect macOS system appearance via CoreFoundation.
|
|
500
663
|
* Returns `"dark"` or `"light"` on macOS, `null` on other platforms.
|
|
501
664
|
*/
|
|
502
665
|
export declare function detectMacOSAppearance(): MacOSAppearance | null
|
|
503
666
|
|
|
667
|
+
/**
|
|
668
|
+
* Generate an Apple `DeviceCheck` attestation token.
|
|
669
|
+
*
|
|
670
|
+
* Resolves with the token (or the error reason) after at most a 1-second
|
|
671
|
+
* wait, matching the upstream `devicecheck.node` addon contract.
|
|
672
|
+
*/
|
|
673
|
+
export declare function deviceCheckGenerateToken(): Promise<DeviceCheckTokenResult>
|
|
674
|
+
|
|
675
|
+
/** Outcome of a single `DCDevice.generateToken` request. */
|
|
676
|
+
export interface DeviceCheckTokenResult {
|
|
677
|
+
/** Whether `DCDevice.isSupported` reported attestation support. */
|
|
678
|
+
supported: boolean
|
|
679
|
+
/**
|
|
680
|
+
* Base64-encoded `DeviceCheck` token; present only when generation
|
|
681
|
+
* succeeded.
|
|
682
|
+
*/
|
|
683
|
+
tokenBase64?: string
|
|
684
|
+
/** Human-readable failure reason when no token was produced. */
|
|
685
|
+
error?: string
|
|
686
|
+
/** Wall-clock time spent in the native call, in milliseconds. */
|
|
687
|
+
latencyMs: number
|
|
688
|
+
}
|
|
689
|
+
|
|
504
690
|
/** One jsdiff change object: a run of added, removed, or common tokens. */
|
|
505
691
|
export interface DiffChange {
|
|
506
692
|
/** Joined token text for this run (lines keep their `
|
package/native/index.js
CHANGED
|
@@ -16,6 +16,10 @@ import { loadNative } from "./loader-state.js";
|
|
|
16
16
|
const nativeBindings = loadNative();
|
|
17
17
|
// --- generated native exports (do not edit) ---
|
|
18
18
|
// classes
|
|
19
|
+
export const AudioCapture = nativeBindings.AudioCapture;
|
|
20
|
+
export const AudioPlayback = nativeBindings.AudioPlayback;
|
|
21
|
+
export const DesktopSession = nativeBindings.DesktopSession;
|
|
22
|
+
export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
|
|
19
23
|
export const MacAppearanceObserver = nativeBindings.MacAppearanceObserver;
|
|
20
24
|
export const MacOSPowerAssertion = nativeBindings.MacOSPowerAssertion;
|
|
21
25
|
export const Process = nativeBindings.Process;
|
|
@@ -24,7 +28,7 @@ export const Shell = nativeBindings.Shell;
|
|
|
24
28
|
|
|
25
29
|
// functions
|
|
26
30
|
export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
|
|
27
|
-
export const
|
|
31
|
+
export const __piNativesV17_1_2 = nativeBindings.__piNativesV17_1_2;
|
|
28
32
|
export const astEdit = nativeBindings.astEdit;
|
|
29
33
|
export const astGrep = nativeBindings.astGrep;
|
|
30
34
|
export const astMatch = nativeBindings.astMatch;
|
|
@@ -33,6 +37,7 @@ export const copyToClipboard = nativeBindings.copyToClipboard;
|
|
|
33
37
|
export const cosineSimilarityPairs = nativeBindings.cosineSimilarityPairs;
|
|
34
38
|
export const countTokens = nativeBindings.countTokens;
|
|
35
39
|
export const detectMacOSAppearance = nativeBindings.detectMacOSAppearance;
|
|
40
|
+
export const deviceCheckGenerateToken = nativeBindings.deviceCheckGenerateToken;
|
|
36
41
|
export const diffLineRuns = nativeBindings.diffLineRuns;
|
|
37
42
|
export const diffLines = nativeBindings.diffLines;
|
|
38
43
|
export const diffWords = nativeBindings.diffWords;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "17.1.
|
|
4
|
-
"description": "Native Rust bindings for grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
|
|
3
|
+
"version": "17.1.2",
|
|
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",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
|
-
"@oh-my-pi/pi-natives-linux-x64": "17.1.
|
|
71
|
-
"@oh-my-pi/pi-natives-linux-arm64": "17.1.
|
|
72
|
-
"@oh-my-pi/pi-natives-darwin-x64": "17.1.
|
|
73
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "17.1.
|
|
74
|
-
"@oh-my-pi/pi-natives-win32-x64": "17.1.
|
|
70
|
+
"@oh-my-pi/pi-natives-linux-x64": "17.1.2",
|
|
71
|
+
"@oh-my-pi/pi-natives-linux-arm64": "17.1.2",
|
|
72
|
+
"@oh-my-pi/pi-natives-darwin-x64": "17.1.2",
|
|
73
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "17.1.2",
|
|
74
|
+
"@oh-my-pi/pi-natives-win32-x64": "17.1.2"
|
|
75
75
|
}
|
|
76
76
|
}
|