@galaxy-blackhole/blackhole-harness 0.1.6 → 0.1.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/apps/cli/lib/main.js +2 -1
- package/apps/cli/src/profile.ts +4 -0
- package/package.json +1 -1
- package/packages/client/ui-open-in-app/lib/client.bundle.js +12 -9
- package/packages/client/ui-open-in-app/lib/client.js +12 -9
- package/packages/client/ui-open-in-app/src/parts/part-01.ts +12 -7
- package/packages/host/host-webserver/lib/index.js +12 -0
- package/packages/host/host-webserver/src/parts/part-02-index.ts +12 -0
- package/packages/host/open-in-app/lib/index.js +35 -0
- package/packages/host/open-in-app/src/catalog.ts +50 -2
package/apps/cli/lib/main.js
CHANGED
|
@@ -1615,7 +1615,8 @@ var DEFAULT_FEATURE_BUNDLES = [
|
|
|
1615
1615
|
"@galaxy-blackhole/gbh-session-titles-bundle"
|
|
1616
1616
|
];
|
|
1617
1617
|
var APP_PROFILE_BUNDLES = [
|
|
1618
|
-
"@galaxy-blackhole/gbh-bundle"
|
|
1618
|
+
"@galaxy-blackhole/gbh-bundle",
|
|
1619
|
+
"@galaxy-blackhole/gbh-client-settings-about"
|
|
1619
1620
|
];
|
|
1620
1621
|
var PNPM_WORKSPACE = `packages:
|
|
1621
1622
|
- .
|
package/apps/cli/src/profile.ts
CHANGED
|
@@ -59,6 +59,10 @@ export const APP_PROFILE_BUNDLES: readonly string[] = [
|
|
|
59
59
|
// moi thu tra theo id (settings/config/slot/typert) deu truot: "Could not save", thieu dong Permission,
|
|
60
60
|
// preset cordis do. Bundle cua ta sinh tu 17 tep patch cua stock, giu nguyen id/order/disabled/config.
|
|
61
61
|
"@galaxy-blackhole/gbh-bundle",
|
|
62
|
+
// 20/11/2026 — tab "Thông tin" (About) trong Settings là bundle riêng; profile cũ migrate từ
|
|
63
|
+
// ~/.galaxy/gbh có thể thiếu, khiến Windows/CLI không có tab này. Đưa vào lõi để ensureProfile
|
|
64
|
+
// reconcile cả hồ sơ đã tồn tại (không xoá bundle người dùng đã tắt).
|
|
65
|
+
"@galaxy-blackhole/gbh-client-settings-about",
|
|
62
66
|
];
|
|
63
67
|
|
|
64
68
|
/** What `ensureProfile` did to the app home on this boot. */
|
package/package.json
CHANGED
|
@@ -274,15 +274,18 @@ class OpenInAppController {
|
|
|
274
274
|
}
|
|
275
275
|
async run() {
|
|
276
276
|
let apps = [];
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
277
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
278
|
+
try {
|
|
279
|
+
const response = await this.fetcher(ROUTE_APPS, { headers: { accept: "application/json" } });
|
|
280
|
+
if (response.ok) {
|
|
281
|
+
const payload = await response.json();
|
|
282
|
+
if (Array.isArray(payload.apps))
|
|
283
|
+
apps = payload.apps.filter((id) => typeof id === "string");
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
if (response.status !== 404) break;
|
|
287
|
+
} catch {}
|
|
288
|
+
if (attempt < 3) await new Promise((resolve) => setTimeout(resolve, 250 * (attempt + 1)));
|
|
286
289
|
}
|
|
287
290
|
this.apps.set(apps);
|
|
288
291
|
}
|
|
@@ -287,15 +287,18 @@
|
|
|
287
287
|
}
|
|
288
288
|
async run() {
|
|
289
289
|
let apps = [];
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
290
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
291
|
+
try {
|
|
292
|
+
const response = await this.fetcher(ROUTE_APPS, { headers: { accept: "application/json" } });
|
|
293
|
+
if (response.ok) {
|
|
294
|
+
const payload = await response.json();
|
|
295
|
+
if (Array.isArray(payload.apps))
|
|
296
|
+
apps = payload.apps.filter((id) => typeof id === "string");
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
if (response.status !== 404) break;
|
|
300
|
+
} catch {}
|
|
301
|
+
if (attempt < 3) await new Promise((resolve) => setTimeout(resolve, 250 * (attempt + 1)));
|
|
299
302
|
}
|
|
300
303
|
this.apps.set(apps);
|
|
301
304
|
}
|
|
@@ -150,13 +150,18 @@ window.__ModuleLoader__.load({
|
|
|
150
150
|
}
|
|
151
151
|
async run() {
|
|
152
152
|
let apps = [];
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
154
|
+
try {
|
|
155
|
+
const response = await this.fetcher(OPEN_IN_APP_APPS_ROUTE, { headers: { accept: "application/json" } });
|
|
156
|
+
if (response.ok) {
|
|
157
|
+
const payload = await response.json();
|
|
158
|
+
if (Array.isArray(payload.apps)) apps = payload.apps.filter((id) => typeof id === "string");
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (response.status !== 404) break;
|
|
162
|
+
} catch {}
|
|
163
|
+
if (attempt < 3) await new Promise((resolve) => setTimeout(resolve, 250 * (attempt + 1)));
|
|
164
|
+
}
|
|
160
165
|
this.apps.set(apps);
|
|
161
166
|
}
|
|
162
167
|
};
|
|
@@ -394,8 +394,20 @@ var WebServer = class extends Service {
|
|
|
394
394
|
const candidates = [];
|
|
395
395
|
if (process.env.GBH_FRONTEND_DIST) candidates.push(process.env.GBH_FRONTEND_DIST);
|
|
396
396
|
candidates.push(join(process.cwd(), "node_modules", "@deepseek-ai", "dsh-web-frontend", "dist"));
|
|
397
|
+
// CLI có thể chạy từ Desktop: dò ngược từ entry host (apps/cli/lib/main.js) tới
|
|
398
|
+
// node_modules của cây CLI, nơi npm đặt @deepseek-ai/dsh-web-frontend.
|
|
399
|
+
if (process.argv[1]) {
|
|
400
|
+
let current = dirname(resolve(process.argv[1]));
|
|
401
|
+
for (let depth = 0; depth < 16; depth += 1) {
|
|
402
|
+
candidates.push(join(current, "node_modules", "@deepseek-ai", "dsh-web-frontend", "dist"));
|
|
403
|
+
const parent = dirname(current);
|
|
404
|
+
if (parent === current) break;
|
|
405
|
+
current = parent;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
397
408
|
try { candidates.push(join(dirname(require.resolve("@deepseek-ai/dsh-web-frontend/package.json")), "dist")); } catch {}
|
|
398
409
|
const dist = candidates.find((candidate) => existsSync(join(candidate, "index.html")));
|
|
410
|
+
if (dist === void 0) this.ctx.logger.warn("[gbh] frontend dist not found; candidates=" + candidates.join(" | "));
|
|
399
411
|
if (dist !== void 0) {
|
|
400
412
|
const rel = pathname === "/" ? "index.html" : pathname.replace(/^\//u, "");
|
|
401
413
|
const target = join(dist, rel);
|
|
@@ -305,8 +305,20 @@ var WebServer = class extends Service {
|
|
|
305
305
|
const candidates: string[] = [];
|
|
306
306
|
if (process.env.GBH_FRONTEND_DIST) candidates.push(process.env.GBH_FRONTEND_DIST);
|
|
307
307
|
candidates.push(join(process.cwd(), "node_modules", "@deepseek-ai", "dsh-web-frontend", "dist"));
|
|
308
|
+
// CLI có thể chạy từ Desktop: dò ngược từ entry host (apps/cli/lib/main.js) tới
|
|
309
|
+
// node_modules của cây CLI, nơi npm đặt @deepseek-ai/dsh-web-frontend.
|
|
310
|
+
if (process.argv[1]) {
|
|
311
|
+
let current = dirname(resolve(process.argv[1]));
|
|
312
|
+
for (let depth = 0; depth < 16; depth += 1) {
|
|
313
|
+
candidates.push(join(current, "node_modules", "@deepseek-ai", "dsh-web-frontend", "dist"));
|
|
314
|
+
const parent = dirname(current);
|
|
315
|
+
if (parent === current) break;
|
|
316
|
+
current = parent;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
308
319
|
try { candidates.push(join(dirname(require.resolve("@deepseek-ai/dsh-web-frontend/package.json")), "dist")); } catch {}
|
|
309
320
|
const dist = candidates.find((candidate) => existsSync(join(candidate, "index.html")));
|
|
321
|
+
if (dist === void 0) this.ctx.logger.warn("[gbh] frontend dist not found; candidates=" + candidates.join(" | "));
|
|
310
322
|
if (dist !== void 0) {
|
|
311
323
|
const rel = pathname === "/" ? "index.html" : pathname.replace(/^\//u, "");
|
|
312
324
|
const target = join(dist, rel);
|
|
@@ -18,7 +18,36 @@ function darwinCandidates() {
|
|
|
18
18
|
{ id: "terminal", label: "Terminal", bundle: "/System/Applications/Utilities/Terminal.app" }
|
|
19
19
|
];
|
|
20
20
|
}
|
|
21
|
+
function windowsCandidates() {
|
|
22
|
+
const local = process.env.LOCALAPPDATA ?? "";
|
|
23
|
+
const pf = process.env.ProgramFiles ?? "";
|
|
24
|
+
const pf86 = process.env["ProgramFiles(x86)"] ?? "";
|
|
25
|
+
const systemRoot = process.env.SystemRoot ?? "C:\\Windows";
|
|
26
|
+
return [
|
|
27
|
+
{ id: "explorer", label: "File Explorer", bundle: join2(systemRoot, "explorer.exe") },
|
|
28
|
+
{ id: "vscode", label: "Visual Studio Code", bundle: join2(local, "Programs", "Microsoft VS Code", "Code.exe") },
|
|
29
|
+
{ id: "vscode", label: "Visual Studio Code", bundle: join2(pf, "Microsoft VS Code", "Code.exe") },
|
|
30
|
+
{ id: "vscode", label: "Visual Studio Code", bundle: join2(pf86, "Microsoft VS Code", "Code.exe") },
|
|
31
|
+
{ id: "windowsterminal", label: "Windows Terminal", bundle: join2(local, "Microsoft", "WindowsApps", "wt.exe") },
|
|
32
|
+
{ id: "gitbash", label: "Git Bash", bundle: join2(pf, "Git", "git-bash.exe") },
|
|
33
|
+
{ id: "gitbash", label: "Git Bash", bundle: join2(pf86, "Git", "git-bash.exe") }
|
|
34
|
+
];
|
|
35
|
+
}
|
|
21
36
|
async function resolveCatalog(platform = process.platform, exists = defaultExists) {
|
|
37
|
+
if (platform === "win32") {
|
|
38
|
+
const found = [];
|
|
39
|
+
const seen = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const candidate of windowsCandidates()) {
|
|
41
|
+
if (seen.has(candidate.id)) continue;
|
|
42
|
+
if (await exists(candidate.bundle)) {
|
|
43
|
+
found.push(candidate);
|
|
44
|
+
seen.add(candidate.id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (!seen.has("explorer"))
|
|
48
|
+
found.unshift({ id: "explorer", label: "File Explorer", bundle: join2(process.env.SystemRoot ?? "C:\\Windows", "explorer.exe") });
|
|
49
|
+
return found;
|
|
50
|
+
}
|
|
22
51
|
if (platform !== "darwin")
|
|
23
52
|
return [];
|
|
24
53
|
const found = [];
|
|
@@ -38,6 +67,12 @@ async function defaultExists(path) {
|
|
|
38
67
|
}
|
|
39
68
|
}
|
|
40
69
|
function openCommand(launcher, path) {
|
|
70
|
+
if (launcher.id === "explorer" || launcher.id === "vscode")
|
|
71
|
+
return { command: launcher.bundle, args: [path] };
|
|
72
|
+
if (launcher.id === "windowsterminal")
|
|
73
|
+
return { command: launcher.bundle, args: ["-d", path] };
|
|
74
|
+
if (launcher.id === "gitbash")
|
|
75
|
+
return { command: launcher.bundle, args: ["--cd=" + path] };
|
|
41
76
|
return { command: "open", args: ["-a", launcher.bundle, path] };
|
|
42
77
|
}
|
|
43
78
|
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
* modify date 17/10/2026
|
|
6
6
|
* desc Bang ung dung mo duoc (catalog cua row open-in-app) + nhan dien tren macOS.
|
|
7
7
|
*/
|
|
8
|
+
import { join } from "node:path";
|
|
8
9
|
/**
|
|
9
10
|
* Ma ung dung trong catalog — dung y 5 id ma oracle phuc vu tren macOS.
|
|
10
11
|
*/
|
|
11
|
-
export type OpenInAppId = "finder" | "vscode" | "xcode" | "iterm" | "terminal";
|
|
12
|
+
export type OpenInAppId = "finder" | "explorer" | "vscode" | "windowsterminal" | "gitbash" | "xcode" | "iterm" | "terminal";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Thu tu id trong catalog (giu nguyen thu tu oracle tra ve: finder, vscode, xcode, iterm, terminal).
|
|
15
16
|
*/
|
|
16
|
-
export const OPEN_IN_APP_IDS: readonly OpenInAppId[] = ["finder", "vscode", "xcode", "iterm", "terminal"];
|
|
17
|
+
export const OPEN_IN_APP_IDS: readonly OpenInAppId[] = ["finder", "explorer", "vscode", "windowsterminal", "gitbash", "xcode", "iterm", "terminal"];
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Mot muc catalog da resolve: bundle .app ton tai tren may.
|
|
@@ -41,6 +42,27 @@ export function darwinCandidates(): readonly OpenInAppLauncher[] {
|
|
|
41
42
|
];
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Ung vien tren Windows: File Explorer, VS Code, Windows Terminal, Git Bash.
|
|
47
|
+
* Duong dan tuyet doi de `launch` khong phu thuoc PATH/resolveExecutable.
|
|
48
|
+
* @returns danh sach ung vien theo thu tu menu.
|
|
49
|
+
*/
|
|
50
|
+
export function windowsCandidates(): readonly OpenInAppLauncher[] {
|
|
51
|
+
const local = process.env.LOCALAPPDATA ?? "";
|
|
52
|
+
const pf = process.env.ProgramFiles ?? "";
|
|
53
|
+
const pf86 = process.env["ProgramFiles(x86)"] ?? "";
|
|
54
|
+
const systemRoot = process.env.SystemRoot ?? "C:\\Windows";
|
|
55
|
+
return [
|
|
56
|
+
{ id: "explorer", label: "File Explorer", bundle: join(systemRoot, "explorer.exe") },
|
|
57
|
+
{ id: "vscode", label: "Visual Studio Code", bundle: join(local, "Programs", "Microsoft VS Code", "Code.exe") },
|
|
58
|
+
{ id: "vscode", label: "Visual Studio Code", bundle: join(pf, "Microsoft VS Code", "Code.exe") },
|
|
59
|
+
{ id: "vscode", label: "Visual Studio Code", bundle: join(pf86, "Microsoft VS Code", "Code.exe") },
|
|
60
|
+
{ id: "windowsterminal", label: "Windows Terminal", bundle: join(local, "Microsoft", "WindowsApps", "wt.exe") },
|
|
61
|
+
{ id: "gitbash", label: "Git Bash", bundle: join(pf, "Git", "git-bash.exe") },
|
|
62
|
+
{ id: "gitbash", label: "Git Bash", bundle: join(pf86, "Git", "git-bash.exe") },
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
|
|
44
66
|
/**
|
|
45
67
|
* Loc ung vien con cai thuc su ton tai tren may.
|
|
46
68
|
* Nguon su that la he thong tep (khong doan): chi bundle co that moi vao catalog.
|
|
@@ -52,6 +74,23 @@ export async function resolveCatalog(
|
|
|
52
74
|
platform: string = process.platform,
|
|
53
75
|
exists: (path: string) => Promise<boolean> = defaultExists,
|
|
54
76
|
): Promise<OpenInAppLauncher[]> {
|
|
77
|
+
// 20/11/2026 — Windows phải có menu "Mở bằng" giống macOS. Catalog gồm File Explorer,
|
|
78
|
+
// VS Code, Windows Terminal, Git Bash; chỉ entry có thật trên máy mới được trả về.
|
|
79
|
+
if (platform === "win32") {
|
|
80
|
+
const found: OpenInAppLauncher[] = [];
|
|
81
|
+
const seen = new Set<OpenInAppId>();
|
|
82
|
+
for (const candidate of windowsCandidates()) {
|
|
83
|
+
if (seen.has(candidate.id)) continue;
|
|
84
|
+
if (await exists(candidate.bundle)) {
|
|
85
|
+
found.push(candidate);
|
|
86
|
+
seen.add(candidate.id);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (!seen.has("explorer")) {
|
|
90
|
+
found.unshift({ id: "explorer", label: "File Explorer", bundle: join(process.env.SystemRoot ?? "C:\\Windows", "explorer.exe") });
|
|
91
|
+
}
|
|
92
|
+
return found;
|
|
93
|
+
}
|
|
55
94
|
if (platform !== "darwin") return [];
|
|
56
95
|
const found: OpenInAppLauncher[] = [];
|
|
57
96
|
for (const candidate of darwinCandidates()) {
|
|
@@ -82,5 +121,14 @@ async function defaultExists(path: string): Promise<boolean> {
|
|
|
82
121
|
* @returns cap lenh + tham so cho node:child_process.
|
|
83
122
|
*/
|
|
84
123
|
export function openCommand(launcher: OpenInAppLauncher, path: string): { command: string; args: string[] } {
|
|
124
|
+
if (launcher.id === "explorer" || launcher.id === "vscode") {
|
|
125
|
+
return { command: launcher.bundle, args: [path] };
|
|
126
|
+
}
|
|
127
|
+
if (launcher.id === "windowsterminal") {
|
|
128
|
+
return { command: launcher.bundle, args: ["-d", path] };
|
|
129
|
+
}
|
|
130
|
+
if (launcher.id === "gitbash") {
|
|
131
|
+
return { command: launcher.bundle, args: ["--cd=" + path] };
|
|
132
|
+
}
|
|
85
133
|
return { command: "open", args: ["-a", launcher.bundle, path] };
|
|
86
134
|
}
|