@galaxy-stack/blackhole-cli 2.4.0 → 3.0.1

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.
Files changed (164) hide show
  1. package/README.md +82 -47
  2. package/dist/application.d.ts.map +1 -1
  3. package/dist/application.js +13 -2
  4. package/dist/application.js.map +1 -1
  5. package/dist/cli-meta.d.ts +8 -0
  6. package/dist/cli-meta.d.ts.map +1 -1
  7. package/dist/cli-meta.js +11 -0
  8. package/dist/cli-meta.js.map +1 -1
  9. package/dist/cli.js +26 -9
  10. package/dist/cli.js.map +1 -1
  11. package/dist/config-command.d.ts +11 -14
  12. package/dist/config-command.d.ts.map +1 -1
  13. package/dist/config-command.js +41 -118
  14. package/dist/config-command.js.map +1 -1
  15. package/dist/doctor.d.ts +8 -2
  16. package/dist/doctor.d.ts.map +1 -1
  17. package/dist/doctor.js +11 -15
  18. package/dist/doctor.js.map +1 -1
  19. package/dist/file-index.d.ts +50 -0
  20. package/dist/file-index.d.ts.map +1 -1
  21. package/dist/file-index.js +124 -0
  22. package/dist/file-index.js.map +1 -1
  23. package/dist/harness/boot.d.ts +87 -0
  24. package/dist/harness/boot.d.ts.map +1 -0
  25. package/dist/harness/boot.js +111 -0
  26. package/dist/harness/boot.js.map +1 -0
  27. package/dist/harness/catalogs.d.ts +50 -0
  28. package/dist/harness/catalogs.d.ts.map +1 -0
  29. package/dist/harness/catalogs.js +34 -0
  30. package/dist/harness/catalogs.js.map +1 -0
  31. package/dist/harness/chat.d.ts +90 -0
  32. package/dist/harness/chat.d.ts.map +1 -0
  33. package/dist/harness/chat.js +260 -0
  34. package/dist/harness/chat.js.map +1 -0
  35. package/dist/harness/client.d.ts +72 -0
  36. package/dist/harness/client.d.ts.map +1 -0
  37. package/dist/harness/client.js +173 -0
  38. package/dist/harness/client.js.map +1 -0
  39. package/dist/harness/command.d.ts +22 -0
  40. package/dist/harness/command.d.ts.map +1 -0
  41. package/dist/harness/command.js +142 -0
  42. package/dist/harness/command.js.map +1 -0
  43. package/dist/harness/composer.d.ts +46 -0
  44. package/dist/harness/composer.d.ts.map +1 -0
  45. package/dist/harness/composer.js +127 -0
  46. package/dist/harness/composer.js.map +1 -0
  47. package/dist/harness/conversation.d.ts +75 -0
  48. package/dist/harness/conversation.d.ts.map +1 -0
  49. package/dist/harness/conversation.js +196 -0
  50. package/dist/harness/conversation.js.map +1 -0
  51. package/dist/harness/help.d.ts +56 -0
  52. package/dist/harness/help.d.ts.map +1 -0
  53. package/dist/harness/help.js +85 -0
  54. package/dist/harness/help.js.map +1 -0
  55. package/dist/harness/history.d.ts +108 -0
  56. package/dist/harness/history.d.ts.map +1 -0
  57. package/dist/harness/history.js +268 -0
  58. package/dist/harness/history.js.map +1 -0
  59. package/dist/harness/labels.d.ts +164 -0
  60. package/dist/harness/labels.d.ts.map +1 -0
  61. package/dist/harness/labels.js +271 -0
  62. package/dist/harness/labels.js.map +1 -0
  63. package/dist/harness/locate.d.ts +28 -0
  64. package/dist/harness/locate.d.ts.map +1 -0
  65. package/dist/harness/locate.js +73 -0
  66. package/dist/harness/locate.js.map +1 -0
  67. package/dist/harness/menus.d.ts +74 -0
  68. package/dist/harness/menus.d.ts.map +1 -0
  69. package/dist/harness/menus.js +140 -0
  70. package/dist/harness/menus.js.map +1 -0
  71. package/dist/harness/model-name.d.ts +73 -0
  72. package/dist/harness/model-name.d.ts.map +1 -0
  73. package/dist/harness/model-name.js +101 -0
  74. package/dist/harness/model-name.js.map +1 -0
  75. package/dist/harness/node-runtime.d.ts +64 -0
  76. package/dist/harness/node-runtime.d.ts.map +1 -0
  77. package/dist/harness/node-runtime.js +109 -0
  78. package/dist/harness/node-runtime.js.map +1 -0
  79. package/dist/harness/parts.d.ts +239 -0
  80. package/dist/harness/parts.d.ts.map +1 -0
  81. package/dist/harness/parts.js +266 -0
  82. package/dist/harness/parts.js.map +1 -0
  83. package/dist/harness/preset.d.ts +124 -0
  84. package/dist/harness/preset.d.ts.map +1 -0
  85. package/dist/harness/preset.js +197 -0
  86. package/dist/harness/preset.js.map +1 -0
  87. package/dist/harness/process.d.ts +55 -0
  88. package/dist/harness/process.d.ts.map +1 -0
  89. package/dist/harness/process.js +124 -0
  90. package/dist/harness/process.js.map +1 -0
  91. package/dist/harness/screen.d.ts +33 -0
  92. package/dist/harness/screen.d.ts.map +1 -0
  93. package/dist/harness/screen.js +1070 -0
  94. package/dist/harness/screen.js.map +1 -0
  95. package/dist/harness/sessions.d.ts +55 -0
  96. package/dist/harness/sessions.d.ts.map +1 -0
  97. package/dist/harness/sessions.js +92 -0
  98. package/dist/harness/sessions.js.map +1 -0
  99. package/dist/harness/skills.d.ts +90 -0
  100. package/dist/harness/skills.d.ts.map +1 -0
  101. package/dist/harness/skills.js +133 -0
  102. package/dist/harness/skills.js.map +1 -0
  103. package/dist/harness/slash-palette.d.ts +32 -0
  104. package/dist/harness/slash-palette.d.ts.map +1 -0
  105. package/dist/harness/slash-palette.js +48 -0
  106. package/dist/harness/slash-palette.js.map +1 -0
  107. package/dist/harness/slash.d.ts +113 -0
  108. package/dist/harness/slash.d.ts.map +1 -0
  109. package/dist/harness/slash.js +187 -0
  110. package/dist/harness/slash.js.map +1 -0
  111. package/dist/harness/trajectory.d.ts +74 -0
  112. package/dist/harness/trajectory.d.ts.map +1 -0
  113. package/dist/harness/trajectory.js +270 -0
  114. package/dist/harness/trajectory.js.map +1 -0
  115. package/dist/harness/tui.d.ts +28 -0
  116. package/dist/harness/tui.d.ts.map +1 -0
  117. package/dist/harness/tui.js +143 -0
  118. package/dist/harness/tui.js.map +1 -0
  119. package/dist/manual-config.d.ts +23 -10
  120. package/dist/manual-config.d.ts.map +1 -1
  121. package/dist/manual-config.js +45 -37
  122. package/dist/manual-config.js.map +1 -1
  123. package/dist/migrate.d.ts +32 -0
  124. package/dist/migrate.d.ts.map +1 -0
  125. package/dist/migrate.js +155 -0
  126. package/dist/migrate.js.map +1 -0
  127. package/dist/options.d.ts +5 -1
  128. package/dist/options.d.ts.map +1 -1
  129. package/dist/options.js +23 -4
  130. package/dist/options.js.map +1 -1
  131. package/dist/setup.d.ts +14 -10
  132. package/dist/setup.d.ts.map +1 -1
  133. package/dist/setup.js +25 -92
  134. package/dist/setup.js.map +1 -1
  135. package/dist/timeline.d.ts.map +1 -1
  136. package/dist/timeline.js +11 -0
  137. package/dist/timeline.js.map +1 -1
  138. package/dist/web/command.d.ts +5 -1
  139. package/dist/web/command.d.ts.map +1 -1
  140. package/dist/web/command.js +34 -6
  141. package/dist/web/command.js.map +1 -1
  142. package/dist/web/credentials.d.ts +7 -5
  143. package/dist/web/credentials.d.ts.map +1 -1
  144. package/dist/web/credentials.js +13 -48
  145. package/dist/web/credentials.js.map +1 -1
  146. package/dist/web/doctor.d.ts +1 -1
  147. package/dist/web/doctor.d.ts.map +1 -1
  148. package/dist/web/doctor.js +49 -61
  149. package/dist/web/doctor.js.map +1 -1
  150. package/dist/web/options.d.ts +26 -2
  151. package/dist/web/options.d.ts.map +1 -1
  152. package/dist/web/options.js +54 -18
  153. package/dist/web/options.js.map +1 -1
  154. package/dist/web/paths.d.ts +1 -1
  155. package/dist/web/paths.d.ts.map +1 -1
  156. package/dist/web/paths.js +2 -2
  157. package/dist/web/paths.js.map +1 -1
  158. package/dist/web/web.d.ts +56 -16
  159. package/dist/web/web.d.ts.map +1 -1
  160. package/dist/web/web.js +184 -168
  161. package/dist/web/web.js.map +1 -1
  162. package/package.json +4 -3
  163. package/web/brand/lib/client.js +4 -4
  164. package/web/patches/gbh-ui.patch.yml +6 -24
