Resolve npm audit vulnerabilities

This commit is contained in:
Codex
2026-04-27 15:38:02 +00:00
parent 4e123f8e27
commit b82e8fb56e
6 changed files with 678 additions and 570 deletions
@@ -0,0 +1,17 @@
import { NextResponse } from "next/server"
import { buildSandboxTelemetry } from "../telemetry"
export async function GET(
_request: Request,
{ params }: { params: Promise<{ sandboxId: string }> },
) {
try {
const { sandboxId } = await params
return NextResponse.json(buildSandboxTelemetry(sandboxId))
} catch {
return NextResponse.json(
{ error: "Failed to fetch sandbox telemetry" },
{ status: 500 },
)
}
}
+4 -30
View File
@@ -1,36 +1,10 @@
import { NextResponse } from "next/server" import { NextResponse } from "next/server"
import { buildSandboxTelemetry } from "./telemetry"
export async function GET( export async function GET(request: Request) {
request: Request,
{ params }: { params: { sandboxId: string } }
) {
try { try {
// In a real implementation, this would fetch specific telemetry for the selected sandbox const { searchParams } = new URL(request.url)
// For now, return realistic mock data based on the selected sandbox return NextResponse.json(buildSandboxTelemetry(searchParams.get("sandboxId") || "sandbox"))
const { sandboxId } = params
// Simulate different telemetry for different sandboxes
const baseValues = {
cpu: 30 + Math.random() * 40,
memory: 40 + Math.random() * 30,
disk: 50 + Math.random() * 15
}
// Add some variation based on sandbox name
const sandboxVariation = sandboxId.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0)
const data = {
cpu: Math.min(100, baseValues.cpu + (sandboxVariation % 20)),
memory: Math.min(100, baseValues.memory + (sandboxVariation % 15)),
disk: baseValues.disk + (sandboxVariation % 5),
gpuMemoryUsed: 20 + Math.random() * 60,
gpuMemoryTotal: 80,
gpuTemperature: 65 + Math.random() * 20,
timestamp: new Date().toISOString()
}
return NextResponse.json(data)
} catch (error) { } catch (error) {
return NextResponse.json( return NextResponse.json(
{ error: 'Failed to fetch sandbox telemetry' }, { error: 'Failed to fetch sandbox telemetry' },
+19
View File
@@ -0,0 +1,19 @@
export function buildSandboxTelemetry(sandboxId: string) {
const baseValues = {
cpu: 30 + Math.random() * 40,
memory: 40 + Math.random() * 30,
disk: 50 + Math.random() * 15,
}
const sandboxVariation = sandboxId.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0)
return {
cpu: Math.min(100, baseValues.cpu + (sandboxVariation % 20)),
memory: Math.min(100, baseValues.memory + (sandboxVariation % 15)),
disk: baseValues.disk + (sandboxVariation % 5),
gpuMemoryUsed: 20 + Math.random() * 60,
gpuMemoryTotal: 80,
gpuTemperature: 65 + Math.random() * 20,
timestamp: new Date().toISOString(),
}
}
+628 -534
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -13,7 +13,7 @@
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0", "@modelcontextprotocol/sdk": "^1.29.0",
"axios": "^1.15.2", "axios": "^1.15.2",
"next": "14.2.35", "next": "^15.5.15",
"node-pty": "^1.1.0", "node-pty": "^1.1.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
@@ -30,9 +30,12 @@
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^8.57.1", "eslint": "^8.57.1",
"eslint-config-next": "14.2.35", "eslint-config-next": "^15.5.15",
"postcss": "^8.5.10", "postcss": "8.5.10",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.15",
"typescript": "^5.6.3" "typescript": "^5.6.3"
},
"overrides": {
"postcss": "8.5.10"
} }
} }
+2 -1
View File
@@ -19,7 +19,8 @@
], ],
"paths": { "paths": {
"@/*": ["./*"] "@/*": ["./*"]
} },
"target": "ES2017"
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"] "exclude": ["node_modules"]