@linxiraos/pi-natives 1.1.26 → 1.2.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 +11 -4
- package/native/desktop-adapter.d.ts +3 -27
- package/native/desktop-adapter.js +32 -400
- package/native/embedded-addon.js +4 -13
- package/native/index.d.ts +295 -20
- package/native/index.js +6 -0
- package/native/loader-state.d.ts +8 -12
- package/native/loader-state.js +36 -111
- package/native/vcs.d.ts +6 -0
- package/native/vcs.js +14 -0
- package/native/version-sentinel.js +1 -5
- package/package.json +7 -9
package/native/index.d.ts
CHANGED
|
@@ -31,10 +31,47 @@ export declare class AudioPlayback {
|
|
|
31
31
|
/** Persistent, serialized native desktop capture/input/accessibility session. */
|
|
32
32
|
export declare class DesktopSession {
|
|
33
33
|
constructor(options?: DesktopSessionOptions | undefined | null)
|
|
34
|
+
/**
|
|
35
|
+
* Asks the worker when it is idle, so permissions are read live. While
|
|
36
|
+
* another operation holds the worker, answers from the snapshot of the
|
|
37
|
+
* latest capabilities read or capture instead of blocking the JS thread
|
|
38
|
+
* behind it.
|
|
39
|
+
*/
|
|
34
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
|
|
35
46
|
listDisplays(): Promise<Array<DesktopDisplay>>
|
|
36
47
|
listWindows(): Promise<Array<DesktopWindow>>
|
|
48
|
+
listApplications(options?: ApplicationQuery | undefined | null): Promise<Array<Application>>
|
|
49
|
+
openApplication(id: string, options?: ApplicationOpenOptions | undefined | null): Promise<Application>
|
|
50
|
+
/**
|
|
51
|
+
* Capture and accessibility share one serialized request. Neither a failed
|
|
52
|
+
* snapshot nor an abandoned reply replaces the last delivered input frame.
|
|
53
|
+
*/
|
|
54
|
+
observe(target: string, caps?: CaptureCaps | undefined | null, axOptions?: AxSnapshotOptions | undefined | null): Promise<DesktopObservation>
|
|
55
|
+
menuItems(target: string, path?: Array<string> | undefined | null): Promise<Array<DesktopMenuItem>>
|
|
56
|
+
menuSelect(target: string, path: Array<string>): Promise<undefined>
|
|
57
|
+
bringToCurrentSpace(windowId: string): Promise<undefined>
|
|
58
|
+
holdKeys(target: string, keys: Array<string>, options: HoldOptions): Promise<undefined>
|
|
59
|
+
holdMouse(target: string, x: number, y: number, options: HoldOptions): Promise<undefined>
|
|
60
|
+
/**
|
|
61
|
+
* Native ownership only. Human approval is required by the host before
|
|
62
|
+
* calling this method.
|
|
63
|
+
*/
|
|
64
|
+
acquireControl(): Promise<DesktopControlState>
|
|
65
|
+
releaseControl(): void
|
|
66
|
+
controlState(): DesktopControlState
|
|
67
|
+
/** Retire queued work from a completed helper without revoking task control. */
|
|
68
|
+
retire(): void
|
|
37
69
|
capture(target: string, caps?: CaptureCaps | undefined | null): Promise<DesktopCapture>
|
|
70
|
+
/**
|
|
71
|
+
* Capture a fresh native-detail region without replacing the full input
|
|
72
|
+
* coordinate frame.
|
|
73
|
+
*/
|
|
74
|
+
captureRegion(target: string, region: CaptureRegion, caps?: CaptureCaps | undefined | null): Promise<DesktopCapture>
|
|
38
75
|
click(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
39
76
|
moveMouse(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
40
77
|
drag(target: string, path: Array<DesktopPoint>, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
@@ -58,6 +95,11 @@ export declare class DesktopSession {
|
|
|
58
95
|
axSetValue(reference: string, value: string): Promise<undefined>
|
|
59
96
|
axFocus(reference: string): Promise<undefined>
|
|
60
97
|
axClick(reference: string, opts?: PointerOptions | undefined | null): Promise<undefined>
|
|
98
|
+
/**
|
|
99
|
+
* Immediately cancel operations submitted before this call. Later
|
|
100
|
+
* operations may proceed.
|
|
101
|
+
*/
|
|
102
|
+
cancel(): void
|
|
61
103
|
close(): Promise<undefined>
|
|
62
104
|
}
|
|
63
105
|
|
|
@@ -693,6 +735,13 @@ export declare class VcsRepo {
|
|
|
693
735
|
*/
|
|
694
736
|
export declare function __ompInstallTokioRuntime(): void
|
|
695
737
|
|
|
738
|
+
/**
|
|
739
|
+
* Points the addon at the directory holding downloaded wasm grammars
|
|
740
|
+
* (`<dir>/<file>`). The loader (`native/loader-state.js`) calls this once
|
|
741
|
+
* with `<natives dir>/grammars`; grammars then load lazily from it.
|
|
742
|
+
*/
|
|
743
|
+
export declare function __ompSetGrammarDir(dir: string): void
|
|
744
|
+
|
|
696
745
|
/**
|
|
697
746
|
* Release version stamped into this `.node` after linking.
|
|
698
747
|
*
|
|
@@ -722,6 +771,38 @@ export declare function appleFmCancel(handle: number): void
|
|
|
722
771
|
*/
|
|
723
772
|
export declare function appleFmGenerate(request: string, onEvent: (err: null | Error, event: string) => void): number
|
|
724
773
|
|
|
774
|
+
/**
|
|
775
|
+
* Installed application identity with currently observable process
|
|
776
|
+
* information.
|
|
777
|
+
*/
|
|
778
|
+
export interface Application {
|
|
779
|
+
id: string
|
|
780
|
+
name: string
|
|
781
|
+
path: string
|
|
782
|
+
running: boolean
|
|
783
|
+
pid?: number
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/** Controls whether launching an application deliberately activates it. */
|
|
787
|
+
export interface ApplicationOpenOptions {
|
|
788
|
+
activate?: boolean
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/** Filters the native application inventory without requiring screen access. */
|
|
792
|
+
export interface ApplicationQuery {
|
|
793
|
+
query?: string
|
|
794
|
+
runningOnly?: boolean
|
|
795
|
+
}
|
|
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
|
+
|
|
725
806
|
/**
|
|
726
807
|
* Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
|
|
727
808
|
* a promise.
|
|
@@ -803,6 +884,11 @@ export interface AstFindResult {
|
|
|
803
884
|
limitReached: boolean
|
|
804
885
|
/** Non-fatal parse or pattern errors collected during the run. */
|
|
805
886
|
parseErrors?: Array<string>
|
|
887
|
+
/**
|
|
888
|
+
* Languages whose on-demand grammar is not installed; their files were
|
|
889
|
+
* skipped (see `wasmGrammarFor`).
|
|
890
|
+
*/
|
|
891
|
+
missingGrammars?: Array<string>
|
|
806
892
|
}
|
|
807
893
|
|
|
808
894
|
/**
|
|
@@ -975,6 +1061,11 @@ export interface AstReplaceResult {
|
|
|
975
1061
|
limitReached: boolean
|
|
976
1062
|
/** Parse or pattern errors when not failing the whole operation. */
|
|
977
1063
|
parseErrors?: Array<string>
|
|
1064
|
+
/**
|
|
1065
|
+
* Languages whose on-demand grammar is not installed; their files were
|
|
1066
|
+
* skipped (see `wasmGrammarFor`).
|
|
1067
|
+
*/
|
|
1068
|
+
missingGrammars?: Array<string>
|
|
978
1069
|
}
|
|
979
1070
|
|
|
980
1071
|
export interface AxNode {
|
|
@@ -1013,6 +1104,15 @@ export interface AxSnapshotOptions {
|
|
|
1013
1104
|
all?: boolean
|
|
1014
1105
|
}
|
|
1015
1106
|
|
|
1107
|
+
export interface BlockParseOptions {
|
|
1108
|
+
/** Source code to parse. */
|
|
1109
|
+
code: string
|
|
1110
|
+
/** Language alias (e.g. "rust", "typescript") used before path inference. */
|
|
1111
|
+
lang?: string
|
|
1112
|
+
/** File path used to infer language by extension when `lang` is omitted. */
|
|
1113
|
+
path?: string
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1016
1116
|
export interface BlockRange {
|
|
1017
1117
|
/** 1-indexed inclusive first line of the resolved block. */
|
|
1018
1118
|
startLine: number
|
|
@@ -1045,6 +1145,14 @@ export interface CaptureCaps {
|
|
|
1045
1145
|
maxHeight?: number
|
|
1046
1146
|
}
|
|
1047
1147
|
|
|
1148
|
+
/** Rectangle in pixels of the most recent full screenshot of the same target. */
|
|
1149
|
+
export interface CaptureRegion {
|
|
1150
|
+
x: number
|
|
1151
|
+
y: number
|
|
1152
|
+
width: number
|
|
1153
|
+
height: number
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1048
1156
|
/** Clipboard image payload encoded as PNG bytes. */
|
|
1049
1157
|
export interface ClipboardImage {
|
|
1050
1158
|
/** PNG-encoded image bytes. */
|
|
@@ -1100,7 +1208,7 @@ export declare function cosineSimilarityPairs(vectors: Float64Array, count: numb
|
|
|
1100
1208
|
export declare function countTokens(input: string | string[], encoding?: Encoding | undefined | null): number
|
|
1101
1209
|
|
|
1102
1210
|
/**
|
|
1103
|
-
* Decode one complete SIXEL control string into a PNG.
|
|
1211
|
+
* Decode one complete SIXEL control string into a PNG on the calling thread.
|
|
1104
1212
|
*
|
|
1105
1213
|
* The decoder is deliberately bounded before handing the stream to
|
|
1106
1214
|
* `icy_sixel`: raster declarations, repeats, and row advances are scanned
|
|
@@ -1109,6 +1217,12 @@ export declare function countTokens(input: string | string[], encoding?: Encodin
|
|
|
1109
1217
|
*/
|
|
1110
1218
|
export declare function decodeSixelToPng(bytes: Uint8Array): Uint8Array
|
|
1111
1219
|
|
|
1220
|
+
/**
|
|
1221
|
+
* Same result as [`decode_sixel_to_png`], but the decode runs on the native
|
|
1222
|
+
* blocking pool instead of the JS thread.
|
|
1223
|
+
*/
|
|
1224
|
+
export declare function decodeSixelToPngAsync(bytes: Uint8Array): Promise<Uint8Array>
|
|
1225
|
+
|
|
1112
1226
|
export interface DesktopCapabilities {
|
|
1113
1227
|
backend: string
|
|
1114
1228
|
displayServer?: string
|
|
@@ -1121,10 +1235,29 @@ export interface DesktopCapabilities {
|
|
|
1121
1235
|
* target and post real input).
|
|
1122
1236
|
*/
|
|
1123
1237
|
takeover: boolean
|
|
1238
|
+
applications: boolean
|
|
1239
|
+
menus: boolean
|
|
1240
|
+
heldInput: boolean
|
|
1241
|
+
spaces: boolean
|
|
1242
|
+
/**
|
|
1243
|
+
* Native global Escape cancellation while input/control ownership is held.
|
|
1244
|
+
* Wayland requires the host interrupt action instead.
|
|
1245
|
+
*/
|
|
1246
|
+
globalEscape: boolean
|
|
1124
1247
|
capturePermission: string
|
|
1125
1248
|
inputPermission: string
|
|
1126
1249
|
axPermission: string
|
|
1127
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
|
|
1128
1261
|
}
|
|
1129
1262
|
|
|
1130
1263
|
export interface DesktopCapture {
|
|
@@ -1138,10 +1271,28 @@ export interface DesktopCapture {
|
|
|
1138
1271
|
* unscaled.
|
|
1139
1272
|
*/
|
|
1140
1273
|
sourceHeight: number
|
|
1274
|
+
/** Dimensions of the full screenshot coordinate frame used by pointer input. */
|
|
1275
|
+
coordinateWidth: number
|
|
1276
|
+
coordinateHeight: number
|
|
1277
|
+
/**
|
|
1278
|
+
* Region in the full screenshot's coordinates; zoom pixels are not input
|
|
1279
|
+
* coordinates.
|
|
1280
|
+
*/
|
|
1281
|
+
region?: CaptureRegion
|
|
1141
1282
|
target: string
|
|
1142
1283
|
displays: Array<DesktopDisplay>
|
|
1143
1284
|
backend: string
|
|
1144
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
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
export interface DesktopControlState {
|
|
1295
|
+
active: boolean
|
|
1145
1296
|
}
|
|
1146
1297
|
|
|
1147
1298
|
/**
|
|
@@ -1163,11 +1314,38 @@ export interface DesktopDisplay {
|
|
|
1163
1314
|
isPrimary: boolean
|
|
1164
1315
|
}
|
|
1165
1316
|
|
|
1317
|
+
/**
|
|
1318
|
+
* One immediate child of a native application menu. Paths contain the actual
|
|
1319
|
+
* native labels, including ellipses; selection accepts normalized labels.
|
|
1320
|
+
*/
|
|
1321
|
+
export interface DesktopMenuItem {
|
|
1322
|
+
title: string
|
|
1323
|
+
path: Array<string>
|
|
1324
|
+
enabled: boolean
|
|
1325
|
+
checked: boolean
|
|
1326
|
+
hasSubmenu: boolean
|
|
1327
|
+
shortcut?: string
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
export interface DesktopObservation {
|
|
1331
|
+
capture: DesktopCapture
|
|
1332
|
+
accessibility: AxSnapshot
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1166
1335
|
export interface DesktopPoint {
|
|
1167
1336
|
x: number
|
|
1168
1337
|
y: number
|
|
1169
1338
|
}
|
|
1170
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
|
+
|
|
1171
1349
|
export interface DesktopSessionOptions {
|
|
1172
1350
|
display?: string
|
|
1173
1351
|
}
|
|
@@ -1520,16 +1698,27 @@ export interface EnclosingBoundaryOptions {
|
|
|
1520
1698
|
}
|
|
1521
1699
|
|
|
1522
1700
|
/**
|
|
1523
|
-
* Encode image bytes into a SIXEL escape sequence for terminal rendering
|
|
1701
|
+
* Encode image bytes into a SIXEL escape sequence for terminal rendering, on
|
|
1702
|
+
* the calling thread.
|
|
1524
1703
|
*
|
|
1525
1704
|
* The input image is decoded and resized to the requested pixel dimensions
|
|
1526
|
-
* before encoding.
|
|
1705
|
+
* before encoding. Prefer [`encode_sixel_async`] unless the caller cannot
|
|
1706
|
+
* wait: the decode, resize and dither block the JS thread.
|
|
1527
1707
|
*
|
|
1528
1708
|
* # Errors
|
|
1529
1709
|
* Returns an error if decoding, resizing, or SIXEL encoding fails.
|
|
1530
1710
|
*/
|
|
1531
1711
|
export declare function encodeSixel(bytes: Uint8Array, targetWidthPx: number, targetHeightPx: number): string
|
|
1532
1712
|
|
|
1713
|
+
/**
|
|
1714
|
+
* Same result as [`encode_sixel`], but the decode, resize and dither run on
|
|
1715
|
+
* the native blocking pool, so they never stall the JavaScript event loop.
|
|
1716
|
+
*
|
|
1717
|
+
* # Errors
|
|
1718
|
+
* Rejects if decoding, resizing, or SIXEL encoding fails.
|
|
1719
|
+
*/
|
|
1720
|
+
export declare function encodeSixelAsync(bytes: Uint8Array, targetWidthPx: number, targetHeightPx: number): Promise<string>
|
|
1721
|
+
|
|
1533
1722
|
/** Tokenizer encoding to use. */
|
|
1534
1723
|
export declare enum Encoding {
|
|
1535
1724
|
/** GPT-4o / o1 / GPT-5 (default). */
|
|
@@ -1775,6 +1964,11 @@ export interface GrepMatch {
|
|
|
1775
1964
|
contextAfter?: Array<ContextLine>
|
|
1776
1965
|
/** Whether the line was truncated. */
|
|
1777
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
|
|
1778
1972
|
/** Per-file match count (count mode only). */
|
|
1779
1973
|
matchCount?: number
|
|
1780
1974
|
}
|
|
@@ -1957,6 +2151,14 @@ export interface HighlightColors {
|
|
|
1957
2151
|
deleted?: string
|
|
1958
2152
|
}
|
|
1959
2153
|
|
|
2154
|
+
export interface HoldOptions {
|
|
2155
|
+
/** Duration in seconds, from zero through 100. */
|
|
2156
|
+
duration: number
|
|
2157
|
+
button?: string
|
|
2158
|
+
keys?: Array<string>
|
|
2159
|
+
takeover?: boolean
|
|
2160
|
+
}
|
|
2161
|
+
|
|
1960
2162
|
/**
|
|
1961
2163
|
* Convert HTML source to Markdown with optional preprocessing.
|
|
1962
2164
|
*
|
|
@@ -2066,10 +2268,13 @@ export interface IsoProbeResult {
|
|
|
2066
2268
|
}
|
|
2067
2269
|
|
|
2068
2270
|
/**
|
|
2069
|
-
* Pick the best backend available right now.
|
|
2070
|
-
*
|
|
2271
|
+
* Pick the best backend available right now.
|
|
2272
|
+
*
|
|
2273
|
+
* `preferred` is treated as a hint — see [`pi_iso::resolve`] for the exact
|
|
2274
|
+
* priority rules. Backend probes may spawn CLIs, so they run on the native
|
|
2275
|
+
* blocking pool.
|
|
2071
2276
|
*/
|
|
2072
|
-
export declare function isoResolve(preferred?: IsoBackendKind | undefined | null): IsoResolveResult
|
|
2277
|
+
export declare function isoResolve(preferred?: IsoBackendKind | undefined | null): Promise<IsoResolveResult>
|
|
2073
2278
|
|
|
2074
2279
|
/** Outcome of [`iso_resolve`]. */
|
|
2075
2280
|
export interface IsoResolveResult {
|
|
@@ -2207,6 +2412,11 @@ export interface Match {
|
|
|
2207
2412
|
contextAfter?: Array<ContextLine>
|
|
2208
2413
|
/** Whether the line was truncated. */
|
|
2209
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
|
|
2210
2420
|
}
|
|
2211
2421
|
|
|
2212
2422
|
/**
|
|
@@ -2457,6 +2667,8 @@ export interface PointerOptions {
|
|
|
2457
2667
|
button?: string
|
|
2458
2668
|
count?: number
|
|
2459
2669
|
modifiers?: Array<string>
|
|
2670
|
+
/** Arbitrary keys held for the duration of a drag. */
|
|
2671
|
+
keys?: Array<string>
|
|
2460
2672
|
/**
|
|
2461
2673
|
* Briefly activate the target window and post real input instead of the
|
|
2462
2674
|
* default background delivery.
|
|
@@ -2583,14 +2795,23 @@ export interface PtyStartOptions {
|
|
|
2583
2795
|
/**
|
|
2584
2796
|
* Rasterize SVG/SVGZ bytes into a bounded PNG without resolving local files.
|
|
2585
2797
|
*
|
|
2586
|
-
*
|
|
2587
|
-
*
|
|
2798
|
+
* The image is drawn at `scale` times the SVG's intrinsic size (default 1;
|
|
2799
|
+
* above 1 renders vector content crisply at display resolution), then shrunk
|
|
2800
|
+
* as needed to fit `max_width_px` x `max_height_px` with its aspect ratio
|
|
2801
|
+
* kept. Conversion runs on the native blocking pool so parsing and rendering
|
|
2802
|
+
* do not stall the JavaScript event loop.
|
|
2803
|
+
*
|
|
2804
|
+
* With `cell`, the limits round down to whole cells and the canvas pads with
|
|
2805
|
+
* transparency, right and bottom, to whole cells: a terminal placing the PNG
|
|
2806
|
+
* over `width / cell.width_px` columns and `height / cell.height_px` rows
|
|
2807
|
+
* shows it 1:1 instead of resampling it.
|
|
2588
2808
|
*
|
|
2589
2809
|
* # Errors
|
|
2590
|
-
* Returns an error for invalid SVG data, zero/oversized limits,
|
|
2591
|
-
* failure, or PNG
|
|
2810
|
+
* Returns an error for invalid SVG data, zero/oversized limits, a zero cell
|
|
2811
|
+
* size, a scale that is not finite and positive, allocation failure, or PNG
|
|
2812
|
+
* encoding failure.
|
|
2592
2813
|
*/
|
|
2593
|
-
export declare function rasterizeSvg(input: Uint8Array, maxWidthPx: number, maxHeightPx: number): Promise<Uint8Array>
|
|
2814
|
+
export declare function rasterizeSvg(input: Uint8Array, maxWidthPx: number, maxHeightPx: number, scale?: number | undefined | null, cell?: SvgCell | undefined | null): Promise<Uint8Array>
|
|
2594
2815
|
|
|
2595
2816
|
/**
|
|
2596
2817
|
* Read an image from the system clipboard.
|
|
@@ -2627,10 +2848,11 @@ export declare function renderMermaidAscii(text: string, options?: MermaidRender
|
|
|
2627
2848
|
* Render one snapcompact frame on a libuv worker: print pre-normalized text
|
|
2628
2849
|
* onto a `size`-wide bitmap and encode it as PNG.
|
|
2629
2850
|
*
|
|
2630
|
-
* The bitmap height hugs the rows the text
|
|
2631
|
-
* (`usedRows * lineRepeat * cellHeight`),
|
|
2632
|
-
*
|
|
2633
|
-
* floor(size/cellHeight/lineRepeat)` characters;
|
|
2851
|
+
* The bitmap height hugs the rows the text occupies
|
|
2852
|
+
* (`usedRows * lineRepeat * cellHeight`), with a 64px floor for vision
|
|
2853
|
+
* processors that reject smaller dimensions. The glyph grid holds
|
|
2854
|
+
* `floor(size/cellWidth) * floor(size/cellHeight/lineRepeat)` characters;
|
|
2855
|
+
* input beyond that is ignored.
|
|
2634
2856
|
* Native-cell bitmap-font shapes encode as indexed PNG; stretched bitmap-font
|
|
2635
2857
|
* shapes (target cell != font cell) encode as RGB. TrueType shapes encode RGB
|
|
2636
2858
|
* directly from grayscale coverage.
|
|
@@ -3108,8 +3330,8 @@ export declare function sliceWithWidth(line: string, startCol: number, length: n
|
|
|
3108
3330
|
export interface SnapcompactRenderOptions {
|
|
3109
3331
|
/**
|
|
3110
3332
|
* Frame width in pixels; also bounds the grid rows
|
|
3111
|
-
* (`floor(size/cellHeight/lineRepeat)`). Output height hugs the rows
|
|
3112
|
-
*
|
|
3333
|
+
* (`floor(size/cellHeight/lineRepeat)`). Output height hugs the used rows
|
|
3334
|
+
* with a 64px floor, rather than padding every frame to a square.
|
|
3113
3335
|
*/
|
|
3114
3336
|
size: number
|
|
3115
3337
|
/**
|
|
@@ -3237,12 +3459,20 @@ export interface SummarySegment {
|
|
|
3237
3459
|
}
|
|
3238
3460
|
|
|
3239
3461
|
/**
|
|
3240
|
-
* Check if a language
|
|
3241
|
-
*
|
|
3242
|
-
* 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.
|
|
3243
3464
|
*/
|
|
3244
3465
|
export declare function supportsLanguage(lang: string): boolean
|
|
3245
3466
|
|
|
3467
|
+
/**
|
|
3468
|
+
* Terminal cell size in device pixels, for [`rasterize_svg`] canvases a
|
|
3469
|
+
* terminal shows over whole cells.
|
|
3470
|
+
*/
|
|
3471
|
+
export interface SvgCell {
|
|
3472
|
+
widthPx: number
|
|
3473
|
+
heightPx: number
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3246
3476
|
/** Options for [`TextPredictor::new`]. */
|
|
3247
3477
|
export interface TextPredictorOptions {
|
|
3248
3478
|
/** Engine: `ngram`, `smollm`, or `apple`. */
|
|
@@ -3496,12 +3726,57 @@ export interface VectorTopK {
|
|
|
3496
3726
|
*/
|
|
3497
3727
|
export declare function visibleWidth(text: string, tabWidth: number): number
|
|
3498
3728
|
|
|
3729
|
+
/**
|
|
3730
|
+
* Parse `options.code` into the shared tree cache on the native blocking
|
|
3731
|
+
* pool.
|
|
3732
|
+
*
|
|
3733
|
+
* [`enclosing_block_boundaries`], [`block_range_at`] and [`node_chain_at`]
|
|
3734
|
+
* are synchronous and parse on the JS thread when their source is not
|
|
3735
|
+
* cached; awaiting this first makes that parse a cache hit. Resolves without
|
|
3736
|
+
* parsing when the language is unrecognized or the source is too large for
|
|
3737
|
+
* the cache to keep.
|
|
3738
|
+
*/
|
|
3739
|
+
export declare function warmBlockParse(options: BlockParseOptions): Promise<undefined>
|
|
3740
|
+
|
|
3499
3741
|
/**
|
|
3500
3742
|
* Warm syntax grammars, scope matchers, and the regexes of commonly
|
|
3501
3743
|
* highlighted languages on the native worker pool.
|
|
3502
3744
|
*/
|
|
3503
3745
|
export declare function warmHighlighter(): Promise<undefined>
|
|
3504
3746
|
|
|
3747
|
+
/**
|
|
3748
|
+
* Wasm grammar backing `lang` (alias) or the language of `path`; `null` for
|
|
3749
|
+
* built-in or unknown languages.
|
|
3750
|
+
*/
|
|
3751
|
+
export declare function wasmGrammarFor(query: WasmGrammarQuery): WasmGrammarInfo | null
|
|
3752
|
+
|
|
3753
|
+
/** A grammar the host downloads on first use. */
|
|
3754
|
+
export interface WasmGrammarInfo {
|
|
3755
|
+
/** Canonical language name, e.g. `verilog`, `csharp`. */
|
|
3756
|
+
language: string
|
|
3757
|
+
/** stencil-hq/wasm-grammars release tag hosting the grammar, e.g. `v1`. */
|
|
3758
|
+
release: string
|
|
3759
|
+
/**
|
|
3760
|
+
* File name inside the grammar directory; the release asset is
|
|
3761
|
+
* `<file>.zst`.
|
|
3762
|
+
*/
|
|
3763
|
+
file: string
|
|
3764
|
+
/** Lowercase hex SHA-256 of the decompressed `.wasm`. */
|
|
3765
|
+
sha256: string
|
|
3766
|
+
/** Byte size of the decompressed `.wasm`. */
|
|
3767
|
+
size: number
|
|
3768
|
+
/** Whether the grammar is downloaded (or already loaded). */
|
|
3769
|
+
installed: boolean
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
/** Language to look up: an alias, or a path to infer it from. */
|
|
3773
|
+
export interface WasmGrammarQuery {
|
|
3774
|
+
/** Language alias (e.g. `kotlin`, `sv`); wins over `path`. */
|
|
3775
|
+
lang?: string
|
|
3776
|
+
/** File whose extension selects the language. */
|
|
3777
|
+
path?: string
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3505
3780
|
/** Profiling results returned to JavaScript. */
|
|
3506
3781
|
export interface WorkProfile {
|
|
3507
3782
|
/** Folded stack format for flamegraph tools. */
|
package/native/index.js
CHANGED
|
@@ -46,10 +46,12 @@ export const VcsRepo = nativeBindings.VcsRepo;
|
|
|
46
46
|
|
|
47
47
|
// functions
|
|
48
48
|
export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime ?? missingNativeExport("__ompInstallTokioRuntime");
|
|
49
|
+
export const __ompSetGrammarDir = nativeBindings.__ompSetGrammarDir ?? missingNativeExport("__ompSetGrammarDir");
|
|
49
50
|
export const __piNativesBuildVersion = nativeBindings.__piNativesBuildVersion;
|
|
50
51
|
export const appleFmAvailability = nativeBindings.appleFmAvailability ?? missingNativeExport("appleFmAvailability");
|
|
51
52
|
export const appleFmCancel = nativeBindings.appleFmCancel ?? missingNativeExport("appleFmCancel");
|
|
52
53
|
export const appleFmGenerate = nativeBindings.appleFmGenerate ?? missingNativeExport("appleFmGenerate");
|
|
54
|
+
export const applyBinaryPatch = nativeBindings.applyBinaryPatch ?? missingNativeExport("applyBinaryPatch");
|
|
53
55
|
export const astEdit = nativeBindings.astEdit ?? missingNativeExport("astEdit");
|
|
54
56
|
export const astGrep = nativeBindings.astGrep ?? missingNativeExport("astGrep");
|
|
55
57
|
export const astMatch = nativeBindings.astMatch ?? missingNativeExport("astMatch");
|
|
@@ -58,6 +60,7 @@ export const copyToClipboard = nativeBindings.copyToClipboard ?? missingNativeEx
|
|
|
58
60
|
export const cosineSimilarityPairs = nativeBindings.cosineSimilarityPairs ?? missingNativeExport("cosineSimilarityPairs");
|
|
59
61
|
export const countTokens = nativeBindings.countTokens ?? missingNativeExport("countTokens");
|
|
60
62
|
export const decodeSixelToPng = nativeBindings.decodeSixelToPng ?? missingNativeExport("decodeSixelToPng");
|
|
63
|
+
export const decodeSixelToPngAsync = nativeBindings.decodeSixelToPngAsync ?? missingNativeExport("decodeSixelToPngAsync");
|
|
61
64
|
export const detectMacOSAppearance = nativeBindings.detectMacOSAppearance ?? missingNativeExport("detectMacOSAppearance");
|
|
62
65
|
export const deviceCheckGenerateToken = nativeBindings.deviceCheckGenerateToken ?? missingNativeExport("deviceCheckGenerateToken");
|
|
63
66
|
export const diffLineRuns = nativeBindings.diffLineRuns ?? missingNativeExport("diffLineRuns");
|
|
@@ -70,6 +73,7 @@ export const editGrammar = nativeBindings.editGrammar ?? missingNativeExport("ed
|
|
|
70
73
|
export const editInspect = nativeBindings.editInspect ?? missingNativeExport("editInspect");
|
|
71
74
|
export const enclosingBlockBoundaries = nativeBindings.enclosingBlockBoundaries ?? missingNativeExport("enclosingBlockBoundaries");
|
|
72
75
|
export const encodeSixel = nativeBindings.encodeSixel ?? missingNativeExport("encodeSixel");
|
|
76
|
+
export const encodeSixelAsync = nativeBindings.encodeSixelAsync ?? missingNativeExport("encodeSixelAsync");
|
|
73
77
|
export const execReplace = nativeBindings.execReplace ?? missingNativeExport("execReplace");
|
|
74
78
|
export const executeShell = nativeBindings.executeShell ?? missingNativeExport("executeShell");
|
|
75
79
|
export const expandWindowsLongPath = nativeBindings.expandWindowsLongPath ?? missingNativeExport("expandWindowsLongPath");
|
|
@@ -138,7 +142,9 @@ export const vcsJoinPatches = nativeBindings.vcsJoinPatches ?? missingNativeExpo
|
|
|
138
142
|
export const vcsValidateHunkSelections = nativeBindings.vcsValidateHunkSelections ?? missingNativeExport("vcsValidateHunkSelections");
|
|
139
143
|
export const vectorIndexTopK = nativeBindings.vectorIndexTopK ?? missingNativeExport("vectorIndexTopK");
|
|
140
144
|
export const visibleWidth = nativeBindings.visibleWidth ?? missingNativeExport("visibleWidth");
|
|
145
|
+
export const warmBlockParse = nativeBindings.warmBlockParse ?? missingNativeExport("warmBlockParse");
|
|
141
146
|
export const warmHighlighter = nativeBindings.warmHighlighter ?? missingNativeExport("warmHighlighter");
|
|
147
|
+
export const wasmGrammarFor = nativeBindings.wasmGrammarFor ?? missingNativeExport("wasmGrammarFor");
|
|
142
148
|
export const wrapTextWithAnsi = nativeBindings.wrapTextWithAnsi ?? missingNativeExport("wrapTextWithAnsi");
|
|
143
149
|
|
|
144
150
|
// string/numeric enums (napi-rs string_enum produces TS-only const enum)
|
package/native/loader-state.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
export interface EmbeddedAddonFile {
|
|
2
2
|
variant: "modern" | "baseline" | "default";
|
|
3
|
+
/** Basename of the extracted `.node` file. */
|
|
3
4
|
filename: string;
|
|
4
|
-
size
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface EmbeddedAddonArchive {
|
|
9
|
-
format: "tar.gz";
|
|
10
|
-
filename: string;
|
|
11
|
-
filePath: string;
|
|
5
|
+
/** Decompressed addon size in bytes. */
|
|
6
|
+
size: number;
|
|
7
|
+
/** Embedded zstd frame holding the addon bytes. */
|
|
8
|
+
zstdPath: string;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
export interface EmbeddedAddon {
|
|
15
12
|
platformTag: string;
|
|
16
13
|
version: string;
|
|
17
14
|
files: EmbeddedAddonFile[];
|
|
18
|
-
archive?: EmbeddedAddonArchive;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
export interface DetectCompiledBinaryInput {
|
|
@@ -90,13 +86,13 @@ export function cleanupStaleNativeVersions(input: CleanupStaleNativeVersionsInpu
|
|
|
90
86
|
|
|
91
87
|
export function prepareNativeVersionDir(versionedDir: string): void;
|
|
92
88
|
|
|
93
|
-
export interface
|
|
94
|
-
archivePath: string;
|
|
89
|
+
export interface ExtractEmbeddedAddonsInput {
|
|
95
90
|
files: EmbeddedAddonFile[];
|
|
96
91
|
targetDir: string;
|
|
97
92
|
}
|
|
98
93
|
|
|
99
|
-
|
|
94
|
+
/** Decompress every manifest addon missing or wrong-sized in `targetDir`; returns the paths written. */
|
|
95
|
+
export function extractEmbeddedAddons(input: ExtractEmbeddedAddonsInput): string[];
|
|
100
96
|
|
|
101
97
|
export interface SelectCpuVariantInput {
|
|
102
98
|
arch: string;
|