import{c as e}from"../../paths-CChBdtE8.js";import{t}from"../../subsystem-hyY_8Y33.js";import n from"node:fs/promises";import r from"node:os";import i from"node:path";const a=t(`command-logger`),o=async t=>{if(t.type===`command`)try{let a=e(process.env,r.homedir),o=i.join(a,`logs`);await n.mkdir(o,{recursive:!0});let s=i.join(o,`commands.log`),c=JSON.stringify({timestamp:t.timestamp.toISOString(),action:t.action,sessionKey:t.sessionKey,senderId:t.context.senderId??`unknown`,source:t.context.commandSource??`unknown`})+`
`;await n.appendFile(s,c,`utf-8`)}catch(e){let t=e instanceof Error?e.message:String(e);a.error(`Failed to log command: ${t}`)}};export{o as default};
