@galaxy-blackhole/blackhole-harness 0.1.3 → 0.1.4

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.
@@ -110,7 +110,7 @@ import { existsSync as existsSync10, writeFileSync as writeFileSync6 } from "nod
110
110
  import { spawnSync as spawnSync2 } from "node:child_process";
111
111
  import { tmpdir } from "node:os";
112
112
  import { createHash as createHash4 } from "node:crypto";
113
- import { cpSync as cpSync3, existsSync as existsSync7, lstatSync as lstatSync4, mkdirSync as mkdirSync3, mkdtempSync, readFileSync as readFileSync5, readdirSync as readdirSync5, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync3, symlinkSync as symlinkSync3, writeFileSync as writeFileSync4 } from "node:fs";
113
+ import { cpSync as cpSync3, existsSync as existsSync7, lstatSync as lstatSync4, mkdirSync as mkdirSync3, mkdtempSync, readFileSync as readFileSync5, readdirSync as readdirSync5, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync3, writeFileSync as writeFileSync4 } from "node:fs";
114
114
 
115
115
  // tools/p1b/denta-profile.ts
116
116
  import { createHash } from "node:crypto";
@@ -386,6 +386,12 @@ function linkSelfPackages() {
386
386
  return added;
387
387
  }
388
388
 
389
+ // apps/cli/src/link-dir.ts
390
+ import { symlinkSync as symlinkSync2 } from "node:fs";
391
+ function linkDirSync(source, link) {
392
+ symlinkSync2(source, link, process.platform === "win32" ? "junction" : "dir");
393
+ }
394
+
389
395
  // apps/cli/src/mount-gate.ts
390
396
  import { spawnSync } from "node:child_process";
391
397
  import { createHash as createHash2 } from "node:crypto";
@@ -894,7 +900,7 @@ function readPeers(gbh) {
894
900
  }
895
901
 
896
902
  // apps/cli/src/prebuilt.ts
897
- import { cpSync as cpSync2, existsSync as existsSync6, mkdirSync as mkdirSync2, readlinkSync, rmSync as rmSync2, statSync as statSync2, symlinkSync as symlinkSync2 } from "node:fs";
903
+ import { cpSync as cpSync2, existsSync as existsSync6, mkdirSync as mkdirSync2, readlinkSync, rmSync as rmSync2, statSync as statSync2 } from "node:fs";
898
904
  import { dirname as dirname4, join as join6, resolve as resolve2 } from "node:path";
