dsh-aurorix-agentbook 1.8.4 → 1.8.5
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/web.js +6 -3
- package/package.json +1 -1
package/lib/web.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// 两条挂载方式(都来自 @deepseek-ai/dsh-host-webserver):
|
|
4
4
|
// webServer.register({ kind:'prefix', path, handler }) 自己拥有 HTTP 响应
|
|
5
|
-
//
|
|
5
|
+
// webCtx.on('webserver/index-inject', table => table.push({ kind:'script', ... }))
|
|
6
6
|
// 往 index.html 里塞一段脚本——侧边栏按钮就是这么加进去的
|
|
7
7
|
//
|
|
8
8
|
// 页面本身是一份自带样式的 HTML,数据和 dsh-go 原生面板同源(同一个 backend)。
|
|
@@ -871,9 +871,12 @@ export function attachWeb(ctx, { backend }) {
|
|
|
871
871
|
path: PREFIX,
|
|
872
872
|
handler: createWebHandler({ backend, connection: webCtx.connection }),
|
|
873
873
|
}), 'dsh-aurorix-agentbook: web route')
|
|
874
|
-
|
|
874
|
+
// 注入监听必须挂在 webCtx 上:宿主在 webServer 这一层 emit 事件,
|
|
875
|
+
// 挂在根 ctx 上收不到(client-connection / api-remote-access / client-modules
|
|
876
|
+
// 三个插件都挂在 webCtx)。挂错的表现是入口永远不出现,而且不报任何错。
|
|
877
|
+
const off = webCtx.effect(() => webCtx.on('webserver/index-inject', (table) => {
|
|
875
878
|
table.push({ kind: 'script', placement: 'body-end', text: floatButtonScript(PREFIX, PAGE_TITLE) })
|
|
876
|
-
}), 'dsh-aurorix-agentbook:
|
|
879
|
+
}), 'dsh-aurorix-agentbook: entry injection')
|
|
877
880
|
return () => {
|
|
878
881
|
try { dispose() } catch {}
|
|
879
882
|
try { off() } catch {}
|