DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

9Ashwin /

9Ashwin/dsh-session-rename

Verified

DSH plugin: a model-facing rename_session tool, so the agent can retitle a session from inside the conversation.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@f073bfa1

dsh-session-rename

A DSH (DeepSeek Harness) plugin that gives the model a rename_session tool — so the agent can retitle a session from inside the conversation.

一个 DSH 插件:给模型一个 rename_session 工具,让 agent 在对话中直接重命名当前会话。

Why

DSH 的会话标题有三个来源——首条用户消息的确定性回退、可选的 LLM 生成 provider、显式重命名——但只有 Host 侧 API(ctx.sessionTitle.rename(session, title))和线级的 session.rename。内置的 Web 客户端里没有改名入口,也没有任何模型可见的工具。这个插件补上模型这一侧。

它不做自动总结。要不要改名、改成什么,由模型按你的规则决定——典型用法是在 AGENTS.md 里约定:开始一个新需求时,把需求 id 写进会话标题。

The tool

rename_session

参数 必填 说明
title 是 新标题。归一化后必须含可见字符。
session_id 否 目标会话 id。省略即重命名当前会话——日常用法。

返回 { session_id, title, seq }(格式化 JSON 文本)。

标题语义由 @deepseek-ai/dsh-session-title 决定:写入一条 source.kind === 'user' 的 session/title 事件,钉住标题——进行中的自动生成被取代,后续用户消息也不再触发自动修订。标题只进会话日志,绝不进入模型输入。

Install

dsh plugin --profile web add -w github:9Ashwin/dsh-session-rename

-w 是给 pnpm 的:新版 profile 目录里有 pnpm-workspace.yaml,不加它会以 ERR_PNPM_ADDING_TO_ROOT 失败。若你的 profile 没有这个文件,去掉 -w 即可。

然后重启 dsh web。dsh plugin add 会读取本包的 dsh.bundle 清单并自动把 dsh-session-rename 追加进 dsh.profile.bundles。

本地开发用 link:(绝对路径):

dsh plugin --profile web add -w link:/absolute/path/to/dsh-session-rename

卸载:

dsh plugin --profile web remove -w dsh-session-rename

Recipe: name the session after the work item

把这条加进你的 AGENTS.md,模型就会在有需求 id 时自己改名:

- 开始一个新需求(出现 PRD-NNN、Issue #NNN 等需求 id)时,调用 `rename_session`,
  把会话标题改成 `<需求 id> <一句话描述>`,例如 `PRD-042 重构 router 层`。

title 由模型组织,插件不做任何拼装——所以规则想怎么写就怎么写(带不带 id、用哪种编号、要不要加阶段前缀都行)。

Design notes

零运行时依赖。 本插件不 import 任何 @deepseek-ai/* 包:工具对象按 ctx.tools.register() 的契约手写(defineTool 只是 spec→JSON Schema 的转换器, SessionId 只是恒等 brand)。这样做的原因很实际:

  • CLI 自带的 dsh-tools 与 profile 侧解析到的版本经常不一致;
  • 以 link: / github: 安装的插件若 import 官方包,Node 会从插件的 realpath 逐级向上找 node_modules,而 profile 的 node_modules/@deepseek-ai/ 未必有对应版本。

结果是同一个 peer 被解析成两个版本、链接期抛 does not provide an export named ...。不 import 就同时避开这两个问题。

代价是自己做参数校验(defineTool 原本会包一层 JSON Schema 校验),test.mjs 覆盖了这些分支。

Limitations

  • 只能改已加载的会话。 传 session_id 时走 ctx.agents.get(),冷会话会报 not loaded — open or switch to it first。省略 session_id 走当前会话,无此限制。
  • 没有专属卡片。 纯 host 插件,工具调用在对话流里显示为通用卡片;要专属视图需要 额外注册客户端的 tool.call.toolview。
  • 不自动触发。 改成什么、什么时候改,由模型(即你的规则)决定。

Development

node test.mjs

行为断言零依赖,永远运行;另外两项断言会用宿主真实的 schema 校验器验证工具定义, 解析不到 @deepseek-ai/dsh-tools 时自动跳过(可用 DSH_TOOLS=/abs/path 指定)。

License

MIT

—/ 5

No ratings yet

Verified DSH bundle

Commit f073bfa1fa7e

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout