@nomadop/session-watcher-dsh 0.10.2 → 0.11.1

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/README.en.md ADDED
@@ -0,0 +1,66 @@
1
+ # @nomadop/session-watcher-dsh
2
+
3
+ [中文](README.md) | English
4
+
5
+ > Unofficial community plugin, maintained independently of DeepSeek. DeepSeek has not reviewed or endorsed it.
6
+
7
+ [Session Watcher](https://github.com/nomadop/session-watcher) inside DeepSeek Harness (DSH): it measures whether the context a session carries is still worth carrying, shows the answer in the Web UI, and carries only what you choose across a restart.
8
+
9
+ ![The composer dock's popover open on a live session](assets/dock-popover.png)
10
+
11
+ The pill below the composer is the **dock**: a lamp, the bill premium and an alert clock. Its popover places the session on the position track and splits the context stock into the rebuild baseline and the work above it.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ dsh plugin --profile web add @nomadop/session-watcher-dsh
17
+ ```
18
+
19
+ `dsh web` boots the `web` profile; add the plugin to the profile you run. It needs DSH 0.2.2-rc.1 or later.
20
+
21
+ The package registers its own `sw_event_read` tool, which reads one event of a session in the caller's directory back as the verbatim text of its messages, tool calls and tool results; nothing else needs mounting for it. The raw event record stays with DSH's optional native `session_event_read`.
22
+
23
+ An optional pi-ai adapter entry, `@nomadop/session-watcher-dsh/pi-ai`, marks the end of the last inner-compaction carrier for the provider's prompt cache. It is off unless a profile mounts it in place of the Harness's `llm-pi-ai` plugin. It takes no configuration of its own: it reads the turned-off `llm-pi-ai` row's provider dictionary, as the Loader composes it, once at startup, so the dictionary stays in one place and an edit applies at the next start, and Session Watcher's Settings page reports when it cannot use that row. While it is mounted the Models page can neither submit edits to its routes nor declare a custom provider; the [DSH plugin docs](https://nomadop.github.io/session-watcher/docs/dsh/) give the patch layer to use and how to manage the routes then, and `vendor/dsh-llm-pi-ai/UPSTREAM.md` records what it vendors and how to remove it. A profile that holds the activation as an installed bundle, the official `@nomadop/session-watcher-dsh-carrier-cache` (`carrier-cache/` in the repository) or a local `@local/sw-carrier-cache-web`, can switch it from Session Watcher's Settings, owner only, and where neither is installed, the first switching on installs the official one after a confirmation, with a second switch under it for the OpenAI Responses breakpoint, which is off until chosen and which the endpoint may reject, and the monitor's call overview records what the entry did for each summary request; those docs give both.
24
+
25
+ ## The idea
26
+
27
+ A session pays rent on the context it carries with every call, and pays a rebuild fee once when it restarts. The position `u` says which is cheaper: left of the sweet spot the rebuild fee dominates, right of it the rent does. The bill premium `br` indexes how far the bill sits above ideal restart timing, the lamp reads it in four zones (amber and red appear only right of the sweet spot), and the alert clock completes a lap each time enough rent has accumulated.
28
+
29
+ ![Session Watcher's model: the bill, the position curve and the readings](assets/model.png)
30
+
31
+ The curve is a schematic, not a measurement. To see real curves without installing anything, the [online demo](https://nomadop.github.io/session-watcher/demo) replays an anonymized session on the standalone dashboard; it is a dashboard replay, not the DSH interface.
32
+
33
+ ## The SW Meter tab
34
+
35
+ ![The SW Meter tab in a conversation](assets/sw-meter-tab.png)
36
+
37
+ The **SW Meter** tab in the conversation view shows the position chart and its verdict, the carry-rent bars, the usage history and the context buckets. In the bucket panel you check or uncheck files, skills and tools to preview where the session would sit before you decide what to keep.
38
+
39
+ ## Hand off and keep going
40
+
41
+ 1. Ask the agent to use the `sw-handoff` skill. It picks only the files and skills the next task needs in hand, writes a summary and the next task, and answers with a token.
42
+ 2. Type `/sw-continue` in the Web composer. It clears the session in place and loads the newest handoff this session prepared.
43
+ 3. The agent says in one sentence what it resumes and carries on, unless the task left a question open. The kept files are read from disk as they are now; the summary, the latest lineage headlines and the newest turns come back with the handoff.
44
+
45
+ ![A handoff prepared with sw-handoff, then /sw-continue resuming the task](assets/handoff-loop.gif)
46
+
47
+ `/sw-load [token]` loads a handoff into the session it is typed in, without clearing it, and waits for your confirmation before work resumes.
48
+
49
+ Clearing does not discard the history. Each turn stays recorded, and the agent can page, search and look up earlier sessions on demand.
50
+
51
+ ![The rotation: what is carried across a restart, and what stays in the lineage](assets/lineage.png)
52
+
53
+ ## Data and limits
54
+
55
+ - The plugin reads the session event log of the DSH host it loads into, and the files that log names. It writes its state under `~/.session-watcher`, which it shares with the Claude Code plugin; a handoff in preparation also keeps its turn notes as working files in the system temp directory. The plugin uploads nothing and has no telemetry; what the agent sends to its model provider is the host's usual traffic, handoff text included.
56
+ - The dock only observes. The tab also applies keep/discard overrides and saves price overrides, which reprice every session of the host that runs that model; neither changes the conversation. `/sw-continue` and `/sw-load` change the session, and both run only while the agent is idle. `/sw-continue` leaves the session untouched when it has prepared no handoff or when its newest handoff predates the latest context reset.
57
+ - A handoff summary is written by the agent and can leave things out. `/sw-load` waits for you to confirm the state it loads; `/sw-continue` carries on after a one-sentence note, so read that note.
58
+ - The tab and the dock are supported on `dsh web`. The DSH Desktop shell is unverified. The commands work from the Web composer only, not over ACP, in a headless run or from an SDK.
59
+ - The readings model the cost of a prompt-cached context. They are not a judgement of task quality and not a promise of savings.
60
+
61
+ ## Links
62
+
63
+ - [DSH plugin docs](https://nomadop.github.io/session-watcher/docs/dsh/): the profile to add it to, what the tab and the dock show, and handoffs that cross between the two hosts.
64
+ - [Guarantees](https://nomadop.github.io/session-watcher/docs/guarantees/): the tools, and what each host supports.
65
+ - [Paper](https://doi.org/10.5281/zenodo.21236704): *Context Is Inventory: A Rent-or-Buy Model for Prompt-Cached LLM Sessions*.
66
+ - [Source and issues](https://github.com/nomadop/session-watcher).
package/README.md CHANGED
@@ -1,9 +1,66 @@
1
1
  # @nomadop/session-watcher-dsh
2
2
 
3
- [Session Watcher](https://github.com/nomadop/session-watcher) inside DeepSeek Harness (DSH): a tab and a composer dock showing each session's restart advice, the Session Watcher tools and skills for the agent, and handoff across sessions.
3
+ 中文 | [English](README.en.md)
4
+
5
+ > 非官方社区插件,独立于 DeepSeek 维护,未经 DeepSeek 审核或认可。
6
+
7
+ 在 DeepSeek Harness(DSH)里运行 [Session Watcher](https://github.com/nomadop/session-watcher):它衡量会话携带的上下文是否还值得继续携带,把结论显示在 Web 界面上,并在重启时只带走你选定的内容。
8
+
9
+ ![在运行中的会话上打开的输入框 dock 弹层](assets/dock-popover.png)
10
+
11
+ 输入框下方的小胶囊是 **dock**:一盏状态灯、账单溢价和提醒时钟。它的弹层把会话标在位置轨道上,并把上下文存量拆成重建基线和工作上下文。
12
+
13
+ ## 安装
4
14
 
5
15
  ```bash
6
- dsh plugin --profile <name> add @nomadop/session-watcher-dsh
16
+ dsh plugin --profile web add @nomadop/session-watcher-dsh
7
17
  ```
8
18
 
9
- The [DSH plugin docs](https://nomadop.github.io/session-watcher/docs/dsh/) cover the profile to add it to, what the tab and the dock show, and handoffs that cross between the two hosts.
19
+ `dsh web` 启动的是 `web` profile;请把插件加到你实际运行的 profile。需要 DSH 0.2.2-rc.1 或更高版本。
20
+
21
+ 本包自带 `sw_event_read` 工具,把调用方所在目录下某个会话的一个事件中的消息、工具调用与工具结果按原文读回;无需另外挂载。原始事件记录仍由 DSH 可选的原生 `session_event_read` 读取。
22
+
23
+ 可选的 pi-ai 适配器入口 `@nomadop/session-watcher-dsh/pi-ai` 会为 provider 的 prompt cache 标记最后一个 inner compaction carrier 的末尾。只有 profile 用它替换 Harness 的 `llm-pi-ai` 插件时才生效。它没有自己的配置:启动时读取一次已关闭的 `llm-pi-ai` 行经 Loader 组合后的 provider 字典,字典因此只维护在一处,修改在下次启动时生效;无法使用该行时,Session Watcher 的设置页会给出提示。挂载期间,模型页既不能提交对其路由的修改,也不能声明自定义 provider;应使用的 patch 层和届时如何管理路由见 [DSH 插件文档](https://nomadop.github.io/session-watcher/docs/dsh/),`vendor/dsh-llm-pi-ai/UPSTREAM.md` 记录了它 vendor 了什么以及如何移除。若 profile 已把这一激活作为已安装的 bundle 持有,即官方的 `@nomadop/session-watcher-dsh-carrier-cache`(仓库中的 `carrier-cache/`)或本地的 `@local/sw-carrier-cache-web`,就可以在 Session Watcher 设置中切换(仅限 owner)。两者都未安装时,首次开启会在确认后安装官方 bundle。该开关之下另有一个 OpenAI Responses 缓存断点开关,开启前保持关闭,端点也可能拒绝它。SW事件(monitor)的调用概览会记录该入口对每次摘要请求做了什么。这两点同样见上述文档。
24
+
25
+ ## 思路
26
+
27
+ 会话的每次调用都要为它携带的上下文付租金,重启时则一次性付重建费。位置 `u` 说明哪种更便宜:甜点左侧重建费占主导,右侧租金占主导。账单溢价 `br` 衡量账单比在理想时机重启时高出多少,状态灯把它分成四个区(「渐深」和「偏深」只出现在甜点右侧),租金每累积到一定量,提醒时钟就走完一圈。
28
+
29
+ ![Session Watcher 的模型:账单、位置曲线与读数](assets/model.png)
30
+
31
+ 这条曲线是示意图,不是测量结果。想不安装就看到真实曲线,可以打开[在线演示](https://nomadop.github.io/session-watcher/demo):它在独立 dashboard 上回放一个匿名会话,是 dashboard 回放,不是 DSH 界面。
32
+
33
+ ## SW Meter 标签页
34
+
35
+ ![会话中的 SW Meter 标签页](assets/sw-meter-tab.png)
36
+
37
+ 对话视图里的 **SW Meter** 标签页(中文界面为「SW仪表」)显示位置图及其结论、携带租金柱、用量历史和上下文分桶。在分桶面板里勾选或取消文件、skill 和工具,可以在决定保留什么之前预览会话会落在哪里。
38
+
39
+ ## 交接并继续
40
+
41
+ 1. 让 agent 使用 `sw-handoff` skill。它只挑出下一个任务要用到的文件和 skill,写好摘要和下一个任务,并返回一个 token。
42
+ 2. 在 Web 输入框里输入 `/sw-continue`。它原地清空会话,并加载本会话准备的最新一份交接。
43
+ 3. agent 用一句话说明它接着做什么,然后继续,除非任务还留着一个待回答的问题。保留的文件按磁盘上的当前内容读取;摘要、最近的 lineage 标题和最新的几轮对话随交接一起回来。
44
+
45
+ ![用 sw-handoff 准备交接,再用 /sw-continue 接着做任务](assets/handoff-loop.gif)
46
+
47
+ `/sw-load [token]` 则把交接加载进输入它的会话,不清空会话,并等你确认后再恢复工作。
48
+
49
+ 清空不会丢掉历史。每一轮都留有记录,agent 可以按需翻页、搜索和查阅更早的会话。
50
+
51
+ ![轮换:哪些内容跨重启带走,哪些留在 lineage 里](assets/lineage.png)
52
+
53
+ ## 数据与限制
54
+
55
+ - 插件读取它所加载进的 DSH 主机的会话事件日志,以及日志里提到的文件。它把状态写在 `~/.session-watcher` 下,与 Claude Code 插件共用;准备中的交接还会把它的轮次笔记作为工作文件放在系统临时目录。插件不上传任何内容,也没有遥测;agent 发给模型 provider 的内容是主机的常规流量,包括交接文本。
56
+ - dock 只观测。标签页还会应用保留/丢弃的覆盖项并保存价格覆盖项,价格覆盖项会让主机上所有运行该模型的会话按新价格重新计价;两者都不改动对话本身。`/sw-continue` 和 `/sw-load` 会改动会话,且都只在 agent 空闲时运行。本会话没有准备交接,或其最新交接早于最近一次上下文重置时,`/sw-continue` 不会改动会话。
57
+ - 交接摘要由 agent 撰写,可能有遗漏。`/sw-load` 会等你确认它加载的状态;`/sw-continue` 只留一句说明就继续,所以请读那句说明。
58
+ - 标签页和 dock 支持 `dsh web`,DSH Desktop 外壳未经验证。命令只能在 Web 输入框里使用,不支持 ACP、headless 运行或 SDK。
59
+ - 读数刻画的是 prompt cache 下上下文的成本,不是对任务质量的评判,也不承诺节省费用。
60
+
61
+ ## 链接
62
+
63
+ - [DSH 插件文档](https://nomadop.github.io/session-watcher/docs/dsh/)(英文):插件该加到哪个 profile、标签页和 dock 显示什么,以及在两种主机之间往来的交接。
64
+ - [Guarantees](https://nomadop.github.io/session-watcher/docs/guarantees/)(英文):各工具以及每种主机支持什么。
65
+ - [论文](https://doi.org/10.5281/zenodo.21236704):*Context Is Inventory: A Rent-or-Buy Model for Prompt-Cached LLM Sessions*。
66
+ - [源码与 issue](https://github.com/nomadop/session-watcher)。
Binary file
Binary file
Binary file
Binary file
Binary file