Lines 796-844javascript
796 WHERE session_id = ? AND role = 'user' AND is_sidechain = 0
797 AND content_text IS NOT NULL AND content_text != ''
798 ORDER BY COALESCE(timestamp, ''), rowid ASC
799 LIMIT ?`).all(e,Le),s=t.prepare(`SELECT rowid AS rid, content_text
801 WHERE session_id = ? AND role = 'user' AND is_sidechain = 0
802 AND content_text IS NOT NULL AND content_text != ''
803 ORDER BY COALESCE(timestamp, '') DESC, rowid DESC
804 LIMIT ?`).all(e,Ve),r=new Map;for(let d of n)r.set(d.rid,d.content_text);for(let d of s)r.set(d.rid,d.content_text);if(r.size===0)throw new Error("no user messages available to summarise");let o=Array.from(r.entries()).sort((d,p)=>d[0]-p[0]).map(([,d])=>({content_text:d})),i=n.length===Le&&s.length===Ve&&r.size===Le+Ve,a=o.map((d,p)=>{let u=(d.content_text??"").slice(0,xc);return i&&p===Le?`--- (middle of session omitted) ---
805${p+1}. ${u}`:`${p+1}. ${u}`}).join(`
806`),c=null;try{c=Fs(e)}catch(d){console.error("[autoTitle] thread context resolution failed:",d),c=null}let l=[];return c&&(l.push(Oc(c)),l.push("")),l.push(`You will receive a sample of user messages from a Claude Code session: the first ${Le}`,`messages (initial intent) and the last ${Ve} messages (current direction).`,"Write a single descriptive title, max 50 characters, focused on what the user is","currently trying to accomplish. If initial intent and current direction differ, prefer","the current direction. Output ONLY the title, with no quotes and no trailing punctuation.","","Messages:" ...
807`)}function Oc(e){let t=[];t.push("Thread context:"),t.push(`- This session is part of thread "${e.thread_name}".`),e.parent_session&&t.push(`- Parent session: "${e.parent_session.title}"`
808`)}function Kt(e,t,n){let s=t.trim();if(!s)return;let r=h(),o=r.prepare(`SELECT auto_title, auto_title_source, auto_title_generated_at, auto_title_history
809 FROM sessions WHERE id = ?`).get(e);if(!o||n==="heuristic"&&o.auto_title_source==="agent"&&o.auto_title||o.auto_title===s&&o.auto_title_source===n)return;let i=Hs(o.auto_title_history),a=new
811 auto_title_source = ?,
812 auto_title_generated_at = ?,
813 auto_title_history = ?
814 WHERE id = ?`).run(s,n,Date.now(),JSON.stringify(i),e),vc(e,s,n,a)}function Ws(e){let t=h().prepare(`SELECT auto_title, auto_title_source, auto_title_generated_at, auto_title_history
815 FROM sessions WHERE id = ?`).get(e);return t?{auto_title:t.auto_title,auto_title_source:t.auto_title_source??null,auto_title_generated_at:t.auto_title_generated_at,auto_title_history:Hs(t.auto_title_history)}:null}function Ic(){C(),kc(zt)||Nc(zt,{recursive:!0})}function vc(
817`)}catch(r){console.error("[autoTitle] mirror write failed:",r)}}var zt,Le,Ve,xc,Gt,Yt=y(()=>{"use strict";x();v();$s();Xt();Us();zt=js(A,"titles"),Le=5,Ve
818`);for(;s!==-1;){let r=t.slice(0,s);t=t.slice(s+1),r.length>0&&e(r),s=t.indexOf(`
819`)}}}async function Kc(e,t={},n){let s=!!t.scanId,r=s?Xc(e):[],o=new Map(r.map(c=>[c.id,c.label])),i=
820`).slice(1).map(s=>s.trim()).filter(s=>s.startsWith("at ")&&!s.includes("refuseBackgroundSpend")&&!s.includes("spawnClaudePromptInternal")&&!
821`)}var tt,V,ke=y(()=>{"use strict";tt="BAAI/bge-base-en-v1.5",V=class extends Error{kind;path;underlying;cause;constructor(t){super(vl(t)),this.name="EmbedderUnavailableError",this.kind=t.kind,this.path=t.path,this.underlying=t.underlying,this.cause=t}}});var rt={};we(rt,{embed:()=>Hl,embedQuery:()=>Bl,getEmbedderStatus:()=>jl,loadEmbedder:()=>Ul,unloadEmbedder:()=>Wl});import{Worker as Cl}from"node:worker_threads";import{join as Dl}from"node:path";import{existsSync as Ml}from"node:fs";function Pl(){return Dl(be(),"dist","daemon","embedder-worker.js")}function Ir(e){for(let t of xe.values())t. ...
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
dist/mcp-server.jsView on unpkg · L816 822`),rt)}var Ie,cn,ve,nd,r_,o_,ln=y(()=>{"use strict";vr();Mr();ke();Ie=td(),cn=Ie.loadEmbedder,ve=Ie.getEmbedderStatus,nd=Ie.embed,r_=Ie.embedQuery,o_=Ie.unloadEmbedder});var Ur=y(()=>{
823`)){let i=o.trim();if(!i||!Uu(i)||Wu(i))continue;let a=i.split(/\s+/);if(a.length<5)continue;let c=Number(a[0]),l=Number(a[1]),d=a[2],p=a[3],u=a[4],g=0,_=0;if(/^\d+$/.test(p)&&(u.includes(".")||/^\d+$/.test(u))?(g=Number(p),_=Number(u)):_=Number(p),!Number.isFinite(c)||!Number.isFinite(l))continue;let S=l>1&&n(l);r.push({pid:c,ppid:l,parentAlive:S,etimeSeconds:Xu(d),pcpu:Number.isFinite(_)?_:0,rssKb:Number.isFinite(g)?g:0,orphan:!S,parentCommand:S?s(l):null})}return r}function ju(){try{return Yo("ps",["-axo","pid,ppid,etime,rss,pcpu,command"],{encoding:"utf8",timeout:2e3,maxBuffer:5*1024*1024} ...
824`),""}}function Hu(e){if(!Number.isFinite(e)||e<=1)return!1;try{return process.kill(e,0),!0}catch
825`)){let o=r.trim();if(!o||!Ju(o))continue;let i=o.split(/\s+/);if(qu(i)||i.length<5)continue;let a=Number(i[0]),c=Number(i[1]),l=i[2];!Number.isFinite(a)||!Number.isFinite(c)||n.has(a)||s.push({pid:a,ppid:c,etimeSeconds:Zu(l),etime:l,command:o})}return s.sort((r,o)=>r.etimeSeconds-o.etimeSeconds),s}function Qu(){if(process.platform==="win32")try{return Jo("powershell.exe",["-NoProfile","-NonInteractive","-Command",`Get-CimInstance Win32_Process | Where-Object { $_.Name -eq 'node.exe' -and $_.CommandLine -like '*entrypoint.js*' } | ForEach-Object { "$($_.ProcessId) $($_.ParentProcessId) 00:00 $ ...
826`),""}try{return Jo("ps",["-axo","pid,ppid,etime,rss,pcpu,command"],{encoding:"utf8",timeout:2e3,maxBuffer:5*1024*1024})}catch(e){let t=e instanceof Error?e.message:String(e);return process.stderr.write(`[daemon-processes] ps -axo failed: ${t}
827`),""}}function Zu(e){if(!e)return 0;let t=0,n=e,s=e.indexOf("-");s>=0&&(t=qo(e.slice(0,s)),n=e.slice(s+1));let r=n.split(":").map(qo),o=0,i=0,a=0;return r.length===3?[o,i,a]=r:r.length===2?[i,a]=r:r.length===1&&(a=r[0]),t*86400+o*3600+i*60+a}function qo(e){let t=Number(e);return Number.isFinite(t)?t:0}function In(e,t=new Date){if(!Number.isFinite(e)||e<0)return null;let n=t.getTime()-e*1e3;if(!Number.isFinite(n))return null;let s=new Date(n),r=String(s.getHours()).padStart(2,"0"),o=String(s.getMinutes()).padStart(2,"0"),i=String(s.getSeconds()).padStart(2,"0");return`${r}:${o}:${i}`}var Vu,vn ...
828`)}var xp,Op,$n,Ai=y(()=>{"use strict";xp=/^(.+?)[_-](\d{8})$/,Op=["_deferred","_backup"];$n="vec_chunks_v1_backup"});var Yi={};
829 using the resolved DB path below \u2014 this honors $RECALL_HOME and avoids
830 the non-expanding \`~\` that breaks in Windows cmd/PowerShell (requires
832 sqlite3 "${me}" "UPDATE sessions SET skipped_reason='reflag_loop_breaker' WHERE file_path = '${r}';"`)}return n}function Up(){let e=ht(A,"daemon.port");if(!Me(e))return null;try{let t=Un(e,
834 SUM(CASE WHEN sa.alias IS NULL OR sa.alias = '' THEN 1 ELSE 0 END) AS without_alias,
835 SUM(CASE WHEN (sa.alias IS NULL OR sa.alias = '')
836 AND s.auto_title_source = 'heuristic' THEN 1 ELSE 0 END) AS heuristic_only
838 LEFT JOIN session_aliases sa ON sa.session_id = s.id
839 WHERE s.started_at >= ?
840 AND COALESCE(s.cwd, '') NOT LIKE '/tmp/%'
841 AND COALESCE(s.cwd, '') NOT LIKE '/private/tmp/%'
842 AND COALESCE(s.cwd, '') NOT LIKE '/var/folders/%'
843 AND COALESCE(s.cwd, '') NOT LIKE '/private/var/folders/%'
844 AND COALESCE(s.cwd, '') NOT IN ('/tmp', '/private/tmp', '/')`).get(e),n=t.total??0,s=t.without_alias??0,r=t.heuristic_only??0,o=n>0?r/n:0;return{total:n,withoutAlias:s,heuristicOnly:r,fractionHeuristic:o}}catch{return{total:0,withoutAlias:0,heuristicOnly:0,fractionHeuristic:0}}}async function Pi(){let e=Up(),t=Hp(),n=Bp(),s=!1,r=null,o=null,i=null,a=null,c=null,l=[];if(e){let u=await jp(e);if(u){s=!0,r=typeof u.uptimeSeconds=="number"?u.uptimeSeconds:null,o=typeof u.version=="string"?u.version:null,i=typeof u.pipeline?.silentTerminalRejections=="number"?u.pipeline.silentTerminalReje ...
Long lines were clipped for display.