feat: add container resource monitoring

This commit is contained in:
RuoJi6 authored and GitHub committed 2026-10-29 10:28:40 -07:00
1 parent 5527120089
commit 5366160a5d
6 files changed
+199 -1

No files matched your search

+2
View File
@@ -116,6 +116,7 @@ import type {
UsageStats,
WorkspaceFile,
WorkspaceListing,
SystemMetrics,
} from "@/lib/types";
function getToken(): string | null {
@@ -292,6 +293,7 @@ function schedulePayload(input: ScheduleInput) {
export const api = {
// 后端应用版本号(release 时由 ldflags 注入,默认 "dev")。
health: () => get<{ ok: boolean; service: string; version: string }>("/health"),
systemMetrics: () => get<SystemMetrics>("/system/metrics"),
// ---- auth ----
authStatus: () => get<{ initialized: boolean }>("/auth/status"),
+16
View File
@@ -1331,6 +1331,22 @@ export interface Stats {
active_task?: Partial<Task>;
}
export interface SystemMetricValue {
used_bytes: number;
total_bytes: number;
percent: number;
}
export interface SystemMetrics {
scope: "container" | string;
timestamp: string;
container_metrics: boolean;
cpu: SystemMetricValue;
memory: SystemMetricValue;
disk: SystemMetricValue;
data_disk: SystemMetricValue;
}
// ---- Intercept Rules ----
export type InterceptAction = "allow" | "deny" | "ask";
export type InterceptMatchTarget = "tool_name" | "tool_input";