在 dsh-better-sidebar 新增分支对话页签:开出独立封存 session,注入头/中/尾脉络摘要,并使用与主对话相同的工具。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:kuanfu0430/dsh-sidebar-branch-chat
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Adds a Branch Chat tab to dsh-better-sidebar: open an independent archived session from the current main chat, inject a head / middle / tail context digest, and run with the same tools as the main agent. Branch history stays in the branch session and does not appear in the main chat list.
在 dsh-better-sidebar 新增「分支對話」頁籤:從目前主對話開出獨立的封存 session,注入頭/中/尾脈絡摘要,並使用與主 agent 相同的完整工具。分支內容只寫進分支 session,不會進入主對話列表。
Runtime dependency / 執行期依賴
This plugin is a companion tab. It does not vendor or fork Better Sidebar.
本插件是 companion 頁籤,不 fork、不安裝第二份、不修改 Better Sidebar。
| Dependency | Role | awesome-dsh-plugin |
|---|---|---|
omdsh-dev/DSH-better-sidebar (dsh-better-sidebar ≥ 0.11.0) |
Provides ctx.betterSidebar.registerTab |
listed as omdsh-dev/DSH-better-sidebar |
Install Better Sidebar first. If the service or registerTab is missing, this plugin stays loaded but hides the Branch Chat tab and logs the missing capability.
請先安裝 Better Sidebar。缺少 service/registerTab 時,本插件仍會載入,但只停用分支頁籤並寫出缺少的能力。
The planned listing for this repository is in docs/awesome-dsh-plugin.yml. After it is merged into awesome-dsh-plugin, dsh-market can pick it up from the curated registry.
本倉預定上架條目見 docs/awesome-dsh-plugin.yml。合併進 awesome-dsh-plugin 後,dsh-market 會從精選目錄收錄。
Install / 安裝
# 1. Better Sidebar (already on the curated list / 已在精選目錄)
dsh plugin --profile web add dsh-better-sidebar
# 2. This plugin from GitHub / 從 GitHub 安裝本插件
dsh plugin --profile web add github:kuanfu0430/dsh-sidebar-branch-chat
Restart dsh web, then open the Branch Chat tab from the Better Sidebar tab strip.
重啟 dsh web,在 Better Sidebar 頁籤列開啟「分支對話」。
The root package.json declares dsh.bundle.patch plus cordis.patch.yml, so dsh plugin add can install it. There is no build step.
根目錄 package.json 已宣告 dsh.bundle.patch 與 cordis.patch.yml,可直接用 dsh plugin add 安裝,無需編譯。
How it mounts / 掛載方式
- Optional peer:
dsh-better-sidebar >= 0.11.0. The profile must provide the single Better Sidebar instance. - All cross-plugin calls go through
compat.js. Only the publicctx.betterSidebar.registerTabAPI is used. New behaviour is gated on capability membership, not on a guessed minor version. - Host half uses empty session +
agents.create/resume. Branches are not subagents: the main chat gets no subagent lifecycle events, and the branch cannot hook back into the main session.
Features / 功能
- One blank composer: the first send creates the branch (label = first 20 characters of the message); later sends continue that branch.
- The branch is a new empty session. It does not copy main-chat events. Context is a head / middle / tail sandwich (first user text, middle heuristic titles, last completed turn including tools), marked as reference-only.
- The branch agent joins the main agent's currently running preset generation (
composeFrom): same tool roster and model family. A deployment with no roster stays empty; the plugin does not pretend tools exist. - The branch is archived immediately (
archiveSession). Archive failure reports failure and disposes the handle. The branch is invisible in the main session list and search; it only lives in the sidebar tab. - The tab shows user messages and assistant replies. Digest text, branch frame hints, and tool arguments / results are hidden. While busy it shows a spinner plus status (thinking /
{Tool}/ answering). Answers grow fromtext-delta(300 ms poll while busy). - Assistant bubbles use the official platform
MarkdownTextseed (same GFM / sanitizer as the main chat). User messages stay plainpre-wraptext. - Toolbar: switch existing branches (●/○) and pick this branch's model / reasoning effort. Stop is the footer button (empty + busy = stop). Enter with text steers the current turn; empty Enter flushes a queued follow-up without stopping.
- In-flight extra messages appear as a queue above the input. The branch copies the main chat permission preset, including Full access sandbox. If the policy is ask, sandbox elevation is answered inside the tab (
allowed-once/ reject).allowed-oncegrants are not inherited.ask_user_questionis not answered in the tab.
Limits / 限制
- Branches follow the main session lifetime: create / continue only while the main chat page is open. Closing the main page pauses the branch; transcripts stay in durable storage.
- Transcripts are JSON polling (idle 1.5 s, busy 300 ms). A cold branch stops event polling after
live: falseuntil the next send or manual switch. This version does not use SSE. - Chat isolation is not workspace isolation. The branch reuses the main session
cwdand the full write tool set. File / shell / git side effects share the main working tree. The frame hint is a model-visible soft constraint, not a permission boundary.
Known behaviour / 已知行為
- Context inheritance is the sandwich, not an event copy. It cuts at the last complete
turn/end. Head is the first raw user text; middle lists intervening user questions; tail keeps that turn's tool call / result. In-progress turns are omitted. Caps are indigest.js(16 KB per tool result, 64 KB total). - Custom early-compaction policies from other plugins do not apply to branches. Branches use the official 80% safety net.
- Digest and frame hints are model-visible and stripped from the UI projection.
- After archive, the tab can still list / continue the branch (live store + sessionQuery).
archive/createsuccess means the archive write completed. - When the main session leaves the store, its branch agents stop (
session/disposed). If the main chat closes mid-create / resume, the new handle is disposed. The branch session itself remains; reopening the main chat can continue it. - Preset still follows the main agent's live generation (
composedPreset+composeFrom). Model choice is per-branch: the side panel can pick any routable model, does not follow the main chat, and never callssaveSelection/session.selectModel. archivestops the current turn, then hides the branch from the main list.- Historical
subagent-settlednotices in old main chats come from the v1 subagent design. The current design emits none.
API
Host routes under /sidebar-branch/api/* are available only on loopback / the trust fence (same rules as Better Sidebar).
create { sessionId, message, provider?, model?, reasoningEffort? }→{ childId }message { sessionId, childId, text, provider?, model?, reasoningEffort? }→{ ok: true }flush { sessionId, childId }→{ ok: true, flushed }stop { sessionId, childId }→{ ok: true, outcome }archive { sessionId, childId }→{ ok: true }list { sessionId }→{ branches: [{ id, label, activity }] }events { sessionId, childId, afterSeq }→{ live, seedLength, events, nextSeq, total, busy, status, draft, queue, approvals }decide { sessionId, childId, approvalId, outcome }→{ ok, outcome }(allowed-once/rejected)models { sessionId, childId? }→{ current, routable, groups, failures }selectModel { sessionId, childId?, provider, model, reasoningEffort? }→{ selected }
Development / 開發
node --check index.js client.js compat.js composer.js digest.js interaction.js project.js
node ./test.mjs
License
链接
同类插件
zhu1090093659/dsh-web#packages/dsh-task-board★ 8597
侧边栏多列任务看板:卡片交给真实 DSH 智能体会话执行,支持 cron 定时(Host 侧到点执行,关浏览器也生效)。
zhu1090093659/dsh-web#packages/dsh-web-all★ 8597
DSH Web UI 插件与皮肤合集:任务看板、git 图、右侧面板、远程移动端 UI、桌宠、实时 token 统计与皮肤中心。
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 4424
右下角常驻的小鲸鱼挂件:余额、今日已用与每轮对话消耗(含峰谷价),余额预警与今日预算的泡泡内容都可编辑;泡泡点击序列模块化自定义,支持并列加权 A/B、随机台词与随机图片;内置 30+ 厂商模板(OpenAI / OpenRouter / Kimi / 硅基流动 / 方舟 / 智谱 / MiniMax 等),按模型查余额与订阅额度;另有任务结束音效、导入音频、自定义角色与资源管理。数据全在本机,无遥测。
ccch1mneyyy/dsh-TUI★ 4268
Claude Code 风格全屏终端 UI:像素鲸鱼顶栏、实时工作状态行、思考流式展开。
omdsh-dev/DSH-better-sidebar★ 4098
侧边栏完整工作台:内置文件渲染编辑、终端、Git 与子代理,支持三方插件注册新 Tab。
Devin-AXIS/deepseek-design#deepseek-idesign★ 1445
可视化设计工作室,支持网站、App 原型、海报、信息卡、报告和杂志的模板创建、元素编辑、选区级 AI 草稿衔接与导出。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。