dsh-tool-hackernews

by tanf1ng

1 工具与能力github收录于 08-23

DeepSeek Harness 的 Hacker News 工具套件(hn_top_stories、hn_search、hn_item)

Hacker News tool suite (hn_top_stories, hn_search, hn_item) for DeepSeek Harness

安装

dsh plugin --profile web add github:tanf1ng/dsh-tool-hackernews

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗

安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。

README

目录

English | 中文

面向 DeepSeek Harness(DSH)智能体的 Hacker News 工具套件:hn_top_stories、hn_search、hn_item。基于免费的 Algolia HN 搜索 API 构建 —— 无需任何 API Key。

工具

工具 参数 行为
hn_top_stories limit(可选,1–30) Hacker News 当前热门首页:标题、链接、评分、评论数、作者、相对时间。
hn_search query(必填)、tag(story/comment/poll/ask_hn/show_hn)、since_hours(1–8760)、limit(1–30) 关键词搜索 HN,可限定标签或最近 N 小时。
hn_item id(必填)、max_comments(0–100) 单个故事详情 + 有上限的评论树(自动去除 HTML、按层级缩进),保护上下文窗口。

三个工具都是只读且并发安全的,DSH 可以并行调度同级的工具调用。每个请求都携带部署方配置的超时预算,并转发调用方的 AbortSignal。

安装

DSH 插件通过 dsh plugin(底层是 pnpm)安装到 profile 中。从本 GitHub 仓库安装:

dsh plugin --profile <名称> add "github:tanf1ng/dsh-tool-hackernews"

或从本地源码安装:

pnpm install
pnpm build
# 然后在需要加载它的 profile 里执行:
dsh plugin --profile <名称> add "file:../../dsh-tool-hackernews"

在 profile 的 cordis.patch.yml(或产品 bundle)中启用插件:

- id: tool-hackernews
  name: dsh-tool-hackernews

配置

所有配置项均可选:

配置项 默认值 含义
registerTopStories true 是否注册 hn_top_stories。
registerSearch true 是否注册 hn_search。
registerItem true 是否注册 hn_item。
topStoriesLimit 10 hn_top_stories 的默认结果条数上限。
searchLimit 8 hn_search 的默认结果条数上限。
maxComments 20 hn_item 的默认评论条数上限。
fetchTimeoutMs 15000 单次请求的超时预算(毫秒)。

开发

pnpm install
pnpm build     # tsc -> lib/
pnpm test      # 冒烟测试(stub fetch,无需网络)

本包遵循官方 DSH 工具插件模式:一个 Cordis 插件(name / inject / Config / apply),通过 ctx.tools.register(defineTool(...)) 注册工具,包含完整的参数 schema、规范化的输出 schema、文本渲染器和 presentCall UI 卡片。

使用示例

装上之后,你可以直接问智能体:

"今天 Hacker News 上最火的是什么?" → hn_top_stories "HN 上最近有人讨论 DeepSeek 吗?" → hn_search(搜索 "deepseek",限最近 24 小时) "这篇热门帖子的评论都在聊什么?" → hn_item

许可证

MIT

原始 README: https://github.com/tanf1ng/dsh-tool-hackernews/blob/main/README.zh.md ↗