--- a/package.json
+++ b/package.json
@@ -1,21 +1,12 @@
 {
   "name": "dsh-news-plugin",
-  "version": "0.1.0",
-  "description": "DeepSeek Harness news fetch tool plugin (RSS). Everything is a plugin.",
+  "version": "0.1.0-cyberfete.1",
   "type": "module",
-  "main": "index.ts",
-  "files": ["index.ts", "README.md"],
-  "keywords": ["dsh-plugin", "deepseek-harness", "cordis", "rss", "news", "agent"],
-  "license": "MIT",
-  "dependencies": {
-    "@deepseek-ai/cordis": "*",
-    "@deepseek-ai/dsh-tools": "*"
+  "main": "lib/index.js",
+  "dsh": {
+    "bundle": {
+      "patch": "./cordis.patch.yml"
+    }
   },
-  "peerDependencies": {
-    "@deepseek-ai/cordis": "*",
-    "@deepseek-ai/dsh-tools": "*"
-  },
-  "engines": {
-    "node": ">=18"
-  }
+  "license": "MIT"
 }
--- a/index.ts
+++ b/index.ts
@@ -9,6 +9,8 @@
  */
 import type { Context } from '@deepseek-ai/cordis'
 import { defineTool } from '@deepseek-ai/dsh-tools'
+import fs from 'node:fs/promises'
+import { createHash } from 'node:crypto'
 
 export const name = 'dsh-news-plugin'
 export const inject = ['tools']
@@ -70,32 +72,33 @@
   const items: NewsItem[] = []
   const blockRe = /<(?:item|entry)\b[\s\S]*?<\/(?:item|entry)>/gi
   const titleRe = /<(?:title)\b[^>]*>([\s\S]*?)<\/(?:title)>/i
-  const linkRe = /<(?:link)\b[^>]*?(?:href="([^"]+)"|>([\s\S]*?)<\/(?:link)>)/i
   const dateRe = /<(?:pubDate|published|updated)\b[^>]*>([\s\S]*?)<\/(?:pubDate|published|updated)>/i
   const descRe = /<(?:description|summary|content:encoded)\b[^>]*>([\s\S]*?)<\/(?:description|summary|content:encoded)>/i
 
   for (const block of xml.matchAll(blockRe)) {
     const b = block[0]
     const title = titleRe.exec(b)?.[1]
-    const link = linkRe.exec(b)
+    const links = [...b.matchAll(/<link\b[^>]*(?:\/>|>[\s\S]*?<\/link>)/gi)].map(match => match[0])
+    const selectedLink = links.find(link => !/rel=["'](?:self|enclosure)["']/i.test(link)) ?? ''
+    const link = selectedLink.match(/href=["']([^"']+)["']/i)?.[1] ?? selectedLink.match(/>([\s\S]*?)<\/link>/i)?.[1] ?? ''
     const date = dateRe.exec(b)?.[1]
     const desc = descRe.exec(b)?.[1]
     if (!title) continue
     items.push({
       title: decodeXml(title).trim(),
-      link: link ? decodeXml(link[1] ?? link[2] ?? '').trim() : '',
+      link: decodeXml(link).trim(),
       source: source.name,
       sourceId: source.id,
       category: source.category,
       pubDate: date ? decodeXml(date).trim() : '',
-      summary: decodeXml((desc ?? '').replace(/<[^>]+>/g, ' ')).trim().slice(0, 200),
+      summary: decodeXml(desc ?? '').replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 200),
     })
   }
   return items
 }
 
 /** 抓取一个源并解析；失败返回空数组并打警告（单个源失败不阻塞整体） */
-export async function fetchSource(src: RssSource, timeoutMs = 9000): Promise<NewsItem[]> {
+export async function fetchSource(src: RssSource, timeoutMs = 15000) {
   const ctrl = new AbortController()
   const timer = setTimeout(() => ctrl.abort(), timeoutMs)
   try {
@@ -104,14 +107,18 @@
       headers: { 'User-Agent': 'Mozilla/5.0 (compatible; dsh-news-plugin/0.1)' },
     })
     if (!res.ok) {
-      console.warn(`[dsh-news] ${src.id} HTTP ${res.status}`)
-      return []
+      return { source: src.id, url: src.url, status: 'failed', error: `HTTP ${res.status}`, items: [] as NewsItem[] }
     }
     const xml = await res.text()
-    return parseRss(xml, src)
+    const evidenceDir = '/Users/macmini_no1/Documents/deepseek-harness/default-workspace/cyberfete-plugin-lab-20261127/D29/outputs/raw-rss'
+    await fs.mkdir(evidenceDir, { recursive: true })
+    await fs.writeFile(`${evidenceDir}/${src.id}.xml`, xml)
+    const metadata = { source: src.id, url: src.url, fetchedAt: new Date().toISOString(), sha256: createHash('sha256').update(xml).digest('hex') }
+    if (!/<(?:rss|feed|rdf:RDF)\b/i.test(xml) || /<!doctype\s+html\b|<html\b/i.test(xml)) return { ...metadata, status: 'failed', error: 'Response is not an RSS/Atom feed', items: [] as NewsItem[] }
+    const items = parseRss(xml, src)
+    return { source: src.id, url: src.url, status: items.length ? 'ok' : 'empty', fetchedAt: new Date().toISOString(), sha256: createHash('sha256').update(xml).digest('hex'), items }
   } catch (e) {
-    console.warn(`[dsh-news] ${src.id} fetch failed: ${(e as Error).message}`)
-    return []
+    return { source: src.id, url: src.url, status: 'failed', error: (e as Error).message, items: [] as NewsItem[] }
   } finally {
     clearTimeout(timer)
   }
