npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-x-connect

v0.1.0

Published

X (Twitter) connector for DeepSeek Harness: OAuth 2.0 credential binding, posting tweets with per-post cost estimation, and reading/summarizing related posts. Ships a settings card in the Web plugin page.

Readme

dsh-x-connect

这是一个面向 DeepSeek Harness 的 X API v2 插件。它通过 OAuth 2.0 PKCE 绑定一个 X 账号,让 Agent 可以检索、阅读、总结和发布帖子。

安装与配置

dsh plugin --profile web add dsh-x-connect

重启 dsh web,进入 设置 → 插件 → X Connect

  1. X Developer Console 创建应用,开启 OAuth 2.0,选择 Public/Native Client 和 Authorization Code + PKCE。
  2. 在 X 应用中注册回调地址 http://127.0.0.1:56130/callback
  3. 将 OAuth 2.0 Client ID 填入插件并保存;无需也不要填写 Client Secret。
  4. 保留 tweet.readusers.readoffline.access;需要发帖时勾选 tweet.write
  5. 点击“生成授权链接”,在 X 完成授权;回到设置页后点击“测试连接”。

回调服务只会在等待授权期间自动启动,并且只监听本机回环地址;平时不会常驻。

功能

  • x_search:检索近期帖子。
  • x_user_tweets / x_tweet / x_me:阅读时间线、单条帖子和账号资料。
  • 总结:读取工具将结构化原文交给当前 DSH 模型总结,不额外调用另一套 LLM。
  • x_post:发布帖子或回复;默认必须通过 DSH 的一次性用户批准。
  • x_status / x_activity_log:查看连接、scope、操作记录和费用估算。
  • x_connect / x_disconnect:绑定或解绑账号;模型触发解绑时也必须批准。

X API 按量计费,插件显示的是版本发布时的估算值,实际价格、余额与上限以 X Developer Console 为准。令牌保存在 ~/.dsh/x-connect/credentials.json,文件权限为 0600,不会返回给 Web 页面或模型。

绑定后如何使用

不需要在对话中输入特殊命令,直接用自然语言描述任务即可。为避免 Agent 扩大读取范围,建议在提示词中写明工具名、调用次数和最大条数。

查看自己的帖子

请只调用一次 x_user_tweets,读取当前绑定账号最近 5 条帖子,
排除转帖和回复。用中文列出时间、链接和一句话摘要。
不搜索其他账号,不发帖。

这会使用 x_user_tweets,不填 username 时默认读取当前绑定账号。X 时间线端点每次最少请求 5 条,所以 5 是插件允许的最小值。

阅读并总结一条帖子

请只调用一次 x_tweet 阅读这个链接:
https://x.com/<username>/status/<post-id>
然后用中文总结核心观点和一条风险提示。不调用 x_search,不发帖。

x_tweet 接受完整 X 链接或纯数字帖子 ID。“总结”是当前 DSH 模型对返回内容的处理,不会再调用一个 X 接口。

谨慎回复帖子

推荐分成两步,避免读取后立即发布:

第一步:只调用一次 x_tweet 阅读这条帖子:
https://x.com/<username>/status/<post-id>
拟一条不超过 100 字、不含链接的中文回复。
只显示草稿,不调用 x_post。

检查草稿后,再单独发出:

请调用一次 x_post,将下面文字回复到帖子 <post-id>:
<已确认的回复文字>
不要修改文字,不要执行其他 X 工具。

<post-id> 必须是 status/ 后的纯数字 ID。保持设置中的“发帖前要求一次性批准”开启;x_post 真正发布前,DSH 会再展示文本和估算费用,只有你点击允许后才会调用 X API。

费用与最小化调用

根据 X 官方当前按量计费说明

| 操作 | 当前公开单价 | 插件行为 | | --- | ---: | --- | | 读取 1 条帖子 | $0.005/资源 | x_tweetx_search和时间线返回的帖子 | | 读取 1 条用户资料 | $0.010/资源 | x_me;按用户名查时间线也需先解析账号 | | 符合条件的自有数据读取 | $0.001/资源 | 仅当认证用户是开发者应用所有者且端点符合 X 规则时 | | 发布纯文本帖子或回复 | $0.015/请求 | x_post | | 发布含 URL 的帖子或回复 | $0.200/请求 | x_post |

插件在无法确定“自有数据读取”资格时使用普通读取价格作保守估算。X 说明同一资源在 24 小时 UTC 日窗口内通常会去重,失败且没有返回数据的请求不计费;去重是软保证,最终以 Developer Console 账单为准。

控制费用时:

  • 先说“只拟稿,不调用 X 工具”,确认任务后再允许一次读取。
  • 显式限制工具调用次数和 maxResults;查看自己帖子时从 5 条开始。
  • 尽量读取精确 URL,不要在只需一条帖子时使用 x_search
  • 在 X Developer Console 中设置 Spending limit 并检查余额;插件估算不是账单。
  • x_status 查连接和本地统计,用 x_activity_log 看插件历史操作。这两个工具只读本地状态,不调用 X API。

开发验证

npm ci
npm run check
npm pack --dry-run

MIT License。