{"version":3,"file":"file_system.d.ts","names":["BaseListChatMessageHistory","BaseMessage","StoredMessage","FILE_HISTORY_DEFAULT_FILE_PATH","FileChatSession","Record","StoredFileChatSession","FileChatStore","FileSystemChatMessageHistoryInput","FileSystemChatMessageHistory","Promise"],"sources":["../../../src/stores/message/file_system.d.ts"],"sourcesContent":["import { BaseListChatMessageHistory } from \"@langchain/core/chat_history\";\nimport { BaseMessage, StoredMessage } from \"@langchain/core/messages\";\nexport declare const FILE_HISTORY_DEFAULT_FILE_PATH = \".history/history.json\";\n/**\n * Represents a lightweight file chat session.\n */\nexport type FileChatSession = {\n    id: string;\n    context: Record<string, unknown>;\n};\n/**\n * Represents a stored chat session.\n */\nexport type StoredFileChatSession = FileChatSession & {\n    messages: StoredMessage[];\n};\n/**\n * Type for the store of chat sessions.\n */\nexport type FileChatStore = {\n    [userId: string]: Record<string, StoredFileChatSession>;\n};\n/**\n * Type for the input to the `FileSystemChatMessageHistory` constructor.\n */\nexport interface FileSystemChatMessageHistoryInput {\n    sessionId: string;\n    userId?: string;\n    filePath?: string;\n}\n/**\n * Store chat message history using a local JSON file.\n * For demo and development purposes only.\n *\n * @example\n * ```typescript\n *  const model = new ChatOpenAI({\n *   model: \"gpt-3.5-turbo\",\n *   temperature: 0,\n * });\n * const prompt = ChatPromptTemplate.fromMessages([\n *   [\n *     \"system\",\n *     \"You are a helpful assistant. Answer all questions to the best of your ability.\",\n *   ],\n *   [\"placeholder\", \"chat_history\"],\n *   [\"human\", \"{input}\"],\n * ]);\n *\n * const chain = prompt.pipe(model).pipe(new StringOutputParser());\n * const chainWithHistory = new RunnableWithMessageHistory({\n *   runnable: chain,\n *  inputMessagesKey: \"input\",\n *  historyMessagesKey: \"chat_history\",\n *   getMessageHistory: async (sessionId) => {\n *     const chatHistory = new FileSystemChatMessageHistory({\n *       sessionId: sessionId,\n *       userId: \"userId\",  // Optional\n *     })\n *     return chatHistory;\n *   },\n * });\n * await chainWithHistory.invoke(\n *   { input: \"What did I just say my name was?\" },\n *   { configurable: { sessionId: \"session-id\" } }\n * );\n * ```\n */\nexport declare class FileSystemChatMessageHistory extends BaseListChatMessageHistory {\n    lc_namespace: string[];\n    private sessionId;\n    private userId;\n    private filePath;\n    constructor(chatHistoryInput: FileSystemChatMessageHistoryInput);\n    private init;\n    protected loadStore(): Promise<FileChatStore>;\n    protected saveStore(): Promise<void>;\n    getMessages(): Promise<BaseMessage[]>;\n    addMessage(message: BaseMessage): Promise<void>;\n    clear(): Promise<void>;\n    getContext(): Promise<Record<string, unknown>>;\n    setContext(context: Record<string, unknown>): Promise<void>;\n    clearAllSessions(): Promise<void>;\n    getAllSessions(): Promise<FileChatSession[]>;\n}\n//# sourceMappingURL=file_system.d.ts.map"],"mappings":";;;;cAEqBG,8BAAAA;;AAArB;AAIA;AAOYG,KAPAF,eAAAA,GAOqB;EAMrBG,EAAAA,EAAAA,MAAAA;EAMKC,OAAAA,EAjBJH,MAiBIG,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;AA2CjB,CAAA;;;;AAQ2BE,KA/DfJ,qBAAAA,GAAwBF,eA+DTM,GAAAA;EACAT,QAAAA,EA/DbC,aA+DaD,EAAAA;CAARS;;;;AAGOL,KA7DdE,aAAAA,GA6DcF;EAARK,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA,EA5DIL,MA4DJK,CAAAA,MAAAA,EA5DmBJ,qBA4DnBI,CAAAA;CACML;;;;AAEFK,UA1DLF,iCAAAA,CA0DKE;EAfoCV,SAAAA,EAAAA,MAAAA;EAA0B,MAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA/DS,4BAAAA,SAAqCT,0BAAAA;;;;;gCAKxBQ;;yBAEPE,QAAQH;yBACRG;iBACRA,QAAQT;sBACHA,cAAcS;WACzBA;gBACKA,QAAQL;sBACFA,0BAA0BK;sBAC1BA;oBACFA,QAAQN"}