@@ -132,50 +139,38 @@
         sources: {
           type: 'array',
           items: { type: 'string' },
-          required: false,
           description:
             '源 id 列表（可选）：ithome / 36kr / sspai / oschina / ruanyf / wallstreetcn / jiemian / chuapp / verge / npr',
         },
         category: {
           type: 'string',
-          required: false,
           description: '按分类过滤：tech / finance / culture / world',
         },
         limit: {
           type: 'number',
-          required: false,
           description: '每个源最多返回条数，默认 8',
         },
       },
       output: {
         schema: {
-          type: 'array',
-          items: {
-            type: 'object',
-            properties: {
-              title: { type: 'string' },
-              link: { type: 'string' },
-              source: { type: 'string' },
-              sourceId: { type: 'string' },
-              category: { type: 'string' },
-              pubDate: { type: 'string' },
-              summary: { type: 'string' },
-            },
+          type: 'object',
+          additionalProperties: false,
+          properties: {
+            items: { type: 'array', items: { type: 'object', additionalProperties: true, properties: {} } },
+            sources: { type: 'array', items: { type: 'object', additionalProperties: true, properties: {} } },
+            duplicates: { type: 'array', items: { type: 'object', additionalProperties: true, properties: {} } },
+            fetchedAt: { type: 'string' },
           },
         },
         render: (_args, value) => [
           {
             type: 'text',
-            text: JSON.stringify(
-              value.map((it: NewsItem) => `[${it.source}] ${it.title} (${it.link})`),
-              null,
-              0,
-            ),
+            text: JSON.stringify(value),
           },
         ],
       },
       async execute(args: { sources?: string[]; category?: string; limit?: number }) {
-        const limit = args.limit ?? 8
+        const limit = Math.min(20, Math.max(1, Math.trunc(args.limit ?? 8)))
         let srcs = SOURCES
         if (args.sources?.length) {
           srcs = srcs.filter((s) => args.sources!.includes(s.id))
@@ -184,10 +179,28 @@
           srcs = srcs.filter((s) => s.category === args.category)
         }
         // 并行抓取，逐源限时
-        const settled = await Promise.allSettled(srcs.map((s) => fetchSource(s)))
-        const items = settled.flatMap((r) => (r.status === 'fulfilled' ? r.value : []))
-        // 按时间倒序（RSS 内一般已排好，这里兜底），截断
-        return items.slice(0, limit * srcs.length || limit)
+        const fetched = await Promise.all(srcs.map(source => fetchSource(source)))
+        const reports: object[] = fetched.map(({ items, ...report }) => ({ ...report, parsedCount: items.length, retainedCount: Math.min(items.length, limit) }))
+        for (const sourceId of args.sources ?? []) if (!SOURCES.some(source => source.id === sourceId)) reports.push({ source: sourceId, status: 'failed', error: 'Unknown source id' })
+        const unique = new Map<string, NewsItem>()
+        const duplicates: object[] = []
+        for (const item of fetched.flatMap(report => report.items.slice(0, limit))) {
+          let key = item.link
+          try {
+            const url = new URL(item.link)
+            url.hash = ''
+            for (const name of [...url.searchParams.keys()]) if (name.startsWith('utm_')) url.searchParams.delete(name)
+            key = url.toString()
+          } catch { key = `${item.sourceId}:${item.title}` }
+          if (unique.has(key)) duplicates.push({ key, kept: unique.get(key), removed: item })
+          else unique.set(key, item)
+        }
+        const items = [...unique.values()].sort((left, right) => (Date.parse(right.pubDate) || 0) - (Date.parse(left.pubDate) || 0))
+        const result = { items, sources: reports, duplicates, fetchedAt: new Date().toISOString() }
+        const output = '/Users/macmini_no1/Documents/deepseek-harness/default-workspace/cyberfete-plugin-lab-20261127/D29/outputs'
+        await fs.mkdir(output, { recursive: true })
+        await fs.writeFile(`${output}/news-fetch-actual.json`, JSON.stringify(result, null, 2))
+        return result
       },
     }),
   )
--- a/cordis.patch.yml
+++ b/cordis.patch.yml
@@ -0,0 +1,3 @@
+- insert:
+    - id: dsh-news-plugin
+      name: dsh-news-plugin
