@deepslacker/dsh-task-progress 0.0.0-stage → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/LICENSE +21 -0
- package/README.en.md +177 -0
- package/README.md +180 -2
- package/client.js +1492 -0
- package/cordis.patch.yml +3 -0
- package/docs/DETAIL.md +106 -0
- package/docs/DETAIL.zh.md +106 -0
- package/docs/images/scene-completed.png +0 -0
- package/docs/images/scene-progress.png +0 -0
- package/docs/mockups/README.md +8 -0
- package/docs/mockups/scenes.html +408 -0
- package/icon.svg +1 -0
- package/index.js +435 -0
- package/lib/judge.js +168 -0
- package/lib/progress.js +213 -0
- package/lib/steps.js +87 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +57 -4
package/cordis.patch.yml
ADDED
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Task progress
|
|
2
|
+
|
|
3
|
+
Shows how far the task a session is running has got. Every time the evaluator moves the current node, the previous node leaves a node on the bar.
|
|
4
|
+
|
|
5
|
+
## What it shows
|
|
6
|
+
|
|
7
|
+
- **Above the composer** (`conversation.input.dock`): two rows. The first row is the bar with its percentage and the turn's nodes; the second row carries the phase, the current node, the next node, and the estimated time left. The block follows the conversation's own width axis (`--dsh-chat-content-width`), so dragging the conversation width handle or resizing the window reflows it. It appears while the session is running, stays briefly after the turn ends, and is absent for history and for idle sessions.
|
|
8
|
+
- **On the session row** (`sidebar.session.row.trailing`): a small ring and percentage beside the row's time; the ring uses the same color as the bar. Only a running, non-blank, non-subagent session with an estimate shows it; finished sessions never do.
|
|
9
|
+
|
|
10
|
+
The large percentage is always the **open turn's own 0–100%**; it does not accumulate across turns.
|
|
11
|
+
|
|
12
|
+
### Per-turn nodes
|
|
13
|
+
|
|
14
|
+
Nodes belong to the open turn; earlier turns are never drawn:
|
|
15
|
+
|
|
16
|
+
- Whenever the model report or the side-channel evaluator names a new "current node", the previous one counts as finished and leaves a filled node at the last percentage it was seen at.
|
|
17
|
+
- The current node is the outlined node at the bar's current percentage. Hovering it shows its text, phase, elapsed time, and the next node.
|
|
18
|
+
- Hovering any node opens a detail card:
|
|
19
|
+
- the node number and `Done` / `In progress`;
|
|
20
|
+
- its text and phase;
|
|
21
|
+
- a finished node shows the completion time and **how long that node took** (from when it appeared until the next node replaced it);
|
|
22
|
+
- the current node shows its **elapsed time** and the next node.
|
|
23
|
+
- Hovering the bar grows it vertically inside 0.2 s with a soft glow; nodes share that hover hit area.
|
|
24
|
+
- Nodes are keyboard-focusable and show the same card on focus.
|
|
25
|
+
- Nodes are numbered from **0**; coincident nodes are nudged apart. A node sits at the last percentage it was seen at. A completed node is shown only inside the current fill: if a later estimate lowers the percentage, nodes beyond the fill are hidden until progress catches up.
|
|
26
|
+
- At most the **last 100** nodes are kept; older ones drop off the rail.
|
|
27
|
+
|
|
28
|
+
The Host keeps the rail in the evaluator's memory (observed every 15 seconds), so a page refresh re-reads the same nodes. A new turn resets it. When the turn ends, the last node is closed at `turn/end` and kept for a short while.
|
|
29
|
+
|
|
30
|
+
### Node list
|
|
31
|
+
|
|
32
|
+
The leftmost control on the second row is a **Nodes** button with a count badge. Opening it expands the turn's full node list:
|
|
33
|
+
|
|
34
|
+
- the current node first (`Node N [In progress]: detail · phase · elapsed`);
|
|
35
|
+
- below a separator, every completed node in time order (`Node 0 [Done]: detail · phase · duration · finished at`), numbered from 0;
|
|
36
|
+
- the list has a **fixed 180px height** and scrolls inside itself; click the button again to collapse it. The badge is the total number of nodes this turn.
|
|
37
|
+
|
|
38
|
+
### Completed-task entry
|
|
39
|
+
|
|
40
|
+
Once the reply is final and this is the latest turn, the completed message's action row (`conversation.chat.assistant-actions`) shows a **gray** progress glyph after the context action and before the branch action. It is not repeated on older turns; only the latest completed turn carries it. Clicking it:
|
|
41
|
+
|
|
42
|
+
- opens the Right Sidebar on a tab named **Nodes** with the same glyph in its title;
|
|
43
|
+
- shows every node of `rails[sessionId]` as a card in time order: number, done/in-progress, label, phase, duration and finish time; the header carries the total;
|
|
44
|
+
- the Host keeps the completed turn's rail until the next turn's first observation, and the client marks the last node done as soon as `taskProgress.done` arrives, even before the next Host sweep.
|
|
45
|
+
|
|
46
|
+
The plugin icon (the one shown under Settings → Plugins) is `icon.svg`; the **Task progress** icon in the Settings navigation is registered through the `settings.section.icon` slot (same id as `settings.section`), so the Settings page shows the same glyph too.
|
|
47
|
+
|
|
48
|
+
## Who evaluates, and how
|
|
49
|
+
|
|
50
|
+
The evaluator is always **the session's own model**, through two channels:
|
|
51
|
+
|
|
52
|
+
1. **An in-session tool, `report_progress`** (preferred). It takes `percent` (0–100), `phase` (`plan` / `execute` / `verify` / `deliver`), `milestone`, optional `next`, `eta_min`, and `revised`. Its description fixes the rubric — 0 not started, 25 plan settled, 50 half the work done, 75 done and verifying, 100 delivered and verified. The call lands in the session log and is folded by the projection.
|
|
53
|
+
2. **A side-channel evaluator** (fallback). Models often never call a telemetry tool, so while a turn is open and the last checkpoint is stale, the host asks **the session's own current route** (the provider/model of its newest request) for one short completion. Input is a bounded digest **scoped to that one turn** — the turn's user request, todo list, last 8 tool calls, last assistant line, and elapsed minutes — at most about 900 tokens; output is forced to one JSON line `{percent, phase, milestone, next, eta_min}` with a 1.2k-token cap and the route's lowest reasoning effort. Results live in memory and the page polls a read-only route every 2 seconds.
|
|
54
|
+
|
|
55
|
+
The digest is cut at `turn/start` / `turn/end`. In a continued session, the previous turn's request, assistant output, and todos never enter the new digest, so the evaluator cannot answer with the previous task's "next" node. Merge also rejects an estimate derived for another turn, or produced before the current turn began.
|
|
56
|
+
|
|
57
|
+
Precedence: **model checkpoint (fresh, under 3 minutes) > evaluator estimate > todo ratio > none**. The node rail uses the same precedence to decide which node is "on screen".
|
|
58
|
+
|
|
59
|
+
## Key behaviours
|
|
60
|
+
|
|
61
|
+
- The projection is the durable record: `turn/start` opens a task (and clears the previous node, next node, and percent), `report_progress` updates it, `todo/write` feeds the fallback, `turn/end` closes it. It replays after a reload and survives reconnect.
|
|
62
|
+
- **Node rail:** every 15 seconds the Host hands the effective node to the pure reducer in `lib/steps.js`. A changed label closes the previous step (recording `endedAt` / `durationMs`) and opens a new one; the same label only updates its percentage and phase. The rail is capped at 100 steps, isolated per turn, and published on the read-only route.
|
|
63
|
+
- **Todo fallback:** with no report but a todo list, the bar uses `completed / total` (capped at 95% while running) and marks the value with `≈`. That costs no tokens.
|
|
64
|
+
- **Long tasks:** the evaluator refreshes at most every two minutes (configurable 30 s – 10 min), so a long stretch without a report still moves and its node still turns into a node; a fresh model report makes the evaluator skip.
|
|
65
|
+
- **Long single steps:** a model cannot report while it waits on its own tool call; after 12 seconds with no result the strip shows the evaluating state and a clock.
|
|
66
|
+
- **Scope changes:** a silent drop of more than 10 points is clamped unless the report sets `revised`.
|
|
67
|
+
|
|
68
|
+
## Appearance settings
|
|
69
|
+
|
|
70
|
+
**Settings → Task progress** exposes three fields that apply immediately and stay on this machine:
|
|
71
|
+
|
|
72
|
+
- **Bar height** — 2–24 px, default 6.
|
|
73
|
+
- **Bar color** — picker or any CSS color (`#hex`, `rgb()`, `var(--x)`); clear it to follow the theme accent. The same color paints the sidebar ring and the nodes.
|
|
74
|
+
- **Explanation size** — the line under the bar, 9–24 px, default 12.
|
|
75
|
+
- **Node list font size** — the expanded list rows, 9–24 px, default 11.
|
|
76
|
+
|
|
77
|
+
The section ends with a live preview (one completed node plus the current node) and **Reset to defaults**. Hovering the preview bar grows it, and hovering a sample node opens its detail card. Values live in this browser's localStorage, so they follow the machine rather than the repository and need no restart.
|
|
78
|
+
|
|
79
|
+
Three layers, highest first: **settings page > row config > theme default**. The row config still works for defaults shipped with a setup:
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
- id: task-progress
|
|
83
|
+
name: '@deepslacker/dsh-task-progress'
|
|
84
|
+
config:
|
|
85
|
+
barHeight: 8
|
|
86
|
+
barColor: '#7c5cff'
|
|
87
|
+
textFontSize: 14
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Other fields: `enableTool`, `minStep`, `todoBaseline`, `judge`, `judgeIntervalMs` (reload the plugin from **Plugins** after changing those); row config also accepts `listFontSize`. The appearance values can be set as CSS variables (`--dtp-bar-height`, `--dtp-bar-color`, `--dtp-font-size`, `--dtp-list-font-size`); the plugin only overrides a variable when the settings page or the row config sets it.
|
|
91
|
+
|
|
92
|
+
## Cost
|
|
93
|
+
|
|
94
|
+
- Tool schema: roughly 150–200 tokens per request (`minStep` raises the gate).
|
|
95
|
+
- One self-report: a short tool call plus a short result.
|
|
96
|
+
- One evaluator call: about 600–900 input tokens and up to 1.2k output (in practice a few dozen), at most once per two minutes per running session, skipped entirely while the model's own checkpoint is fresh.
|
|
97
|
+
- The node rail, the bar, and the evaluating state cost no model tokens.
|
|
98
|
+
|
|
99
|
+
## Limitations
|
|
100
|
+
|
|
101
|
+
- The percentage is a model judgement, not a measurement; the rubric, the `revised` flag, and the second opinion reduce but do not remove optimism.
|
|
102
|
+
- A node's duration is an **observation interval**: the Host observes the effective node every 15 seconds, so durations resolve to tens of seconds, not exact timing.
|
|
103
|
+
- The evaluator sometimes paraphrases the same work differently; a paraphrase counts as a new node and can leave two near-identical nodes.
|
|
104
|
+
- The rail lives in Host memory; after a DSH restart it starts again from the current node. The projection, self-reports, and todos remain in the log.
|
|
105
|
+
- A task finished in one step may report on that step, but the choice belongs to the model; ordinary one-step answers usually skip it, so nothing is shown.
|
|
106
|
+
- The sidebar ring hides while the row is hovered (the host's rule for trailing decorations) and sits in the trailing seat by design, not over the leading status dot.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# 任务进度
|
|
2
|
+
|
|
3
|
+
在会话里和侧栏上显示当前任务完成到哪一步;本轮里模型每换一个节点,上一个节点就会在进度条上留下一个节点。
|
|
4
|
+
|
|
5
|
+
## 显示什么
|
|
6
|
+
|
|
7
|
+
- **输入框上方**(`conversation.input.dock`):两行。第一行是整条进度条、百分比和本轮节点;第二行是阶段、当前节点、下一节点和预计剩余时间。宽度跟随会话内容区(宿主共享的 `--dsh-chat-content-width`),拖动会话宽度控制柄或缩放窗口时一起变化。仅在会话运行中出现,结束后短暂保留,历史会话和空闲会话不显示。
|
|
8
|
+
- **会话行上**(`sidebar.session.row.trailing`):行尾时间旁边的小圆环和百分比,圆环颜色与进度条颜色一致。只有“运行中、非空白、非子代理、且有估算”的会话才显示;已完成或已回复的会话从不显示。
|
|
9
|
+
|
|
10
|
+
进度条的大号百分比始终是**当前这一轮任务**的 0–100%,不跨轮累计。
|
|
11
|
+
|
|
12
|
+
### 本轮节点
|
|
13
|
+
|
|
14
|
+
节点只属于当前这一轮,不记录前面几轮会话:
|
|
15
|
+
|
|
16
|
+
- 模型自评或旁路评估每给出一个新的“当前节点”,上一个节点就算完成,在进度条上留一个实心节点;位置是它最后一次被看到时的百分比。
|
|
17
|
+
- 当前节点本身是一个空心节点,落在进度条当前百分比处;悬停能看到它的内容、阶段、已用时间,以及「下一步」。
|
|
18
|
+
- 鼠标移到任意节点上会弹出详情卡:
|
|
19
|
+
- 第几个节点、`已完成` / `进行中`;
|
|
20
|
+
- 节点内容与阶段;
|
|
21
|
+
- 完成节点显示完成时刻和**这一段耗时**(从它出现到被下一个节点替换);
|
|
22
|
+
- 当前节点显示**已用时间**和下一步。
|
|
23
|
+
- 鼠标移到进度条上,进度条会在 0.2 秒内纵向放大并带一点光晕;节点和整条进度条共用这个放大效果。
|
|
24
|
+
- 节点支持键盘 Tab 聚焦,聚焦时同样显示详情。
|
|
25
|
+
- 节点编号从 **0** 开始;同一位置附近有多个节点时会左右错开。节点位置取它最后一次被看到时的百分比。已完成节点只在当前填充范围内显示:如果评估把百分比下调,超出当前填充的节点会暂时隐藏,等进度追上再出现。
|
|
26
|
+
- 本轮最多保留最近 **100 个**节点,更早的从轨道上淡出。
|
|
27
|
+
|
|
28
|
+
轨道由宿主在旁路评估器的内存里维护(每 15 秒观察一次有效节点),所以刷新页面后节点仍在;换到下一轮时自动清空。一轮结束时,最后一个节点会在 `turn/end` 处收尾并保留一小段时间。
|
|
29
|
+
|
|
30
|
+
### 节点列表
|
|
31
|
+
|
|
32
|
+
第二行最左侧有一个带数量角标的「节点」按钮,点开后展开本轮所有节点的列表:
|
|
33
|
+
|
|
34
|
+
- 第一行是当前正在进行的节点(`节点 N [进行中]:详情 · 阶段 · 已用时间`);
|
|
35
|
+
- 分隔线以下按时间正序列出所有已完成节点(`节点 0 [已完成]:详情 · 阶段 · 耗时 · 完成时刻`),编号从 0 开始;
|
|
36
|
+
- 列表**固定 180px 高**,超出时在列表内部滚动,再次点击按钮收起;角标是本轮节点总数。
|
|
37
|
+
|
|
38
|
+
### 完成后的节点入口
|
|
39
|
+
|
|
40
|
+
模型回复完成、且这一轮就是最新一轮时,最后一条回复底部的操作行(`conversation.chat.assistant-actions`)会在上下文图标之后、分支图标之前显示一个**灰色**进度图标;它不是每轮历史回复都出现,只跟随最新完成的一轮。点击后:
|
|
41
|
+
|
|
42
|
+
- 右侧边栏打开,标签页叫「节点」,标题带同一个进度图标;
|
|
43
|
+
- 页面以**节点卡片**按时间正序展示 `rails[sessionId]` 里的全部节点:编号、`已完成 / 进行中`、节点内容、阶段、耗时和完成时刻;顶部显示节点总数;
|
|
44
|
+
- 宿主保留已完成轮次的轨道,直到下一轮第一次观察时替换;客户端在收到 `taskProgress.done` 后即使宿主还没跑下一趟清扫,也会把最后一个节点按已完成显示。
|
|
45
|
+
|
|
46
|
+
插件图标(设置 → 插件里的图标)是 `icon.svg`;设置导航里的「任务进度」图标通过 `settings.section.icon` 槽(id 与 `settings.section` 相同)注册同一套路径,所以设置页左侧也显示这个进度字形。
|
|
47
|
+
|
|
48
|
+
## 谁评估、怎么评估
|
|
49
|
+
|
|
50
|
+
评估者始终是**该会话自己的模型**,有两条通道:
|
|
51
|
+
|
|
52
|
+
1. **会话内自评工具 `report_progress`**(首选)。参数为 `percent`(0–100)、`phase`(`plan` / `execute` / `verify` / `deliver`)、`milestone`、可选的 `next`、`eta_min` 和 `revised`;工具描述里写死一套标尺——0 未开始、25 计划确定、50 核心工作完成一半、75 主体完成并在验证、100 已交付并验证。模型在节点处调用,这次调用落进会话日志,由投影折叠。
|
|
53
|
+
2. **旁路评估器**(兜底)。实测模型经常根本不调这种“遥测”工具(本机多个会话里调用数为 0),所以当某一轮开着、而上一次自评已过期时,宿主会用**该会话当前的模型路由**(最近一次请求的 provider/model)发一次短请求:输入是**只属于当前这一轮**的压缩摘要(本轮用户请求、待办清单、最近 8 次工具调用、最后一段助手输出、本轮已用分钟数),上限约 900 tokens;输出强制成一行 JSON `{percent, phase, milestone, next, eta_min}`,上限 1.2k tokens、最低推理档。结果按会话存在内存里,页面每 2 秒从一个只读路由取一次,和投影值合并显示。
|
|
54
|
+
|
|
55
|
+
摘要按 `turn/start` / `turn/end` 切分:继续会话时,前一轮的用户请求、助手输出和待办**不会**再进入这一轮的摘要,评估器因此不会把上一任务的“下一步”搬到新任务上。合并时还有一道保护:评估结果若非本轮、或产生时间早于本轮开始,一律不采用。
|
|
56
|
+
|
|
57
|
+
合并优先级:**模型自评(3 分钟内新鲜)> 旁路评估 > 待办比例 > 无**。节点轨道也按同一优先级取“当前正在显示的节点”。
|
|
58
|
+
|
|
59
|
+
## 关键状态
|
|
60
|
+
|
|
61
|
+
- **投影是自评的唯一事实来源**:`turn/start` 开启任务(清空上一任务的节点、下一节点和百分比),`report_progress` 调用更新它,`todo/write` 提供兜底,`turn/end` 收尾。刷新可重放、断线重连不丢。
|
|
62
|
+
- **节点轨道**:宿主每 15 秒把“有效节点”送进 `lib/steps.js` 的纯 reducer;标签变化时关闭上一步(记录 `endedAt` / `durationMs`)并开新步,标签不变时只更新百分比和阶段。轨道最多 100 步,按轮次隔离,并随只读路由下发。
|
|
63
|
+
- **待办兜底**:没有自评但有待办时用 `已完成 / 总数`(运行中最多 95%),百分比前加 `≈`,零 token。
|
|
64
|
+
- **长任务**:旁路评估器每 2 分钟(可配 30 秒–10 分钟)刷新一次,所以长时间不说话的轮次也会动,节点也会随之换节点;模型自评新鲜时会跳过评估调用以省 token。
|
|
65
|
+
- **单个长步骤**:模型在等自己的工具调用时无法自评;超过 12 秒没有结果就显示“评估中”并计时。
|
|
66
|
+
- **范围变化**:一次上报若把估算下调超过 10 个点,除非带 `revised`,否则会被钳制,避免倒跳。
|
|
67
|
+
|
|
68
|
+
## 外观配置
|
|
69
|
+
|
|
70
|
+
在 **设置 → 任务进度** 里有三项,改完立即生效并保存在本机:
|
|
71
|
+
|
|
72
|
+
- **进度条高度**:2–24 px,默认 6。
|
|
73
|
+
- **进度条颜色**:颜色选择器或直接输入任意 CSS 颜色(`#hex`、`rgb()`、`var(--x)`);清空即跟随主题强调色。这个颜色同时用于侧栏会话行上的圆环和节点。
|
|
74
|
+
- **说明文字字号**:进度条下方说明行,9–24 px,默认 12。
|
|
75
|
+
- **节点列表字号**:展开列表的行字号,9–24 px,默认 11。
|
|
76
|
+
|
|
77
|
+
页面底部有实时预览(含一个完成节点和一个当前节点)和「恢复默认」:预览条悬停会放大,悬停节点会显示详情卡。值存在浏览器 localStorage,所以只影响这台机器的这个界面,不需要重启。
|
|
78
|
+
|
|
79
|
+
三层优先级:**设置页 > 行配置 > 主题默认**。行配置仍可在 profile 的 `cordis.patch.yml` 里写(适合随仓库下发的默认值):
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
- id: task-progress
|
|
83
|
+
name: '@deepslacker/dsh-task-progress'
|
|
84
|
+
config:
|
|
85
|
+
barHeight: 8
|
|
86
|
+
barColor: '#7c5cff'
|
|
87
|
+
textFontSize: 14
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
其余字段:`enableTool`、`minStep`、`todoBaseline`、`judge`、`judgeIntervalMs`(改完需要在「插件」里重载一次);外观行配置还支持 `listFontSize`。也可以直接设 CSS 变量 `--dtp-bar-height` / `--dtp-bar-color` / `--dtp-font-size` / `--dtp-list-font-size`;只有在设置页或行配置里明确指定某项时,插件才会覆盖对应变量。
|
|
91
|
+
|
|
92
|
+
## 成本
|
|
93
|
+
|
|
94
|
+
- 工具 schema 约 150–200 tokens/请求(`minStep` 可调高)。
|
|
95
|
+
- 每次自评:一次短工具调用 + 一条短结果。
|
|
96
|
+
- 每次旁路评估:输入约 600–900 tokens、输出上限 1.2k(实际几十个),每个运行中的会话最多每 2 分钟一次;模型自评新鲜时完全跳过。
|
|
97
|
+
- 节点轨道、进度条和“评估中”状态不产生模型成本。
|
|
98
|
+
|
|
99
|
+
## 限制
|
|
100
|
+
|
|
101
|
+
- 百分比是模型的判断而非测量,可能偏乐观;标尺、`revised` 与旁路复核只能缓解。
|
|
102
|
+
- 节点的耗时是**观察区间**:宿主每 15 秒观察一次有效节点,所以耗时的分辨率是十几秒,不是精确计时。
|
|
103
|
+
- 旁路评估偶尔会用不同措辞描述同一件事;措辞变化会被当成一个新节点,轨道上可能出现两条内容相近的节点。
|
|
104
|
+
- 轨道只存在宿主内存里,DSH 重启后从当前节点重新开始记录;投影、自评和待办仍在日志里。
|
|
105
|
+
- 一步就完成的任务也能在第 1 步上报,但是否调用由模型决定;单步问答通常不会调,界面也就不显示。
|
|
106
|
+
- 侧栏圆环在行被 hover 时隐藏(宿主对行尾装饰的既有规则),且按设计放在行尾座位,不覆盖行首状态圆点。
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Scene mockups
|
|
2
|
+
|
|
3
|
+
`scenes.html` is a self-contained, fictional DSH-style scene used to render the two screenshots in `docs/images/`:
|
|
4
|
+
|
|
5
|
+
- `scene-progress.png` — open `scenes.html?scene=rail`
|
|
6
|
+
- `scene-completed.png` — open `scenes.html?scene=completed`
|
|
7
|
+
|
|
8
|
+
The page is a standalone static document (1600 × 1000, rendered at 2× device scale). It uses only system fonts and inline SVG; no real session data, account, or conversation is used.
|