🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(acceptance): screen programmatic-test checks, add audio evidence, polish evidence UX (#18100)
Arvin Xu8effa2c96c39
diff --git a/.agents/skills/agent-testing/SKILL.md b/.agents/skills/agent-testing/SKILL.mdindex 041f552c9f3..cbc0ae3697b 100644--- a/.agents/skills/agent-testing/SKILL.md+++ b/.agents/skills/agent-testing/SKILL.md@@ -157,6 +157,12 @@ deliverable. Do not ask for approval yet: Step 2 must establish the realenvironment state first so the user can approve one complete, evidence-backed planinstead of separate plan and environment prompts.+**Case selection gate (hard rule):** every case must be a delivery outcome a+person can judge. Never plan the repo's own programmatic gates — unit /+integration tests, coverage, type-check, lint, a clean build — as cases; ingest+drops them and a gates-only round fails to publish. Full rule:+[references/plan.md](./references/plan.md#case-selection-gate-hard-rule).+### Step 2 — Confirm environment state and auth (mandatory)Step 2 is about getting the environment ready: **dependencies are healthy** and@@ -476,6 +482,17 @@ Hard rules worth front-loading:- **Time-based behavior needs a GIF, not a screenshot.** Streaming output, aticking timer, loading states, animations — record with `scripts/record-gif.sh`and attach the GIF as that case's evidence; a static screenshot cannot prove it.+- **A deliverable the user hears needs `audio`.** TTS output, a voice reply, an+ alert tone: attach the clip the feature produced so the page renders a player.+ Prose about a sound, or a screenshot of a waveform, proves nothing —+ [references/report.md](./references/report.md).+- **Programmatic gates are NEVER acceptance checks (hard rule, enforced).**+ Unit / integration tests, coverage, type-check, lint, and a clean build are+ preconditions of shipping; they belong in one line of `report.md` →+ Verification and MUST NOT appear in `plan[]` / `cases[]` under any phrasing.+ `acceptance run ingest` drops every matching item (matched on title, category,+ and method) and a gates-only round fails to publish —+ [references/report.md](./references/report.md#hard-rule--what-is-not-an-acceptance-check).### Step 6 — Publish to LobeHub Acceptance (mandatory)diff --git a/.agents/skills/agent-testing/references/plan.md b/.agents/skills/agent-testing/references/plan.mdindex 51155bd3e22..34eef9ef985 100644--- a/.agents/skills/agent-testing/references/plan.md+++ b/.agents/skills/agent-testing/references/plan.md@@ -69,6 +69,22 @@ Do not include irrelevant environment rows. Add a row when the run has another hprerequisite, such as a native app, gateway, fixture repository, or specificexternal account.+## Case selection gate (hard rule)++Every planned case MUST be a delivery outcome a person can judge — what the+user sees, hears, reads, or receives. **Never plan a case whose subject is the+repo's own programmatic gate**: unit / integration / regression tests, test+suites, coverage, type-check, lint, format, or a clean build. Run those gates as+part of your own diligence and report them as one line of narrative in+`report.md` → Verification — they are preconditions of shipping, not things the+user accepts, and `lh acceptance run ingest` drops them from the round (a+gates-only round fails to publish entirely). A plan feedback that lists such a+case wastes the user's approval on a row that will never reach the page.++The gate is about the check's _subject_, not its verifier: a CLI behavior case+asserted by a command is a good case (`verifier: "program"`); "`bun run test`+is green" is not.+When a check refines or replaces a requirement from an earlier Acceptance round,keep the old stable id if it is the same assertion. If the semantic assertion needsa new id, declare the replacement explicitly with `supersedes: ['old-check-id']`;diff --git a/.agents/skills/agent-testing/references/report.md b/.agents/skills/agent-testing/references/report.mdindex 9b1a2f1d790..c58d246aafe 100644--- a/.agents/skills/agent-testing/references/report.md+++ b/.agents/skills/agent-testing/references/report.md@@ -120,6 +120,23 @@ table — those double up on the page. It carries only the non-duplicate narration each side, so the two captions read as a comparison rather than repeatingthe case title.+ - Audio (a deliverable the user **hears** — TTS output, a voice reply, an+ alert tone): attach the clip itself as `audio` evidence. The acceptance page+ renders a player, so the reviewer can listen; prose about a sound, or a+ screenshot of a waveform, proves nothing. `mp3` / `wav` / `m4a` / `aac` /+ `flac` / `ogg` / `opus` are typed as `audio` from the extension.++ Verify the clip before citing it — confirm it is non-silent and carries the+ expected content (duration plus a transcription or spectral check); an empty+ or truncated file is indistinguishable from a good one in a file listing.+ Pair it with a short text artifact when the claim is about _what was said_+ (input text, voice/model, measured duration): the player proves it plays,+ the text makes it auditable.++ A screen recording with system audio is the fallback for "the UI plays it at+ the right moment"; for "the output is correct", attach the file the feature+ produced.+- CLI: use the dual-text evidence format below. Preserve the exact command +trimmed output (`<cli> <command> | tee "$DIR/assets/x-execution.txt"`) inthe execution artifact, and attach a separate reasoning artifact.@@ -188,6 +205,11 @@ from the current one.never produces a case renders as **未执行** rather than vanishing, so cut coveragein the open.+ **HARD RULE: no programmatic gates in the plan.** Tests / type-check / lint /+ build are never plan items — ingest drops them and a gates-only round fails+ to publish. See+ [what is NOT an acceptance check](#hard-rule--what-is-not-an-acceptance-check).+4. **Fill `result.json` as you go** — it is the report. Each tested behavior is oneentry in `cases[]` (`{ id, name, result, observation, evidence }`), where`evidence` is a path under `assets/`. Set the scope fields (`scenario`, `branch`,@@ -387,10 +409,10 @@ you cut it is not.Two of its fields are a **closed vocabulary**, because the pipeline acts on them —they are not labels:-| field | values | what it does |-| ------------------ | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |-| `verifier` | `program` \| `agent` \| `llm` (default `agent`) | How the verdict is reached. A command-asserted check is `program`; calling it `agent` hides what actually judged it. |-| `requiredEvidence` | `screenshot` \| `gif` \| `video` \| `text` \| `dom_snapshot` \| `transcript` | The artifact this check **must** produce. The coverage gate **fails** an item whose required medium is missing. |+| field | values | what it does |+| ------------------ | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |+| `verifier` | `program` \| `agent` \| `llm` (default `agent`) | How the verdict is reached. A command-asserted check is `program`; calling it `agent` hides what actually judged it. |+| `requiredEvidence` | `screenshot` \| `gif` \| `video` \| `audio` \| `text` \| `markdown` \| `dom_snapshot` \| `transcript` | The artifact this check **must** produce. The coverage gate **fails** an item whose required medium is missing. |An out-of-vocabulary value in either fails the ingest — an unrecognized mediumwould silently gate on nothing, which is worse than no gate at all.@@ -399,6 +421,38 @@ would silently gate on nothing, which is worse than no gate at all.**free prose** — they carry intent no enum can, and both render under the check onthe page next to the outcome.+### HARD RULE — what is NOT an acceptance check++A check is something a **person decides about the delivery**. The repo's own+automated gates are not that, and on the page they are actively harmful: twenty+green "unit tests pass" rows bury the two checks that actually needed someone to+look.++**These MUST NOT appear in `plan[]` / `cases[]`, under any phrasing:**++| Not a check | Where it belongs |+| ---------------------------------------------------------- | ---------------------------------------------------- |+| Unit / integration / regression / snapshot tests, coverage | one line in `report.md` → **Verification** |+| `type-check`, `tsc`, `eslint`, lint, format, a clean build | same — a precondition of shipping, not a deliverable |+| "the suite is green", "CI passes" | same |++This is enforced, not advisory. `acceptance run ingest` **drops every matching+item** — matched on title, category, AND `method`, so "run `bun run test`"+inside `method` under a product-sounding title still matches — warns with the+dropped ids, and recounts `summary` from the checks that remain. A round+consisting **only** of such checks **fails to publish**. Apply the rule at plan+time (Phase 1 case selection gate), before any case runs: a gate written as a+check is a round spent proving something nobody accepts. Run the gates as your+own diligence — report them as one line of narrative.++The line is the _subject_ of the check, not who judged it: a CLI behavior check+asserted by a command is a good acceptance item (`verifier: "program"`);+"`bun run test` is green" is not.++**What IS a check:** what the user sees, hears, reads, or receives — a rendered+screen, a produced file, a response shape a client depends on, an audio clip that+actually plays, a failure state that recovers.+A plan item may also carry a per-item `surface` (same closed set as the run-level`surfaces`; `electron` normalizes to `desktop`). It says which product surface THIScheck ran on. It is metadata, never an Acceptance grouping key.diff --git a/.agents/skills/ux/SKILL.md b/.agents/skills/ux/SKILL.mdindex b6efb77c7fa..3ccb9fd2f6b 100644--- a/.agents/skills/ux/SKILL.md+++ b/.agents/skills/ux/SKILL.md@@ -113,6 +113,7 @@ The one-screen scan. Each line links back to a module above for the full rule +- [ ] A sidebar / nav / master-detail **list row** composes the canonical `NavItem` (+ `Accordion` / `GroupedAccordion` for groups, `Block variant='filled'` for active), not a hand-rolled `<div>`/`<button>`/`<input>` + bespoke CSS — else the hover/active highlight misaligns from the content box, content bleeds to the panel edge, the search/rename/action-reveal drift from every sibling panel, and the list stays a flat ungrouped dump. Grep `NavItem` before building.- [ ] A persistent create/compose affordance above a list is the hero only while the list is **empty**; once populated it doesn't bury the records — cap the editor height (max-height + internal scroll) and/or default it to collapsed when the list has data, so the records keep Center Stage.- [ ] A status group/label is true for **every** member — don't fold a distinct lifecycle state (scheduled/queued/snoozed) under a label that asserts another (running/in-progress); give it its own group or a neutral label.+- [ ] An embedded/quoted document (evidence, log, attached report) folds to a **titled row** (first meaningful line as the label) expanding to full text — not a first-N-px cropped preview with a fade; expanded, it stays in a quiet container with a capped heading scale so it never masquerades as page structure.**Edit — entering & changing content** ([edit.md](references/edit.md))diff --git a/.agents/skills/ux/references/read.md b/.agents/skills/ux/references/read.mdindex 067db05b32a..6b722a0a70f 100644--- a/.agents/skills/ux/references/read.md+++ b/.agents/skills/ux/references/read.md@@ -460,6 +460,7 @@ UX consequence — a bespoke row is a visible consistency + craft regression.)- [ ] Grouping at scale reuses `Accordion` / `GroupedAccordion` (by-project / status / time), not a flat ungrouped dump once the list grows past a screen. _(Natural)_- [ ] Search box, inline-rename, and row actions reuse the shared input / editing / action-reveal patterns, not raw `<input>` / `<label>` + hand CSS. _(Certainty)_- [ ] Spacing/padding expressed as `Flexbox` / `Block` `gap` / `padding` props (inherits the sidebar rhythm), not hand-picked px constants. _(Natural)_+## 1.11 A persistent composer above a list must not bury the records・Meaningful・NaturalA list surface with an **always-visible create / compose affordance above the records** (an@@ -519,3 +520,34 @@ label** (ranked where it belongs), or relabel the shared group so it's true for- [ ] A status group/label is true for **every** member — no folding a distinct lifecycle state (scheduled/queued/snoozed) under a label that asserts a different one (running/in-progress). _(Certainty)_- [ ] The distinct state gets its own group/label (ranked appropriately), or the shared label is neutral enough to be true for both. _(Meaningful)_++## 1.13 Quoted documents fold to a titled row, not a height-cropped preview・Natural・Meaningful++When a surface embeds **someone else's document** as material (an evidence write-up, a log,+an attached report, a quoted spec), two things go wrong if it renders inline like the page's+own prose. First, **disclosure**: a "show the first N px + expand" fold assumes the opening+lines are a summary — true for chat prose, false for structured documents, which open with+headings and environment metadata. The cropped preview then spends a card of vertical space+on the document's _least_ informative part, cut mid-sentence behind a fade — pure noise. The+reader's real choice is binary: read this artifact now, or skip it. Serve that choice with a+**one-line titled row (first meaningful line, markdown-stripped, as the label) that expands+to the full text** — never a partial bleed. Second, **subordination**: quoted material must+not share the host page's typographic scale. Un-contained, the document's own `##` headings+render larger than the host's section titles and masquerade as page structure. Give it a+quiet container and a capped heading scale (`headerMultiple` near 0) so it reads as quoted+material, not as the page.++> ✅ Each prose evidence folds to one quiet row labeled by its first line (" 声明 — 验收页的音+> 频证据应复用对话播放器 "); expanding shows the full text in a contained block whose headings+> stay body-sized. Two artifacts = two rows; need it → expand, don't → one line each.+> ❌ Acceptance check evidence rendered bare `Markdown` folded at 180px behind a `MaskShadow`+> (`MarkdownEvidence.tsx`, pre-fix): the preview showed only the document's opening headings+> ("环境: worktree…") cut by a fade whose `size={32}` was actually **32%** (the prop is a+> percentage, not px), masking a third of the window to blank; the evidence's `#` headings+> rendered bigger than the check's own title, so quoted content read as page structure.++**Checklist**++- [ ] An embedded document folds to a **titled row** (first meaningful line as label) that expands to full text — no first-N-px cropped preview with a fade. _(Natural)_+- [ ] Quoted/embedded content is visually subordinated: a quiet container + capped heading scale, never sharing the host page's typographic hierarchy. _(Meaningful)_+- [ ] A mask/fade helper's `size` unit is verified against its implementation (px vs %) before shipping — a wrong unit blanks real content. _(Certainty)_diff --git a/apps/cli/src/commands/acceptanceRun.ts b/apps/cli/src/commands/acceptanceRun.tsindex 94f490dfba9..918eee3e457 100644--- a/apps/cli/src/commands/acceptanceRun.ts+++ b/apps/cli/src/commands/acceptanceRun.ts@@ -29,10 +29,12 @@ import {pullRequestFromResult,reportEvidence,scenarioFromResult,+ screenProgrammaticTestChecks,subjectFromEnv,subjectFromResult,surfacesFromResult,toVerdict,+ type Verdict,visualizationMetadata,} from './verifyHelpers';@@ -540,14 +542,39 @@ async function ingestReportAction(reportDir: string, options: IngestReportOptionprocess.exit(1);}- const cases: any[] = Array.isArray(result.cases) ? result.cases : [];+ // Unit tests, type-checks and lint gates are preconditions of shipping, not+ // things a person accepts — a page full of them buries the checks that+ // actually needed a human eye. Screen them out of both the plan and the cases+ // before anything is published.+ const { droppedIds, droppedLabels } = screenProgrammaticTestChecks(result);+ const allCases: any[] = Array.isArray(result.cases) ? result.cases : [];+ // Freeze each case's id BEFORE filtering: the fallback id is position-based+ // (`case-N`), so dropping an earlier case would re-enumerate the survivors in+ // the ingest loop — pairing them with the wrong plan items and publishing+ // orphaned results into the immutable round.+ const casesWithIds = allCases.map((c, index) => ({+ case: c,+ checkItemId: String(c?.id ?? c?.checkItemId ?? `case-${index + 1}`),+ }));+ const cases = casesWithIds.filter(({ checkItemId }) => !droppedIds.has(checkItemId));+ // Every check was a gate: there is nothing here for a person to accept, and+ // publishing an empty round would just create a verdict-less page. Fail before+ // the first remote mutation, while the author can still fix the report.+ if (cases.length === 0 && allCases.length > 0) {+ log.error(+ 'every check in this round is a programmatic gate (tests / type-check / lint) — nothing here needs a human decision.',+ );+ log.error(+ ' Verify what the delivery does, shows, or produces, and keep the gates as one line of report.md.',+ );+ process.exit(1);+ }// Validate every schemaless visualization before the first remote mutation.// An ingest that cannot render must not create or attach a partial immutable round.- const caseMetadata = cases.map((item, index) => {+ const caseMetadata = cases.map(({ case: item, checkItemId }) => {try {return visualizationMetadata(item);} catch (error) {- const checkItemId = String(item.id ?? item.checkItemId ?? `case-${index + 1}`);throw new Error(`case ${checkItemId}: ${error instanceof Error ? error.message : String(error)}`,{ cause: error },@@ -589,7 +616,7 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption// What the run set out to check, written before it ran. Paired with the// results by `id`, so the report can show a planned item that never ran.- const plan = planFromResult(result);+ const plan = planFromResult(result, droppedIds);const goal = options.goal ?? (typeof result.focus === 'string' ? result.focus : undefined);const title = options.title ?? result.title;@@ -698,8 +725,7 @@ async function ingestReportAction(reportDir: string, options: IngestReportOptionconst seenCheckItemIds = new Set<string>();let evidenceCount = 0;let inlined = 0;- for (const [index, c] of cases.entries()) {- const checkItemId = String(c.id ?? c.checkItemId ?? `case-${index + 1}`);+ for (const [index, { case: c, checkItemId }] of cases.entries()) {seenCheckItemIds.add(checkItemId);const verdict = toVerdict(c.result ?? c.status ?? c.verdict);const observation = c.keyObservation ?? c.observation ?? c.note;@@ -765,18 +791,31 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption// surfaces it as the `score` stat.const score =typeof summary.score === 'number' ? Math.max(0, Math.min(1, summary.score / 100)) : undefined;+ // The authored counts describe the report the author wrote. Once a+ // programmatic-test check is screened out they no longer match what was+ // published, so recount from the cases that actually landed — a stats block+ // that disagrees with the visible check list is worse than no stats.+ const recount = cases.length !== allCases.length;+ const verdicts = cases.map(({ case: c }) => toVerdict(c.result ?? c.status ?? c.verdict));+ const counted = (verdict: Verdict) => verdicts.filter((v) => v === verdict).length;await client.verify.upsertReport.mutate({content,- failedChecks: summary.failed,+ failedChecks: recount ? counted('failed') : summary.failed,overallConfidence: score,- passedChecks: summary.passed,+ passedChecks: recount ? counted('passed') : summary.passed,summary: conclusion,- totalChecks: summary.total ?? cases.length,- uncertainChecks: (summary.blocked ?? 0) + (summary.uncertain ?? 0) || undefined,+ totalChecks: recount ? cases.length : (summary.total ?? cases.length),+ uncertainChecks: recount+ ? counted('uncertain') || undefined+ : (summary.blocked ?? 0) + (summary.uncertain ?? 0) || undefined,// An explicit summary.verdict wins; otherwise the headline is derived// from the ingested cases (deriveReportVerdict) so no report ships- // verdict-less and lists as a permanent "?".- verdict: summary.verdict ? toVerdict(summary.verdict) : deriveReportVerdict(cases),+ // verdict-less and lists as a permanent "?". After a screen the authored+ // verdict may have been about a check that is no longer here, so rederive.+ verdict:+ summary.verdict && !recount+ ? toVerdict(summary.verdict)+ : deriveReportVerdict(cases.map(({ case: c }) => c)),verifyRunId: runId,});@@ -793,6 +832,7 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption{acceptanceId,cases: cases.length,+ droppedProgrammaticChecks: droppedLabels,evidence: evidenceCount,inlined,origin,@@ -811,7 +851,8 @@ async function ingestReportAction(reportDir: string, options: IngestReportOptionconsole.log(`${pc.green('✓')} Ingested ${pc.bold(String(cases.length))} case(s), ${pc.bold(String(evidenceCount))} evidence artifact(s)` +- `${inlined > 0 ? `, ${pc.bold(String(inlined))} inline` : ''}`,+ `${inlined > 0 ? `, ${pc.bold(String(inlined))} inline` : ''}` ++ `${droppedLabels.length > 0 ? pc.yellow(` — ${droppedLabels.length} programmatic-test check(s) dropped`) : ''}`,);if (plan?.length) {const unexecuted = plan.filter((item) => !seenCheckItemIds.has(item.id));diff --git a/apps/cli/src/commands/verify.test.ts b/apps/cli/src/commands/verify.test.tsindex 7a18fafba55..f04e56519cc 100644--- a/apps/cli/src/commands/verify.test.ts+++ b/apps/cli/src/commands/verify.test.ts@@ -18,6 +18,7 @@ import {registerVerifyCommand,reportEvidence,scenarioFromResult,+ screenProgrammaticTestChecks,subjectFromEnv,subjectFromResult,surfacesFromResult,@@ -473,6 +474,17 @@ describe('evidenceTypeForFile — markdown evidence', () => {expect(evidenceTypeForFile('assets/root-cause.txt')).toBe('text');});+ it('types an audio clip as audio, not the binary-blob-as-text fallback', () => {+ // Before `audio` existed these fell through to `text`, so a TTS deliverable+ // published as an unreadable, unplayable artifact.+ expect(evidenceTypeForFile('assets/tts-zh.mp3')).toBe('audio');+ expect(evidenceTypeForFile('assets/reply.WAV')).toBe('audio');+ expect(evidenceTypeForFile('assets/voice.m4a')).toBe('audio');+ expect(evidenceTypeForFile('assets/tone.opus')).toBe('audio');+ // .webm stays video — the container is overwhelmingly used for screen clips.+ expect(evidenceTypeForFile('assets/flow.webm')).toBe('video');+ });+it('inlines a small markdown file as content instead of uploading it', () => {const dir = mkdtempSync(path.join(tmpdir(), 'lh-evidence-'));const file = path.join(dir, 'root-cause.md');@@ -524,6 +536,71 @@ describe('surfacesFromResult — surface normalization', () => {});});+describe('screenProgrammaticTestChecks', () => {+ let warnSpy: ReturnType<typeof vi.spyOn>;++ beforeEach(() => {+ warnSpy = vi.spyOn(log, 'warn').mockImplementation(() => undefined);+ });++ afterEach(() => {+ warnSpy.mockRestore();+ });++ it('drops the repo test suites and static gates, keeping real acceptance checks', () => {+ const result = {+ cases: [+ { id: 'c1', name: '语音回复能在气泡里播放', status: 'pass' },+ { id: 'c2', name: '单元测试全部通过', status: 'pass' },+ ],+ plan: [+ { id: 'c1', title: '语音回复能在气泡里播放' },+ { id: 'c2', title: '单元测试全部通过' },+ { id: 'c3', method: 'bun run check --type', title: '类型检查无报错' },+ ],+ };++ const { droppedIds, droppedLabels } = screenProgrammaticTestChecks(result);++ expect([...droppedIds]).toEqual(['c2', 'c3']);+ expect(droppedLabels).toEqual(['c2 — 单元测试全部通过', 'c3 — 类型检查无报错']);+ expect(warnSpy).toHaveBeenCalled();+ });++ it('screens plan and cases together so a dropped item never orphans its pair', () => {+ // The plan item names the gate; the case is titled loosely. Screening only+ // one side would leave the other behind as an "unplanned" row.+ const { droppedIds } = screenProgrammaticTestChecks({+ cases: [{ id: 'c1', name: 'all green' }],+ plan: [{ id: 'c1', title: 'vitest suite passes' }],+ });++ expect([...droppedIds]).toEqual(['c1']);+ });++ it('says nothing when the round has no programmatic-test checks', () => {+ const { droppedIds, droppedLabels } = screenProgrammaticTestChecks({+ plan: [{ id: '1', title: 'the reply streams token by token' }],+ });++ expect(droppedIds.size).toBe(0);+ expect(droppedLabels).toEqual([]);+ expect(warnSpy).not.toHaveBeenCalled();+ });++ it('omits the screened ids from the frozen plan', () => {+ const result = {+ plan: [+ { id: 'c1', title: 'the reply streams token by token' },+ { id: 'c2', title: 'unit tests pass' },+ ],+ };+ const { droppedIds } = screenProgrammaticTestChecks(result);++ expect(planFromResult(result, droppedIds)!.map((item) => item.id)).toEqual(['c1']);+ });+});+describe('planFromResult — plan item normalization', () => {let exitSpy: ReturnType<typeof vi.spyOn>;@@ -665,6 +742,37 @@ describe('verify ingest-report — every run is an immutable acceptance round',await program.parseAsync(['node', 'lh', 'verify', ...args]);};+ it('keeps position-based fallback ids stable when screening drops an earlier case', async () => {+ // Regression (codex review): the survivors used to be re-enumerated after+ // the programmatic-test screen, so dropping an id-less first case shifted+ // every later fallback id (`case-2` ingested as `case-1`) — orphaning the+ // results from their plan items in the immutable round.+ const verify = mockTrpcClient.verify as Record<string, any>;+ verify.ingestResult = { mutate: vi.fn().mockResolvedValue({ id: 'result-1' }) };+ writeFileSync(+ path.join(dir, 'result.json'),+ JSON.stringify({+ cases: [+ { name: '单元测试全部通过', status: 'pass' },+ { name: '回复在气泡中渲染', status: 'pass' },+ { name: '失败态可重试', status: 'pass' },+ ],+ plan: [+ { id: 'case-2', title: '回复在气泡中渲染' },+ { id: 'case-3', title: '失败态可重试' },+ ],+ title: 'fallback id screening',+ }),+ );++ await run(['ingest-report', dir, '--json']);++ const ingested = verify.ingestResult.mutate.mock.calls.map(+ ([input]: [{ checkItemId: string }]) => input.checkItemId,+ );+ expect(ingested).toEqual(['case-2', 'case-3']);+ });+it('creates a fresh run and binds it to the current topic acceptance', async () => {const verify = mockTrpcClient.verify as Record<string, any>;@@ -1003,6 +1111,15 @@ describe('deriveReportVerdict — headline fallback when summary.verdict is abseit('no cases → no derived verdict', () => {expect(deriveReportVerdict([])).toBeUndefined();});++ it('reads the documented `status` field, same as the per-case ingest', () => {+ // Regression: `status` was skipped here while the per-case ingest reads+ // `result ?? status ?? verdict`, so an all-pass report written with the+ // documented field derived `uncertain` whenever this fallback ran (e.g.+ // after the programmatic-test screen recounts the summary).+ expect(deriveReportVerdict([{ status: 'pass' }, { status: 'pass' }])).toBe('passed');+ expect(deriveReportVerdict([{ status: 'pass' }, { status: 'fail' }])).toBe('failed');+ });});describe('subjectFromEnv — default topic acceptance', () => {diff --git a/apps/cli/src/commands/verifyHelpers.ts b/apps/cli/src/commands/verifyHelpers.tsindex 84bac3a6fe2..12a5f09482d 100644--- a/apps/cli/src/commands/verifyHelpers.ts+++ b/apps/cli/src/commands/verifyHelpers.ts@@ -10,7 +10,9 @@ import type {} from '@lobechat/const/verify';import {acceptanceSubjectTypes,+ isProgrammaticTestCheck,normalizeVerifySurface,+ PROGRAMMATIC_TEST_CHECK_HINT,verifyEvidenceTypes,verifyRunScenarios,verifySurfaces,@@ -61,7 +63,7 @@ export function assertEnum<T extends string>(export type Verdict = 'failed' | 'passed' | 'uncertain';export type EvidenceType =- 'dom_snapshot' | 'gif' | 'markdown' | 'screenshot' | 'text' | 'transcript' | 'video';+ 'audio' | 'dom_snapshot' | 'gif' | 'markdown' | 'screenshot' | 'text' | 'transcript' | 'video';export const INLINE_TEXT_EVIDENCE_LIMIT = 5000;export const INLINE_TEXT_EVIDENCE_TYPES = new Set<EvidenceType>([@@ -85,7 +87,12 @@ export function toVerdict(raw: unknown): Verdict {* render as a permanent "?" in every list surface.*/export function deriveReportVerdict(cases: unknown[]): Verdict | undefined {- const verdicts = cases.map((c) => toVerdict((c as any)?.result ?? (c as any)?.verdict));+ // Same field fallback as the per-case ingest (`result ?? status ?? verdict`) —+ // the documented case field is `status`, so dropping it here derived+ // `uncertain` for an all-pass report whenever this fallback actually ran.+ const verdicts = cases.map((c) =>+ toVerdict((c as any)?.result ?? (c as any)?.status ?? (c as any)?.verdict),+ );if (verdicts.length === 0) return undefined;if (verdicts.includes('failed')) return 'failed';if (verdicts.includes('uncertain')) return 'uncertain';@@ -98,6 +105,12 @@ export function evidenceTypeForFile(file: string): EvidenceType {if (ext === 'gif') return 'gif';if (['png', 'jpg', 'jpeg', 'webp', 'svg', 'bmp'].includes(ext)) return 'screenshot';if (['mp4', 'webm', 'mov', 'm4v'].includes(ext)) return 'video';+ // Audio before the text fallback: an unrecognized binary used to land on+ // `text`, publishing a TTS clip as an unreadable, unplayable blob.+ if (+ ['mp3', 'wav', 'm4a', 'aac', 'flac', 'ogg', 'oga', 'opus', 'aiff', 'aif', 'wma'].includes(ext)+ )+ return 'audio';if (['html', 'htm'].includes(ext)) return 'dom_snapshot';if (['md', 'markdown'].includes(ext)) return 'markdown';return 'text';@@ -568,6 +581,81 @@ export function genericContextFromResult(return entries.length > 0 ? Object.fromEntries(entries) : undefined;}+/** The id a plan entry / case will be ingested under, mirroring the readers below. */+const planItemId = (item: Record<string, unknown>, index: number) =>+ String(item.id ?? `case-${index + 1}`);+const caseItemId = (item: Record<string, unknown>, index: number) =>+ String(item.id ?? item.checkItemId ?? `case-${index + 1}`);++/** The outcome of {@link screenProgrammaticTestChecks}. */+export interface ProgrammaticTestScreen {+ /** Check ids to omit from both the frozen plan and the ingested cases. */+ droppedIds: Set<string>;+ /** What was dropped, `id — title`, for one warning the author can act on. */+ droppedLabels: string[];+}++/**+ * Which checks in this report are the repo's own programmatic test / static-+ * analysis gates rather than delivery outcomes a person accepts.+ *+ * Screened once, over the plan AND the cases, so a dropped plan item can never+ * leave its case behind as an orphan "unplanned" row (or the reverse). Both+ * sides are matched on their own text, then unioned by id.+ *+ * Dropping one item rather than failing the ingest is deliberate: the round's+ * real checks are still worth publishing, and a hard error would cost the author+ * the whole publish over an item they only meant as a footnote. (The caller does+ * refuse to publish when the screen empties the round — then there is nothing+ * left for a person to accept.)+ */+export function screenProgrammaticTestChecks(+ result: Record<string, unknown>,+): ProgrammaticTestScreen {+ const droppedIds = new Set<string>();+ const droppedLabels: string[] = [];++ const screen = (entry: unknown, id: string) => {+ const item = objectValue(entry);+ if (!item) return;+ const title = firstString(item.title, item.name, item.case);+ if (+ !isProgrammaticTestCheck(+ title,+ firstString(item.category, item.group),+ firstString(item.method, item.how),+ )+ ) {+ return;+ }+ if (!droppedIds.has(id)) {+ droppedIds.add(id);+ droppedLabels.push(title ? `${id} — ${title}` : id);+ }+ };++ if (Array.isArray(result.plan)) {+ result.plan.forEach((entry, index) =>+ screen(entry, planItemId(objectValue(entry) ?? {}, index)),+ );+ }+ if (Array.isArray(result.cases)) {+ result.cases.forEach((entry, index) =>+ screen(entry, caseItemId(objectValue(entry) ?? {}, index)),+ );+ }++ if (droppedLabels.length > 0) {+ log.warn(+ `dropping ${droppedLabels.length} programmatic-test check(s) from this acceptance round:`,+ );+ for (const label of droppedLabels) log.warn(` - ${label}`);+ log.warn(` ${PROGRAMMATIC_TEST_CHECK_HINT}`);+ }++ return { droppedIds, droppedLabels };+}+/** Reject an out-of-vocabulary plan value rather than storing a word nothing reads. */export function assertPlanEnum<T extends string>(value: string,@@ -604,8 +692,11 @@ export function assertPlanEnum<T extends string>(* Returns `undefined` when the report declares no `plan` field. A `plan` that is* present but empty returns `[]`, recording an explicitly empty plan in this* immutable snapshot.+ *+ * `droppedIds` (from {@link screenProgrammaticTestChecks}) omits the repo's own+ * test/lint gates, which are shipping preconditions rather than acceptance items.*/-export function planFromResult(result: Record<string, unknown>) {+export function planFromResult(result: Record<string, unknown>, droppedIds?: Set<string>) {if (!Array.isArray(result.plan)) return undefined;const items = result.plan.flatMap((entry: unknown, index: number) => {@@ -614,7 +705,8 @@ export function planFromResult(result: Record<string, unknown>) {// An item with no title names no check — it can't be rendered or paired.if (!item || !title) return [];- const id = String(item.id ?? `case-${index + 1}`);+ const id = planItemId(item, index);+ if (droppedIds?.has(id)) return [];const method = firstString(item.method, item.how);const expected = firstString(item.expected, item.expectation);diff --git a/apps/server/src/routers/lambda/verify.ts b/apps/server/src/routers/lambda/verify.tsindex c8e246e37b3..2da08d09e43 100644--- a/apps/server/src/routers/lambda/verify.ts+++ b/apps/server/src/routers/lambda/verify.ts@@ -83,6 +83,7 @@ const evidenceTypeSchema = z.enum(['screenshot','gif','video',+ 'audio','text','markdown','dom_snapshot',diff --git a/apps/server/src/services/verify/planGenerator.ts b/apps/server/src/services/verify/planGenerator.tsindex 466cf9e8647..15b2f9e9bb5 100644--- a/apps/server/src/services/verify/planGenerator.ts+++ b/apps/server/src/services/verify/planGenerator.ts@@ -1,6 +1,7 @@import { randomUUID } from 'node:crypto';import { TRACING_SCENARIOS, VERIFY_INSTRUCTION_FILE_TYPE } from '@lobechat/const';+import { isProgrammaticTestCheck } from '@lobechat/const/verify';import type { TracingOptions } from '@lobechat/llm-generation-tracing';import type { RequiredEvidenceSpec, VerifyCheckItem } from '@lobechat/types';import debug from 'debug';@@ -90,6 +91,19 @@ const buildHolisticAgentItem = (requirement?: string, goal?: string): VerifyChec};};+/**+ * Drop AI-proposed criteria that are really the repo's own test / lint gates.+ *+ * The prompt already forbids them, but a model asked to verify a code change+ * reaches for "unit tests pass" reliably enough that the acceptance page fills+ * with rows nobody can act on. Applied only to the AI-generated criteria: they+ * are complementary by construction, and `generateDraftPlan` still falls back+ * to the holistic check if the filter empties the plan.+ */+const withoutProgrammaticTests = <T extends { description?: string; title: string }>(+ criteria: T[],+): T[] => criteria.filter((c) => !isProgrammaticTestCheck(c.title, c.description));+const criterionToCheckItem = (criterion: VerifyCriterionItem,index: number,@@ -284,7 +298,7 @@ export class VerifyPlanGeneratorService {log('config criteria-gen output did not match schema: %O', parsed.error.flatten());return [];}- return parsed.data.criteria.slice(0, maxCriteria).map((c) => ({+ return withoutProgrammaticTests(parsed.data.criteria.slice(0, maxCriteria)).map((c) => ({description: c.description,instruction: c.instruction,onFail: c.onFail ?? 'manual',@@ -444,7 +458,7 @@ export class VerifyPlanGeneratorService {// Like the agent-authored path, the detailed instruction lives in a document// (the single source of truth) referenced by documentId — never inline.return Promise.all(- parsed.data.criteria.slice(0, params.maxCriteria).map(async (c) => {+ withoutProgrammaticTests(parsed.data.criteria.slice(0, params.maxCriteria)).map(async (c) => {let documentId: string | null = null;if (c.instruction) {const doc = await this.documentModel.create({diff --git a/apps/server/src/services/verify/prompts.ts b/apps/server/src/services/verify/prompts.tsindex 81583e319b9..f3f656f2e88 100644--- a/apps/server/src/services/verify/prompts.ts+++ b/apps/server/src/services/verify/prompts.ts@@ -1,7 +1,7 @@import type { VerifyCheckItem, VerifyEvidenceType } from '@lobechat/types';/** Bump when the plan-gen prompt meaningfully changes (tracing partition key). */-export const VERIFY_PLAN_PROMPT_VERSION = '2';+export const VERIFY_PLAN_PROMPT_VERSION = '3';/** Bump when the judge prompt meaningfully changes. */export const VERIFY_JUDGE_PROMPT_VERSION = '2';/** Bump when the report prompt meaningfully changes. */@@ -27,7 +27,9 @@ export const buildPlanPrompt = ({'Given the run goal, propose a concise set of verification criteria — each a single pass/fail standard that determines whether the delivered work satisfies the user’s explicit requirements.','Guidelines:',`- Propose at most ${maxCriteria} criteria. Fewer, sharper criteria are better than many vague ones.`,+ '- Every criterion must be an outcome the USER can judge — what the delivery does, shows, or produces. Never propose the repo’s own programmatic gates as criteria: unit / integration / regression tests, test suites, coverage, type-checks, lint, or a clean build. Those are preconditions of shipping, not acceptance items, and they are dropped before the acceptance page renders.','- First enumerate every deliverable and artifact needed to prove the criterion. Put each one in requiredEvidence with its type, semantic modality, source scope, and a concrete capture hint. Use [] only when the final text answer alone is sufficient.',+ '- requiredEvidence types: screenshot / gif / video for what the user sees, audio for a delivered sound (TTS output, a voice reply, an alert tone), text / markdown / dom_snapshot / transcript otherwise. A deliverable the user listens to needs audio evidence — describing it in prose does not prove it.','- Choose verifierType: "llm" only when all required evidence is inline text, or a single image modality that a multimodal judge can directly inspect. Choose "agent" whenever evidence spans multiple modalities/files, requires opening a document or attachment, exceeds a normal prompt, or needs active investigation. Choose "program" only for strictly deterministic command checks.','- Set required=true when failing the criterion must block delivery; false for nice-to-have improvements.','- Set onFail="auto_repair" when a failure can be fixed by re-running the agent with guidance; otherwise "manual".',diff --git a/apps/server/src/services/verify/schema.ts b/apps/server/src/services/verify/schema.tsindex 87aacd2bc01..4d1ce37838f 100644--- a/apps/server/src/services/verify/schema.ts+++ b/apps/server/src/services/verify/schema.ts@@ -11,6 +11,7 @@ const evidenceTypeEnum = ['screenshot','gif','video',+ 'audio','text','markdown','dom_snapshot',diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex d6f4df19263..03e15d2e136 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -67,6 +67,7 @@"artifact.thinking": "Thinking","artifact.thought": "Thought process","artifact.unknownTitle": "Untitled Work",+ "audioPlayer.download": "Download audio","audioPlayer.pause": "Pause audio","audioPlayer.play": "Play audio","availableAgents": "Available Agents",diff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex 46e7746b0cb..917ac0549c4 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -19,6 +19,8 @@"acceptance.banner.rejected": "Rejected","acceptance.banner.rejectedHint": "The next verification round re-opens this acceptance when it lands.","acceptance.banner.rejectedReason": "Reason: {{reason}}",+ "acceptance.bar.addComment": "Add note",+ "acceptance.bar.addCommentDescription": "A delivery-wide note for what the queued feedback misses — the next verification round reads it.","acceptance.bar.copied": "Copied — paste it to any agent to start the repair.","acceptance.bar.copyReview": "Copy review prompt","acceptance.bar.feedback": "Feedback {{count}}",@@ -78,6 +80,7 @@"acceptance.detail.suggestion": "Suggestion","acceptance.error.description": "Check your connection and try loading this acceptance again.","acceptance.error.title": "Unable to load acceptance",+ "acceptance.evidence.audio": "{{count}} audio evidence item(s)","acceptance.evidence.empty": "No evidence artifacts were submitted for this check in this round — only the verifier’s recorded observation.","acceptance.evidence.file": "{{count}} text evidence item(s)","acceptance.evidence.image": "{{count}} image evidence item(s)",@@ -321,6 +324,7 @@"report.document.view": "View document","report.error.description": "The report could not be loaded. Check your connection and try again.","report.error.title": "Unable to load report",+ "report.evidence.category.audio": "Audio","report.evidence.category.file": "File","report.evidence.category.image": "Image","report.evidence.category.video": "Video",@@ -330,6 +334,7 @@"report.evidence.count": "{{count}} evidence","report.evidence.expand": "Expand","report.evidence.inlineFallback": "Inline evidence {{index}}",+ "report.evidence.medium.audio": "Audio","report.evidence.medium.dom_snapshot": "DOM snapshot","report.evidence.medium.gif": "GIF","report.evidence.medium.markdown": "Markdown",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex b7d82b4dd49..236072966d3 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -67,6 +67,7 @@"artifact.thinking": "思考中","artifact.thought": "思考过程","artifact.unknownTitle": "未命名作品",+ "audioPlayer.download": "下载音频","audioPlayer.pause": "暂停音频","audioPlayer.play": "播放音频","availableAgents": "可用助理",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex e062e2a4d20..86fae1fd6d1 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -19,6 +19,8 @@"acceptance.banner.rejected": "已打回","acceptance.banner.rejectedHint": "下一轮验证完成后将重新回到待验收","acceptance.banner.rejectedReason": "打回意见:{{reason}}",+ "acceptance.bar.addComment": "补充评论",+ "acceptance.bar.addCommentDescription": "面向整个交付的补充说明,不局限于单个检查项——下一轮验证会读取。","acceptance.bar.copied": "已复制,粘贴给任意 agent 即可开始修复。","acceptance.bar.copyReview": "复制 review 建议","acceptance.bar.feedback": "反馈 {{count}}",@@ -78,6 +80,7 @@"acceptance.detail.suggestion": "建议","acceptance.error.description": "请检查网络连接后重试。","acceptance.error.title": "无法加载验收信息",+ "acceptance.evidence.audio": "{{count}} 项音频证据","acceptance.evidence.empty": "该检查项本轮未提交证据材料,仅有验证方记录的结论。","acceptance.evidence.file": "{{count}} 份文本证据","acceptance.evidence.image": "{{count}} 份图片证据",@@ -321,6 +324,7 @@"report.document.view": "查看文档","report.error.description": "报告加载失败,请检查网络后重试。","report.error.title": "无法加载报告",+ "report.evidence.category.audio": "音频","report.evidence.category.file": "文件","report.evidence.category.image": "图片","report.evidence.category.video": "视频",@@ -330,6 +334,7 @@"report.evidence.count": "{{count}} 条证据","report.evidence.expand": "展开全部","report.evidence.inlineFallback": "内联证据 {{index}}",+ "report.evidence.medium.audio": "音频","report.evidence.medium.dom_snapshot": "DOM 快照","report.evidence.medium.gif": "GIF","report.evidence.medium.markdown": "Markdown",diff --git a/packages/builtin-skills/src/acceptance/SKILL.md b/packages/builtin-skills/src/acceptance/SKILL.mdindex 550c29b089c..7cc007f182b 100644--- a/packages/builtin-skills/src/acceptance/SKILL.md+++ b/packages/builtin-skills/src/acceptance/SKILL.md@@ -72,6 +72,38 @@ On the first ingest, always supply `--requirement "<one-sentence business goal>"The requirement describes what the whole acceptance judges, not the narrowerscope of one round. It is immutable once recorded.+## HARD RULE — programmatic gates are NEVER acceptance checks++This is a binding constraint on every check you author, enforced at ingest —+not a style preference.++Every check MUST be an outcome a **person decides about the delivery**: what+the user sees, hears, reads, or receives. The repo's own automated gates are+not that. The following MUST NOT appear as a check, in any round, under any+phrasing:++- unit / integration / regression / snapshot tests; test suites or test cases+- coverage, `type-check` / `tsc`, lint / `eslint`, format, "compiles cleanly",+ "build passes", "CI is green"++They are preconditions of shipping, and a page full of them buries the two or+three checks that actually needed a human eye. Run them — then report them as+**one line of narrative**, never as a check.++Enforcement, so plan around it rather than against it:++- `lh acceptance run ingest` **drops** every matching plan item and case and+ warns — the round publishes without them, so a gate-check wastes the effort+ spent producing it.+- A round consisting **only** of such checks **fails to publish entirely**:+ there is nothing in it for a person to accept.++The line is the _subject_ of the check, not who judged it: a CLI behavior check+asserted by a command is a good acceptance item (`verifier: "program"`);+"`bun run test` is green" is not. Before writing any plan, re-read each draft+check and ask: _would the user click accept/reject on this?_ If the honest+answer is "it's a gate", it does not go in.+## Rounds are immutable — repair means a NEW roundA published round is a permanent record of what was true at that moment. **Never@@ -107,8 +139,10 @@ stay internal.## Step 1 — Discover the plan (what to prove)-> Plan-driven path only. Authoring your own checks instead? Jump to-> [references/report.md](references/report.md), then use the relevant surface+> Plan-driven path only. Authoring your own checks instead? Apply the+> [hard rule](#hard-rule--programmatic-gates-are-never-acceptance-checks) to+> every check you write, then jump to+> [references/report.md](references/report.md) and use the relevant surface> recipes below to capture its evidence. Publish that authored plan and its> cases together with `lh acceptance run ingest`.@@ -146,8 +180,11 @@ the cheapest surface that can actually prove it, and escalate only if needed:Rules of thumb:- **Don't open a browser for a backend change.** If a criterion is satisfied by a- command's output or a test passing, capture that as `text` — it's the strongest,- cheapest proof.+ command's output, capture that as `text` — it's the strongest, cheapest proof.+- **A deliverable the user hears needs `audio`.** TTS output, a voice reply, an+ alert tone: upload the clip itself so the page renders a player. Prose about a+ sound, or a screenshot of a waveform, proves nothing.+ See [references/evidence.md](references/evidence.md#audio-deliverables).- **Web vs Electron:** use **web** when the behavior is identical in a normalbrowser against the app's dev server or deployed URL. Use **Electron** only whenthe criterion depends on desktop-only behavior (native windows, IPC, thediff --git a/packages/builtin-skills/src/acceptance/references/evidence.md b/packages/builtin-skills/src/acceptance/references/evidence.mdindex 1afba8037e3..72538ec9923 100644--- a/packages/builtin-skills/src/acceptance/references/evidence.md+++ b/packages/builtin-skills/src/acceptance/references/evidence.md@@ -9,15 +9,43 @@ instructions merely to learn how to submit an artifact.| Type | Use when || -------------- | ------------------------------------------------------------------------------------------------- || `text` | Command output, logs, focused request/response data, or computed assertions prove the criterion |+| `markdown` | Reviewer-facing prose (a reasoning write-up, structured findings) should render as body text || `dom_snapshot` | Structured content is stronger and smaller than pixels || `screenshot` | A settled visual state, layout, or native rendering is the claim || `gif` | A short temporal state should render inline, usually no more than about 10 seconds || `video` | A longer animation, transition, gesture, or multi-step flow needs a player and better compression |+| `audio` | The deliverable is something the user **hears** — TTS output, a voice reply, an alert tone || `transcript` | A conversation, event stream, or request log is itself the proof |The declared `requiredEvidence` type is binding. Do not replace a required videowith a final screenshot or a required DOM snapshot with prose.+## Audio deliverables++A sound cannot be verified in prose, and a waveform screenshot proves only that+a file exists. Upload the clip itself with `--type audio` and the acceptance+page gives the reviewer a player.++```bash+# The generated file is the evidence — attach the artifact the feature produced,+# not a re-encode and not a screenshot of the player.+lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" \+ --type audio --file ./out/tts-zh-female.mp3 --by program \+ --desc "TTS output for 「今天天气不错」, zh-CN female voice, 2.4s"+```++- `mp3` / `wav` / `m4a` / `aac` / `flac` / `ogg` / `opus` are recognized by+ extension, so `acceptance run ingest` types them as `audio` automatically.+- **Listen before citing it.** Confirm the clip is non-silent and is the right+ content (duration + a transcription pass, or a spectral check) — an empty or+ truncated file looks identical to a good one in the file list.+- Pair the clip with a short `text` artifact when the claim is about _what was+ said_ (the input text, the voice/model, the measured duration). The player+ proves it plays; the text artifact makes it auditable.+- Capture what the product produced. A screen recording with system audio is a+ fallback for "the UI plays it at the right moment" — for "the output is+ correct", attach the file itself.+## Dual text evidence for non-visual behaviorCLI, API, backend, policy, security, and migration claims normally need twodiff --git a/packages/builtin-skills/src/acceptance/references/report.md b/packages/builtin-skills/src/acceptance/references/report.mdindex 4c789da5419..95212e9b9e2 100644--- a/packages/builtin-skills/src/acceptance/references/report.md+++ b/packages/builtin-skills/src/acceptance/references/report.md@@ -89,6 +89,10 @@ Any directory works — no repo convention required:supersedes? }`.A planned item that never produces a case renders as **未执行** rather thanvanishing — cut coverage in the open.+ **HARD RULE: every item must be an outcome the reader can judge.** Never+ plan a programmatic gate (tests / type-check / lint / build) as a check —+ ingest drops them, and a gates-only round fails to publish. See+ [what is not an acceptance check](#hard-rule--what-is-not-an-acceptance-check).2. **Collect evidence into `assets/` as you test.** Screenshots/charts must be**visually verified with the Read tool before being cited** — never cite animage you haven't looked at. Numeric results worth seeing (loss curves,@@ -172,16 +176,47 @@ Optional fields: `branch` / `commit` / `pullRequest` (provenance line; when### Closed vocabularies — the pipeline acts on these, they are not labels-| field | values | what it does |-| ------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |-| `verifier` | `program` \| `agent` \| `llm` (default `agent`) | How the verdict is reached. A command-asserted check is `program`; calling it `agent` hides what actually judged it. |-| `requiredEvidence` | `screenshot` \| `gif` \| `video` \| `text` \| `dom_snapshot` \| `transcript` | The artifact this check **must** produce. The coverage gate **fails** an item whose required medium is missing. |-| `surfaces` / per-case `surface` | `web` \| `desktop` \| `cli` \| `mobile` \| `bot` (`electron` → `desktop`) | The product surface a check ran **on**. A test kind (`unit`, `backend`) or runtime mode is not a surface. |+| field | values | what it does |+| ------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |+| `verifier` | `program` \| `agent` \| `llm` (default `agent`) | How the verdict is reached. A command-asserted check is `program`; calling it `agent` hides what actually judged it. |+| `requiredEvidence` | `screenshot` \| `gif` \| `video` \| `audio` \| `text` \| `markdown` \| `dom_snapshot` \| `transcript` | The artifact this check **must** produce. The coverage gate **fails** an item whose required medium is missing. |+| `surfaces` / per-case `surface` | `web` \| `desktop` \| `cli` \| `mobile` \| `bot` (`electron` → `desktop`) | The product surface a check ran **on**. A test kind (`unit`, `backend`) or runtime mode is not a surface. |`category` names the user-facing requirement area (e.g. `Task hierarchy`,`Rate-limit recovery`) — never a technical surface. `method` / `expected` stayfree prose; they render under the check next to the outcome.+### HARD RULE — what is not an acceptance check++An acceptance check is something a **person decides about the delivery**. The+repo's own automated gates are not that, and they are actively harmful on the+page: twenty green "unit tests pass" rows bury the two checks that actually+needed someone to look.++**These MUST NOT appear as `plan[]` / `cases[]` items, under any phrasing:**++| Not a check | Where it belongs |+| ---------------------------------------------------------- | ---------------------------------------------------- |+| Unit / integration / regression / snapshot tests, coverage | one line in `report.md` → **Verification** |+| `type-check`, `tsc`, `eslint`, lint, format, a clean build | same — a precondition of shipping, not a deliverable |+| "the test suite is green", "CI passes" | same |++This is enforced, not advisory. `lh acceptance run ingest` **drops every+matching item** — matched on title, category, AND `method`, so writing+"run `bun run test`" into `method` under a product-sounding title still+matches — warns with the dropped ids, and recounts `summary` from the checks+that remain. A round consisting **only** of such checks **fails to publish**.+Either way, a gate written as a check is effort spent proving something nobody+accepts: apply the rule at plan time, before the first case runs.++The line is the _subject_ of the check, not who judged it: a CLI behavior check+asserted by a command is a fine acceptance item (`verifier: "program"`). "Run+`bun run test`" is not.++**What IS an acceptance check:** what the user sees, hears, reads, or receives —+a rendered screen, a produced file, an API response shape a client depends on,+an audio clip that actually plays, a failure state that recovers.+### Before/after comparison pairsThe page renders a complete pair under tinted bands (red `before`, greendiff --git a/packages/builtin-tool-lobe-delivery-checker/src/manifest.test.ts b/packages/builtin-tool-lobe-delivery-checker/src/manifest.test.tsnew file mode 100644index 00000000000..1a315952c33--- /dev/null+++ b/packages/builtin-tool-lobe-delivery-checker/src/manifest.test.ts@@ -0,0 +1,20 @@+import { verifyEvidenceTypes } from '@lobechat/const/verify';+import { describe, expect, it } from 'vitest';++import { LobeDeliveryCheckerManifest } from './manifest';++/** Walk the manifest schema for the requiredEvidence `type` enum. */+const evidenceTypeEnum = (): string[] => {+ const api = LobeDeliveryCheckerManifest.api.find((a) => a.name === 'generateVerifyPlan');+ const criteria = (api?.parameters?.properties as any)?.criteria;+ return criteria?.items?.properties?.requiredEvidence?.items?.properties?.type?.enum ?? [];+};++describe('generateVerifyPlan manifest schema', () => {+ it('accepts every evidence medium the verify pipeline knows', () => {+ // Regression: the systemRole told the model to require `audio` for sound+ // deliverables while this enum still rejected it — argument validation+ // killed the plan before the audio-aware server runtime was ever reached.+ expect(evidenceTypeEnum()).toEqual([...verifyEvidenceTypes]);+ });+});diff --git a/packages/builtin-tool-lobe-delivery-checker/src/manifest.ts b/packages/builtin-tool-lobe-delivery-checker/src/manifest.tsindex 6ed113f2e4b..4d15665fc07 100644--- a/packages/builtin-tool-lobe-delivery-checker/src/manifest.ts+++ b/packages/builtin-tool-lobe-delivery-checker/src/manifest.ts@@ -71,6 +71,7 @@ export const LobeDeliveryCheckerManifest: BuiltinToolManifest = {'screenshot','gif','video',+ 'audio','text','markdown','dom_snapshot',diff --git a/packages/builtin-tool-lobe-delivery-checker/src/systemRole.ts b/packages/builtin-tool-lobe-delivery-checker/src/systemRole.tsindex f60a648ba8c..cfcca06dda0 100644--- a/packages/builtin-tool-lobe-delivery-checker/src/systemRole.ts+++ b/packages/builtin-tool-lobe-delivery-checker/src/systemRole.ts@@ -5,10 +5,11 @@ For a task that produces a **deliverable** (writing code, editing files, produciFirst enumerate all deliverables and associated artifacts that must be inspected. Then enumerate the concrete checks the deliverable must satisfy and pass them as \`criteria\` (one entry per check), with \`title\` set to the user's task/goal. Derive the criteria from the user's explicit requirements — **each requirement becomes one criterion**. For each criterion:- \`title\`: the single, concrete pass/fail standard (short).- \`instruction\`: a **detailed, fine-grained judging rubric** — the exact pass conditions, what counts as a fail, the concrete evidence the judge must find, and edge cases. Write it thoroughly, not a one-liner; the judge relies entirely on it.-- \`requiredEvidence\`: every required artifact with its evidence \`type\`, semantic \`modality\`, source \`scope\`, and a concrete capture \`hint\`. Use an empty array only when the final text response alone is sufficient.+- \`requiredEvidence\`: every required artifact with its evidence \`type\`, semantic \`modality\`, source \`scope\`, and a concrete capture \`hint\`. Use an empty array only when the final text response alone is sufficient. Pick the medium the deliverable actually is: \`screenshot\` / \`gif\` / \`video\` for what the user sees, \`audio\` for a delivered sound (TTS output, a voice reply, an alert tone), \`text\` / \`markdown\` / \`dom_snapshot\` / \`transcript\` otherwise.- \`verifierType\`: \`llm\` only for inline text or a single image modality a multimodal judge can directly inspect; \`agent\` for documents, attachments, multiple files/modalities, large context, or active investigation.- \`required\`: \`true\` when the check must pass to deliver, \`false\` when it is optional/advisory.+- **Never propose the repo's own programmatic gates as criteria** — unit / integration / regression tests, test suites, coverage, type-checks, lint, or a clean build. They are preconditions of shipping, not things a person accepts, and an acceptance page full of them buries the checks that needed a human eye. Mention them in your own summary instead.- The user reviews and confirms the proposed checks; on confirmation they are persisted and the checks run **automatically** when the operation completes. You do **not** run the checks yourself.- **Skip it** for simple questions, lookups, or chit-chat with no deliverable, or when you cannot identify any concrete check.- After calling it, continue with the task normally — do not wait or ask the user about the checks.diff --git a/packages/builtin-tool-lobe-delivery-checker/vitest.config.mts b/packages/builtin-tool-lobe-delivery-checker/vitest.config.mtsnew file mode 100644index 00000000000..9e935ef21d1--- /dev/null+++ b/packages/builtin-tool-lobe-delivery-checker/vitest.config.mts@@ -0,0 +1,18 @@+import path from 'node:path';+import { fileURLToPath } from 'node:url';++import { defineConfig } from 'vitest/config';++const packageDir = path.dirname(fileURLToPath(import.meta.url));+const repoRoot = path.resolve(packageDir, '../..');++export default defineConfig({+ resolve: {+ alias: {+ '@': path.resolve(repoRoot, 'src'),+ },+ },+ test: {+ environment: 'happy-dom',+ },+});diff --git a/packages/const/src/verify.test.ts b/packages/const/src/verify.test.tsindex f213644c4df..3de211668ad 100644--- a/packages/const/src/verify.test.ts+++ b/packages/const/src/verify.test.ts@@ -34,7 +34,7 @@ import type {verifyUserDecisions,verifyVerdicts,} from './verify';-import { normalizeVerifySurface } from './verify';+import { isProgrammaticTestCheck, normalizeVerifySurface } from './verify';/*** `@lobechat/types` declares these unions independently — it cannot import them@@ -87,3 +87,55 @@ describe('normalizeVerifySurface', () => {expect(normalizeVerifySurface('packaged build')).toBeNull();});});++describe('isProgrammaticTestCheck', () => {+ it('catches the repo test suites and static gates that clutter an acceptance page', () => {+ expect(isProgrammaticTestCheck('单元测试全部通过')).toBe(true);+ expect(isProgrammaticTestCheck('Unit tests pass')).toBe(true);+ expect(isProgrammaticTestCheck('新增回归测试覆盖该分支')).toBe(true);+ expect(isProgrammaticTestCheck('Type-check is clean')).toBe(true);+ expect(isProgrammaticTestCheck('No new eslint errors')).toBe(true);+ expect(isProgrammaticTestCheck('Integration test suite is green')).toBe(true);+ });++ it('catches the ordinary phrasings the docs name, not only runner/kind keywords', () => {+ // Regression (codex review): these documented gate labels slipped through,+ // so a gates-only round written in plain words still published.+ expect(isProgrammaticTestCheck('All tests pass')).toBe(true);+ expect(isProgrammaticTestCheck('Tests are green')).toBe(true);+ expect(isProgrammaticTestCheck('Build passes')).toBe(true);+ expect(isProgrammaticTestCheck('CI passes')).toBe(true);+ expect(isProgrammaticTestCheck('CI is green')).toBe(true);+ expect(isProgrammaticTestCheck('Formatting is clean')).toBe(true);+ expect(isProgrammaticTestCheck('质量保障', undefined, 'bun run check --test')).toBe(true);+ });++ it('reads the method too — the give-away is often in the how, not the what', () => {+ expect(+ isProgrammaticTestCheck('Topic list stays ordered', undefined, 'bun run test topicList'),+ ).toBe(true);+ expect(+ isProgrammaticTestCheck('Coverage does not regress', 'Quality', 'vitest --coverage'),+ ).toBe(true);+ });++ it('leaves real acceptance checks alone, including command-asserted ones', () => {+ // `program` verifier ≠ programmatic-test check: the subject here is product+ // behavior, and the command is only how it was observed.+ expect(isProgrammaticTestCheck('lh task list --tree returns nested children')).toBe(false);+ expect(isProgrammaticTestCheck('The client reconnects after a dropped socket')).toBe(false);+ expect(isProgrammaticTestCheck('TTS output plays in the reply bubble')).toBe(false);+ expect(isProgrammaticTestCheck('Rejecting a check re-tasks the next round')).toBe(false);+ });++ it('does not fire on a word that merely contains a gate name', () => {+ expect(isProgrammaticTestCheck('The client list renders 200 rows')).toBe(false);+ expect(isProgrammaticTestCheck('Unit price is formatted as currency')).toBe(false);+ expect(isProgrammaticTestCheck('Latest run wins')).toBe(false);+ });++ it('is false for an empty or absent name', () => {+ expect(isProgrammaticTestCheck()).toBe(false);+ expect(isProgrammaticTestCheck('', undefined, null)).toBe(false);+ });+});diff --git a/packages/const/src/verify.ts b/packages/const/src/verify.tsindex bae40abadcf..d2c54bce4f0 100644--- a/packages/const/src/verify.ts+++ b/packages/const/src/verify.ts@@ -124,6 +124,66 @@ export const normalizeVerifySurface = (value: string): VerifySurface | null => {return VERIFY_SURFACE_ALIASES[key] ?? null;};+/**+ * Names of the repo's own automated test suites and static-analysis gates. A+ * check built on one of these is a *precondition of shipping*, not something a+ * human accepts: "138 unit tests pass" tells the reviewer nothing about whether+ * the delivery is right, and a page full of them buries the two or three checks+ * that actually needed a person to look.+ *+ * ASCII entries match on word boundaries (so `lint` never fires on `client`);+ * CJK entries match as plain substrings, which is how those words are written.+ */+const PROGRAMMATIC_TEST_PATTERNS: RegExp[] = [+ // test kinds+ /\bunit[\s-]?tests?\b/i,+ /\bintegration[\s-]?tests?\b/i,+ /\bregression[\s-]?tests?\b/i,+ /\bsnapshot[\s-]?tests?\b/i,+ /\btest[\s-]?(?:suite|case)s?\b/i,+ /\bcode coverage\b|\btest coverage\b/i,+ // "the tests pass" in its ordinary phrasings — the subject is the suite even+ // when no runner or kind is named ("All tests pass", "tests are green").+ /\btests?\s+(?:pass(?:es|ed|ing)?|(?:are\s+|is\s+)?green)\b/i,+ // runners+ /\b(?:vitest|jest|mocha|pytest|junit|rspec|phpunit|karma|ava)\b/i,+ /\b(?:npm|pnpm|yarn|bun|bunx|go|cargo|make)\s+(?:run\s+)?tests?\b/i,+ // this repo's own composite gate ("bun run check", with or without flags)+ /\b(?:npm|pnpm|yarn|bun|bunx)\s+run\s+check\b/i,+ // static analysis / build / CI gates+ /\btype[\s-]?check(?:s|ing)?\b/i,+ /\b(?:tsc|tsgo|eslint|stylelint|prettier|biome|ruff|mypy|clippy)\b/i,+ /\blint(?:s|ing)?\b/i,+ /\bcompiles?\s+(?:cleanly|without errors)\b/i,+ /\bbuild\s+(?:pass(?:es|ed)?|succeed(?:s|ed)?|(?:is\s+)?(?:green|clean))\b/i,+ /\bci\s+(?:is\s+)?(?:pass(?:es|ed|ing)?|green)\b/i,+ /\bformat(?:ting)?\s+(?:is\s+)?(?:clean|correct)\b/i,+ // Chinese+ /单元测试|单测|集成测试|回归测试|类型检查|类型校验|测试覆盖率|代码覆盖率|静态检查|测试用例全部通过/,+];++/**+ * Whether a proposed acceptance check is really one of the repo's programmatic+ * test / static-analysis gates rather than a delivery outcome a person accepts.+ *+ * Pass every field that names the check — title, category, and the plan item's+ * `method` — because the give-away is as often in the how ("run `bun run test`")+ * as in the what.+ *+ * This does NOT mean "the verifier is a program": a CLI behavior check asserted+ * by a command is a perfectly good acceptance item. It means the *subject* of+ * the check is the test suite itself.+ */+export const isProgrammaticTestCheck = (...fields: (string | null | undefined)[]): boolean => {+ const text = fields.filter(Boolean).join(' \n ');+ if (!text.trim()) return false;+ return PROGRAMMATIC_TEST_PATTERNS.some((pattern) => pattern.test(text));+};++/** Why a programmatic-test check was dropped — shared by every surface that drops one. */+export const PROGRAMMATIC_TEST_CHECK_HINT =+ 'Unit / integration tests, type-checks and lint gates are preconditions of shipping, not acceptance items — they are noise on the acceptance page. Report them in the narrative (report.md) instead, and keep the checks for outcomes a person can judge.';+/*** The product object being accepted. Kept polymorphic so the acceptance aggregate* is not coupled to task-only workflows: a future run can accept a topic,@@ -179,6 +239,10 @@ export const verifyEvidenceTypes = ['screenshot','gif','video',+ // A delivered or captured sound: TTS output, a recorded voice reply, an+ // alert tone. Plays inline on the acceptance page — without it, audio+ // deliverables could only be published as an unplayable "text" blob.+ 'audio','text',// Prose evidence (root-cause write-ups, structured findings) — rendered as// body markdown instead of the monospace raw-text box `text` gets.diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex db8e3e27ad2..dbe8820df94 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -1,6 +1,7 @@export default {'ModelSwitch.title': 'Model','active': 'Active',+ 'audioPlayer.download': 'Download audio','audioPlayer.pause': 'Pause audio','audioPlayer.play': 'Play audio','agentBuilder.installPlugin.authRequired': 'Cloud MCP requires sign-in to continue',diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex d83d279ec4c..f44cb1692a8 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -26,6 +26,9 @@ export default {'acceptance.banner.rejectedHint':'The next verification round re-opens this acceptance when it lands.','acceptance.banner.rejectedReason': 'Reason: {{reason}}',+ 'acceptance.bar.addComment': 'Add note',+ 'acceptance.bar.addCommentDescription':+ 'A delivery-wide note for what the queued feedback misses — the next verification round reads it.','acceptance.bar.copied': 'Copied — paste it to any agent to start the repair.','acceptance.bar.copyReview': 'Copy review prompt','acceptance.bar.feedback': 'Feedback {{count}}',@@ -68,6 +71,7 @@ export default {'acceptance.error.title': 'Unable to load acceptance','acceptance.evidence.empty':'No evidence artifacts were submitted for this check in this round — only the verifier’s recorded observation.',+ 'acceptance.evidence.audio': '{{count}} audio evidence item(s)','acceptance.evidence.file': '{{count}} text evidence item(s)','acceptance.evidence.image': '{{count}} image evidence item(s)','acceptance.evidence.video': '{{count}} video evidence item(s)',@@ -365,6 +369,7 @@ export default {'report.error.description':'The report could not be loaded. Check your connection and try again.','report.error.title': 'Unable to load report',+ 'report.evidence.category.audio': 'Audio','report.evidence.category.file': 'File','report.evidence.category.image': 'Image','report.evidence.category.video': 'Video',@@ -414,6 +419,7 @@ export default {'report.overview.title': 'Check overview','report.overview.total': 'All','report.overview.uncertain': 'Uncertain',+ 'report.evidence.medium.audio': 'Audio','report.evidence.medium.dom_snapshot': 'DOM snapshot','report.evidence.medium.gif': 'GIF','report.evidence.medium.markdown': 'Markdown',diff --git a/packages/types/src/verify.ts b/packages/types/src/verify.tsindex 00a1620c783..1e12d9a9332 100644--- a/packages/types/src/verify.ts+++ b/packages/types/src/verify.ts@@ -262,9 +262,13 @@ export type VerifyRunScenario = 'coding' | 'writing' | 'research' | 'generic';*/export type VerifySurface = 'web' | 'desktop' | 'cli' | 'mobile' | 'bot';-/** The medium of a captured evidence artifact. */+/**+ * The medium of a captured evidence artifact. `audio` covers a delivered or+ * captured sound (TTS output, a recorded voice reply, an alert tone) — it plays+ * inline on the acceptance page instead of publishing as an unplayable blob.+ */export type VerifyEvidenceType =- 'screenshot' | 'gif' | 'video' | 'text' | 'markdown' | 'dom_snapshot' | 'transcript';+ 'screenshot' | 'gif' | 'video' | 'audio' | 'text' | 'markdown' | 'dom_snapshot' | 'transcript';/** Who / what captured an evidence artifact (provenance). */export type VerifyEvidenceCapturedBy = 'agent-browser' | 'cdp' | 'cli' | 'program' | 'llm_judge';diff --git a/src/features/Conversation/Messages/User/components/AudioPlayer/index.tsx b/src/features/AudioPlayer/index.tsxsimilarity index 66%rename from src/features/Conversation/Messages/User/components/AudioPlayer/index.tsxrename to src/features/AudioPlayer/index.tsxindex 4bdb4f55424..0218171a6a1 100644--- a/src/features/Conversation/Messages/User/components/AudioPlayer/index.tsx+++ b/src/features/AudioPlayer/index.tsx@@ -2,7 +2,7 @@import { Icon } from '@lobehub/ui';import { createStaticStyles } from 'antd-style';-import { PauseIcon, PlayIcon } from 'lucide-react';+import { DownloadIcon, PauseIcon, PlayIcon } from 'lucide-react';import { memo, type MouseEvent, useCallback, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -59,6 +59,30 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFillQuaternary};`,+ download: css`+ cursor: pointer;++ display: flex;+ flex: none;+ align-items: center;+ justify-content: center;++ width: 28px;+ height: 28px;+ border: none;+ border-radius: 6px;++ color: ${cssVar.colorTextTertiary};++ background: transparent;++ transition: all 120ms ease;++ &:hover {+ color: ${cssVar.colorText};+ background: ${cssVar.colorFillSecondary};+ }+ `,time: css`flex: none;@@ -73,11 +97,16 @@ const styles = createStaticStyles(({ css, cssVar }) => ({waveform: css`cursor: pointer;+ overflow: hidden;display: flex;flex: 1;gap: 2px;align-items: center;+ /* The bars' intrinsic minimum (56 × min-width + gaps ≈ 222px) must never+ set the row's minimum — without this, adding any sibling (the download+ button) pushes the tail controls out of the rounded box. */+ min-width: 0;height: 32px;`,}));@@ -91,10 +120,17 @@ const formatTime = (seconds: number): string => {interface AudioPlayerProps {alt?: string;+ /** Download filename; also switches the download affordance on. */+ downloadFileName?: string;+ /**+ * Fill the host's width instead of the chat bubble's fixed 360px — evidence+ * surfaces render the player as a block, not an inline attachment.+ */+ fullWidth?: boolean;url: string;}-const AudioPlayer = memo<AudioPlayerProps>(({ url, alt }) => {+const AudioPlayer = memo<AudioPlayerProps>(({ url, alt, downloadFileName, fullWidth }) => {const { t } = useTranslation('chat');const audioRef = useRef<HTMLAudioElement>(null);const [isPlaying, setIsPlaying] = useState(false);@@ -128,8 +164,27 @@ const AudioPlayer = memo<AudioPlayerProps>(({ url, alt }) => {[duration],);+ // Cross-origin sources (a signed S3 url) ignore the anchor `download`+ // attribute, so pull the bytes and hand out a same-origin object url — the+ // one route that saves with the intended filename instead of navigating.+ const handleDownload = useCallback(async () => {+ if (!downloadFileName) return;+ try {+ const res = await fetch(url);+ const blob = await res.blob();+ const objectUrl = URL.createObjectURL(blob);+ const anchor = document.createElement('a');+ anchor.href = objectUrl;+ anchor.download = downloadFileName;+ anchor.click();+ URL.revokeObjectURL(objectUrl);+ } catch {+ window.open(url, '_blank', 'noopener');+ }+ }, [url, downloadFileName]);+return (- <div className={styles.container}>+ <div className={styles.container} style={fullWidth ? { width: '100%' } : undefined}><audiopreload={'metadata'}ref={audioRef}@@ -164,6 +219,17 @@ const AudioPlayer = memo<AudioPlayerProps>(({ url, alt }) => {})}</div><span className={styles.time}>{formatTime(currentTime || duration)}</span>+ {downloadFileName && (+ <button+ aria-label={t('audioPlayer.download')}+ className={styles.download}+ title={t('audioPlayer.download')}+ type={'button'}+ onClick={() => void handleDownload()}+ >+ <Icon icon={DownloadIcon} size={15} />+ </button>+ )}</div>);});diff --git a/src/features/Conversation/Messages/User/components/AudioPlayer/useWaveform.ts b/src/features/AudioPlayer/useWaveform.tssimilarity index 100%rename from src/features/Conversation/Messages/User/components/AudioPlayer/useWaveform.tsrename to src/features/AudioPlayer/useWaveform.tsdiff --git a/src/features/Conversation/Messages/User/components/AudioFileListViewer.tsx b/src/features/Conversation/Messages/User/components/AudioFileListViewer.tsxindex 7c1f9e16802..f8d48f75f51 100644--- a/src/features/Conversation/Messages/User/components/AudioFileListViewer.tsx+++ b/src/features/Conversation/Messages/User/components/AudioFileListViewer.tsx@@ -1,10 +1,9 @@import { Flexbox } from '@lobehub/ui';import { memo } from 'react';+import AudioPlayer from '@/features/AudioPlayer';import { type ChatAudioItem } from '@/types/index';-import AudioPlayer from './AudioPlayer';-interface AudioFileListViewerProps {items: ChatAudioItem[];}diff --git a/src/features/Verify/Acceptance/CheckList.test.ts b/src/features/Verify/Acceptance/CheckList.test.tsindex 84cc63f1382..00a9f88bf16 100644--- a/src/features/Verify/Acceptance/CheckList.test.ts+++ b/src/features/Verify/Acceptance/CheckList.test.ts@@ -79,6 +79,16 @@ describe('hasVisualEvidence', () => {} as AcceptanceCheck),).toBe(false);});++ it('counts an audio clip as media, so a sound deliverable expands on open', () => {+ // The clip IS the deliverable — a row that stays collapsed hides the one+ // thing the reviewer has to listen to.+ expect(+ hasVisualEvidence({+ evidence: [{ fileUrl: 'https://example.com/tts.mp3', type: 'audio' }],+ } as AcceptanceCheck),+ ).toBe(true);+ });});describe('hasAnnotatableEvidence', () => {@@ -97,6 +107,14 @@ describe('hasAnnotatableEvidence', () => {} as AcceptanceCheck),).toBe(false);});++ it('does not offer region comments for audio — there is no image to circle', () => {+ expect(+ hasAnnotatableEvidence({+ evidence: [{ fileUrl: 'https://example.com/tts.mp3', type: 'audio' }],+ } as AcceptanceCheck),+ ).toBe(false);+ });});describe('mergeRejectComments', () => {diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsxindex b884428b3a9..f5ac5e4ad8b 100644--- a/src/features/Verify/Acceptance/CheckList.tsx+++ b/src/features/Verify/Acceptance/CheckList.tsx@@ -17,6 +17,7 @@ import { Button } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import dayjs from 'dayjs';import {+ AudioLines,BadgeCheck,Ban,Check,@@ -39,6 +40,7 @@ import {import { Fragment, memo, useState } from 'react';import { useTranslation } from 'react-i18next';+import AudioPlayer from '@/features/AudioPlayer';import type { AcceptanceBundle } from '@/services/verify';import {@@ -142,11 +144,15 @@ export const checkHeadMeta = (check: AcceptanceCheck) => {export const isException = (check: AcceptanceCheck) =>check.state === 'failed' || check.state === 'uncertain';-const VISUAL_EVIDENCE = new Set(['gif', 'screenshot', 'video']);-const ANNOTATABLE_EVIDENCE = new Set(['gif', 'screenshot']);+const IMAGE_EVIDENCE = new Set(['gif', 'screenshot']);+/** Rendered by a `<video>` / `<audio>` element rather than an image box. */+const PLAYER_EVIDENCE = new Set(['audio', 'video']);+/** Everything that shows or plays inline — the deliverable itself, not a log about it. */+const MEDIA_EVIDENCE = new Set([...IMAGE_EVIDENCE, ...PLAYER_EVIDENCE]);+const ANNOTATABLE_EVIDENCE = IMAGE_EVIDENCE;const isVisual = (item: AcceptanceEvidence) =>- Boolean(item.fileUrl) && VISUAL_EVIDENCE.has(item.type);+ Boolean(item.fileUrl) && MEDIA_EVIDENCE.has(item.type);export const hasVisualEvidence = (check: AcceptanceCheck) => check.evidence.some(isVisual);@@ -360,9 +366,10 @@ const styles = createStaticStyles(({ css }) => ({/** Evidence media counts for the collapsed row's right-side badges. */const evidenceCounts = (evidence: AcceptanceEvidence[]) => {- const counts = { file: 0, image: 0, video: 0 };+ const counts = { audio: 0, file: 0, image: 0, video: 0 };for (const item of evidence) {if (item.type === 'video' && item.fileUrl) counts.video += 1;+ else if (item.type === 'audio' && item.fileUrl) counts.audio += 1;else if (isVisual(item)) counts.image += 1;else counts.file += 1;}@@ -372,6 +379,7 @@ const evidenceCounts = (evidence: AcceptanceEvidence[]) => {const EVIDENCE_BADGES = [{ icon: Images, key: 'image', labelKey: 'acceptance.evidence.image' },{ icon: Film, key: 'video', labelKey: 'acceptance.evidence.video' },+ { icon: AudioLines, key: 'audio', labelKey: 'acceptance.evidence.audio' },{ icon: FileText, key: 'file', labelKey: 'acceptance.evidence.file' },] as const;@@ -386,6 +394,13 @@ const imageRatio = (item: AcceptanceEvidence): string | undefined =>const comparisonContent = (item: AcceptanceEvidence) =>item.type === 'video' ? (<video controls src={item.fileUrl!} style={{ display: 'block', width: '100%' }} />+ ) : item.type === 'audio' ? (+ <AudioPlayer+ fullWidth+ alt={item.description ?? item.fileName ?? item.type}+ downloadFileName={item.fileName ?? 'audio'}+ url={item.fileUrl!}+ />) : (<Imagepreview@@ -458,7 +473,21 @@ const EvidenceList = memo<{ evidence: AcceptanceEvidence[] }>(({ evidence }) =>{caption}</Flexbox>);- if (item.fileUrl && VISUAL_EVIDENCE.has(item.type))+ if (item.fileUrl && item.type === 'audio')+ return (+ <Flexbox gap={4} key={item.id} width={'100%'}>+ {/* The conversation's own waveform player — one audio dialect across+ the product, with the download the reviewer needs to keep the clip. */}+ <AudioPlayer+ fullWidth+ alt={item.description ?? item.fileName ?? item.type}+ downloadFileName={item.fileName ?? 'audio'}+ url={item.fileUrl}+ />+ {caption}+ </Flexbox>+ );+ if (item.fileUrl && IMAGE_EVIDENCE.has(item.type))return (<Flexbox gap={4} key={item.id} style={{ maxWidth: '100%', width: 'fit-content' }}>{/* The frame owns the border — the inner Image must not draw its@@ -739,7 +768,7 @@ const IterationTimeline = memo<{{step.evidence.length > 0 && (<Flexbox horizontal gap={8} wrap={'wrap'}>{step.evidence.map((item) =>- item.fileUrl && VISUAL_EVIDENCE.has(item.type) ? (+ item.fileUrl && IMAGE_EVIDENCE.has(item.type) ? (<Flexbox className={styles.evidenceImage} key={item.id}><Imagealt={item.description ?? item.type}@@ -749,6 +778,24 @@ const IterationTimeline = memo<{variant={'borderless'}/></Flexbox>+ ) : item.fileUrl && item.type === 'video' ? (+ // A player, never an <Image>: pointing an image box at an+ // mp4 renders a broken thumbnail, not the clip.+ <video+ controls+ key={item.id}+ src={item.fileUrl}+ style={{ borderRadius: 8, maxHeight: 160, maxWidth: 280 }}+ />+ ) : item.fileUrl && item.type === 'audio' ? (+ <div key={item.id} style={{ width: '100%' }}>+ <AudioPlayer+ fullWidth+ alt={item.description ?? item.type}+ downloadFileName={item.fileName ?? 'audio'}+ url={item.fileUrl}+ />+ </div>) : item.content ? (<divclassName={styles.evidenceText}diff --git a/src/features/Verify/Acceptance/DecisionBar.tsx b/src/features/Verify/Acceptance/DecisionBar.tsxindex add1f6427eb..c33970e08ce 100644--- a/src/features/Verify/Acceptance/DecisionBar.tsx+++ b/src/features/Verify/Acceptance/DecisionBar.tsx@@ -3,7 +3,15 @@import { Flexbox, Icon, Text } from '@lobehub/ui';import { Button } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';-import { BadgeCheck, CircleAlert, ListTodo, Loader2, RefreshCw, RotateCcw } from 'lucide-react';+import {+ BadgeCheck,+ CircleAlert,+ ListTodo,+ Loader2,+ MessageSquarePlus,+ RefreshCw,+ RotateCcw,+} from 'lucide-react';import { memo, useEffect, useRef } from 'react';import { useTranslation } from 'react-i18next';@@ -135,6 +143,8 @@ interface DecisionBarProps {/** Checks the user reviewed as needing a fix (待修复) — decided, not pending. */needsFixCount: number;onAccept: () => void;+ /** Record a global (uncategorized) comment for the next round. */+ onAddComment: () => void;/** Copy the hardcoded repair prompt for pasting to any agent. */onCopyReview: () => void;onOpenFeedback: () => void;@@ -172,6 +182,7 @@ const DecisionBar = memo<DecisionBarProps>(ignoredCount,needsFixCount,onAccept,+ onAddComment,onCopyReview,onOpenFeedback,onRejectComment,@@ -252,7 +263,7 @@ const DecisionBar = memo<DecisionBarProps>() : (<ProgressRing done={decidedCount} total={totalCount} />)}- <Flexbox gap={2} style={{ flex: 1, minWidth: 0 }}>+ <Flexbox gap={2} style={{ flex: '0 1 auto', minWidth: 0 }}><Text ellipsis strong style={{ fontSize: 14 }}>{statusText}</Text>@@ -263,7 +274,9 @@ const DecisionBar = memo<DecisionBarProps>()}</Flexbox>- {/* The clearing list — every note this round queues for the next one. */}+ {/* The clearing list — every note this round queues for the next one.+ Sits with the status reading on the left: it explains that reading,+ while the right side stays pure actions. */}{feedbackCount > 0 && (<Buttonicon={<Icon icon={ListTodo} />}@@ -276,6 +289,8 @@ const DecisionBar = memo<DecisionBarProps>(</Button>)}+ <div style={{ flex: 1, minWidth: 8 }} />+{/* A dispatched send-back (repairing) keeps the copy entry alive —the reviewer may still hand the prompt to another agent. Embedded,the composer beside it already receives the draft. */}@@ -300,6 +315,17 @@ const DecisionBar = memo<DecisionBarProps>({t('acceptance.bar.copyReview')}</Button>)}+ {/* Last words before the repair leaves — a global note the next+ round reads, for what the queued per-check feedback missed. */}+ <Button+ disabled={pending}+ icon={<Icon icon={MessageSquarePlus} />}+ style={{ flex: 'none' }}+ type={'fill'}+ onClick={onAddComment}+ >+ {t('acceptance.bar.addComment')}+ </Button>{rerunAvailable && (<Buttondisabled={pending}diff --git a/src/features/Verify/Acceptance/index.tsx b/src/features/Verify/Acceptance/index.tsxindex 729d402ac7c..853eb3a34ee 100644--- a/src/features/Verify/Acceptance/index.tsx+++ b/src/features/Verify/Acceptance/index.tsx@@ -84,7 +84,7 @@ import { EMPTY_ID_SET, setAggregateEntry } from './expandState';import FeedbackDrawer, { type FeedbackListEntry } from './FeedbackDrawer';import { acceptanceFocusedLayout, acceptanceScrollLayout } from './layout';import LedgerPanel, { type AcceptanceRound } from './LedgerPanel';-import { openAcceptModal, openRejectModal } from './modals';+import { openAcceptModal, openGroupFeedbackModal, openRejectModal } from './modals';import { acceptanceCheckPath, acceptanceOverviewPath } from './routes';import { getAcceptanceStatusActions } from './statusActions';import TopicPanel from './TopicPanel';@@ -605,6 +605,17 @@ const AcceptancePage = memo<AcceptancePageProps>([runAction, acceptanceRecordId],);+ // The decision bar's global note — the same group-feedback channel, aimed+ // at the uncategorized bucket ('' targets the whole delivery).+ const handleAddGlobalComment = useCallback(() => {+ openGroupFeedbackModal({+ description: t('acceptance.bar.addCommentDescription'),+ groupLabel: t('acceptance.feedback.global'),+ onConfirm: (comment, fileIds) => handleGroupFeedback('', comment, fileIds),+ title: t('acceptance.bar.addComment'),+ });+ }, [handleGroupFeedback, t]);+const gotoRound = useCallback((round: number) => {setHighlightRound(round);setLedgerExpand(true);@@ -1833,6 +1844,7 @@ const AcceptancePage = memo<AcceptancePageProps>(subText={barTexts.subText}totalCount={reviewTotal}onAccept={handleAccept}+ onAddComment={handleAddGlobalComment}onCopyReview={handleCopyReview}onOpenFeedback={() => setFeedbackOpen(true)}onRejectComment={handleRejectComment}diff --git a/src/features/Verify/Acceptance/modals.tsx b/src/features/Verify/Acceptance/modals.tsxindex d1c8299e3c7..2b59b4057f0 100644--- a/src/features/Verify/Acceptance/modals.tsx+++ b/src/features/Verify/Acceptance/modals.tsx@@ -156,70 +156,74 @@ export const openRejectModal = (options: RejectContentProps): ModalInstance =>});interface GroupFeedbackContentProps {+ /** Override the group-scoped description (the decision bar's global note). */+ description?: string;groupLabel: string;/** Record the feedback (note + any screenshots); resolve true to close. */onConfirm: (comment: string, fileIds: string[]) => Promise<boolean>;}-const GroupFeedbackContent = memo<GroupFeedbackContentProps>(({ groupLabel, onConfirm }) => {- const { t: translate } = useTranslation('verify');- const { close } = useModalContext();- const [comment, setComment] = useState('');- const [loading, setLoading] = useState(false);- const { attachments, fileIds, handlePaste, remove, uploadFiles, uploading } =- useFeedbackAttachments();-- const handleConfirm = async () => {- const trimmed = comment.trim();- if (!trimmed) return;- setLoading(true);- try {- if (await onConfirm(trimmed, fileIds)) close();- } finally {- setLoading(false);- }- };-- return (- <Flexbox gap={16}>- <Text fontSize={13} type={'secondary'}>- {translate('acceptance.group.feedbackDescription', { label: groupLabel })}- </Text>- <Flexbox gap={8}>- <TextArea- autoSize={{ maxRows: 8, minRows: 3 }}- placeholder={translate('acceptance.group.feedbackPlaceholder')}- value={comment}- onChange={(event) => setComment(event.target.value)}- onPaste={handlePaste}- />- {/* One row hugging the input — attachments belong to the note. */}- <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>- <AttachmentStrip- attachments={attachments}- disabled={loading}- uploading={uploading}- onRemove={remove}+const GroupFeedbackContent = memo<GroupFeedbackContentProps>(+ ({ description, groupLabel, onConfirm }) => {+ const { t: translate } = useTranslation('verify');+ const { close } = useModalContext();+ const [comment, setComment] = useState('');+ const [loading, setLoading] = useState(false);+ const { attachments, fileIds, handlePaste, remove, uploadFiles, uploading } =+ useFeedbackAttachments();++ const handleConfirm = async () => {+ const trimmed = comment.trim();+ if (!trimmed) return;+ setLoading(true);+ try {+ if (await onConfirm(trimmed, fileIds)) close();+ } finally {+ setLoading(false);+ }+ };++ return (+ <Flexbox gap={16}>+ <Text fontSize={13} type={'secondary'}>+ {description ?? translate('acceptance.group.feedbackDescription', { label: groupLabel })}+ </Text>+ <Flexbox gap={8}>+ <TextArea+ autoSize={{ maxRows: 8, minRows: 3 }}+ placeholder={translate('acceptance.group.feedbackPlaceholder')}+ value={comment}+ onChange={(event) => setComment(event.target.value)}+ onPaste={handlePaste}/>- <AttachmentUploadButton disabled={loading} onFiles={uploadFiles} />+ {/* One row hugging the input — attachments belong to the note. */}+ <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>+ <AttachmentStrip+ attachments={attachments}+ disabled={loading}+ uploading={uploading}+ onRemove={remove}+ />+ <AttachmentUploadButton disabled={loading} onFiles={uploadFiles} />+ </Flexbox>+ </Flexbox>+ <Flexbox horizontal align={'center'} gap={8} justify={'flex-end'}>+ <Button disabled={loading} onClick={close}>+ {translate('acceptance.actions.cancel')}+ </Button>+ <Button+ disabled={!comment.trim() || uploading}+ loading={loading}+ type={'primary'}+ onClick={handleConfirm}+ >+ {translate('acceptance.group.feedbackSubmit')}+ </Button></Flexbox></Flexbox>- <Flexbox horizontal align={'center'} gap={8} justify={'flex-end'}>- <Button disabled={loading} onClick={close}>- {translate('acceptance.actions.cancel')}- </Button>- <Button- disabled={!comment.trim() || uploading}- loading={loading}- type={'primary'}- onClick={handleConfirm}- >- {translate('acceptance.group.feedbackSubmit')}- </Button>- </Flexbox>- </Flexbox>- );-});+ );+ },+);GroupFeedbackContent.displayName = 'AcceptanceGroupFeedbackContent';@@ -227,12 +231,14 @@ GroupFeedbackContent.displayName = 'AcceptanceGroupFeedbackContent';* Group-scoped feedback dialog — the channel for concerns that belong to no* single check (which may well be accepted) yet must reach the next round.*/-export const openGroupFeedbackModal = (options: GroupFeedbackContentProps): ModalInstance =>+export const openGroupFeedbackModal = (+ options: GroupFeedbackContentProps & { title?: string },+): ModalInstance =>createModal({content: <GroupFeedbackContent {...options} />,footer: null,maskClosable: true,styles: frostedModalStyles,- title: t('acceptance.group.feedbackTitle', { ns: 'verify' }),+ title: options.title ?? t('acceptance.group.feedbackTitle', { ns: 'verify' }),width: 'min(90vw, 520px)',});diff --git a/src/features/Verify/ReportViewer.tsx b/src/features/Verify/ReportViewer.tsxindex d57c1d40063..ba0ce54769d 100644--- a/src/features/Verify/ReportViewer.tsx+++ b/src/features/Verify/ReportViewer.tsx@@ -19,6 +19,7 @@ import { createStaticStyles, cssVar, cx } from 'antd-style';import type { TFunction } from 'i18next';import {AlertTriangle,+ AudioLines,Bot,CalendarClock,Check,@@ -46,6 +47,7 @@ import { useTranslation } from 'react-i18next';import { useParams } from 'react-router';import Loading from '@/components/Loading/BrandTextLoading';+import AudioPlayer from '@/features/AudioPlayer';import type { VerifyEvidenceWithUrl } from '@/services/verify';import {@@ -922,9 +924,14 @@ const SURFACE_ICON: Record<VerifySurface, typeof Check> = {};const imageEvidenceTypes = new Set(['gif', 'screenshot']);-/** Visual media that renders/plays inline in the check body, no click-to-open. */+/** Player media — a `<video>`/`<audio>` element, not an image box. */+const playerEvidenceTypes = new Set(['audio', 'video']);+/** Media that renders/plays inline in the check body, no click-to-open. */const isInlineVisualEvidence = (evidence: VerifyEvidenceWithUrl) =>- Boolean(evidence.fileUrl && (imageEvidenceTypes.has(evidence.type) || evidence.type === 'video'));+ Boolean(+ evidence.fileUrl &&+ (imageEvidenceTypes.has(evidence.type) || playerEvidenceTypes.has(evidence.type)),+ );/*** Evidence with a directly renderable payload in the check body, no@@ -935,16 +942,23 @@ const isInlineVisualEvidence = (evidence: VerifyEvidenceWithUrl) =>const isInlineEvidence = (evidence: VerifyEvidenceWithUrl) =>Boolean(evidence.content) || isInlineVisualEvidence(evidence);-/** Coarse attachment bucket for the type marker: image / video / everything else. */-type EvidenceCategory = 'file' | 'image' | 'video';+/** Coarse attachment bucket for the type marker: image / video / audio / everything else. */+type EvidenceCategory = 'audio' | 'file' | 'image' | 'video';const evidenceCategory = (type: VerifyEvidenceType): EvidenceCategory =>- type === 'video' ? 'video' : imageEvidenceTypes.has(type) ? 'image' : 'file';+ type === 'video'+ ? 'video'+ : type === 'audio'+ ? 'audio'+ : imageEvidenceTypes.has(type)+ ? 'image'+ : 'file';const CATEGORY_ICON: Record<EvidenceCategory, typeof FileText> = {+ audio: AudioLines,file: FileText,image: ImageIcon,video: Video,};-const CATEGORY_ORDER: EvidenceCategory[] = ['image', 'video', 'file'];+const CATEGORY_ORDER: EvidenceCategory[] = ['image', 'video', 'audio', 'file'];// `errored` is terminal too (the verifier couldn't run) — stop polling and don't// treat it as a live/in-progress status.const terminalRunStatuses = new Set(['delivered', 'errored', 'failed', 'passed']);@@ -1250,6 +1264,16 @@ const EvidenceItem = memo<{</Flexbox>) : e.fileUrl && e.type === 'video' ? (<video controls className={styles.evidenceVideo} src={e.fileUrl} />+ ) : e.fileUrl && e.type === 'audio' ? (+ // The same waveform player the conversation renders — one audio dialect+ // across the product, plus the download the reviewer needs to keep the+ // deliverable.+ <AudioPlayer+ fullWidth+ alt={e.description ?? label}+ downloadFileName={e.fileName ?? 'audio'}+ url={e.fileUrl}+ />) : e.fileUrl ? (<div className={styles.evidenceDoc}><DocumentViewer@@ -1383,7 +1407,7 @@ const CheckRow = memo<{ defaultOpen: boolean; row: CheckRowData }>(({ defaultOpeacc[evidenceCategory(e.type)] += 1;return acc;},- { file: 0, image: 0, video: 0 } as Record<EvidenceCategory, number>,+ { audio: 0, file: 0, image: 0, video: 0 } as Record<EvidenceCategory, number>,);// `required` lives on the result when there is one, on the plan item otherwise// — a check that never ran still knows whether it was optional.diff --git a/src/features/Verify/components/MarkdownEvidence.tsx b/src/features/Verify/components/MarkdownEvidence.tsxindex ef2325210e2..31423ded6d4 100644--- a/src/features/Verify/components/MarkdownEvidence.tsx+++ b/src/features/Verify/components/MarkdownEvidence.tsx@@ -1,11 +1,10 @@'use client';-import { Center, Flexbox, Highlighter, Icon, Markdown, MaskShadow, Text } from '@lobehub/ui';-import { Button, Drawer } from '@lobehub/ui/base-ui';-import { useSize } from 'ahooks';-import { createStaticStyles, cssVar } from 'antd-style';-import { ChevronsDownUpIcon, ChevronsUpDownIcon, FileText } from 'lucide-react';-import { memo, useEffect, useRef, useState } from 'react';+import { Center, Flexbox, Highlighter, Icon, Markdown, Text } from '@lobehub/ui';+import { Drawer } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { ChevronRight, FileText } from 'lucide-react';+import { memo, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';import Loading from '@/components/Loading/BrandTextLoading';@@ -27,14 +26,56 @@ export const filenameFromUrl = (url: string): string => {}};-/** Same fold threshold as the task brief summary — the style this mirrors. */-const COLLAPSED_MAX_HEIGHT = 180;-const styles = createStaticStyles(({ css }) => ({- expandLink: css`- align-self: center;- font-size: 12px;- color: ${cssVar.colorTextDescription};+ foldBody: css`+ padding-block: 4px 8px;+ padding-inline: 22px 0;+ `,+ /* Reviewer-directed: no fill, no border — the row is just a line of text+ with a chevron; the surrounding check card provides the container. */+ foldCard: css`+ overflow: hidden;+ border-radius: ${cssVar.borderRadius};+ `,+ foldChevron: css`+ flex: none;+ color: ${cssVar.colorTextTertiary};+ transition: transform 160ms ease;+ `,+ foldChevronOpen: css`+ transform: rotate(90deg);+ `,+ foldHeader: css`+ cursor: pointer;++ display: flex;+ gap: 8px;+ align-items: center;++ width: 100%;+ padding-block: 4px;+ padding-inline: 0;+ border: none;++ text-align: start;++ background: transparent;++ /* No fill and no border by design — the hover feedback lives on the text. */+ &:hover [data-fold-title] {+ color: ${cssVar.colorText};+ }+ `,+ foldTitle: css`+ overflow: hidden;++ font-size: 13px;+ line-height: 1.35;+ color: ${cssVar.colorTextSecondary};+ text-overflow: ellipsis;+ white-space: nowrap;++ transition: color 120ms ease;`,docViewer: css`overflow: auto;@@ -96,49 +137,87 @@ const styles = createStaticStyles(({ css }) => ({`,}));+/** Content small enough that folding it would cost more than it saves. */+const INLINE_RENDER_MAX_CHARS = 160;+/**- * Inline prose evidence in the task-brief style: bare body markdown (no tinted- * box), folded behind a mask + expand button once it outgrows the threshold.+ * The collapsed row's label: the first meaningful line of the document, with+ * markdown syntax stripped so it reads as a sentence, not source. Fence markers+ * and blank lines are skipped — a document that opens with a code block should+ * be labeled by its first code line, not by "```bash".+ */+export const evidenceTitleFromMarkdown = (content: string): string => {+ for (const raw of content.split('\n')) {+ let line = raw.trim();+ if (!line || line.startsWith('```') || /^-{3,}$/.test(line)) continue;+ line = line+ .replace(/^#{1,6}\s+/, '')+ .replace(/^(?:[-*+]|\d+[.)])\s+/, '')+ .replace(/^>\s*/, '')+ .replaceAll(/\*\*([^*]+)\*\*/g, '$1')+ .replaceAll(/\*([^*]+)\*/g, '$1')+ .replaceAll(/`([^`]+)`/g, '$1')+ .replaceAll(/\[([^\]]+)\]\([^)]*\)/g, '$1')+ .trim();+ if (line) return line.length > 160 ? `${line.slice(0, 160)}…` : line;+ }+ return '';+};++/**+ * Inline prose evidence, folded to ONE titled row by default — the first line+ * of the document is the label, the click is the disclosure. Expanding renders+ * the full text in place, typographically subordinated (small header scale) so+ * the evidence's own headings never compete with the page's hierarchy.+ *+ * Replaces the earlier first-180px preview fold: agent-authored evidence opens+ * with headings and environment metadata, so a height-cropped preview spent a+ * card of space showing the least informative part of the document — and read+ * as noise. Need it → expand; don't → one quiet line.*/export const CollapsibleMarkdownEvidence = memo<{ children: string }>(({ children }) => {const { t } = useTranslation('verify');const [expanded, setExpanded] = useState(false);- const [isOverflow, setIsOverflow] = useState(false);- const ref = useRef<any>(null);- const size = useSize(ref);-- useEffect(() => {- if (!size) return;- setIsOverflow(size.height > COLLAPSED_MAX_HEIGHT);- }, [size]);-- const content = (- <Markdown fontSize={13} ref={ref} style={{ overflow: 'unset' }} variant={'chat'}>- {children}- </Markdown>- );+ const title = useMemo(() => evidenceTitleFromMarkdown(children), [children]);- return (- <Flexbox gap={4}>- {isOverflow && !expanded ? (- <MaskShadow size={32} style={{ maxHeight: COLLAPSED_MAX_HEIGHT }}>- {content}- </MaskShadow>- ) : (- content- )}+ // A couple of plain lines carry no structure worth hiding — folding them+ // would trade one click for nothing.+ const trimmed = children.trim();+ if (!title || (!trimmed.includes('\n') && trimmed.length <= INLINE_RENDER_MAX_CHARS)) {+ return (+ <Markdown fontSize={13} variant={'chat'}>+ {children}+ </Markdown>+ );+ }- {isOverflow && (- <Button- className={styles.expandLink}- icon={expanded ? ChevronsDownUpIcon : ChevronsUpDownIcon}- iconPosition={'end'}- size={'small'}- type={'fill'}- onClick={() => setExpanded(!expanded)}- >- {expanded ? t('report.evidence.collapse') : t('report.evidence.expand')}- </Button>+ return (+ <Flexbox className={styles.foldCard}>+ <button+ aria-expanded={expanded}+ className={styles.foldHeader}+ title={t(expanded ? 'report.evidence.collapse' : 'report.evidence.expand')}+ type={'button'}+ onClick={() => setExpanded(!expanded)}+ >+ <Icon+ className={cx(styles.foldChevron, expanded && styles.foldChevronOpen)}+ icon={ChevronRight}+ size={14}+ />+ <span className={styles.fileCardIcon}>+ <Icon icon={FileText} size={13} />+ </span>+ <span data-fold-title className={styles.foldTitle}>+ {title}+ </span>+ </button>+ {expanded && (+ <div className={styles.foldBody}>+ <Markdown fontSize={13} headerMultiple={0.1} variant={'chat'}>+ {children}+ </Markdown>+ </div>)}</Flexbox>);diff --git a/src/features/Verify/components/markdownEvidenceTitle.test.ts b/src/features/Verify/components/markdownEvidenceTitle.test.tsnew file mode 100644index 00000000000..3ffeb92d64d--- /dev/null+++ b/src/features/Verify/components/markdownEvidenceTitle.test.ts@@ -0,0 +1,37 @@+import { describe, expect, it } from 'vitest';++import { evidenceTitleFromMarkdown } from './MarkdownEvidence';++describe('evidenceTitleFromMarkdown — the collapsed row label', () => {+ it('strips heading syntax so the first line reads as a sentence', () => {+ expect(evidenceTitleFromMarkdown('## 声明\n\n验收页的音频证据应复用对话播放器。')).toBe('声明');+ });++ it('strips bold / code / link syntax from the first line', () => {+ expect(+ evidenceTitleFromMarkdown('**环境**: worktree `lobehub-wt-x`(基线 [canary](https://x))'),+ ).toBe('环境: worktree lobehub-wt-x(基线 canary)');+ });++ it('skips blank lines and fence markers — a doc opening with a code block is labeled by its first code line', () => {+ expect(evidenceTitleFromMarkdown('\n\n```bash\n$ lh acceptance view --json\n```')).toBe(+ '$ lh acceptance view --json',+ );+ });++ it('strips list markers and blockquote prefixes', () => {+ expect(evidenceTitleFromMarkdown('- 第一条观察\n- 第二条')).toBe('第一条观察');+ expect(evidenceTitleFromMarkdown('> 引用的结论')).toBe('引用的结论');+ });++ it('truncates a run-on first line instead of overflowing the row', () => {+ const long = '这一行非常长'.repeat(40);+ const title = evidenceTitleFromMarkdown(long);+ expect(title.endsWith('…')).toBe(true);+ expect(title.length).toBeLessThanOrEqual(161);+ });++ it('returns empty for whitespace-only content (caller renders inline)', () => {+ expect(evidenceTitleFromMarkdown(' \n\n')).toBe('');+ });+});