You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`).find(i=>i.replace(/^[\s*/]+/,"").trim().length>0);o&&r.push(` \u{1F4AC} ${o.replace(/^[\s*/]+/,"").trim()}`)}r.push("")}r.push("\u2500\u2500 Folded File Views \u2500\u2500"),r.push("");for(letnoft.foldedFiles)r.push(Un(n)),r.push("");returnr.push("\u2500\u2500 Actions \u2500\u2500"),r.push(" To see full implementation: use smart_unfold with file path and symbol name"),r.join(`
197
-
`)}vargm=require("node:fs/promises"),Sb=require("node:fs"),Fr=require("node:path"),kb=require("node:url"),vj={},cj="12.1.0";console.log=(...t)=>{E.error("CONSOLE","Intercepted console output (MCP protocol protection)",void0,{args:t})};varwb=!1,Eb=(()=>{if(typeof__dirname<"u")return__dirname;try{return(0,Fr.dirname)((0,kb.fileURLToPath)(vj.url))}catch{returnwb=!0,process.cwd()}})(),vm=(0,Fr.resolve)(Eb,"worker-service.cjs");functionuj(){wb&&((0,Sb.existsSync)(vm)||E.error("SYSTEM","mcp-server: dirname resolution failed (both __dirname and import.meta.url are unavailable). Fell back to process.cwd() and the resolved WORKER_SCRIPT_PATH does not exist. This is the actual problem \u2014 the worker bundle is fine, but mcp-server cannot locate it. Worker auto-start will fail until the dirname-resolution path is fixed.",{workerScriptPath:vm,mcpServerDir:Eb}))}varbb={search:"/api/search",timeline:"/api/timeline"};asyncfunctionhm(t,e){E.debug("SYSTEM","\u2192 Worker API",void0,{endpoint:t,params:e});try{letr=newURLSearchParams;for(let[a,s]ofObject.entries(e))s!=null&&r.append(a,String(s));letn=`${t}?${r}`,o=awaitXs(n);if(!o.ok){leta=awaito.text();thrownewError(`Worker API error (${o.status}): ${a}`)}leti=awaito.json();returnE.debug("SYSTEM","\u2190 Worker API success",void0,{endpoint:t}),i}catch(r){returnE.error("SYSTEM","\u2190 Worker API error",{endpoint:t},r),{content:[{type:"text",text:`Error calling Worker API: ${rinstanceofError?r.message:String(r)}`}],isError:!0}}}asyncfunctionLn(t,e){E.debug("HTTP","Worker API request (POST)",void0,{endpoint:t});try{letr=awaitXs(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){leto=awaitr.text();thrownewError(`Worker API error (${r.status}): ${o}`)}letn=awaitr.json();returnE.debug("HTTP","Worker API success (POST)",void0,{endpoint:t}),{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(r){returnE.error("HTTP","Worker API error (POST)",{endpoint:t},r),{content:[{type:"text",text:`Error calling Worker API: ${rinstanceofError?r.message:String(r)}`}],isError:!0}}}asyncfunctionlj(){try{return(awaitXs("/api/health")).ok}catch(t){returnE.debug("SYSTEM","Worker health check failed",{},t),!1}}asyncfunctiondj(){if(awaitlj())return!0;E.warn("SYSTEM","Worker not available, attempting auto-start for MCP client"),uj();try{lett=Yf(),e=awaitrb(t,vm);returne||E.error("SYSTEM","Worker auto-start returned false \u2014 MCP tools that require the worker (search, timeline, get_observations) will fail until the worker is running. Check earlier log lines for the specific failure reason (Bun not found, missing worker bundle, port conflict, etc.)."),e}catch(t){returnE.error("SYSTEM","Worker auto-start threw \u2014 MCP tools that require the worker (search, timeline, get_observations) will fail until the worker is running.",void0,t),!1}}varIb=[{name:"__IMPORTANT",description:`3-LAYER WORKFLOW (ALWAYS FOLLOW):
197
+
`)}vargm=require("node:fs/promises"),Sb=require("node:fs"),Fr=require("node:path"),kb=require("node:url"),vj={},cj="12.1.1";console.log=(...t)=>{E.error("CONSOLE","Intercepted console output (MCP protocol protection)",void0,{args:t})};varwb=!1,Eb=(()=>{if(typeof__dirname<"u")return__dirname;try{return(0,Fr.dirname)((0,kb.fileURLToPath)(vj.url))}catch{returnwb=!0,process.cwd()}})(),vm=(0,Fr.resolve)(Eb,"worker-service.cjs");functionuj(){wb&&((0,Sb.existsSync)(vm)||E.error("SYSTEM","mcp-server: dirname resolution failed (both __dirname and import.meta.url are unavailable). Fell back to process.cwd() and the resolved WORKER_SCRIPT_PATH does not exist. This is the actual problem \u2014 the worker bundle is fine, but mcp-server cannot locate it. Worker auto-start will fail until the dirname-resolution path is fixed.",{workerScriptPath:vm,mcpServerDir:Eb}))}varbb={search:"/api/search",timeline:"/api/timeline"};asyncfunctionhm(t,e){E.debug("SYSTEM","\u2192 Worker API",void0,{endpoint:t,params:e});try{letr=newURLSearchParams;for(let[a,s]ofObject.entries(e))s!=null&&r.append(a,String(s));letn=`${t}?${r}`,o=awaitXs(n);if(!o.ok){leta=awaito.text();thrownewError(`Worker API error (${o.status}): ${a}`)}leti=awaito.json();returnE.debug("SYSTEM","\u2190 Worker API success",void0,{endpoint:t}),i}catch(r){returnE.error("SYSTEM","\u2190 Worker API error",{endpoint:t},r),{content:[{type:"text",text:`Error calling Worker API: ${rinstanceofError?r.message:String(r)}`}],isError:!0}}}asyncfunctionLn(t,e){E.debug("HTTP","Worker API request (POST)",void0,{endpoint:t});try{letr=awaitXs(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){leto=awaitr.text();thrownewError(`Worker API error (${r.status}): ${o}`)}letn=awaitr.json();returnE.debug("HTTP","Worker API success (POST)",void0,{endpoint:t}),{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(r){returnE.error("HTTP","Worker API error (POST)",{endpoint:t},r),{content:[{type:"text",text:`Error calling Worker API: ${rinstanceofError?r.message:String(r)}`}],isError:!0}}}asyncfunctionlj(){try{return(awaitXs("/api/health")).ok}catch(t){returnE.debug("SYSTEM","Worker health check failed",{},t),!1}}asyncfunctiondj(){if(awaitlj())return!0;E.warn("SYSTEM","Worker not available, attempting auto-start for MCP client"),uj();try{lett=Yf(),e=awaitrb(t,vm);returne||E.error("SYSTEM","Worker auto-start returned false \u2014 MCP tools that require the worker (search, timeline, get_observations) will fail until the worker is running. Check earlier log lines for the specific failure reason (Bun not found, missing worker bundle, port conflict, etc.)."),e}catch(t){returnE.error("SYSTEM","Worker auto-start threw \u2014 MCP tools that require the worker (search, timeline, get_observations) will fail until the worker is running.",void0,t),!1}}varIb=[{name:"__IMPORTANT",description:`3-LAYER WORKFLOW (ALWAYS FOLLOW):
198
198
1. search(query) \u2192 Get index with IDs (~50-100 tokens/result)
199
199
2. timeline(anchor=ID) \u2192 Get context around interesting results
200
200
3. get_observations([IDs]) \u2192 Fetch full details ONLY for filtered IDs
0 commit comments