feat(sidechat): 实时推送 + 排队可见 + per-thread 模型选择 + 底栏重构
侧边对话的四处用户痛点,加上「实时 fork」与「隐藏会话」两条路线的可行性结论。
全部结论都有真机复现取证(在运行中的宿主上建线程 + 读真实 session 日志)。
- 排队信息漏入:create 的 `inbox.clear()` 围栏确实生效(真机复现:子会话
request 只有 [boundary, 问题]);但幽灵来源比文档更宽——父会话 mid-turn 且
工具未返回时,种子被截断在 `turn/start` 之前,而 inbox 的「领取」splice 发生
在其后,于是**父会话本轮已领取的输入**在种子折叠里仍是 pending;而冷恢复
路径完全没有围栏。修法:create 保留硬围栏(本线程自己不可能有排队输入),
resume 改为 `inheritedPendingIds` 只折继承前缀得到幽灵 id → `inbox.remove(id)`
精确清扫,绝不误杀用户自己排的队。
- 消息不及时:新增 `/sidebar/ws/sidechat` 推送(`session/event` 60ms、
`agent/assistant-stream` 250ms 去抖,**纯失效帧**,客户端带 afterSeq 重拉),
2s 轮询降级为 15s 兜底,断线自愈。
- 模型选不了:宿主对 `origin:'subagent'` 会话**显式禁用**自带选择器,
`sessionController.selectModel` 又被 subagent fence 挡;插件因此自建
`sidechat.models`(直通宿主模型目录)与 `sidechat.model`(append
`model/selection` + `installModelSelection`),并让 `sidechat.info` 报**有效**
选择而不是冻结的创建期 options。
- 排队可见 / 回显 / spinner / 错误行:`sidechat.events` 增返 `pending`(claim
顺序)、`sidechat.dequeue` 按 id 撤销或清空、发送即本地回显、立即 thinking
行、`turn/end{error}` 与失败 attempt 渲染成可见错误行;另修掉「首问未 claim
时连发第二条会注入第二对 boundary+question」(新增 `boundaryPending`)。
- 底栏重构(用户反馈「注意力全在底栏,看不到上栏的保存为新会话」):顶栏整条
删除,`[+新建][线程][保存][归档] … [模型选择器][发送/停止]` 与主会话底栏对齐
(图标靠左、选择器靠右完整显示,agent 徽标不再显示);推理强度改为**平铺行**
——宿主 `Menu` 的 submenu 只能开在父项右侧(无翻转开关)且会让整个面板失去
滚动,钉在侧栏右缘必然被裁;每个控件加宿主 `Tooltip` 悬停气泡(锚在启用的
span 上,禁用态才解释得了「为什么不能点」),替代原生 title。
设计文档:docs/plans/2026-10-12-sidechat-native-surface.md(含取证、判定、
实施偏差与未验证项);AGENTS §3.4 第 4/10 条同步。
门禁:`tsc --noEmit` / `eslint .` / `vitest run`(2268 passed / 17 skipped)全绿;
宿主半 build + pack 后真实挂载进 sidechat-test profile 并验证新路由与 WS 通道。
This commit is contained in:
1 parent
0c3e5e9279
commit
5330eab474
40 files changed
+3064
-198
No files matched your search
@@ -6,7 +6,9 @@
|
||||
* collapsible-line chrome (no cards); shimmer is reserved for generating
|
||||
* states (running status line, streaming rows, the creating hero). Motion
|
||||
* is crossfade-only (≤200ms entrances, no springs); reduced-motion disables
|
||||
* every loop. All values consume DSW tokens (fallbacks point at older alias
|
||||
* every loop. The queue tail (pending / local-echo bubbles, the failure row)
|
||||
* and the header's model-picker capsule reuse the same surfaces and tokens.
|
||||
* All values consume DSW tokens (fallbacks point at older alias
|
||||
* tokens for rc-era hosts). */
|
||||
.sidechat {
|
||||
flex: 1;
|
||||
@@ -15,39 +17,8 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* ── thread header (status dot · agent badge · threads menu · save) ─── */
|
||||
.sidechatDetailHeader {
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
min-height: 36px;
|
||||
padding: 4px 8px 4px 12px;
|
||||
border-bottom: 1px solid var(--dsw-alias-hairline);
|
||||
}
|
||||
|
||||
.sidechatHeaderDot {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.sidechatHeaderSpacer {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sidechatAgentBadge {
|
||||
flex: none;
|
||||
max-width: 55%;
|
||||
padding: 1px 8px;
|
||||
border: 1px solid var(--dsw-alias-hairline);
|
||||
border-radius: 999px;
|
||||
font: var(--dsw-font-xxs-12);
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── composer-bar controls (model picker · thread menu · save · archive):
|
||||
* every thread function sits next to the input, where the reader looks ──── */
|
||||
.sidechatIconBtn {
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
@@ -74,6 +45,37 @@
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* Model picker trigger (the host disables its own picker for subagent
|
||||
* sessions, so the thread's route is chosen here): a quiet capsule showing
|
||||
* the model in use, never a color of its own. It sits at the RIGHT end of the
|
||||
* composer bar next to send (the main composer's arrangement) and shows the
|
||||
* model in full — it yields width only when the panel is genuinely too
|
||||
* narrow, and even then its label ellipsizes instead of the bar overflowing. */
|
||||
.sidechatModelBtn {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
padding: 1px 8px;
|
||||
border: 1px solid var(--dsw-alias-hairline);
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
font: var(--dsw-font-xxs-12);
|
||||
cursor: pointer;
|
||||
transition: background-color 100ms ease-out, color 100ms ease-out;
|
||||
}
|
||||
|
||||
.sidechatModelBtn:hover {
|
||||
background: var(--dsw-alias-interactive-bg-hover);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
}
|
||||
|
||||
.sidechatModelName {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── hero (unbound tab: the one brand moment) ───────────────────────── */
|
||||
.sidechatHero {
|
||||
flex: 1;
|
||||
@@ -138,6 +140,20 @@
|
||||
color: var(--dsw-alias-danger);
|
||||
}
|
||||
|
||||
/* A provider/agent failure INSIDE the transcript (a failed attempt or a
|
||||
* turn/end error): unlike the header banner above, this is a transcript row,
|
||||
* so it takes the transcript's own width and never markdown. */
|
||||
.sidechatErrorRow {
|
||||
align-self: stretch;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid var(--dsw-alias-danger);
|
||||
border-radius: 8px;
|
||||
font: var(--dsw-font-xxs-12);
|
||||
color: var(--dsw-alias-danger);
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* ── transcript ─────────────────────────────────────────────────────── */
|
||||
.sidechatScroll {
|
||||
flex: 1;
|
||||
@@ -174,6 +190,59 @@
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* Pending / local-echo bubbles: the user surface plus the queue chrome
|
||||
* (spinner · state word · dequeue). They sit AFTER the durable rows, so the
|
||||
* reader sees the message they just sent instead of a silent composer. */
|
||||
.sidechatPending {
|
||||
align-self: flex-end;
|
||||
max-width: 88%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
padding: 8px 10px 6px 14px;
|
||||
border-radius: 18px;
|
||||
background: var(--dsw-specific-bubble, var(--dsw-alias-bg-base));
|
||||
font: var(--dsw-font-s-14);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.sidechatPendingText {
|
||||
min-width: 0;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.sidechatPendingMeta {
|
||||
align-self: flex-end;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font: var(--dsw-font-xxs-12);
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sidechatDequeueBtn {
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
cursor: pointer;
|
||||
transition: background-color 100ms ease-out, color 100ms ease-out;
|
||||
}
|
||||
|
||||
.sidechatDequeueBtn:hover {
|
||||
background: var(--dsw-alias-interactive-bg-hover);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
}
|
||||
|
||||
/* ── collapsible context rows (tool / thinking / injection, Codex-style) ──
|
||||
* One quiet line — chevron + label + one-line summary — that expands into
|
||||
* an indented body hung on a hairline thread. No cards, no fills: hierarchy
|
||||
@@ -385,18 +454,41 @@
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: 4px;
|
||||
min-height: 28px;
|
||||
}
|
||||
|
||||
.sidechatComposerMeta {
|
||||
/* The function row: fixed width (three icon buttons), never squeezed away by
|
||||
* the model selector — the selector is the element that yields space. */
|
||||
.sidechatComposerTools {
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Pushes the model selector + send action to the right edge, exactly like the
|
||||
* main conversation's composer bar. */
|
||||
.sidechatComposerSpacer {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font: var(--dsw-font-xxs-12);
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Hover-bubble anchor of one composer-bar control. An ENABLED box is required:
|
||||
* a disabled button fires no pointer events, so the bubble must anchor here to
|
||||
* still explain WHY save/archive are disabled. The default `min-width: auto`
|
||||
* keeps an icon anchor at its button's size; only the model capsule opts into
|
||||
* shrinking (see .sidechatTipShrink), so the slack absorber is the capsule and
|
||||
* never an icon. */
|
||||
.sidechatTipAnchor {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sidechatTipShrink {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sidechatSendBtn {
|
||||
@@ -451,8 +543,11 @@
|
||||
.sidechatScroll > *,
|
||||
.sidechatHero,
|
||||
.sidechatStatus,
|
||||
.sidechatSendBtn {
|
||||
.sidechatSendBtn,
|
||||
.sidechatModelBtn,
|
||||
.sidechatDequeueBtn {
|
||||
animation: none;
|
||||
transition: none;
|
||||
}
|
||||
.sidechatStatusText,
|
||||
.sidechatShimmerText {
|
||||
|
||||
Reference in new issue
Block a user