@melaya/runner 1.0.8 → 1.0.10
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/dist/cli.js +14 -8
- package/dist/connection.js +3 -2
- package/dist/localRelay.d.ts +1 -0
- package/dist/localRelay.js +4 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -25,14 +25,20 @@ const program = new Command()
|
|
|
25
25
|
.option("--verbose", "Show detailed logs", false)
|
|
26
26
|
.parse(process.argv);
|
|
27
27
|
const opts = program.opts();
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
28
|
+
// Logo colors: cyan → blue → indigo gradient (matching melaya.org)
|
|
29
|
+
const c1 = chalk.hex("#22D3EE").bold;
|
|
30
|
+
const c2 = chalk.hex("#10B0F0").bold;
|
|
31
|
+
const c3 = chalk.hex("#0090E8").bold;
|
|
32
|
+
const c4 = chalk.hex("#0070D8").bold;
|
|
33
|
+
const c5 = chalk.hex("#0050C8").bold;
|
|
34
|
+
const c6 = chalk.hex("#0038B0").bold;
|
|
34
35
|
const br = chalk.hex("#22D3EE");
|
|
35
|
-
const dm = chalk.hex("#
|
|
36
|
+
const dm = chalk.hex("#555");
|
|
37
|
+
import { readFileSync } from "fs";
|
|
38
|
+
import { fileURLToPath } from "url";
|
|
39
|
+
import { dirname, join } from "path";
|
|
40
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
41
|
+
const { version } = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
36
42
|
const BANNER = `
|
|
37
43
|
${c1("███╗ ███╗")} ${c2("███████╗")} ${c3("██╗")} ${c4("█████╗")} ${c5("██╗ ██╗")} ${c6("█████╗")}
|
|
38
44
|
${c1("████╗ ████║")} ${c2("██╔════╝")} ${c3("██║")} ${c4("██╔══██╗")} ${c5("╚██╗ ██╔╝")} ${c6("██╔══██╗")}
|
|
@@ -41,7 +47,7 @@ const BANNER = `
|
|
|
41
47
|
${c1("██║ ╚═╝ ██║")} ${c2("███████╗")} ${c3("███████╗")} ${c4("██║ ██║")} ${c5("██║")} ${c6("██║ ██║")}
|
|
42
48
|
${c1("╚═╝ ╚═╝")} ${c2("╚══════╝")} ${c3("╚══════╝")} ${c4("╚═╝ ╚═╝")} ${c5("╚═╝")} ${c6("╚═╝ ╚═╝")}
|
|
43
49
|
|
|
44
|
-
${br("▸")} ${dm("Local AI Pipeline Runner")} ${chalk.hex("#333")(
|
|
50
|
+
${br("▸")} ${dm("Local AI Pipeline Runner")} ${chalk.hex("#333")(`v${version}`)}
|
|
45
51
|
${br("─────────────────────────────────────────────────────")}
|
|
46
52
|
`;
|
|
47
53
|
async function main() {
|
package/dist/connection.js
CHANGED
|
@@ -17,7 +17,7 @@ import { spawn } from "child_process";
|
|
|
17
17
|
import { writeFileSync, mkdirSync } from "fs";
|
|
18
18
|
import { join } from "path";
|
|
19
19
|
import { tmpdir } from "os";
|
|
20
|
-
import { startLocalRelay } from "./localRelay.js";
|
|
20
|
+
import { startLocalRelay, setActiveProject } from "./localRelay.js";
|
|
21
21
|
import { ensureSharedModules, getSharedDir } from "./sharedVendor.js";
|
|
22
22
|
const HEARTBEAT_INTERVAL = 30_000;
|
|
23
23
|
const activeProcesses = new Map();
|
|
@@ -80,7 +80,8 @@ export async function connect(opts) {
|
|
|
80
80
|
}
|
|
81
81
|
// Ensure shared modules are cached
|
|
82
82
|
await ensureSharedModules(opts.serverUrl, payload.sharedVersion);
|
|
83
|
-
// Register run in DB
|
|
83
|
+
// Register run in DB + set active project for event relay
|
|
84
|
+
setActiveProject(payload.project);
|
|
84
85
|
socket.emit("runner:registerRun", {
|
|
85
86
|
runId: payload.runId,
|
|
86
87
|
project: payload.project,
|
package/dist/localRelay.d.ts
CHANGED
package/dist/localRelay.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import crypto from "crypto";
|
|
13
13
|
import http from "http";
|
|
14
|
+
let _activeProject = null;
|
|
15
|
+
export function setActiveProject(project) { _activeProject = project; }
|
|
14
16
|
export function startLocalRelay(socket, verbose) {
|
|
15
17
|
const nonce = crypto.randomUUID().replace(/-/g, "");
|
|
16
18
|
return new Promise((resolve, reject) => {
|
|
@@ -26,6 +28,8 @@ export function startLocalRelay(socket, verbose) {
|
|
|
26
28
|
req.on("end", () => {
|
|
27
29
|
try {
|
|
28
30
|
const payload = JSON.parse(body);
|
|
31
|
+
if (_activeProject && !payload.project)
|
|
32
|
+
payload.project = _activeProject;
|
|
29
33
|
socket.emit("runner:event", payload);
|
|
30
34
|
if (verbose) {
|
|
31
35
|
const type = payload.event_type || "unknown";
|