Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
import { NextRequest, NextResponse } from "next/server";
import { requireSession } from "@/lib/auth/require-session";
import { IS_DEMO } from "@/lib/demo";
import { catalogSkillsDetailed, resolveSkill, readSkillFile, type SkillInfo } from "@/lib/skills/catalog";
import { catalogTtl } from "@/lib/skills/catalog-ttl";
import { listLearnedRecipes } from "@/lib/workflow";
import { searchSkillMemory } from "@/lib/skills/search";
const demoSkills: SkillInfo[] = [
{ id: "camoufox-browse", name: "camoufox-browse", path: "demo://camoufox-browse", description: "Browser automation playbook for Camoufox.", source: "bundled", trust: "verified" },
{ id: "vps-alfa", name: "vps-alfa", path: "demo://vps-alfa", description: "Patrol and assist VPS terminal panes.", source: "mso", trust: "official" },
];
export async function handleGetSkills(req: NextRequest): Promise<Response> {
const name = req.nextUrl.searchParams.get("name");
const query = req.nextUrl.searchParams.get("q")?.trim();
if (IS_DEMO) {
if (query) {
const q = query.toLowerCase();
return NextResponse.json({
engine: "demo",
query,
hits: demoSkills
.filter((s) => `${s.name} ${s.description}`.toLowerCase().includes(q))
.map((s) => ({ kind: "skill", id: s.id, name: s.name, score: 1, description: s.description, source: s.source, trust: s.trust })),
});
}
const skill = name ? resolveSkill(demoSkills, name).skill : null;
return skill
? NextResponse.json({ skill, content: `# ${skill.name}\n\n${skill.description}\n\nDemo mode only lists this skill; it does not run host automation.` })
: NextResponse.json({ skills: demoSkills, recipes: [] });
}
if (!(await requireSession("owner"))) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
if (query) {
const { TOOLS } = await import("@/lib/mcp/tools");
return NextResponse.json(await searchSkillMemory(query, {
recipeAccess: { ownerView: true },
topK: Number(req.nextUrl.searchParams.get("top") ?? 8),
includeUntrusted: req.nextUrl.searchParams.get("include_untrusted") === "1",
toolDocs: TOOLS.map((t) => ({ name: t.name, description: t.description, scope: t.scope, inputSchema: t.inputSchema })),
}));
}
if (name) {
const { skills } = await catalogSkillsDetailed();
const { skill, ambiguous } = resolveSkill(skills, name);
// A bare name matching several projects is not a 404 and must not be a guess:
// returning one project's instructions under another's name is the whole bug.
if (ambiguous) return NextResponse.json({ error: "ambiguous", candidates: ambiguous }, { status: 409 });
if (!skill) return NextResponse.json({ error: "not_found" }, { status: 404 });
const content = await readSkillFile(skill.path);
if (content === null) return NextResponse.json({ error: "not_found" }, { status: 404 });
return NextResponse.json({ skill, content: content.slice(0, 24_000), truncated: content.length > 24_000 });
}
const refresh = req.nextUrl.searchParams.get("refresh") === "1" || req.nextUrl.searchParams.get("refresh") === "true";
const { skills, scan } = await catalogTtl.get({ refresh });
const recipes = (await listLearnedRecipes({ ownerView: true })).map((r) => ({
id: r.id, intent: r.intent, project: r.project, summary: r.summary, attempts: r.attempts,
successes: r.successes, failures: r.failures, fastestDurationMs: r.fastestDurationMs, updatedAt: r.updatedAt,
}));
return NextResponse.json({ skills, recipes, scan });
}