fix(sites): HHClub parsing, resource list layout and request restraint

HHClub (憨憨) was checked read-only against a real account (one detail
request; list, user data and health came from the product's own fetch).

Parsing fixes:
- list titles carried the site's new-torrent marker "[新]" (58 of 100
  rows; the detail page title has none); stripped with a replace filter
- refreshing a detail overwrote seeders / leechers / snatched / category
  name / H&R with null because the HHClub div detail page lacks them;
  detail values now fall back to the list snapshot (mergeDetailOverList),
  and an unknown detail promotion keeps the list promotion
- level "贵宾" is VIP (umt.vipLevels)
- sanitized minimal fixture HHANCLUB_LIST_PAGE_2026 + tests; README marks
  HHClub as verified 2026-09-29
Size, counts, category ids/names, +08:00 time and subtitle were correct.

Request restraint:
- site definitions may carry umt.defaults; merged with settings.sites
  (longer intervals, fewer pages): new settings defaultSnapshotMaxPages 1,
  defaultHealthCheckIntervalSec 6 h, defaultDetailCacheSec 24 h; default
  burst 2. HHClub: snapshot 60 min page 1 only, health 6 h, search
  concurrency 1, detail cache 24 h, 1 token / 3 s burst 2
- periodic / manual snapshots are capped to that page count; scheduled
  health checks skip sites checked within the interval; detail refresh is
  served from cache inside the window; live searches on one site queue
- every rate-limiter token is counted per site per hour
  (site_request_count, migration 0046); GET /sites/{id}/request-stats;
  site overview and resource list show requests in the last 24 hours

Resource list: two-layer rows. Main line: title + spec tags (episodes,
resolution, source, codec, HDR, group, 国语/中字, site tags) + promotion
with time left + H&R. Second line: subtitle (one line, ellipsis) and
fixed-width category / size / seed-leech-snatched / upload time
(relative, absolute on hover) columns, stale badge, inventory overlay;
folds into a card on phones.

Also aligns identity_candidate.normalized_title order in db types with
the migrations (schema drift test).

Takes effect after the stack is rebuilt (migration 0046).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 15:18:15 +08:00
1 parent 20b63db254
commit 901b01d1a1
43 files changed
+1222 -1315

No files matched your search

+16 -19
View File
@@ -2,8 +2,7 @@
// Copyright (c) 2026 Saurabh Chauhan. MIT License, see ./LICENSE-agentui.md
// 改造:状态色 blue/emerald/rose → 中性/success/destructive(并配文字);ActionSwapRollText 滚字去掉;
// 折叠用 Disclosure;新增 `badges` 槽(scope/风险/幂等等审计徽标)与 `summary`(收起时的一行结果);
// AGUI-2:收起态压成一行(能力名 · 状态 · 耗时 · 摘要),能力 ID 与徽标移进展开区;
// 默认一律收起(运行中也只显示一行状态);用户点开的卡片完成后保持展开(collapseOnComplete 可改)。
// 默认不在完成后自动展开历史卡片(回放时 defaultOpen=false),运行中的卡片展开、完成后按 collapseOnComplete 收起。
import { Ban, Braces, ChevronDown, CircleCheck, CircleX, LoaderCircle, SquareTerminal, Wrench } from "lucide-react";
import { type ReactNode, useCallback, useEffect, useId, useRef, useState } from "react";
import { cn } from "~/lib/utils.ts";
@@ -62,8 +61,8 @@ export function ToolResult({
badges,
summary,
icon,
defaultOpen = false,
collapseOnComplete = false,
defaultOpen = status === "running",
collapseOnComplete = true,
className,
}: ToolResultProps) {
const id = useId();
@@ -71,6 +70,7 @@ export function ToolResult({
const prev = useRef(status);
const setOpen = useCallback((v: boolean) => setOpenState(v), []);
useEffect(() => {
if (prev.current !== "running" && status === "running") setOpen(true);
if (prev.current === "running" && status !== "running" && collapseOnComplete) setOpen(false);
prev.current = status;
}, [collapseOnComplete, setOpen, status]);
@@ -88,31 +88,28 @@ export function ToolResult({
aria-expanded={open}
aria-controls={`${id}-c`}
onClick={() => setOpen(!open)}
className="group flex min-h-9 w-full min-w-0 cursor-pointer items-center gap-2 rounded-xl px-3 py-1.5 text-left outline-none transition-colors duration-micro hover:bg-foreground/[0.03] focus-visible:ring-2 focus-visible:ring-ring"
className="group flex min-h-10 w-full min-w-0 cursor-pointer items-center gap-2 rounded-xl px-3 py-1.5 text-left outline-none transition-colors duration-micro hover:bg-foreground/[0.03] focus-visible:ring-2 focus-visible:ring-ring"
>
<span aria-hidden className="grid size-4 shrink-0 place-items-center text-muted-foreground">
{icon ?? <KindIcon kind={kind} />}
</span>
{/* 收起时一行:能力名 · 状态 · 耗时 · 摘要;展开后摘要让位给完整输入输出 */}
<span className="max-w-[45%] shrink-0 truncate text-caption font-medium text-foreground/90">{title}</span>
<span className="flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2 gap-y-0.5">
<span className="min-w-0 truncate text-caption font-medium text-foreground/90">{title}</span>
<span className="min-w-0 truncate font-mono text-label text-muted-foreground">{tool}</span>
{meta ? <span className="shrink-0 text-label text-muted-foreground tabular-nums">{meta}</span> : null}
</span>
<span className={cn("inline-flex shrink-0 items-center gap-1 text-label font-medium", st.cls)}>
<StatusIcon status={status} />
{st.label}
</span>
{meta ? <span className="shrink-0 text-label text-muted-foreground tabular-nums">{meta}</span> : null}
<span className="min-w-0 flex-1 truncate text-meta text-muted-foreground">
{!open && summary ? summary : null}
</span>
<ChevronDown aria-hidden className={cn("size-3.5 shrink-0", CHEVRON_CLASS, open && "rotate-180")} />
<ChevronDown aria-hidden className={cn("size-3.5", CHEVRON_CLASS, open && "rotate-180")} />
</button>
{badges ? <div className="flex flex-wrap items-center gap-1 px-3 pb-2 pl-9">{badges}</div> : null}
{!open && summary ? (
<p className="-mt-1 truncate px-3 pb-2 pl-9 text-meta text-muted-foreground">{summary}</p>
) : null}
<Disclosure id={`${id}-c`} role="region" aria-labelledby={`${id}-t`} open={open}>
<div className="space-y-2 border-t border-border/60 px-3 py-2.5">
<div className="flex flex-wrap items-center gap-1">
<span className="mr-1 min-w-0 truncate font-mono text-label text-muted-foreground">{tool}</span>
{badges}
</div>
{children}
</div>
<div className="space-y-2 border-t border-border/60 px-3 py-2.5">{children}</div>
</Disclosure>
</div>
);