899
905
  function embeddedHost() {
900
906
  return existsSync6(join6(repoRoot(), ".gbh-embedded"));
@@ -924,7 +930,7 @@ function ensureLink(link, target) {
924
930
  }
925
931
  try {
926
932
  mkdirSync2(dirname4(link), { recursive: true });
927
- symlinkSync2(target, link, "dir");
933
+ linkDirSync(target, link);
928
934
  return true;
929
935
  } catch {
930
936
  return false;
@@ -1223,7 +1229,7 @@ function mountRewritePackage(pkg) {
1223
1229
  }
1224
1230
  mkdirSync3(dirname5(link), { recursive: true });
1225
1231
  rmSync3(link, { recursive: true, force: true });
1226
- symlinkSync3(source, link, "dir");
1232
+ linkDirSync(source, link);
1227
1233
  peers.push(peer);
1228
1234
  }
1229
1235
  trace("xong");
@@ -1255,7 +1261,7 @@ function linkInfrastructurePackages() {
1255
1261
  } catch {}
1256
1262
  try {
1257
1263
  mkdirSync3(dirname5(link), { recursive: true });
1258
- symlinkSync3(nguon, link, "dir");
1264
+ linkDirSync(nguon, link);
1259
1265
  linked.push(specifier);
1260
1266
  } catch {
1261
1267
  continue;
@@ -1287,7 +1293,7 @@ function linkNativeAddonPackages() {
1287
1293
  } catch {}
1288
1294
  try {
1289
1295
  mkdirSync3(dirname5(link), { recursive: true });
1290
- symlinkSync3(nguon, link, "dir");
1296
+ linkDirSync(nguon, link);
1291
1297
  linked.push("@deepseek-ai/" + goi);
1292
1298
  } catch {
1293
1299
  continue;
@@ -1459,7 +1465,7 @@ function applyHostAliases(results) {
1459
1465
  try {
1460
1466
  mkdirSync3(dirname5(link), { recursive: true });
1461
1467
  rmSync3(link, { recursive: true, force: true });
1462
- symlinkSync3(result.dir, link, "dir");
1468
+ linkDirSync(result.dir, link);
1463
1469
  applied.push(alias + " -> " + result.specifier);
1464
1470
  } catch (error) {
1465
1471
  console.warn("[bh] khong tao duoc host alias " + alias + " -> " + result.dir + ": " + String(error));
@@ -1568,7 +1574,7 @@ function applyProvenanceAliases() {
1568
1574
  rmSync3(link, { recursive: true, force: true });
1569
1575
  const thuMucKernel = join7(kernelModulesDir2(), stock);
1570
1576
  const nguonAlias = chiCoKhaiKieu(dir) && existsSync7(thuMucKernel) ? thuMucKernel : dich;
1571
- symlinkSync3(realpathSync2(nguonAlias), link, "dir");
1577
+ linkDirSync(realpathSync2(nguonAlias), link);
1572
1578
  applied.push(stock + " -> " + ours);
1573
1579
  } catch {
1574
1580
  continue;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * author Bùi Trọng Hiếu
3
+ * email kevinbui210191@gmail.com
4
+ * create date 15/10/2026
5
+ * modify date 16/11/2026
6
+ * desc Tao lien ket THU MUC chay duoc tren moi he: Windows khong cho symlink thu muc neu thieu quyen
7
+ * (EPERM) nhung JUNCTION thi khong can quyen. 16/11/2026: loi Windows that — profile thieu
8
+ * @galaxy-blackhole/gbh-brand, gbh-typert-protocol, gbh-cordis-plugin-timer ⇒ 4 plugin khong
9
+ * activate ⇒ harness khong in URL.
10
+ */
11
+
12
+ import { symlinkSync } from "node:fs";
13
+
14
+ /**
15
+ * Tao lien ket thư mục từ `source` tới `link`, chọn kiểu phù hợp với hệ điều hành.
16
+ *
17
+ * @param source - thư mục đích (thật) của liên kết.
18
+ * @param link - đường dẫn liên kết cần tạo.
19
+ * @remarks Windows chỉ tạo được **junction** khi không có quyền Administrator/Developer Mode; symlink
20
+ * thư mục sẽ ném EPERM và trước 16/11/2026 lỗi đó bị `catch {}` nuốt ⇒ profile thiếu gói ⇒ harness chết.
21
+ * @throws khi không tạo được liên kết (để nơi gọi báo rõ, không im lặng).
22
+ */
23
+ export function linkDirSync(source: string, link: string): void {
24
+ symlinkSync(source, link, process.platform === "win32" ? "junction" : "dir");
25
+ }
@@ -19,6 +19,7 @@ import { suaIdProfile } from "../../../tools/p1b/denta-profile.ts";
19
19
  import { dirname, join, relative } from "node:path";
20
20
  import { appHome, kernelModulesDir as kernelModulesDirFromPaths, repoRoot } from "./paths.ts";
21
21
  import { linkSelfPackages } from "./self-links.ts";
22
+ import { linkDirSync } from "./link-dir.ts";
22
23
  import { bunOnlyCommand, runMountGate } from "./mount-gate.ts";
23
24
  import { timePhase } from "./boot-timing.ts";
24
25
 
@@ -491,7 +492,7 @@ const trace = process.env.BH_TRACE === "1" ? (step: string): void => { console.l
491
492
  }
492
493
  mkdirSync(dirname(link), { recursive: true });
493
494
  rmSync(link, { recursive: true, force: true });
494
- symlinkSync(source, link, "dir");
495
+ linkDirSync(source, link);
495
496
  peers.push(peer);
496
497
  }
497
498
  // Host alias KHÔNG tạo ở đây: vòng peer của những gói mount SAU sẽ ghi đè cùng đường dẫn
@@ -544,7 +545,7 @@ export function linkInfrastructurePackages(): string[] {
544
545
  }
545
546
  try {
546
547
  mkdirSync(dirname(link), { recursive: true });
547
- symlinkSync(nguon, link, "dir");
548
+ linkDirSync(nguon, link);
548
549
  linked.push(specifier);
549
550
  } catch {
550
551
  continue;
@@ -589,7 +590,7 @@ export function linkNativeAddonPackages(): string[] {
589
590
  }
590
591
  try {
591
592
  mkdirSync(dirname(link), { recursive: true });
592
- symlinkSync(nguon, link, "dir");
593
+ linkDirSync(nguon, link);
593
594
  linked.push("@deepseek-ai/" + goi);
594
595
  } catch {
595
596
  continue;
@@ -825,7 +826,7 @@ export function applyHostAliases(results: readonly MountResult[]): string[] {
825
826
  try {
826
827
  mkdirSync(dirname(link), { recursive: true });
827
828
  rmSync(link, { recursive: true, force: true });
828
- symlinkSync(result.dir, link, "dir");
829
+ linkDirSync(result.dir, link);
829
830
  applied.push(alias + " -> " + result.specifier);
830
831
  } catch (error) {
831
832
  console.warn("[bh] khong tao duoc host alias " + alias + " -> " + result.dir + ": " + String(error));
@@ -963,7 +964,7 @@ export function applyProvenanceAliases(): string[] {
963
964
  // activate"). Khi gói ta CHỈ có khai kiểu mà KERNEL có bản đầy đủ thì alias phải trỏ KERNEL.
964
965
  const thuMucKernel = join(kernelModulesDir(), stock);
965
966
  const nguonAlias = chiCoKhaiKieu(dir) && existsSync(thuMucKernel) ? thuMucKernel : dich;
966
- symlinkSync(realpathSync(nguonAlias), link, 'dir');
967
+ linkDirSync(realpathSync(nguonAlias), link);
967
968
  applied.push(stock + ' -> ' + ours);
968
969
  } catch {
969
970
  continue;
@@ -11,6 +11,7 @@
11
11
 
12
12
  import { cpSync, existsSync, mkdirSync, readlinkSync, rmSync, statSync, symlinkSync } from "node:fs";
13
13
  import { dirname, join, resolve } from "node:path";
14
+ import { linkDirSync } from "./link-dir.ts";
14
15
  import { repoRoot } from "./paths.ts";
15
16
 
16
17
  /**
@@ -69,7 +70,7 @@ export function ensureLink(link: string, target: string): boolean {
69
70
  }
70
71
  try {
71
72
  mkdirSync(dirname(link), { recursive: true });
72
- symlinkSync(target, link, "dir");
73
+ linkDirSync(target, link);
73
74
  return true;
74
75
  } catch {
75
76
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galaxy-blackhole/blackhole-harness",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Galaxy Blackhole harness — boot the DSH host with the blackhole profile (lean npm build)",