mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:38:28 +00:00
refactor(gateway): share gmail watcher startup flow
This commit is contained in:
@@ -10,7 +10,7 @@ import { cleanStaleLockFiles } from "../agents/session-write-lock.js";
|
||||
import type { CliDeps } from "../cli/deps.js";
|
||||
import type { loadConfig } from "../config/config.js";
|
||||
import { resolveStateDir } from "../config/paths.js";
|
||||
import { startGmailWatcher } from "../hooks/gmail-watcher.js";
|
||||
import { startGmailWatcherWithLogs } from "../hooks/gmail-watcher-lifecycle.js";
|
||||
import {
|
||||
clearInternalHooks,
|
||||
createInternalHookEvent,
|
||||
@@ -68,22 +68,10 @@ export async function startGatewaySidecars(params: {
|
||||
}
|
||||
|
||||
// Start Gmail watcher if configured (hooks.gmail.account).
|
||||
if (!isTruthyEnvValue(process.env.OPENCLAW_SKIP_GMAIL_WATCHER)) {
|
||||
try {
|
||||
const gmailResult = await startGmailWatcher(params.cfg);
|
||||
if (gmailResult.started) {
|
||||
params.logHooks.info("gmail watcher started");
|
||||
} else if (
|
||||
gmailResult.reason &&
|
||||
gmailResult.reason !== "hooks not enabled" &&
|
||||
gmailResult.reason !== "no gmail account configured"
|
||||
) {
|
||||
params.logHooks.warn(`gmail watcher not started: ${gmailResult.reason}`);
|
||||
}
|
||||
} catch (err) {
|
||||
params.logHooks.error(`gmail watcher failed to start: ${String(err)}`);
|
||||
}
|
||||
}
|
||||
await startGmailWatcherWithLogs({
|
||||
cfg: params.cfg,
|
||||
log: params.logHooks,
|
||||
});
|
||||
|
||||
// Validate hooks.gmail.model if configured.
|
||||
if (params.cfg.hooks?.gmail?.model) {
|
||||
|
||||
Reference in New Issue
Block a user