mirror of
https://github.com/yexi-by/dsh-unrestricted.git
synced 2026-11-28 02:30:22 +08:00
修复破限插件开机启用时的预设注册竞态
This commit is contained in:
1 parent
25f04e4211
commit
54d4e83569
4 files changed
+37
-6
No files matched your search
+4
-1
@@ -36,7 +36,7 @@ import {
|
||||
export const name = 'dsh-unrestricted'
|
||||
|
||||
/** Services required by this plugin (all host-plane residents of the web profile). */
|
||||
export const inject = ['settings', 'systemPrompt', 'agentPresets']
|
||||
export const inject = ['settings', 'systemPrompt', 'agentPresets', 'loader']
|
||||
|
||||
const RPC_CHANNEL = '/dsh-unrestricted'
|
||||
|
||||
@@ -84,6 +84,8 @@ export function apply(ctx, config) {
|
||||
|
||||
/** 用公开预设挂载接口读取当前配置;临时作用域在组装后释放。 */
|
||||
async function presetAssembly(presetId) {
|
||||
// 预设声明与本插件是并列 Loader 条目;服务可用时,声明仍可能尚未注册。
|
||||
await ctx.loader.await()
|
||||
const key = {}
|
||||
const scope = createScope(ctx, key)
|
||||
try {
|
||||
@@ -350,6 +352,7 @@ export function apply(ctx, config) {
|
||||
})
|
||||
if (state.enabled) onEnable()
|
||||
return () => {
|
||||
state.enabled = false
|
||||
unwatch()
|
||||
clearShadows()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user