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

@qiaoy01/mission

v0.2.0

Published

Persistent long-horizon autonomous mission runtime for DeepSeek Harness: dependency DAG, independent verification, replan-on-failure, lease ownership.

Readme

dsh-mission

DeepSeek Harness 的长程自主 mission 运行时 —— 让 agent 能多日推进一个长期目标: 跨会话、可独立验证、失败可重规划、崩溃可恢复的自主控制循环。 DAG(依赖任务图)是它的驱动/执行手段之一,不是运行时本身。

English | 中文

npm version license CI

是什么

dsh-mission 是 DeepSeek Harness 的纯 TypeScript cordis 插件,提供 dsh 缺失的 长程自主 mission 运行时:一个持久、可验证、崩溃可恢复的自主控制循环,把"一个长期目标" 拆成带依赖的任务 DAG,由运行时自主推进,而不是靠单次对话一次性完成。

核心原则:agent 提议,环境裁决,运行时提交

  • agent 的计划、执行、声明永远非权威;
  • 每个工作项:task/report = 对环境的声明(非权威),task/verify = 独立地把声明与 环境反馈对齐(权威);
  • 执行者不能自证完成——只有通过确定性校验、以单个事件原子写入会话日志的状态变更才是权威。

为什么是 dsh 需要它

| dsh 已有 | dsh-mission 的独特增量 | |---|---| | goal(单目标记账,可自证完成) | 依赖 DAG + 派生就绪/阻塞,失败支线可重规划(保留 DONE 成果) | | workflow(一次性扇出脚本) | 持久、可恢复、跨会话的任务状态机 | | schedule(纯时间触发) | 依赖触发(上游 DONE → 下游 READY) | | subagent(执行单元) | 独立验证——执行者不能自证,reportverify | | — | lease 所有权 + 惰性回收 + 崩溃恢复 |

特性

  • 事件溯源持久化:mission/* 会话事件,单事件 = 原子提交,无独立数据库;
  • 版本守卫:revision CAS(照搬 dsh-goal 的 GoalRef 模式);
  • 自主驱动宿主(mission-driver):监听 mission/changed,自动执行 认领 → 子代理执行 → 声明 → 独立验证 → 提交 的循环;
  • 惰性 lease 回收:过期且无声明的任务可被回收重做;在飞任务守卫杜绝重复派发;
  • 失败重规划:mission 卡死时产出新 revision,已 DONE 且 spec 未变的任务跨 revision 保留;
  • 模型策略可选:llmDecider(选下一任务)/ llmReplanner(重规划)/ userApprovalGate(审批闸);
  • UI 数据面:mission session projection 单元;
  • 触发伴生(mission-trigger):软指引提示词 + /mission 斜杠命令,把触发短语 路由到 mission_create/mission_plan;
  • 容错伴生:mission-invariantinvariants 服务存在时自动注册审计,不存在时静默跳过 (生产 profile 无需额外配置即可加载)。

事件词汇(mission/*)

| 事件 | 语义 | |---|---| | mission/created | 创建 mission | | mission/plan-committed | 提交整次计划快照(revision +1,DONE 且 spec 不变的任务延续) | | mission/task-claimed | lease 认领 | | mission/task-reported | agent 对环境的声明(不产生 DONE) | | mission/task-verified | 独立对齐环境反馈 → DONE/FAILED | | mission/cancelled | 显式终止 |

状态:mission CREATED / RUNNING / COMPLETED / FAILED / CANCELLED; 任务 PENDING / CLAIMED / DONE / FAILED + 派生 READY / BLOCKED

安装与使用

# 从 npm 安装(已发布;会把 6 行 bundle patch 插入组合)
dsh plugin --profile <name> add @qiaoy01/mission

从源码安装(给贡献者)

npm 包已预构建(lib/),普通使用者只需上面一条命令。想改代码或审查源码时才需要从源码构建:

git clone https://github.com/qiaoy01/dsh-mission.git
cd dsh-mission   # bundle 就在仓库根
npm install                                # 构建依赖,锁定到运行中 harness 的 peer 版本
npm run build                              # typecheck + emit 到 lib/
dsh plugin --profile <name> add file:.

file:. 指向仓库根(其 package.json 声明了 dsh.bundle.patchcordis.patch.yml),因为你刚 cd 进去的就是仓库根。改完源码后要重新 npm run build 并重新 add。

在会话中,agent 通过四个模型工具使用 mission:mission_create(创建)、 mission_plan(提交任务 DAG,revision 必须 = 当前 + 1)、mission_status(读取状态)、 mission_cancel(取消 mission)。

模型提交计划后,执行由运行时接管(mission-driver 自动认领任务、派发真实子代理、 独立验证)。模型不需要也不应该自己执行任务。

快速上手(30 秒)

# 1. 把插件装进一个 dsh profile
dsh plugin --profile web add @qiaoy01/mission

# 2. 在会话中对 agent 说:
#    "mission: 构建一个小型网页游戏。用 mission_create 创建,再用 mission_plan 提交计划,
#     然后停止——任务由运行时执行。"
#
# 模型创建并规划;mission-driver 自动认领任务、派发真实子代理、独立验证每个任务,
# 直到 mission COMPLETED。

默认策略保守(确定性选任务、不自动重规划,零模型开销);需要模型决策时在 profile 里配置:

- id: mission-driver
  config:
    decider: llm     # 模型选择下一任务
    replan: true     # 卡死时模型重规划

构建与测试

npm run build          # 自动发现本机 tsc;typecheck + emit 到 lib/
# 六套测试,全部隔离运行:
node --experimental-strip-types tests/domain.test.mjs    # 纯函数域模型
node tests/service.test.mjs                               # 运行时(真实 cordis/session/agent)
node tests/driver.test.mjs                                # driver 循环(mock 执行器)
node tests/driver-host.test.mjs                           # 驱动宿主(stub subagents)
node tests/trigger.test.mjs                               # trigger 伴生(软指引 + /mission)
node --experimental-strip-types tests/projection.test.mjs # 会话投影单元

验证状态

  • 阶段 A(域模型)✅ · 阶段 B(服务 + 工具 + 伴生)✅ · 阶段 C(driver 循环)✅ · 阶段 D(重规划 / lease 回收 / 模型决策 / 审批闸)✅ · 阶段 E(投影 ✅,浏览器 UI 待做);
  • 真实组合验证:7 任务 DAG 由真实子代理自主推进至 COMPLETED, 每个任务独立验证通过,全程零失败、零重复派发。

许可

MIT —— 详见 LICENSE