feat: add internal hooks system
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
||||
import type { CliDeps } from "../cli/deps.js";
|
||||
import type { loadConfig } from "../config/config.js";
|
||||
import { startGmailWatcher } from "../hooks/gmail-watcher.js";
|
||||
import { clearInternalHooks } from "../hooks/internal-hooks.js";
|
||||
import { loadInternalHooks } from "../hooks/loader.js";
|
||||
import type { loadClawdbotPlugins } from "../plugins/loader.js";
|
||||
import { type PluginServicesHandle, startPluginServices } from "../plugins/services.js";
|
||||
import { startBrowserControlServerIfEnabled } from "./server-browser.js";
|
||||
@@ -90,6 +92,18 @@ export async function startGatewaySidecars(params: {
|
||||
}
|
||||
}
|
||||
|
||||
// Load internal hook handlers from configuration and directory discovery.
|
||||
try {
|
||||
// Clear any previously registered hooks to ensure fresh loading
|
||||
clearInternalHooks();
|
||||
const loadedCount = await loadInternalHooks(params.cfg, params.defaultWorkspaceDir);
|
||||
if (loadedCount > 0) {
|
||||
params.logHooks.info(`loaded ${loadedCount} internal hook handler${loadedCount > 1 ? 's' : ''}`);
|
||||
}
|
||||
} catch (err) {
|
||||
params.logHooks.error(`failed to load internal hooks: ${String(err)}`);
|
||||
}
|
||||
|
||||
// Launch configured channels so gateway replies via the surface the message came from.
|
||||
// Tests can opt out via CLAWDBOT_SKIP_CHANNELS (or legacy CLAWDBOT_SKIP_PROVIDERS).
|
||||
const skipChannels =
|
||||
|
||||
Reference in New Issue
Block a user