fix(atlas): register tool.execute.before and pass backgroundManager

- Add atlasHook?.['tool.execute.before'] call in tool.execute.before handler
- Pass backgroundManager option to createAtlasHook for proper bg task checking
- Move atlasHook declaration after backgroundManager initialization
This commit is contained in:
justsisyphus
2026-01-23 14:25:59 +09:00
parent e16bbbcc05
commit 75158caded

View File

@@ -199,10 +199,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
? createStartWorkHook(ctx)
: null;
const atlasHook = isHookEnabled("atlas")
? createAtlasHook(ctx)
: null;
const prometheusMdOnly = isHookEnabled("prometheus-md-only")
? createPrometheusMdOnlyHook(ctx)
: null;
@@ -211,6 +207,10 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
const backgroundManager = new BackgroundManager(ctx);
const atlasHook = isHookEnabled("atlas")
? createAtlasHook(ctx, { directory: ctx.directory, backgroundManager })
: null;
initTaskToastManager(ctx.client);
const todoContinuationEnforcer = isHookEnabled("todo-continuation-enforcer")
@@ -487,6 +487,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
await directoryReadmeInjector?.["tool.execute.before"]?.(input, output);
await rulesInjector?.["tool.execute.before"]?.(input, output);
await prometheusMdOnly?.["tool.execute.before"]?.(input, output);
await atlasHook?.["tool.execute.before"]?.(input, output);
if (input.tool === "task") {
const args = output.args as Record<string, unknown>;