package/dist/web/web.js CHANGED
@@ -1,209 +1,225 @@
1
+ /**
2
+ * `blackhole web`: open the Galaxy Blackhole web GUI.
3
+ *
4
+ * The GUI is the blackhole-tauri harness (the same app the desktop shell loads),
5
+ * not the legacy in-process DSH build this package used to bundle. The launcher
6
+ * prints one authenticated URL; that URL is what this command opens, and its
7
+ * token must be exchanged by a navigation before any request is trusted.
8
+ */
1
9
  import { spawn } from "node:child_process";
2
- import { cpSync, existsSync, lstatSync, mkdirSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
3
- import { join, resolve } from "node:path";
4
- import { resolveDsh } from "./dsh.js";
5
- import { brandPackagePath, brandPatchPath, bundledPatchPath, defaultHome, overlayPath, uiPatchPath } from "./paths.js";
6
- import { credentialsFilePath, GALAXY_KEY_ENV, resolveGalaxyKey, resolveGalaxyKeySource } from "./credentials.js";
10
+ import { createServer } from "node:net";
11
+ import { homedir } from "node:os";
12
+ import { join } from "node:path";
13
+ import { findTauriRoot, systemLocateEnvironment } from "../harness/locate.js";
14
+ import { resolveNodeRuntime, systemNodeLookup } from "../harness/node-runtime.js";
15
+ import { BOOT_PHASES, bootPhaseFor, createBootReporter } from "../harness/boot.js";
16
+ import { resolveGalaxyKey } from "./credentials.js";
17
+ import { promoteLegacyCredential } from "../config-command.js";
7
18
  import { galaxyCredentialsPath } from "@galaxy-stack/ai-coder-core/adapters/node/config/galaxy-credentials";
8
19
  import { openUrl } from "./open-browser.js";
9
- const URL_PATTERN = /dsh web:\s*(\S+)/;
10
- function yamlScalar(value) {
11
- return JSON.stringify(value);
12
- }
20
+ /** The URL the launcher prints once the harness serves. */
21
+ const READY_URL = /https?:\/\/127\.0\.0\.1:\d+\/\?token=[A-Za-z0-9._~+/=-]+/u;
13
22
  /**
14
- * Write the per-run overlay.
15
- *
16
- * It always carries the credentials row: every Galaxy host reads and writes one
17
- * secrets document, `~/.galaxy/credentials.yaml` (see
18
- * documents/GALAXY_CREDENTIALS_SETTINGS_SYNC_PLAN.md), so the web GUI resolves the
19
- * same references the CLI and the extension write. An explicit path beats the
20
- * computed one, which keeps tests and relocated homes working.
23
+ * The line a busy FIXED port prints. A fixed default only earns its keep if a collision is stated
24
+ * out loud: silence would send the user to a URL nobody printed.
25
+ * @param port - the port that could not be bound.
26
+ * @returns one sentence with both ways out.
21
27
  */
22
- function writeOverlay(options, home) {
23
- const rows = [];
24
- rows.push("# Galaxy credentials: one shared document for the desktop app, the CLI, the extension, and this GUI.");
25
- rows.push("- id: credentials");
26
- rows.push(" config:");
27
- rows.push(" path: " + yamlScalar(process.env.GALAXY_CREDENTIALS_PATH ?? galaxyCredentialsPath()));
28
- rows.push("");
29
- if (options.model !== undefined) {
30
- rows.push("- id: agent-default-model");
31
- rows.push(" config:");
32
- rows.push(" provider: galaxy");
33
- rows.push(" model: " + yamlScalar(options.model));
34
- }
35
- if (options.preset !== undefined) {
36
- rows.push("- id: agent-preset-registry");
37
- rows.push(" config:");
38
- rows.push(" default: " + yamlScalar(options.preset));
39
- }
40
- mkdirSync(home, { recursive: true });
41
- const path = overlayPath(home);
42
- writeFileSync(path, rows.join("\n") + "\n", "utf8");
43
- return path;
28
+ export function busyPortMessage(port) {
29
+ return "cổng " + String(port) + " đang bận — dùng --port <cổng khác>, hoặc --port 0 để lấy cổng ngẫu nhiên.";
44
30
  }
45
31
  /**
46
- * Whether something is there, including a symlink that points at nothing.
47
- *
48
- * `existsSync` follows the link, so a symlink into an application bundle that has since moved reports the slot as
49
- * empty. That is how a dead link left behind by another installation made the brand permanently unavailable: the
50
- * code thought the slot was free, tried to create it, and collided with the thing it could not see.
32
+ * Probes whether this process could bind the port right now.
33
+ * @param port - the TCP port to try; 0 always counts as free because the OS picks one.
34
+ * @param host - bind host; the harness is loopback-only, so the probe is too.
35
+ * @returns true when the port is free.
51
36
  */
52
- function existsAsEntry(path) {
53
- try {
54
- lstatSync(path);
55
- return true;
56
- }
57
- catch {
58
- return false;
59
- }
60
- }
61
- function shellQuote(value) {
62
- if (value.length > 0 && /^[A-Za-z0-9_@%+=:,.-]+$/.test(value))
63
- return value;
64
- return "'" + value.split("'").join("'\\''") + "'";
37
+ export function isPortFree(port, host = "127.0.0.1") {
38
+ if (port === 0)
39
+ return Promise.resolve(true);
40
+ return new Promise((resolveProbe) => {
41
+ const probe = createServer();
42
+ probe.once("error", () => {
43
+ probe.close();
44
+ resolveProbe(false);
45
+ });
46
+ probe.once("listening", () => {
47
+ probe.close(() => resolveProbe(true));
48
+ });
49
+ probe.listen(port, host);
50
+ });
65
51
  }
66
- /** Link the gbh brand client package into the profile node_modules (best effort). */
67
52
  /**
68
- * Link the gbh brand client package into the profile node_modules.
53
+ * Plan the harness boot.
69
54
  *
70
- * A directory symlink needs privileges on Windows, which turned a cosmetic plugin into a dead web server: the
71
- * link was never created, the failure was swallowed, and the brand patch still demanded the package. A junction
72
- * needs no privileges, and a plain copy is the last resort, so the caller can always decide honestly.
55
+ * The launcher is a Node program, so the runtime is Node — never Bun: a machine that installed this
56
+ * CLI already has Node, and the harness kernel refuses anything below Node 26 anyway. Bun is only a
57
+ * build-time tool of the desktop checkout (it bundles the client plugins), never a boot dependency.
58
+ * @param options - parsed command options.
59
+ * @param environment - checkout, PATH and Node facts; defaults to this machine.
60
+ * @returns everything the spawn needs.
61
+ * @throws with an actionable message when Node >= 26 or the checkout is missing.
73
62
  */
74
- export function ensureBrandLink(home) {
75
- const dir = join(home, "profiles", "node_modules", "@galaxy-stack");
76
- const link = join(dir, "gbh-brand");
77
- const target = brandPackagePath();
78
- const alreadyLinked = () => {
79
- try {
80
- return readlinkSync(link) === target;
81
- }
82
- catch {
83
- return false;
84
- }
85
- };
86
- try {
87
- mkdirSync(dir, { recursive: true });
88
- if (existsAsEntry(link) && !alreadyLinked())
89
- rmSync(link, { force: true, recursive: true });
90
- if (existsAsEntry(link))
91
- return link;
92
- try {
93
- symlinkSync(target, link, process.platform === "win32" ? "junction" : "dir");
94
- return link;
95
- }
96
- catch {
97
- cpSync(target, link, { recursive: true, dereference: true });
98
- return link;
99
- }
100
- }
101
- catch (error) {
102
- /*
103
- * A skin that cannot be installed must say why: silence here once cost an afternoon of guessing why the interface
104
- * was not ours.
105
- */
106
- process.stderr.write("galaxy web: cannot link the brand into " + dir + ": " + (error instanceof Error ? error.message : String(error)) + "\n");
107
- return undefined;
108
- }
109
- }
110
- /** Resolve the DSH command, patch list, and environment for gbh web. */
111
- export function planWeb(options) {
112
- const runtime = resolveDsh();
113
- const home = options.home !== undefined ? options.home : defaultHome();
114
- const patches = [bundledPatchPath(), uiPatchPath()];
115
- if (options.brand) {
116
- if (ensureBrandLink(home) === undefined) {
117
- /* The skin is cosmetic: a browser with the plain UI beats a server that never starts. */
118
- process.stderr.write("galaxy web: brand plugin unavailable; starting without the branded skin.\n");
119
- }
120
- else {
121
- patches.push(brandPatchPath());
122
- }
123
- }
124
- patches.push(writeOverlay(options, home));
125
- for (const extra of options.patches)
126
- patches.push(resolve(extra));
127
- const args = [...runtime.baseArgs, "--profile", options.profile];
128
- for (const patch of patches)
63
+ export function planWeb(options, environment = { locate: systemLocateEnvironment(), nodes: systemNodeLookup() }) {
64
+ const root = findTauriRoot(environment.locate);
65
+ if (root === undefined)
66
+ throw new Error("Không tìm thấy blackhole-tauri. Đặt GBH_TAURI_ROOT tới bản checkout của nó.");
67
+ // Throws with the requirement, the fix and every binary it refused — no silent exit.
68
+ const node = resolveNodeRuntime(environment.nodes);
69
+ const home = options.home ?? ((process.env.GBH_HOME ?? "").trim() || join(homedir(), ".galaxy", "blackhole"));
70
+ // ONE port, the one the caller asked for. `--auto-port` is deliberately NOT passed: it is what made
71
+ // the printed URL change on every boot, and a fixed default is only fixed if a busy port fails loudly
72
+ // instead of sliding to a random one. `--port 0` still means "OS picks", which is the opt-in path.
73
+ const args = [join(root, "apps", "cli", "src", "main.ts"), "host", "--port", String(options.port)];
74
+ if (options.profile !== undefined && options.profile.length > 0)
75
+ args.push("--profile", options.profile);
76
+ for (const patch of options.patches)
129
77
  args.push("--patch", patch);
130
- args.push("--no-open", "--port", String(options.port), "--host", options.host);
131
- const env = { ...process.env, DSH_HOME: home, DSH_TOOLS_MODE: options.toolsMode };
132
- /*
133
- * The key is resolved from the stores every host shares, never injected into the launch environment: DSH
134
- * treats an environment key as externally managed and locks the field in its dialog. resolveGalaxyKey
135
- * writes a legacy key into the shared store on the way through, so the dialog always owns the value.
136
- */
137
- const resolved = resolveGalaxyKey(home, env);
138
- const keySource = resolved?.source ?? resolveGalaxyKeySource(home, env);
139
- return {
140
- command: runtime.command,
141
- args,
78
+ // GBH_NODE pins the same runtime for the launcher's own kernel lookup, so the version printed by
79
+ // --dry-run is the version that boots the harness.
80
+ const env = { ...process.env, GBH_HOME: home, GBH_NODE: node.bin };
81
+ // GBH_CREDENTIALS moves the shared document for the harness; read the same file here.
82
+ const credentials = (process.env.GBH_CREDENTIALS ?? "").trim() || galaxyCredentialsPath();
83
+ const key = resolveGalaxyKey(env, credentials);
84
+ return Object.freeze({
85
+ command: node.bin,
86
+ args: Object.freeze(args),
142
87
  env,
143
- patches,
144
88
  home,
145
- runtimeSource: runtime.source,
146
- ...(keySource === undefined ? {} : { keySource }),
147
- };
89
+ root,
90
+ source: "blackhole-tauri " + root,
91
+ nodeVersion: node.version,
92
+ nodeSource: node.source,
93
+ ...(key === undefined ? {} : { keySource: key.source }),
94
+ });
148
95
  }
149
- /** Boot the DSH web GUI, open the browser, and propagate the exit code. */
96
+ /**
97
+ * Boot the Galaxy Blackhole web GUI and open its authenticated URL.
98
+ * @param options - parsed command options.
99
+ * @returns the launcher exit code.
100
+ */
150
101
  export async function runWeb(options) {
151
- const plan = planWeb(options);
102
+ let plan;
103
+ try {
104
+ // The harness reads the shared document only; a key left in the legacy DSH store is promoted
105
+ // once before boot. A dry run never writes.
106
+ if (!options.dryRun)
107
+ promoteLegacyCredential();
108
+ plan = planWeb(options);
109
+ }
110
+ catch (error) {
111
+ process.stderr.write("blackhole web: " + (error instanceof Error ? error.message : String(error)) + "\n");
112
+ return 1;
113
+ }
152
114
  if (options.dryRun) {
153
115
  process.stdout.write("cwd: " + process.cwd() + "\n");
154
- process.stdout.write("DSH_HOME=" + plan.home + " DSH_TOOLS_MODE=" + options.toolsMode + "\n");
155
- process.stdout.write("runtime: " + plan.runtimeSource + "\n");
156
- process.stdout.write("galaxy key: " + (plan.keySource === undefined ? "NOT SET" : "set via " + plan.keySource) + "\n");
157
- process.stdout.write("patches:\n");
158
- for (const patch of plan.patches)
159
- process.stdout.write(" " + patch + "\n");
160
- process.stdout.write(shellQuote(plan.command) + " " + plan.args.map(shellQuote).join(" ") + "\n");
116
+ process.stdout.write("GBH_HOME=" + plan.home + "\n");
117
+ process.stdout.write("harness: " + plan.source + "\n");
118
+ process.stdout.write("node: " + plan.nodeVersion + " (" + plan.command + ", " + plan.nodeSource + ")\n");
119
+ process.stdout.write("galaxy key: " + (plan.keySource === undefined ? "NOT SET (hộp thoại GBH sẽ hỏi)" : "set via " + plan.keySource) + "\n");
120
+ process.stdout.write([plan.command, ...plan.args].map(value => JSON.stringify(value)).join(" ") + "\n");
161
121
  return 0;
162
122
  }
123
+ if (options.brand === false) {
124
+ process.stderr.write("blackhole web: giao diện Galaxy Blackhole là mặc định của harness; --no-brand không còn tác dụng.\n");
125
+ }
163
126
  if (plan.keySource === undefined) {
164
- process.stderr.write("gbh: No Galaxy API key yet: " + GALAXY_KEY_ENV + " is not exported and " + credentialsFilePath(plan.home) + " does not reference it. " +
165
- "The Galaxy Blackhole dialog will ask for it on first load and store it there.\n");
127
+ process.stderr.write("blackhole web: chưa có API key trong ~/.galaxy/credentials.yaml hoặc biến môi trường; hộp thoại của app sẽ hỏi ở lần mở đầu.\n");
166
128
  }
167
- const child = spawn(plan.command, plan.args, { cwd: process.cwd(), env: plan.env, stdio: ["inherit", "pipe", "pipe"] });
129
+ // The harness exits with "port busy" on its own, but that line is swallowed with the rest of its log
130
+ // when --verbose is off — the user would just see nothing. Ask here, so the answer names the port and
131
+ // both ways out. 0 is exempt: the OS hands out a free port.
132
+ if (!(await isPortFree(options.port))) {
133
+ process.stderr.write("blackhole web: " + busyPortMessage(options.port) + "\n");
134
+ return 1;
135
+ }
136
+ // One line of outcome, and only that line: the harness's own log (inspector devtools URL, plugin
137
+ // probes, mount notes) is noise for someone who just wants the GUI. --verbose or GBH_LOG=debug
138
+ // relays it, relabelled gbh.
139
+ const verbose = options.verbose || (process.env.GBH_LOG ?? "").trim().toLowerCase() === "debug";
140
+ const boot = verbose ? undefined : createBootReporter(process.stdout, BOOT_PHASES[0].label);
141
+ let phaseIndex = 0;
142
+ const advance = (phase) => {
143
+ if (phase === undefined)
144
+ return;
145
+ const index = BOOT_PHASES.findIndex(entry => entry.id === phase.id);
146
+ if (index <= phaseIndex)
147
+ return;
148
+ phaseIndex = index;
149
+ boot?.step(phase.label);
150
+ };
151
+ const child = spawn(plan.command, [...plan.args], { cwd: process.cwd(), env: plan.env, stdio: ["ignore", "pipe", "pipe"] });
168
152
  let seen = "";
169
- let opened = false;
170
- const scan = (chunk) => {
171
- if (opened || !options.open)
153
+ let settled = false;
154
+ /** Relay one launcher line, reading the harness's stock prefixes as gbh. */
155
+ const relayLine = (line, sink) => {
156
+ sink.write(line.replace(/^dsh (?=web:|inspector:|\b)/u, "gbh ").replace(/^\[bh\] ready /u, "gbh ready ") + "\n");
157
+ };
158
+ /** Fold one complete line into the boot: progress, optional relay, and the ready URL. */
159
+ const handleLine = (line, sink) => {
160
+ seen = (seen + line + "\n").slice(-16384);
161
+ advance(bootPhaseFor(line));
162
+ // The ready line is printed once, below, as this command's own result: relaying the host's copy
163
+ // as well would print the same URL twice under --verbose.
164
+ if (sink !== undefined && !READY_URL.test(line))
165
+ relayLine(line, sink);
166
+ if (settled)
172
167
  return;
173
- seen += chunk;
174
- const match = seen.match(URL_PATTERN);
175
- if (match !== null && match[1] !== undefined) {
176
- opened = true;
177
- openUrl(match[1]);
178
- }
168
+ const match = READY_URL.exec(seen);
169
+ if (match === null)
170
+ return;
171
+ settled = true;
172
+ boot?.clear();
173
+ // The token is the point of this line: it is the only way into this boot's session.
174
+ process.stdout.write("gbh web: " + match[0] + "\n");
175
+ if (options.open)
176
+ openUrl(match[0]);
177
+ };
178
+ /** A chunk reader that only ever hands complete lines to handleLine. */
179
+ const reader = (sink) => {
180
+ let buffer = "";
181
+ return (chunk) => {
182
+ buffer += chunk;
183
+ const lines = buffer.split(/\r?\n/u);
184
+ buffer = lines.pop() ?? "";
185
+ for (const line of lines)
186
+ handleLine(line, sink);
187
+ };
179
188
  };
180
189
  child.stdout?.setEncoding("utf8");
181
- child.stdout?.on("data", (chunk) => {
182
- process.stdout.write(chunk);
183
- scan(chunk);
184
- });
190
+ child.stdout?.on("data", reader(verbose ? process.stdout : undefined));
185
191
  child.stderr?.setEncoding("utf8");
186
- child.stderr?.on("data", (chunk) => {
187
- process.stderr.write(chunk);
188
- });
189
- const onSigterm = () => {
190
- if (!child.killed)
191
- child.kill("SIGTERM");
192
- };
193
- process.on("SIGTERM", onSigterm);
194
- const code = await new Promise((resolvePromise) => {
192
+ child.stderr?.on("data", reader(verbose ? process.stderr : undefined));
193
+ const onTerm = () => { if (!child.killed)
194
+ child.kill("SIGTERM"); };
195
+ process.on("SIGTERM", onTerm);
196
+ const code = await new Promise(resolvePromise => {
195
197
  child.on("error", (error) => {
196
- process.stderr.write("gbh: failed to start DSH: " + error.message + "\n");
198
+ process.stderr.write("blackhole web: không chạy được " + plan.command + ": " + error.message + "\n");
197
199
  resolvePromise(1);
198
200
  });
199
201
  child.on("close", (exitCode, signal) => {
202
+ // Exit 3 is the host's "port busy" (apps/cli/src/main.ts EXIT.portBusy). Its own line was
203
+ // swallowed above, so the one port the user asked for is named again here — the race between the
204
+ // probe and the bind is exactly the case this covers.
205
+ if (exitCode === 3 && !settled)
206
+ process.stderr.write("blackhole web: " + busyPortMessage(options.port) + "\n");
207
+ // A boot that dies before printing a URL must never be silent: the launcher's last lines are the
208
+ // only place that names the cause (no Node >= 26 for the kernel, a broken profile, …), and they
209
+ // were swallowed along with the rest of its log when --verbose is off.
210
+ if (!settled && exitCode !== 0 && exitCode !== 3) {
211
+ const tail = seen.trim();
212
+ if (tail.length > 0) {
213
+ process.stderr.write("blackhole web: harness thoát mã " + String(exitCode) + ":\n" + tail.split(/\r?\n/u).slice(-12).join("\n") + "\n");
214
+ }
215
+ }
200
216
  if (exitCode !== null)
201
217
  resolvePromise(exitCode);
202
218
  else
203
219
  resolvePromise(signal === "SIGINT" ? 130 : 1);
204
220
  });
205
221
  });
206
- process.off("SIGTERM", onSigterm);
222
+ process.off("SIGTERM", onTerm);
207
223
  return code;
208
224
  }
209
225
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACjH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qEAAqE,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAYvC,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,YAAY,CAAC,OAAmB,EAAE,IAAY;IACrD,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,CAAC,IAAI,CAAC,sGAAsG,CAAC,CAAC;IAClH,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACvB,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,UAAU,CAA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AAuE;YACvE,IAAI,CAAC,OAAO,IAAI,QAAQ,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;gBACjD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;gBACzB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC1I,CAAC;YACH,CAAC;YACD,IAAI,QAAQ,KAAK,IAAI;gBAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;;gBAC3C,cAAc,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galaxy-stack/blackhole-cli",
3
- "version": "2.4.0",
3
+ "version": "3.0.1",
4
4
  "private": false,
5
5
  "description": "Galaxy Code CLI and terminal UI for the Galaxy agent runtime",
6
6
  "license": "MIT",
@@ -35,10 +35,11 @@
35
35
  "ink": "7.1.1",
36
36
  "react": "^19.3.0",
37
37
  "string-width": "^8.2.2",
38
- "wrap-ansi": "^9.0.2"
38
+ "wrap-ansi": "^9.0.2",
39
+ "ws": "^8.21.3"
39
40
  },
40
41
  "optionalDependencies": {
41
- "@deepseek-ai/dsh": "^0.2.0-rc.2"
42
+ "@deepseek-ai/dsh": "0.2.1-alpha.4"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@types/node": "^22.19.15",