#!/usr/bin/env node
import"./suppress-stderr.mjs";import"./ensure-deps.mjs";import{readStdin as X,getSessionId as Y,getSessionDBPath as Z}from"./session-helpers.mjs";import{createSessionLoaders as $}from"./session-loaders.mjs";import{appendFileSync as k}from"node:fs";import{join as w,dirname as y}from"node:path";import{homedir as C}from"node:os";import{fileURLToPath as E}from"node:url";var F=y(E(import.meta.url)),{loadSessionDB:H,loadSnapshot:K}=$(F),T=w(C(),".claude","context-mode","precompact-debug.log");try{let z=await X(),J=JSON.parse(z),{buildResumeSnapshot:M}=await K(),{SessionDB:N}=await H(),Q=Z(),q=new N({dbPath:Q}),x=Y(J),A=q.getEvents(x);if(A.length>0){let V=q.getSessionStats(x),W=M(A,{compactCount:(V?.compact_count??0)+1});q.upsertResume(x,W,A.length),q.incrementCompactCount(x)}q.close()}catch(z){try{k(T,`[${new Date().toISOString()}] ${z.message}
`)}catch{}}console.log(JSON.stringify({}));
