dsh-context-manager 1.6.0 → 1.7.0

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/locale/en.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Context manager",
4
- "description": "Session context management plugin: adds a Context manager entry (the list icon on the right of the session header) to the session header and manages the model context of a DSH session — delete messages one by one or whole turns, and restore them later. Two typical uses: roll back to the start of a turn and ask again (use /ctxmgr turns to read the turn numbers, then /ctxmgr deleteturn 5 to move that whole turn out of the context), and drop noise such as error logs, pasted code and trial-and-error instructions entry by entry (use /ctxmgr list to find the indexes, then /ctxmgr delete 12,13,14). The context_manager tool offers the same operations (actions list / list-turns / delete / delete-turns / restore). Deleting appends an empty developer message (a tombstone) that replaces the range on the session surface, so the raw session log, the chat transcript and audit data stay intact and removed messages disappear only from later model requests. Turns are listed with numbers, previews and an in-progress marker. Operations that cannot append safely are written into the session log as plugin records and applied at the next request, so they survive restarts; restore puts user and context messages back at their original position and appends assistant content at the tail. Local only, nothing leaves the machine. Requires a running session; system prompts and messages that are still streaming cannot be deleted. Turning the plugin off removes the header entry, the command and the tool, while tombstones already written stay in the log.",
4
+ "description": "Session context management plugin: adds a Context manager entry (the list icon on the right of the session header) to the session header and manages the model context of a DSH session — delete messages one by one or whole turns, and restore them later. Two typical uses: roll back to the start of a turn and ask again (use /ctxmgr turns to read the turn numbers, then /ctxmgr deleteturn 5 to move that whole turn out of the context), and drop noise such as error logs, pasted code and trial-and-error instructions entry by entry (use /ctxmgr list to find the indexes, then /ctxmgr delete 12,13,14). The context_manager tool offers the same operations (actions list / list-turns / delete / delete-turns / restore). Deleting appends an empty developer message (a tombstone) that replaces the range on the session surface, so the raw session log, the chat transcript and audit data stay intact and removed messages disappear only from later model requests. Turns are listed with numbers, previews and an in-progress marker. Operations that cannot append safely are written into the session log as plugin records and applied at the next request, so they survive restarts; restore puts user and context messages back at their original position and appends assistant content at the tail. Local only, nothing leaves the machine. Requires a running session; system prompts and messages that are still streaming cannot be deleted. Turning the plugin off removes the header entry, the command and the tool, while tombstones already written stay in the log. Message rows and the total occupation show heuristic token estimates (4 characters ≈ 1 token; Chinese text and JSON are markedly underestimated; the Host prefers node pricing from ctx.tokenMeter when available). A new /ctxmgr clean <target tokens> command and the context_manager action clean trim the largest tool and assistant messages down to a token budget: user and context messages are never eligible, the most recent 3 messages are protected by default, candidates below 100 tokens are skipped, and deletions still go through the restorable tombstone and queue pipeline. It also keeps a batch ledger: every delete, whole-turn delete, clean and undo mints a batch id and appends an append-only plugin:context-manager/batch record to the session log (viewable with /ctxmgr batches, still there after a restart, no external files), and /ctxmgr undo-batch undoes the latest operation or a specific batch by batch-id prefix through the existing restore path. Not the same plugin as the same-named @sulytwelve/dsh-context-manager: this one only does reversible, in-place trimming of the exact selection inside the current session — no cross-session memory, no global compression engine, no dashboard. Each tombstone source also carries a tiny recall pointer: at most 8 entries, previews truncated to 80 characters, storing only seq / role / a one-line preview and never the full message text. Deleting therefore unloads content from the main context into a searchable archive instead of erasing it: the read-only session_event_search tool of @deepseek-ai/dsh-tool-session-query can find it by keyword, and session_event_read returns the complete original event for a seq (searches exclude the caller session and are authorized by the workspace cwd). A new /ctxmgr compact <start> <end> command and context_manager action compact (parameters start / end) hand only the user selection to the official ctx.compaction.compactRegion for one summary — start / end are surface position seqs whose edges must be tool-pair balanced, a loaded compaction backend such as dsh-compaction-basic is required, no global threshold compaction is performed, and both success and failure are recorded in the ledger. The dialog gains a filter dropdown (all / user / assistant / tool / context) that only affects display while selection and token totals stay unchanged, and user message rows carry a protected marker.",
5
5
  "detail": "docs/DETAIL.md"
6
6
  }
7
7
  }
