negotium 0.6.7 → 0.6.9
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/agent-helpers.js +2 -2
- package/dist/agent-helpers.js.map +2 -2
- package/dist/{chunk-f124y9d0.js → chunk-bhxdah5c.js} +2 -2
- package/dist/{chunk-f124y9d0.js.map → chunk-bhxdah5c.js.map} +2 -2
- package/dist/hosted-agent.js +2 -2
- package/dist/hosted-agent.js.map +2 -2
- package/dist/main.js +73 -20
- package/dist/main.js.map +5 -5
- package/dist/mcp-factories.js +68 -16
- package/dist/mcp-factories.js.map +4 -4
- package/dist/registry.js +1 -1
- package/dist/runtime/src/mcp/factories/system-health.ts +118 -16
- package/dist/runtime/src/version.ts +1 -1
- package/dist/types/packages/core/src/mcp/factories/system-health.d.ts +23 -3
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3674,7 +3674,7 @@ var exports_version = {};
|
|
|
3674
3674
|
__export(exports_version, {
|
|
3675
3675
|
NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
|
|
3676
3676
|
});
|
|
3677
|
-
var NEGOTIUM_VERSION = "0.6.
|
|
3677
|
+
var NEGOTIUM_VERSION = "0.6.9";
|
|
3678
3678
|
|
|
3679
3679
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
3680
3680
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -25107,7 +25107,7 @@ __export(exports_system_health, {
|
|
|
25107
25107
|
createSystemHealthMcpServer: () => createSystemHealthMcpServer
|
|
25108
25108
|
});
|
|
25109
25109
|
import { execFile as execFile2 } from "child_process";
|
|
25110
|
-
import { cpus,
|
|
25110
|
+
import { cpus, loadavg } from "os";
|
|
25111
25111
|
import { promisify as promisify2 } from "util";
|
|
25112
25112
|
import { McpServer as McpServer4 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
25113
25113
|
function fmtBytes(bytes) {
|
|
@@ -25119,13 +25119,58 @@ async function shell(command, args) {
|
|
|
25119
25119
|
return stdout.trim();
|
|
25120
25120
|
}
|
|
25121
25121
|
async function getMemoryPressure() {
|
|
25122
|
+
let level = "unknown";
|
|
25122
25123
|
try {
|
|
25123
|
-
const
|
|
25124
|
-
|
|
25124
|
+
const l = await shell("sysctl", ["-n", "kern.memorystatus_vm_pressure_level"]);
|
|
25125
|
+
level = l === "4" ? "critical" : l === "2" ? "warning" : "normal";
|
|
25126
|
+
} catch {}
|
|
25127
|
+
let freePct = null;
|
|
25128
|
+
try {
|
|
25129
|
+
const out = await shell("memory_pressure", []);
|
|
25130
|
+
const m = out.match(/System-wide memory free percentage:\s*(\d+)%/);
|
|
25131
|
+
if (m)
|
|
25132
|
+
freePct = Number(m[1]);
|
|
25133
|
+
} catch {}
|
|
25134
|
+
return { level, freePct };
|
|
25135
|
+
}
|
|
25136
|
+
async function getTotalMemBytes() {
|
|
25137
|
+
try {
|
|
25138
|
+
return Number(await shell("sysctl", ["-n", "hw.memsize"]));
|
|
25125
25139
|
} catch {
|
|
25126
|
-
return
|
|
25140
|
+
return 0;
|
|
25127
25141
|
}
|
|
25128
25142
|
}
|
|
25143
|
+
async function getVmStatMemory() {
|
|
25144
|
+
const [out, totalFromSysctl] = await Promise.all([shell("vm_stat", []), getTotalMemBytes()]);
|
|
25145
|
+
const extract = (label) => {
|
|
25146
|
+
const m = out.match(new RegExp(`${label.replace(/\s/g, "\\s")}:\\s+(\\d+)`));
|
|
25147
|
+
return m ? Number(m[1]) : 0;
|
|
25148
|
+
};
|
|
25149
|
+
const pageSize = Number(out.match(/page size of (\d+) bytes/)?.[1]) || 16384;
|
|
25150
|
+
const pagesFree = extract("Pages free");
|
|
25151
|
+
const pagesActive = extract("Pages active");
|
|
25152
|
+
const pagesInactive = extract("Pages inactive");
|
|
25153
|
+
const pagesSpeculative = extract("Pages speculative");
|
|
25154
|
+
const pagesWired = extract("Pages wired down");
|
|
25155
|
+
const pagesPurgeable = extract("Pages purgeable");
|
|
25156
|
+
const pagesCompressor = extract("Pages occupied by compressor");
|
|
25157
|
+
const activeBytes = pagesActive * pageSize;
|
|
25158
|
+
const wiredBytes = pagesWired * pageSize;
|
|
25159
|
+
const usedBytes = activeBytes + wiredBytes;
|
|
25160
|
+
const cacheBytes = (pagesInactive + pagesSpeculative + pagesPurgeable) * pageSize;
|
|
25161
|
+
const compressorBytes = pagesCompressor * pageSize;
|
|
25162
|
+
const totalBytes = totalFromSysctl || (pagesFree + pagesActive + pagesInactive + pagesSpeculative + pagesWired + pagesPurgeable + pagesCompressor) * pageSize;
|
|
25163
|
+
const availableBytes = Math.max(0, totalBytes - usedBytes);
|
|
25164
|
+
return {
|
|
25165
|
+
usedBytes,
|
|
25166
|
+
cacheBytes,
|
|
25167
|
+
compressorBytes,
|
|
25168
|
+
availableBytes,
|
|
25169
|
+
totalBytes,
|
|
25170
|
+
activeBytes,
|
|
25171
|
+
wiredBytes
|
|
25172
|
+
};
|
|
25173
|
+
}
|
|
25129
25174
|
async function getSwapUsage() {
|
|
25130
25175
|
try {
|
|
25131
25176
|
const output = await shell("sysctl", ["vm.swapusage"]);
|
|
@@ -25182,23 +25227,30 @@ function createSystemHealthMcpServer(host2 = defaultSystemHealthMcpHost) {
|
|
|
25182
25227
|
server.tool("get_system_health", [
|
|
25183
25228
|
"\uC2DC\uC2A4\uD15C \uC0C1\uD0DC\uB97C \uC870\uD68C\uD569\uB2C8\uB2E4.",
|
|
25184
25229
|
"- CPU \uBD80\uD558 (load average 1/5/15\uBD84)",
|
|
25185
|
-
"- \uBA54\uBAA8\uB9AC \uC0AC\uC6A9\
|
|
25230
|
+
"- \uBA54\uBAA8\uB9AC: \uC571 \uC2E4\uC0AC\uC6A9(active+wired) / \uD30C\uC77C\uCE90\uC2DC(\uBC18\uD658\uAC00\uB2A5) / available / \uC555\uB825(free%\xB7level)",
|
|
25186
25231
|
"- \uC2A4\uC651 \uC0AC\uC6A9\uB7C9",
|
|
25187
25232
|
"- \uB514\uC2A4\uD06C \uC0AC\uC6A9\uB960 (/)",
|
|
25188
25233
|
"- \uC5F4 \uC0C1\uD0DC (thermal)",
|
|
25189
|
-
"- \uD504\uB85C\uC138\uC2A4 \uC218"
|
|
25234
|
+
"- \uD504\uB85C\uC138\uC2A4 \uC218",
|
|
25235
|
+
"",
|
|
25236
|
+
"\u26A0\uFE0F Chromium/playwright \uB4F1 \uBB34\uAC70\uC6B4 \uD504\uB85C\uC138\uC2A4 \uC2E4\uD589 \uAC00\uB2A5 \uC5EC\uBD80\uB294 '\uBA54\uBAA8\uB9AC \uC0AC\uC6A9%'\uAC00 \uC544\uB2C8\uB77C",
|
|
25237
|
+
" \uBA54\uBAA8\uB9AC \uC555\uB825 \uB808\uBCA8(normal/warning/critical) + available GB \uB85C \uD310\uB2E8\uD560 \uAC83.",
|
|
25238
|
+
" (\uD30C\uC77C \uCE90\uC2DC\uB294 \uC555\uBC15 \uC2DC \uC989\uC2DC \uBC18\uD658\uB418\uBBC0\uB85C used%\uC5D0 \uAC81\uBA39\uC9C0 \uB9D0 \uAC83)"
|
|
25190
25239
|
].join(`
|
|
25191
25240
|
`), {}, async () => {
|
|
25192
25241
|
const snapshot = await host2.readSystemHealth();
|
|
25193
|
-
const
|
|
25194
|
-
const
|
|
25242
|
+
const { memory } = snapshot;
|
|
25243
|
+
const usedPct = memory.totalBytes > 0 ? (memory.usedBytes / memory.totalBytes * 100).toFixed(1) : "0.0";
|
|
25195
25244
|
const [load1, load5, load15] = snapshot.cpuLoad;
|
|
25245
|
+
const pressureStr = snapshot.memoryPressure.freePct !== null ? `${snapshot.memoryPressure.level} (free ${snapshot.memoryPressure.freePct}%)` : snapshot.memoryPressure.level;
|
|
25196
25246
|
return mcpOk([
|
|
25197
25247
|
"\uC2DC\uC2A4\uD15C \uC0C1\uD0DC",
|
|
25198
25248
|
"",
|
|
25199
25249
|
`CPU \uBD80\uD558: ${load1.toFixed(2)} / ${load5.toFixed(2)} / ${load15.toFixed(2)} (1/5/15\uBD84, \uCF54\uC5B4 ${snapshot.cpuCount}\uAC1C)`,
|
|
25200
|
-
`\uBA54\uBAA8\uB9AC:
|
|
25201
|
-
|
|
25250
|
+
`\uBA54\uBAA8\uB9AC \uC2E4\uC0AC\uC6A9: ${fmtBytes(memory.usedBytes)} / ${fmtBytes(memory.totalBytes)} (${usedPct}%) available: ${fmtBytes(memory.availableBytes)}`,
|
|
25251
|
+
` (active ${fmtBytes(memory.activeBytes)} + wired ${fmtBytes(memory.wiredBytes)})`,
|
|
25252
|
+
`\uD30C\uC77C \uCE90\uC2DC: ${fmtBytes(memory.cacheBytes)} (\uC555\uBC15 \uC2DC \uBC18\uD658 \uAC00\uB2A5) | \uC555\uCD95 ${fmtBytes(memory.compressorBytes)}`,
|
|
25253
|
+
`\uBA54\uBAA8\uB9AC \uC555\uB825: ${pressureStr}`,
|
|
25202
25254
|
`\uC2A4\uC651: ${snapshot.swap}`,
|
|
25203
25255
|
`\uB514\uC2A4\uD06C(/): ${snapshot.disk}`,
|
|
25204
25256
|
`\uC5F4 \uC0C1\uD0DC: ${snapshot.thermal}`,
|
|
@@ -25214,19 +25266,19 @@ var init_system_health = __esm(() => {
|
|
|
25214
25266
|
execFileAsync2 = promisify2(execFile2);
|
|
25215
25267
|
defaultSystemHealthMcpHost = {
|
|
25216
25268
|
async readSystemHealth() {
|
|
25217
|
-
const [memoryPressure, swap, thermal, disk, processCount] = await Promise.all([
|
|
25269
|
+
const [memoryPressure, swap, thermal, disk, processCount, memory] = await Promise.all([
|
|
25218
25270
|
getMemoryPressure(),
|
|
25219
25271
|
getSwapUsage(),
|
|
25220
25272
|
getThermal(),
|
|
25221
25273
|
getDisk(),
|
|
25222
|
-
getProcessCount()
|
|
25274
|
+
getProcessCount(),
|
|
25275
|
+
getVmStatMemory()
|
|
25223
25276
|
]);
|
|
25224
25277
|
const load = loadavg();
|
|
25225
25278
|
return {
|
|
25226
25279
|
cpuLoad: [load[0] ?? 0, load[1] ?? 0, load[2] ?? 0],
|
|
25227
25280
|
cpuCount: cpus().length,
|
|
25228
|
-
|
|
25229
|
-
memoryFree: freemem(),
|
|
25281
|
+
memory,
|
|
25230
25282
|
memoryPressure,
|
|
25231
25283
|
swap,
|
|
25232
25284
|
disk,
|
|
@@ -33985,7 +34037,8 @@ async function startDefaultNode(opts = {}) {
|
|
|
33985
34037
|
const modules = [];
|
|
33986
34038
|
if (process.env.NEGOTIUM_CRON !== "0") {
|
|
33987
34039
|
const { createCronModule: createCronModule2 } = await init_src4().then(() => exports_src2);
|
|
33988
|
-
|
|
34040
|
+
const trustedLocal = process.env.NEGOTIUM_CRON_TRUSTED_LOCAL === "1";
|
|
34041
|
+
modules.push(createCronModule2(trustedLocal ? { host: { authorize: () => true } } : {}));
|
|
33989
34042
|
}
|
|
33990
34043
|
const port = opts.port === 0 ? readFixedNodePort() ?? await availableLoopbackPort() : opts.port;
|
|
33991
34044
|
return startNode({ ...opts, port, modules });
|
|
@@ -46741,7 +46794,7 @@ var init_gateway_forward = __esm(async () => {
|
|
|
46741
46794
|
|
|
46742
46795
|
// ../../adapters/otium/src/peer-server.ts
|
|
46743
46796
|
import { statfsSync } from "fs";
|
|
46744
|
-
import { cpus as cpus2, freemem
|
|
46797
|
+
import { cpus as cpus2, freemem, loadavg as loadavg2, totalmem } from "os";
|
|
46745
46798
|
function jsonError2(error2, status) {
|
|
46746
46799
|
return Response.json({ ok: false, error: error2 }, { status });
|
|
46747
46800
|
}
|
|
@@ -46841,8 +46894,8 @@ function localHealth() {
|
|
|
46841
46894
|
uptimeSeconds: process.uptime(),
|
|
46842
46895
|
cpu: { cores: cpus2().length, loadAverage: loadavg2() },
|
|
46843
46896
|
memory: {
|
|
46844
|
-
totalBytes:
|
|
46845
|
-
freeBytes:
|
|
46897
|
+
totalBytes: totalmem(),
|
|
46898
|
+
freeBytes: freemem(),
|
|
46846
46899
|
processRssBytes: memory.rss,
|
|
46847
46900
|
processHeapUsedBytes: memory.heapUsed
|
|
46848
46901
|
},
|
|
@@ -48751,4 +48804,4 @@ switch (command) {
|
|
|
48751
48804
|
}
|
|
48752
48805
|
}
|
|
48753
48806
|
|
|
48754
|
-
//# debugId=
|
|
48807
|
+
//# debugId=4A0B3AF545043CDF64756E2164756E21
|