UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.13 kB
import{r as resolveScheduledPrincipal}from"./execution-context-5X9Gsql6.mjs"; //!src/cron/bind-parent.ts function resolveCronBindParent(e){if(e.pluginCommand)return{refusal:`cron bind does not apply to plugin command automations.`};if(e.sessionTarget===`main`)return{refusal:`cron bind does not apply to main-session automations.`};const t=resolveScheduledPrincipal(e,{trigger:`cron`,agentId:e.agentId??``});if(`error`in t)return{refusal:`cron bind cannot classify this automation: ${t.error}.`};if(t.kind===`parent`)return{refusal:`cron bind: this automation is already bound to its parent conversation.`};if(t.kind!==`unbound-parent`)return{refusal:`cron bind only applies to automations linked to a parent conversation by session key alone.`};return{parentSessionKey:t.parentSessionKey}}function assertCronBindApplies(e,t){const n=resolveCronBindParent(e);if(`refusal`in n)throw new TypeError(n.refusal);if(n.parentSessionKey!==t.sessionKey)throw new TypeError(`cron bind must run from this automation's parent conversation; this conversation is not its parent.`)}export{resolveCronBindParent as n,assertCronBindApplies as t};