@rallycry/conveyor-agent 11.0.51 → 11.1.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.
- package/dist/{boot-GD5XMLPS.js → boot-3FWYGHSN.js} +3 -2
- package/dist/{chunk-SXZS2R52.js → chunk-76JCOHPE.js} +2 -2
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/{chunk-NK6JMYEY.js → chunk-K2PCYBXI.js} +14034 -10603
- package/dist/{chunk-ATYCG6MT.js → chunk-MFGRXD4Y.js} +1 -1
- package/dist/chunk-MILKMRPU.js +10043 -0
- package/dist/{chunk-HIJWYTBH.js → chunk-NLVZSOKK.js} +12 -4
- package/dist/{chunk-XCO2BP6A.js → chunk-VVDV5P5Y.js} +1 -1
- package/dist/cli.js +11 -10
- package/dist/{client-VIFYMBT2.js → client-3EEFC7OD.js} +1 -0
- package/dist/gate-cli.js +1 -0
- package/dist/heartbeat-worker.js +28 -20
- package/dist/index.d.ts +79 -87
- package/dist/index.js +5 -4
- package/dist/{mode-ZJSOSLGU.js → mode-2XRJTIX6.js} +1 -0
- package/dist/{oom-watchdog-PAC5OJJG.js → oom-watchdog-YQYPVUKH.js} +1 -0
- package/dist/{protocol-QBCYO4GI.js → protocol-U6Z4MJ5S.js} +1 -0
- package/dist/{serve-boot-NMLVGJS3.js → serve-boot-3GJ3IFKW.js} +4 -3
- package/dist/{server-FPDS4CT5.js → server-3SSY4JV7.js} +3 -2
- package/package.json +4 -1
- package/skills/conveyor-prune/SKILL.md +1 -1
- package/dist/chunk-IA45XHOA.js +0 -141
package/dist/chunk-IA45XHOA.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// ../shared/dist/socket-core/index.js
|
|
2
|
-
function buildConveyorSocketOptions(auth) {
|
|
3
|
-
return {
|
|
4
|
-
auth,
|
|
5
|
-
transports: ["websocket"],
|
|
6
|
-
reconnection: true,
|
|
7
|
-
reconnectionAttempts: Infinity,
|
|
8
|
-
reconnectionDelay: 2e3,
|
|
9
|
-
reconnectionDelayMax: 3e4,
|
|
10
|
-
randomizationFactor: 0.3,
|
|
11
|
-
extraHeaders: { "ngrok-skip-browser-warning": "true" }
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function callWithAck(socket, event, payload, options) {
|
|
15
|
-
const { timeoutMs, requireData = false, makeTimeoutError, makeFailureError } = options;
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
let settled = false;
|
|
18
|
-
const timer = setTimeout(() => {
|
|
19
|
-
if (settled) return;
|
|
20
|
-
settled = true;
|
|
21
|
-
reject(makeTimeoutError());
|
|
22
|
-
}, timeoutMs);
|
|
23
|
-
socket.emit(event, payload, (response) => {
|
|
24
|
-
if (settled) return;
|
|
25
|
-
settled = true;
|
|
26
|
-
clearTimeout(timer);
|
|
27
|
-
if (response.success && (!requireData || response.data !== void 0)) {
|
|
28
|
-
resolve(response.data);
|
|
29
|
-
} else {
|
|
30
|
-
reject(makeFailureError(response.error));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function waitForConnected(socket, timeoutMs, makeTimeoutError) {
|
|
36
|
-
if (socket.connected) return Promise.resolve();
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
const cleanup = () => {
|
|
39
|
-
clearTimeout(timer);
|
|
40
|
-
socket.off("connect", onConnect);
|
|
41
|
-
};
|
|
42
|
-
const onConnect = () => {
|
|
43
|
-
cleanup();
|
|
44
|
-
resolve();
|
|
45
|
-
};
|
|
46
|
-
const timer = setTimeout(() => {
|
|
47
|
-
cleanup();
|
|
48
|
-
reject(makeTimeoutError());
|
|
49
|
-
}, timeoutMs);
|
|
50
|
-
socket.once("connect", onConnect);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/connection/loop-lag.ts
|
|
55
|
-
var LOOP_TICK_INTERVAL_MS = 250;
|
|
56
|
-
var LOOP_STALL_LOG_MS = 1e3;
|
|
57
|
-
var LOOP_STATUS_VALUES = ["active", "idle", "building", "waiting"];
|
|
58
|
-
function heartbeatStatusFor(status) {
|
|
59
|
-
return status === "waiting" ? "active" : status;
|
|
60
|
-
}
|
|
61
|
-
var WORKING_RUNNER_STATUSES = /* @__PURE__ */ new Set([
|
|
62
|
-
"connecting",
|
|
63
|
-
"connected",
|
|
64
|
-
"setup",
|
|
65
|
-
"fetching_context",
|
|
66
|
-
"running"
|
|
67
|
-
]);
|
|
68
|
-
var RESTING_RUNNER_STATUSES = /* @__PURE__ */ new Set([
|
|
69
|
-
"idle",
|
|
70
|
-
"waiting_for_input",
|
|
71
|
-
"stopping",
|
|
72
|
-
"finished",
|
|
73
|
-
"disconnected",
|
|
74
|
-
"error"
|
|
75
|
-
]);
|
|
76
|
-
function loopStatusForRunnerStatus(status) {
|
|
77
|
-
if (status === null || status === void 0) return "idle";
|
|
78
|
-
if (WORKING_RUNNER_STATUSES.has(status)) return "active";
|
|
79
|
-
if (RESTING_RUNNER_STATUSES.has(status)) return "idle";
|
|
80
|
-
return "active";
|
|
81
|
-
}
|
|
82
|
-
function lagFromBuffer(view) {
|
|
83
|
-
const last = view[0];
|
|
84
|
-
if (!last) return 0;
|
|
85
|
-
return Math.max(0, Date.now() - last - LOOP_TICK_INTERVAL_MS);
|
|
86
|
-
}
|
|
87
|
-
function statusFromBuffer(view) {
|
|
88
|
-
return LOOP_STATUS_VALUES[view[1]] ?? "active";
|
|
89
|
-
}
|
|
90
|
-
var LoopLagMonitor = class {
|
|
91
|
-
sharedBuffer = new SharedArrayBuffer(2 * Float64Array.BYTES_PER_ELEMENT);
|
|
92
|
-
view = new Float64Array(this.sharedBuffer);
|
|
93
|
-
timer = null;
|
|
94
|
-
maxLagMs = 0;
|
|
95
|
-
start() {
|
|
96
|
-
if (this.timer) return;
|
|
97
|
-
this.view[0] = Date.now();
|
|
98
|
-
this.timer = setInterval(() => {
|
|
99
|
-
const now = Date.now();
|
|
100
|
-
const lag = Math.max(0, now - this.view[0] - LOOP_TICK_INTERVAL_MS);
|
|
101
|
-
if (lag >= LOOP_STALL_LOG_MS) {
|
|
102
|
-
this.maxLagMs = Math.max(this.maxLagMs, lag);
|
|
103
|
-
process.stderr.write(
|
|
104
|
-
`[conveyor-agent] event-loop stall: ${Math.round(lag)}ms (${(/* @__PURE__ */ new Date()).toISOString()})
|
|
105
|
-
`
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
this.view[0] = now;
|
|
109
|
-
}, LOOP_TICK_INTERVAL_MS);
|
|
110
|
-
this.timer.unref();
|
|
111
|
-
}
|
|
112
|
-
stop() {
|
|
113
|
-
if (this.timer) clearInterval(this.timer);
|
|
114
|
-
this.timer = null;
|
|
115
|
-
}
|
|
116
|
-
/** Mirror the runner's current status for the worker to report. */
|
|
117
|
-
setStatus(status) {
|
|
118
|
-
const idx = LOOP_STATUS_VALUES.indexOf(status);
|
|
119
|
-
this.view[1] = idx === -1 ? 0 : idx;
|
|
120
|
-
}
|
|
121
|
-
/** Worst stall observed since the previous call (then reset). Includes the
|
|
122
|
-
* live lag so a beat sent mid-stall from this thread — possible when the
|
|
123
|
-
* heartbeat timer fires before the refresher in the same tick batch — is
|
|
124
|
-
* still truthful. */
|
|
125
|
-
takeMaxLagMs() {
|
|
126
|
-
const max = Math.max(this.maxLagMs, lagFromBuffer(this.view));
|
|
127
|
-
this.maxLagMs = 0;
|
|
128
|
-
return max;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export {
|
|
133
|
-
buildConveyorSocketOptions,
|
|
134
|
-
callWithAck,
|
|
135
|
-
waitForConnected,
|
|
136
|
-
heartbeatStatusFor,
|
|
137
|
-
loopStatusForRunnerStatus,
|
|
138
|
-
lagFromBuffer,
|
|
139
|
-
statusFromBuffer,
|
|
140
|
-
LoopLagMonitor
|
|
141
|
-
};
|