openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
35 lines (34 loc) • 1.24 kB
JavaScript
import { n as createCronRunDiagnosticsFromError } from "./run-diagnostics-D33n4kQR.mjs";
import { t as createCronExecutionId } from "./run-id-Be9gQ-r9.mjs";
import { t as commitBackgroundPayloadsToSession } from "./background-result-payloads-DpQ26rEd.mjs";
//#region src/cron/conversation-result.ts
/** Commits an internal-channel result; external deliveries are recorded by outbound delivery. */
async function commitCronConversationResult(e) {
const t = createCronExecutionId(e.jobId, e.runStartedAt);
await e.deliveryAttemptFence?.beforeAttempt();
const n = await commitBackgroundPayloadsToSession({
agentId: e.agentId,
sessionKey: e.conversation.sessionKey,
payloads: e.payloads,
idempotencyKey: `cron-current-completion:${t}`,
provenance: {
kind: "cron",
jobId: e.jobId,
runId: t
},
config: e.config,
signal: e.signal,
assertCurrent: () => {
e.signal?.throwIfAborted();
e.deliveryAttemptFence?.assertCurrent();
}
});
if (!n.ok) return n;
return {
ok: true,
...n.skipped ? { skipped: true } : {},
...n.diagnostics ? { diagnostics: createCronRunDiagnosticsFromError("delivery", n.diagnostics, { severity: "warn" }) } : {}
};
}
//#endregion
export { commitCronConversationResult as t };