Skip to content

feat: 临时侧聊实验与选区提问 - #210

Merged
freedomkk-qfeng merged 33 commits into
ECNU:mainfrom
dbbDylan:codex/side-chat-proposal
Oct 28, 2026
Merged

freedomkk-qfeng merged 33 commits into
ECNU:mainfrom
dbbDylan:codex/side-chat-proposal

Conversation

@dbbDylan

@dbbDylan dbbDylan commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
05b23f3770ac696d3ba12321f2add616 0ef1b0a97c3534c4424f5096069c198d

参考 ChatGPT、Claude Desktop 实现了 EduWork 的侧边聊天功能:

  • 无侵入地实现了侧边聊天功能。可在主会话选中段落或点击 button 开启侧边聊天,具体功能与其它 harness 类似,不再赘述
  • 侧边聊天_与普通聊天存在形式一致_,同属于一个目录。受限于 DSH Runtime,当关闭侧边聊天时,采取的方式是归档而不是删除
  • 侧边聊天会记录主会话的历史记录(snapshot 机制)。与 ChatGPT 不同,这里的快照机制如下:

    同一主会话可以同时拥有多个侧聊,每个侧聊对应创建时的来源历史快照。引用内容时,优先使用当前聚焦且快照覆盖该内容的侧聊;如果当前侧聊不满足,则按内存中的创建顺序选择第一个覆盖该内容的侧聊。若所有现有快照都不包含引用内容,则创建新的侧聊并聚焦。

    例如,已有快照 A → B → C,其中 A 最旧、C 最新,后面的快照包含前面的历史:

    • 引用 C 才新增的内容:添加到 C,并聚焦 C。
    • 引用 B 时已有的内容:如果当前聚焦 B 或 C,就添加到当前侧聊;否则按内存顺序在 B、C 中选择第一个,并聚焦。
    • 引用 A 时已有的内容:A、B、C 均可覆盖,优先添加到当前聚焦的侧聊。
    • 引用 比 C 更新的内容:创建快照 D 对应的侧聊,添加引用并聚焦。
      主会话更新本身不会自动创建侧聊,只有引用现有快照未覆盖的新内容时才会创建。这样可以复用已有历史前缀,同时让新侧聊获得更新后的上下文;实际 KV cache 命中取决于模型服务。
  • 参考上一条,同一个会话可能存在多个侧边聊天;同时可为多个会话开启侧边聊天

@dbbDylan dbbDylan changed the title docs: 侧边临时聊天与手动转正提案 feat: 临时侧边聊天独立实验(暂不含转正) Oct 23, 2026
@dbbDylan dbbDylan changed the title feat: 临时侧边聊天独立实验(暂不含转正) feat: 临时侧聊实验,空白记录与历史上下文分离 Oct 24, 2026
@dbbDylan dbbDylan changed the title feat: 临时侧聊实验,空白记录与历史上下文分离 feat: 临时侧聊实验与选区提问 Oct 24, 2026
@dbbDylan

Copy link
Copy Markdown
Contributor Author

效果图:
image

目前已实现的功能:

  • 选中会话内容,可以选择“批注”和“在侧边聊天提问”
    image
  • 侧边聊天的会话轮次从 0 开始,但是会继承原分支的快照历史会话记录,以便拥有更详细的上下文
  • 侧边聊天的”批注“功能复用已有批注能力,可在后续会话中从原始会话和当前侧边聊天会话追加多条批注
  • 侧边聊天没有 /fork 能力
  • 侧边聊天关闭后即销毁

目前已知的问题/特性:

  • 同一个主会话目前仅支持打开一个临时会话。临时会话对主会话的上下文是不可变的,即主会话更新后,追加的会话轮次并不会补充到已存在的临时会话中

@dbbDylan
dbbDylan marked this pull request as ready for review October 25, 2026 14:02
Keep independent side chats for each source conversation without inactivity expiry, support live selections, and reuse native notice and action styles. Preserve shared model request queueing, restore desktop environment credential fallback, and trim the experiment workflow and research script.
@dbbDylan

Copy link
Copy Markdown
Contributor Author

需讨论:

  • 侧边聊天自动会携带主会话快照历史对话内容,但该内容不更新。考虑到 KV-Cache,如果需要追问新内容,应该关闭侧边聊天重新询问。是否有必要在历史会话内容更新时在侧边聊天也同步这些更新?
  • 侧边聊天和普通会话在底层存储内容上实际没什么区别。考虑到侧边聊天也可能产生比较重要的对话内容,是否需要一个_侧边聊天转为普通会话(默认放到主会话同目录下)_的能力(结果同 /fork)?

@freedomkk-qfeng

Copy link
Copy Markdown
Member

需讨论:

  • 侧边聊天自动会携带主会话快照历史对话内容,但该内容不更新。考虑到 KV-Cache,如果需要追问新内容,应该关闭侧边聊天重新询问。是否有必要在历史会话内容更新时在侧边聊天也同步这些更新?
  • 侧边聊天和普通会话在底层存储内容上实际没什么区别。考虑到侧边聊天也可能产生比较重要的对话内容,是否需要一个_侧边聊天转为普通会话(默认放到主会话同目录下)_的能力(结果同 /fork)?

感觉暂时不需要,摸着 codex 过河就好了。
但是我感觉可能要评估下,是否有可能补下这个机制
image

@freedomkk-qfeng

Copy link
Copy Markdown
Member

感谢 @dbbDylan 为侧聊原型和交互完善投入的工作,复用 DSH 原生会话界面与现有批注能力的方向很有参考价值。

