MVP: Pulse, Memory, History modules
- Mobile-first PWA with dark glassmorphic theme - Pulse: status card, recent sessions, memory snapshot - Memory: view/edit agent + user memory with usage bars - History: session list, platform filter, search, session replay - TanStack Query hooks for all Hermes WebAPI endpoints - Bottom tab navigation, safe-area support
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Hermes WebAPI base URL (gateway)
|
||||||
|
NEXT_PUBLIC_HERMES_API=http://localhost:8787
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules/
|
||||||
|
.next/
|
||||||
|
.env.local
|
||||||
|
*.tsbuildinfo
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<!-- BEGIN:nextjs-agent-rules -->
|
||||||
|
# This is NOT the Next.js you know
|
||||||
|
|
||||||
|
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
|
||||||
|
<!-- END:nextjs-agent-rules -->
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
First, run the development server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
# or
|
||||||
|
yarn dev
|
||||||
|
# or
|
||||||
|
pnpm dev
|
||||||
|
# or
|
||||||
|
bun dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||||
|
|
||||||
|
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||||
|
|
||||||
|
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
To learn more about Next.js, take a look at the following resources:
|
||||||
|
|
||||||
|
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||||
|
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||||
|
|
||||||
|
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||||
|
|
||||||
|
## Deploy on Vercel
|
||||||
|
|
||||||
|
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||||
|
|
||||||
|
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,50 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #0a0a0f;
|
||||||
|
color: #f0f0f0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
overscroll-behavior: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Glass card */
|
||||||
|
.glass {
|
||||||
|
background: rgba(255, 255, 255, 0.04);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glass-hover:active {
|
||||||
|
background: rgba(255, 255, 255, 0.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scrollbar */
|
||||||
|
::-webkit-scrollbar { width: 4px; }
|
||||||
|
::-webkit-scrollbar-track { background: transparent; }
|
||||||
|
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
|
||||||
|
|
||||||
|
/* Safe area padding for bottom nav */
|
||||||
|
.pb-safe {
|
||||||
|
padding-bottom: calc(4.5rem + var(--safe-bottom));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Platform badges */
|
||||||
|
.badge-cli { background: rgba(245,158,11,0.15); color: #f59e0b; }
|
||||||
|
.badge-telegram { background: rgba(56,189,248,0.15); color: #38bdf8; }
|
||||||
|
.badge-discord { background: rgba(139,92,246,0.15); color: #8b5cf6; }
|
||||||
|
.badge-whatsapp { background: rgba(34,197,94,0.15); color: #22c55e; }
|
||||||
|
.badge-web { background: rgba(168,85,247,0.15); color: #a78bfa; }
|
||||||
|
|
||||||
|
/* Pulse dot animation */
|
||||||
|
@keyframes pulse-dot {
|
||||||
|
0%, 100% { opacity: 1; }
|
||||||
|
50% { opacity: 0.4; }
|
||||||
|
}
|
||||||
|
.animate-pulse-dot {
|
||||||
|
animation: pulse-dot 2s ease-in-out infinite;
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { use } from "react";
|
||||||
|
import { ArrowLeft, MessageSquare, Wrench } from "lucide-react";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { useSession, useMessages } from "@/lib/hooks";
|
||||||
|
import { timeAgo, formatTokens, platformBadgeClass } from "@/lib/utils";
|
||||||
|
import { MessageBubble } from "@/components/MessageBubble";
|
||||||
|
|
||||||
|
export default function SessionReplayPage({ params }: { params: Promise<{ id: string }> }) {
|
||||||
|
const { id } = use(params);
|
||||||
|
const { data: sessionData } = useSession(id);
|
||||||
|
const { data: messagesData, isLoading } = useMessages(id);
|
||||||
|
|
||||||
|
const session = sessionData?.session;
|
||||||
|
const messages = messagesData?.items || [];
|
||||||
|
|
||||||
|
// Group tool results with their preceding assistant tool_calls
|
||||||
|
const visibleMessages = messages.filter(
|
||||||
|
(m) => m.role === "user" || m.role === "assistant"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Collect tool results keyed by tool_call_id
|
||||||
|
const toolResults = new Map<string, { name: string; content: string }>();
|
||||||
|
for (const m of messages) {
|
||||||
|
if (m.role === "tool" && m.tool_call_id) {
|
||||||
|
toolResults.set(m.tool_call_id, {
|
||||||
|
name: m.tool_name || "tool",
|
||||||
|
content: m.content || "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
{/* Header */}
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Link href="/history" className="p-1.5 -ml-1.5 rounded-lg active:bg-white/[0.06]">
|
||||||
|
<ArrowLeft size={20} className="text-zinc-400" />
|
||||||
|
</Link>
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
|
<h1 className="text-base font-semibold text-zinc-200 truncate">
|
||||||
|
{session?.title || `Session ${id.slice(0, 8)}`}
|
||||||
|
</h1>
|
||||||
|
{session && (
|
||||||
|
<div className="flex items-center gap-2 text-xs text-zinc-500">
|
||||||
|
<span className={`px-1.5 py-0.5 rounded-full text-[10px] font-medium ${platformBadgeClass(session.source)}`}>
|
||||||
|
{session.source}
|
||||||
|
</span>
|
||||||
|
<span>{session.message_count} msgs</span>
|
||||||
|
<span>{formatTokens(session.input_tokens + session.output_tokens)} tok</span>
|
||||||
|
<span>{timeAgo(session.started_at)}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Messages */}
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="space-y-3">
|
||||||
|
{[...Array(4)].map((_, i) => (
|
||||||
|
<div key={i} className="glass p-4 animate-pulse">
|
||||||
|
<div className="h-4 bg-white/[0.06] rounded w-full mb-2" />
|
||||||
|
<div className="h-4 bg-white/[0.06] rounded w-3/4" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-3">
|
||||||
|
{visibleMessages.map((m) => (
|
||||||
|
<MessageBubble
|
||||||
|
key={m.id}
|
||||||
|
message={m}
|
||||||
|
toolResults={toolResults}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
{visibleMessages.length === 0 && (
|
||||||
|
<div className="glass p-6 text-center text-sm text-zinc-500">
|
||||||
|
Empty session
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Clock, Search, X } from "lucide-react";
|
||||||
|
import { useSessions, useSessionSearch } from "@/lib/hooks";
|
||||||
|
import { SessionCard } from "@/components/SessionCard";
|
||||||
|
|
||||||
|
const PLATFORMS = [
|
||||||
|
{ id: null, label: "All" },
|
||||||
|
{ id: "cli", label: "CLI" },
|
||||||
|
{ id: "telegram", label: "Telegram" },
|
||||||
|
{ id: "discord", label: "Discord" },
|
||||||
|
{ id: "web", label: "Web" },
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export default function HistoryPage() {
|
||||||
|
const [filter, setFilter] = useState<string | null>(null);
|
||||||
|
const [query, setQuery] = useState("");
|
||||||
|
const [searching, setSearching] = useState(false);
|
||||||
|
|
||||||
|
const { data: sessionsData, isLoading } = useSessions(30, filter || undefined);
|
||||||
|
const { data: searchData, isFetching: searchLoading } = useSessionSearch(
|
||||||
|
searching ? query : ""
|
||||||
|
);
|
||||||
|
|
||||||
|
const showSearch = searching && query.length >= 2;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Clock size={20} style={{ color: "#22c55e" }} />
|
||||||
|
<h1 className="text-xl font-bold" style={{ color: "#22c55e" }}>History</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Search bar */}
|
||||||
|
<div className="relative">
|
||||||
|
<Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500" />
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={query}
|
||||||
|
onChange={(e) => { setQuery(e.target.value); setSearching(true); }}
|
||||||
|
onFocus={() => setSearching(true)}
|
||||||
|
placeholder="Search sessions..."
|
||||||
|
className="w-full pl-9 pr-9 py-2.5 rounded-xl text-sm bg-white/[0.04] border border-white/[0.08] text-zinc-200 placeholder-zinc-600 outline-none focus:border-white/[0.15] transition-colors"
|
||||||
|
/>
|
||||||
|
{query && (
|
||||||
|
<button
|
||||||
|
onClick={() => { setQuery(""); setSearching(false); }}
|
||||||
|
className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500"
|
||||||
|
>
|
||||||
|
<X size={16} />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Search results */}
|
||||||
|
{showSearch ? (
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-zinc-500 mb-2">
|
||||||
|
{searchLoading ? "Searching..." : `${searchData?.count || 0} results`}
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
{searchData?.results?.map((r) => (
|
||||||
|
<a key={r.message_id} href={`/history/${r.session_id}`}>
|
||||||
|
<div className="glass glass-hover p-3 transition-all">
|
||||||
|
<div className="flex items-center gap-2 mb-1">
|
||||||
|
<span className="text-xs font-medium text-zinc-400">
|
||||||
|
{r.session_title || r.session_id.slice(0, 8)}
|
||||||
|
</span>
|
||||||
|
<span className="text-[10px] text-zinc-600">{r.role}</span>
|
||||||
|
</div>
|
||||||
|
<p className="text-sm text-zinc-300 line-clamp-2">{r.content}</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{/* Platform filter */}
|
||||||
|
<div className="flex gap-1.5 overflow-x-auto pb-1 -mx-1 px-1">
|
||||||
|
{PLATFORMS.map((p) => (
|
||||||
|
<button
|
||||||
|
key={p.id || "all"}
|
||||||
|
onClick={() => setFilter(p.id)}
|
||||||
|
className="px-3 py-1.5 rounded-lg text-xs font-medium whitespace-nowrap transition-all shrink-0"
|
||||||
|
style={{
|
||||||
|
background: filter === p.id ? "rgba(34,197,94,0.15)" : "rgba(255,255,255,0.04)",
|
||||||
|
color: filter === p.id ? "#22c55e" : "#6b7280",
|
||||||
|
border: `1px solid ${filter === p.id ? "rgba(34,197,94,0.3)" : "rgba(255,255,255,0.06)"}`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{p.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Session list */}
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="space-y-2">
|
||||||
|
{[...Array(5)].map((_, i) => (
|
||||||
|
<div key={i} className="glass p-4 animate-pulse">
|
||||||
|
<div className="h-4 bg-white/[0.06] rounded w-3/4 mb-2" />
|
||||||
|
<div className="h-3 bg-white/[0.06] rounded w-1/2" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-2">
|
||||||
|
{sessionsData?.items?.map((s) => (
|
||||||
|
<SessionCard key={s.id} session={s} />
|
||||||
|
))}
|
||||||
|
{sessionsData?.items?.length === 0 && (
|
||||||
|
<div className="glass p-6 text-center text-sm text-zinc-500">
|
||||||
|
No sessions found
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import type { Metadata, Viewport } from "next";
|
||||||
|
import "./globals.css";
|
||||||
|
import { BottomNav } from "@/components/BottomNav";
|
||||||
|
import { Providers } from "@/components/Providers";
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: "Hermes OS",
|
||||||
|
description: "Mobile dashboard for Hermes Agent",
|
||||||
|
icons: { icon: "/icon-192.png", apple: "/icon-192.png" },
|
||||||
|
appleWebApp: { capable: true, statusBarStyle: "black-translucent", title: "Hermes" },
|
||||||
|
};
|
||||||
|
|
||||||
|
export const viewport: Viewport = {
|
||||||
|
themeColor: "#0a0a0f",
|
||||||
|
width: "device-width",
|
||||||
|
initialScale: 1,
|
||||||
|
maximumScale: 1,
|
||||||
|
viewportFit: "cover",
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
return (
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
</head>
|
||||||
|
<body className="antialiased">
|
||||||
|
<Providers>
|
||||||
|
<main className="min-h-screen pb-safe px-4 pt-4 max-w-lg mx-auto">
|
||||||
|
{children}
|
||||||
|
</main>
|
||||||
|
<BottomNav />
|
||||||
|
</Providers>
|
||||||
|
<script
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: `if("serviceWorker"in navigator)window.addEventListener("load",()=>navigator.serviceWorker.register("/sw.js"))`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Brain, Plus } from "lucide-react";
|
||||||
|
import { useMemory, useAddMemory, usePatchMemory, useDeleteMemory } from "@/lib/hooks";
|
||||||
|
import { MemoryEntry } from "@/components/MemoryEntry";
|
||||||
|
|
||||||
|
const TABS = [
|
||||||
|
{ id: "memory", label: "Agent", color: "#f59e0b" },
|
||||||
|
{ id: "user", label: "User", color: "#38bdf8" },
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export default function MemoryPage() {
|
||||||
|
const [tab, setTab] = useState<"memory" | "user">("memory");
|
||||||
|
const [adding, setAdding] = useState(false);
|
||||||
|
const [newText, setNewText] = useState("");
|
||||||
|
const { data, isLoading } = useMemory();
|
||||||
|
const addMutation = useAddMemory();
|
||||||
|
const patchMutation = usePatchMemory();
|
||||||
|
const deleteMutation = useDeleteMemory();
|
||||||
|
|
||||||
|
const target = data?.targets?.find((t) => t.target === tab);
|
||||||
|
const entries = target?.entries || [];
|
||||||
|
const usage = target?.usage || "";
|
||||||
|
|
||||||
|
const pctMatch = usage.match(/(\d+)%/);
|
||||||
|
const pct = pctMatch ? parseInt(pctMatch[1]) : 0;
|
||||||
|
const barColor = pct > 85 ? "#ef4444" : pct > 65 ? "#f59e0b" : "#38bdf8";
|
||||||
|
|
||||||
|
const handleAdd = () => {
|
||||||
|
if (!newText.trim()) return;
|
||||||
|
addMutation.mutate({ target: tab, content: newText.trim() }, {
|
||||||
|
onSuccess: () => { setNewText(""); setAdding(false); },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePatch = (oldText: string, newContent: string) => {
|
||||||
|
patchMutation.mutate({ target: tab, old_text: oldText, content: newContent });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDelete = (oldText: string) => {
|
||||||
|
deleteMutation.mutate({ target: tab, old_text: oldText });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Brain size={20} style={{ color: "#38bdf8" }} />
|
||||||
|
<h1 className="text-xl font-bold" style={{ color: "#38bdf8" }}>Memory</h1>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={() => setAdding(!adding)}
|
||||||
|
className="p-2 rounded-xl transition-all active:scale-95"
|
||||||
|
style={{ background: "rgba(56,189,248,0.15)", color: "#38bdf8" }}
|
||||||
|
>
|
||||||
|
<Plus size={18} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Tabs */}
|
||||||
|
<div className="flex gap-2">
|
||||||
|
{TABS.map((t) => (
|
||||||
|
<button
|
||||||
|
key={t.id}
|
||||||
|
onClick={() => setTab(t.id)}
|
||||||
|
className="flex-1 py-2 rounded-xl text-sm font-medium transition-all"
|
||||||
|
style={{
|
||||||
|
background: tab === t.id ? `${t.color}20` : "rgba(255,255,255,0.04)",
|
||||||
|
color: tab === t.id ? t.color : "#6b7280",
|
||||||
|
border: `1px solid ${tab === t.id ? `${t.color}40` : "rgba(255,255,255,0.06)"}`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Usage bar */}
|
||||||
|
{usage && (
|
||||||
|
<div>
|
||||||
|
<div className="flex justify-between text-xs mb-1">
|
||||||
|
<span className="text-zinc-400">{tab === "memory" ? "Agent memory" : "User profile"}</span>
|
||||||
|
<span className="text-zinc-500 font-mono">{usage}</span>
|
||||||
|
</div>
|
||||||
|
<div className="h-2 rounded-full bg-white/[0.06]">
|
||||||
|
<div
|
||||||
|
className="h-full rounded-full transition-all"
|
||||||
|
style={{ width: `${pct}%`, background: barColor }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Add form */}
|
||||||
|
{adding && (
|
||||||
|
<div className="glass p-3 space-y-2">
|
||||||
|
<textarea
|
||||||
|
value={newText}
|
||||||
|
onChange={(e) => setNewText(e.target.value)}
|
||||||
|
placeholder="New memory entry..."
|
||||||
|
className="w-full bg-transparent text-sm text-zinc-200 placeholder-zinc-600 resize-none outline-none min-h-[80px]"
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
<div className="flex gap-2 justify-end">
|
||||||
|
<button
|
||||||
|
onClick={() => { setAdding(false); setNewText(""); }}
|
||||||
|
className="px-3 py-1.5 text-xs text-zinc-400 rounded-lg"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleAdd}
|
||||||
|
disabled={!newText.trim() || addMutation.isPending}
|
||||||
|
className="px-3 py-1.5 text-xs rounded-lg font-medium disabled:opacity-40"
|
||||||
|
style={{ background: "rgba(56,189,248,0.2)", color: "#38bdf8" }}
|
||||||
|
>
|
||||||
|
{addMutation.isPending ? "Saving..." : "Add"}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Entries */}
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="space-y-2">
|
||||||
|
{[...Array(3)].map((_, i) => (
|
||||||
|
<div key={i} className="glass p-4 animate-pulse">
|
||||||
|
<div className="h-4 bg-white/[0.06] rounded w-full mb-2" />
|
||||||
|
<div className="h-4 bg-white/[0.06] rounded w-2/3" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : entries.length === 0 ? (
|
||||||
|
<div className="glass p-6 text-center text-sm text-zinc-500">
|
||||||
|
No entries yet
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-2">
|
||||||
|
{entries.map((entry, i) => (
|
||||||
|
<MemoryEntry
|
||||||
|
key={`${tab}-${i}`}
|
||||||
|
content={entry}
|
||||||
|
onPatch={(newContent) => handlePatch(entry.slice(0, 40), newContent)}
|
||||||
|
onDelete={() => handleDelete(entry.slice(0, 40))}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { StatusCard } from "@/components/StatusCard";
|
||||||
|
import { SessionCard } from "@/components/SessionCard";
|
||||||
|
import { MemorySnapshotCard } from "@/components/MemorySnapshotCard";
|
||||||
|
import { useSessions } from "@/lib/hooks";
|
||||||
|
|
||||||
|
export default function PulsePage() {
|
||||||
|
const { data: sessionsData, isLoading } = useSessions(8);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<h1 className="text-xl font-bold" style={{ color: "#f59e0b" }}>
|
||||||
|
Pulse
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<StatusCard />
|
||||||
|
<MemorySnapshotCard />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2 className="text-sm font-medium text-zinc-400 mb-2">
|
||||||
|
Recent Sessions
|
||||||
|
</h2>
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="space-y-3">
|
||||||
|
{[...Array(3)].map((_, i) => (
|
||||||
|
<div key={i} className="glass p-4 animate-pulse">
|
||||||
|
<div className="h-4 bg-white/[0.06] rounded w-3/4 mb-2" />
|
||||||
|
<div className="h-3 bg-white/[0.06] rounded w-1/2" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-2">
|
||||||
|
{sessionsData?.items?.map((s) => (
|
||||||
|
<SessionCard key={s.id} session={s} />
|
||||||
|
))}
|
||||||
|
{sessionsData?.items?.length === 0 && (
|
||||||
|
<div className="glass p-6 text-center text-sm text-zinc-500">
|
||||||
|
No sessions yet
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { Activity, Brain, Clock } from "lucide-react";
|
||||||
|
|
||||||
|
const TABS = [
|
||||||
|
{ href: "/", label: "Pulse", icon: Activity, color: "#f59e0b" },
|
||||||
|
{ href: "/memory", label: "Memory", icon: Brain, color: "#38bdf8" },
|
||||||
|
{ href: "/history", label: "History", icon: Clock, color: "#22c55e" },
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export function BottomNav() {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<nav
|
||||||
|
className="fixed bottom-0 left-0 right-0 z-50 border-t border-white/[0.06]"
|
||||||
|
style={{
|
||||||
|
background: "rgba(10,10,15,0.92)",
|
||||||
|
backdropFilter: "blur(20px)",
|
||||||
|
WebkitBackdropFilter: "blur(20px)",
|
||||||
|
paddingBottom: "var(--safe-bottom)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="flex justify-around items-center h-16 max-w-lg mx-auto">
|
||||||
|
{TABS.map(({ href, label, icon: Icon, color }) => {
|
||||||
|
const active =
|
||||||
|
href === "/" ? pathname === "/" : pathname.startsWith(href);
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
key={href}
|
||||||
|
href={href}
|
||||||
|
className="flex flex-col items-center gap-1 px-6 py-2 transition-opacity"
|
||||||
|
style={{ opacity: active ? 1 : 0.4 }}
|
||||||
|
>
|
||||||
|
<Icon size={22} style={{ color: active ? color : "#a1a1aa" }} />
|
||||||
|
<span
|
||||||
|
className="text-[10px] font-medium"
|
||||||
|
style={{ color: active ? color : "#a1a1aa" }}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Pencil, Trash2, Check, X } from "lucide-react";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
content: string;
|
||||||
|
onPatch: (newContent: string) => void;
|
||||||
|
onDelete: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MemoryEntry({ content, onPatch, onDelete }: Props) {
|
||||||
|
const [editing, setEditing] = useState(false);
|
||||||
|
const [editText, setEditText] = useState(content);
|
||||||
|
const [confirmDelete, setConfirmDelete] = useState(false);
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
if (editText.trim() && editText !== content) {
|
||||||
|
onPatch(editText.trim());
|
||||||
|
}
|
||||||
|
setEditing(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (editing) {
|
||||||
|
return (
|
||||||
|
<div className="glass p-3 space-y-2">
|
||||||
|
<textarea
|
||||||
|
value={editText}
|
||||||
|
onChange={(e) => setEditText(e.target.value)}
|
||||||
|
className="w-full bg-transparent text-sm text-zinc-200 resize-none outline-none min-h-[80px]"
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
<div className="flex gap-2 justify-end">
|
||||||
|
<button
|
||||||
|
onClick={() => { setEditing(false); setEditText(content); }}
|
||||||
|
className="p-1.5 rounded-lg text-zinc-500"
|
||||||
|
>
|
||||||
|
<X size={16} />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleSave}
|
||||||
|
className="p-1.5 rounded-lg"
|
||||||
|
style={{ color: "#22c55e" }}
|
||||||
|
>
|
||||||
|
<Check size={16} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="glass p-4 group">
|
||||||
|
<p className="text-sm text-zinc-300 whitespace-pre-wrap leading-relaxed">
|
||||||
|
{content}
|
||||||
|
</p>
|
||||||
|
<div className="flex gap-2 justify-end mt-2 opacity-0 group-active:opacity-100 transition-opacity">
|
||||||
|
<button
|
||||||
|
onClick={() => setEditing(true)}
|
||||||
|
className="p-1.5 rounded-lg text-zinc-500 active:text-zinc-300"
|
||||||
|
>
|
||||||
|
<Pencil size={14} />
|
||||||
|
</button>
|
||||||
|
{confirmDelete ? (
|
||||||
|
<button
|
||||||
|
onClick={() => { onDelete(); setConfirmDelete(false); }}
|
||||||
|
className="px-2 py-1 rounded-lg text-xs font-medium"
|
||||||
|
style={{ background: "rgba(239,68,68,0.2)", color: "#ef4444" }}
|
||||||
|
>
|
||||||
|
Confirm
|
||||||
|
</button>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
onClick={() => setConfirmDelete(true)}
|
||||||
|
className="p-1.5 rounded-lg text-zinc-500 active:text-red-400"
|
||||||
|
>
|
||||||
|
<Trash2 size={14} />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { Brain } from "lucide-react";
|
||||||
|
import { useMemory } from "@/lib/hooks";
|
||||||
|
|
||||||
|
function UsageBar({ label, usage }: { label: string; usage: string }) {
|
||||||
|
// usage format: "42% — 939/2,200 chars"
|
||||||
|
const pctMatch = usage.match(/(\d+)%/);
|
||||||
|
const pct = pctMatch ? parseInt(pctMatch[1]) : 0;
|
||||||
|
const color =
|
||||||
|
pct > 85 ? "#ef4444" : pct > 65 ? "#f59e0b" : "#38bdf8";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="flex justify-between text-[10px] mb-1">
|
||||||
|
<span className="text-zinc-400">{label}</span>
|
||||||
|
<span className="text-zinc-500 font-mono">{usage}</span>
|
||||||
|
</div>
|
||||||
|
<div className="h-1.5 rounded-full bg-white/[0.06]">
|
||||||
|
<div
|
||||||
|
className="h-full rounded-full transition-all"
|
||||||
|
style={{ width: `${pct}%`, background: color }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MemorySnapshotCard() {
|
||||||
|
const { data } = useMemory();
|
||||||
|
|
||||||
|
const memoryTarget = data?.targets?.find((t) => t.target === "memory");
|
||||||
|
const userTarget = data?.targets?.find((t) => t.target === "user");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link href="/memory">
|
||||||
|
<div className="glass glass-hover p-4 transition-all">
|
||||||
|
<div className="flex items-center gap-2 mb-3">
|
||||||
|
<Brain size={16} style={{ color: "#38bdf8" }} />
|
||||||
|
<span className="text-sm font-medium text-zinc-200">Memory</span>
|
||||||
|
<span className="text-xs text-zinc-500 ml-auto">
|
||||||
|
{(memoryTarget?.entry_count || 0) + (userTarget?.entry_count || 0)} entries
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
{memoryTarget && (
|
||||||
|
<UsageBar label="Agent" usage={memoryTarget.usage} />
|
||||||
|
)}
|
||||||
|
{userTarget && (
|
||||||
|
<UsageBar label="User" usage={userTarget.usage} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Wrench, ChevronDown, ChevronRight, User, Bot } from "lucide-react";
|
||||||
|
import type { Message, ToolCall } from "@/lib/types";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
message: Message;
|
||||||
|
toolResults: Map<string, { name: string; content: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ToolCallBlock({ tc, result }: { tc: ToolCall; result?: { name: string; content: string } }) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
let args: Record<string, unknown> = {};
|
||||||
|
try { args = JSON.parse(tc.function.arguments); } catch {}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mt-2">
|
||||||
|
<button
|
||||||
|
onClick={() => setOpen(!open)}
|
||||||
|
className="flex items-center gap-1.5 text-xs py-1 px-2 rounded-lg active:bg-white/[0.04] transition-all"
|
||||||
|
style={{ color: "#f59e0b" }}
|
||||||
|
>
|
||||||
|
<Wrench size={11} />
|
||||||
|
<span className="font-mono">{tc.function.name}</span>
|
||||||
|
{open ? <ChevronDown size={11} /> : <ChevronRight size={11} />}
|
||||||
|
</button>
|
||||||
|
{open && (
|
||||||
|
<div className="mt-1 ml-2 pl-2 border-l border-white/[0.06] space-y-1">
|
||||||
|
<pre className="text-[11px] text-zinc-500 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto">
|
||||||
|
{JSON.stringify(args, null, 2)}
|
||||||
|
</pre>
|
||||||
|
{result && (
|
||||||
|
<pre className="text-[11px] text-zinc-600 overflow-x-auto whitespace-pre-wrap max-h-32 overflow-y-auto">
|
||||||
|
{result.content.slice(0, 500)}
|
||||||
|
{result.content.length > 500 ? "..." : ""}
|
||||||
|
</pre>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MessageBubble({ message, toolResults }: Props) {
|
||||||
|
const isUser = message.role === "user";
|
||||||
|
const content = message.content || "";
|
||||||
|
|
||||||
|
let toolCalls: ToolCall[] = [];
|
||||||
|
if (message.tool_calls) {
|
||||||
|
try { toolCalls = JSON.parse(message.tool_calls); } catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!content && toolCalls.length === 0) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`flex ${isUser ? "justify-end" : "justify-start"}`}>
|
||||||
|
<div
|
||||||
|
className="max-w-[90%] rounded-2xl px-4 py-3"
|
||||||
|
style={{
|
||||||
|
background: isUser ? "rgba(56,189,248,0.12)" : "rgba(255,255,255,0.04)",
|
||||||
|
border: `1px solid ${isUser ? "rgba(56,189,248,0.2)" : "rgba(255,255,255,0.06)"}`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-1.5 mb-1">
|
||||||
|
{isUser ? (
|
||||||
|
<User size={12} className="text-sky-400" />
|
||||||
|
) : (
|
||||||
|
<Bot size={12} className="text-amber-400" />
|
||||||
|
)}
|
||||||
|
<span className="text-[10px] font-medium" style={{ color: isUser ? "#38bdf8" : "#f59e0b" }}>
|
||||||
|
{isUser ? "You" : "Hermes"}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{content && (
|
||||||
|
<p className="text-sm text-zinc-300 whitespace-pre-wrap leading-relaxed break-words">
|
||||||
|
{content}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{toolCalls.length > 0 && (
|
||||||
|
<div>
|
||||||
|
{toolCalls.length <= 3 ? (
|
||||||
|
toolCalls.map((tc) => (
|
||||||
|
<ToolCallBlock
|
||||||
|
key={tc.id}
|
||||||
|
tc={tc}
|
||||||
|
result={toolResults.get(tc.id)}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<CollapsedToolCalls toolCalls={toolCalls} toolResults={toolResults} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CollapsedToolCalls({
|
||||||
|
toolCalls,
|
||||||
|
toolResults,
|
||||||
|
}: {
|
||||||
|
toolCalls: ToolCall[];
|
||||||
|
toolResults: Map<string, { name: string; content: string }>;
|
||||||
|
}) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
return (
|
||||||
|
<div className="mt-2">
|
||||||
|
<button
|
||||||
|
onClick={() => setOpen(!open)}
|
||||||
|
className="flex items-center gap-1.5 text-xs py-1 px-2 rounded-lg active:bg-white/[0.04]"
|
||||||
|
style={{ color: "#f59e0b" }}
|
||||||
|
>
|
||||||
|
<Wrench size={11} />
|
||||||
|
<span>{toolCalls.length} tool calls</span>
|
||||||
|
{open ? <ChevronDown size={11} /> : <ChevronRight size={11} />}
|
||||||
|
</button>
|
||||||
|
{open &&
|
||||||
|
toolCalls.map((tc) => (
|
||||||
|
<ToolCallBlock key={tc.id} tc={tc} result={toolResults.get(tc.id)} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export function Providers({ children }: { children: React.ReactNode }) {
|
||||||
|
const [client] = useState(
|
||||||
|
() =>
|
||||||
|
new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: { staleTime: 30_000, retry: 1, refetchOnWindowFocus: true },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return <QueryClientProvider client={client}>{children}</QueryClientProvider>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { MessageSquare } from "lucide-react";
|
||||||
|
import { timeAgo, formatTokens, platformBadgeClass } from "@/lib/utils";
|
||||||
|
import type { Session } from "@/lib/types";
|
||||||
|
|
||||||
|
export function SessionCard({ session }: { session: Session }) {
|
||||||
|
const tokens = session.input_tokens + session.output_tokens;
|
||||||
|
const title = session.title || `Session ${session.id.slice(0, 8)}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link href={`/history/${session.id}`}>
|
||||||
|
<div className="glass glass-hover p-4 transition-all">
|
||||||
|
<div className="flex items-start justify-between gap-2 mb-2">
|
||||||
|
<span className="text-sm font-medium text-zinc-200 line-clamp-1 flex-1">
|
||||||
|
{title}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
className={`text-[10px] px-1.5 py-0.5 rounded-full shrink-0 font-medium ${platformBadgeClass(session.source)}`}
|
||||||
|
>
|
||||||
|
{session.source}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-3 text-xs text-zinc-500">
|
||||||
|
<span className="flex items-center gap-1">
|
||||||
|
<MessageSquare size={12} />
|
||||||
|
{session.message_count}
|
||||||
|
</span>
|
||||||
|
{tokens > 0 && <span>{formatTokens(tokens)} tok</span>}
|
||||||
|
<span className="ml-auto">{timeAgo(session.started_at)}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Cpu, Wifi, WifiOff } from "lucide-react";
|
||||||
|
import { useHealth, useConfig } from "@/lib/hooks";
|
||||||
|
|
||||||
|
export function StatusCard() {
|
||||||
|
const { data: health } = useHealth();
|
||||||
|
const { data: config } = useConfig();
|
||||||
|
|
||||||
|
const online = health?.status === "ok";
|
||||||
|
const model = config?.model || "—";
|
||||||
|
const provider = config?.provider || "custom";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="glass p-4">
|
||||||
|
<div className="flex items-center justify-between mb-3">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Cpu size={18} style={{ color: "#f59e0b" }} />
|
||||||
|
<span className="font-semibold text-sm">Hermes</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-1.5">
|
||||||
|
<div
|
||||||
|
className="w-2 h-2 rounded-full"
|
||||||
|
style={{
|
||||||
|
background: online ? "#22c55e" : "#ef4444",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{online ? (
|
||||||
|
<Wifi size={14} style={{ color: "#22c55e" }} />
|
||||||
|
) : (
|
||||||
|
<WifiOff size={14} style={{ color: "#ef4444" }} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-2 gap-3 text-xs">
|
||||||
|
<div>
|
||||||
|
<div className="text-zinc-500">Model</div>
|
||||||
|
<div className="text-zinc-200 font-mono truncate">{model}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div className="text-zinc-500">Provider</div>
|
||||||
|
<div className="text-zinc-200 font-mono truncate">{provider}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
||||||
|
import nextTs from "eslint-config-next/typescript";
|
||||||
|
|
||||||
|
const eslintConfig = defineConfig([
|
||||||
|
...nextVitals,
|
||||||
|
...nextTs,
|
||||||
|
// Override default ignores of eslint-config-next.
|
||||||
|
globalIgnores([
|
||||||
|
// Default ignores of eslint-config-next:
|
||||||
|
".next/**",
|
||||||
|
"out/**",
|
||||||
|
"build/**",
|
||||||
|
"next-env.d.ts",
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
export default eslintConfig;
|
||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
const BASE = process.env.NEXT_PUBLIC_HERMES_API || "http://localhost:8787";
|
||||||
|
|
||||||
|
async function get<T>(path: string): Promise<T> {
|
||||||
|
const res = await fetch(`${BASE}${path}`);
|
||||||
|
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
||||||
|
return res.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function post<T>(path: string, body?: unknown): Promise<T> {
|
||||||
|
const res = await fetch(`${BASE}${path}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
|
});
|
||||||
|
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
||||||
|
return res.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function patch<T>(path: string, body: unknown): Promise<T> {
|
||||||
|
const res = await fetch(`${BASE}${path}`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
});
|
||||||
|
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
||||||
|
return res.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function del<T>(path: string, body?: unknown): Promise<T> {
|
||||||
|
const res = await fetch(`${BASE}${path}`, {
|
||||||
|
method: "DELETE",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
|
});
|
||||||
|
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
||||||
|
return res.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
import type {
|
||||||
|
Session, Message, MemoryResponse, SkillSummary, SkillDetail,
|
||||||
|
CronJob, ConfigResponse, SearchResult,
|
||||||
|
} from "./types";
|
||||||
|
|
||||||
|
// Sessions
|
||||||
|
export const fetchSessions = (limit = 50, offset = 0, source?: string) =>
|
||||||
|
get<{ items: Session[]; total: number }>(
|
||||||
|
`/api/sessions?limit=${limit}&offset=${offset}${source ? `&source=${source}` : ""}`
|
||||||
|
);
|
||||||
|
|
||||||
|
export const fetchSession = (id: string) =>
|
||||||
|
get<{ session: Session }>(`/api/sessions/${id}`);
|
||||||
|
|
||||||
|
export const fetchMessages = (sessionId: string, limit = 200, offset = 0) =>
|
||||||
|
get<{ items: Message[]; total: number }>(
|
||||||
|
`/api/sessions/${sessionId}/messages?limit=${limit}&offset=${offset}`
|
||||||
|
);
|
||||||
|
|
||||||
|
export const searchSessions = (q: string, limit = 20) =>
|
||||||
|
get<{ query: string; count: number; results: SearchResult[] }>(
|
||||||
|
`/api/sessions/search?q=${encodeURIComponent(q)}&limit=${limit}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Memory
|
||||||
|
export const fetchMemory = () => get<MemoryResponse>("/api/memory");
|
||||||
|
|
||||||
|
export const addMemory = (target: string, content: string) =>
|
||||||
|
post<{ success: boolean }>("/api/memory", { target, content });
|
||||||
|
|
||||||
|
export const patchMemory = (target: string, old_text: string, content: string) =>
|
||||||
|
patch<{ success: boolean }>("/api/memory", { target, old_text, content });
|
||||||
|
|
||||||
|
export const deleteMemory = (target: string, old_text: string) =>
|
||||||
|
del<{ success: boolean }>("/api/memory", { target, old_text });
|
||||||
|
|
||||||
|
// Skills
|
||||||
|
export const fetchSkills = (category?: string) =>
|
||||||
|
get<{ success: boolean; skills: SkillSummary[] }>(
|
||||||
|
`/api/skills${category ? `?category=${category}` : ""}`
|
||||||
|
);
|
||||||
|
|
||||||
|
export const fetchSkill = (name: string) =>
|
||||||
|
get<SkillDetail>(`/api/skills/${name}`);
|
||||||
|
|
||||||
|
// Config
|
||||||
|
export const fetchConfig = () => get<ConfigResponse>("/api/config");
|
||||||
|
|
||||||
|
// Health
|
||||||
|
export const fetchHealth = () => get<{ status: string }>("/api/health");
|
||||||
+104
@@ -0,0 +1,104 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
|
import * as api from "./api";
|
||||||
|
|
||||||
|
// Sessions
|
||||||
|
export function useSessions(limit = 20, source?: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["sessions", limit, source],
|
||||||
|
queryFn: () => api.fetchSessions(limit, 0, source),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSession(id: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["session", id],
|
||||||
|
queryFn: () => api.fetchSession(id),
|
||||||
|
enabled: !!id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useMessages(sessionId: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["messages", sessionId],
|
||||||
|
queryFn: () => api.fetchMessages(sessionId),
|
||||||
|
enabled: !!sessionId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSessionSearch(query: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["search", query],
|
||||||
|
queryFn: () => api.searchSessions(query),
|
||||||
|
enabled: query.length >= 2,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Memory
|
||||||
|
export function useMemory() {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["memory"],
|
||||||
|
queryFn: api.fetchMemory,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAddMemory() {
|
||||||
|
const qc = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ target, content }: { target: string; content: string }) =>
|
||||||
|
api.addMemory(target, content),
|
||||||
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["memory"] }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function usePatchMemory() {
|
||||||
|
const qc = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ target, old_text, content }: { target: string; old_text: string; content: string }) =>
|
||||||
|
api.patchMemory(target, old_text, content),
|
||||||
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["memory"] }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteMemory() {
|
||||||
|
const qc = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ target, old_text }: { target: string; old_text: string }) =>
|
||||||
|
api.deleteMemory(target, old_text),
|
||||||
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["memory"] }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skills
|
||||||
|
export function useSkills(category?: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["skills", category],
|
||||||
|
queryFn: () => api.fetchSkills(category),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSkill(name: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["skill", name],
|
||||||
|
queryFn: () => api.fetchSkill(name),
|
||||||
|
enabled: !!name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Config
|
||||||
|
export function useConfig() {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["config"],
|
||||||
|
queryFn: api.fetchConfig,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Health
|
||||||
|
export function useHealth() {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["health"],
|
||||||
|
queryFn: api.fetchHealth,
|
||||||
|
refetchInterval: 30_000,
|
||||||
|
});
|
||||||
|
}
|
||||||
+107
@@ -0,0 +1,107 @@
|
|||||||
|
// Hermes WebAPI response types
|
||||||
|
|
||||||
|
export interface Session {
|
||||||
|
id: string;
|
||||||
|
source: string;
|
||||||
|
user_id: string | null;
|
||||||
|
model: string | null;
|
||||||
|
started_at: number;
|
||||||
|
ended_at: number | null;
|
||||||
|
end_reason: string | null;
|
||||||
|
message_count: number;
|
||||||
|
tool_call_count: number;
|
||||||
|
input_tokens: number;
|
||||||
|
output_tokens: number;
|
||||||
|
cache_read_tokens: number;
|
||||||
|
cache_write_tokens: number;
|
||||||
|
reasoning_tokens: number;
|
||||||
|
estimated_cost_usd: number | null;
|
||||||
|
title: string | null;
|
||||||
|
parent_session_id: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Message {
|
||||||
|
id: number;
|
||||||
|
session_id: string;
|
||||||
|
role: "user" | "assistant" | "tool" | "system";
|
||||||
|
content: string | null;
|
||||||
|
tool_call_id: string | null;
|
||||||
|
tool_calls: string | null;
|
||||||
|
tool_name: string | null;
|
||||||
|
timestamp: number;
|
||||||
|
token_count: number | null;
|
||||||
|
finish_reason: string | null;
|
||||||
|
reasoning: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ToolCall {
|
||||||
|
id: string;
|
||||||
|
function: { name: string; arguments: string };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MemoryTarget {
|
||||||
|
target: "memory" | "user";
|
||||||
|
entries: string[];
|
||||||
|
usage: string;
|
||||||
|
entry_count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MemoryResponse {
|
||||||
|
targets: MemoryTarget[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SkillSummary {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
category?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SkillDetail {
|
||||||
|
name: string;
|
||||||
|
content: string;
|
||||||
|
linked_files?: Record<string, string[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CronJob {
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
prompt: string;
|
||||||
|
schedule: string;
|
||||||
|
status: string;
|
||||||
|
deliver: string;
|
||||||
|
skill?: string;
|
||||||
|
skills?: string[];
|
||||||
|
model?: string;
|
||||||
|
provider?: string;
|
||||||
|
repeat?: number;
|
||||||
|
run_count: number;
|
||||||
|
last_run?: string;
|
||||||
|
next_run?: string;
|
||||||
|
created_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GatewayState {
|
||||||
|
pid: number;
|
||||||
|
kind: string;
|
||||||
|
gateway_state: string;
|
||||||
|
platforms: Record<string, { state: string; updated_at: string }>;
|
||||||
|
updated_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConfigResponse {
|
||||||
|
model: string;
|
||||||
|
provider: string | null;
|
||||||
|
api_mode: string | null;
|
||||||
|
base_url: string | null;
|
||||||
|
config: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SearchResult {
|
||||||
|
session_id: string;
|
||||||
|
message_id: number;
|
||||||
|
role: string;
|
||||||
|
content: string;
|
||||||
|
timestamp: number;
|
||||||
|
session_title: string | null;
|
||||||
|
session_source: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
export function timeAgo(ts: number): string {
|
||||||
|
const now = Date.now() / 1000;
|
||||||
|
const diff = now - ts;
|
||||||
|
if (diff < 60) return "just now";
|
||||||
|
if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
|
||||||
|
if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
|
||||||
|
if (diff < 604800) return `${Math.floor(diff / 86400)}d ago`;
|
||||||
|
return new Date(ts * 1000).toLocaleDateString();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatTokens(n: number): string {
|
||||||
|
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
|
||||||
|
if (n >= 1_000) return `${(n / 1_000).toFixed(1)}k`;
|
||||||
|
return String(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function platformColor(source: string): string {
|
||||||
|
const map: Record<string, string> = {
|
||||||
|
cli: "#f59e0b",
|
||||||
|
telegram: "#38bdf8",
|
||||||
|
discord: "#8b5cf6",
|
||||||
|
whatsapp: "#22c55e",
|
||||||
|
web: "#a78bfa",
|
||||||
|
webapi: "#a78bfa",
|
||||||
|
};
|
||||||
|
return map[source] || "#6b7280";
|
||||||
|
}
|
||||||
|
|
||||||
|
export function platformBadgeClass(source: string): string {
|
||||||
|
const map: Record<string, string> = {
|
||||||
|
cli: "badge-cli",
|
||||||
|
telegram: "badge-telegram",
|
||||||
|
discord: "badge-discord",
|
||||||
|
whatsapp: "badge-whatsapp",
|
||||||
|
web: "badge-web",
|
||||||
|
webapi: "badge-web",
|
||||||
|
};
|
||||||
|
return map[source] || "badge-cli";
|
||||||
|
}
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/image-types/global" />
|
||||||
|
import "./.next/types/routes.d.ts";
|
||||||
|
|
||||||
|
// NOTE: This file should not be edited
|
||||||
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
|
const nextConfig: NextConfig = {
|
||||||
|
output: "standalone",
|
||||||
|
reactStrictMode: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default nextConfig;
|
||||||
Generated
+6609
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "temp-scaffold",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "next dev",
|
||||||
|
"build": "next build",
|
||||||
|
"start": "next start",
|
||||||
|
"lint": "eslint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@tanstack/react-query": "^5.97.0",
|
||||||
|
"lucide-react": "^1.8.0",
|
||||||
|
"next": "16.2.3",
|
||||||
|
"react": "19.2.4",
|
||||||
|
"react-dom": "19.2.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tailwindcss/postcss": "^4",
|
||||||
|
"@types/node": "^20",
|
||||||
|
"@types/react": "^19",
|
||||||
|
"@types/react-dom": "^19",
|
||||||
|
"eslint": "^9",
|
||||||
|
"eslint-config-next": "16.2.3",
|
||||||
|
"tailwindcss": "^4",
|
||||||
|
"typescript": "^5"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
const config = {
|
||||||
|
plugins: {
|
||||||
|
"@tailwindcss/postcss": {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||||
|
After Width: | Height: | Size: 391 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "Hermes OS",
|
||||||
|
"short_name": "Hermes",
|
||||||
|
"description": "Mobile dashboard for Hermes Agent",
|
||||||
|
"start_url": "/",
|
||||||
|
"display": "standalone",
|
||||||
|
"background_color": "#0a0a0f",
|
||||||
|
"theme_color": "#0a0a0f",
|
||||||
|
"orientation": "portrait-primary",
|
||||||
|
"icons": [
|
||||||
|
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
|
||||||
|
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png" }
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,24 @@
|
|||||||
|
// Hermes OS service worker — cache shell for offline PWA
|
||||||
|
const CACHE = "hermes-os-v1";
|
||||||
|
const SHELL = ["/", "/manifest.json"];
|
||||||
|
|
||||||
|
self.addEventListener("install", (e) => {
|
||||||
|
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(SHELL)));
|
||||||
|
self.skipWaiting();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener("activate", (e) => {
|
||||||
|
e.waitUntil(
|
||||||
|
caches.keys().then((keys) =>
|
||||||
|
Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
self.clients.claim();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener("fetch", (e) => {
|
||||||
|
if (e.request.method !== "GET") return;
|
||||||
|
e.respondWith(
|
||||||
|
fetch(e.request).catch(() => caches.match(e.request))
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||||
|
After Width: | Height: | Size: 128 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||||
|
After Width: | Height: | Size: 385 B |
@@ -0,0 +1,31 @@
|
|||||||
|
import type { Config } from "tailwindcss";
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
content: ["./app/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}", "./lib/**/*.{ts,tsx}"],
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
surface: {
|
||||||
|
DEFAULT: "#0a0a0f",
|
||||||
|
card: "rgba(255,255,255,0.04)",
|
||||||
|
hover: "rgba(255,255,255,0.07)",
|
||||||
|
},
|
||||||
|
border: {
|
||||||
|
glass: "rgba(255,255,255,0.08)",
|
||||||
|
},
|
||||||
|
accent: {
|
||||||
|
pulse: "#f59e0b",
|
||||||
|
memory: "#38bdf8",
|
||||||
|
history: "#22c55e",
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
primary: "#f0f0f0",
|
||||||
|
secondary: "#a1a1aa",
|
||||||
|
muted: "#52525b",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
};
|
||||||
|
export default config;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2017",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"incremental": true,
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "next"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts",
|
||||||
|
".next/dev/types/**/*.ts",
|
||||||
|
"**/*.mts"
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user