Repository navigation
fix: adapt to Cordis 4 / DSH 0.1.2-alpha.5 slots & webServer inject API - #3
Open
hao1196561270 wants to merge 1 commit into
Open
hao1196561270 wants to merge 1 commit into
hao1196561270 wants to merge 1 commit into
Conversation
- client: declare inject=['slots'] and use ctx.slots.inject/register
instead of ctx.get('slots') + ctx.effect(()=>slots.inject)
Fixes silent early-return where slots was undefined at apply time,
causing breathing indicator (conversation.input.right) to never register
on DSH 0.1.2-alpha.5 (Cordis 4.0.2).
- host: declare inject=['webServer'] and use ctx.webServer.register
instead of ctx.inject(['webServer'], httpCtx=> httpCtx.webServer.register)
Aligns with modern dsh-free-search / dsh-web-app pattern and removes
deprecated dynamic inject wrapper. Verified host route /opencodego-usage
still returns windows JSON.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复在 DSH
0.1.2-alpha.5(Cordis4.0.2)上呼吸灯不显示的问题。现象
curl /opencodego-usage正常返回rolling/weekly/monthly窗口数据,Host 侧路由工作正常根因
Cordis 4 收紧了服务注入模型:
Client 侧
slots服务 现在为异步提供,旧写法通过ctx.get('slots')绕过注入检查:在
0.1.2-alpha.5中apply时slots尚未就绪,插件直接return,导致conversation.input.right(见dsh-client-ui-conversation/lib/client.js: renderSlot("conversation.input.right"))从未注册。对比新版官方插件dsh-client-ui-attachment的正确范式:Host 侧
webServer旧ctx.inject(['webServer'], httpCtx => httpCtx.webServer.register)仍兼容但已废弃,新版dsh-free-search/dsh-web-app均改为静态export const inject = ['webServer']+ctx.webServer.register。改动
client.js: 声明inject: ['slots'],改用ctx.slots.inject/ctx.slots.register,移除ctx.get+ctx.effect包装,与dsh-client-ui-attachment保持一致。index.js: 声明export const inject = ['webServer'],改用ctx.effect(() => ctx.webServer.register({...})),移除动态ctx.inject包装。验证
node --check index.js通过,import('index.js')导出inject/apply正常C:\Users\admin\.dsh\profiles\web覆盖安装后,curl /opencodego-usage仍正常dsh web后输入框右下角呼吸灯恢复(绿>50% / 黄20–50% / 红<20%),点击可展开三窗口进度条,fetch /opencodego-usage每 2 分钟自动刷新兼容性
仅调整注入声明,不改业务逻辑与对外 API,向后兼容旧版 DSH(
inject声明在旧 Cordis 上会被忽略,ctx.slots访问仍需服务就绪后才调用,但旧版slots同步提供故不影响)。