diff --git a/plugin/package.json b/plugin/package.json index c7aa0d55..6316b3b4 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -1,6 +1,6 @@ { "name": "claude-mem-plugin", - "version": "7.0.8", + "version": "7.0.9", "private": true, "description": "Runtime dependencies for claude-mem bundled hooks", "type": "module", diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs index 74ae47f5..e5db5ca4 100755 --- a/plugin/scripts/worker-service.cjs +++ b/plugin/scripts/worker-service.cjs @@ -1038,7 +1038,7 @@ Other tips: WHERE project IS NOT NULL GROUP BY project ORDER BY MAX(created_at_epoch) DESC - `).all().map(o=>o.project);t.json({projects:n})});handleGetProcessingStatus=this.wrapHandler((r,t)=>{let s=this.sessionManager.isAnySessionProcessing(),i=this.sessionManager.getTotalActiveWork();t.json({isProcessing:s,queueDepth:i})});handleSetProcessing=this.wrapHandler((r,t)=>{this.workerService.broadcastProcessingStatus();let s=this.sessionManager.isAnySessionProcessing(),i=this.sessionManager.getTotalQueueDepth(),n=this.sessionManager.getActiveSessionCount();t.json({status:"ok",isProcessing:s})});parsePaginationParams(r){let t=parseInt(r.query.offset,10)||0,s=Math.min(parseInt(r.query.limit,10)||20,100),i=r.query.project;return{offset:t,limit:s,project:i}}};var Ll=class extends br{constructor(r){super();this.searchManager=r}setupRoutes(r){r.get("/api/search",this.handleUnifiedSearch.bind(this)),r.get("/api/timeline",this.handleUnifiedTimeline.bind(this)),r.get("/api/decisions",this.handleDecisions.bind(this)),r.get("/api/changes",this.handleChanges.bind(this)),r.get("/api/how-it-works",this.handleHowItWorks.bind(this)),r.get("/api/search/observations",this.handleSearchObservations.bind(this)),r.get("/api/search/sessions",this.handleSearchSessions.bind(this)),r.get("/api/search/prompts",this.handleSearchPrompts.bind(this)),r.get("/api/search/by-concept",this.handleSearchByConcept.bind(this)),r.get("/api/search/by-file",this.handleSearchByFile.bind(this)),r.get("/api/search/by-type",this.handleSearchByType.bind(this)),r.get("/api/context/recent",this.handleGetRecentContext.bind(this)),r.get("/api/context/timeline",this.handleGetContextTimeline.bind(this)),r.get("/api/context/preview",this.handleContextPreview.bind(this)),r.get("/api/context/inject",this.handleContextInject.bind(this)),r.get("/api/timeline/by-query",this.handleGetTimelineByQuery.bind(this)),r.get("/api/search/help",this.handleSearchHelp.bind(this))}handleUnifiedSearch=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.search(r.query);t.json(s.content)});handleUnifiedTimeline=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.timeline(r.query);t.json(s.content)});handleDecisions=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.decisions(r.query);t.json(s.content)});handleChanges=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.changes(r.query);t.json(s.content)});handleHowItWorks=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.howItWorks(r.query);t.json(s.content)});handleSearchObservations=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.searchObservations(r.query);t.json(s.content)});handleSearchSessions=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.searchSessions(r.query);t.json(s.content)});handleSearchPrompts=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.searchUserPrompts(r.query);t.json(s.content)});handleSearchByConcept=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.findByConcept(r.query);t.json(s.content)});handleSearchByFile=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.findByFile(r.query);t.json(s.content)});handleSearchByType=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.findByType(r.query);t.json(s.content)});handleGetRecentContext=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.getRecentContext(r.query);t.json(s.content)});handleGetContextTimeline=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.getContextTimeline(r.query);t.json(s.content)});handleContextPreview=this.wrapHandler(async(r,t)=>{let s=r.query.project;if(!s){this.badRequest(t,"Project parameter is required");return}let{generateContext:i}=await Promise.resolve().then(()=>(Of(),Pf)),n=`/preview/${s}`,o=await i({session_id:"preview-"+Date.now(),cwd:n},!0);t.setHeader("Content-Type","text/plain; charset=utf-8"),t.send(o)});handleContextInject=this.wrapHandler(async(r,t)=>{let s=r.query.project,i=r.query.colors==="true";if(!s){this.badRequest(t,"Project parameter is required");return}let{generateContext:n}=await Promise.resolve().then(()=>(Of(),Pf)),o=`/context/${s}`,l=await n({session_id:"context-inject-"+Date.now(),cwd:o},i);t.setHeader("Content-Type","text/plain; charset=utf-8"),t.send(l)});handleGetTimelineByQuery=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.getTimelineByQuery(r.query);t.json(s.content)});handleSearchHelp=this.wrapHandler((r,t)=>{t.json({title:"Claude-Mem Search API",description:"HTTP API for searching persistent memory",endpoints:[{path:"/api/search/observations",method:"GET",description:"Search observations using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/sessions",method:"GET",description:"Search session summaries using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)"}},{path:"/api/search/prompts",method:"GET",description:"Search user prompts using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/by-concept",method:"GET",description:"Find observations by concept tag",parameters:{concept:"Concept tag (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-file",method:"GET",description:"Find observations and sessions by file path",parameters:{filePath:"File path or partial path (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results per type (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-type",method:"GET",description:"Find observations by type",parameters:{type:"Observation type (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/context/recent",method:"GET",description:"Get recent session context including summaries and observations",parameters:{project:"Project name (default: current directory)",limit:"Number of recent sessions (default: 3)"}},{path:"/api/context/timeline",method:"GET",description:"Get unified timeline around a specific point in time",parameters:{anchor:'Anchor point: observation ID, session ID (e.g., "S123"), or ISO timestamp (required)',depth_before:"Number of records before anchor (default: 10)",depth_after:"Number of records after anchor (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/timeline/by-query",method:"GET",description:"Search for best match, then get timeline around it",parameters:{query:"Search query (required)",mode:'Search mode: "auto", "observations", or "sessions" (default: "auto")',depth_before:"Number of records before match (default: 10)",depth_after:"Number of records after match (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/help",method:"GET",description:"Get this help documentation"}],examples:['curl "http://localhost:37777/api/search/observations?query=authentication&format=index&limit=5"','curl "http://localhost:37777/api/search/by-type?type=bugfix&limit=10"','curl "http://localhost:37777/api/context/recent?project=claude-mem&limit=3"','curl "http://localhost:37777/api/context/timeline?anchor=123&depth_before=5&depth_after=5"']})})};var zs=yt(require("path"),1),Rt=require("fs"),kf=require("os");Hr();xt();var Cf=require("child_process"),Us=require("fs"),s1=require("os"),ao=require("path");xt();var so=(0,ao.join)((0,s1.homedir)(),".claude","plugins","marketplaces","thedotmack");function xr(a){return(0,Cf.execSync)(`git ${a}`,{cwd:so,encoding:"utf-8",timeout:3e4,windowsHide:!0}).trim()}function n1(a,e=6e4){return(0,Cf.execSync)(a,{cwd:so,encoding:"utf-8",timeout:e,windowsHide:!0}).trim()}function ql(){let a=(0,ao.join)(so,".git");if(!(0,Us.existsSync)(a))return{branch:null,isBeta:!1,isGitRepo:!1,isDirty:!1,canSwitch:!1,error:"Installed plugin is not a git repository"};try{let e=xr("rev-parse --abbrev-ref HEAD"),t=xr("status --porcelain").length>0,s=e.startsWith("beta");return{branch:e,isBeta:s,isGitRepo:!0,isDirty:t,canSwitch:!0}}catch(e){return V.error("BRANCH","Failed to get branch info",{},e),{branch:null,isBeta:!1,isGitRepo:!0,isDirty:!1,canSwitch:!1,error:e.message}}}async function i1(a){let e=ql();if(!e.isGitRepo)return{success:!1,error:"Installed plugin is not a git repository. Please reinstall."};if(e.branch===a)return{success:!0,branch:a,message:`Already on branch ${a}`};try{V.info("BRANCH","Starting branch switch",{from:e.branch,to:a}),V.debug("BRANCH","Discarding local changes"),xr("checkout -- ."),xr("clean -fd"),V.debug("BRANCH","Fetching from origin"),xr("fetch origin"),V.debug("BRANCH","Checking out branch",{branch:a});try{xr(`checkout ${a}`)}catch{xr(`checkout -b ${a} origin/${a}`)}V.debug("BRANCH","Pulling latest"),xr(`pull origin ${a}`);let r=(0,ao.join)(so,".install-version");return(0,Us.existsSync)(r)&&(0,Us.unlinkSync)(r),V.debug("BRANCH","Running npm install"),n1("npm install",12e4),V.success("BRANCH","Branch switch complete",{branch:a}),{success:!0,branch:a,message:`Switched to ${a}. Worker will restart automatically.`}}catch(r){V.error("BRANCH","Branch switch failed",{targetBranch:a},r);try{e.branch&&xr(`checkout ${e.branch}`)}catch{}return{success:!1,error:`Branch switch failed: ${r.message}`}}}async function o1(){let a=ql();if(!a.isGitRepo||!a.branch)return{success:!1,error:"Cannot pull updates: not a git repository"};try{V.info("BRANCH","Pulling updates",{branch:a.branch}),xr("checkout -- ."),xr("fetch origin"),xr(`pull origin ${a.branch}`);let e=(0,ao.join)(so,".install-version");return(0,Us.existsSync)(e)&&(0,Us.unlinkSync)(e),n1("npm install",12e4),V.success("BRANCH","Updates pulled",{branch:a.branch}),{success:!0,branch:a.branch,message:`Updated ${a.branch}. Worker will restart automatically.`}}catch(e){return V.error("BRANCH","Pull failed",{},e),{success:!1,error:`Pull failed: ${e.message}`}}}Jc();na();var Fl=class extends br{constructor(r){super();this.settingsManager=r}setupRoutes(r){r.get("/api/settings",this.handleGetSettings.bind(this)),r.post("/api/settings",this.handleUpdateSettings.bind(this)),r.get("/api/mcp/status",this.handleGetMcpStatus.bind(this)),r.post("/api/mcp/toggle",this.handleToggleMcp.bind(this)),r.get("/api/branch/status",this.handleGetBranchStatus.bind(this)),r.post("/api/branch/switch",this.handleSwitchBranch.bind(this)),r.post("/api/branch/update",this.handleUpdateBranch.bind(this))}handleGetSettings=this.wrapHandler((r,t)=>{let s=zs.default.join((0,kf.homedir)(),".claude-mem","settings.json");this.ensureSettingsFile(s);let i=gt.loadFromFile(s);t.json(i)});handleUpdateSettings=this.wrapHandler((r,t)=>{if(r.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS){let l=parseInt(r.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10);if(isNaN(l)||l<1||l>200){t.status(400).json({success:!1,error:"CLAUDE_MEM_CONTEXT_OBSERVATIONS must be between 1 and 200"});return}}if(r.body.CLAUDE_MEM_WORKER_PORT){let l=parseInt(r.body.CLAUDE_MEM_WORKER_PORT,10);if(isNaN(l)||l<1024||l>65535){t.status(400).json({success:!1,error:"CLAUDE_MEM_WORKER_PORT must be between 1024 and 65535"});return}}if(r.body.CLAUDE_MEM_LOG_LEVEL&&!["DEBUG","INFO","WARN","ERROR","SILENT"].includes(r.body.CLAUDE_MEM_LOG_LEVEL.toUpperCase())){t.status(400).json({success:!1,error:"CLAUDE_MEM_LOG_LEVEL must be one of: DEBUG, INFO, WARN, ERROR, SILENT"});return}if(r.body.CLAUDE_MEM_PYTHON_VERSION&&!/^3\.\d{1,2}$/.test(r.body.CLAUDE_MEM_PYTHON_VERSION)){t.status(400).json({success:!1,error:'CLAUDE_MEM_PYTHON_VERSION must be in format "3.X" or "3.XX" (e.g., "3.13")'});return}let s=this.validateContextSettings(r.body);if(!s.valid){t.status(400).json({success:!1,error:s.error});return}let i=zs.default.join((0,kf.homedir)(),".claude-mem","settings.json");this.ensureSettingsFile(i);let n={};if((0,Rt.existsSync)(i)){let l=(0,Rt.readFileSync)(i,"utf-8");n=JSON.parse(l)}let o=["CLAUDE_MEM_MODEL","CLAUDE_MEM_CONTEXT_OBSERVATIONS","CLAUDE_MEM_WORKER_PORT","CLAUDE_MEM_DATA_DIR","CLAUDE_MEM_LOG_LEVEL","CLAUDE_MEM_PYTHON_VERSION","CLAUDE_CODE_PATH","CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES","CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS","CLAUDE_MEM_CONTEXT_FULL_COUNT","CLAUDE_MEM_CONTEXT_FULL_FIELD","CLAUDE_MEM_CONTEXT_SESSION_COUNT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let l of o)r.body[l]!==void 0&&(n[l]=r.body[l]);(0,Rt.writeFileSync)(i,JSON.stringify(n,null,2),"utf-8"),V.info("WORKER","Settings updated"),t.json({success:!0,message:"Settings updated successfully"})});handleGetMcpStatus=this.wrapHandler((r,t)=>{let s=this.isMcpEnabled();t.json({enabled:s})});handleToggleMcp=this.wrapHandler((r,t)=>{let{enabled:s}=r.body;if(typeof s!="boolean"){this.badRequest(t,"enabled must be a boolean");return}this.toggleMcp(s),t.json({success:!0,enabled:this.isMcpEnabled()})});handleGetBranchStatus=this.wrapHandler((r,t)=>{let s=ql();t.json(s)});handleSwitchBranch=this.wrapHandler(async(r,t)=>{let{branch:s}=r.body;if(!s){t.status(400).json({success:!1,error:"Missing branch parameter"});return}let i=["main","beta/7.0"];if(!i.includes(s)){t.status(400).json({success:!1,error:`Invalid branch. Allowed: ${i.join(", ")}`});return}V.info("WORKER","Branch switch requested",{branch:s});let n=await i1(s);n.success&&setTimeout(()=>{V.info("WORKER","Restarting worker after branch switch"),process.exit(0)},1e3),t.json(n)});handleUpdateBranch=this.wrapHandler(async(r,t)=>{V.info("WORKER","Branch update requested");let s=await o1();s.success&&setTimeout(()=>{V.info("WORKER","Restarting worker after branch update"),process.exit(0)},1e3),t.json(s)});validateContextSettings(r){let t=["CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let s of t)if(r[s]&&!["true","false"].includes(r[s]))return{valid:!1,error:`${s} must be "true" or "false"`};if(r.CLAUDE_MEM_CONTEXT_FULL_COUNT){let s=parseInt(r.CLAUDE_MEM_CONTEXT_FULL_COUNT,10);if(isNaN(s)||s<0||s>20)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_FULL_COUNT must be between 0 and 20"}}if(r.CLAUDE_MEM_CONTEXT_SESSION_COUNT){let s=parseInt(r.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10);if(isNaN(s)||s<1||s>50)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_SESSION_COUNT must be between 1 and 50"}}if(r.CLAUDE_MEM_CONTEXT_FULL_FIELD&&!["narrative","facts"].includes(r.CLAUDE_MEM_CONTEXT_FULL_FIELD))return{valid:!1,error:'CLAUDE_MEM_CONTEXT_FULL_FIELD must be "narrative" or "facts"'};if(r.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES){let s=r.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(i=>i.trim());for(let i of s)if(i&&!An.includes(i))return{valid:!1,error:`Invalid observation type: ${i}. Valid types: ${An.join(", ")}`}}if(r.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS){let s=r.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(i=>i.trim());for(let i of s)if(i&&!Dn.includes(i))return{valid:!1,error:`Invalid observation concept: ${i}. Valid concepts: ${Dn.join(", ")}`}}return{valid:!0}}isMcpEnabled(){let r=ia(),t=zs.default.join(r,"plugin",".mcp.json");return(0,Rt.existsSync)(t)}toggleMcp(r){try{let t=ia(),s=zs.default.join(t,"plugin",".mcp.json"),i=zs.default.join(t,"plugin",".mcp.json.disabled");r&&(0,Rt.existsSync)(i)?((0,Rt.renameSync)(i,s),V.info("WORKER","MCP search server enabled")):!r&&(0,Rt.existsSync)(s)?((0,Rt.renameSync)(s,i),V.info("WORKER","MCP search server disabled")):V.debug("WORKER","MCP toggle no-op (already in desired state)",{enabled:r})}catch(t){throw V.failure("WORKER","Failed to toggle MCP",{enabled:r},t),t}}ensureSettingsFile(r){if(!(0,Rt.existsSync)(r)){let t=gt.getAllDefaults(),s=zs.default.dirname(r);(0,Rt.existsSync)(s)||(0,Rt.mkdirSync)(s,{recursive:!0}),(0,Rt.writeFileSync)(r,JSON.stringify(t,null,2),"utf-8"),V.info("SETTINGS","Created settings file with defaults",{settingsPath:r})}}};function i5(){process.platform==="win32"&&!process.type&&(console.warn('[worker-service] Applying MCP SDK windowsHide workaround: setting process.type = "renderer". This is a fragile hack. Remove when MCP SDK is fixed. See code comments for details.'),process.type="renderer")}i5();var Ul=class{app;server=null;startTime=Date.now();mcpClient;dbManager;sessionManager;sseBroadcaster;sdkAgent;paginationHelper;settingsManager;sessionEventBroadcaster;viewerRoutes;sessionRoutes;dataRoutes;searchRoutes;settingsRoutes;constructor(){this.app=(0,c1.default)(),this.dbManager=new nl,this.sessionManager=new il(this.dbManager),this.sseBroadcaster=new ol,this.sdkAgent=new wl(this.dbManager,this.sessionManager),this.paginationHelper=new Tl(this.dbManager),this.settingsManager=new Rl(this.dbManager),this.sessionEventBroadcaster=new kl(this.sseBroadcaster,this),this.sessionManager.setOnSessionDeleted(()=>{this.broadcastProcessingStatus()}),this.mcpClient=new On({name:"worker-search-proxy",version:"1.0.0"},{capabilities:{}}),this.viewerRoutes=new Il(this.sseBroadcaster,this.dbManager,this.sessionManager),this.sessionRoutes=new Nl(this.sessionManager,this.dbManager,this.sdkAgent,this.sessionEventBroadcaster,this),this.dataRoutes=new jl(this.paginationHelper,this.dbManager,this.sessionManager,this.sseBroadcaster,this,this.startTime),this.searchRoutes=null,this.settingsRoutes=new Fl(this.settingsManager),this.setupMiddleware(),this.setupRoutes()}setupMiddleware(){Xw(this.summarizeRequestBody.bind(this)).forEach(r=>this.app.use(r))}setupRoutes(){this.app.get("/api/health",(e,r)=>{r.status(200).json({status:"ok"})}),this.viewerRoutes.setupRoutes(this.app),this.sessionRoutes.setupRoutes(this.app),this.dataRoutes.setupRoutes(this.app),this.settingsRoutes.setupRoutes(this.app)}async start(){let e=jn();this.server=await new Promise((r,t)=>{let s=this.app.listen(e,()=>r(s));s.on("error",t)}),V.info("SYSTEM","Worker started",{port:e,pid:process.pid}),this.initializeBackground().catch(r=>{V.error("SYSTEM","Background initialization failed",{},r)})}async initializeBackground(){await this.dbManager.initialize();let e=new Ol,r=new Cl,t=new Pl(this.dbManager.getSessionSearch(),this.dbManager.getSessionStore(),this.dbManager.getChromaSync(),e,r);this.searchRoutes=new Ll(t),this.searchRoutes.setupRoutes(this.app),V.info("WORKER","SearchManager initialized and search routes registered");let s=l1.default.join(__dirname,"mcp-server.cjs"),i=new In({command:"node",args:[s],env:process.env});await this.mcpClient.connect(i),V.success("WORKER","Connected to MCP server")}async shutdown(){if(await this.sessionManager.shutdownAll(),this.mcpClient)try{await this.mcpClient.close(),V.info("SYSTEM","MCP client closed")}catch(e){V.error("SYSTEM","Failed to close MCP client",{},e)}this.server&&await new Promise((e,r)=>{this.server.close(t=>t?r(t):e())}),await this.dbManager.close(),V.info("SYSTEM","Worker shutdown complete")}summarizeRequestBody(e,r,t){return Kw(e,r,t)}broadcastProcessingStatus(){let e=this.sessionManager.isAnySessionProcessing(),r=this.sessionManager.getTotalActiveWork(),t=this.sessionManager.getActiveSessionCount();V.info("WORKER","Broadcasting processing status",{isProcessing:e,queueDepth:r,activeSessions:t}),this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:e,queueDepth:r})}};if(require.main===module||!module.parent){let a=new Ul;process.on("SIGTERM",async()=>{V.info("SYSTEM","Received SIGTERM, shutting down gracefully"),await a.shutdown(),process.exit(0)}),process.on("SIGINT",async()=>{V.info("SYSTEM","Received SIGINT, shutting down gracefully"),await a.shutdown(),process.exit(0)}),a.start().catch(e=>{V.failure("SYSTEM","Worker failed to start",{},e),process.exit(1)})}0&&(module.exports={WorkerService}); + `).all().map(o=>o.project);t.json({projects:n})});handleGetProcessingStatus=this.wrapHandler((r,t)=>{let s=this.sessionManager.isAnySessionProcessing(),i=this.sessionManager.getTotalActiveWork();t.json({isProcessing:s,queueDepth:i})});handleSetProcessing=this.wrapHandler((r,t)=>{this.workerService.broadcastProcessingStatus();let s=this.sessionManager.isAnySessionProcessing(),i=this.sessionManager.getTotalQueueDepth(),n=this.sessionManager.getActiveSessionCount();t.json({status:"ok",isProcessing:s})});parsePaginationParams(r){let t=parseInt(r.query.offset,10)||0,s=Math.min(parseInt(r.query.limit,10)||20,100),i=r.query.project;return{offset:t,limit:s,project:i}}};var Ll=class extends br{constructor(r){super();this.searchManager=r}setupRoutes(r){r.get("/api/search",this.handleUnifiedSearch.bind(this)),r.get("/api/timeline",this.handleUnifiedTimeline.bind(this)),r.get("/api/decisions",this.handleDecisions.bind(this)),r.get("/api/changes",this.handleChanges.bind(this)),r.get("/api/how-it-works",this.handleHowItWorks.bind(this)),r.get("/api/search/observations",this.handleSearchObservations.bind(this)),r.get("/api/search/sessions",this.handleSearchSessions.bind(this)),r.get("/api/search/prompts",this.handleSearchPrompts.bind(this)),r.get("/api/search/by-concept",this.handleSearchByConcept.bind(this)),r.get("/api/search/by-file",this.handleSearchByFile.bind(this)),r.get("/api/search/by-type",this.handleSearchByType.bind(this)),r.get("/api/context/recent",this.handleGetRecentContext.bind(this)),r.get("/api/context/timeline",this.handleGetContextTimeline.bind(this)),r.get("/api/context/preview",this.handleContextPreview.bind(this)),r.get("/api/context/inject",this.handleContextInject.bind(this)),r.get("/api/timeline/by-query",this.handleGetTimelineByQuery.bind(this)),r.get("/api/search/help",this.handleSearchHelp.bind(this))}handleUnifiedSearch=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.search(r.query);t.json(s)});handleUnifiedTimeline=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.timeline(r.query);t.json(s)});handleDecisions=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.decisions(r.query);t.json(s)});handleChanges=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.changes(r.query);t.json(s)});handleHowItWorks=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.howItWorks(r.query);t.json(s)});handleSearchObservations=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.searchObservations(r.query);t.json(s)});handleSearchSessions=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.searchSessions(r.query);t.json(s)});handleSearchPrompts=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.searchUserPrompts(r.query);t.json(s)});handleSearchByConcept=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.findByConcept(r.query);t.json(s)});handleSearchByFile=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.findByFile(r.query);t.json(s)});handleSearchByType=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.findByType(r.query);t.json(s)});handleGetRecentContext=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.getRecentContext(r.query);t.json(s)});handleGetContextTimeline=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.getContextTimeline(r.query);t.json(s)});handleContextPreview=this.wrapHandler(async(r,t)=>{let s=r.query.project;if(!s){this.badRequest(t,"Project parameter is required");return}let{generateContext:i}=await Promise.resolve().then(()=>(Of(),Pf)),n=`/preview/${s}`,o=await i({session_id:"preview-"+Date.now(),cwd:n},!0);t.setHeader("Content-Type","text/plain; charset=utf-8"),t.send(o)});handleContextInject=this.wrapHandler(async(r,t)=>{let s=r.query.project,i=r.query.colors==="true";if(!s){this.badRequest(t,"Project parameter is required");return}let{generateContext:n}=await Promise.resolve().then(()=>(Of(),Pf)),o=`/context/${s}`,l=await n({session_id:"context-inject-"+Date.now(),cwd:o},i);t.setHeader("Content-Type","text/plain; charset=utf-8"),t.send(l)});handleGetTimelineByQuery=this.wrapHandler(async(r,t)=>{let s=await this.searchManager.getTimelineByQuery(r.query);t.json(s)});handleSearchHelp=this.wrapHandler((r,t)=>{t.json({title:"Claude-Mem Search API",description:"HTTP API for searching persistent memory",endpoints:[{path:"/api/search/observations",method:"GET",description:"Search observations using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/sessions",method:"GET",description:"Search session summaries using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)"}},{path:"/api/search/prompts",method:"GET",description:"Search user prompts using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/by-concept",method:"GET",description:"Find observations by concept tag",parameters:{concept:"Concept tag (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-file",method:"GET",description:"Find observations and sessions by file path",parameters:{filePath:"File path or partial path (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results per type (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-type",method:"GET",description:"Find observations by type",parameters:{type:"Observation type (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/context/recent",method:"GET",description:"Get recent session context including summaries and observations",parameters:{project:"Project name (default: current directory)",limit:"Number of recent sessions (default: 3)"}},{path:"/api/context/timeline",method:"GET",description:"Get unified timeline around a specific point in time",parameters:{anchor:'Anchor point: observation ID, session ID (e.g., "S123"), or ISO timestamp (required)',depth_before:"Number of records before anchor (default: 10)",depth_after:"Number of records after anchor (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/timeline/by-query",method:"GET",description:"Search for best match, then get timeline around it",parameters:{query:"Search query (required)",mode:'Search mode: "auto", "observations", or "sessions" (default: "auto")',depth_before:"Number of records before match (default: 10)",depth_after:"Number of records after match (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/help",method:"GET",description:"Get this help documentation"}],examples:['curl "http://localhost:37777/api/search/observations?query=authentication&format=index&limit=5"','curl "http://localhost:37777/api/search/by-type?type=bugfix&limit=10"','curl "http://localhost:37777/api/context/recent?project=claude-mem&limit=3"','curl "http://localhost:37777/api/context/timeline?anchor=123&depth_before=5&depth_after=5"']})})};var zs=yt(require("path"),1),Rt=require("fs"),kf=require("os");Hr();xt();var Cf=require("child_process"),Us=require("fs"),s1=require("os"),ao=require("path");xt();var so=(0,ao.join)((0,s1.homedir)(),".claude","plugins","marketplaces","thedotmack");function xr(a){return(0,Cf.execSync)(`git ${a}`,{cwd:so,encoding:"utf-8",timeout:3e4,windowsHide:!0}).trim()}function n1(a,e=6e4){return(0,Cf.execSync)(a,{cwd:so,encoding:"utf-8",timeout:e,windowsHide:!0}).trim()}function ql(){let a=(0,ao.join)(so,".git");if(!(0,Us.existsSync)(a))return{branch:null,isBeta:!1,isGitRepo:!1,isDirty:!1,canSwitch:!1,error:"Installed plugin is not a git repository"};try{let e=xr("rev-parse --abbrev-ref HEAD"),t=xr("status --porcelain").length>0,s=e.startsWith("beta");return{branch:e,isBeta:s,isGitRepo:!0,isDirty:t,canSwitch:!0}}catch(e){return V.error("BRANCH","Failed to get branch info",{},e),{branch:null,isBeta:!1,isGitRepo:!0,isDirty:!1,canSwitch:!1,error:e.message}}}async function i1(a){let e=ql();if(!e.isGitRepo)return{success:!1,error:"Installed plugin is not a git repository. Please reinstall."};if(e.branch===a)return{success:!0,branch:a,message:`Already on branch ${a}`};try{V.info("BRANCH","Starting branch switch",{from:e.branch,to:a}),V.debug("BRANCH","Discarding local changes"),xr("checkout -- ."),xr("clean -fd"),V.debug("BRANCH","Fetching from origin"),xr("fetch origin"),V.debug("BRANCH","Checking out branch",{branch:a});try{xr(`checkout ${a}`)}catch{xr(`checkout -b ${a} origin/${a}`)}V.debug("BRANCH","Pulling latest"),xr(`pull origin ${a}`);let r=(0,ao.join)(so,".install-version");return(0,Us.existsSync)(r)&&(0,Us.unlinkSync)(r),V.debug("BRANCH","Running npm install"),n1("npm install",12e4),V.success("BRANCH","Branch switch complete",{branch:a}),{success:!0,branch:a,message:`Switched to ${a}. Worker will restart automatically.`}}catch(r){V.error("BRANCH","Branch switch failed",{targetBranch:a},r);try{e.branch&&xr(`checkout ${e.branch}`)}catch{}return{success:!1,error:`Branch switch failed: ${r.message}`}}}async function o1(){let a=ql();if(!a.isGitRepo||!a.branch)return{success:!1,error:"Cannot pull updates: not a git repository"};try{V.info("BRANCH","Pulling updates",{branch:a.branch}),xr("checkout -- ."),xr("fetch origin"),xr(`pull origin ${a.branch}`);let e=(0,ao.join)(so,".install-version");return(0,Us.existsSync)(e)&&(0,Us.unlinkSync)(e),n1("npm install",12e4),V.success("BRANCH","Updates pulled",{branch:a.branch}),{success:!0,branch:a.branch,message:`Updated ${a.branch}. Worker will restart automatically.`}}catch(e){return V.error("BRANCH","Pull failed",{},e),{success:!1,error:`Pull failed: ${e.message}`}}}Jc();na();var Fl=class extends br{constructor(r){super();this.settingsManager=r}setupRoutes(r){r.get("/api/settings",this.handleGetSettings.bind(this)),r.post("/api/settings",this.handleUpdateSettings.bind(this)),r.get("/api/mcp/status",this.handleGetMcpStatus.bind(this)),r.post("/api/mcp/toggle",this.handleToggleMcp.bind(this)),r.get("/api/branch/status",this.handleGetBranchStatus.bind(this)),r.post("/api/branch/switch",this.handleSwitchBranch.bind(this)),r.post("/api/branch/update",this.handleUpdateBranch.bind(this))}handleGetSettings=this.wrapHandler((r,t)=>{let s=zs.default.join((0,kf.homedir)(),".claude-mem","settings.json");this.ensureSettingsFile(s);let i=gt.loadFromFile(s);t.json(i)});handleUpdateSettings=this.wrapHandler((r,t)=>{if(r.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS){let l=parseInt(r.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10);if(isNaN(l)||l<1||l>200){t.status(400).json({success:!1,error:"CLAUDE_MEM_CONTEXT_OBSERVATIONS must be between 1 and 200"});return}}if(r.body.CLAUDE_MEM_WORKER_PORT){let l=parseInt(r.body.CLAUDE_MEM_WORKER_PORT,10);if(isNaN(l)||l<1024||l>65535){t.status(400).json({success:!1,error:"CLAUDE_MEM_WORKER_PORT must be between 1024 and 65535"});return}}if(r.body.CLAUDE_MEM_LOG_LEVEL&&!["DEBUG","INFO","WARN","ERROR","SILENT"].includes(r.body.CLAUDE_MEM_LOG_LEVEL.toUpperCase())){t.status(400).json({success:!1,error:"CLAUDE_MEM_LOG_LEVEL must be one of: DEBUG, INFO, WARN, ERROR, SILENT"});return}if(r.body.CLAUDE_MEM_PYTHON_VERSION&&!/^3\.\d{1,2}$/.test(r.body.CLAUDE_MEM_PYTHON_VERSION)){t.status(400).json({success:!1,error:'CLAUDE_MEM_PYTHON_VERSION must be in format "3.X" or "3.XX" (e.g., "3.13")'});return}let s=this.validateContextSettings(r.body);if(!s.valid){t.status(400).json({success:!1,error:s.error});return}let i=zs.default.join((0,kf.homedir)(),".claude-mem","settings.json");this.ensureSettingsFile(i);let n={};if((0,Rt.existsSync)(i)){let l=(0,Rt.readFileSync)(i,"utf-8");n=JSON.parse(l)}let o=["CLAUDE_MEM_MODEL","CLAUDE_MEM_CONTEXT_OBSERVATIONS","CLAUDE_MEM_WORKER_PORT","CLAUDE_MEM_DATA_DIR","CLAUDE_MEM_LOG_LEVEL","CLAUDE_MEM_PYTHON_VERSION","CLAUDE_CODE_PATH","CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES","CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS","CLAUDE_MEM_CONTEXT_FULL_COUNT","CLAUDE_MEM_CONTEXT_FULL_FIELD","CLAUDE_MEM_CONTEXT_SESSION_COUNT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let l of o)r.body[l]!==void 0&&(n[l]=r.body[l]);(0,Rt.writeFileSync)(i,JSON.stringify(n,null,2),"utf-8"),V.info("WORKER","Settings updated"),t.json({success:!0,message:"Settings updated successfully"})});handleGetMcpStatus=this.wrapHandler((r,t)=>{let s=this.isMcpEnabled();t.json({enabled:s})});handleToggleMcp=this.wrapHandler((r,t)=>{let{enabled:s}=r.body;if(typeof s!="boolean"){this.badRequest(t,"enabled must be a boolean");return}this.toggleMcp(s),t.json({success:!0,enabled:this.isMcpEnabled()})});handleGetBranchStatus=this.wrapHandler((r,t)=>{let s=ql();t.json(s)});handleSwitchBranch=this.wrapHandler(async(r,t)=>{let{branch:s}=r.body;if(!s){t.status(400).json({success:!1,error:"Missing branch parameter"});return}let i=["main","beta/7.0"];if(!i.includes(s)){t.status(400).json({success:!1,error:`Invalid branch. Allowed: ${i.join(", ")}`});return}V.info("WORKER","Branch switch requested",{branch:s});let n=await i1(s);n.success&&setTimeout(()=>{V.info("WORKER","Restarting worker after branch switch"),process.exit(0)},1e3),t.json(n)});handleUpdateBranch=this.wrapHandler(async(r,t)=>{V.info("WORKER","Branch update requested");let s=await o1();s.success&&setTimeout(()=>{V.info("WORKER","Restarting worker after branch update"),process.exit(0)},1e3),t.json(s)});validateContextSettings(r){let t=["CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let s of t)if(r[s]&&!["true","false"].includes(r[s]))return{valid:!1,error:`${s} must be "true" or "false"`};if(r.CLAUDE_MEM_CONTEXT_FULL_COUNT){let s=parseInt(r.CLAUDE_MEM_CONTEXT_FULL_COUNT,10);if(isNaN(s)||s<0||s>20)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_FULL_COUNT must be between 0 and 20"}}if(r.CLAUDE_MEM_CONTEXT_SESSION_COUNT){let s=parseInt(r.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10);if(isNaN(s)||s<1||s>50)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_SESSION_COUNT must be between 1 and 50"}}if(r.CLAUDE_MEM_CONTEXT_FULL_FIELD&&!["narrative","facts"].includes(r.CLAUDE_MEM_CONTEXT_FULL_FIELD))return{valid:!1,error:'CLAUDE_MEM_CONTEXT_FULL_FIELD must be "narrative" or "facts"'};if(r.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES){let s=r.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(i=>i.trim());for(let i of s)if(i&&!An.includes(i))return{valid:!1,error:`Invalid observation type: ${i}. Valid types: ${An.join(", ")}`}}if(r.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS){let s=r.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(i=>i.trim());for(let i of s)if(i&&!Dn.includes(i))return{valid:!1,error:`Invalid observation concept: ${i}. Valid concepts: ${Dn.join(", ")}`}}return{valid:!0}}isMcpEnabled(){let r=ia(),t=zs.default.join(r,"plugin",".mcp.json");return(0,Rt.existsSync)(t)}toggleMcp(r){try{let t=ia(),s=zs.default.join(t,"plugin",".mcp.json"),i=zs.default.join(t,"plugin",".mcp.json.disabled");r&&(0,Rt.existsSync)(i)?((0,Rt.renameSync)(i,s),V.info("WORKER","MCP search server enabled")):!r&&(0,Rt.existsSync)(s)?((0,Rt.renameSync)(s,i),V.info("WORKER","MCP search server disabled")):V.debug("WORKER","MCP toggle no-op (already in desired state)",{enabled:r})}catch(t){throw V.failure("WORKER","Failed to toggle MCP",{enabled:r},t),t}}ensureSettingsFile(r){if(!(0,Rt.existsSync)(r)){let t=gt.getAllDefaults(),s=zs.default.dirname(r);(0,Rt.existsSync)(s)||(0,Rt.mkdirSync)(s,{recursive:!0}),(0,Rt.writeFileSync)(r,JSON.stringify(t,null,2),"utf-8"),V.info("SETTINGS","Created settings file with defaults",{settingsPath:r})}}};function i5(){process.platform==="win32"&&!process.type&&(console.warn('[worker-service] Applying MCP SDK windowsHide workaround: setting process.type = "renderer". This is a fragile hack. Remove when MCP SDK is fixed. See code comments for details.'),process.type="renderer")}i5();var Ul=class{app;server=null;startTime=Date.now();mcpClient;dbManager;sessionManager;sseBroadcaster;sdkAgent;paginationHelper;settingsManager;sessionEventBroadcaster;viewerRoutes;sessionRoutes;dataRoutes;searchRoutes;settingsRoutes;constructor(){this.app=(0,c1.default)(),this.dbManager=new nl,this.sessionManager=new il(this.dbManager),this.sseBroadcaster=new ol,this.sdkAgent=new wl(this.dbManager,this.sessionManager),this.paginationHelper=new Tl(this.dbManager),this.settingsManager=new Rl(this.dbManager),this.sessionEventBroadcaster=new kl(this.sseBroadcaster,this),this.sessionManager.setOnSessionDeleted(()=>{this.broadcastProcessingStatus()}),this.mcpClient=new On({name:"worker-search-proxy",version:"1.0.0"},{capabilities:{}}),this.viewerRoutes=new Il(this.sseBroadcaster,this.dbManager,this.sessionManager),this.sessionRoutes=new Nl(this.sessionManager,this.dbManager,this.sdkAgent,this.sessionEventBroadcaster,this),this.dataRoutes=new jl(this.paginationHelper,this.dbManager,this.sessionManager,this.sseBroadcaster,this,this.startTime),this.searchRoutes=null,this.settingsRoutes=new Fl(this.settingsManager),this.setupMiddleware(),this.setupRoutes()}setupMiddleware(){Xw(this.summarizeRequestBody.bind(this)).forEach(r=>this.app.use(r))}setupRoutes(){this.app.get("/api/health",(e,r)=>{r.status(200).json({status:"ok"})}),this.viewerRoutes.setupRoutes(this.app),this.sessionRoutes.setupRoutes(this.app),this.dataRoutes.setupRoutes(this.app),this.settingsRoutes.setupRoutes(this.app)}async start(){let e=jn();this.server=await new Promise((r,t)=>{let s=this.app.listen(e,()=>r(s));s.on("error",t)}),V.info("SYSTEM","Worker started",{port:e,pid:process.pid}),this.initializeBackground().catch(r=>{V.error("SYSTEM","Background initialization failed",{},r)})}async initializeBackground(){await this.dbManager.initialize();let e=new Ol,r=new Cl,t=new Pl(this.dbManager.getSessionSearch(),this.dbManager.getSessionStore(),this.dbManager.getChromaSync(),e,r);this.searchRoutes=new Ll(t),this.searchRoutes.setupRoutes(this.app),V.info("WORKER","SearchManager initialized and search routes registered");let s=l1.default.join(__dirname,"mcp-server.cjs"),i=new In({command:"node",args:[s],env:process.env});await this.mcpClient.connect(i),V.success("WORKER","Connected to MCP server")}async shutdown(){if(await this.sessionManager.shutdownAll(),this.mcpClient)try{await this.mcpClient.close(),V.info("SYSTEM","MCP client closed")}catch(e){V.error("SYSTEM","Failed to close MCP client",{},e)}this.server&&await new Promise((e,r)=>{this.server.close(t=>t?r(t):e())}),await this.dbManager.close(),V.info("SYSTEM","Worker shutdown complete")}summarizeRequestBody(e,r,t){return Kw(e,r,t)}broadcastProcessingStatus(){let e=this.sessionManager.isAnySessionProcessing(),r=this.sessionManager.getTotalActiveWork(),t=this.sessionManager.getActiveSessionCount();V.info("WORKER","Broadcasting processing status",{isProcessing:e,queueDepth:r,activeSessions:t}),this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:e,queueDepth:r})}};if(require.main===module||!module.parent){let a=new Ul;process.on("SIGTERM",async()=>{V.info("SYSTEM","Received SIGTERM, shutting down gracefully"),await a.shutdown(),process.exit(0)}),process.on("SIGINT",async()=>{V.info("SYSTEM","Received SIGINT, shutting down gracefully"),await a.shutdown(),process.exit(0)}),a.start().catch(e=>{V.failure("SYSTEM","Worker failed to start",{},e),process.exit(1)})}0&&(module.exports={WorkerService}); /*! Bundled license information: depd/index.js: