feat: busy state on bind dots — bound conversation running shows alternating blinking blue glow

This commit is contained in:
Aisland
2026-08-20 00:22:23 +08:00
parent 30b694341b
commit eb8177bc22
6 changed files with 127 additions and 8 deletions
+9 -5
View File
@@ -1043,12 +1043,16 @@ function buildCustomLayoutPrompt(req: string): string {
}, [])
/** 项目 → 提醒态:绑定会话 completed=done / pendingInteraction=need(ack 过则不亮) */
const bindNotifyMap: Record<string, 'done' | 'need'> = useMemo(() => {
const map: Record<string, 'done' | 'need'> = {}
const bindNotifyMap: Record<string, 'done' | 'need' | 'busy'> = useMemo(() => {
const map: Record<string, 'done' | 'need' | 'busy'> = {}
const byId = sessionsSnapshotStore.snapshot?.byId ?? {}
const ack = loadNotifyAck()
for (const [pid, sid] of Object.entries(projects.bindings)) {
const state = sessionNotifyState(byId[sid])
const e = byId[sid]
if (!e) continue
// 优先级:工作中(蓝色交替闪烁)> 完成(绿)> 待决(黄)
if (e.running === true) { map[pid] = 'busy'; continue }
const state = sessionNotifyState(e)
if (state && ack[sid] !== state) map[pid] = state
}
return map
@@ -1361,7 +1365,7 @@ function buildCustomLayoutPrompt(req: string): string {
const arrow = kids.find((k: any) => k.tagName === 'SPAN' && String((k as HTMLElement).textContent ?? '').trim() === '›')
if (arrow) (arrow as HTMLElement).classList.add('dsh-wt_resArrow')
const tip = bound
? t('bind.tipBound', { name: boundSessionTitle(bound) }) + (bindNotifyMap[id] === 'done' ? t('bind.tipDone') : bindNotifyMap[id] === 'need' ? t('bind.tipNeed') : '')
? t('bind.tipBound', { name: boundSessionTitle(bound) }) + (bindNotifyMap[id] === 'busy' ? t('bind.tipBusy') : bindNotifyMap[id] === 'done' ? t('bind.tipDone') : bindNotifyMap[id] === 'need' ? t('bind.tipNeed') : '')
: t('bind.tipUnbound')
bindBtn.setAttribute('data-tip', tip)
bindBtn.setAttribute('aria-label', tip)
@@ -1939,7 +1943,7 @@ function buildCustomLayoutPrompt(req: string): string {
tabIndex={0}
data-bound={bindNotifyMap[l.id] ?? (projects.bindings[l.id] ? 'true' : 'false')}
data-tip={projects.bindings[l.id]
? t('bind.tipBound', { name: boundSessionTitle(projects.bindings[l.id]) }) + (bindNotifyMap[l.id] === 'done' ? t('bind.tipDone') : bindNotifyMap[l.id] === 'need' ? t('bind.tipNeed') : '')
? t('bind.tipBound', { name: boundSessionTitle(projects.bindings[l.id]) }) + (bindNotifyMap[l.id] === 'busy' ? t('bind.tipBusy') : bindNotifyMap[l.id] === 'done' ? t('bind.tipDone') : bindNotifyMap[l.id] === 'need' ? t('bind.tipNeed') : '')
: t('bind.tipUnbound')}
aria-label={projects.bindings[l.id] ? t('bind.tipBound', { name: boundSessionTitle(projects.bindings[l.id]) }) : t('bind.tipUnbound')}
onClick={(e) => { e.stopPropagation(); openBindPick(l.id, e.currentTarget as HTMLElement) }}
+2
View File
@@ -94,6 +94,7 @@ export const zh = {
'bind.titleBound': '已绑定对话(●●):点击更换或解绑',
'bind.tipUnbound': '未绑定对话:点击选择要跟随的对话',
'bind.tipDone': '(任务已完成,点击项目查看)',
'bind.tipBusy': '(对话正在处理任务…)',
'bind.tipNeed': '(需要你的决定,点击项目处理)',
'bind.folder': '项目文件夹',
'bind.folderChange': '更改',
@@ -226,6 +227,7 @@ export const en = {
'bind.titleBound': 'Conversation bound (●●): click to change or unbind',
'bind.tipUnbound': 'No conversation bound — click to pick one',
'bind.tipDone': ' (task completed — click the project to view)',
'bind.tipBusy': ' (conversation is working on the task…)',
'bind.tipNeed': ' (needs your decision — click the project to handle)',
'bind.folder': 'Project folder',
'bind.folderChange': 'Change',
+9 -3
View File
@@ -159,17 +159,23 @@ export const css = [
'.dsh-wt_bindBtn{position:absolute;right:26px;top:50%;transform:translateY(-50%);width:22px;height:22px;margin:0;display:block;border-radius:6px;color:var(--dsw-alias-label-secondary,#9aa4b2);cursor:pointer;user-select:none}',
'.dsh-wt_bindBtn:hover{background:var(--dsw-alias-fill-l2,rgba(255,255,255,.09));color:var(--dsw-alias-label-primary,#e6e8eb)}',
'.dsh-wt_bindBtn[data-bound=true]{color:var(--dsw-alias-label-primary,#e6e8eb)}',
// 任务完成提醒镜像:绿色发光 / 待决提醒:黄色发光(点击项目即 ack 恢复常态实心)
// 任务完成提醒镜像:绿色发光 / 待决提醒:黄色发光(点击项目即 ack 恢复常态实心);
// 工作中:蓝色发光 + 两圆交替亮灭(对应 DSH 对话的转圈标记,无需 ack,running 变 false 自动停)
'.dsh-wt_bindBtn[data-bound=done]{color:#3fb950}',
'.dsh-wt_bindBtn[data-bound=need]{color:#d29922}',
'.dsh-wt_bindBtn[data-bound=done] .dsh-wt_bindCircles,.dsh-wt_bindBtn[data-bound=need] .dsh-wt_bindCircles{filter:drop-shadow(0 0 3px currentColor)}',
'.dsh-wt_bindBtn[data-bound=busy]{color:#4f8ef7}',
'@keyframes dsh-wt-busyA{0%,44%{opacity:1}50%,94%{opacity:.12}100%{opacity:1}}',
'@keyframes dsh-wt-busyB{0%,44%{opacity:.12}50%,94%{opacity:1}100%{opacity:.12}}',
'.dsh-wt_bindBtn[data-bound=busy] .dsh-wt_bindCircles::before{animation:dsh-wt-busyA 1s ease-in-out infinite}',
'.dsh-wt_bindBtn[data-bound=busy] .dsh-wt_bindCircles::after{animation:dsh-wt-busyB 1s ease-in-out infinite}',
'.dsh-wt_bindBtn[data-bound=done] .dsh-wt_bindCircles,.dsh-wt_bindBtn[data-bound=need] .dsh-wt_bindCircles,.dsh-wt_bindBtn[data-bound=busy] .dsh-wt_bindCircles{filter:drop-shadow(0 0 3px currentColor)}',
// 气泡为 body 级独立元素(.dsh-wt_bindTip),此处只保留按钮本体样式
'.dsh-wt_bindTip{position:fixed;transform:translateY(-50%);padding:5px 9px;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:6px;background:var(--dsw-alias-fill-l2,#171b22);color:var(--dsw-alias-label-primary,#e6e8eb);font-size:11px;line-height:15px;white-space:nowrap;pointer-events:none;z-index:1200;box-shadow:0 4px 12px rgba(0,0,0,.35);display:none}',
'.dsh-wt_bindCircles{position:absolute;left:50%;top:50%;width:17px;height:7px;transform:translate(-50%,-50%)}',
'.dsh-wt_bindCircles::before,.dsh-wt_bindCircles::after{content:\'\';position:absolute;top:50%;width:6px;height:6px;margin-top:-3px;border-radius:50%;box-sizing:border-box;border:1.2px solid currentColor;background:transparent}',
'.dsh-wt_bindCircles::before{left:0}',
'.dsh-wt_bindCircles::after{left:10px}',
'.dsh-wt_bindBtn[data-bound=true] .dsh-wt_bindCircles::before,.dsh-wt_bindBtn[data-bound=true] .dsh-wt_bindCircles::after,.dsh-wt_bindBtn[data-bound=done] .dsh-wt_bindCircles::before,.dsh-wt_bindBtn[data-bound=done] .dsh-wt_bindCircles::after,.dsh-wt_bindBtn[data-bound=need] .dsh-wt_bindCircles::before,.dsh-wt_bindBtn[data-bound=need] .dsh-wt_bindCircles::after{background:currentColor}',
'.dsh-wt_bindBtn[data-bound=true] .dsh-wt_bindCircles::before,.dsh-wt_bindBtn[data-bound=true] .dsh-wt_bindCircles::after,.dsh-wt_bindBtn[data-bound=done] .dsh-wt_bindCircles::before,.dsh-wt_bindBtn[data-bound=done] .dsh-wt_bindCircles::after,.dsh-wt_bindBtn[data-bound=need] .dsh-wt_bindCircles::before,.dsh-wt_bindBtn[data-bound=need] .dsh-wt_bindCircles::after,.dsh-wt_bindBtn[data-bound=busy] .dsh-wt_bindCircles::before,.dsh-wt_bindBtn[data-bound=busy] .dsh-wt_bindCircles::after{background:currentColor}',
// 布局条目卡片
'.dsh-wt_layout{display:flex;align-items:center;gap:7px;padding:6px 8px;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:8px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.02));color:var(--dsw-alias-label-primary,#e6e8eb);font:inherit;font-size:12px;line-height:18px;cursor:pointer;text-align:left}',