package/locale/zh.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "会话上下文管理",
4
- "description": "会话上下文管理插件:在会话标题栏增加「上下文管理」入口(标题栏右侧的列表图标),管理会话的模型上下文——按条删、按整轮删,之后还能恢复。典型用法有两个:回退到某一轮的开始重新提问(用 /ctxmgr turns 看清轮号,再用 /ctxmgr deleteturn 5 把该轮整体移出上下文),以及把报错日志、粘贴的代码与试错指令按条清出上下文(/ctxmgr list 找序号,再用 /ctxmgr delete 12,13,14 清掉)。也可以用 context_manager 工具(action 为 list / list-turns / delete / delete-turns / restore)。删除的做法是追加一条空的 developer 消息,在会话表面上替换掉目标区间(tombstone),因此原始会话日志、聊天记录与审计数据始终保留,被删的消息只是从后续模型请求中消失。对话轮列表带轮号、预览与「进行中」标记。无法安全追加的操作会作为 plugin 记录写进会话日志,在下一个请求时应用,重启不丢失;恢复时用户与上下文消息回到原位置,助手内容追加到末尾。纯本地运行,不外发任何数据。需要会话处于运行状态;系统提示词与仍在流式生成的消息不在可删除范围内。关闭插件后标题栏入口、命令与工具都会消失,已写入日志的删除记录仍然保留。",
4
+ "description": "会话上下文管理插件:在会话标题栏增加「上下文管理」入口(标题栏右侧的列表图标),管理会话的模型上下文——按条删、按整轮删,之后还能恢复。典型用法有两个:回退到某一轮的开始重新提问(用 /ctxmgr turns 看清轮号,再用 /ctxmgr deleteturn 5 把该轮整体移出上下文),以及把报错日志、粘贴的代码与试错指令按条清出上下文(/ctxmgr list 找序号,再用 /ctxmgr delete 12,13,14 清掉)。也可以用 context_manager 工具(action 为 list / list-turns / delete / delete-turns / restore)。删除的做法是追加一条空的 developer 消息,在会话表面上替换掉目标区间(tombstone),因此原始会话日志、聊天记录与审计数据始终保留,被删的消息只是从后续模型请求中消失。对话轮列表带轮号、预览与「进行中」标记。无法安全追加的操作会作为 plugin 记录写进会话日志,在下一个请求时应用,重启不丢失;恢复时用户与上下文消息回到原位置,助手内容追加到末尾。纯本地运行,不外发任何数据。需要会话处于运行状态;系统提示词与仍在流式生成的消息不在可删除范围内。关闭插件后标题栏入口、命令与工具都会消失,已写入日志的删除记录仍然保留。消息列表与总占用显示启发式估算的 token(4 字符 ≈ 1 token,中文与 JSON 明显低估;Host 有 token-meter 时优先用其节点定价);新增 /ctxmgr clean <目标tokens> 与工具 action=clean,按预算清理最占 token 的工具 / 助手消息:用户消息与上下文消息永不入选,默认保护最近 3 条、候选 ≥100 tokens,删除仍走可恢复的墓碑与队列管线。新增批次台账:每次删除、整轮删除、按预算清理与撤销都会生成批次号并在会话日志追加 plugin:context-manager/batch 审计记录(只增不改、重启后仍可查、不写外部文件),用 /ctxmgr batches 查看、用 /ctxmgr undo-batch 撤销最近一次操作(也可按批次号前几位撤销指定批次,撤销复用既有 restore 路径)。注意与同名的 @sulytwelve/dsh-context-manager 区分:我们只做当前会话内、用户精确选区、可逆的就地裁剪,不做跨会话记忆,也不做全局压缩引擎或仪表板。 墓碑的 source 里另带一个极短的召回指针 recall:最多 8 条、preview 截断到 80 字符、只存 seq / 角色 / 一行摘要,不写消息全文;删掉的内容因此不是被擦除,而是从主上下文卸载到可检索存档——可用 @deepseek-ai/dsh-tool-session-query 的 session_event_search 按关键字检索、或用 session_event_read 按 seq 读取完整原始事件(搜索排除调用方会话、按工作区 cwd 授权)。新增 /ctxmgr compact <起序号> <止序号> 与工具 action=compact(参数 start / end):只把用户选区交给官方 ctx.compaction.compactRegion 换成一条摘要,start / end 是表面位置序号且两端必须工具配对平衡,需要环境加载压缩后端(如 dsh-compaction-basic),不做全局阈值压缩,成功与失败都会写进台账。弹窗新增过滤下拉(全部 / 用户 / 助手 / 工具 / 上下文,只影响显示,选择与 token 总计不变),用户消息行带「受保护」标记。",
5
5
  "detail": "docs/DETAIL.zh.md"
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-manager",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "description": "Manage a DSH session's model context: delete single messages or whole conversation turns (roll back to the start of any turn, drop noise), and restore them later, without touching the raw session log.",
6
6
  "license": "MIT",