open-agents-ai 0.185.90 → 0.185.92
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/README.md +31 -0
- package/dist/index.js +68 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -646,6 +646,37 @@ curl -s http://localhost:11435/v1/chat \
|
|
|
646
646
|
# Response: {"session_id": "abc123", "message": {"role": "assistant", "content": "..."}}
|
|
647
647
|
```
|
|
648
648
|
|
|
649
|
+
**Request body:**
|
|
650
|
+
```json
|
|
651
|
+
{
|
|
652
|
+
"message": "What is happening in the world?",
|
|
653
|
+
"model": "qwen3.5:9b",
|
|
654
|
+
"session_id": "optional-uuid-from-previous-response",
|
|
655
|
+
"stream": true,
|
|
656
|
+
"max_tokens": 4096
|
|
657
|
+
}
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
**Response (non-streaming):**
|
|
661
|
+
```json
|
|
662
|
+
{
|
|
663
|
+
"session_id": "abc123-def4-5678-ghij-klmnopqrstuv",
|
|
664
|
+
"message": {
|
|
665
|
+
"role": "assistant",
|
|
666
|
+
"content": "Here are the major events happening today..."
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
**Response (streaming `stream: true`):** Server-Sent Events:
|
|
672
|
+
```
|
|
673
|
+
data: {"type":"tool_call","tool":"web_search","args":{"query":"world news today"}}
|
|
674
|
+
data: {"type":"tool_result","output":"Top results: ..."}
|
|
675
|
+
data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","choices":[{"delta":{"content":"Based on..."}}]}
|
|
676
|
+
data: {"type":"complete","turns":"3","tokens":"12,450","duration":8500}
|
|
677
|
+
data: [DONE]
|
|
678
|
+
```
|
|
679
|
+
|
|
649
680
|
**Session management:** Each chat message returns a `session_id`. Send it back to maintain conversation context across turns:
|
|
650
681
|
|
|
651
682
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -65552,7 +65552,9 @@ body {
|
|
|
65552
65552
|
<button class="tab" onclick="switchTab('jobs')" id="tab-jobs" style="background:none;border:none;border-bottom:2px solid transparent;color:#555;padding:6px 16px;font-family:inherit;font-size:0.7rem;cursor:pointer">dashboard</button>
|
|
65553
65553
|
<button class="tab" onclick="switchTab('config')" id="tab-config" style="background:none;border:none;border-bottom:2px solid transparent;color:#555;padding:6px 16px;font-family:inherit;font-size:0.7rem;cursor:pointer">config</button>
|
|
65554
65554
|
<button class="tab" onclick="switchTab('activity')" id="tab-activity" style="background:none;border:none;border-bottom:2px solid transparent;color:#555;padding:6px 16px;font-family:inherit;font-size:0.7rem;cursor:pointer">activity</button>
|
|
65555
|
-
<span id="
|
|
65555
|
+
<span id="sys-metrics" style="margin-left:auto;font-size:0.6rem;color:#555"></span>
|
|
65556
|
+
<span id="update-btn" style="display:none;background:#3a2a10;border:1px solid #b2920a;color:#b2920a;padding:2px 8px;border-radius:3px;font-family:inherit;font-size:0.6rem;cursor:pointer" onclick="doUpdate()">update</span>
|
|
65557
|
+
<span id="token-counter" style="font-size:0.6rem;color:#555">0 tokens</span>
|
|
65556
65558
|
</div>
|
|
65557
65559
|
<div style="display:flex;flex:1;overflow:hidden">
|
|
65558
65560
|
<div id="workspace-sidebar" style="display:none;width:250px;background:#1e1e22;border-right:1px solid #2a2a30;overflow-y:auto;padding:8px;flex-shrink:0;font-size:0.7rem">
|
|
@@ -66243,10 +66245,44 @@ function toggleSandbox() {
|
|
|
66243
66245
|
btn.style.borderColor = sandboxMode === 'none' ? '#3a3a42' : '#b2920a';
|
|
66244
66246
|
}
|
|
66245
66247
|
|
|
66248
|
+
// Live system metrics polling
|
|
66249
|
+
async function pollMetrics() {
|
|
66250
|
+
try {
|
|
66251
|
+
const r = await fetch('/v1/system', { headers: headers() });
|
|
66252
|
+
const d = await r.json();
|
|
66253
|
+
const el = document.getElementById('sys-metrics');
|
|
66254
|
+
const parts = [];
|
|
66255
|
+
if (d.cpu_pct !== undefined) parts.push('CPU ' + d.cpu_pct + '%');
|
|
66256
|
+
if (d.ram_used_pct !== undefined) parts.push('RAM ' + d.ram_used_pct + '%');
|
|
66257
|
+
if (d.gpu_utilization?.length) {
|
|
66258
|
+
const g = d.gpu_utilization[0];
|
|
66259
|
+
parts.push('GPU ' + g.gpu_pct + '%');
|
|
66260
|
+
parts.push('VRAM ' + g.vram_used_gb + '/' + g.vram_total_gb + 'GB');
|
|
66261
|
+
}
|
|
66262
|
+
if (el) el.textContent = parts.join(' | ');
|
|
66263
|
+
// Update button
|
|
66264
|
+
const btn = document.getElementById('update-btn');
|
|
66265
|
+
if (btn && d.update_available && d.latest_version) {
|
|
66266
|
+
btn.style.display = 'inline-block';
|
|
66267
|
+
btn.textContent = 'update v' + d.latest_version;
|
|
66268
|
+
btn.title = 'Current: v' + d.version + ' \u2192 Latest: v' + d.latest_version;
|
|
66269
|
+
}
|
|
66270
|
+
} catch {}
|
|
66271
|
+
}
|
|
66272
|
+
|
|
66273
|
+
function doUpdate() {
|
|
66274
|
+
if (confirm('Update Open Agents to latest version? This will restart the server.')) {
|
|
66275
|
+
fetch('/v1/commands/update', { method: 'POST', headers: headers() }).catch(() => {});
|
|
66276
|
+
document.getElementById('update-btn').textContent = 'updating...';
|
|
66277
|
+
}
|
|
66278
|
+
}
|
|
66279
|
+
|
|
66246
66280
|
// Init
|
|
66247
66281
|
checkHealth();
|
|
66248
66282
|
loadModels();
|
|
66283
|
+
pollMetrics();
|
|
66249
66284
|
setInterval(checkHealth, 30000);
|
|
66285
|
+
setInterval(pollMetrics, 10000);
|
|
66250
66286
|
input.focus();
|
|
66251
66287
|
</script>
|
|
66252
66288
|
</body>
|
|
@@ -67946,6 +67982,7 @@ async function handleRequest(req, res, ollamaUrl, verbose) {
|
|
|
67946
67982
|
}
|
|
67947
67983
|
if (pathname === "/v1/system" && method === "GET") {
|
|
67948
67984
|
const os = __require("node:os");
|
|
67985
|
+
const version = getVersion3();
|
|
67949
67986
|
const { execSync: es } = __require("node:child_process");
|
|
67950
67987
|
let gpus = [];
|
|
67951
67988
|
try {
|
|
@@ -67958,15 +67995,43 @@ async function handleRequest(req, res, ollamaUrl, verbose) {
|
|
|
67958
67995
|
} catch {
|
|
67959
67996
|
}
|
|
67960
67997
|
const totalVram = gpus.reduce((s, g) => s + g.vram_gb, 0);
|
|
67998
|
+
const freeMem = os.freemem();
|
|
67999
|
+
const totalMem = os.totalmem();
|
|
68000
|
+
const ramUsedPct = Math.round((1 - freeMem / totalMem) * 100);
|
|
68001
|
+
const cpuLoad = os.loadavg()[0] ?? 0;
|
|
68002
|
+
const cpuPct = Math.min(100, Math.round(cpuLoad / os.cpus().length * 100));
|
|
68003
|
+
let gpuUtil = [];
|
|
68004
|
+
try {
|
|
68005
|
+
const util = es("nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total --format=csv,noheader,nounits", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
|
|
68006
|
+
for (const line of util.trim().split("\n")) {
|
|
68007
|
+
const [pct, used, total] = line.split(",").map((s) => parseInt(s.trim(), 10));
|
|
68008
|
+
if (!isNaN(pct) && !isNaN(used) && !isNaN(total)) {
|
|
68009
|
+
gpuUtil.push({ gpu_pct: pct, vram_used_gb: Math.round(used / 1024 * 10) / 10, vram_total_gb: Math.round(total / 1024) });
|
|
68010
|
+
}
|
|
68011
|
+
}
|
|
68012
|
+
} catch {
|
|
68013
|
+
}
|
|
68014
|
+
let latestVersion = null;
|
|
68015
|
+
try {
|
|
68016
|
+
const ver = es("npm view open-agents-ai version 2>/dev/null", { encoding: "utf8", timeout: 5e3, stdio: "pipe" }).trim();
|
|
68017
|
+
if (ver && ver !== version)
|
|
68018
|
+
latestVersion = ver;
|
|
68019
|
+
} catch {
|
|
68020
|
+
}
|
|
67961
68021
|
jsonResponse(res, 200, {
|
|
67962
68022
|
gpu: gpus,
|
|
68023
|
+
gpu_utilization: gpuUtil,
|
|
67963
68024
|
total_vram_gb: totalVram,
|
|
67964
|
-
ram_gb: Math.round(
|
|
68025
|
+
ram_gb: Math.round(totalMem / 1024 ** 3),
|
|
68026
|
+
ram_used_pct: ramUsedPct,
|
|
67965
68027
|
cpu: os.cpus()[0]?.model ?? "unknown",
|
|
68028
|
+
cpu_pct: cpuPct,
|
|
67966
68029
|
cores: os.cpus().length,
|
|
67967
68030
|
platform: process.platform,
|
|
67968
68031
|
node: process.version,
|
|
67969
|
-
|
|
68032
|
+
version,
|
|
68033
|
+
latest_version: latestVersion,
|
|
68034
|
+
update_available: !!latestVersion,
|
|
67970
68035
|
recommended_max_params: totalVram >= 80 ? "120B+" : totalVram >= 48 ? "70B" : totalVram >= 24 ? "27B" : totalVram >= 8 ? "9B" : "4B"
|
|
67971
68036
|
});
|
|
67972
68037
|
return;
|
package/package.json
CHANGED