mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 13:11:10 +00:00
refactor: unify outbound session context wiring
This commit is contained in:
@@ -8,6 +8,7 @@ import { resolveAgentMainSessionKey } from "../../config/sessions.js";
|
||||
import { deliverOutboundPayloads } from "../../infra/outbound/deliver.js";
|
||||
import { resolveAgentOutboundIdentity } from "../../infra/outbound/identity.js";
|
||||
import { resolveOutboundSessionRoute } from "../../infra/outbound/outbound-session.js";
|
||||
import { buildOutboundSessionContext } from "../../infra/outbound/session-context.js";
|
||||
import { logWarn } from "../../logger.js";
|
||||
import type { CronJob, CronRunTelemetry } from "../types.js";
|
||||
import type { DeliveryTargetResolution } from "./delivery-target.js";
|
||||
@@ -170,6 +171,11 @@ export async function dispatchCronDelivery(
|
||||
});
|
||||
}
|
||||
deliveryAttempted = true;
|
||||
const deliverySession = buildOutboundSessionContext({
|
||||
cfg: params.cfgWithAgentDefaults,
|
||||
agentId: params.agentId,
|
||||
sessionKey: params.agentSessionKey,
|
||||
});
|
||||
const deliveryResults = await deliverOutboundPayloads({
|
||||
cfg: params.cfgWithAgentDefaults,
|
||||
channel: delivery.channel,
|
||||
@@ -177,12 +183,11 @@ export async function dispatchCronDelivery(
|
||||
accountId: delivery.accountId,
|
||||
threadId: delivery.threadId,
|
||||
payloads: payloadsForDelivery,
|
||||
agentId: params.agentId,
|
||||
session: deliverySession,
|
||||
identity,
|
||||
bestEffort: params.deliveryBestEffort,
|
||||
deps: createOutboundSendDeps(params.deps),
|
||||
abortSignal: params.abortSignal,
|
||||
sessionKey: params.agentSessionKey,
|
||||
});
|
||||
delivered = deliveryResults.length > 0;
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user