rterm-backend 2.7.1 → 2.7.3
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/bin/gybackend.js +25 -17
- package/package.json +1 -1
package/bin/gybackend.js
CHANGED
|
@@ -360739,7 +360739,7 @@ var AgentService_v2 = class {
|
|
|
360739
360739
|
state.messages
|
|
360740
360740
|
);
|
|
360741
360741
|
const messages = [...state.messages];
|
|
360742
|
-
const lastMessage = messages[messages.length - 1];
|
|
360742
|
+
const lastMessage = messages.length > 0 ? messages[messages.length - 1] : void 0;
|
|
360743
360743
|
let pendingToolCalls = [];
|
|
360744
360744
|
if (AIMessage.isInstance(lastMessage) && (hasEmptyMalformedToolCallFinishFlag(lastMessage) || isEmptyMalformedToolCallFinish(lastMessage, []))) {
|
|
360745
360745
|
this.helpers.sendEvent(sessionId, {
|
|
@@ -361623,7 +361623,7 @@ ${reminder}`;
|
|
|
361623
361623
|
const sessionId = state.sessionId;
|
|
361624
361624
|
if (!sessionId) throw new Error("No session ID in state");
|
|
361625
361625
|
const messages = [...state.messages];
|
|
361626
|
-
const lastMessage = messages[messages.length - 1];
|
|
361626
|
+
const lastMessage = messages.length > 0 ? messages[messages.length - 1] : void 0;
|
|
361627
361627
|
const lastMessageIsAi = AIMessage.isInstance(lastMessage);
|
|
361628
361628
|
const guardMessages = lastMessageIsAi || messages.length === 0 ? messages : messages.slice(0, -1);
|
|
361629
361629
|
if (!lastMessageIsAi && lastMessage) {
|
|
@@ -361800,7 +361800,7 @@ ${reminder}`;
|
|
|
361800
361800
|
const sessionId = state.sessionId;
|
|
361801
361801
|
if (!sessionId) return state;
|
|
361802
361802
|
const messages = Array.isArray(state.messages) ? [...state.messages] : [];
|
|
361803
|
-
const lastMessage = messages[messages.length - 1];
|
|
361803
|
+
const lastMessage = messages.length > 0 ? messages[messages.length - 1] : void 0;
|
|
361804
361804
|
const finalBoundaryMessages = AIMessage.isInstance(lastMessage) || messages.length === 0 ? messages : messages.slice(0, -1);
|
|
361805
361805
|
const queuedInsertionResult = this.appendQueuedInsertionMessagesForContinue(
|
|
361806
361806
|
sessionId,
|
|
@@ -362362,7 +362362,7 @@ ${reminder}`;
|
|
|
362362
362362
|
return "tools";
|
|
362363
362363
|
}
|
|
362364
362364
|
const messages = Array.isArray(state.messages) ? state.messages : [];
|
|
362365
|
-
const lastMessage = messages[messages.length - 1];
|
|
362365
|
+
const lastMessage = messages.length > 0 ? messages[messages.length - 1] : void 0;
|
|
362366
362366
|
if (AIMessage.isInstance(lastMessage) && (hasEmptyMalformedToolCallFinishFlag(lastMessage) || isEmptyMalformedToolCallFinish(lastMessage, []))) {
|
|
362367
362367
|
return "final_output";
|
|
362368
362368
|
}
|
|
@@ -362409,8 +362409,8 @@ ${reminder}`;
|
|
|
362409
362409
|
}
|
|
362410
362410
|
}
|
|
362411
362411
|
trimInterruptedToolCallHistory(messages, executedToolCall) {
|
|
362412
|
-
const lastMessage = messages[messages.length - 1];
|
|
362413
|
-
if (!AIMessage.isInstance(lastMessage)) {
|
|
362412
|
+
const lastMessage = messages.length > 0 ? messages[messages.length - 1] : void 0;
|
|
362413
|
+
if (!lastMessage || !AIMessage.isInstance(lastMessage)) {
|
|
362414
362414
|
return;
|
|
362415
362415
|
}
|
|
362416
362416
|
const toolCalls = Array.isArray(lastMessage.tool_calls) ? lastMessage.tool_calls : [];
|
|
@@ -377401,8 +377401,8 @@ var MetricsLedger = class {
|
|
|
377401
377401
|
var DEFAULT_WINDOW = 36e5;
|
|
377402
377402
|
function percentile(sorted, p) {
|
|
377403
377403
|
if (sorted.length === 0) return void 0;
|
|
377404
|
-
const
|
|
377405
|
-
return sorted[
|
|
377404
|
+
const rank = Math.max(1, Math.ceil(p / 100 * sorted.length));
|
|
377405
|
+
return sorted[Math.min(rank, sorted.length) - 1];
|
|
377406
377406
|
}
|
|
377407
377407
|
var GoldenSignals = class {
|
|
377408
377408
|
constructor(deps) {
|
|
@@ -381941,16 +381941,19 @@ function parseAperfReport(text) {
|
|
|
381941
381941
|
topProcs.sort((a, b) => b.cpuPercent - a.cpuPercent);
|
|
381942
381942
|
if (topProcs.length > 0) summary.topCpuProcesses = topProcs.slice(0, 5);
|
|
381943
381943
|
if (findings.length === 0) {
|
|
381944
|
-
|
|
381945
|
-
|
|
381946
|
-
|
|
381947
|
-
|
|
381944
|
+
const cpu = summary.cpuUsagePercent;
|
|
381945
|
+
if (cpu !== void 0 && cpu >= 90) {
|
|
381946
|
+
findings.push({ metric: "cpu_utilization", value: cpu, severity: "critical", message: `aggregate CPU utilization is ${cpu}% (>= 90%)` });
|
|
381947
|
+
} else if (cpu !== void 0 && cpu >= 75) {
|
|
381948
|
+
findings.push({ metric: "cpu_utilization", value: cpu, severity: "warning", message: `aggregate CPU utilization is ${cpu}% (>= 75%)` });
|
|
381948
381949
|
}
|
|
381949
|
-
|
|
381950
|
-
|
|
381950
|
+
const mem = summary.memUsagePercent;
|
|
381951
|
+
if (mem !== void 0 && mem >= 90) {
|
|
381952
|
+
findings.push({ metric: "memory", value: mem, severity: "critical", message: `memory utilization is ${mem}% (>= 90%)` });
|
|
381951
381953
|
}
|
|
381952
|
-
|
|
381953
|
-
|
|
381954
|
+
const disk = summary.diskUsagePercentMax;
|
|
381955
|
+
if (disk !== void 0 && disk >= 90) {
|
|
381956
|
+
findings.push({ metric: "disk", value: disk, severity: "critical", message: `a disk is at ${disk}% utilization (>= 90%)` });
|
|
381954
381957
|
}
|
|
381955
381958
|
if (summary.topCpuProcesses && summary.topCpuProcesses.length > 0) {
|
|
381956
381959
|
const top = summary.topCpuProcesses[0];
|
|
@@ -382119,7 +382122,12 @@ var AuditLedger = class _AuditLedger {
|
|
|
382119
382122
|
}
|
|
382120
382123
|
/** Import records from JSON (for recovery). Verifies the chain on import. */
|
|
382121
382124
|
import(json3) {
|
|
382122
|
-
|
|
382125
|
+
let parsed;
|
|
382126
|
+
try {
|
|
382127
|
+
parsed = JSON.parse(json3);
|
|
382128
|
+
} catch {
|
|
382129
|
+
return { imported: 0, valid: false, detail: "invalid JSON" };
|
|
382130
|
+
}
|
|
382123
382131
|
if (!Array.isArray(parsed)) {
|
|
382124
382132
|
return { imported: 0, valid: false, detail: "not an array" };
|
|
382125
382133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rterm-backend",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"description": "RTerm headless backend — run RTerm-as-a-service (AI agent, SSH/WinRM/Serial/local terminals, fleet orchestration, advanced automation with event-driven triggers + NATS event mesh, scheduled automation, SRE observability, Netdata integration, AWS APerf performance deep-dive, plugin system) and drive it over a WebSocket JSON-RPC gateway. No desktop UI required.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|