我们进一步核对后,目前这套侧聊实现仍依赖配套的 Runtime 扩展,涉及临时会话、参考上下文和持久化处理;仅安装插件,还不能在未修改的官方 DSH 上独立使用。后续随 DSH 升级,也需要继续适配和验证这些扩展。

考虑到我们希望尽量通过官方扩展接口交付独立插件,这个 PR 先保持开放,暂不合入正式产品。已有实现和讨论都保留,继续观察后续 DSH 对相关能力的开放情况,届时再评估如何减少 Runtime 改动、推进插件化接入。感谢付出,也欢迎后续继续一起讨论。

丁永亮 and others added 7 commits October 26, 2026 18:42
Add the product-injection helper used to smoke-test the plugin in a locally
assembled desktop build, and refresh the reviewed-compatibility hash for the
development Studio launcher after the audit surfaced a stale entry. Local
checkpoint only; not part of the published product.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
Replace the experiment build pipeline (runtime-extension.mjs,
build-side-chat-experiment.mjs, assemble-side-chat-experiment.mjs) with
a standard seed-based fork approach:

- service.js: use agents.create({ seed }) instead of setReferenceContext
  and ephemeral session patches; return seedLength for UI filtering
- client/index.jsx: add hideInheritedNodes() to hide seed messages via
  DOM observation; fix empty-state detection for seeded sessions
- Remove dsh-llm peer dependency (no longer needed)
- Relax dsh-session peer to >=0.2.1-rc.2 for version compatibility
- Register side-chat in assembly and distribution configs

Co-Authored-By: Claude Fable 5 <[email protected]>
DSH 0.2.1-rc.3 no longer exposes @deepseek-ai/dsh-client-ui-primitives as a
shared client module, so the client bundle failed to initialise and the
plugin's UI never registered. Ship the three pieces the plugin uses (Toast,
Tooltip, warning icon) locally and drop the package from dsh.client.inject.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
packages/ is not a valid localPlugins source for the desktop assembler (its
payload step calls npm pack on dsh-plugins paths), so registering the package
there broke product assembly. The plugin stays an explicit local injection
for smoke tests until it is published and added to the plugin lock.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
A side chat is a durable Session, so the sidebar classified it as Ungrouped
for its whole lifetime. Attach it to the Workspace owning the source cwd when
it opens and detach it on close, keeping the panel grouped with its source.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
@dbbDylan

Copy link
Copy Markdown
Contributor Author

需讨论:

  • 侧边聊天自动会携带主会话快照历史对话内容,但该内容不更新。考虑到 KV-Cache,如果需要追问新内容,应该关闭侧边聊天重新询问。是否有必要在历史会话内容更新时在侧边聊天也同步这些更新?
  • 侧边聊天和普通会话在底层存储内容上实际没什么区别。考虑到侧边聊天也可能产生比较重要的对话内容,是否需要一个_侧边聊天转为普通会话(默认放到主会话同目录下)_的能力(结果同 /fork)?

感觉暂时不需要,摸着 codex 过河就好了。 但是我感觉可能要评估下,是否有可能补下这个机制 image

最新版 PR 已实现该功能:
image

Name a side chat from the selected text as soon as it opens, then replace the
placeholder with a model-distilled title once its first turn settles. The host
title action reads only the side chat's own events (skipping the seeded source
history), asks the session model for a single line, and normalizes whatever
comes back; the client renames through the standard session API.

The annotation selection action now forwards the quoted text so the
placeholder has something to name.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
丁永亮 and others added 13 commits October 27, 2026 15:32
…e host

The views override replaced the whole session body, so an empty side chat had
no composer at all. Render the native session view unconditionally and float
the hint over it.

Renaming now goes through the host's sessionTitle service instead of the
client remote, which never reached the session: the placeholder rides the open
call and the model title is applied where the agent lives.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
Wrapping the session view in a flex container broke the height chain: the
whole pane scrolled instead of the transcript. Render the native body directly
and portal the empty hint into the tab so it never takes part in layout; detect
emptiness from the conversation nodes after the seeded boundary instead of a
session projection that does not exist.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
A seeded session needs both the inherited event count and an isSeeded
header, otherwise the persisted log is unreadable on reload. The title
pass now dispatches through a prepared LLM call and only counts the side
chat's own turns. Inherited nodes are hidden by node key, and the empty
state shows only while the side chat owns no node. Quoting a streaming
row is refused, matching the reference plugin's selection guard.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
A side chat ends with its pane, but its turns still produced completed
items that no click could resolve, so they piled up as unreviewed tasks.
Skip side-chat sessions in the attention observer; approvals and
questions still notify because those need a decision.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
The first pass skipped every event of a side chat, which also silenced
the approval prompt it may be waiting on. Only the settled turn stays
quiet now; decisions still reach the tray.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
Closing a side chat only disposed its handle, so the stored log kept the
id in the ungrouped bucket and the right sidebar restored an empty tab on
every launch. Archive the session on close, sweep orphans left by an
earlier Host, and close a restored tab with no chat behind it.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
A temporary chat should leave nothing behind. The runtime has no removal
API, so the Host drops the session directory the JSONL store would keep
listing; if that is not possible the conversation stays attached to its
Workspace as an ordinary session rather than disappearing. The startup
archive sweep goes away with it: anything still stored came from a close
that could not run, and is kept.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
Removing the directory is a layout guess. Ask the persistence store
whether the session is still listed afterwards, so a store that moved
its files degrades to keeping the conversation instead of detaching an
id that resurfaces later.

Co-Authored-By: Claude Haiku 4.5 (1M context) <[email protected]>
@freedomkk-qfeng
freedomkk-qfeng merged commit ba384fe into ECNU:main Oct 28, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants