INNER CODE UNIT · TypeScript
isSlackOriginSession
nanocoai/nanoclaw · .claude/skills/slack-agent-flow/src/modules/slack-agent-flow/index.ts:48
async function isSlackOriginSession(session: Session): Promise<boolean> {
if (!session.messaging_group_id) return false;
return (await getMessagingGroup(session.messaging_group_id))?.channel_type === 'slack';
}
// Avatar prefetch for multi-agent creates ("build me a team"): the batch
// preview sees every create_agent row in the session's outbound batch before
// they are processed sequentially, and starts all their avatar generations in
// parallel — each is an independent async Lambda on the broker, so N waits
// collapse to ~one (~23s). Gated on ≥2 creates: a single create starts its
// flow immediately anyway, and skipping the single case means a guard-HELD
// lone request never generates an avatar it might not get approval for.
// The (displayName, description) derivation MUST mirror runSlackAgentFlow /
// orchestrate exactly — a mismatch is harmless (fresh request) but wastes the
// prefetch.
registerDeliveryBatchPreview(async (batch, session) => {
if (!(await isSlackOriginSession(session))) return;
const creates = batch