@oh-my-pi/pi-natives 16.2.12 → 16.3.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/native/index.d.ts +27 -17
- package/native/index.js +1 -1
- package/package.json +6 -6
package/native/index.d.ts
CHANGED
|
@@ -126,21 +126,29 @@ export declare class Shell {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* Install the bounded Tokio runtime napi-rs adopts for async exports
|
|
129
|
+
* Install the bounded Tokio runtime napi-rs adopts for async exports and the
|
|
130
|
+
* bounded Rayon global pool used by native parallel iterators.
|
|
130
131
|
*
|
|
131
132
|
* The JS loader calls this exactly once, synchronously, right *after* `dlopen`
|
|
132
|
-
* returns and *before* any async native runs — never from
|
|
133
|
-
* Building a multi-thread runtime eagerly spawns worker
|
|
134
|
-
* that during module init (while the dynamic-loader lock is
|
|
135
|
-
* some hosts: a fresh worker blocks acquiring the loader
|
|
136
|
-
* thread still owns. napi-rs only materializes its runtime
|
|
137
|
-
* call (`RT` is a `LazyLock`) and
|
|
138
|
-
* the runtime in a `OnceLock`, so
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
133
|
+
* returns and *before* any async native or parallel iterator runs — never from
|
|
134
|
+
* `#[module_init]`. Building a multi-thread runtime eagerly spawns worker
|
|
135
|
+
* threads, and doing that during module init (while the dynamic-loader lock is
|
|
136
|
+
* held) deadlocks on some hosts: a fresh worker blocks acquiring the loader
|
|
137
|
+
* lock that the init thread still owns. napi-rs only materializes its runtime
|
|
138
|
+
* on the first async call (`RT` is a `LazyLock`) and
|
|
139
|
+
* `create_custom_tokio_runtime` merely records the runtime in a `OnceLock`, so
|
|
140
|
+
* installing it post-load is still honored.
|
|
141
|
+
*
|
|
142
|
+
* Without the Tokio override napi builds its own default (one worker per CPU,
|
|
143
|
+
* spawned eagerly), which aborts the process (`os error 1455`) on a
|
|
144
|
+
* memory-constrained Windows host before any JS error can surface;
|
|
145
|
+
* [`create_windows_napi_tokio_runtime`] pre-flights the spawn instead. Rayon
|
|
146
|
+
* has the same one-thread-per-core lazy default, so [`configure_rayon_pool`]
|
|
147
|
+
* installs a probed global pool before `count_tokens` or vendored `sort` can
|
|
148
|
+
* trigger it across a N-API nounwind boundary. If no worker thread is
|
|
149
|
+
* spawnable, patched Rayon callsites stay sequential rather than registering a
|
|
150
|
+
* current-thread-only global pool that cannot steal work from later native
|
|
151
|
+
* calls. Idempotent.
|
|
144
152
|
*/
|
|
145
153
|
export declare function __ompInstallTokioRuntime(): void
|
|
146
154
|
|
|
@@ -162,7 +170,7 @@ export declare function __ompInstallTokioRuntime(): void
|
|
|
162
170
|
* `packages/natives/native/index.js` (which derives the name from
|
|
163
171
|
* `package.json#version`).
|
|
164
172
|
*/
|
|
165
|
-
export declare function
|
|
173
|
+
export declare function __piNativesV16_3_0(): void
|
|
166
174
|
|
|
167
175
|
/**
|
|
168
176
|
* Apply conservative pre-execution rewrites to a bash command.
|
|
@@ -478,9 +486,9 @@ export declare function copyToClipboard(text: string): void
|
|
|
478
486
|
* Count tokens in `input`.
|
|
479
487
|
*
|
|
480
488
|
* `input` may be a single string or an array of strings; an array returns
|
|
481
|
-
* the sum across all elements (encoded in parallel via rayon
|
|
482
|
-
* returns a single token total — use this for any
|
|
483
|
-
* without paying a per-element napi crossing.
|
|
489
|
+
* the sum across all elements (encoded in parallel via rayon when the global
|
|
490
|
+
* pool is available). Always returns a single token total — use this for any
|
|
491
|
+
* aggregate budget question without paying a per-element napi crossing.
|
|
484
492
|
*
|
|
485
493
|
* Uses ordinary encoding (no special-token handling), which is the right
|
|
486
494
|
* choice for measuring user/model content rather than wire-protocol tokens.
|
|
@@ -1437,6 +1445,8 @@ export interface ShellRunResult {
|
|
|
1437
1445
|
* minimized text shown to the agent. `None` when nothing was rewritten.
|
|
1438
1446
|
*/
|
|
1439
1447
|
minimized?: MinimizerResult
|
|
1448
|
+
/** Shell working directory after command completion. */
|
|
1449
|
+
workingDir?: string
|
|
1440
1450
|
}
|
|
1441
1451
|
|
|
1442
1452
|
/**
|
package/native/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export const Shell = nativeBindings.Shell;
|
|
|
24
24
|
|
|
25
25
|
// functions
|
|
26
26
|
export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
|
|
27
|
-
export const
|
|
27
|
+
export const __piNativesV16_3_0 = nativeBindings.__piNativesV16_3_0;
|
|
28
28
|
export const applyBashFixups = nativeBindings.applyBashFixups;
|
|
29
29
|
export const astEdit = nativeBindings.astEdit;
|
|
30
30
|
export const astGrep = nativeBindings.astGrep;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.3.0",
|
|
4
4
|
"description": "Native Rust bindings for grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
|
-
"@oh-my-pi/pi-natives-linux-x64": "16.
|
|
71
|
-
"@oh-my-pi/pi-natives-linux-arm64": "16.
|
|
72
|
-
"@oh-my-pi/pi-natives-darwin-x64": "16.
|
|
73
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "16.
|
|
74
|
-
"@oh-my-pi/pi-natives-win32-x64": "16.
|
|
70
|
+
"@oh-my-pi/pi-natives-linux-x64": "16.3.0",
|
|
71
|
+
"@oh-my-pi/pi-natives-linux-arm64": "16.3.0",
|
|
72
|
+
"@oh-my-pi/pi-natives-darwin-x64": "16.3.0",
|
|
73
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "16.3.0",
|
|
74
|
+
"@oh-my-pi/pi-natives-win32-x64": "16.3.0"
|
|
75
75
|
}
|
|
76
76
|
}
|