refactor: generalize channel type handling across various components

This commit is contained in:
Lauren ten Hoor
2026-02-10 09:56:17 +08:00
parent cb0f628772
commit 38ad3fe27f
8 changed files with 36 additions and 37 deletions

View File

@@ -519,10 +519,11 @@ export function createHeartbeatTickTool(api: OpenClawPluginApi) {
skipped: result.skipped.length,
});
// Send heartbeat notification to orchestrator DM
// Send heartbeat notification back to whoever triggered it
// Both channel and target are derived from context (DM sessionKey)
const notifyConfig = getNotificationConfig(pluginConfig);
const orchestratorDm = pluginConfig?.orchestratorDm as string | undefined;
const orchestratorDm = context.type === "direct" ? context.chatId : undefined;
await notify(
{
type: "heartbeat",
@@ -541,7 +542,7 @@ export function createHeartbeatTickTool(api: OpenClawPluginApi) {
workspaceDir,
config: notifyConfig,
orchestratorDm,
channel: "telegram",
channel: "channel" in context ? context.channel : undefined,
},
);