Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions kernel_ai/services/system_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ def get_isolation_context():
namespace_keys = ["mnt", "pid", "net", "ipc", "uts", "user"]
namespace_labels = {"mnt": "MNT", "pid": "PID", "net": "NET", "ipc": "IPC", "uts": "UTS", "user": "USER"}
namespace_counts = {k: {} for k in namespace_keys}
# Per-namespace, per-inode sample process names (each inode = one isolated "world").
namespace_samples = {k: {} for k in namespace_keys}
cgroup_aggregates = {}
total_scanned = 0

Expand All @@ -305,11 +307,15 @@ def get_isolation_context():
process_name = proc.info.get("name") or "unknown"
agg["sample_processes"].append(process_name)

proc_name = proc.info.get("name") or "unknown"
for ns_name in namespace_keys:
inode = read_namespace_inode(pid, ns_name)
if inode:
ns_map = namespace_counts[ns_name]
ns_map[inode] = ns_map.get(inode, 0) + 1
samples = namespace_samples[ns_name].setdefault(inode, [])
if len(samples) < 5 and proc_name not in samples:
samples.append(proc_name)
except (psutil.NoSuchProcess, psutil.AccessDenied, KeyError):
continue

Expand All @@ -322,6 +328,15 @@ def get_isolation_context():
if entries:
dominant_inode, dominant_count = max(entries.items(), key=lambda kv: kv[1])
activity = round((dominant_count / total_scanned), 3) if total_scanned > 0 else 0
# Top isolated "worlds" for this namespace (one per inode), richest first.
worlds = [
{
"inode": inode,
"count": count,
"sample": namespace_samples[ns_name].get(inode, []),
}
for inode, count in sorted(entries.items(), key=lambda kv: kv[1], reverse=True)[:6]
]
namespaces.append(
{
"id": ns_name,
Expand All @@ -330,6 +345,8 @@ def get_isolation_context():
"dominant_inode": dominant_inode,
"dominant_count": dominant_count,
"activity": activity,
"isolated": unique_count > 1,
"worlds": worlds,
}
)

Expand Down
120 changes: 120 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ svg {
height: 100vh;
}

/* Модальный скрим открытого меню процесса (клик по нему закрывает меню) */
.process-modal-scrim {
cursor: pointer;
}

/* Central circle */
.central-circle {
fill: rgba(0, 0, 0, 0.09);
Expand Down Expand Up @@ -169,6 +174,121 @@ svg {
max-width: 300px;
}

/* Namespace HUD tooltip (ink-on-paper FUI style) */
.ns-hud-tooltip {
background: rgba(20, 22, 26, 0.94);
color: #e8eaef;
border: 1px solid rgba(120, 126, 138, 0.5);
border-radius: 3px;
padding: 9px 11px;
min-width: 172px;
max-width: 240px;
box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}
.ns-hud-head {
font-size: 10px;
letter-spacing: 1.6px;
color: #ffffff;
padding-bottom: 5px;
margin-bottom: 6px;
border-bottom: 1px solid rgba(120, 126, 138, 0.35);
}
.ns-hud-desc {
font-size: 9.5px;
line-height: 1.35;
color: #aab0bc;
margin-bottom: 7px;
}
.ns-hud-row {
display: flex;
justify-content: space-between;
font-size: 9.5px;
letter-spacing: 0.4px;
padding: 1px 0;
}
.ns-hud-row span { color: #8b909c; }
.ns-hud-row b { color: #e8eaef; font-weight: 600; }
.ns-hud-bar {
margin-top: 7px;
height: 4px;
border-radius: 2px;
background: rgba(120, 126, 138, 0.25);
overflow: hidden;
}
.ns-hud-bar i {
display: block;
height: 100%;
background: rgba(88, 182, 216, 0.85);
}
.ns-hud-foot {
margin-top: 4px;
font-size: 8px;
letter-spacing: 1.2px;
color: #7f8794;
text-align: right;
}

/* Marker for namespace cells that contain real isolation (unique_count > 1) */
.ns-isolated-marker {
animation: nsIsolatedPulse 1.8s ease-in-out infinite;
transform-box: fill-box;
transform-origin: center;
}
@keyframes nsIsolatedPulse {
0%, 100% { opacity: 0.35; }
50% { opacity: 1; }
}

/* Namespace system-info tree (unfolds from a namespace cell) */
.ns-tree-conn { stroke: rgba(90, 94, 102, 0.75); stroke-width: 1.3; fill: none; }
.ns-tree-anchor { fill: rgba(60, 63, 70, 0.9); }
.ns-tree-frame {
fill: rgba(20, 22, 26, 0.95);
stroke: rgba(120, 126, 138, 0.5);
stroke-width: 1;
}
.ns-tree-title {
fill: #ffffff;
font-family: 'Share Tech Mono', monospace;
font-size: 10px;
letter-spacing: 1.5px;
}
.ns-tree-link { stroke: rgba(150, 156, 168, 0.5); stroke-width: 1; fill: none; }
.ns-tree-root rect {
fill: rgba(88, 182, 216, 0.9);
stroke: rgba(88, 182, 216, 1);
stroke-width: 1;
}
.ns-tree-root text {
fill: #06131b;
font-family: 'Share Tech Mono', monospace;
font-size: 9.5px;
font-weight: 600;
letter-spacing: 0.6px;
}
.ns-tree-branch rect {
fill: rgba(255, 255, 255, 0.1);
stroke: rgba(255, 255, 255, 0.28);
stroke-width: 1;
}
.ns-tree-branch text {
fill: #eef1f5;
font-family: 'Share Tech Mono', monospace;
font-size: 9px;
letter-spacing: 1px;
}
.ns-tree-leaf rect {
fill: rgba(255, 255, 255, 0.045);
stroke: rgba(120, 126, 138, 0.42);
stroke-width: 1;
}
.ns-tree-leaf text {
fill: #c4c9d3;
font-family: 'Share Tech Mono', monospace;
font-size: 8.5px;
letter-spacing: 0.3px;
}

/* Bezier curve styles - matching connection lines */
.bezier-curve {
fill: none;
Expand Down
Loading
Loading