dsh-session-launcher
moonlitdropofblood/dsh-session-launcher
Starts genuinely independent top-level sessions from inside a conversation and hands them the first task verbatim, plus one-way messaging between sessions: six agent tools (launch, message, directory, transcript, model and preset catalogs), an independence assertion that refuses to hand back a subagent, workspace and permission inheritance from the calling session, and delivery cards that keep agent-sent messages visually distinct from your own.
설치
dsh plugin --profile web add github:moonlitdropofblood/dsh-session-launcherREADME
dsh-session-launcher
DeepSeek Harness 插件:从当前对话启动真正独立的新会话,并在独立会话之间投递消息。
它是 @laoyuehanni/dsh-session-tools 的替代实现,修复后者的核心设计问题:
旧插件创建会话时不带 withoutInitiator 边界、首条消息强制套「来自会话…」委派信封,
新会话在上下文层面像发起方的委派工作者;需要审批的工具调用在无人应答的新会话里
fail closed,表现为「新会话里调用工具报错」。
设计契约
- 独立是可验证的声明,不是假设。
session_launch创建会话后立刻读回会话头:origin不得为subagent、parentSession必须缺席,否则工具直接报错。 结果里带independent: true与permissionPreset(新会话的权限预设)。 - 创建与投递全程运行在
ctx.agents.withoutInitiator()边界内——官方dsh-schedule运行时同款模式:新会话不继承发起方 agent 的因果链。 - 首条任务原样投递。 默认不加任何委派信封;只有显式
reply: true才追加 回信地址。新会话是一个普通对话,不是被告知「你是委派工作者」的子代理。 - 投递走宿主
sessionController.prompt准入路径(Web 客户端同一条路):requestId去重、冷会话显式恢复。accepted≠persisted;unknown状态用 返回的requestId经session_message重试,不会重复创建会话。
工具
| 工具 | 作用 |
|---|---|
session_launch | 新建独立顶层会话并投递首条任务;可选 cwd / title / provider+model+reasoningEffort / agentPreset / reply |
session_message | 向另一个独立会话单向投递消息;queue/steer;requestId 重试;reply 请求回报 |
session_directory | 列出可寻址会话(id/标题/目录/创建时间/归档/委派/运行中标记) |
session_transcript | 仅在用户明确要求时读取某会话最近的 user/assistant 文本消息 |
session_model_catalog | 新会话可用的模型路由(provider/model/显示名/思考档位/默认选择) |
session_preset_catalog | 新会话可用的 Agent 预设名册 |
工具名与旧插件(session_create/session_send/…)和内置 session_search/
session_event_* 均不冲突,可共存;建议启用本插件后禁用旧插件,保持工具面干净。
cwd 三种给法:绝对路径、相对发起会话的路径、用户嘴里的名字(工作区标题、
目录末级段、某个会话标题)。命中多个返回候选,一个不命中列出已知目录。
模型/预设在创建任何东西之前对照实时名册校验,miss 零成本并附完整名册供重试。
卡片(Client 半)
会话内投递卡片:凡本插件投递的消息(session_launch 首条任务 /
session_message 会话消息),在对话里渲染为整宽可折叠卡片,而不是普通用户气泡——
折叠态显示「会话投递」徽标、发件人(或「独立会话 · 首条任务」)与首句预览,
点击展开显示全文。agent 投递的流量一眼可辨。判定只认消息持久来源里的
session-launch: / session-message: requestId 前缀,不接管普通消息。
回合回执卡片:session_launch / session_message 被受理后,回答下方出现
回执卡片,点击直接打开目标会话(uiWorkspace.openSession)。新会话若需要审批,
用户一键就能过去应答。样式全部走 --dsw-alias-* 主题变量,明暗主题自适应。
安装
dsh plugin --profile <name> add @duke-dsh-plugins/dsh-session-launcher
# 或本地目录:
dsh plugin --profile <name> add /path/to/dsh-session-launcher
包内声明 dsh.bundle,安装时自动加入 profile 的 bundle 栈。装完重启 profile
(或经插件管理器热加载)。兼容门:engines.dsh >=0.2.2-rc.5 <0.3.0。
验证
npm run check # node --check index.js client.js
npm run verify # Host 激活/独立性/信封策略冒烟 + 真实兼容门预检
scripts/verify-host.mjs 用桩 ctx 驱动真实 index.js:断言六个工具注册、
withoutInitiator 边界确实包住创建与投递、独立性断言拒绝 subagent 头、
默认投递无信封、reply 投递带回信地址。scripts/verify-compat.mjs 用真实安装
(DSH_INSTALL_DIR)里 dsh-app-boot 的 evaluatePluginCompatibility 预检
manifest,防止「被静默跳过」。
已知边界
- 新会话运行用户当前默认权限预设(宿主行为,插件不越权设置):预设为 ask 类时,必须有人在新会话里应答审批,否则工具调用 fail closed。工具描述 与回执卡片都在引导用户打开新会话。
- 创建出的活 Agent 的生命周期挂在插件 fiber 上(与官方 schedule 相同): 插件重载/重启会释放活 Agent,但会话日志已持久化,侧栏点开即冷恢复。
- 向子代理会话(
origin: subagent)投递会被拒绝——那是send_message的领域。 - Client 半只做回执卡片;旧插件的
/菜单会话选择器不在本版本范围。
发布
首次走命令行,之后走 GitHub 标签(详见 AGENTS.md「发布」):
npm run publish:first # 预检 + npm publish(首次)
npm run publish:first -- --dry-run # 演练,不真发
git tag v1.0.1 && git push origin v1.0.1 # 后续:CI 自动发 npm + GitHub Release
CI 的 npm 发布走 OIDC Trusted Publishing,需先在 npmjs.com 给包配置
(repo MoonlitDropOfBlood/dsh-session-launcher + workflow .github/workflows/release.yml)。
工作流对「版本已存在」自动跳过 npm,首次 CLI 发布后补推标签只补 GitHub Release。
License
MIT