import { bsky } from "./bsky.ts"; const notificationTypes = (Deno.env.get("BSKY_NOTIFICATION_TYPES") || "mention,reply") .split(",") .map((type) => type.trim()); const supportedTools = (Deno.env.get("BSKY_SUPPORTED_TOOLS") || "mention,reply") .split(",") .map((type) => type.trim()); const agentName = Deno.env.get("LETTA_PROJECT_NAME") ? Deno.env.get("LETTA_PROJECT_NAME") : "Agent"; const agentBskyDID = bsky?.did ? bsky.did : ""; const delayNotifMin: number = Deno.env.get("DELAY_NOTIF_SECONDS_MIN") ? Number(Deno.env.get("DELAY_NOTIF_SECONDS_MIN")) * 1000 : 20000; const delayNotifMax: number = Deno.env.get("DELAY_NOTIF_SECONDS_MAX") ? Number(Deno.env.get("DELAY_NOTIF_SECONDS_MAX")) * 1000 : 300000; const delayNotifMultiplier = Deno.env.get("DELAY_NOTIF_MULTIPLIER_PERCENT") ? (Number(Deno.env.get("DELAY_NOTIF_MULTIPLIER_PERCENT")) / 100) + 1 : 1.05; const reflectionEnabled = Deno.env.get("REFLECTION_ENABLED")?.toLowerCase() === "true"; const isProactive = Deno.env.get("IS_PROACTIVE")?.toLowerCase() === "true"; const delayReflectMin: number = Deno.env.get("DELAY_REFLECT_MINUTES_MIN") ? Number(Deno.env.get("DELAY_REFLECT_MINUTES_MIN")) : 30; const delayReflectMax: number = Deno.env.get("DELAY_REFLECT_MINUTES_MAX") ? Number(Deno.env.get("DELAY_REFLECT_MINUTES_MAX")) : 720; const sleepTimeEnabled = Deno.env.get("SLEEP_TIME") && Deno.env.get("WAKE_TIME") ? true : false; const timeZone: string = Deno.env.get("TIME_ZONE") ?? "America/Los_Angeles"; const wakeTime = Deno.env.get("WAKE_TIME") ? Number(Deno.env.get("WAKE_TIME")) : 7; const sleepTime = Deno.env.get("SLEEP_TIME") ? Number(Deno.env.get("SLEEP_TIME")) : 23; export const session = { busy: false, checkCount: 0, reflectionCount: 0, processingCount: 0, likeCount: 0, repostCount: 0, followCount: 0, mentionCount: 0, replyCount: 0, quoteCount: 0, get totalNotifs() { return ( this.likeCount + this.repostCount + this.followCount + this.mentionCount + this.replyCount + this.quoteCount ); }, agentName: agentName, agentBskyDID: agentBskyDID, notificationTypes: notificationTypes, supportedTools: supportedTools, minNotifDelaySeconds: delayNotifMin, currentNotifDelaySeconds: delayNotifMin, maxNotifDelaySeconds: delayNotifMax, notifDelayMultiplier: delayNotifMultiplier, reflectionEnabled: reflectionEnabled, isProactive: isProactive, minReflectDelayMinutes: delayReflectMin, currentReflectDelayMinutes: delayReflectMin, maxReflectDelayMinutes: delayReflectMax, sleepTimeEnabled: sleepTimeEnabled, timeZone: timeZone, wakeTime: wakeTime, sleepTime: sleepTime, }; export const claimTaskThread = () => { if (session.busy) return false; session.busy = true; return true; }; export const releaseTaskThread = () => { session.busy = false; }; export const resetSessionCounts = () => { session.likeCount = 0; session.repostCount = 0; session.followCount = 0; session.mentionCount = 0; session.replyCount = 0; session.quoteCount = 0; session.checkCount = 0; session.processingCount = 0; };