async function e(e){if(!(!e.client||!e.connected)){e.historyLoading=!0,e.requestUpdate?.();try{e.historySessions=(await e.client.request(`sessions.list`,{})).sessions??[],e.historyError=null}catch(t){e.historyError=String(t)}finally{e.historyLoading=!1,e.requestUpdate?.()}}}async function t(e,t){if(!(!e.client||!e.connected)){e.historySelectedKey=t,e.historyMessages=[],e.requestUpdate?.();try{e.historyMessages=(await e.client.request(`sessions.get`,{key:t,limit:200})).messages??[]}catch{e.historyMessages=[]}e.requestUpdate?.()}}async function n(e,t){if(!(!e.client||!e.connected)){e.historyLoading=!0,e.requestUpdate?.();try{await e.client.request(`sessions.delete`,{key:t,deleteTranscript:!0}),e.historySessions=e.historySessions.filter(e=>e.key!==t),e.historySelectedKey===t&&(e.historySelectedKey=null,e.historyMessages=[]),e.historyError=null}catch(t){e.historyError=String(t)}finally{e.historyLoading=!1,e.requestUpdate?.()}}}export{n as deleteHistorySession,e as loadHistorySessions,t as loadSessionMessages};
//# sourceMappingURL=history-BAHhWkjM.js.map