riftri 0.6.1 → 0.6.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/lib/client.js CHANGED
@@ -200,8 +200,11 @@ class Riftri {
200
200
  // child wrote there first (a hook's output, a Git warning) must not
201
201
  // cost the caller the receipt's code and category.
202
202
  let receipt = null;
203
- const lines = stderr.trimEnd().split("\n");
204
- for (const candidate of [lines.at(-1), stderr]) {
203
+ // Preserve the full diagnostic fallback without allocating an array
204
+ // and a string entry for every line of a verbose child's output.
205
+ const trimmed = stderr.trimEnd();
206
+ const lastLine = trimmed.slice(trimmed.lastIndexOf("\n") + 1);
207
+ for (const candidate of [lastLine, stderr]) {
205
208
  try {
206
209
  receipt = JSON.parse(candidate);
207
210
  break;
package/lib/platform.js CHANGED
@@ -3,6 +3,9 @@
3
3
  const fs = require("node:fs");
4
4
  const path = require("node:path");
5
5
 
6
+ // Kept in step with the ELF release gate and standalone installer by tests.
7
+ const GLIBC_FLOOR = "2.34";
8
+
6
9
  const PLATFORM_PACKAGES = Object.freeze({
7
10
  "darwin-arm64": "riftri-darwin-arm64",
8
11
  "darwin-x64": "riftri-darwin-x64",
@@ -20,7 +23,22 @@ function detectLinuxLibc(report = process.report) {
20
23
  }
21
24
 
22
25
  const header = report.getReport()?.header;
23
- return header?.glibcVersionRuntime ? "gnu" : "musl";
26
+ const version = header?.glibcVersionRuntime;
27
+ if (!version) return "musl";
28
+ const parts = typeof version === "string" && /^(\d+)\.(\d+)(?:\.\d+)?$/.exec(version);
29
+ const [major, minor] = parts ? parts.slice(1, 3).map(Number) : [];
30
+ const [floorMajor, floorMinor] = GLIBC_FLOOR.split(".").map(Number);
31
+ if (!Number.isSafeInteger(major) || !Number.isSafeInteger(minor) ||
32
+ major < floorMajor || (major === floorMajor && minor < floorMinor)) {
33
+ // npm excludes musl optional dependencies on glibc hosts. Do not select
34
+ // an absent package or attempt to execute an incompatible GNU binary.
35
+ throw new Error(
36
+ `Riftri's GNU npm binary requires glibc ${GLIBC_FLOOR} or newer (detected ${version}); ` +
37
+ "use the standalone installer at https://riftri.dev/install.sh for the static musl binary, " +
38
+ "then set RIFTRI_BINARY to its absolute path when using the Node SDK",
39
+ );
40
+ }
41
+ return "gnu";
24
42
  }
25
43
 
26
44
  function platformKey(
@@ -44,6 +62,9 @@ function binaryName(platform = process.platform) {
44
62
 
45
63
  function assertUsableBinary(candidate, source) {
46
64
  try {
65
+ // Follow executable symlinks, but reject directories and special files
66
+ // that can pass an access check without being runnable binaries.
67
+ if (!fs.statSync(candidate).isFile()) throw new Error("not a regular file");
47
68
  fs.accessSync(
48
69
  candidate,
49
70
  process.platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK,
@@ -124,6 +145,7 @@ function resolveBinary(options = {}) {
124
145
  }
125
146
 
126
147
  module.exports = {
148
+ GLIBC_FLOOR,
127
149
  PLATFORM_PACKAGES,
128
150
  assertCompatiblePackageManifest,
129
151
  binaryName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "riftri",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Experimental lightweight Git workspaces for parallel development",
5
5
  "license": "MIT",
6
6
  "author": "Assistant UI contributors",
@@ -22,14 +22,14 @@
22
22
  "typescript": "5.9.3"
23
23
  },
24
24
  "optionalDependencies": {
25
- "riftri-darwin-arm64": "0.6.1",
26
- "riftri-darwin-x64": "0.6.1",
27
- "riftri-linux-arm64-gnu": "0.6.1",
28
- "riftri-linux-arm64-musl": "0.6.1",
29
- "riftri-linux-x64-gnu": "0.6.1",
30
- "riftri-linux-x64-musl": "0.6.1",
31
- "riftri-win32-arm64": "0.6.1",
32
- "riftri-win32-x64": "0.6.1"
25
+ "riftri-darwin-arm64": "0.6.2",
26
+ "riftri-darwin-x64": "0.6.2",
27
+ "riftri-linux-arm64-gnu": "0.6.2",
28
+ "riftri-linux-arm64-musl": "0.6.2",
29
+ "riftri-linux-x64-gnu": "0.6.2",
30
+ "riftri-linux-x64-musl": "0.6.2",
31
+ "riftri-win32-arm64": "0.6.2",
32
+ "riftri-win32-x64": "0.6.2"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",