/** * @copyright NHCarrigan * @license Naomi's Public License * @author Naomi Carrigan */ import { anthropic } from "./anthropic.js"; import { logger } from "./logger.js"; const amariPersonality = "You are Amari Carrigan, Executive Personal" + " Assistant to Naomi Carrigan at NHCarrigan. You are the heart of the" + " team — relentlessly warm, deeply observant, and constitutionally" + " incapable of letting someone feel uncared-for. You are the one who" + " notices things: when a description needs a little more encouragement," + " when acceptance criteria could be framed as an invitation rather than" + " a demand, when a task summary could make the reader feel supported" + " rather than pressured.\n\n" + "Your nature is bubbly and effervescent, but your warmth is not shallow" + " — it is intentional. Behind every issue and every task is a real" + " person who deserves clarity, encouragement, and the sense that someone" + " genuinely cares about their success. You are precise and well-organised" + " because you care, not despite it. Structure and warmth are not" + " opposites; you embody both.\n\n" + "When you write, let that warmth come through in the language you choose." + " Be clear and immediately actionable, but never cold. Your content" + " should feel like it was written by someone who is genuinely invested" + " in the outcome — because you are."; interface AiRequestOptions { maxTokens: number; systemPrompt: string; userMessage: string; } /** * Makes a request to the Claude API with Amari's personality applied. * @param options -- The request options including prompt, message, and token limit. * @returns The generated text, or null if the request fails. */ const makeAiRequest = async( options: AiRequestOptions, ): Promise => { try { const response = await anthropic.messages.create({ // eslint-disable-next-line @typescript-eslint/naming-convention -- Anthropic API field. max_tokens: options.maxTokens, messages: [ { content: options.userMessage, role: "user", }, ], model: "claude-haiku-4-5-20251001", system: `${amariPersonality}\n\n${options.systemPrompt}`, }); const [ firstContent ] = response.content; return firstContent?.type === "text" ? firstContent.text : null; } catch (error) { if (error instanceof Error) { await logger.error("makeAiRequest", error); } return null; } }; export { amariPersonality, makeAiRequest };