@riddledc/riddle-proof 0.5.6 → 0.5.7

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.
@@ -7,8 +7,8 @@ import {
7
7
  mkdirSync,
8
8
  readFileSync,
9
9
  renameSync,
10
+ realpathSync,
10
11
  rmSync,
11
- symlinkSync,
12
12
  unlinkSync,
13
13
  writeFileSync,
14
14
  } from "node:fs";
@@ -356,10 +356,27 @@ function copyDependencyInputs(sourceDir, targetDir) {
356
356
  }
357
357
  }
358
358
 
359
- function linkNodeModules(projectDir, sourceModules) {
359
+ function materializeNodeModules(projectDir, sourceModules) {
360
360
  const projectModules = path.join(projectDir, "node_modules");
361
361
  removePath(projectModules);
362
- symlinkSync(sourceModules, projectModules, "dir");
362
+ const resolvedSource = realpathSync(sourceModules);
363
+ const hardlinkResult = runSafe(
364
+ `cp -al ${shellQuote(resolvedSource)} ${shellQuote(projectModules)}`,
365
+ undefined,
366
+ dependencyInstallTimeoutMs(),
367
+ );
368
+ if (hardlinkResult.ok && existsSync(projectModules)) return "hardlinked";
369
+
370
+ removePath(projectModules);
371
+ const copyResult = runSafe(
372
+ `cp -a ${shellQuote(resolvedSource)} ${shellQuote(projectModules)}`,
373
+ undefined,
374
+ dependencyInstallTimeoutMs(),
375
+ );
376
+ if (!copyResult.ok || !existsSync(projectModules)) {
377
+ throw new Error(`dependency materialization failed in ${projectDir}: ${copyResult.output.slice(0, 300)}`);
378
+ }
379
+ return "copied";
363
380
  }
364
381
 
365
382
  function tryEnsureCachedDeps({ projectDir, fingerprint, installCmd }) {
@@ -370,7 +387,7 @@ function tryEnsureCachedDeps({ projectDir, fingerprint, installCmd }) {
370
387
  const cacheModules = path.join(cacheDir, "node_modules");
371
388
  const cacheManifest = readDepsManifest(cacheDir);
372
389
  if (cacheManifest.fingerprint === fingerprint && cacheManifest.install_cmd === installCmd && existsSync(cacheModules)) {
373
- linkNodeModules(projectDir, cacheModules);
390
+ materializeNodeModules(projectDir, cacheModules);
374
391
  return `reused_cache:${cacheDir}`;
375
392
  }
376
393
 
@@ -399,7 +416,7 @@ function tryEnsureCachedDeps({ projectDir, fingerprint, installCmd }) {
399
416
 
400
417
  const finalManifest = readDepsManifest(cacheDir);
401
418
  if (finalManifest.fingerprint === fingerprint && finalManifest.install_cmd === installCmd && existsSync(cacheModules)) {
402
- linkNodeModules(projectDir, cacheModules);
419
+ materializeNodeModules(projectDir, cacheModules);
403
420
  return `cached:${installCmd}`;
404
421
  }
405
422
  } catch {
@@ -427,7 +444,7 @@ export function ensureDeps({ projectDir, reuseFrom = "" } = {}) {
427
444
  const sourceManifest = readDepsManifest(reuseFrom);
428
445
  const sourceModules = path.join(reuseFrom, "node_modules");
429
446
  if (sourceFingerprint === fingerprint && sourceManifest.fingerprint === fingerprint && existsSync(sourceModules)) {
430
- linkNodeModules(projectDir, sourceModules);
447
+ materializeNodeModules(projectDir, sourceModules);
431
448
  return `reused_from:${reuseFrom}`;
432
449
  }
433
450
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",