Skip to content
dsh.fish
Bundle

dsh-task-estimator

DSH plugin: session-header task estimator — estimated remaining time, token usage and per-model cost (≈CNY) with an optional LLM-powered estimate. / DSH 插件:会话标题栏任务估算窗口——预计剩余时间、token 用量与按模型花费估算(≈CNY),支持 LLM 智能估算。

Source
0x250-t
stars
1 stars
License
MIT
Updated
Updated 5 days ago

Readme

# dsh-task-estimator

> **v1.1.1** — 修复 client 加载:factory 内定义 `module` 全局(浏览器 ESM 运行时无 `module`,否则 client 半区启动报错)

<p align="center">
  <sub>🤖 由 <a href="https://github.com/deepseek-ai/DeepSeek-Harness">DeepSeek Harness</a> 辅助开发 · Built with <a href="https://github.com/deepseek-ai/DeepSeek-Harness">DeepSeek Harness</a></sub>
</p>

DSH 插件:会话标题栏任务估算窗口——预计剩余时间、token 用量与按模型花费估算(≈CNY),支持 LLM 智能估算。

Session-header task estimator for the DeepSeek Harness web GUI: estimated remaining time, token usage and per-model cost (≈CNY), with an optional LLM-powered estimate.

## 功能 Features

- **启发式估算 Heuristic estimate**:基于会话投影(`sessionStats`/`tokenUsage`/`goal`)实时计算——已用轮次/token/耗时、平均每轮、预计剩余(近 5 轮趋势外推 + 置信区间)、预计完成时刻
- **花费估算 Cost estimate**:按会话日志重放 token 用量,按「模型 × 时段」(legacy/peak/offPeak,北京时间)增量计价,返回汇总 + 按模型明细(模型 / token / 花费),价格随生效日期自动切换
- **AI 估算 LLM estimate**:用会话当前模型做轻量补全,输出 **PERT 三点估算**(乐观/最可能/悲观剩余分钟 + 期望值)、剩余轮数/token、任务复杂度分档(XS~XL)、**METR 可靠性警告**(估算超过模型 p80 阈值时建议拆分任务)
- **本轮预计 Per-round estimate**:agent 思考中(「Deep diving...」状态行)时,在该行右侧注入「本轮预计 ≈ X」——以近 5 轮 LLM 耗时趋势(趋势不可用时取全程平均)预估本轮对话所需时长,随每轮节奏变化自动刷新
- **交互 Interaction**:悬停显示、移开 0.3s 后 0.5s 线性淡出、点击固定(再次点击任意位置关闭)、`Alt+E` 切换、触屏自动降级、面板内点击不退出、内容超高可滚动
- **设置 Settings**:价格表可编辑(legacy 档,峰谷倍率自动派生)、刷新间隔自定义(分钟,支持小数)、恢复默认、固定状态持久化(localStorage)、价格生效日程(本地/北京日期、当前价格时段、新价格生效日)

## 安装 Install

bundle 插件,安装后**重启 web**:

```sh
dsh plugin --profile web add github:0x250-t/dsh-task-estimator#v1.1.0
```

或本地目录(先 `npm run build`):

```sh
cd dsh-task-estimator
dsh plugin --profile web add .
```

## 使用 Usage

1. 悬停会话标题栏右侧的估算按钮(`⏱ 剩余 X · Y tok · ≈¥Z`)查看明细
2. 点击按钮固定面板;再次点击任意位置关闭
3. AI 估算:展开「AI 估算」区块 → 点击「开始估算」(也可设置自动刷新间隔)
4. 设置:展开「设置」区块 → 编辑价格/间隔 → 保存;「恢复默认」一键还原
5. agent 思考中(「Deep diving...」状态行):右侧会显示「本轮预计 ≈ X」,即对当前这轮对话耗时的实时预估

## 算法说明 Algorithm

- **PERT**:`E = (O + 4M + P) / 6`,区间 `[O, P]`,顺序异常时排序降级
- **METR**:估算期望超过模型 p80 可靠性阈值(flash 约 60 分钟 / pro 约 90 分钟)时提示拆分任务
- **任务分档**:按轮次 / 工具调用数 / 用户消息量归为 XS~XL
- 参考:agent-estimate(github.com/kiloloop/agent-estimate)、codex-eta(pypi.org/project/codex-eta)

## 隐私 Privacy

- 全部状态为进程内存,无任何持久化
- 无 API key / 密钥 / 密码硬编码;无网络外发(除 AI 估算时对已配置模型的一次调用)
- 价格表为内置参考值,可在设置中修改

## 构建 Build

```sh
npm install          # 安装 esbuild(devDependency)
npm run build        # 构建 lib/client.js + 语法检查
```

## License

MIT

Install

dsh plugin --profile web add github:0x250-t/dsh-task-estimator

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source