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

@civilization/dsh-office-reader

v0.1.1

Published

Smart PDF, Excel, and Word document parser and token-safe analyzer for DeepSeek Harness.

Readme

@civilization/dsh-office-reader

DeepSeek Harness (DSH) 原生多格式文档透视与解析插件(PDF / Excel / Word)


🌟 核心特性

  • 🛡️ Token 上下文安全防爆机制: 文档往往体量庞大(动辄上百页 PDF 研报或数万行 Excel),盲目读取容易消耗天价 Token 甚至超出上下文限制。本插件提供两阶段渐进式阅读,先透视结构大纲,再按需切片读取。
  • 📑 全格式覆盖(纯 JS 本地解析,零外部依赖):
    • PDF (.pdf):提取元数据、大纲、支持按页码区间(如第 1-5 页)精准抽取。
    • Excel (.xlsx, .xls, .csv, .tsv):透视所有工作表(Sheets),将数据清洗转换为对模型极其友好的标准 Markdown 表格或结构化 JSON,支持行列安全截断。
    • Word (.docx):语义化解析为层级 Markdown,完整保留标题(#、##)、列表与数据表格,支持按二级标题定位抽取。
  • 🤖 专属 AI Agent Tools 与 Skill: 为模型赋予 5 大语义化工具(doc_inspect、doc_read_pdf、doc_read_excel、doc_read_word、doc_parse_auto),当用户在会话中提及任何文档或输入 @document.pdf 时,AI 自动调用专属工具精准分析。
  • 🎨 DSH 官方右侧栏看板: 右侧独立功能面板提供输入文档路径一键“透视结构”与“提取预览”,并实时估算 Token 消耗。

🧭 AI 模型专属工具集 (Tools)

| 工具名称 | 核心功能简介 | | :--- | :--- | | doc_inspect | 文档结构快速透视:在读取大文档前先执行此工具,获取总页数、工作表清单、标题与估计 Token,防止盲目读取。 | | doc_read_pdf | 分页按需读取 PDF:支持指定页码范围(如 startPage: 1, endPage: 5)或特定离散页码(如 [1, 3, 5]),杜绝超长研报撑爆上下文。 | | doc_read_excel | Excel 表格转 Markdown:指定工作表读取,自动转换为对齐良好的 Markdown 表格,内置默认 100 行安全截断。 | | doc_read_word | Word (.docx) 语义化提取:将 Word 转化为标准 Markdown,支持按指定小节标题(如 targetHeading: "项目背景")精准提取。 | | doc_parse_auto | 万能一步提取入口:自动根据后缀识别格式,适合中小文件(< 5 页 PDF 或小型表格)一步获取结构化文本与摘要。 |


⚙️ 配置项 (Settings)

本插件采用 @deepseek-ai/schemastery 标准,可在 DSH 官方设置面板中可视化配置:

| 配置项 | 类型 | 默认值 | 说明 | | :--- | :---: | :---: | :--- | | maxPdfPagesPerRead | number | 20 | 单次读取 PDF 的最大页数软上限 | | maxExcelRowsPerRead | number | 100 | 单次读取 Excel 表格的默认最大行数截断 | | maxTextCharsLimit | number | 40000 | 单次提取正文的最大字符数安全阈值(默认 40,000 字) | | enableFormatPreview | boolean | true | 是否在右侧栏启用文档透视面板 |


🏗️ 构建与调试

# 1. 安装依赖
pnpm install

# 2. 编译打包(双端产物:Node 宿主 + 浏览器侧边栏)
pnpm run build

# 3. 类型检查
pnpm run typecheck

# 4. 运行自动化测试
node tests/test-parsers.mjs