pi-libtui 0.3.7 → 0.3.8
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 +7 -6
- package/native-revision +1 -0
- package/package.json +1 -1
- package/src/native-binary.ts +7 -7
package/README.md
CHANGED
|
@@ -79,13 +79,13 @@ guarded Pi 0.84–0.85 adapter; unsupported hosts keep their native transcript.
|
|
|
79
79
|
Feature packages shell out to Rust binaries such as `terminal_bridge` (the
|
|
80
80
|
exported `TERMINAL_BRIDGE` descriptor). Requires a Rust toolchain
|
|
81
81
|
(https://rustup.rs). The `terminal_bridge` binary builds itself on first use
|
|
82
|
-
under Pi's agent directory (`native/terminal-bridge
|
|
83
|
-
`<
|
|
82
|
+
under Pi's agent directory (`native/terminal-bridge/<revision>/`), where
|
|
83
|
+
`<revision>` is the source commit recorded in the packaged `native-revision` file. Set `PI_TERMINAL_BRIDGE_BINARY` to use
|
|
84
84
|
a prebuilt binary; it must point at an executable file.
|
|
85
85
|
|
|
86
86
|
`ensureNativeBinary(binary, hooks?)` resolves in this order: the descriptor's
|
|
87
|
-
env override, then `<agentDir>/native/<crate>/
|
|
88
|
-
it on first use when absent. Builds are keyed by crate and
|
|
87
|
+
env override, then `<agentDir>/native/<crate>/<revision>/bin/<name>`, building
|
|
88
|
+
it on first use when absent. Builds are keyed by crate and source commit, so every
|
|
89
89
|
installed copy shares them, and concurrent requests within one process share
|
|
90
90
|
one build. Pass `onBuild` to show the delay in the UI. The extension host keeps
|
|
91
91
|
the shared PTY host alive across an extension reload; a session switch or quit
|
|
@@ -203,5 +203,6 @@ Source: https://github.com/luan/agents, directory
|
|
|
203
203
|
harnesses/pi/agent/packages/pi-libtui. Run `bun run typecheck` and
|
|
204
204
|
`bun test test` in that directory. When running from that checkout,
|
|
205
205
|
`ensureNativeBinary` also looks for `target/{release,debug}/<name>` in the Cargo
|
|
206
|
-
workspace and reports an unbuilt checkout instead of building
|
|
207
|
-
|
|
206
|
+
workspace and reports an unbuilt checkout instead of building. `just pi-pack`
|
|
207
|
+
records the checkout commit in every bundled `pi-libtui/native-revision` file,
|
|
208
|
+
so native builds do not depend on npm versions or repository-wide release tags.
|
package/native-revision
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
93ecc14e6cb9dc5228165a4b605b933ea595d69e
|
package/package.json
CHANGED
package/src/native-binary.ts
CHANGED
|
@@ -81,7 +81,8 @@ export interface EnsureNativeBinaryHooks {
|
|
|
81
81
|
* revision under Pi's agent directory and shared by every installed pi-libtui copy.
|
|
82
82
|
*/
|
|
83
83
|
export async function ensureNativeBinary(binary: NativeBinary, hooks: EnsureNativeBinaryHooks = {}): Promise<string> {
|
|
84
|
-
const
|
|
84
|
+
const options = processOptions();
|
|
85
|
+
const location = locateNativeBinary(binary, options);
|
|
85
86
|
if (location.kind === "found") return location.path;
|
|
86
87
|
if (location.kind === "unbuilt-checkout") {
|
|
87
88
|
throw new Error(
|
|
@@ -92,7 +93,7 @@ export async function ensureNativeBinary(binary: NativeBinary, hooks: EnsureNati
|
|
|
92
93
|
const existing = builds.get(location.path);
|
|
93
94
|
if (existing) return existing;
|
|
94
95
|
hooks.onBuild?.(`Building ${binary.binaryName} (first use); this takes a minute.`);
|
|
95
|
-
const build = runCargo(nativeBuildArguments(binary,
|
|
96
|
+
const build = runCargo(nativeBuildArguments(binary, options.rev, location.installRoot), location.installRoot)
|
|
96
97
|
.then(() => {
|
|
97
98
|
if (!isExecutable(location.path)) throw new Error(`cargo install did not produce ${location.path}`);
|
|
98
99
|
return location.path;
|
|
@@ -106,12 +107,11 @@ export function terminalBridgeBinaryPath(): Promise<string> {
|
|
|
106
107
|
return ensureNativeBinary(TERMINAL_BRIDGE);
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
/**
|
|
110
|
+
/** The pack step records the exact source commit independently of npm versions. */
|
|
110
111
|
export function nativeRevision(): string {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return `v${manifest.version}`;
|
|
112
|
+
const revision = readFileSync(new URL("../native-revision", import.meta.url), "utf8").trim();
|
|
113
|
+
if (!/^[a-f0-9]{40}$/.test(revision)) throw new Error("Invalid native source revision; reinstall the package.");
|
|
114
|
+
return revision;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
function processOptions(): NativeBinaryOptions {
|