@oh-my-pi/pi-natives 18.12.1 → 18.12.3

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
@@ -57,6 +57,14 @@ without applying alpha twice. Fully transparent pixels remain transparent;
57
57
  unscaled images retain their existing blending path. Re-encode when the terminal
58
58
  background RGB changes.
59
59
 
60
+ ### PTY dimensions
61
+
62
+ `normalizePtyDimensions(cols, rows)` returns `{ cols, rows }` with fractional
63
+ values truncated toward zero and dimensions clamped to 20–400 columns and
64
+ 5–200 rows. It shares the native bounds used by `PtySession.start`,
65
+ `startArgv`, and `resize`. Use the returned dimensions when sizing a screen
66
+ emulator so its viewport matches the native PTY.
67
+
60
68
  ### Lazy Windows path helpers
61
69
 
62
70
  Import `expandWindowsLongPath` and `getWindowsShortPath` from
@@ -4,6 +4,7 @@ const REQUIRED_METHODS = [
4
4
  "captureRegion",
5
5
  "cancel",
6
6
  "retire",
7
+ "setRunDeadline",
7
8
  "observe",
8
9
  "listApplications",
9
10
  "openApplication",
@@ -15,14 +16,21 @@ const REQUIRED_METHODS = [
15
16
  "releaseControl",
16
17
  "controlState",
17
18
  "bringToCurrentSpace",
19
+ "axSelectText",
18
20
  "holdDisplayUntilReleased",
19
21
  "releaseDisplayAwake",
20
22
  ];
21
23
 
24
+ /** Getters the computer worker reads; without `escapeStops` it would read every run as stopped by the user's Escape. */
25
+ const REQUIRED_GETTERS = ["escapeStops"];
26
+
22
27
  /** Require the current desktop ABI; partial legacy emulation cannot preserve input ownership. */
23
28
  export function adaptDesktopSession(NativeDesktopSession) {
24
29
  const prototype = NativeDesktopSession?.prototype;
25
- const missing = REQUIRED_METHODS.filter(method => typeof prototype?.[method] !== "function");
30
+ const missing = [
31
+ ...REQUIRED_METHODS.filter(method => typeof prototype?.[method] !== "function"),
32
+ ...REQUIRED_GETTERS.filter(getter => !prototype || !(getter in prototype)),
33
+ ];
26
34
  if (missing.length === 0) {
27
35
  return NativeDesktopSession;
28
36
  }
@@ -2,3 +2,12 @@ import type { DesktopSession, DesktopSessionOptions } from "./index.js";
2
2
 
3
3
  /** Construct a desktop session, loading the native addon on first use. */
4
4
  export declare function createDesktopSession(options: DesktopSessionOptions): DesktopSession;
5
+
6
+ /** Physical-Escape stops counted under `key`, loading the native addon on first use. */
7
+ export declare function desktopEscapeStops(key: string): number;
8
+
9
+ /** Drop the stop count kept under `key`. */
10
+ export declare function forgetDesktopEscapeStops(key: string): void;
11
+
12
+ /** Invalidate this process's event taps before it exits (see the native doc). */
13
+ export declare function closeDesktopEventTaps(): void;
package/native/desktop.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { adaptDesktopSession } from "./desktop-adapter.js";
2
- import { loadNative } from "./loader-state.js";
2
+ import { loadNative, missingNativeExport } from "./loader-state.js";
3
3
 
4
4
  let DesktopSession;
5
5
 
@@ -11,3 +11,22 @@ export function createDesktopSession(options) {
11
11
  DesktopSession ??= adaptDesktopSession(loadNative().DesktopSession);
12
12
  return new DesktopSession(options);
13
13
  }
14
+
15
+ // A stale workspace addon lacks the Escape exports; fall back to the stub
16
+ // `native/index.js` exports in their place, which names the rebuild.
17
+
18
+ /** Physical-Escape stops counted under `key`, loading the native addon on first use. */
19
+ export function desktopEscapeStops(key) {
20
+ return (loadNative().desktopEscapeStops ?? missingNativeExport("desktopEscapeStops"))(key);
21
+ }
22
+
23
+ /** Drop the stop count kept under `key`. */
24
+ export function forgetDesktopEscapeStops(key) {
25
+ (loadNative().forgetDesktopEscapeStops ?? missingNativeExport("forgetDesktopEscapeStops"))(key);
26
+ }
27
+
28
+ /** Invalidate this process's event taps before it exits (see the native doc). A stale
29
+ * workspace addon without the export holds no such taps. */
30
+ export function closeDesktopEventTaps() {
31
+ loadNative().closeDesktopEventTaps?.();
32
+ }
package/native/index.d.ts CHANGED
@@ -56,10 +56,16 @@ export declare class DesktopSession {
56
56
  * outside a turn keeps its grace. An agent calls this when its turn ends.
57
57
  */
58
58
  releaseDisplayAwake(): void
59
+ /**
60
+ * How many times the user's physical Escape has stopped takeover input in
61
+ * this session, or under its `escapeStopKey`. Host cancels, retirement and
62
+ * release never count, so a rise tells the host the user stopped the work.
63
+ */
64
+ get escapeStops(): number
59
65
  listDisplays(): Promise<Array<DesktopDisplay>>
60
66
  listWindows(): Promise<Array<DesktopWindow>>
61
67
  listApplications(options?: ApplicationQuery | undefined | null): Promise<Array<Application>>
62
- openApplication(id: string, options?: ApplicationOpenOptions | undefined | null): Promise<Application>
68
+ openApplication(id: string, options?: ApplicationOpenOptions | undefined | null): Promise<OpenedApplication>
63
69
  /**
64
70
  * Capture and accessibility share one serialized request. Neither a failed
65
71
  * snapshot nor an abandoned reply replaces the last delivered input frame.
@@ -68,8 +74,8 @@ export declare class DesktopSession {
68
74
  menuItems(target: string, path?: Array<string> | undefined | null): Promise<Array<DesktopMenuItem>>
69
75
  menuSelect(target: string, path: Array<string>): Promise<undefined>
70
76
  bringToCurrentSpace(windowId: string): Promise<undefined>
71
- holdKeys(target: string, keys: Array<string>, options: HoldOptions): Promise<undefined>
72
- holdMouse(target: string, x: number, y: number, options: HoldOptions): Promise<undefined>
77
+ holdKeys(target: string, keys: Array<string>, options: HoldOptions): Promise<DesktopFocusReturn | undefined | null>
78
+ holdMouse(target: string, x: number, y: number, options: HoldOptions): Promise<DesktopFocusReturn | undefined | null>
73
79
  /**
74
80
  * Native ownership only. Human approval is required by the host before
75
81
  * calling this method.
@@ -79,18 +85,24 @@ export declare class DesktopSession {
79
85
  controlState(): DesktopControlState
80
86
  /** Retire queued work from a completed helper without revoking task control. */
81
87
  retire(): void
88
+ /**
89
+ * Sets when the current run ends, `remaining_ms` from now; each run sets
90
+ * it before its first call. On macOS, input waiting for the user to pause
91
+ * in its app gives up shortly before it.
92
+ */
93
+ setRunDeadline(remainingMs: number): void
82
94
  capture(target: string, caps?: CaptureCaps | undefined | null): Promise<DesktopCapture>
83
95
  /**
84
96
  * Capture a fresh native-detail region without replacing the full input
85
97
  * coordinate frame.
86
98
  */
87
99
  captureRegion(target: string, region: CaptureRegion, caps?: CaptureCaps | undefined | null): Promise<DesktopCapture>
88
- click(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<undefined>
89
- moveMouse(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<undefined>
90
- drag(target: string, path: Array<DesktopPoint>, opts?: PointerOptions | undefined | null): Promise<undefined>
91
- scroll(target: string, x: number, y: number, dx: number, dy: number, opts?: PointerOptions | undefined | null): Promise<undefined>
92
- typeText(target: string, text: string, opts?: PointerOptions | undefined | null): Promise<undefined>
93
- keyChord(target: string, keys: Array<string>, opts?: PointerOptions | undefined | null): Promise<undefined>
100
+ click(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
101
+ moveMouse(target: string, x: number, y: number, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
102
+ drag(target: string, path: Array<DesktopPoint>, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
103
+ scroll(target: string, x: number, y: number, dx: number, dy: number, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
104
+ typeText(target: string, text: string, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
105
+ keyChord(target: string, keys: Array<string>, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
94
106
  raiseWindow(windowId: string): Promise<undefined>
95
107
  axSnapshot(target: string, opts?: AxSnapshotOptions | undefined | null): Promise<AxSnapshot>
96
108
  axQuery(target: string, query: AxQuery): Promise<Array<AxNode>>
@@ -104,10 +116,26 @@ export declare class DesktopSession {
104
116
  axAttributes(reference: string): Promise<Array<[string, string]>>
105
117
  axChildren(reference: string): Promise<Array<AxNode>>
106
118
  axParent(reference: string): Promise<AxNode | undefined | null>
107
- axPerform(reference: string, action: string): Promise<undefined>
119
+ /**
120
+ * Performs `action` on the element; with `menu`, chooses that item path
121
+ * in the menu the action opens, which closes it.
122
+ */
123
+ axPerform(reference: string, action: string, menu?: Array<string> | undefined | null): Promise<undefined>
108
124
  axSetValue(reference: string, value: string): Promise<undefined>
125
+ /**
126
+ * Selects `text` in the element's value by accessibility, or places a
127
+ * caret at its start or end, without focus change or keystrokes.
128
+ */
129
+ axSelectText(reference: string, text: string, opts?: AxSelectTextOptions | undefined | null): Promise<AxTextSelection>
109
130
  axFocus(reference: string): Promise<undefined>
110
- axClick(reference: string, opts?: PointerOptions | undefined | null): Promise<undefined>
131
+ axClick(reference: string, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
132
+ /**
133
+ * Types `text` into the element: native text fields take it by AX
134
+ * insertion, other elements as keystrokes once they hold keyboard focus.
135
+ */
136
+ axType(reference: string, text: string, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
137
+ /** Presses a key chord in the element once it holds keyboard focus. */
138
+ axKeyChord(reference: string, keys: Array<string>, opts?: PointerOptions | undefined | null): Promise<DesktopFocusReturn | undefined | null>
111
139
  /**
112
140
  * Immediately cancel operations submitted before this call. Later
113
141
  * operations may proceed.
@@ -327,6 +355,29 @@ export declare class IpcServer {
327
355
  unref(): void
328
356
  }
329
357
 
358
+ /** Native multi-pattern line matcher returning named captures per line. */
359
+ export declare class LineMatcher {
360
+ /**
361
+ * Throws when a pattern fails to compile; message names the failing index
362
+ * and the regex error, e.g. `pattern 2: regex parse error: ...`.
363
+ *
364
+ * # Errors
365
+ * Returns an error when any pattern fails to compile.
366
+ */
367
+ constructor(patterns: Array<string>)
368
+ /**
369
+ * Named groups of each pattern, in pattern order: the layout of a match's
370
+ * `start, end` pairs in [`LineMatches::spans`].
371
+ */
372
+ groupNames(): Array<Array<string>>
373
+ /**
374
+ * Matches every line (split on `
375
+ `) against every pattern; first match
376
+ * per line per pattern; ordered by line then pattern index.
377
+ */
378
+ matchLines(text: string): LineMatches
379
+ }
380
+
330
381
  /** WebRTC peer that accepts 16 kHz mono PCM and renders remote Opus audio. */
331
382
  export declare class LiveWebRtcPeer {
332
383
  /**
@@ -386,6 +437,27 @@ export declare class NativeOAuthCallback {
386
437
  dispose(): Promise<undefined>
387
438
  }
388
439
 
440
+ /**
441
+ * The bytes crossing one shell run's pipeline pipes, during and after the run.
442
+ *
443
+ * For `cargo build 2>&1 | tail -5`, stream 1 holds what `cargo` has written
444
+ * so far while `tail` still holds it back. Create one per run and pass it as
445
+ * [`ShellRunOptions::streams`]. Streams are numbered from 1 in the order the
446
+ * run opened its pipes; each keeps its most recent 1 MiB, and a run keeps its
447
+ * 4 newest finished streams.
448
+ */
449
+ export declare class PipeStreams {
450
+ constructor()
451
+ /** The run's retained streams, oldest first. */
452
+ list(): Array<PipeStreamInfo>
453
+ /**
454
+ * Retained bytes of stream `id` from stream offset `from` on (all of them
455
+ * without it), or `null` for a stream the run never opened or no longer
456
+ * keeps.
457
+ */
458
+ read(id: number, from?: number | undefined | null): PipeStreamChunk | null
459
+ }
460
+
389
461
  /**
390
462
  * Long-lived cross-platform power assertion.
391
463
  *
@@ -1184,6 +1256,16 @@ export interface AxQuery {
1184
1256
  limit?: number
1185
1257
  }
1186
1258
 
1259
+ /** Where `axSelectText` looks for its text and what it selects there. */
1260
+ export interface AxSelectTextOptions {
1261
+ /** Text that must directly precede the match. */
1262
+ prefix?: string
1263
+ /** Text that must directly follow the match. */
1264
+ suffix?: string
1265
+ /** `text` (default) selects the match; `start` and `end` place a caret. */
1266
+ select?: string
1267
+ }
1268
+
1187
1269
  export interface AxSnapshot {
1188
1270
  text: string
1189
1271
  nodeCount: number
@@ -1196,6 +1278,19 @@ export interface AxSnapshotOptions {
1196
1278
  all?: boolean
1197
1279
  }
1198
1280
 
1281
+ /** The selection read back after `axSelectText`, in UTF-16 code units. */
1282
+ export interface AxTextSelection {
1283
+ start: number
1284
+ length: number
1285
+ /** The selected text, empty for a caret. */
1286
+ text: string
1287
+ /**
1288
+ * Whether the element is focused in its app: typing and AX insertion
1289
+ * act on the focused element.
1290
+ */
1291
+ focused: boolean
1292
+ }
1293
+
1199
1294
  export interface BlockParseOptions {
1200
1295
  /** Source code to parse. */
1201
1296
  code: string
@@ -1253,6 +1348,16 @@ export interface ClipboardImage {
1253
1348
  mimeType: string
1254
1349
  }
1255
1350
 
1351
+ /**
1352
+ * Invalidates this process's event taps before it exits.
1353
+ *
1354
+ * No desktop session here sees the user's input again afterwards. A macOS tap
1355
+ * that dies with its process while the user types makes `WindowServer`
1356
+ * deliver their key again; Bun's `process.exit` runs no native exit hook, so
1357
+ * the host calls this from its exit handler.
1358
+ */
1359
+ export declare function closeDesktopEventTaps(): void
1360
+
1256
1361
  /** A context line (before or after a match). */
1257
1362
  export interface ContextLine {
1258
1363
  /** 1-indexed line number in the source file. */
@@ -1332,8 +1437,10 @@ export interface DesktopCapabilities {
1332
1437
  heldInput: boolean
1333
1438
  spaces: boolean
1334
1439
  /**
1335
- * Native global Escape cancellation while input/control ownership is held.
1336
- * Wayland requires the host interrupt action instead.
1440
+ * Native global Escape cancellation of takeover input (`takeover: true`,
1441
+ * held control, desktop/display-level input, raises, activating launches).
1442
+ * Without held control, background window input never watches the user's
1443
+ * keys; it and Wayland stop only through the host interrupt.
1337
1444
  */
1338
1445
  globalEscape: boolean
1339
1446
  capturePermission: string
@@ -1406,6 +1513,26 @@ export interface DesktopDisplay {
1406
1513
  isPrimary: boolean
1407
1514
  }
1408
1515
 
1516
+ /**
1517
+ * Physical-Escape stops counted under `key` by every desktop session created
1518
+ * with it, including closed ones, until the key is forgotten.
1519
+ */
1520
+ export declare function desktopEscapeStops(key: string): number
1521
+
1522
+ /**
1523
+ * Where focus ended after a takeover input call, as `WindowServer` reports
1524
+ * it. Input calls resolve to it on macOS when they took over; other
1525
+ * backends and background delivery resolve to `null`.
1526
+ */
1527
+ export interface DesktopFocusReturn {
1528
+ /** Whether the takeover handed focus back to the app front before it. */
1529
+ handedBack: boolean
1530
+ /** The process front before the takeover. */
1531
+ previousPid?: number
1532
+ /** The process front once the takeover ended; absent when unreadable. */
1533
+ frontPid?: number
1534
+ }
1535
+
1409
1536
  /**
1410
1537
  * One immediate child of a native application menu. Paths contain the actual
1411
1538
  * native labels, including ellipses; selection accepts normalized labels.
@@ -1440,6 +1567,11 @@ export interface DesktopScreenState {
1440
1567
 
1441
1568
  export interface DesktopSessionOptions {
1442
1569
  display?: string
1570
+ /**
1571
+ * Sessions created with the same key share one physical-Escape stop
1572
+ * count, which `desktopEscapeStops` reads after they close.
1573
+ */
1574
+ escapeStopKey?: string
1443
1575
  }
1444
1576
 
1445
1577
  /** One capturable top-level window in global logical desktop coordinates. */
@@ -1695,6 +1827,12 @@ export interface EditPolicy {
1695
1827
  allowFuzzy: boolean
1696
1828
  fuzzyThreshold: number
1697
1829
  enforceSeenLines: boolean
1830
+ /**
1831
+ * Narrowest per-line display cap any tool applies, in UTF-8 bytes (0: no
1832
+ * tool cuts lines). Without recorded read provenance, hashline anchors on
1833
+ * longer lines are rejected.
1834
+ */
1835
+ maxColumns: number
1698
1836
  blockAutoGenerated: boolean
1699
1837
  planActive: boolean
1700
1838
  /** Registered internal URL schemes (router spec keys). */
@@ -1902,6 +2040,9 @@ export declare enum FileType {
1902
2040
  Symlink = 3
1903
2041
  }
1904
2042
 
2043
+ /** Drops the stop count kept under `key` once no session will use it again. */
2044
+ export declare function forgetDesktopEscapeStops(key: string): void
2045
+
1905
2046
  /** Fuzzy file path search for autocomplete. */
1906
2047
  export declare function fuzzyFind(options: FuzzyFindOptions): Promise<FuzzyFindResult>
1907
2048
 
@@ -2256,6 +2397,16 @@ export interface HoldOptions {
2256
2397
  button?: string
2257
2398
  keys?: Array<string>
2258
2399
  takeover?: boolean
2400
+ /**
2401
+ * With `takeover`, hand focus back to the user's app even after their
2402
+ * input during the hold; see `PointerOptions.returnFocus`.
2403
+ */
2404
+ returnFocus?: boolean
2405
+ /**
2406
+ * Refuse a background left hold that starts on a control that opens a
2407
+ * menu; see `PointerOptions.refuseMenu`.
2408
+ */
2409
+ refuseMenu?: boolean
2259
2410
  }
2260
2411
 
2261
2412
  /**
@@ -2272,6 +2423,12 @@ export interface HtmlToMarkdownOptions {
2272
2423
  cleanContent?: boolean
2273
2424
  /** Skip images during conversion. */
2274
2425
  skipImages?: boolean
2426
+ /**
2427
+ * Hidden content to keep: "drop" (default) omits it, "reachable" keeps
2428
+ * content the page can reveal (collapsed sections, inactive tab panels),
2429
+ * "all" also keeps `<template>` and `<noscript>` content.
2430
+ */
2431
+ hiddenContent?: string
2275
2432
  }
2276
2433
 
2277
2434
  /** One stray sloppy payload region inside prose (UTF-16 offsets). */
@@ -2447,6 +2604,25 @@ export declare enum KeyEventType {
2447
2604
  Release = 3
2448
2605
  }
2449
2606
 
2607
+ /**
2608
+ * Matches of one [`LineMatcher::match_lines`] call, column-wise.
2609
+ *
2610
+ * Match `i` is on line `lines[i]` for pattern `rules[i]`, and its named
2611
+ * groups (in [`LineMatcher::group_names`] order for that pattern) are the
2612
+ * next `start, end` pairs of `spans`.
2613
+ */
2614
+ export interface LineMatches {
2615
+ /** 0-based line index per match. */
2616
+ lines: Uint32Array
2617
+ /** Pattern index per match. */
2618
+ rules: Uint32Array
2619
+ /**
2620
+ * Per match and named group: UTF-16 start and end within the line, `-1, -1`
2621
+ * when the group did not participate.
2622
+ */
2623
+ spans: Int32Array
2624
+ }
2625
+
2450
2626
  export interface LineRange {
2451
2627
  /** 1-indexed inclusive first visible line. */
2452
2628
  startLine: number
@@ -2738,9 +2914,29 @@ export interface NodeSpan {
2738
2914
  kind: string
2739
2915
  }
2740
2916
 
2917
+ /**
2918
+ * Truncate and clamp dimensions to the same limits used by PTY start and
2919
+ * resize.
2920
+ */
2921
+ export declare function normalizePtyDimensions(cols: number, rows: number): PtyDimensions
2922
+
2741
2923
  /** Decode notebook JSON into the editable cell-marker text. */
2742
2924
  export declare function notebookToEditableText(json: string, displayPath: string): string
2743
2925
 
2926
+ /**
2927
+ * An opened application: its [`Application`] fields and the window it
2928
+ * shows. On macOS `window` is its frontmost window once one is on screen;
2929
+ * other platforms report none.
2930
+ */
2931
+ export interface OpenedApplication {
2932
+ id: string
2933
+ name: string
2934
+ path: string
2935
+ running: boolean
2936
+ pid?: number
2937
+ window?: DesktopWindow
2938
+ }
2939
+
2744
2940
  /** Check syntax through the shared parse cache without constructing a summary. */
2745
2941
  export declare function parseCodeStatus(options: ParseStatusOptions): ParseStatus
2746
2942
 
@@ -2832,6 +3028,35 @@ export interface PdfMarkdownResult {
2832
3028
  */
2833
3029
  export declare function pdfToMarkdown(input: Uint8Array): Promise<PdfMarkdownResult>
2834
3030
 
3031
+ /** Retained bytes of a stream, as stream offsets `start..end`. */
3032
+ export interface PipeStreamChunk {
3033
+ /**
3034
+ * Stream offset of `data`'s first byte; past 0 once older bytes were
3035
+ * dropped.
3036
+ */
3037
+ start: number
3038
+ /** Stream offset just past `data`: the next read's `from`. */
3039
+ end: number
3040
+ /** The bytes `start..end`. */
3041
+ data: Buffer
3042
+ /** Whether bytes may still arrive. */
3043
+ open: boolean
3044
+ }
3045
+
3046
+ /** A tapped pipe of a run. */
3047
+ export interface PipeStreamInfo {
3048
+ /** Stream number, from 1. */
3049
+ id: number
3050
+ /** Source text of the stage writing into the pipe. */
3051
+ producer: string
3052
+ /** Source text of the stage reading from it. */
3053
+ consumer: string
3054
+ /** Bytes written so far, including those no longer retained. */
3055
+ total: number
3056
+ /** Whether bytes may still arrive. */
3057
+ open: boolean
3058
+ }
3059
+
2835
3060
  export interface PointerOptions {
2836
3061
  button?: string
2837
3062
  count?: number
@@ -2843,6 +3068,26 @@ export interface PointerOptions {
2843
3068
  * default background delivery.
2844
3069
  */
2845
3070
  takeover?: boolean
3071
+ /**
3072
+ * With `takeover`, hand focus back to the user's app even if they typed
3073
+ * or clicked during the action; only a third app they switched to keeps
3074
+ * it. The host sets this when it reruns a refused background action.
3075
+ */
3076
+ returnFocus?: boolean
3077
+ /**
3078
+ * Item path to choose in the menu a click opens, matched like a menu-bar
3079
+ * path, e.g. a context menu's `["Add to", "Fonts"]`; the call opens the
3080
+ * menu, presses the item and returns with the menu closed.
3081
+ */
3082
+ menu?: Array<string>
3083
+ /**
3084
+ * Refuse a background left click that lands on a control that opens a
3085
+ * menu (on macOS a menu button or popup button), or a drag that starts on
3086
+ * one, with `BackgroundUnavailable` before anything is sent. The host sets
3087
+ * this when the user refuses foreground takeover: an open menu takes their
3088
+ * keyboard.
3089
+ */
3090
+ refuseMenu?: boolean
2846
3091
  }
2847
3092
 
2848
3093
  /**
@@ -2928,6 +3173,12 @@ export interface PtyArgvStartOptions {
2928
3173
  rows?: number
2929
3174
  }
2930
3175
 
3176
+ /** Effective terminal dimensions shared by PTY sessions and screen emulators. */
3177
+ export interface PtyDimensions {
3178
+ cols: number
3179
+ rows: number
3180
+ }
3181
+
2931
3182
  /** Result of a PTY command run. */
2932
3183
  export interface PtyRunResult {
2933
3184
  /** Exit code when the command completes. */
@@ -3455,6 +3706,8 @@ export interface ShellRunOptions {
3455
3706
  * filesystem applies again to later runs.
3456
3707
  */
3457
3708
  filesystem?: ShellFilesystem
3709
+ /** Receives a copy of every byte crossing the run's pipeline pipes. */
3710
+ streams?: PipeStreams
3458
3711
  }
3459
3712
 
3460
3713
  /** Result of running a shell command. */
package/native/index.js CHANGED
@@ -33,9 +33,11 @@ export const FileLock = nativeBindings.FileLock;
33
33
  export const HighlightStream = nativeBindings.HighlightStream;
34
34
  export const IpcConnection = nativeBindings.IpcConnection;
35
35
  export const IpcServer = nativeBindings.IpcServer;
36
+ export const LineMatcher = nativeBindings.LineMatcher;
36
37
  export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
37
38
  export const MacAppearanceObserver = nativeBindings.MacAppearanceObserver;
38
39
  export const NativeOAuthCallback = nativeBindings.NativeOAuthCallback;
40
+ export const PipeStreams = nativeBindings.PipeStreams;
39
41
  export const PowerAssertion = nativeBindings.PowerAssertion;
40
42
  export const Process = nativeBindings.Process;
41
43
  export const PtySession = nativeBindings.PtySession;
@@ -58,11 +60,13 @@ export const astEdit = nativeBindings.astEdit ?? missingNativeExport("astEdit");
58
60
  export const astGrep = nativeBindings.astGrep ?? missingNativeExport("astGrep");
59
61
  export const astMatch = nativeBindings.astMatch ?? missingNativeExport("astMatch");
60
62
  export const blockRangeAt = nativeBindings.blockRangeAt ?? missingNativeExport("blockRangeAt");
63
+ export const closeDesktopEventTaps = nativeBindings.closeDesktopEventTaps ?? missingNativeExport("closeDesktopEventTaps");
61
64
  export const copyToClipboard = nativeBindings.copyToClipboard ?? missingNativeExport("copyToClipboard");
62
65
  export const cosineSimilarityPairs = nativeBindings.cosineSimilarityPairs ?? missingNativeExport("cosineSimilarityPairs");
63
66
  export const countTokens = nativeBindings.countTokens ?? missingNativeExport("countTokens");
64
67
  export const decodeSixelToPng = nativeBindings.decodeSixelToPng ?? missingNativeExport("decodeSixelToPng");
65
68
  export const decodeSixelToPngAsync = nativeBindings.decodeSixelToPngAsync ?? missingNativeExport("decodeSixelToPngAsync");
69
+ export const desktopEscapeStops = nativeBindings.desktopEscapeStops ?? missingNativeExport("desktopEscapeStops");
66
70
  export const detectMacOSAppearance = nativeBindings.detectMacOSAppearance ?? missingNativeExport("detectMacOSAppearance");
67
71
  export const deviceCheckGenerateToken = nativeBindings.deviceCheckGenerateToken ?? missingNativeExport("deviceCheckGenerateToken");
68
72
  export const diffLineRuns = nativeBindings.diffLineRuns ?? missingNativeExport("diffLineRuns");
@@ -81,6 +85,7 @@ export const executeShell = nativeBindings.executeShell ?? missingNativeExport("
81
85
  export const expandWindowsLongPath = nativeBindings.expandWindowsLongPath ?? missingNativeExport("expandWindowsLongPath");
82
86
  export const extractInlineSloppyRegions = nativeBindings.extractInlineSloppyRegions ?? missingNativeExport("extractInlineSloppyRegions");
83
87
  export const extractSegments = nativeBindings.extractSegments ?? missingNativeExport("extractSegments");
88
+ export const forgetDesktopEscapeStops = nativeBindings.forgetDesktopEscapeStops ?? missingNativeExport("forgetDesktopEscapeStops");
84
89
  export const fuzzyFind = nativeBindings.fuzzyFind ?? missingNativeExport("fuzzyFind");
85
90
  export const getSupportedLanguages = nativeBindings.getSupportedLanguages ?? missingNativeExport("getSupportedLanguages");
86
91
  export const getWindowsShortPath = nativeBindings.getWindowsShortPath ?? missingNativeExport("getWindowsShortPath");
@@ -115,6 +120,7 @@ export const matchesKittySequence = nativeBindings.matchesKittySequence ?? missi
115
120
  export const matchesLegacySequence = nativeBindings.matchesLegacySequence ?? missingNativeExport("matchesLegacySequence");
116
121
  export const mmrRerankIndices = nativeBindings.mmrRerankIndices ?? missingNativeExport("mmrRerankIndices");
117
122
  export const nodeChainAt = nativeBindings.nodeChainAt ?? missingNativeExport("nodeChainAt");
123
+ export const normalizePtyDimensions = nativeBindings.normalizePtyDimensions ?? missingNativeExport("normalizePtyDimensions");
118
124
  export const notebookToEditableText = nativeBindings.notebookToEditableText ?? missingNativeExport("notebookToEditableText");
119
125
  export const parseCodeStatus = nativeBindings.parseCodeStatus ?? missingNativeExport("parseCodeStatus");
120
126
  export const parseKey = nativeBindings.parseKey ?? missingNativeExport("parseKey");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "18.12.1",
3
+ "version": "18.12.3",
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",
@@ -113,11 +113,11 @@
113
113
  }
114
114
  },
115
115
  "optionalDependencies": {
116
- "@oh-my-pi/pi-natives-linux-x64": "18.12.1",
117
- "@oh-my-pi/pi-natives-linux-arm64": "18.12.1",
118
- "@oh-my-pi/pi-natives-darwin-x64": "18.12.1",
119
- "@oh-my-pi/pi-natives-darwin-arm64": "18.12.1",
120
- "@oh-my-pi/pi-natives-win32-x64": "18.12.1",
121
- "@oh-my-pi/pi-natives-win32-arm64": "18.12.1"
116
+ "@oh-my-pi/pi-natives-linux-x64": "18.12.3",
117
+ "@oh-my-pi/pi-natives-linux-arm64": "18.12.3",
118
+ "@oh-my-pi/pi-natives-darwin-x64": "18.12.3",
119
+ "@oh-my-pi/pi-natives-darwin-arm64": "18.12.3",
120
+ "@oh-my-pi/pi-natives-win32-x64": "18.12.3",
121
+ "@oh-my-pi/pi-natives-win32-arm64": "18.12.3"
122
122
  }
123
123
  }