// page-home.jsx — landing page with game-flavored animations
const { SiteCtx, useReveal, CountUp, I18N } = window.MM_HOOKS;
function HomePage({ motion, onJump }) {
const { lang } = React.useContext(SiteCtx);
const t = I18N[lang];
const D = window.SITE_DATA;
const stats = D.HERO.stats;
const [ref1, s1] = useReveal({ threshold: 0.1 });
const [ref2, s2] = useReveal({ threshold: 0.1 });
const [ref3, s3] = useReveal({ threshold: 0.1 });
const [ref4, s4] = useReveal({ threshold: 0.1 });
const [ref5, s5] = useReveal({ threshold: 0.2 });
const [agentOpen, setAgentOpen] = React.useState(false);
React.useEffect(() => {
document.body.style.overflow = agentOpen ? "hidden" : "";
const onKey = (e) => { if (e.key === "Escape") setAgentOpen(false); };
if (agentOpen) window.addEventListener("keydown", onKey);
return () => { document.body.style.overflow = ""; window.removeEventListener("keydown", onKey); };
}, [agentOpen]);
return (
▲
◆
●
■
{t.home_tagline_a}{t.home_tagline_b} {t.home_tagline_c}
{t.home_sub}
onJump("cases")}>
👤
{lang === "zh" ? "Human view" : "Human view"}
{lang === "zh" ? "往下滚——案例、Side Project、简历、AI 对话。" : "Scroll on — cases, side projects, résumé, chat."}
↓
setAgentOpen(true)}>
🤖
{lang === "zh" ? "Agent view" : "Agent view"}
{lang === "zh" ? "看一个 agent 来这里会先抓哪几个文件。可以一键复制成 curl。" : "See which files an agent fetches here first. Copy as curl."}
→
{stats.map((s, i) => (
{s.note_en && {lang === "zh" ? s.note_zh : s.note_en} }
{lang === "zh" ? s.label_zh : s.label_en}
))}
{agentOpen && setAgentOpen(false)} lang={lang} />}
);
}
// ============================================================
// AgentView — demonstrates the fetch sequence an LLM agent runs
// against this site. Not a mode toggle — a product demo of
// agent-readable design. Resources are real & fetched live.
// ============================================================
const AGENT_SEQUENCE = [
{ url: "/llms.txt", type: "text/markdown", purpose_en: "Site map for agents (llmstxt.org spec)", purpose_zh: "agent 的站点地图(llmstxt.org 规范)" },
{ url: "/skill.md", type: "text/markdown", purpose_en: "How to evaluate this candidate", purpose_zh: "如何评估这个候选人" },
{ url: "/candidate.md", type: "text/markdown", purpose_en: "Full CV, EN + 中文", purpose_zh: "完整简历,中英双语" },
{ url: "/projects.json", type: "application/json",purpose_en: "Machine-readable project list", purpose_zh: "结构化的项目列表" },
];
function AgentView({ onClose, lang }) {
const [active, setActive] = React.useState(0);
const [bodies, setBodies] = React.useState({});
const [status, setStatus] = React.useState({});
const [copied, setCopied] = React.useState(false);
// fetch all four resources lazily, show first 20 lines
React.useEffect(() => {
AGENT_SEQUENCE.forEach((s, i) => {
const path = s.url.replace(/^\//, "");
setStatus(prev => ({ ...prev, [i]: "fetching" }));
fetch(path, { headers: { Accept: s.type } })
.then(r => r.text().then(t => ({ ok: r.ok, code: r.status, text: t })))
.then(({ ok, code, text }) => {
setStatus(prev => ({ ...prev, [i]: ok ? `200 OK · ${text.length.toLocaleString()} bytes` : `${code}` }));
setBodies(prev => ({ ...prev, [i]: text }));
})
.catch(() => setStatus(prev => ({ ...prev, [i]: "error" })));
});
}, []);
const origin = typeof window !== "undefined" ? window.location.origin : "https://mingmu.site";
const curl = AGENT_SEQUENCE.map(s =>
`curl -H "Accept: ${s.type}" ${origin}${s.url}`
).join(" \\\n && ");
const copyCurl = async () => {
try {
await navigator.clipboard.writeText(curl);
setCopied(true);
setTimeout(() => setCopied(false), 1800);
} catch {}
};
const cur = AGENT_SEQUENCE[active];
const body = bodies[active] || "";
const previewLines = body.split("\n").slice(0, 20);
const truncated = body.split("\n").length > 20;
return (
e.stopPropagation()}>
🤖
{lang === "zh" ? "Agent 视图 — 一个 LLM 代理在这个站点会做什么" : "Agent view — what an LLM agent fetches here"}
✕
01
{lang === "zh" ? "请求序列" : "Fetch sequence"}
{AGENT_SEQUENCE.map((s, i) => (
setActive(i)}
>
GET
{s.url}
{status[i] || "—"}
{lang === "zh" ? s.purpose_zh : s.purpose_en}
Accept: {s.type}
))}
02
{lang === "zh" ? "复制成 curl" : "Copy as curl"}
{curl}
{copied
? (lang === "zh" ? "✓ 已复制" : "✓ Copied")
: (lang === "zh" ? "📋 复制全部" : "📋 Copy all")}
03
{lang === "zh" ? "响应预览(前 20 行)" : "Response preview (first 20 lines)"}
GET {cur.url}
Content-Type: {cur.type}
{status[active] || "fetching…"}
{previewLines.map((line, i) => (
{String(i + 1).padStart(2, "0")}
{line || " "}
))}
{truncated && (
)}
{lang === "zh"
? "上面四个 URL 都是真的,agent 现在就能 curl。"
: "All four URLs are real. An agent could curl them right now."}
{lang === "zh" ? "Esc 关闭" : "press Esc to close"}
);
}
window.HomePage = HomePage;