Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style: token B rollover, ux skill restructure, agent breadcrumb & approval card (#16587)

Arvin Xu4f894c6de61b
diff --git a/.agents/skills/react/SKILL.md b/.agents/skills/react/SKILL.md
index 547dd05c230..9d0632f2921 100644
--- a/.agents/skills/react/SKILL.md
+++ b/.agents/skills/react/SKILL.md
@@ -56,7 +56,8 @@ For Modal specifically, see the dedicated **modal** skill — use the imperative
## Loading indicators
**Do NOT use antd `Spin` / `<Spin />`.** Use a project loader
-(`NeuralNetworkLoading`, `DotsLoading`, …) instead.
+(`NeuralNetworkLoading`, `DotsLoading`, …) — see the **ux** skill ("Loading
+visuals") for the component table and when to use each.
## State
@@ -117,7 +118,7 @@ errorElement: <ErrorBoundary />;
| ------------------------------------------------------------------ | --------------------------------------------------------------------------- |
| Using `next/link` in SPA | Use `react-router-dom` `Link` |
| Using antd directly | Use `@lobehub/ui/base-ui` first, then `@lobehub/ui` |
-| antd `Spin` / `<Spin />` for loading | Use `NeuralNetworkLoading` / project loaders |
+| antd `Spin` / `<Spin />` for loading | Use `NeuralNetworkLoading` / project loaders (see the **ux** skill) |
| `import { Select } from '@lobehub/ui'` | `import { Select } from '@lobehub/ui/base-ui'` |
| `import { Modal } from '@lobehub/ui'` + `<Modal open>` declarative | `createModal` / `confirmModal` from `@lobehub/ui/base-ui` (see modal skill) |
| `import { DropdownMenu/Popover/Switch } from '@lobehub/ui'` | Import same name from `@lobehub/ui/base-ui` instead |
diff --git a/.agents/skills/ux-audit/SKILL.md b/.agents/skills/ux-audit/SKILL.md
new file mode 100644
index 00000000000..6bca59891ce
--- /dev/null
+++ b/.agents/skills/ux-audit/SKILL.md
@@ -0,0 +1,121 @@
+---
+name: ux-audit
+description: 'Audit a page / surface against the Designing Interfaces pattern language + the ux skill checklists, then land findings. Use to run a repeatable, standards-based UX review of one screen.'
+disable-model-invocation: true
+argument-hint: '<page-or-surface>'
+---
+
+# UX Audit
+
+A repeatable, standards-based UX review of **one surface at a time**. The benchmark is
+two things together:
+
+1. **Jenifer Tidwell, _Designing Interfaces_** — the pattern language for what a good
+ interface is _made of_ (navigation, layout, input, commands, data display, feedback).
+ See [`references/pattern-catalog.md`](references/pattern-catalog.md).
+2. **The [`ux`](../ux/SKILL.md) skill** — LobeHub's execution checklists for how a flow
+ should _behave_ (empty/loading/error, loading-can-fail, draft safety, forward
+ momentum, one primary button, live streams, …).
+
+The audit answers two questions for the surface: **which patterns does it use** (and how
+well), and **where is the experience weak** (each gap tied to a checklist item). It also
+feeds back: recurring gaps become new `ux` checklist items; the audit itself can become a
+worked-example reference.
+
+Do **one surface per run** — a full-app sweep is too much for a single pass. Re-run per
+page as the product grows; that's the "continuous" part.
+
+## Ground rule: evidence, not vibes
+
+Every finding cites `file:line`. Before you assert a load-bearing claim ("no error
+state", "draft not persisted"), **open the code and confirm it** — don't trust a summary
+or a screenshot. A wrong "it's missing" is worse than no finding. When you delegate the
+surface map to an Explore agent, still re-read the 2–3 files behind your top findings
+yourself.
+
+## Procedure
+
+### 1 — Scope & map the surface
+
+Pin down exactly what's being audited (the route + its feature tree). A screenshot from
+the user is the ideal anchor — enumerate every block the user sees, top to bottom, plus
+the surrounding chrome (nav, header, sidebar).
+
+- Find the route segment (`src/routes/**`) and the feature components (`src/features/**`)
+ it delegates to. An **Explore** agent is good here — ask it to return the component
+ tree, and for each block: the data-fetching mechanism, and which of empty / loading /
+ error / retry states exist or are **missing**, with `file:line`.
+- Produce a block list: `[greeting] [composer] [banner] [chips] [feed] [sidebar…]`.
+
+### 2 — Inventory patterns in use
+
+Walk [`references/pattern-catalog.md`](references/pattern-catalog.md) family by family.
+For each block, tag the Tidwell pattern(s) it implements and rate the execution:
+
+- **✅ solid** — used well.
+- **⚠️ partial / misused** — the pattern is there but incomplete or fighting its intent.
+
+Output a table: `Pattern | Where (block + file) | ✅/⚠️ | one-line note`. This is the
+"patterns in use" half of the report — it also surfaces **missing** patterns (a data feed
+with no _Update Indicator_; a list with no _empty state_).
+
+### 3 — Audit states & flows against the ux checklists
+
+For every block, walk the relevant [`ux`](../ux/SKILL.md) module (Read / Edit / Act /
+Feedback / Grow). Record each gap as **present / missing / misleading** with `file:line`
+evidence. High-yield checks, in order of how often they're the real problem here:
+
+- **Loading can fail** (Feedback §4.2) — does every fetch have a terminal failure + retry,
+ or does it spin forever / silently degrade? Watch for an init-flag set _only_ on success
+ → permanent skeleton on error.
+- **Empty vs failed vs not-loaded** (Read §1.1) — are the variants distinguished, or does a
+ failed load masquerade as "nothing here"?
+- **Draft safety** (Edit §2.1) — is typed input persisted across reload/crash, or in-memory
+ only?
+- **Forward momentum & action states** (Act §3.1) — confirm → in-progress (locked) →
+ done/error; success leads forward.
+- **One primary button per surface**, **pinned actions outside scroll** (Act §3.2 / §3.3).
+- **Live / polling streams** (Read §1.7) — new-item indicator, manual refresh, no reorder
+ under the user.
+- **Predictable affordances** — is anything randomized / rotating / ephemeral where the
+ user needs a stable mental model (promo slots, placeholders holding real content)?
+
+### 4 — Rank by severity
+
+- 🔴 **Breaks trust** — data or input loss, stuck/permanent states, misleading "empty" that
+ hides a failure, silent send failure.
+- 🟠 **Dead-ends or misleads** — no forward path, ambiguous state, missing in-progress
+ feedback, empty state that isn't a real page.
+- 🟡 **Friction / inconsistency / missed delight** — predictability, redundant controls,
+ progressive-disclosure gaps.
+
+### 5 — Output the report
+
+Use the two-part shape (see the worked example,
+[`references/example-home.md`](references/example-home.md)):
+
+1. **Patterns in use** — the table from step 2, grouped by pattern family, with a
+ one-line overall read.
+2. **Experience gaps** — ranked list; each item names the finding, the `ux` checklist
+ item (or catalog pattern) it violates, `file:line` evidence, and a one-line remedy.
+3. **Skill feedback** — which findings are real instances of existing checklist items
+ (good worked examples) vs **new generalizable gaps** worth adding to `ux`.
+
+### 6 — Land the findings
+
+Don't let the audit evaporate:
+
+- **Concrete bugs** → fix the top 🔴 in the same or a follow-up branch, or file them.
+- **Generalizable gaps** → add / strengthen a checklist item in the `ux` skill (put the
+ rule + a ✅/❌ example in the right module reference, and mirror a line into the `ux`
+ Quick review checklist). Cite the audited surface as the ❌ example.
+- **The audit** → optionally save it as a `references/example-<page>.md` here so the next
+ run has a template.
+
+## Related skills
+
+- **[ux](../ux/SKILL.md)** — the execution checklists this audit measures against, and
+ where generalizable findings get landed.
+- **review-checklist** — code-level review; this skill is its design-level sibling.
+- **skills-audit** — the same "periodic, evidence-based audit" shape, applied to the skill
+ catalog instead of a UI surface.
diff --git a/.agents/skills/ux-audit/references/example-home.md b/.agents/skills/ux-audit/references/example-home.md
new file mode 100644
index 00000000000..14501cf8c82
--- /dev/null
+++ b/.agents/skills/ux-audit/references/example-home.md
@@ -0,0 +1,74 @@
+# Worked example — Home page (首页) audit
+
+A real run of this skill against the home landing (`src/routes/(main)/home`), 2026-07.
+Use it as a **template for the output shape**, not as current-state truth (the code moves;
+re-verify before citing). Surface = center column (agent greeting → composer → onboarding
+banner → "上新" model chips → "简报" feed) plus the left sidebar (nav / 最近 / 助理).
+
+## 1 — Patterns in use
+
+| Pattern (family) | Where | Rating | Note |
+| ------------------------------------------ | --------------------------------------------------------------------------------------- | ------ | ------------------------------------ |
+| Global Navigation (nav) | left sidebar 搜索 / 首页 / 任务 / 资源 | ✅ | persistent |
+| Clear Entry Points (nav) | central composer as the one main door | ✅ | strong |
+| Center Stage (layout) | greeting + input dominate the center | ✅ | textbook |
+| Titled Sections / Card Stack (layout/data) | 简报 / 最近 / 助理;`BriefCard` list | ✅ | |
+| Accordion (layout) | 最近 / 助理 collapsible, reorderable, persisted | ✅ | |
+| Overview + Detail (data) | card → `TopicChatDrawer`; 最近 → `AllRecentsDrawer` | ✅ | preserves surface contract |
+| News / Activity Stream (data) | 简报 feed, 10s poll | ⚠️ | no Update Indicator / manual refresh |
+| Input Prompt / Hints (input) | daily hint used as placeholder | ⚠️ | dynamic + linkified placeholder |
+| Good / Smart Defaults (input) | default inbox agent & model; **empty send falls back to the day's hint** (`useSend.ts`) | ✅ | highlight |
+| Autocompletion (input) | `@` to assign another agent | ✅ | |
+| Button Groups (action) | 忽略 / 重试,已阅 (`BriefCardActions`) | ✅ | |
+| Smart Menu Items (action) | model switch gated by permission + tooltip (`StarterList`) | ✅ | |
+| Prominent "Done" Button (action) | send button | ✅ | one primary |
+| Skeleton loading (feedback) | every section + `NeuralNetworkLoading` revalidate | ✅ | good coverage |
+| Onboarding promo (growth) | connect-software / bot banners, dismissible + versioned | ⚠️ | randomly rotated (see gap ⑥) |
+| Personable / delight | "开工咯 / 久等了" typewriter greeting | ✅ | |
+
+**Read:** navigation & layout are mature; defaults have real craft. Weakness clusters in
+**Feedback (failure states)** and **Input (draft safety, placeholder)**.
+
+## 2 — Experience gaps (ranked)
+
+**① No error/retry anywhere — ux §4.2** 🔴 The 简报 feed has only `!isInit` skeleton /
+empty / success branches, **no error branch** (`src/features/DailyBrief/index.tsx:32`).
+`isBriefsInit` flips true only on a successful fetch, so a failed request → **permanent
+skeleton**. Same missing failure path in Recents, agent list, `AgentSelect` config, and
+composer send (send errors only hit `console.error`). No Error Boundary on the page.
+
+**② Composer draft not persisted — ux §2.1** 🔴 `inputMessage` lives in the chat store
+(`src/store/chat/store.ts` — `createWithEqualityFn`, **no persist**), so a reload/crash on
+the highest-traffic entry point vaporizes a typed task description.
+
+**③ Empty vs failed ambiguity — ux Read §1.1** 🟠 Empty 简报 silently renders the
+recommendations list or `null` (`DailyBrief/index.tsx:44`); "no todos", "load failed", and
+"logged out" are indistinguishable, and there's no purpose-built empty state.
+
+**④ Send has no in-progress/locked state — ux §3.1** 🟠 Send only disables the button;
+"creating / navigating" has no explicit in-progress feedback, and failure is blank.
+
+**⑤ Feed is an Activity Stream but has no Update Indicator / manual refresh — ux Read
+§1.7** 🟡 10s polling with no "N new" signal, no manual refresh, and undefined behavior
+when a poll lands mid-read.
+
+**⑥ Onboarding banner is randomly rotated — Certainty** 🟡 `InputArea/index.tsx:62` picks
+one undismissed banner at random per mount; the user can't form a stable model or get back
+the one they saw.
+
+**⑦ Dynamic, linkified content in the placeholder — Input Prompt trap** 🟡 The rotating
+daily hint is used as the composer placeholder; `[label](url)` links inside it aren't
+clickable, and a rotating hint "seen once" can't be retrieved.
+
+**⑧ Agent list has no first-run empty state — ux Read §1.1** 🟡 Empty pinned-agents renders
+a bare empty list, no "create your first agent" guidance.
+
+## 3 — Skill feedback
+
+- **Validated existing rules** (good ❌ examples to cite): §4.2 (gap ①, the permanent-
+ skeleton), §2.1 (gap ②), Read §1.1 (gap ③).
+- **Landed as new `ux` items** from this audit: Read **§1.7 Live / polling streams** (gap
+ ⑤), Edit **§2.2 Stable input affordances** (gap ⑦), and a strengthened §4.2 note on the
+ init-flag-gated-on-success failure mode (gap ①).
+- **Noted, not yet landed:** predictable promo slots (gap ⑥) — captured here; promote to a
+ checklist item if a second surface repeats it.
diff --git a/.agents/skills/ux-audit/references/pattern-catalog.md b/.agents/skills/ux-audit/references/pattern-catalog.md
new file mode 100644
index 00000000000..5fb2758833e
--- /dev/null
+++ b/.agents/skills/ux-audit/references/pattern-catalog.md
@@ -0,0 +1,100 @@
+# Pattern Catalog — the _Designing Interfaces_ benchmark
+
+The pattern language from Jenifer Tidwell's **_Designing Interfaces_** (with a few
+common web/app additions), grouped by family. Use it in **step 2** of the audit: walk
+each family and tag which patterns the surface implements — and, just as important, which
+expected ones are **absent**.
+
+This is a **checklist of names to look for**, not a spec. Naming varies across editions
+and libraries; match on intent, not the exact label. A pattern being absent isn't
+automatically a bug — but an absent pattern the surface clearly _wants_ (a data feed with
+no way to see new items; a list with no empty state) is a finding.
+
+> How to use a family: for each pattern, ask "is this here? where? used well?" Record
+> ✅ solid / ⚠️ partial-or-misused / — absent-but-expected.
+
+## Navigation — getting around
+
+- **Clear Entry Points** — a few obvious "start here" doors, not a wall of equal links.
+- **Global Navigation** — a persistent nav to the app's main sections.
+- **Hub & Spoke** — a central hub that spokes out to tasks and returns.
+- **Fat Menus / Sitemap Footer** — dense but organized link sets for deep sections.
+- **Sequence Map / Breadcrumbs** — show where you are in a flow or hierarchy.
+- **Escape Hatch** — an always-available way out of a state / back to safety.
+- **Modal Panel** — a focused sub-task that suspends the background.
+- **Deep-linking** — a URL that restores a specific state.
+
+## Layout — organizing the page
+
+- **Visual Framework** — consistent chrome (header/sidebar/spacing) across pages.
+- **Center Stage** — the most important thing dominates the visual center.
+- **Titled Sections** — labeled, separable content blocks.
+- **Card / Card Stack** — self-contained units in a stack or grid.
+- **Grid of Equals** — peers shown as equally-weighted tiles.
+- **Accordion / Collapsible Panels / Movable Panels** — user-controlled disclosure &
+ arrangement.
+- **Right / Left Alignment** — aligned form fields & labels for scannability.
+- **Responsive Disclosure / Diagonal Balance** — reveal/reflow as space or focus changes.
+
+## Input — forms & getting input
+
+- **Input Prompt / Input Hints** — placeholder / helper text that guides entry.
+ ⚠️ trap: a placeholder must be **static** and hold no clickable/retrievable content.
+- **Good / Smart Defaults** — prefilled sensible values; "empty submit does the obvious
+ thing".
+- **Forgiving / Structured Format** — accept loose input; format-as-you-type.
+- **Autocompletion** — suggest completions (e.g. `@mention`).
+- **Dropdown Chooser / List Builder / Illustrated Choices** — richer selection controls.
+- **Same-Page / Inline Error Messages** — validation shown at the field, not a wipe.
+
+## Commands & actions
+
+- **Prominent "Done" Button** — the primary action is unmistakable (one per surface).
+- **Button Groups** — related actions grouped (e.g. skip / retry).
+- **Smart Menu Items** — items adapt/disable to context, with a reason.
+- **Preview** — see the effect before committing.
+- **Progress Indicator / Cancelability** — long ops show progress and can be stopped.
+- **Multi-Level Undo / Command History** — reversible, inspectable actions.
+- **Action Panel / Overflow Menu** — secondary actions collected without crowding.
+
+## Showing complex data
+
+- **Overview + Detail** — summary list → detail (drawer / page) without losing place.
+- **Cards / Sortable Table / Tree-Table** — structured record display.
+- **News Stream / Activity Stream** — reverse-chronological feed of updates.
+ ⚠️ expects an **Update Indicator** (new-items badge) + manual refresh + no reorder
+ under the user.
+- **Dynamic Queries / Data Brushing / Local Zooming / Datatips** — interactive
+ exploration & inline detail-on-demand.
+- **Data Spotlight** — de-emphasize everything but the relevant records.
+
+## Feedback & system response
+
+- **Loading Indicator / Spinner / Skeleton** — in-flight feedback (LobeHub: skeleton /
+ `NeuralNetworkLoading`, never antd `Spin`).
+- **Progress Indicator** — bounded progress for known-length work.
+- **Update Indicator** — "N new" signal for background changes.
+- **Failure + Retry** — a terminal error state with a way to recover (ux §4.2).
+- **Cancelability / Deferred Choices** — let the user stop or postpone.
+
+## Getting started — onboarding & growth
+
+- **Welcome / Sign-on** — a purposeful first screen.
+- **Guided Tour / Discoverable Detail / Onboarding** — reveal capability progressively.
+- **Empty-state as onboarding** — first-run empty states that teach + offer a CTA
+ (ux Read §1.1).
+ ⚠️ trap: promo / onboarding slots should be **predictable**, not randomly rotated —
+ randomness costs the user a stable mental model (Certainty).
+
+## Visual style & aesthetics
+
+- **Deep Background / Few Hues Many Values / Corner Treatments / Skins & Themes** — the
+ look. Mostly lives in **DESIGN.md** (tokens, theme); note here only when the visual
+ choice hurts a behavior (e.g. a spinner that hides a failure).
+
+---
+
+### Families most often weak in this codebase
+
+From audits so far, the recurring soft spots cluster in **Feedback** (failure/retry
+absent) and **Input** (draft safety, placeholder misuse) — check those families first.
diff --git a/.agents/skills/ux/SKILL.md b/.agents/skills/ux/SKILL.md
new file mode 100644
index 00000000000..0be036a2b5a
--- /dev/null
+++ b/.agents/skills/ux/SKILL.md
@@ -0,0 +1,127 @@
+---
+name: ux
+description: 'LobeHub product design values / principles / checklists. Load this skill whenever the work touches user-interface features or implementation — designing or building any user-facing flow — to get better UX results.'
+user-invocable: false
+---
+
+# UX — Design Values & Execution Checklists
+
+How LobeHub products should feel, and concrete rules to get there. Use this when
+**building or reviewing** any user-facing flow.
+
+This file is the **index**: the design values and interaction principles below are the
+conceptual layer; the execution checklists live in per-module reference files (see
+**Checklist modules**). Each checklist item is tagged with the design value(s) it serves.
+
+## What lives where: DESIGN.md vs this skill
+
+Two documents, two jobs — don't duplicate; cross-reference.
+
+- **[`DESIGN.md`](../../../DESIGN.md)** — the design **system**: what the product looks
+ and sounds like. Themeable tokens (color, typography, elevation, radius), the component
+ inventory, and Voice & Content (wording, tone). Reach for it when you need a token
+ value, a component, or copy tone.
+- **this `ux` skill** — interaction **behavior**: how a flow should behave over time.
+ Empty / loading / error states, lists at scale, selection visibility, pickers, number
+ formatting, draft safety, action flow & momentum, button hierarchy, entity lifecycle,
+ capability guardrails, progressive disclosure.
+
+Rule of thumb: **static look & wording → DESIGN.md; dynamic behavior → this skill.** For
+component/styling choices see **react**; for imperative modal wiring see **modal**.
+
+## Design values
+
+LobeHub follows four product design values — **Natural・Meaningful・Certainty・Growth**.
+Read them before designing:
+**[references/design-values.md](references/design-values.md)** (definitions + conflict
+priority).
+
+## Interaction principles
+
+Use these before the execution checklists when a flow has multiple plausible interaction
+patterns.
+
+### Preserve the surface contract・Meaningful・Natural
+
+Every surface carries a task promise: chat keeps the user in a working conversation, a
+document page supports focused reading / editing, a settings page supports configuration,
+and so on. Default interactions should continue that promise instead of unexpectedly
+moving the user into another mode. Prefer in-context surfaces (portal / panel / drawer)
+for reference and auxiliary work; reserve full-page navigation for committed focus or
+explicit mode switches.
+
+### Consistency is semantic, not mechanical・Certainty・Meaningful
+
+Consistency means the same user intent behaves the same way in the same surface. It does
+not mean the same component must do the same thing everywhere. When a component is reused
+across surfaces, let the parent surface provide the interaction strategy so behavior
+follows intent rather than implementation convenience.
+
+### Layout communicates role・Natural・Certainty
+
+Element placement is part of the interface language. Identity and location (breadcrumbs,
+titles, object labels) should read separately from state and actions (save status,
+sharing, panel toggles, overflow menus). When these roles are mixed, users have to infer
+whether an element describes the current object or acts on it.
+
+## Checklist modules
+
+Grouped by **interaction type** — the kind of thing the user is doing. Jump to the module
+matching the surface you're building; a surface often spans several (an editable list is
+Read + Edit + Act) — walk each that applies.
+
+- **[Read](references/read.md)** — viewing data & lists: empty / loading / error states,
+ lists at scale, selection visibility, picker completeness, number formatting, default
+ view.
+- **[Edit](references/edit.md)** — entering & changing content: protect in-progress
+ drafts, never lose input.
+- **[Act](references/act.md)** — operations, flows & buttons: forward momentum, one
+ primary button, entity lifecycle completeness.
+- **[Feedback](references/feedback.md)** — loading visuals & capability guardrails.
+- **[Grow](references/grow.md)** — discoverability & progressive disclosure.
+
+## Quick review checklist
+
+The one-screen scan. Each line links back to a module above for the full rule + examples.
+
+**Read — viewing data & lists** ([read.md](references/read.md))
+
+- [ ] Empty / loading / error states are all designed; empty is a real page with a CTA. Always-rendered chrome (toolbar/header) still gets a body empty state.
+- [ ] List designed across 1 → 10k rows (virtual scroll / pagination / batch as needed).
+- [ ] Capped/scrollable/virtualized list scrolls the restored active item into view on mount (`block: 'nearest'`, re-run after async rows mount).
+- [ ] Pickers show all valid targets (default/inbox included); empty = truly none.
+- [ ] Large numbers roll the unit at each 1000× (K→M→B→T), never a coefficient ≥ 1000; use the shared `formatUsageValue` / `formatShortenNumber`.
+- [ ] Multi-tab/view surface lands on the tab the entry intent implies (and falls back to a populated view, decided from resolved state); a manual pick sticks.
+- [ ] Live/polling feed signals new items + offers manual refresh, doesn't reorder under the user, and shows a failed refresh distinctly (not as empty).
+
+**Edit — entering & changing content** ([edit.md](references/edit.md))
+
+- [ ] Editors back up in-progress input to durable storage (survives reload, not in-memory only) and recover it after refresh/crash/failed-save; destructive exits warn, never silently discard.
+- [ ] Input affordances are stable: static placeholder, no clickable/retrievable content hidden in it.
+
+**Act — operations, flows & buttons** ([act.md](references/act.md))
+
+- [ ] Action leads the user forward; success offers a primary "go to result".
+- [ ] Bulk action has a single-item entry (and vice versa).
+- [ ] Async/bulk/irreversible action: confirm → in-progress (locked) → done/error.
+- [ ] Scrollable content + actions/status → pin them in a fixed footer/header, not inside the scroll area (verify at the overflowing state).
+- [ ] Exactly one primary button per surface.
+- [ ] Listed entities have their full lifecycle (not display-only); ops match source (built-in / installed / custom).
+
+**Feedback — loading & system response** ([feedback.md](references/feedback.md))
+
+- [ ] No antd `Spin`; use `NeuralNetworkLoading` / project loaders.
+- [ ] Every loading state can fail: on error or timeout, show a failed state with a Reload/Retry action — never an infinite spinner.
+- [ ] Capability-gated feature warns (soft, reactive, load-gated) when the model can't deliver it; copy gives the remedy.
+
+**Grow — discoverability & progressive disclosure** ([grow.md](references/grow.md))
+
+- [ ] Advanced capability is progressively disclosed / discoverable at the moment of need.
+
+## Related skills
+
+- **ux-audit** — a repeatable, _Designing Interfaces_-benchmarked audit of one surface; run
+ it to find gaps and land them back into these checklists.
+- **modal** — imperative `createModal` state-machine wiring for confirm/progress/done.
+- **DESIGN.md** (Voice & Content) — wording for confirm / done / empty / error states.
+- **react** — component priority, `Button` usage, styling.
diff --git a/.agents/skills/ux/references/act.md b/.agents/skills/ux/references/act.md
new file mode 100644
index 00000000000..ed06a79370e
--- /dev/null
+++ b/.agents/skills/ux/references/act.md
@@ -0,0 +1,86 @@
+# Act — operations, flows & buttons
+
+Any surface where the user **performs an action** — a single op, a bulk op, or a
+multi-step flow. Covers momentum, focus, and full entity lifecycle.
+
+Part of the **ux** skill — see [`../SKILL.md`](../SKILL.md). Each checklist item is
+tagged with the design value(s) it serves.
+
+## 3.1 Flow & momentum・Natural・Meaningful
+
+Every action chain must **push the user forward**, never dead-end or block the flow.
+After any operation, lead the user to the next step instead of just stopping. A success
+state makes the strong button the forward action ("go to result") and the weak /
+secondary button "dismiss" / "Done". Keep bulk ⇄ single-item parity — an action on a
+multi-select toolbar must also be reachable on a single item (its context menu), and
+vice versa. Bulk / irreversible / async ops run as a modal state machine in one surface:
+a confirm step stating exactly what happens → an in-progress view with **dismissal
+locked** → a done (or error) view in the same modal. Never fire-and-forget with only a
+toast; never leave a dead spinner.
+
+> ✅ After moving topics: primary = "Go to «target»", secondary = "Done".
+
+**Checklist**
+
+- [ ] Action leads forward; doesn't just stop. _(Meaningful)_
+- [ ] Success = primary "go to result", secondary "Done". _(Meaningful・Natural)_
+- [ ] Bulk ⇄ single-item parity (toolbar action also on the item, and vice versa). _(Certainty)_
+- [ ] Bulk / irreversible / async: confirm → in-progress (locked) → done/error, one surface. _(Certainty・Meaningful)_
+
+## 3.2 One primary button per surface・Certainty
+
+The single primary CTA tells the user the core action; everything else is secondary /
+tertiary. Never a pile of primary buttons competing for attention.
+
+**Checklist**
+
+- [ ] Exactly one primary button per surface. _(Certainty)_
+
+## 3.3 Pin actions & status outside the scroll region・Certainty・Meaningful
+
+When a surface pairs a **scrollable content area** with action controls (submit / skip /
+confirm) or live status (a countdown, save state, error), those controls must live in a
+**fixed header / footer outside the scroll region** — never inside the scrolling content
+where they slide away. A submit button that scrolls off reads as "there's no way to
+proceed"; a countdown that scrolls off hides the deadline the user is racing. Scroll the
+content; pin the actions. This is an easy trap because it **only shows up once the content
+is tall enough to scroll** — short demo data keeps the footer on-screen and hides the bug.
+
+Concretely: give the surface a fixed footer slot and render the action row into it (e.g.
+portal the buttons into the card's footer), so loading a taller body scrolls only the body.
+When the same component is embedded in a host that provides **no** fixed footer slot,
+render the actions inline as a fallback — pin only when a slot exists.
+
+> ✅ The global approval card pins the ask-user **skip / submit + countdown** in a bordered
+> footer; only the question and its options scroll. ❌ The footer living inside the
+> `overflow-y: auto` body, so a long option list scrolls the submit button out of view.
+
+**Checklist**
+
+- [ ] Scrollable content + actions/status → actions & status pinned in a fixed header/footer, not inside the scroll area. _(Certainty)_
+- [ ] Verified at the tall/overflowing state, not just short demo data. _(Certainty)_
+- [ ] Portal into the host's fixed slot when present; fall back to inline when the host has none. _(Meaningful)_
+
+## 3.4 Entity lifecycle completeness・Meaningful・Certainty
+
+The recurring trap: a feature ships only the **display** of a list, but edit / delete /
+management are never built — so the user can add something and then be stuck with it. For
+every entity a user can see, design its **full lifecycle**: create / read / update /
+delete, plus state transitions (enable/disable, connect/disconnect, install/uninstall).
+The allowed operation set depends on the entity's source / ownership — decide it
+explicitly _before_ building. Each item should expose its allowed ops (hover action /
+context menu / detail page) with a clear entry point to add/create; an intentionally-
+absent op is a documented decision, not an oversight.
+
+| Entity class | Add | Edit | Remove |
+| ----------------------------------- | ------- | --------- | ------------------ |
+| Official / built-in (skills, tools) | — | — | ✗ not removable |
+| Community (installed MCP) | install | configure | uninstall / remove |
+| User-custom (custom connector) | create | edit | delete |
+
+**Checklist**
+
+- [ ] No display-only features: every listed entity has the CRUD / lifecycle ops that apply. _(Meaningful)_
+- [ ] Op set matches source: built-in read-only; installed removable; user-created editable + deletable. _(Certainty)_
+- [ ] Each item exposes its allowed ops + a clear add/create entry point. _(Natural)_
+- [ ] An intentionally-absent op is documented by design, not an oversight. _(Certainty)_
diff --git a/.agents/skills/ux/references/design-values.md b/.agents/skills/ux/references/design-values.md
new file mode 100644
index 00000000000..33452a9df8c
--- /dev/null
+++ b/.agents/skills/ux/references/design-values.md
@@ -0,0 +1,51 @@
+# LobeHub Design Values (设计价值观)
+
+The philosophy behind every LobeHub interface. Read this before designing or
+reviewing a flow; the per-aspect execution rules live in the parent
+[SKILL.md](../SKILL.md) and each checklist item is tagged with the value(s) it serves.
+
+Adapted from Ant Design's design values
+(<https://ant.design/docs/spec/values-cn>, <https://zhuanlan.zhihu.com/p/44809866>).
+LobeHub adopts all four.
+
+## 自然 (Natural)
+
+Minimise cognitive load. Digital products keep getting more complex while human
+attention stays scarce — so the interface should feel as effortless as the
+physical world. The next step should be obvious without thinking; the product
+proactively carries the user forward (sensible defaults, AI-assisted decisions,
+smooth transitions) rather than making them stop and figure things out.
+
+## 意义感 (Meaningful)
+
+Every screen is rooted in the user's real goal, not an isolated feature. Make the
+objective clear, give immediate feedback on the result of each action, and always
+point at the next meaningful step. Calibrate difficulty — neither a patronising
+over-simplification nor an overwhelming wall — so the user keeps a sense of
+progress and accomplishment.
+
+## 确定性 (Certainty)
+
+Low-entropy, predictable interactions. Reuse the same patterns, components, and
+wording so behaviour is never surprising. Keep a single clear focus per surface,
+and design **every** state (empty / loading / error / success) so nothing is left
+undefined. Restraint over cleverness: fewer, consistent rules beat many bespoke
+ones.
+
+## 生长性 (Growth)
+
+The product grows together with the user. As needs deepen and roles evolve,
+surface advanced capabilities progressively and make related features
+discoverable at the moment they become relevant — without crowding the novice
+path. Bridge product value to the user's changing scenarios and aim for
+human–machine symbiosis (人机共生): the user and the agent co-evolve, each making
+the other more capable over time.
+
+## Priority when values conflict
+
+For moment-to-moment interaction decisions: **意义感 ≳ 自然 > 确定性** — never
+sacrifice the user's goal or forward momentum just to keep things uniform.
+
+**生长性 (Growth)** is a longer-horizon lens: weigh it when shaping how a feature
+is discovered and how it scales with the user, not when resolving a single-screen
+layout trade-off.
diff --git a/.agents/skills/ux/references/edit.md b/.agents/skills/ux/references/edit.md
new file mode 100644
index 00000000000..ea2ea71a59e
--- /dev/null
+++ b/.agents/skills/ux/references/edit.md
@@ -0,0 +1,53 @@
+# Edit — entering & changing content
+
+Any surface where the user **types or edits**. Input is expensive effort; the
+overriding rule is **never lose it**.
+
+Part of the **ux** skill — see [`../SKILL.md`](../SKILL.md). Each checklist item is
+tagged with the design value(s) it serves.
+
+## 2.1 Protect in-progress edits・Certainty・Meaningful
+
+Typed / edited content is real user effort; losing it is one of the most infuriating
+outcomes a product can produce. Whenever an editor holds unsaved input, assume the exit
+can be **accidental** — a misclick, refresh, crash, navigation, or failed save — and
+build a safety net. Back the draft up locally as the user types (localStorage /
+IndexedDB / store) so nothing vaporizes it, and auto-restore (or offer to restore) it on
+return rather than showing a blank field. Guard destructive exits: closing, navigating,
+or switching items away from a dirty editor warns or auto-saves, never silently discards.
+Survive a failed save by keeping the content in the field for retry. Scope the draft to
+its target (per topic / message / item id) so drafts don't bleed across entities or
+resurrect on the wrong item. "Backed up locally" means it survives a **reload** — an
+in-memory store alone doesn't count.
+
+> ❌ The home composer holds its input in an in-memory store (no `persist`), so a reload on
+> the app's highest-traffic entry point vaporizes a typed task description.
+
+**Checklist**
+
+- [ ] Draft backed up to durable storage as the user types (localStorage / IndexedDB), surviving a reload — not an in-memory store only. _(Certainty)_
+- [ ] Unsaved draft auto-restored (or offered) on return, not a blank field. _(Meaningful)_
+- [ ] Destructive exits (close / navigate / switch) warn or auto-save. _(Certainty)_
+- [ ] Failed save keeps the content for retry, never clears it. _(Meaningful)_
+- [ ] Draft scoped to its target id so it doesn't bleed across entities. _(Certainty)_
+
+## 2.2 Input affordances stay stable & retrievable・Certainty・Natural
+
+The controls _around_ input — placeholder, hints, helper text — are read once and relied
+on. Keep them **stable**: a placeholder that rotates on a timer, or that carries content
+the user might want back, fails them, because a placeholder is ephemeral (it vanishes the
+moment they type) and inert (its text isn't selectable or clickable). Anything the user
+might **act on or return to** — a link, an example they want to copy, a tip that matters —
+belongs in persistent chrome (helper text below the field, a hint row, a popover), not
+smuggled into the placeholder. Rotating "delight" copy in a placeholder is a double miss:
+seen-once-can't-retrieve, and any `[label](url)` in it isn't clickable.
+
+> ❌ The home composer pipes a rotating, markdown-linked daily hint into the placeholder —
+> the links aren't clickable and a hint the user glimpsed can't be brought back. ✅ Keep a
+> stable placeholder; surface the rotating hint as a dismissible row / affordance beside
+> the input where its links work.
+
+**Checklist**
+
+- [ ] Placeholder is static — not rotating/animated content the user can't retrieve. _(Certainty)_
+- [ ] No clickable / copy-worthy content hidden in a placeholder; it lives in persistent chrome. _(Meaningful)_
diff --git a/.agents/skills/ux/references/feedback.md b/.agents/skills/ux/references/feedback.md
new file mode 100644
index 00000000000..487edfc98d4
--- /dev/null
+++ b/.agents/skills/ux/references/feedback.md
@@ -0,0 +1,91 @@
+# Feedback — loading & system response
+
+How the product **answers back** while and after the user acts — loading visuals and
+proactive guardrails.
+
+Part of the **ux** skill — see [`../SKILL.md`](../SKILL.md). Each checklist item is
+tagged with the design value(s) it serves.
+
+## 4.1 Loading visuals・Natural
+
+**Never use antd `Spin`** — it doesn't match the product's loading visual. Use a project
+loader:
+
+| Need | Component |
+| --------------------------- | ----------------------------------------------------------------------------- |
+| Default loading (in-flight) | `NeuralNetworkLoading` from `@/components/NeuralNetworkLoading` (`size` prop) |
+| Inline dots | `DotsLoading` / `BubblesLoading` from `@/components` |
+| Branded full-page | `Loading` from `@/components/Loading/BrandTextLoading` |
+| List / card placeholder | a skeleton (e.g. `SkeletonList`) |
+
+When in doubt, reach for `NeuralNetworkLoading` — the default in-flight indicator (e.g.
+modal "in progress" states). Minimise layout shift (CLS): the strongest loading state
+changes as little of the final layout as possible. When a surface already knows its shape
+(card, row, list item), keep the layout elements — container, border, radius, padding,
+icon — and replace only the text/data with a skeleton sized like the text it stands in
+for. A generic full-block / full-card skeleton (or a centred spinner the real content
+later pushes aside) is heavier and shifts the layout; an in-place text→skeleton swap is
+optimal.
+
+**Checklist**
+
+- [ ] No antd `Spin`; use `NeuralNetworkLoading` / project loaders. _(Natural)_
+- [ ] Skeleton reuses the loaded component's chrome — content swap, not relayout. _(Certainty・Natural)_
+- [ ] Skeleton lines sized like the text they replace (height ≈ real). _(Certainty)_
+- [ ] Known-shape surface not downgraded to a bare block / spinner. _(Natural)_
+
+## 4.2 Loading must be able to fail — timeout → error + retry・Certainty・Meaningful
+
+A loading state that can only ever resolve to _success_ is a bug. Any async fetch can hang,
+time out, or error, so every loading state needs a **terminal failure path**: after a
+bounded wait (or on an error) the spinner / skeleton must give way to an explicit **failed**
+state that says it didn't load and offers a **Reload / Retry** button. An indefinite spinner
+is indistinguishable from a dead one — the user is stuck with no recourse but to reload the
+whole app, and can't even tell whether anything is still happening. A failed-with-retry
+state hands control back and restores certainty. Retry re-runs the _same_ fetch (SWR
+`mutate` / query refetch), shows loading again while it re-runs, and stays available if it
+fails again; keep any already-loaded context rather than blowing the surface away.
+
+> **We under-build this today** — most surfaces only draw loading + success and let a slow
+> or failed request spin forever. Treat the failure path as required, not optional: it's a
+> large part of what makes the experience feel trustworthy.
+
+A common shape of this bug: the surface gates its "ready" render on an **init flag that is
+set only on a successful fetch** (`if (!isInit) return <Skeleton/>`). On error the flag
+never flips, so the skeleton is **permanent** — an infinite spinner wearing a skeleton's
+clothes. The error path must drive the flag / a separate `error` state, not be forgotten.
+
+> ✅ A panel whose data request errors or exceeds its timeout shows "加载失败" with a
+> **Reload** button that refetches. ❌ A `NeuralNetworkLoading` that spins indefinitely when
+> the request hangs. ❌ `isInit` set only in the success handler, so a failed fetch leaves
+> the skeleton up forever. _(pairs with Read §1.1 error state, §4.1 loading visuals.)_
+
+**Checklist**
+
+- [ ] Every loading state has a terminal failure path — on error or after a bounded timeout, not an infinite spinner. _(Certainty)_
+- [ ] An init/ready flag isn't gated on success only — the error path resolves the loading state too, no permanent skeleton. _(Certainty)_
+- [ ] The failed state names the failure and offers a **Reload / Retry** action. _(Meaningful)_
+- [ ] Retry re-runs the same fetch, shows loading while re-running, and stays available on repeat failure. _(Certainty)_
+- [ ] Already-loaded context is preserved on failure — don't wipe the surface. _(Meaningful)_
+
+## 4.3 Capability-gated features・Certainty・Meaningful
+
+A feature can be fully built and still produce a broken result when the selected model —
+or its still-loading config — **can't deliver the capability the feature depends on**
+(e.g. an agentic run on a model without tool calling). This is usually the user's
+configuration choice, not a defect; but if the product stays silent the user reads it as
+broken. Owe a **proactive, non-blocking reminder** — a guardrail, not a gate: a soft
+inline warning at the point of action, never a hard block or a modal that stops the user.
+Stay reactive — the reminder clears the moment the user switches to a capable model
+(derive from live state, not a one-shot check). Don't warn while config is still loading
+(an unresolved capability looks "unsupported" — a false alarm); warn only on a _resolved_
+unsupported state. Scope to the mode that needs it — one reminder per root cause — and
+state both the problem and the remedy.
+
+**Checklist**
+
+- [ ] Missing capability shows a soft inline warning, never a hard block. _(Meaningful)_
+- [ ] Reminder is reactive — clears when a capable model is selected. _(Natural)_
+- [ ] No warning while config is still loading; only on resolved-unsupported. _(Certainty)_
+- [ ] Scoped to the dependent mode; one reminder per root cause. _(Natural・Certainty)_
+- [ ] Copy states the problem and the remedy. _(Meaningful)_
diff --git a/.agents/skills/ux/references/grow.md b/.agents/skills/ux/references/grow.md
new file mode 100644
index 00000000000..2707bdc8179
--- /dev/null
+++ b/.agents/skills/ux/references/grow.md
@@ -0,0 +1,19 @@
+# Grow — discoverability & progressive disclosure
+
+How the product **deepens** as the user's needs deepen.
+
+Part of the **ux** skill — see [`../SKILL.md`](../SKILL.md). Each checklist item is
+tagged with the design value(s) it serves.
+
+## 5.1 Progressive disclosure・Growth
+
+The product should grow with the user — deeper power shows up as needs deepen. Keep the
+novice path clean and reveal advanced capabilities as the user gets there, don't dump
+everything at once. Surface related actions at the moment of need — make the next
+capability discoverable in context (e.g. after the first item exists, offer what to do
+with it), not buried in a far-off menu.
+
+**Checklist**
+
+- [ ] Advanced capability progressively disclosed; novice path stays clean. _(Growth・Natural)_
+- [ ] Next action surfaced in context at the moment of need. _(Growth・Meaningful)_
diff --git a/.agents/skills/ux/references/read.md b/.agents/skills/ux/references/read.md
new file mode 100644
index 00000000000..a65cf1f7edb
--- /dev/null
+++ b/.agents/skills/ux/references/read.md
@@ -0,0 +1,153 @@
+# Read — viewing data & lists
+
+Any surface that **displays** records, lists, or detail. Covers the states a data
+view can be in, behavior at scale, keeping the user's place visible, picker
+completeness, number formatting, and landing on the right view.
+
+Part of the **ux** skill — see [`../SKILL.md`](../SKILL.md) for the design values,
+interaction principles, and the DESIGN.md boundary. Each checklist item is tagged
+with the design value(s) it serves.
+
+## 1.1 Data states: empty / loading / error・Meaningful・Certainty
+
+Every data surface has **four** states — design all of them, not just "has data".
+Empty is a purpose-built page that explains what this is, why it's empty, and gives a
+clear next action (CTA + value props); distinguish "no data yet" (onboarding CTA) from
+"no match for filters" (clear-filters affordance) — they are different screens. When a
+surface keeps its toolbar/header mounted with no data (so a create / `+` affordance
+stays reachable), the **body** below must still render an empty placeholder —
+persistent chrome is no excuse for dead space. Loading uses a skeleton /
+`NeuralNetworkLoading`, never a flash of blank or a layout shift; error surfaces the
+reason and a retry/back path.
+
+> ✅ An empty "Connect your first device" page with primary/secondary connect paths and "what you can do once connected" cards.
+> ✅ The agent **Documents** tab keeps its new-folder / new-doc toolbar and renders an `Empty` below it when there are no documents.
+> ❌ A bare title over skeleton rows, or a toolbar over dead space.
+
+**Checklist**
+
+- [ ] Empty state is a real page with explanation + CTA, not a blank screen. _(Meaningful)_
+- [ ] Empty variants distinguished: "no data yet" vs "no filter match". _(Certainty)_
+- [ ] Always-rendered chrome still renders a body empty placeholder. _(Meaningful)_
+- [ ] Loading designed (skeleton / NeuralNetworkLoading), no layout shift. _(Natural)_
+- [ ] Error designed with reason + retry/back path. _(Meaningful)_
+
+## 1.2 Lists at scale・Certainty・Natural
+
+A list/data page must be designed for its **whole range of sizes**, not just the demo
+data. Walk the scale — 1 / 2 / 5 / 20 / 100 / 1k–10k rows — and pick the right
+mechanism per range: plain render → load-more / pagination → virtual scroll, adding
+batch-select / bulk actions once counts get large. Co-design the empty / loading /
+error states (§1.1) alongside: a list isn't done until all four render well.
+
+**Checklist**
+
+- [ ] List designed across 1 → 10k rows (plain → pagination → virtual scroll). _(Certainty)_
+- [ ] Batch-select / bulk actions added once counts get large. _(Certainty)_
+- [ ] Empty / loading / error co-designed with the data state (§1.1). _(Natural)_
+
+## 1.3 Selection visibility in scrolled lists・Certainty・Natural
+
+A capped / scrollable / virtualized list mounts at `scrollTop = 0`. If the active item
+sits below the fold, the user lands on a valid selection that is **off-screen** and
+reads it as "nothing selected" or a broken page. Any list that can open with a
+pre-selected item must **scroll that item into view** — hardest when the selection has
+no other anchor (no highlighted parent row, breadcrumb, or header echo), because then
+an off-screen active row means **zero** visible feedback. Scroll only when the row is
+actually off-screen (`block: 'nearest'`) so an already-visible selection doesn't jump,
+and re-run once async rows mount (key off a list-ready signal like row count, not just
+the id) so a restored selection still lands when data arrives. Mirror the behavior
+across duplicated list variants so it can't regress in just one.
+
+> ✅ The nested thread list is capped to \~9 rows; a thread restored from `?thread=` below the fold is scrolled into view on mount.
+
+**Checklist**
+
+- [ ] Restored / deep-linked active item is scrolled into view on mount. _(Certainty)_
+- [ ] Designed for the no-anchor case (parent not highlighted → off-screen = zero feedback). _(Meaningful)_
+- [ ] Uses `block: 'nearest'` — an already-visible selection doesn't jump. _(Natural)_
+- [ ] Scroll re-runs once async rows mount (keyed off row count). _(Certainty)_
+- [ ] Mirrored across duplicated list variants (parallel agent / group lists). _(Certainty)_
+
+## 1.4 Option visibility in pickers・Certainty・Meaningful
+
+Pickers must list every valid target. Watch for options dropped by backend list queries
+(pagination, `virtual` flags, scope filters) and add them back. An empty picker must
+mean "genuinely none", never "we filtered out the only option".
+
+> ✅ The default "LobeAI" (inbox) agent is `virtual` and excluded from the sidebar list, so the move picker re-adds it.
+
+**Checklist**
+
+- [ ] Picker lists every valid target; backend-dropped options (virtual / scope / pagination) re-added. _(Meaningful)_
+- [ ] Empty picker = truly none, not filtered-out. _(Certainty)_
+
+## 1.5 Abbreviate large numbers, roll the unit over・Natural・Certainty
+
+Big counts (tokens, requests, sizes) are for **scanning**, not accounting. Show a
+compact abbreviated value and advance the unit at every 1000× boundary — never let a
+magnitude pile up inside a smaller unit. `10285.7M` is a bug: past 1000M it should read
+`10.3B`; a coefficient that keeps growing digits (`9092.9M`, `10285.7M`) forces the
+reader to count zeros and defeats the point of abbreviating. Keep precision compact —
+one decimal, drop a trailing `.0` (`1M` not `1.0M`; `9.1B` not `9.09B`) — and put full
+precision in a tooltip / detail row. Use the shared helpers rather than re-rolling:
+token/usage counts through `formatUsageValue` (`@lobechat/utils`), general shortenings
+through `formatShortenNumber`; both already carry the K/M/B/T ladder.
+
+> ✅ `10.3B` ❌ `10285.7M`
+> ❌ an ad-hoc `(n / 1_000_000).toFixed(1) + 'M'` that stops at M.
+
+**Checklist**
+
+- [ ] Unit rolls at each 1000× (K→M→B→T); displayed coefficient never ≥ 1000. _(Certainty)_
+- [ ] Compact precision: one decimal, trailing `.0` dropped. _(Natural)_
+- [ ] Uses shared `formatUsageValue` / `formatShortenNumber`, not an ad-hoc M-capped roll. _(Certainty)_
+
+## 1.6 Default view reflects entry intent & data state・Certainty・Meaningful
+
+A surface with multiple tabs / views / panels has a **landing** selection. Don't
+hardcode it to "the first tab" — derive it from (a) how the user got here (the intent
+their navigation carried) and (b) which views actually have data. A static default that
+lands the user on an empty tab while a sibling holds exactly what they came for reads as
+broken. Open on the tab the entry implies (clicked a Skill / file / typed record → the
+view that shows it), and fall back to a populated view when the default would be empty.
+Decide from resolved state, not mid-load — choosing off an empty in-flight list flips
+the tab as data arrives, so hold the static default while loading and switch on
+resolved-empty. Once the user manually picks a tab, that choice wins and sticks — track
+"user-picked" separately (e.g. a nullable `pickedTab`) so later data changes don't yank
+them off it. Pairs with §1.1: the empty state is the fallback _within_ a view; this rule
+is about not landing on that empty view when a better one exists.
+
+> ✅ Opening a document page by clicking a **skill** lands the right panel on the **Skills** tab; a plain document lands on **Documents**.
+> ✅ An agent with only skills (no documents) opens the panel on **Skills** instead of an empty **Documents** tab.
+
+**Checklist**
+
+- [ ] Lands on the tab the entry intent implies, not a static first tab. _(Meaningful)_
+- [ ] Falls back to a populated view when the default would be empty. _(Certainty)_
+- [ ] Default decided from resolved state, not mid-load. _(Certainty)_
+- [ ] A manual pick is tracked separately and sticks. _(Natural)_
+
+## 1.7 Live / polling streams・Certainty・Natural
+
+A feed that **refreshes on a timer** (polling / subscription — a notification list, a task
+brief, an activity stream) is a _News Stream_ pattern, and it owes the user control over
+the churn. Silent background updates that reorder rows, or that quietly replace what the
+user is reading, break their place and their trust. Three things every live stream needs:
+a way to **know** something changed (an unobtrusive "N new" indicator, not a silent swap),
+a way to **pull** on demand (a manual refresh, so the user isn't hostage to the interval),
+and a promise **not to yank the ground** — don't reorder or drop the row under an active
+read/interaction; stage new items and let the user choose to merge them. And a refresh
+that _fails_ must not masquerade as "nothing new" — distinguish "failed to refresh" from
+"no updates" (pairs with §1.1 and Feedback §4.2).
+
+> ✅ A feed shows a "3 new" pill the user taps to bring new items in; a manual refresh
+> control sits in the header. ❌ A 10s poll silently reshuffles the list mid-read, and a
+> failed poll looks identical to an empty feed.
+
+**Checklist**
+
+- [ ] New background items are signaled (indicator / "N new"), not silently swapped in. _(Meaningful)_
+- [ ] Manual refresh available — the user isn't hostage to the poll interval. _(Certainty)_
+- [ ] Active read/interaction isn't reordered or dropped under the user; new items are staged. _(Natural)_
+- [ ] A failed refresh is distinct from "no new items", never shown as empty. _(Certainty)_
diff --git a/DESIGN.md b/DESIGN.md
index 9cf90f97e08..5ce9f4b0c60 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -95,6 +95,8 @@ Two things make this system different from a fixed palette, and both matter when
The YAML above lists the default **Light** theme. The Dark theme redefines the same token names with different values and lives in **[DESIGN.dark.md](./DESIGN.dark.md)** — every other section here (typography, layout, motion, shapes, components, voice, values) is theme-independent and applies to both. Build against token names, not values.
+> **Scope — this file is the design _system_, not the interaction playbook.** DESIGN.md covers what the product looks and sounds like: tokens (color, typography, elevation, radius), the component inventory, and Voice & Content. It deliberately does **not** cover how a flow should behave over time. For any **interaction detail** — empty / loading / error states, lists at scale, selection & scroll restoration, pickers, number formatting, draft safety, action momentum & confirm flows, button hierarchy, entity lifecycle, capability guardrails, progressive disclosure — consult the **ux** skill (`.agents/skills/ux/`). Rule of thumb: **static look & wording → here; dynamic behavior → the ux skill.**
+
## Design Values
The philosophy behind every LobeHub interface. Read these before designing a flow.
diff --git a/apps/server/src/services/toolExecution/__tests__/builtin.test.ts b/apps/server/src/services/toolExecution/__tests__/builtin.test.ts
index 8a313deef44..76ab615b4d3 100644
--- a/apps/server/src/services/toolExecution/__tests__/builtin.test.ts
+++ b/apps/server/src/services/toolExecution/__tests__/builtin.test.ts
@@ -18,6 +18,18 @@ vi.mock('@/server/services/market', () => ({
MarketService: vi.fn().mockImplementation(() => ({})),
}));
+// The runtime mock above only exposes `createDocument`, but the manifest is the
+// authoritative source of declared APIs — it also lists `listDocuments`, so an
+// UNKNOWN_API hint sourced from the manifest must surface both.
+vi.mock('@lobechat/builtin-tools', () => ({
+ builtinTools: [
+ {
+ identifier: 'lobe-notebook',
+ manifest: { api: [{ name: 'createDocument' }, { name: 'listDocuments' }] },
+ },
+ ],
+}));
+
const buildPayload = (argsStr: string): ChatToolPayload => ({
apiName: 'createDocument',
arguments: argsStr,
@@ -126,4 +138,44 @@ describe('BuiltinToolsExecutor truncated arguments', () => {
expect(mockApiHandler).toHaveBeenCalledWith({}, context);
expect(result.success).toBe(true);
});
+
+ it('returns a recoverable UNKNOWN_API error for a hallucinated apiName', async () => {
+ // The runtime mock only exposes `createDocument`; calling a non-existent
+ // API (e.g. a model hallucinating `viewTopic`) must NOT throw a hard error
+ // — it should return a structured result that lists the real APIs so the
+ // model can self-correct.
+ const result = await executor.execute({ ...buildPayload('{}'), apiName: 'viewTopic' }, context);
+
+ expect(result.success).toBe(false);
+ expect(result.error?.code).toBe('UNKNOWN_API');
+ expect(result.content).toContain('viewTopic');
+ // The available APIs are surfaced to guide the model.
+ expect(result.content).toContain('createDocument');
+ // Sourced from the manifest, not the runtime instance: `listDocuments` is
+ // declared in the manifest yet absent from the mocked runtime's own keys,
+ // so its presence proves the hint reads the manifest.
+ expect(result.content).toContain('listDocuments');
+ expect(mockApiHandler).not.toHaveBeenCalled();
+ });
+
+ it('lists prototype-method APIs via the fallback when no manifest is available', async () => {
+ // A runtime whose APIs are class prototype methods (the common case).
+ // `Object.keys(runtime)` would miss these, collapsing the hint to an empty
+ // list; the prototype-chain fallback must surface them.
+ class FooRuntime {
+ async barApi() {
+ return { content: 'ok', success: true };
+ }
+ }
+ const { getServerRuntime } = await import('../serverRuntimes');
+ vi.mocked(getServerRuntime).mockResolvedValueOnce(new FooRuntime() as any);
+
+ const result = await executor.execute(
+ { ...buildPayload('{}'), apiName: 'hallucinated', identifier: 'lobe-unknown-tool' },
+ context,
+ );
+
+ expect(result.error?.code).toBe('UNKNOWN_API');
+ expect(result.content).toContain('barApi');
+ });
});
diff --git a/apps/server/src/services/toolExecution/builtin.ts b/apps/server/src/services/toolExecution/builtin.ts
index b51bbac56d4..1b229112cb0 100644
--- a/apps/server/src/services/toolExecution/builtin.ts
+++ b/apps/server/src/services/toolExecution/builtin.ts
@@ -1,3 +1,4 @@
+import { builtinTools } from '@lobechat/builtin-tools';
import { type LobeChatDatabase } from '@lobechat/database';
import { type ChatToolPayload } from '@lobechat/types';
import { detectTruncatedJSON, safeParseJSON } from '@lobechat/utils';
@@ -11,6 +12,37 @@ import { type IToolExecutor, type ToolExecutionContext, type ToolExecutionResult
const log = debug('lobe-server:builtin-tools-executor');
+/**
+ * Declared API names for a builtin tool, read from its manifest — the
+ * authoritative source. Runtime instances declare their APIs as prototype
+ * methods (`async sendMessage() {}`), which `Object.keys` cannot see, so the
+ * manifest, not the instance, is the correct source for a recovery hint.
+ */
+const getManifestApiNames = (identifier: string): string[] =>
+ (builtinTools.find((tool) => tool.identifier === identifier)?.manifest?.api ?? []).map(
+ (api) => api.name,
+ );
+
+/**
+ * Fallback when a manifest isn't available (e.g. a runtime registered without a
+ * matching manifest entry): collect callable names across the whole prototype
+ * chain — both own arrow-field methods and class prototype methods — which
+ * `Object.keys` alone would miss.
+ */
+const collectRuntimeApiNames = (runtime: Record<string, any>): string[] => {
+ const names = new Set<string>();
+ for (
+ let cur: object | null = runtime;
+ cur && cur !== Object.prototype;
+ cur = Object.getPrototypeOf(cur)
+ ) {
+ for (const key of Object.getOwnPropertyNames(cur)) {
+ if (key !== 'constructor' && typeof runtime[key] === 'function') names.add(key);
+ }
+ }
+ return [...names];
+};
+
export class BuiltinToolsExecutor implements IToolExecutor {
private marketService: MarketService;
private composioService: ComposioService;
@@ -95,8 +127,31 @@ export class BuiltinToolsExecutor implements IToolExecutor {
// Await runtime in case factory is async
const runtime = await getServerRuntime(identifier, context);
- if (!runtime[apiName]) {
- throw new Error(`Builtin tool ${identifier}'s ${apiName} is not implemented`);
+ if (typeof runtime[apiName] !== 'function') {
+ // An unknown apiName is almost always a model hallucination (calling an
+ // API that the tool never declared in its manifest). Return a structured,
+ // recoverable error listing the tool's real APIs instead of throwing a
+ // hard error the model cannot act on. The throw here also sits outside
+ // the try/catch below, so it would otherwise surface as an uncaught
+ // failure rather than a tool result.
+ //
+ // Prefer the manifest's declared API names; most runtimes declare their
+ // APIs as prototype methods that `Object.keys(runtime)` cannot see, which
+ // would collapse the hint to an empty list. Fall back to a prototype-chain
+ // walk only when no manifest is available.
+ const manifestApis = getManifestApiNames(identifier);
+ const availableApis =
+ manifestApis.length > 0 ? manifestApis : collectRuntimeApiNames(runtime);
+ const message =
+ `Builtin tool "${identifier}" has no API named "${apiName}". ` +
+ `Available APIs: ${availableApis.join(', ')}. ` +
+ `Do not call APIs that are not listed above.`;
+ log('Unknown apiName for %s: %s (available: %o)', identifier, apiName, availableApis);
+ return {
+ content: message,
+ error: { code: 'UNKNOWN_API', message },
+ success: false,
+ };
}
try {
diff --git a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
index 20991d0e273..02f28292d4d 100644
--- a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
+++ b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
@@ -1,10 +1,12 @@
'use client';
import type { BuiltinInterventionProps } from '@lobechat/types';
-import { Button, Flexbox, Icon, Tabs, Text, TextArea } from '@lobehub/ui';
+import { Flexbox, Icon, Text, TextArea } from '@lobehub/ui';
+import { Button, Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { ArrowLeft, Check, PenLine, Send, X } from 'lucide-react';
import { memo } from 'react';
+import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
import type { AskUserQuestionArgs } from '../../../types';
@@ -55,6 +57,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
*/
const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestionArgs>>((props) => {
const { t } = useTranslation('tool');
+ const { actionsPortalTarget } = props;
const {
activeQuestion,
activeTab,
@@ -77,6 +80,55 @@ const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestio
submitting,
} = useAskUserForm(props);
+ const footer = (
+ <Flexbox horizontal align="center" gap={8} justify="space-between" width={'100%'}>
+ <Flexbox horizontal align="center" gap={12}>
+ {escapeActive ? (
+ <Text
+ className={styles.escapeLink}
+ fontSize={12}
+ type="secondary"
+ onClick={expired || submitting ? undefined : handleEscapeToggle}
+ >
+ <Icon icon={ArrowLeft} size={12} />
+ {t('claudeCode.askUserQuestion.escape.back')}
+ </Text>
+ ) : (
+ <Text
+ className={styles.escapeLink}
+ fontSize={12}
+ type="secondary"
+ onClick={expired || submitting ? undefined : handleEscapeToggle}
+ >
+ {t('claudeCode.askUserQuestion.escape.enter')}
+ <Icon icon={PenLine} size={12} />
+ </Text>
+ )}
+ <Text fontSize={12} type="secondary">
+ {expired
+ ? t('claudeCode.askUserQuestion.timeExpired')
+ : t('claudeCode.askUserQuestion.timeRemaining', {
+ time: formatRemaining(remainingMs),
+ })}
+ </Text>
+ </Flexbox>
+ <Flexbox horizontal gap={8}>
+ <Button disabled={submitting} icon={<Icon icon={X} />} onClick={handleSkip}>
+ {t('claudeCode.askUserQuestion.skip')}
+ </Button>
+ <Button
+ disabled={isSubmitDisabled}
+ icon={<Icon icon={Send} />}
+ loading={submitting}
+ type="primary"
+ onClick={handleSubmit}
+ >
+ {t('claudeCode.askUserQuestion.submit')}
+ </Button>
+ </Flexbox>
+ </Flexbox>
+ );
+
return (
<Flexbox gap={12}>
{!escapeActive && isMulti && (
@@ -120,52 +172,7 @@ const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestio
)
)}
- <Flexbox horizontal align="center" gap={8} justify="space-between">
- <Flexbox horizontal align="center" gap={12}>
- {escapeActive ? (
- <Text
- className={styles.escapeLink}
- fontSize={12}
- type="secondary"
- onClick={expired || submitting ? undefined : handleEscapeToggle}
- >
- <Icon icon={ArrowLeft} size={12} />
- {t('claudeCode.askUserQuestion.escape.back')}
- </Text>
- ) : (
- <Text
- className={styles.escapeLink}
- fontSize={12}
- type="secondary"
- onClick={expired || submitting ? undefined : handleEscapeToggle}
- >
- {t('claudeCode.askUserQuestion.escape.enter')}
- <Icon icon={PenLine} size={12} />
- </Text>
- )}
- <Text fontSize={12} type="secondary">
- {expired
- ? t('claudeCode.askUserQuestion.timeExpired')
- : t('claudeCode.askUserQuestion.timeRemaining', {
- time: formatRemaining(remainingMs),
- })}
- </Text>
- </Flexbox>
- <Flexbox horizontal gap={8}>
- <Button disabled={submitting} icon={X} onClick={handleSkip}>
- {t('claudeCode.askUserQuestion.skip')}
- </Button>
- <Button
- disabled={isSubmitDisabled}
- icon={Send}
- loading={submitting}
- type="primary"
- onClick={handleSubmit}
- >
- {t('claudeCode.askUserQuestion.submit')}
- </Button>
- </Flexbox>
- </Flexbox>
+ {actionsPortalTarget ? createPortal(footer, actionsPortalTarget) : footer}
</Flexbox>
);
});
diff --git a/packages/types/src/tool/builtin.ts b/packages/types/src/tool/builtin.ts
index d07c57212a0..113fd25d251 100644
--- a/packages/types/src/tool/builtin.ts
+++ b/packages/types/src/tool/builtin.ts
@@ -416,6 +416,14 @@ export interface BuiltinServerRuntimeOutput {
}
export interface BuiltinInterventionProps<Arguments = any> {
+ /**
+ * When present, a custom intervention should portal its action footer
+ * (submit / skip + status) into this node so it stays pinned below the
+ * scrollable content instead of scrolling with it. Hosts that render a fixed
+ * footer (e.g. the global approval card) supply this; when absent the
+ * component renders its footer inline.
+ */
+ actionsPortalTarget?: HTMLElement | null;
apiName?: string;
args: Arguments;
identifier?: string;
diff --git a/packages/utils/src/format.test.ts b/packages/utils/src/format.test.ts
index 80c77529fc3..ed3bcdf3ddf 100644
--- a/packages/utils/src/format.test.ts
+++ b/packages/utils/src/format.test.ts
@@ -284,6 +284,13 @@ describe('format', () => {
it('formats million-level token counts with M suffix', () => {
expect(formatUsageValue(1_000_000)).toBe('1M');
expect(formatUsageValue(1_500_000)).toBe('1.5M');
+ expect(formatUsageValue(999_900_000)).toBe('999.9M');
+ });
+
+ it('rolls over to B suffix once counts reach a billion (1000M)', () => {
+ expect(formatUsageValue(1_000_000_000)).toBe('1B');
+ expect(formatUsageValue(9_092_900_000)).toBe('9.1B');
+ expect(formatUsageValue(10_285_700_000)).toBe('10.3B');
});
});
diff --git a/packages/utils/src/format.ts b/packages/utils/src/format.ts
index 319e60d8e86..e8d929ebc73 100644
--- a/packages/utils/src/format.ts
+++ b/packages/utils/src/format.ts
@@ -82,6 +82,7 @@ export const formatIntergerNumber = (num?: any) => {
};
export const formatUsageValue = (number: number) => {
+ if (number >= 1_000_000_000) return `${numeral(number / 1_000_000_000).format('0.[0]')}B`;
if (number >= 1_000_000) return `${numeral(number / 1_000_000).format('0.[0]')}M`;
if (number >= 1_000) return `${numeral(number / 1_000).format('0.[0]')}K`;
return numeral(number).format('0,0');
diff --git a/src/features/AgentBreadcrumb/index.tsx b/src/features/AgentBreadcrumb/index.tsx
new file mode 100644
index 00000000000..e906ee59e83
--- /dev/null
+++ b/src/features/AgentBreadcrumb/index.tsx
@@ -0,0 +1,62 @@
+'use client';
+
+import { Icon, Text } from '@lobehub/ui';
+import { Breadcrumb as AntBreadcrumb } from 'antd';
+import { ChevronRight } from 'lucide-react';
+import { memo, type ReactNode } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Link } from 'react-router';
+import urlJoin from 'url-join';
+
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
+
+interface AgentBreadcrumbProps {
+ agentId: string;
+ /**
+ * The current section under the agent, e.g. 话题 / 助理档案 / 用量与成本.
+ */
+ title: ReactNode;
+}
+
+/**
+ * Breadcrumb for pages that live under an agent: `<AgentName> › <Section>`.
+ * The agent name links back to the agent home; the section is the current page.
+ */
+const AgentBreadcrumb = memo<AgentBreadcrumbProps>(({ agentId, title }) => {
+ const { t } = useTranslation(['chat', 'common']);
+ const agentTitle = useAgentStore((s) => agentSelectors.getAgentMetaById(agentId)(s).title);
+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
+ const isInbox = !!inboxAgentId && agentId === inboxAgentId;
+ const displayTitle = isInbox
+ ? agentTitle || t('inbox.title', { ns: 'chat' })
+ : agentTitle || t('defaultSession', { ns: 'common' });
+
+ return (
+ <AntBreadcrumb
+ separator={<Icon icon={ChevronRight} size={14} />}
+ items={[
+ {
+ title: (
+ <Link to={urlJoin('/agent', agentId)}>
+ <Text ellipsis color={'inherit'} style={{ maxWidth: 200 }} weight={500}>
+ {displayTitle}
+ </Text>
+ </Link>
+ ),
+ },
+ {
+ title: (
+ <Text color={'inherit'} weight={500}>
+ {title}
+ </Text>
+ ),
+ },
+ ]}
+ />
+ );
+});
+
+AgentBreadcrumb.displayName = 'AgentBreadcrumb';
+
+export default AgentBreadcrumb;
diff --git a/src/features/AgentTopicManager/Header.tsx b/src/features/AgentTopicManager/Header.tsx
index 41435aaaaf6..e46d0579dd8 100644
--- a/src/features/AgentTopicManager/Header.tsx
+++ b/src/features/AgentTopicManager/Header.tsx
@@ -1,16 +1,12 @@
'use client';
-import { Icon, Input, Text } from '@lobehub/ui';
-import { Breadcrumb as AntBreadcrumb } from 'antd';
-import { ChevronRight, Search } from 'lucide-react';
+import { Icon, Input } from '@lobehub/ui';
+import { Search } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
-import { Link } from 'react-router';
-import urlJoin from 'url-join';
+import AgentBreadcrumb from '@/features/AgentBreadcrumb';
import NavHeader from '@/features/NavHeader';
-import { useAgentStore } from '@/store/agent';
-import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
import { useTopicsViewStore } from './store';
@@ -19,42 +15,14 @@ interface HeaderProps {
}
const Header = memo<HeaderProps>(({ agentId }) => {
- const { t } = useTranslation(['topic', 'chat', 'common']);
- const agentTitle = useAgentStore((s) => agentSelectors.getAgentMetaById(agentId)(s).title);
- const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
- const isInbox = !!inboxAgentId && agentId === inboxAgentId;
- const displayTitle = isInbox
- ? agentTitle || t('inbox.title', { ns: 'chat' })
- : agentTitle || t('defaultSession', { ns: 'common' });
+ const { t } = useTranslation('topic');
const search = useTopicsViewStore((s) => s.search);
const setSearch = useTopicsViewStore((s) => s.setSearch);
return (
<NavHeader
+ left={<AgentBreadcrumb agentId={agentId} title={t('management.title')} />}
styles={{ center: { maxWidth: 560, paddingInline: 16 }, left: { paddingInlineStart: 24 } }}
- left={
- <AntBreadcrumb
- separator={<Icon icon={ChevronRight} size={14} />}
- items={[
- {
- title: (
- <Link to={urlJoin('/agent', agentId)}>
- <Text ellipsis color={'inherit'} style={{ maxWidth: 200 }} weight={500}>
- {displayTitle}
- </Text>
- </Link>
- ),
- },
- {
- title: (
- <Text color={'inherit'} weight={500}>
- {t('management.title')}
- </Text>
- ),
- },
- ]}
- />
- }
>
<Input
placeholder={t('management.searchPlaceholder')}
diff --git a/src/features/AgentUsage/index.tsx b/src/features/AgentUsage/index.tsx
index c22efe68edc..c0b5467619b 100644
--- a/src/features/AgentUsage/index.tsx
+++ b/src/features/AgentUsage/index.tsx
@@ -5,6 +5,7 @@ import { Segmented } from '@lobehub/ui/base-ui';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AgentBreadcrumb from '@/features/AgentBreadcrumb';
import NavHeader from '@/features/NavHeader';
import WideScreenContainer from '@/features/WideScreenContainer';
import { useAgentStore } from '@/store/agent';
@@ -49,10 +50,11 @@ const AgentUsage = memo(() => {
return (
<Flexbox height={'100%'} width={'100%'}>
<NavHeader
+ styles={{ left: { paddingInlineStart: 24 } }}
left={
- <Text fontSize={16} weight={600}>
- {t('usageStats.title')}
- </Text>
+ activeAgentId ? (
+ <AgentBreadcrumb agentId={activeAgentId} title={t('usageStats.title')} />
+ ) : null
}
/>
<Flexbox flex={1} style={styles.body} width={'100%'}>
diff --git a/src/features/ChatInput/ActionBar/Token/TokenProgress.test.ts b/src/features/ChatInput/ActionBar/Token/TokenProgress.test.ts
deleted file mode 100644
index f47906a61eb..00000000000
--- a/src/features/ChatInput/ActionBar/Token/TokenProgress.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { describe, expect, it } from 'vitest';
-
-import { formatToken } from './TokenProgress';
-
-describe('formatToken', () => {
- it('should format numbers >= 1M with M suffix', () => {
- expect(formatToken(1_000_000)).toBe('1M');
- expect(formatToken(1_500_000)).toBe('1.5M');
- expect(formatToken(2_000_000)).toBe('2M');
- expect(formatToken(10_000_000)).toBe('10M');
- });
-
- it('should format numbers >= 1K with K suffix', () => {
- expect(formatToken(1_000)).toBe('1K');
- expect(formatToken(14_251)).toBe('14.3K');
- expect(formatToken(985_749)).toBe('985.7K');
- expect(formatToken(999_999)).toBe('1000K');
- });
-
- it('should format numbers < 1K with comma separator', () => {
- expect(formatToken(0)).toBe('0');
- expect(formatToken(1)).toBe('1');
- expect(formatToken(999)).toBe('999');
- });
-});
diff --git a/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx b/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx
index a025e1a73ac..0864ec38c84 100644
--- a/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx
+++ b/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx
@@ -1,7 +1,7 @@
+import { formatUsageValue } from '@lobechat/utils';
import { Flexbox } from '@lobehub/ui';
import { Divider } from 'antd';
import { cssVar } from 'antd-style';
-import numeral from 'numeral';
import { memo } from 'react';
interface TokenProgressItem {
@@ -17,12 +17,6 @@ interface TokenProgressProps {
showTotal?: string;
}
-export const formatToken = (number: number) => {
- if (number >= 1_000_000) return numeral(number / 1_000_000).format('0.[0]') + 'M';
- if (number >= 1_000) return numeral(number / 1_000).format('0.[0]') + 'K';
- return numeral(number).format('0,0');
-};
-
const TokenProgress = memo<TokenProgressProps>(({ data, showIcon, showTotal }) => {
const total = data.reduce((acc, item) => acc + item.value, 0);
return (
@@ -63,7 +57,7 @@ const TokenProgress = memo<TokenProgressProps>(({ data, showIcon, showTotal }) =
)}
<div style={{ color: cssVar.colorTextSecondary }}>{item.title}</div>
</Flexbox>
- <div style={{ fontWeight: 500 }}>{formatToken(item.value)}</div>
+ <div style={{ fontWeight: 500 }}>{formatUsageValue(item.value)}</div>
</Flexbox>
))}
{showTotal && (
@@ -71,7 +65,7 @@ const TokenProgress = memo<TokenProgressProps>(({ data, showIcon, showTotal }) =
<Divider style={{ marginBlock: 8 }} />
<Flexbox horizontal align={'center'} gap={4} justify={'space-between'}>
<div style={{ color: cssVar.colorTextSecondary }}>{showTotal}</div>
- <div style={{ fontWeight: 500 }}>{formatToken(total)}</div>
+ <div style={{ fontWeight: 500 }}>{formatUsageValue(total)}</div>
</Flexbox>
</>
)}
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/index.tsx
index 934180868fe..6209695b1a9 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/index.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/index.tsx
@@ -189,6 +189,7 @@ const Intervention = memo<InterventionProps>(
return (
<Flexbox gap={12}>
<BuiltinToolInterventionRender
+ actionsPortalTarget={actionsPortalTarget}
apiName={apiName}
args={parsedArgs}
identifier={identifier}
diff --git a/src/features/GlobalApprovalNotification/styles.ts b/src/features/GlobalApprovalNotification/styles.ts
index a6946c3342d..a23688e68aa 100644
--- a/src/features/GlobalApprovalNotification/styles.ts
+++ b/src/features/GlobalApprovalNotification/styles.ts
@@ -156,6 +156,6 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
flex-direction: column;
align-items: center;
- width: min(520px, 92vw);
+ width: min(640px, 92vw);
`,
}));
diff --git a/src/routes/(main)/agent/profile/features/Header/index.test.tsx b/src/routes/(main)/agent/profile/features/Header/index.test.tsx
index 96c2fd1d4de..37aa17a0648 100644
--- a/src/routes/(main)/agent/profile/features/Header/index.test.tsx
+++ b/src/routes/(main)/agent/profile/features/Header/index.test.tsx
@@ -138,6 +138,10 @@ vi.mock('@/const/layoutTokens', () => ({
DESKTOP_HEADER_ICON_SMALL_SIZE: 24,
}));
+vi.mock('@/features/AgentBreadcrumb', () => ({
+ default: () => null,
+}));
+
vi.mock('@/features/NavHeader', () => ({
default: ({ left, right }: { left?: ReactNode; right?: ReactNode }) => (
<header>
diff --git a/src/routes/(main)/agent/profile/features/Header/index.tsx b/src/routes/(main)/agent/profile/features/Header/index.tsx
index a822742c872..90c161b4ab5 100644
--- a/src/routes/(main)/agent/profile/features/Header/index.tsx
+++ b/src/routes/(main)/agent/profile/features/Header/index.tsx
@@ -18,6 +18,7 @@ import { useAgentTransferMenuItem } from '@/business/client/hooks/useAgentTransf
import { useBusinessAgentImportMenuItem } from '@/business/client/hooks/useBusinessAgentImportMenuItem';
import { message } from '@/components/AntdStaticMethods';
import { DESKTOP_HEADER_ICON_SMALL_SIZE } from '@/const/layoutTokens';
+import AgentBreadcrumb from '@/features/AgentBreadcrumb';
import NavHeader from '@/features/NavHeader';
import ToggleRightPanelButton from '@/features/RightPanel/ToggleRightPanelButton';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
@@ -243,8 +244,12 @@ const Header = memo(() => {
return (
<NavHeader
+ styles={{ left: { paddingInlineStart: 24 } }}
left={
<Flexbox horizontal align={'center'} gap={8}>
+ {activeAgentId && (
+ <AgentBreadcrumb agentId={activeAgentId} title={t('tab.profile', { ns: 'chat' })} />
+ )}
<AutoSaveHint />
<AgentStatusTag />
<AgentVersionReviewTag />