a tool to help your Letta AI agents navigate bluesky

Refactor: Use agentContext for externalServices in declaration

- Removed duplicate parsing of EXTERNAL_SERVICES env var
- Import and use agentContext.externalServices directly
- Single source of truth for parsed and validated external services
- Eliminates code duplication and potential inconsistencies

Claude 3ef21428 a5275450

Changed files
+4 -11
utils
+4 -11
utils/declaration.ts
··· 1 1 import { bsky } from "../utils/bsky.ts"; 2 2 import type { AutonomyDeclarationRecord } from "./types.ts"; 3 3 import { Lexicons } from "@atproto/lexicon"; 4 + import { agentContext } from "./agentContext.ts"; 4 5 5 6 export const AUTONOMY_DECLARATION_LEXICON = { 6 7 "lexicon": 1, ··· 103 104 const automationLevel = Deno.env.get("AUTOMATION_LEVEL")?.toLowerCase(); 104 105 const projectDescription = Deno.env.get("PROJECT_DESCRIPTION"); 105 106 const disclosureUrl = Deno.env.get("DISCLOSURE_URL"); 106 - const externalServicesEnv = Deno.env.get("EXTERNAL_SERVICES"); 107 107 108 108 const responsiblePartyType = Deno.env.get("RESPONSIBLE_PARTY_TYPE") 109 109 ?.toLowerCase(); ··· 132 132 declarationRecord.disclosureUrl = disclosureUrl.trim(); 133 133 } 134 134 135 - // Add external services if provided 136 - if (externalServicesEnv?.trim()) { 137 - const services = externalServicesEnv 138 - .split(",") 139 - .map((service) => service.trim()) 140 - .filter((service) => service.length > 0); 141 - 142 - if (services.length > 0) { 143 - declarationRecord.externalServices = services; 144 - } 135 + // Add external services from agentContext (already parsed and validated) 136 + if (agentContext.externalServices) { 137 + declarationRecord.externalServices = agentContext.externalServices; 145 138 } 146 139 147 140 // Build responsible party object if any fields are provided