@kl-c/matrixos 0.3.1 → 0.3.2
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/cli/index.js +8 -39
- package/dist/cli-node/index.js +8 -39
- package/dist/features/dashboard/frontend/js/app.js +18 -23
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.2",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -186919,15 +186919,7 @@ function createDataProvider(config5) {
|
|
|
186919
186919
|
async getIncidents(limit = 50) {
|
|
186920
186920
|
const lines = readJsonl("anti-loop.jsonl");
|
|
186921
186921
|
if (lines.length === 0) {
|
|
186922
|
-
return
|
|
186923
|
-
timestamp: Date.now() - randomBetween(0, 86400000),
|
|
186924
|
-
trigger: randomChoice(["heartbeat_loss", "memory_exceeded", "cpu_exceeded", "doom_loop", "stuck"]),
|
|
186925
|
-
fromLevel: randomChoice(["nudge", "fallback", "restart"]),
|
|
186926
|
-
toLevel: randomChoice(["nudge", "fallback", "restart", "notify", "safe"]),
|
|
186927
|
-
actionTaken: randomChoice(["nudge", "fallback", "restart", "notify"]),
|
|
186928
|
-
outcome: randomChoice(["success", "success", "success", "failed"]),
|
|
186929
|
-
detail: "Mock incident data"
|
|
186930
|
-
})).slice(0, limit);
|
|
186922
|
+
return [];
|
|
186931
186923
|
}
|
|
186932
186924
|
return lines.slice(0, limit).map((l2) => {
|
|
186933
186925
|
try {
|
|
@@ -186954,13 +186946,18 @@ function createDataProvider(config5) {
|
|
|
186954
186946
|
const mem = process.memoryUsage();
|
|
186955
186947
|
const memPercent = Math.round(mem.rss / totalMem * 100);
|
|
186956
186948
|
const cpuPercent = Math.round(os12.loadavg()[0] * 100);
|
|
186949
|
+
let diskPercent = 0;
|
|
186950
|
+
try {
|
|
186951
|
+
const stat = fs21.statfsSync("/");
|
|
186952
|
+
diskPercent = Math.round((stat.blocks - stat.bavail) / stat.blocks * 100);
|
|
186953
|
+
} catch {}
|
|
186957
186954
|
const snapshots = [];
|
|
186958
186955
|
for (let i3 = 0;i3 < 60; i3++) {
|
|
186959
186956
|
snapshots.push({
|
|
186960
186957
|
timestamp: Date.now() - (59 - i3) * 60000,
|
|
186961
186958
|
cpuPercent,
|
|
186962
186959
|
memoryPercent: memPercent,
|
|
186963
|
-
diskPercent
|
|
186960
|
+
diskPercent,
|
|
186964
186961
|
sessionsActive: activeSessions
|
|
186965
186962
|
});
|
|
186966
186963
|
}
|
|
@@ -186986,34 +186983,6 @@ function createDataProvider(config5) {
|
|
|
186986
186983
|
} catch {}
|
|
186987
186984
|
}
|
|
186988
186985
|
}
|
|
186989
|
-
if (entries.length < 20) {
|
|
186990
|
-
const mockMsgs = [
|
|
186991
|
-
["Session started", "info"],
|
|
186992
|
-
["Tool executed: read_file", "info"],
|
|
186993
|
-
["Token count: 12,847", "debug"],
|
|
186994
|
-
["Model switch: deepseek-v4-flash-free", "info"],
|
|
186995
|
-
["Cost threshold warning: 78%", "warn"],
|
|
186996
|
-
["Heartbeat received from Morpheus", "debug"],
|
|
186997
|
-
["Session completed (4m 23s)", "info"],
|
|
186998
|
-
["Memory compaction triggered", "info"],
|
|
186999
|
-
["Config change detected", "info"],
|
|
187000
|
-
["Anti-loop triggered: Boulder retry cycle", "error"],
|
|
187001
|
-
["Cache hit rate: 89%", "info"],
|
|
187002
|
-
["Background task completed", "info"],
|
|
187003
|
-
["Gateway reconnected", "info"],
|
|
187004
|
-
["API rate limit: 45/60", "warn"],
|
|
187005
|
-
["Watchdog cycle #1247", "debug"],
|
|
187006
|
-
["Session ses_a1b2c3d4 failed", "error"]
|
|
187007
|
-
];
|
|
187008
|
-
for (const [msg, level] of mockMsgs.slice(0, 30 - entries.length)) {
|
|
187009
|
-
entries.push({
|
|
187010
|
-
timestamp: new Date(Date.now() - randomBetween(0, 3600000)).toISOString(),
|
|
187011
|
-
level,
|
|
187012
|
-
source: randomChoice(["system", "gateway", "agent", "watchdog"]),
|
|
187013
|
-
message: msg
|
|
187014
|
-
});
|
|
187015
|
-
}
|
|
187016
|
-
}
|
|
187017
186986
|
return entries.sort((a2, b2) => b2.timestamp.localeCompare(a2.timestamp)).slice(0, 100);
|
|
187018
186987
|
},
|
|
187019
186988
|
getConfig() {
|
package/dist/cli-node/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.2",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -186974,15 +186974,7 @@ function createDataProvider(config5) {
|
|
|
186974
186974
|
async getIncidents(limit = 50) {
|
|
186975
186975
|
const lines = readJsonl("anti-loop.jsonl");
|
|
186976
186976
|
if (lines.length === 0) {
|
|
186977
|
-
return
|
|
186978
|
-
timestamp: Date.now() - randomBetween(0, 86400000),
|
|
186979
|
-
trigger: randomChoice(["heartbeat_loss", "memory_exceeded", "cpu_exceeded", "doom_loop", "stuck"]),
|
|
186980
|
-
fromLevel: randomChoice(["nudge", "fallback", "restart"]),
|
|
186981
|
-
toLevel: randomChoice(["nudge", "fallback", "restart", "notify", "safe"]),
|
|
186982
|
-
actionTaken: randomChoice(["nudge", "fallback", "restart", "notify"]),
|
|
186983
|
-
outcome: randomChoice(["success", "success", "success", "failed"]),
|
|
186984
|
-
detail: "Mock incident data"
|
|
186985
|
-
})).slice(0, limit);
|
|
186977
|
+
return [];
|
|
186986
186978
|
}
|
|
186987
186979
|
return lines.slice(0, limit).map((l2) => {
|
|
186988
186980
|
try {
|
|
@@ -187009,13 +187001,18 @@ function createDataProvider(config5) {
|
|
|
187009
187001
|
const mem = process.memoryUsage();
|
|
187010
187002
|
const memPercent = Math.round(mem.rss / totalMem * 100);
|
|
187011
187003
|
const cpuPercent = Math.round(os12.loadavg()[0] * 100);
|
|
187004
|
+
let diskPercent = 0;
|
|
187005
|
+
try {
|
|
187006
|
+
const stat = fs21.statfsSync("/");
|
|
187007
|
+
diskPercent = Math.round((stat.blocks - stat.bavail) / stat.blocks * 100);
|
|
187008
|
+
} catch {}
|
|
187012
187009
|
const snapshots = [];
|
|
187013
187010
|
for (let i3 = 0;i3 < 60; i3++) {
|
|
187014
187011
|
snapshots.push({
|
|
187015
187012
|
timestamp: Date.now() - (59 - i3) * 60000,
|
|
187016
187013
|
cpuPercent,
|
|
187017
187014
|
memoryPercent: memPercent,
|
|
187018
|
-
diskPercent
|
|
187015
|
+
diskPercent,
|
|
187019
187016
|
sessionsActive: activeSessions
|
|
187020
187017
|
});
|
|
187021
187018
|
}
|
|
@@ -187041,34 +187038,6 @@ function createDataProvider(config5) {
|
|
|
187041
187038
|
} catch {}
|
|
187042
187039
|
}
|
|
187043
187040
|
}
|
|
187044
|
-
if (entries.length < 20) {
|
|
187045
|
-
const mockMsgs = [
|
|
187046
|
-
["Session started", "info"],
|
|
187047
|
-
["Tool executed: read_file", "info"],
|
|
187048
|
-
["Token count: 12,847", "debug"],
|
|
187049
|
-
["Model switch: deepseek-v4-flash-free", "info"],
|
|
187050
|
-
["Cost threshold warning: 78%", "warn"],
|
|
187051
|
-
["Heartbeat received from Morpheus", "debug"],
|
|
187052
|
-
["Session completed (4m 23s)", "info"],
|
|
187053
|
-
["Memory compaction triggered", "info"],
|
|
187054
|
-
["Config change detected", "info"],
|
|
187055
|
-
["Anti-loop triggered: Boulder retry cycle", "error"],
|
|
187056
|
-
["Cache hit rate: 89%", "info"],
|
|
187057
|
-
["Background task completed", "info"],
|
|
187058
|
-
["Gateway reconnected", "info"],
|
|
187059
|
-
["API rate limit: 45/60", "warn"],
|
|
187060
|
-
["Watchdog cycle #1247", "debug"],
|
|
187061
|
-
["Session ses_a1b2c3d4 failed", "error"]
|
|
187062
|
-
];
|
|
187063
|
-
for (const [msg, level] of mockMsgs.slice(0, 30 - entries.length)) {
|
|
187064
|
-
entries.push({
|
|
187065
|
-
timestamp: new Date(Date.now() - randomBetween(0, 3600000)).toISOString(),
|
|
187066
|
-
level,
|
|
187067
|
-
source: randomChoice(["system", "gateway", "agent", "watchdog"]),
|
|
187068
|
-
message: msg
|
|
187069
|
-
});
|
|
187070
|
-
}
|
|
187071
|
-
}
|
|
187072
187041
|
return entries.sort((a2, b2) => b2.timestamp.localeCompare(a2.timestamp)).slice(0, 100);
|
|
187073
187042
|
},
|
|
187074
187043
|
getConfig() {
|
|
@@ -116,44 +116,39 @@ async function loadHealth(){
|
|
|
116
116
|
const kpi=document.getElementById('healthKpis'),gauges=document.getElementById('gaugeGrid'),hb=document.getElementById('heartbeatGrid'),inc=document.getElementById('incidentList')
|
|
117
117
|
showSkeleton(kpi,'kpi')
|
|
118
118
|
try{
|
|
119
|
-
const[health,metrics,incidents]=await Promise.all([API.health(),API.metrics(),API.incidents(8)])
|
|
120
|
-
const cpu=metrics.length?metrics[metrics.length-1].cpuPercent:
|
|
121
|
-
const mem=health.memoryUsage?health.memoryUsage.percent||
|
|
122
|
-
const disk=
|
|
119
|
+
const[health,metrics,incidents,agents]=await Promise.all([API.health(),API.metrics(),API.incidents(8),API.agents()])
|
|
120
|
+
const cpu=metrics.length?metrics[metrics.length-1].cpuPercent:0
|
|
121
|
+
const mem=health.memoryUsage?health.memoryUsage.percent||0:0
|
|
122
|
+
const disk=metrics.length?metrics[metrics.length-1].diskPercent||0:0
|
|
123
123
|
const cpuColor=cpu>80?'var(--danger)':cpu>60?'var(--warning)':'var(--success)'
|
|
124
124
|
const memColor=mem>80?'var(--danger)':mem>60?'var(--warning)':'var(--success)'
|
|
125
125
|
const diskColor=disk>80?'var(--danger)':disk>60?'var(--warning)':'var(--info)'
|
|
126
126
|
|
|
127
127
|
kpi.innerHTML=`
|
|
128
|
-
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">System Status</span><div class="kpi-icon green"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M4 8l3 3 5-6"/></svg></div></div><div class="kpi-value" style="color:var(--success)">
|
|
129
|
-
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">Uptime</span><div class="kpi-icon cyan"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="8" cy="8" r="6"/><path d="M8 4.5v3.5l2.5 1.5"/></svg></div></div><div class="kpi-value"
|
|
130
|
-
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">Active Incidents</span><div class="kpi-icon red"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M8 2L1.5 13h13L8 2z"/><path d="M8 7v2.5M8 11.5v.5"/></svg></div></div><div class="kpi-value" style="color
|
|
131
|
-
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">
|
|
128
|
+
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">System Status</span><div class="kpi-icon green"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M4 8l3 3 5-6"/></svg></div></div><div class="kpi-value" style="color:var(--success)">Online</div><div class="kpi-trend flat"><span class="live-dot" style="margin-right:4px"></span>v${health.version}</div></div>
|
|
129
|
+
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">Uptime</span><div class="kpi-icon cyan"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="8" cy="8" r="6"/><path d="M8 4.5v3.5l2.5 1.5"/></svg></div></div><div class="kpi-value">${fmtDur(Math.round(health.uptime))}</div><div class="kpi-trend up">Since last restart</div></div>
|
|
130
|
+
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">Active Incidents</span><div class="kpi-icon red"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M8 2L1.5 13h13L8 2z"/><path d="M8 7v2.5M8 11.5v.5"/></svg></div></div><div class="kpi-value" style="color:${incidents.length?'var(--danger)':'var(--success)'}">${incidents.length}</div><div class="kpi-trend ${incidents.length?'down':'flat'}">${incidents.length?'Needs attention':'All clear'}</div></div>
|
|
131
|
+
<div class="kpi-card"><div class="kpi-card-header"><span class="kpi-label">Active Sessions</span><div class="kpi-icon blue"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="8" cy="8" r="6"/><path d="M8 5v3"/><circle cx="8" cy="11" r="0.5" fill="currentColor"/></svg></div></div><div class="kpi-value">${health.activeSessions}</div><div class="kpi-trend flat">${health.tasksQueued} queued</div></div>`
|
|
132
132
|
|
|
133
133
|
// Resource gauges (SVG)
|
|
134
134
|
function gauge(pct,color,label,sub){
|
|
135
135
|
const r=16,c=2*Math.PI*r,offset=c-(c*pct/100)
|
|
136
136
|
return `<div class="gauge-card"><div class="gauge-ring"><svg viewBox="0 0 40 40"><circle class="track" cx="20" cy="20" r="${r}"/><circle stroke="${color}" cx="20" cy="20" r="${r}" stroke-dasharray="${c}" stroke-dashoffset="${offset}" style="transition:stroke-dashoffset 500ms"/></svg><div class="gauge-val" style="color:${color}">${pct}%</div></div><div class="gauge-label">${label}</div><div class="gauge-sub">${sub}</div></div>`
|
|
137
137
|
}
|
|
138
|
-
const totalMem=(health.memoryUsage&&health.memoryUsage.total)||
|
|
138
|
+
const totalMem=(health.memoryUsage&&health.memoryUsage.total)||0
|
|
139
139
|
const usedMem=Math.round(totalMem*(mem||0)/100)
|
|
140
|
-
gauges.innerHTML=gauge(Math.round(cpu),cpuColor,'CPU Usage','
|
|
140
|
+
gauges.innerHTML=gauge(Math.round(cpu),cpuColor,'CPU Usage','Load avg')+gauge(mem,memColor,'Memory',`${usedMem} / ${totalMem} MB`)+gauge(disk,diskColor,'Disk','/ filesystem')
|
|
141
141
|
|
|
142
|
-
// Heartbeat Grid
|
|
143
|
-
const agents
|
|
142
|
+
// Heartbeat Grid — real agents
|
|
143
|
+
const agentNames=agents.slice(0,8).map(a=>a.name)
|
|
144
144
|
const hbLegendEl=document.getElementById('hbLegend')
|
|
145
|
-
hbLegendEl.innerHTML=`<span style="display:flex;align-items:center;gap:4px;font-size:var(--text-xs);color:var(--success)"><span style="width:6px;height:6px;border-radius:50%;background:var(--success)"></span>
|
|
146
|
-
hb.innerHTML=
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
const r=Math.random()
|
|
151
|
-
const cls=r>0.85?'fail':r>0.7&&i>2?'warn':'healthy'
|
|
152
|
-
cells.push(`<div class="hb-cell ${cls}" title="${name} t-${(7-t)*10}s">${initial}</div>`)
|
|
153
|
-
}
|
|
154
|
-
return cells.join('')
|
|
145
|
+
hbLegendEl.innerHTML=`<span style="display:flex;align-items:center;gap:4px;font-size:var(--text-xs);color:var(--success)"><span style="width:6px;height:6px;border-radius:50%;background:var(--success)"></span>Online</span><span style="display:flex;align-items:center;gap:4px;font-size:var(--text-xs);color:var(--warning)"><span style="width:6px;height:6px;border-radius:50%;background:var(--warning)"></span>Idle</span><span style="display:flex;align-items:center;gap:4px;font-size:var(--text-xs);color:var(--danger)"><span style="width:6px;height:6px;border-radius:50%;background:var(--danger)"></span>Offline</span>`
|
|
146
|
+
hb.innerHTML=agentNames.map((name)=>{
|
|
147
|
+
const agent=agents.find(a=>a.name===name)
|
|
148
|
+
const cls=agent&&agent.status==='online'?'healthy':agent&&agent.status==='idle'?'warn':'fail'
|
|
149
|
+
return `<div class="hb-cell ${cls}" title="${name}">${name[0]}</div>`
|
|
155
150
|
}).join('')
|
|
156
|
-
hb.insertAdjacentHTML('afterend',`<div style="margin-top:var(--space-3);font-size:var(--text-xs);color:var(--text-tertiary)">Agents: ${
|
|
151
|
+
hb.insertAdjacentHTML('afterend',`<div style="margin-top:var(--space-3);font-size:var(--text-xs);color:var(--text-tertiary)">Agents: ${agentNames.map(a=>a[0]+'='+a).join(', ')}</div>`)
|
|
157
152
|
|
|
158
153
|
// Incidents
|
|
159
154
|
if(!incidents.length){showEmpty(inc,'No incidents recorded');return}
|
package/dist/index.js
CHANGED
|
@@ -368019,7 +368019,7 @@ function getCachedVersion(options = {}) {
|
|
|
368019
368019
|
// package.json
|
|
368020
368020
|
var package_default = {
|
|
368021
368021
|
name: "@kl-c/matrixos",
|
|
368022
|
-
version: "0.3.
|
|
368022
|
+
version: "0.3.2",
|
|
368023
368023
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
368024
368024
|
main: "./dist/index.js",
|
|
368025
368025
|
types: "dist/index.d.ts",
|
package/package.json
CHANGED