@melaya/runner 1.0.9 → 1.0.11
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/connection.js +11 -2
- package/dist/localRelay.d.ts +1 -0
- package/dist/localRelay.js +4 -0
- package/package.json +1 -1
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,
|
|
@@ -133,6 +134,14 @@ export async function connect(opts) {
|
|
|
133
134
|
activeProcesses.delete(payload.runId);
|
|
134
135
|
const status = code === 0 ? "done" : "failed";
|
|
135
136
|
socket.emit("runner:runComplete", { runId: payload.runId, status });
|
|
137
|
+
// Also emit a pushEvent so the frontend clears the LIVE state
|
|
138
|
+
// (runner:runComplete only updates the DB, it doesn't broadcast)
|
|
139
|
+
socket.emit("runner:event", {
|
|
140
|
+
run_id: payload.runId,
|
|
141
|
+
event_type: "run_status",
|
|
142
|
+
status,
|
|
143
|
+
project: payload.project,
|
|
144
|
+
});
|
|
136
145
|
console.log(chalk.gray(` ■ Pipeline finished (exit ${code})\n`));
|
|
137
146
|
console.log(chalk.gray(" Waiting for pipeline runs...\n"));
|
|
138
147
|
});
|
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";
|