refactor: narrow synchronous extension contracts

This commit is contained in:
Tianyi Cui
2026-07-13 11:58:55 +08:00
parent f7b9cea733
commit f32cfafa1a
33 changed files with 148 additions and 126 deletions

View File

@@ -212,7 +212,7 @@ export function apply(ctx: Context, config: Config): void {
// available — deriving the wording from THAT provider — and unregister it
// when the provider goes away, so the description can never outlive or
// predate the provider it describes.
let disposeTool: (() => Promise<void> | void) | undefined
let disposeTool: (() => void) | undefined
const mount = (provider: SubagentProvider): void => {
const wording = providerWording(provider.inheritsParentContext)
disposeTool = ctx.tools.register(defineTool({
@@ -283,7 +283,7 @@ export function apply(ctx: Context, config: Config): void {
})
ctx.on('subagent/provider-removed', (name) => {
if (name !== config.provider || disposeTool === undefined) return
void disposeTool()
disposeTool()
disposeTool = undefined
})
const present = ctx.subagents.getProvider(config.provider)