dsh-coding-sidebar 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client-editor.js +174 -174
- package/lib/client-registry.js +318 -312
- package/lib/client-terminal.js +177 -177
- package/lib/client.js +314 -308
- package/package.json +1 -1
- package/src/client/BrowserView.tsx +17 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-coding-sidebar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "DSH web plugin: a VSCode-like right sidebar (explorer / editor / terminal / git / browser), isolated per conversation session. Exposes the betterSidebar service for other plugins to register sidebar tabs and file viewers. KCoder-maintained fork of DSH-better-sidebar 0.17.2 (bottom panel removed, upstream-decoupled release line).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -121,11 +121,18 @@ export function BrowserView(props: TabComponentProps) {
|
|
|
121
121
|
return () => { cancelled = true }
|
|
122
122
|
}, [url])
|
|
123
123
|
|
|
124
|
-
// Agent 实况自动切换(2026-09-12)
|
|
125
|
-
// target
|
|
126
|
-
//
|
|
127
|
-
//
|
|
124
|
+
// Agent 实况自动切换(2026-09-12 边沿触发重构):非实况态轮询浏览器宿主
|
|
125
|
+
// 的 page target——agent 页面(非 about: 空页)从「无」到「有」的那一拍
|
|
126
|
+
// 才自动开实况并把本 tab 顶到前台。两条风暴防线(1.0.7):
|
|
127
|
+
// - 边沿判定:上一拍必须明确观测过「无 agent 页」(null=尚无历史,首拍
|
|
128
|
+
// 永不触发)——重挂载/页面重载后 agent 页面虽在,也不构成「新出现」;
|
|
129
|
+
// 配合一次性闩,用户手动关掉实况后不会被再次强制打开。
|
|
130
|
+
// - 顶前台走 activateTab(本 tab)而非 openTab:browser 类型每次 openTab
|
|
131
|
+
// 都经 createTab 铸唯一 id 新开 tab(无 dedupe),旧写法在新挂载的组件
|
|
132
|
+
// 里每拍都 mint 新 tab,几何级繁殖直至渲染进程被打爆(引擎表现为
|
|
133
|
+
// 反复重连、tab 关不掉,只能重启应用)。
|
|
128
134
|
const autoRaised = useRef(false)
|
|
135
|
+
const hadAgentPage = useRef<boolean | null>(null)
|
|
129
136
|
useEffect(() => {
|
|
130
137
|
if (live || autoRaised.current) return
|
|
131
138
|
const timer = setInterval(async () => {
|
|
@@ -133,19 +140,20 @@ export function BrowserView(props: TabComponentProps) {
|
|
|
133
140
|
try {
|
|
134
141
|
const { targets: list } = await api.cdpTargets()
|
|
135
142
|
const agentPages = list.filter((t) => t.url !== '' && !t.url.startsWith('about:'))
|
|
136
|
-
const had =
|
|
137
|
-
|
|
143
|
+
const had = hadAgentPage.current
|
|
144
|
+
hadAgentPage.current = agentPages.length > 0
|
|
145
|
+
if (agentPages.length > 0 && had === false) {
|
|
138
146
|
autoRaised.current = true
|
|
139
147
|
setLive(true)
|
|
140
148
|
try {
|
|
141
|
-
const better = (ctx as unknown as { betterSidebar?: {
|
|
142
|
-
better?.
|
|
149
|
+
const better = (ctx as unknown as { betterSidebar?: { activateTab?: (id: string) => unknown } }).betterSidebar
|
|
150
|
+
better?.activateTab?.(tab.id)
|
|
143
151
|
} catch { /* 顶起失败:实况仍已在 tab 内容里生效 */ }
|
|
144
152
|
}
|
|
145
153
|
} catch { /* 宿主未起:静默等下次轮询 */ }
|
|
146
154
|
}, 3000)
|
|
147
155
|
return () => { clearInterval(timer) }
|
|
148
|
-
}, [live, ctx])
|
|
156
|
+
}, [live, ctx, tab.id])
|
|
149
157
|
|
|
150
158
|
const persist = (nextUrl: string): void => {
|
|
151
159
|
let host = nextUrl
|