@bangdao-ai/acw-tools 1.13.55 → 1.13.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ACW工具集",
3
3
  "description": "ACW平台工具集:智能下载规则/技能到项目、上传技能到Skills广场、搜索技能、检查技能更新、上传/下载/检索个人知识库",
4
- "version": "1.13.55",
4
+ "version": "1.13.56",
5
5
  "author": "邦道科技 - 产品技术中心",
6
6
  "homepage": "https://www.npmjs.com/package/@bangdao-ai/acw-tools",
7
7
  "repository": "https://www.npmjs.com/package/@bangdao-ai/acw-tools?activeTab=readme",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bangdao-ai/acw-tools",
3
- "version": "1.13.55",
3
+ "version": "1.13.56",
4
4
  "type": "module",
5
5
  "description": "MCP (Model Context Protocol) tools for ACW - download rules and initialize Common Admin projects",
6
6
  "main": "index.js",
package/postinstall.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const _0x534102=_0x1589;(function(_0x750a73,_0x55897a){const _0x24b96d=_0x1589,_0x1ebd88=_0x750a73();while(!![]){try{const _0x416cc9=-parseInt(_0x24b96d(0x12c))/0x1+-parseInt(_0x24b96d(0x125))/0x2+parseInt(_0x24b96d(0x123))/0x3*(-parseInt(_0x24b96d(0x108))/0x4)+-parseInt(_0x24b96d(0xe1))/0x5+parseInt(_0x24b96d(0x10b))/0x6+parseInt(_0x24b96d(0x120))/0x7*(-parseInt(_0x24b96d(0xd6))/0x8)+parseInt(_0x24b96d(0xdd))/0x9*(parseInt(_0x24b96d(0xf5))/0xa);if(_0x416cc9===_0x55897a)break;else _0x1ebd88['push'](_0x1ebd88['shift']());}catch(_0x54b0fa){_0x1ebd88['push'](_0x1ebd88['shift']());}}}(_0x5725,0xae7ca));import _0x3e62cc from'fs';import _0x59cbcf from'path';import{fileURLToPath as _0x5a7445}from'url';import{execSync as _0x18ae5b}from'child_process';import _0x28bdd7 from'https';import _0x4ea6bf from'http';import _0x2a3084 from'zlib';var C='12.4.1',L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:_0x534102(0xc2),0x13:_0x534102(0xb9),0x14:_0x534102(0xc5),0x15:_0x534102(0xc1),0x16:_0x534102(0xd1),0x17:'131',0x18:_0x534102(0xfd),0x19:'137'},$=['115','127','131',_0x534102(0xfd)],I=parseInt(process['version'][_0x534102(0x11c)](0x1)[_0x534102(0xc3)]('.')[0x0],0xa),T=((()=>{const _0x3b9fb=_0x534102;let _0x13084a=process[_0x3b9fb(0xde)][_0x3b9fb(0x11c)](0x1)[_0x3b9fb(0xc3)]('.');return parseInt(_0x13084a[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x368460=_0x534102;console[_0x368460(0xd4)](''),console['log'](_0x368460(0x11d)),console['log']('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console['log']('[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。'),console[_0x368460(0xd4)](_0x368460(0x109)),console[_0x368460(0xd4)]('[提示]\x20【你当前的情况】当前为\x20'+process[_0x368460(0xde)]+',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。'),console['log'](_0x368460(0xcf)),console[_0x368460(0xd4)]('[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;'),console['log'](_0x368460(0x122)),console['log'](_0x368460(0xf2)),console[_0x368460(0xd4)](_0x368460(0x10a)),console[_0x368460(0xd4)]('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x368460(0xd4)]('');}function y(){const _0x3ae6e8=_0x534102;console[_0x3ae6e8(0x116)](''),console['error'](_0x3ae6e8(0x115)),console[_0x3ae6e8(0x116)]('本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。'),console['error'](_0x3ae6e8(0xfe)),console['error'](_0x3ae6e8(0x114)),console['error']('package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。'),console['error'](_0x3ae6e8(0xda));}function b(){const _0x190e43=_0x534102;let _0x1664bf=parseInt(process['version']['slice'](0x1)['split']('.')[0x0],0xa);return F[_0x1664bf]||process['versions'][_0x190e43(0x100)];}function E(){const _0x53b92e=_0x534102;let _0x2fe8a5=C,_0x2356f5=b(),_0x1d1e58=process['platform'],_0x187ba6=process[_0x53b92e(0xbe)];return'better-sqlite3-v'+_0x2fe8a5+'-node-v'+_0x2356f5+'-'+_0x1d1e58+'-'+_0x187ba6+_0x53b92e(0xc0);}function v(_0x3cea08){return new Promise((_0x3d5056,_0x31484b)=>{const _0x8e8d2e=_0x1589;let _0x299a02=(_0x3cea08[_0x8e8d2e(0x119)](_0x8e8d2e(0xcc))?_0x28bdd7:_0x4ea6bf)[_0x8e8d2e(0xcd)](_0x3cea08,{'timeout':0x7530},_0x18b5f6=>{const _0x311287=_0x8e8d2e;if(_0x18b5f6['statusCode']===0x12d||_0x18b5f6[_0x311287(0x132)]===0x12e){v(_0x18b5f6['headers']['location'])[_0x311287(0x11b)](_0x3d5056)[_0x311287(0xc8)](_0x31484b);return;}if(_0x18b5f6['statusCode']!==0xc8){_0x31484b(new Error(_0x311287(0xf1)+_0x18b5f6['statusCode']));return;}let _0xfbcfa4=[];_0x18b5f6['on'](_0x311287(0xbc),_0x2bc631=>_0xfbcfa4[_0x311287(0xbd)](_0x2bc631)),_0x18b5f6['on']('end',()=>_0x3d5056(Buffer['concat'](_0xfbcfa4))),_0x18b5f6['on'](_0x311287(0x116),_0x31484b);});_0x299a02['on']('error',_0x31484b),_0x299a02['on']('timeout',()=>{const _0x2cee27=_0x8e8d2e;_0x299a02[_0x2cee27(0x10f)](),_0x31484b(new Error('Request\x20timeout'));});});}function _0x5725(){const _0x459158=['was\x20compiled\x20against','exit','statusCode','readFileSync','better-sqlite3','首错原文:\x20','pipe','...','\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;','[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)','[OK]\x20安装完成','111',':memory:','[INFO]\x20better-sqlite3\x20原生加载失败:\x20','data','push','arch','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','.tar.gz','120','108','split',',npm\x20包根=','115','includes','close','catch','platform','。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。',')\x20|\x20','https','get','[INFO]\x20自动尝试本地编译:\x20在「','[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:','[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。','127','(ABI\x20v','inherit','log','string','8MkCLYY','existsSync','env','[步骤]\x20ABI\x20','────────────────────────────────────────────','[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','[提示]\x20','9iJZWet','version','join','[ERROR]\x20postinstall\x20脚本执行出错:','1439480WQowHC','[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...','unshift','dirname','[INFO]\x20预编译包已安装,重新测试...','dlopen','\x20不在\x20OSS\x20预编译列表\x20[','\x20|\x20Node\x20','writeFileSync','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。','length','[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。','toFixed','[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20','HTTP\x20','[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。','NODE_MODULE_VERSION','message','48146370ZgYbUk','acwInstallNote','[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。',',process.versions.modules=','default','utf8','forEach','[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)','137','根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。','trim','modules','warn','node_modules','basename','复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:','未解析',',映射\x20ABI=','package.json','44lsweKT','[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。','[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。','6691128jmxiFH','MODULE_NOT_FOUND','──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────','[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20','destroy','\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;','[INFO]\x20下载成功\x20(','无法找到\x20better-sqlite3\x20模块路径','\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。','──────────\x20给用户的说明(安装失败)──────────','error','versions','未找到','startsWith','stderr','then','slice','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','\x20(ABI\x20','[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。','7818629BOEwiq','Cannot\x20find\x20package','[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);','304170tsxxML','[WARN]\x20npm\x20rebuild\x20未成功:\x20','2642588tqKXKt','fromCharCode','node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22','cwd','mkdirSync','toLowerCase','[环境]\x20Node=','1373700MgBzyc','说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:','ERR_MODULE_NOT_FOUND','darwin'];_0x5725=function(){return _0x459158;};return _0x5725();}async function D(_0x27b062,_0x5c224d){const _0xa99d75=_0x534102;let _0x17047d=_0x2a3084['gunzipSync'](_0x27b062),_0x275d80=0x200,_0x219c50=0x0;for(;_0x219c50<_0x17047d[_0xa99d75(0xec)]-_0x275d80;){let _0x25b342=_0x17047d[_0xa99d75(0x11c)](_0x219c50,_0x219c50+_0x275d80);if(_0x25b342[0x0]===0x0)break;let _0x1ed73b=_0x25b342[_0xa99d75(0x11c)](0x0,0x64)['toString'](_0xa99d75(0xfa))['replace'](/\0/g,'')['trim'](),_0x74e1d5=_0x25b342[_0xa99d75(0x11c)](0x7c,0x88)['toString'](_0xa99d75(0xfa))['replace'](/\0/g,'')[_0xa99d75(0xff)](),_0x371235=parseInt(_0x74e1d5,0x8)||0x0,_0x58ccfc=String[_0xa99d75(0x126)](_0x25b342[0x9c]);if(_0x219c50+=_0x275d80,_0x1ed73b&&_0x58ccfc==='0'||_0x58ccfc==='\x00'){let _0x2fda5f=_0x17047d[_0xa99d75(0x11c)](_0x219c50,_0x219c50+_0x371235),_0x2b722c=_0x59cbcf['join'](_0x5c224d,_0x59cbcf[_0xa99d75(0x103)](_0x1ed73b));_0x3e62cc[_0xa99d75(0x129)](_0x59cbcf[_0xa99d75(0xe4)](_0x2b722c),{'recursive':!0x0}),_0x3e62cc[_0xa99d75(0xe9)](_0x2b722c,_0x2fda5f);}_0x219c50+=Math['ceil'](_0x371235/_0x275d80)*_0x275d80;}}function h(){const _0xf2ce0=_0x534102;let _0x361b1c=[_0x59cbcf['join'](process[_0xf2ce0(0x128)](),_0xf2ce0(0x102),'better-sqlite3'),_0x59cbcf['join'](_0x5a7445(import.meta.url),'..','node_modules',_0xf2ce0(0x134))];try{let _0x36236b=import.meta.resolve('better-sqlite3');if(_0x36236b){let _0x2a9f87=_0x5a7445(_0x36236b);_0x361b1c[_0xf2ce0(0xe3)](_0x59cbcf[_0xf2ce0(0xe4)](_0x59cbcf[_0xf2ce0(0xe4)](_0x2a9f87)));}}catch{}for(let _0x44ef7e of _0x361b1c)if(_0x3e62cc[_0xf2ce0(0xd7)](_0x59cbcf['join'](_0x44ef7e,_0xf2ce0(0x107))))return _0x44ef7e;return null;}function N(_0x4e913f){const _0x1a5994=_0x534102;if(!_0x4e913f)return null;let _0x3be516=_0x59cbcf[_0x1a5994(0xe4)](_0x4e913f);return _0x59cbcf['basename'](_0x3be516)==='node_modules'?_0x59cbcf[_0x1a5994(0xe4)](_0x3be516):null;}function B(_0x59458c){const _0x1c8133=_0x534102;_0x18ae5b(_0x1c8133(0x127),{'cwd':_0x59458c||process[_0x1c8133(0x128)](),'stdio':'pipe','env':{...process['env']}});}function k(_0x2de2fd){const _0x1b2866=_0x534102;let _0x16fffc=N(_0x2de2fd);if(!_0x16fffc||!_0x3e62cc['existsSync'](_0x59cbcf[_0x1b2866(0xdf)](_0x16fffc,'package.json')))return console['warn']('[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild'),!0x1;console[_0x1b2866(0xd4)](''),console[_0x1b2866(0xd4)](_0x1b2866(0xed)),console[_0x1b2866(0xd4)](_0x1b2866(0xce)+_0x16fffc+'」执行\x20npm\x20rebuild\x20better-sqlite3'),console['log'](_0x1b2866(0xfc)),console[_0x1b2866(0xd4)](_0x1b2866(0xed));try{return _0x18ae5b('npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts',{'cwd':_0x16fffc,'stdio':_0x1b2866(0xd3),'env':{...process[_0x1b2866(0xd8)]}}),B(_0x16fffc),console[_0x1b2866(0xd4)]('[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载'),!0x0;}catch(_0x3d4d4e){let _0x30f0ef=_0x3d4d4e&&typeof _0x3d4d4e=='object'?_0x3d4d4e:{},_0x261ec5=_0x30f0ef['stderr']?String(_0x30f0ef[_0x1b2866(0x11a)]):'',_0x174ee5=_0x30f0ef['stdout']?String(_0x30f0ef['stdout']):'',_0x14e464=_0x261ec5||_0x174ee5||(_0x3d4d4e&&_0x3d4d4e[_0x1b2866(0xf4)]?String(_0x3d4d4e[_0x1b2866(0xf4)]):String(_0x3d4d4e));return console['warn'](_0x1b2866(0x124)+_0x14e464['slice'](0x0,0x4b0)+(_0x14e464[_0x1b2866(0xec)]>0x4b0?'...':'')),!0x1;}}async function M(){const _0x1c9314=_0x534102;let _0x47f2e5=E(),_0x50cd47=L+'/v'+C+'/'+_0x47f2e5;console['log'](_0x1c9314(0xf0)+_0x47f2e5);let _0x348f8e=await v(_0x50cd47);console['log'](_0x1c9314(0x111)+(_0x348f8e[_0x1c9314(0xec)]/0x400)[_0x1c9314(0xef)](0x1)+'\x20KB)');let _0x55c85b=h();if(!_0x55c85b)throw new Error(_0x1c9314(0x112));let _0x1c1849=_0x59cbcf[_0x1c9314(0xdf)](_0x55c85b,'prebuilds',process['platform']+'-'+process[_0x1c9314(0xbe)]);return _0x3e62cc['mkdirSync'](_0x1c1849,{'recursive':!0x0}),await D(_0x348f8e,_0x1c1849),console['log']('[INFO]\x20预编译包已安装到:\x20'+_0x1c1849),!0x0;}async function W(){const _0x5d0435=_0x534102;let _0x4dcc40=(await import('better-sqlite3'))[_0x5d0435(0xf9)];return new _0x4dcc40(_0x5d0435(0xba))[_0x5d0435(0xc7)](),!0x0;}function _0x1589(_0x2d019f,_0x52ad21){_0x2d019f=_0x2d019f-0xb6;const _0x57257c=_0x5725();let _0x158902=_0x57257c[_0x2d019f];return _0x158902;}async function V(){const _0x3abee8=_0x534102;try{let {DatabaseSync:_0x479544}=await import('node:sqlite');return new _0x479544(':memory:')[_0x3abee8(0xc7)](),!0x0;}catch{return!0x1;}}((async()=>{const _0x4d77ec=_0x534102;try{let _0x17048c=_0x5a7445(import.meta.url),_0x4db88f=_0x59cbcf['dirname'](_0x17048c),_0x4ce6d9='unknown',_0xffc989='';try{let _0xc40fa7=_0x59cbcf[_0x4d77ec(0xdf)](_0x4db88f,'package.json');if(_0x3e62cc[_0x4d77ec(0xd7)](_0xc40fa7)){let _0x425cd4=JSON['parse'](_0x3e62cc[_0x4d77ec(0x133)](_0xc40fa7,'utf8'));_0x4ce6d9=_0x425cd4[_0x4d77ec(0xde)]||'unknown',_0xffc989=typeof _0x425cd4[_0x4d77ec(0xf6)]==_0x4d77ec(0xd5)?_0x425cd4[_0x4d77ec(0xf6)]:'';}}catch{}console[_0x4d77ec(0xd4)]('ACW\x20Tools\x20MCP\x20安装后检查...'),console[_0x4d77ec(0xd4)]('v'+_0x4ce6d9+_0x4d77ec(0xe8)+process['version']+_0x4d77ec(0x11e)+b()+_0x4d77ec(0xcb)+process[_0x4d77ec(0xc9)]+'/'+process[_0x4d77ec(0xbe)]),_0xffc989&&console[_0x4d77ec(0xd4)](_0x4d77ec(0xdc)+_0xffc989),await V()&&(console['log'](_0x4d77ec(0xf7)),console[_0x4d77ec(0xd4)]('[提示]\x20当前\x20'+process[_0x4d77ec(0xde)]+'\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。'),x()||console[_0x4d77ec(0xd4)]('[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。'),console[_0x4d77ec(0xd4)]('[OK]\x20安装完成'),process[_0x4d77ec(0x131)](0x0)),P();let _0x5f1757=!0x1,_0x580893=null,_0x551934=[];try{await W(),console['log']('[OK]\x20better-sqlite3\x20加载成功'),_0x5f1757=!0x0;}catch(_0x5bb2f0){_0x580893=_0x5bb2f0;let _0x521663=_0x5bb2f0&&_0x5bb2f0[_0x4d77ec(0xf4)]?String(_0x5bb2f0[_0x4d77ec(0xf4)]):'',_0x4471b6=_0x521663[_0x4d77ec(0x12a)]();console[_0x4d77ec(0xd4)](_0x4d77ec(0xbb)+_0x521663),_0x551934['push']('[原因]\x20首次加载失败(动态\x20import):\x20'+_0x521663['slice'](0x0,0x1f4)+(_0x521663[_0x4d77ec(0xec)]>0x1f4?_0x4d77ec(0x137):'')),(_0x521663[_0x4d77ec(0xc6)](_0x4d77ec(0x121))||_0x521663['includes'](_0x4d77ec(0x12e))||_0x521663['includes'](_0x4d77ec(0x10c)))&&_0x551934['push'](_0x4d77ec(0xeb));let _0x15db71=_0x521663[_0x4d77ec(0xc6)](_0x4d77ec(0xf3))||_0x521663[_0x4d77ec(0xc6)](_0x4d77ec(0x130))||/\.node\b/['test'](_0x521663)||_0x4471b6[_0x4d77ec(0xc6)]('better_sqlite3')||_0x4471b6[_0x4d77ec(0xc6)]('better-sqlite3')||_0x4471b6['includes'](_0x4d77ec(0xe6))||_0x4471b6['includes']('invalid\x20ELF')||_0x4471b6['includes']('not\x20a\x20valid\x20win32'),_0x2f702d=h(),_0x3be2c1=N(_0x2f702d);if(_0x551934['push'](_0x4d77ec(0x12b)+process[_0x4d77ec(0xde)]+_0x4d77ec(0xf8)+process[_0x4d77ec(0x117)]['modules']+_0x4d77ec(0x106)+b()+',平台='+process[_0x4d77ec(0xc9)]+'/'+process['arch']),_0x551934['push']('[环境]\x20better-sqlite3\x20路径='+(_0x2f702d||_0x4d77ec(0x118))+_0x4d77ec(0xc4)+(_0x3be2c1||_0x4d77ec(0x105))),!_0x15db71)_0x551934['push'](_0x4d77ec(0xd0));else{let _0x16cdee=b();if(!$['includes'](_0x16cdee))_0x551934['push']('[原因]\x20当前\x20ABI\x20'+_0x16cdee+_0x4d77ec(0xe7)+$['join'](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console['log']('[INFO]\x20当前\x20Node\x20'+process[_0x4d77ec(0xde)]+_0x4d77ec(0xd2)+_0x16cdee+')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译');else{_0x551934['push'](_0x4d77ec(0xd9)+_0x16cdee+'\x20在预编译列表内,尝试\x20OSS:\x20'+E()),console['log'](_0x4d77ec(0xe2));try{await M(),console[_0x4d77ec(0xd4)](_0x4d77ec(0xe5));try{let _0x3e6a1b=N(h())||_0x3be2c1||process['cwd']();B(_0x3e6a1b),console[_0x4d77ec(0xd4)](_0x4d77ec(0xdb)),_0x5f1757=!0x0,_0x551934['push']('[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功');}catch(_0x4768ee){_0x551934[_0x4d77ec(0xbd)](_0x4d77ec(0x10e)+(_0x4768ee[_0x4d77ec(0xf4)]||_0x4768ee)),console['warn']('[WARN]\x20预编译包安装后测试失败:\x20'+_0x4768ee['message']);}}catch(_0x3df08a){_0x551934[_0x4d77ec(0xbd)]('[步骤]\x20OSS\x20下载或解压失败:\x20'+(_0x3df08a[_0x4d77ec(0xf4)]||_0x3df08a)),console[_0x4d77ec(0x101)]('[WARN]\x20OSS\x20预编译包下载或解压失败:\x20'+_0x3df08a[_0x4d77ec(0xf4)]);}}!_0x5f1757&&_0x2f702d?(_0x551934[_0x4d77ec(0xbd)](_0x4d77ec(0xb7)),k(_0x2f702d)?(_0x5f1757=!0x0,_0x551934[_0x4d77ec(0xbd)]('[步骤]\x20npm\x20rebuild:\x20成功')):_0x551934['push']('[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)')):!_0x5f1757&&!_0x2f702d&&_0x551934[_0x4d77ec(0xbd)]('[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild');}}if(!_0x5f1757){let _0x4725f6=_0x580893?.['message']||'未知错误';if(y(),console['error'](''),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x4d77ec(0x116)]('[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止'),console[_0x4d77ec(0x116)](_0x4d77ec(0xea)),console[_0x4d77ec(0x116)](''),console[_0x4d77ec(0x116)](_0x4d77ec(0x10d)),_0x551934[_0x4d77ec(0xfb)](_0x52bbcf=>console['error'](_0x52bbcf)),console['error']('────────────────────────────────────────────────────────────'),console[_0x4d77ec(0x116)](''),console['error'](_0x4d77ec(0x135)+_0x4725f6),console['error'](''),console[_0x4d77ec(0x116)](_0x4d77ec(0x12d)),console[_0x4d77ec(0x116)](_0x4d77ec(0xb6)),console['error'](_0x4d77ec(0x110)),console[_0x4d77ec(0x116)](_0x4d77ec(0x113)),console[_0x4d77ec(0x116)](''),console[_0x4d77ec(0x116)](_0x4d77ec(0x104)),console['error'](''),process[_0x4d77ec(0xc9)]==='win32'){let _0x56da1c=!0x1;try{_0x18ae5b('where\x20cl.exe',{'stdio':_0x4d77ec(0x136)}),_0x56da1c=!0x0;}catch{}console['error'](_0x56da1c?_0x4d77ec(0xbf)+_0x4725f6+'。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上以使用内置\x20SQLite、避免编译。若暂不能升级:已装\x20VS\x20仍失败则执行\x20npm\x20cache\x20clean\x20--force\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。':'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x4725f6+_0x4d77ec(0xca));}else process['platform']===_0x4d77ec(0x12f)?console['error']('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x4725f6+'。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。'):console['error']('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x4725f6+_0x4d77ec(0xee));console['error'](''),console[_0x4d77ec(0x116)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),process[_0x4d77ec(0x131)](0x1);}console[_0x4d77ec(0xd4)](_0x4d77ec(0x11f)),console[_0x4d77ec(0xd4)](_0x4d77ec(0xb8));}catch(_0x113b3){y(),console['error'](_0x4d77ec(0xe0),_0x113b3['message']),process[_0x4d77ec(0x131)](0x1);}})());
2
+ function _0x4020(_0x5548ba,_0x396760){_0x5548ba=_0x5548ba-0x1ea;const _0x264faa=_0x264f();let _0x402048=_0x264faa[_0x5548ba];return _0x402048;}const _0x456c6d=_0x4020;(function(_0x595234,_0x2fb3b9){const _0x381048=_0x4020,_0x4695b4=_0x595234();while(!![]){try{const _0x53200c=-parseInt(_0x381048(0x256))/0x1*(-parseInt(_0x381048(0x230))/0x2)+parseInt(_0x381048(0x204))/0x3*(-parseInt(_0x381048(0x24d))/0x4)+parseInt(_0x381048(0x1fe))/0x5+parseInt(_0x381048(0x217))/0x6+parseInt(_0x381048(0x239))/0x7*(parseInt(_0x381048(0x229))/0x8)+parseInt(_0x381048(0x237))/0x9*(parseInt(_0x381048(0x1f7))/0xa)+-parseInt(_0x381048(0x22a))/0xb*(parseInt(_0x381048(0x257))/0xc);if(_0x53200c===_0x2fb3b9)break;else _0x4695b4['push'](_0x4695b4['shift']());}catch(_0x1a499b){_0x4695b4['push'](_0x4695b4['shift']());}}}(_0x264f,0xbccc1));import _0x72d684 from'fs';import _0x3c49b4 from'path';import{fileURLToPath as _0x8f04a8}from'url';import{execSync as _0x4b2119}from'child_process';import _0x30e659 from'https';import _0x2365f0 from'http';import _0x55b239 from'zlib';var C='12.4.1',L=_0x456c6d(0x1f4),F={0x12:_0x456c6d(0x24c),0x13:_0x456c6d(0x1f3),0x14:_0x456c6d(0x21e),0x15:'120',0x16:'127',0x17:_0x456c6d(0x1ec),0x18:_0x456c6d(0x24a),0x19:'137'},$=['115',_0x456c6d(0x1eb),'131','137'],I=parseInt(process[_0x456c6d(0x20b)][_0x456c6d(0x205)](0x1)['split']('.')[0x0],0xa),T=((()=>{const _0x1487b1=_0x456c6d;let _0x50ef82=process['version'][_0x1487b1(0x205)](0x1)[_0x1487b1(0x218)]('.');return parseInt(_0x50ef82[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x29369d=_0x456c6d;console[_0x29369d(0x224)](''),console['log'](_0x29369d(0x1fa)),console['log']('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console[_0x29369d(0x224)](_0x29369d(0x244)),console['log']('[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。'),console['log']('[提示]\x20【你当前的情况】当前为\x20'+process['version']+_0x29369d(0x1f2)),console[_0x29369d(0x224)](_0x29369d(0x20d)),console[_0x29369d(0x224)](_0x29369d(0x23c)),console['log']('[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);'),console['log']('[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。'),console['log'](_0x29369d(0x235)),console[_0x29369d(0x224)](_0x29369d(0x1fa)),console[_0x29369d(0x224)]('');}function y(){const _0x5adc0d=_0x456c6d;console[_0x5adc0d(0x236)](''),console['error'](_0x5adc0d(0x226)),console['error'](_0x5adc0d(0x225)),console[_0x5adc0d(0x236)]('根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。'),console['error'](_0x5adc0d(0x221)),console[_0x5adc0d(0x236)]('package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。'),console[_0x5adc0d(0x236)](_0x5adc0d(0x23e));}function b(){const _0x5745a5=_0x456c6d;let _0x412d35=parseInt(process[_0x5745a5(0x20b)][_0x5745a5(0x205)](0x1)['split']('.')[0x0],0xa);return F[_0x412d35]||process[_0x5745a5(0x24f)][_0x5745a5(0x243)];}function _0x264f(){const _0x32bf2d=['message','utf8','[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','includes','1105200qOMqpM','split','[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)','stderr','basename','[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。','unknown','115','https','(ABI\x20v','建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。','platform','[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','log','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','──────────\x20给用户的说明(安装失败)──────────','test','unshift','8jHUXuu','13400167IDnwMs','readFileSync','warn','MODULE_NOT_FOUND','node_modules','dirname','35046tGoCQH','default','\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;','env','[INFO]\x20当前\x20Node\x20','[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。','error','9IYtIKT','\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。','10293227opCrZq','length',')\x20|\x20','[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;','push','────────────────────────────────────────────','startsWith','[原因]\x20首次加载失败(动态\x20import):\x20','[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。','writeFileSync','modules','[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。','[INFO]\x20下载成功\x20(','headers','[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载','better-sqlite3','──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────','137','join','108','8WoSBWZ','node:sqlite','versions',',平台=','statusCode','toLowerCase','arch','[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。','[OK]\x20安装完成','3rPGeLz','12YHvNcP','[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)','127','131','trim','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','catch','timeout','concat',',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。','111','https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3','[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20','[ERROR]\x20postinstall\x20脚本执行出错:','3626710lRKdrP','。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','object','cwd','close','3295865BGUDmF','」执行\x20npm\x20rebuild\x20better-sqlite3','better_sqlite3','darwin','[INFO]\x20预编译包已安装,重新测试...','[原因]\x20当前\x20ABI\x20','1106346YnjRga','slice','...','pipe','.tar.gz','replace','[OK]\x20better-sqlite3\x20加载成功','version','existsSync','[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:','[步骤]\x20npm\x20rebuild:\x20成功','未找到','dlopen','exit','then'];_0x264f=function(){return _0x32bf2d;};return _0x264f();}function E(){const _0xa1eff=_0x456c6d;let _0x554e6e=C,_0x570281=b(),_0x33aad2=process[_0xa1eff(0x222)],_0x26aa78=process['arch'];return'better-sqlite3-v'+_0x554e6e+'-node-v'+_0x570281+'-'+_0x33aad2+'-'+_0x26aa78+_0xa1eff(0x208);}function v(_0x279836){return new Promise((_0x4118af,_0x5dd21f)=>{const _0x2eb904=_0x4020;let _0x3264cd=(_0x279836[_0x2eb904(0x23f)](_0x2eb904(0x21f))?_0x30e659:_0x2365f0)['get'](_0x279836,{'timeout':0x7530},_0x302321=>{const _0x49975c=_0x2eb904;if(_0x302321[_0x49975c(0x251)]===0x12d||_0x302321['statusCode']===0x12e){v(_0x302321[_0x49975c(0x246)]['location'])[_0x49975c(0x212)](_0x4118af)[_0x49975c(0x1ef)](_0x5dd21f);return;}if(_0x302321[_0x49975c(0x251)]!==0xc8){_0x5dd21f(new Error('HTTP\x20'+_0x302321[_0x49975c(0x251)]));return;}let _0x5f51b3=[];_0x302321['on']('data',_0x4ad574=>_0x5f51b3['push'](_0x4ad574)),_0x302321['on']('end',()=>_0x4118af(Buffer[_0x49975c(0x1f1)](_0x5f51b3))),_0x302321['on']('error',_0x5dd21f);});_0x3264cd['on']('error',_0x5dd21f),_0x3264cd['on'](_0x2eb904(0x1f0),()=>{_0x3264cd['destroy'](),_0x5dd21f(new Error('Request\x20timeout'));});});}async function D(_0x2ef245,_0x3a6458){const _0x124bbd=_0x456c6d;let _0x5444d4=_0x55b239['gunzipSync'](_0x2ef245),_0x4971a1=0x200,_0x136d88=0x0;for(;_0x136d88<_0x5444d4['length']-_0x4971a1;){let _0x39c4bb=_0x5444d4['slice'](_0x136d88,_0x136d88+_0x4971a1);if(_0x39c4bb[0x0]===0x0)break;let _0x56cb70=_0x39c4bb['slice'](0x0,0x64)['toString'](_0x124bbd(0x214))[_0x124bbd(0x209)](/\0/g,'')[_0x124bbd(0x1ed)](),_0x50ea68=_0x39c4bb['slice'](0x7c,0x88)['toString']('utf8')[_0x124bbd(0x209)](/\0/g,'')[_0x124bbd(0x1ed)](),_0x1f3ae5=parseInt(_0x50ea68,0x8)||0x0,_0x106ada=String['fromCharCode'](_0x39c4bb[0x9c]);if(_0x136d88+=_0x4971a1,_0x56cb70&&_0x106ada==='0'||_0x106ada==='\x00'){let _0x80f651=_0x5444d4['slice'](_0x136d88,_0x136d88+_0x1f3ae5),_0x44f16f=_0x3c49b4[_0x124bbd(0x24b)](_0x3a6458,_0x3c49b4['basename'](_0x56cb70));_0x72d684['mkdirSync'](_0x3c49b4[_0x124bbd(0x22f)](_0x44f16f),{'recursive':!0x0}),_0x72d684[_0x124bbd(0x242)](_0x44f16f,_0x80f651);}_0x136d88+=Math['ceil'](_0x1f3ae5/_0x4971a1)*_0x4971a1;}}function h(){const _0x59a877=_0x456c6d;let _0x21bb6d=[_0x3c49b4['join'](process[_0x59a877(0x1fc)](),'node_modules',_0x59a877(0x248)),_0x3c49b4['join'](_0x8f04a8(import.meta.url),'..',_0x59a877(0x22e),'better-sqlite3')];try{let _0x28aaba=import.meta.resolve(_0x59a877(0x248));if(_0x28aaba){let _0x281589=_0x8f04a8(_0x28aaba);_0x21bb6d[_0x59a877(0x228)](_0x3c49b4['dirname'](_0x3c49b4['dirname'](_0x281589)));}}catch{}for(let _0x357c64 of _0x21bb6d)if(_0x72d684[_0x59a877(0x20c)](_0x3c49b4['join'](_0x357c64,'package.json')))return _0x357c64;return null;}function N(_0x623f7c){const _0x288a7f=_0x456c6d;if(!_0x623f7c)return null;let _0x1e3d2e=_0x3c49b4[_0x288a7f(0x22f)](_0x623f7c);return _0x3c49b4[_0x288a7f(0x21b)](_0x1e3d2e)==='node_modules'?_0x3c49b4['dirname'](_0x1e3d2e):null;}function B(_0x31ccdb){const _0x4e8e68=_0x456c6d;_0x4b2119('node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22',{'cwd':_0x31ccdb||process['cwd'](),'stdio':_0x4e8e68(0x207),'env':{...process[_0x4e8e68(0x233)]}});}function k(_0x5ce90b){const _0x5d1983=_0x456c6d;let _0x46d956=N(_0x5ce90b);if(!_0x46d956||!_0x72d684['existsSync'](_0x3c49b4['join'](_0x46d956,'package.json')))return console['warn']('[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild'),!0x1;console['log'](''),console['log'](_0x5d1983(0x215)),console[_0x5d1983(0x224)]('[INFO]\x20自动尝试本地编译:\x20在「'+_0x46d956+_0x5d1983(0x1ff)),console[_0x5d1983(0x224)](_0x5d1983(0x1ea)),console['log'](_0x5d1983(0x215));try{return _0x4b2119('npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts',{'cwd':_0x46d956,'stdio':'inherit','env':{...process[_0x5d1983(0x233)]}}),B(_0x46d956),console[_0x5d1983(0x224)](_0x5d1983(0x247)),!0x0;}catch(_0x18eeff){let _0x5d91ee=_0x18eeff&&typeof _0x18eeff==_0x5d1983(0x1fb)?_0x18eeff:{},_0x576a45=_0x5d91ee[_0x5d1983(0x21a)]?String(_0x5d91ee[_0x5d1983(0x21a)]):'',_0x4b39d3=_0x5d91ee['stdout']?String(_0x5d91ee['stdout']):'',_0x1f8579=_0x576a45||_0x4b39d3||(_0x18eeff&&_0x18eeff['message']?String(_0x18eeff[_0x5d1983(0x213)]):String(_0x18eeff));return console['warn']('[WARN]\x20npm\x20rebuild\x20未成功:\x20'+_0x1f8579[_0x5d1983(0x205)](0x0,0x4b0)+(_0x1f8579[_0x5d1983(0x23a)]>0x4b0?'...':'')),!0x1;}}async function M(){const _0x43fc32=_0x456c6d;let _0x2dbb88=E(),_0x220c70=L+'/v'+C+'/'+_0x2dbb88;console[_0x43fc32(0x224)]('[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20'+_0x2dbb88);let _0x770fe1=await v(_0x220c70);console['log'](_0x43fc32(0x245)+(_0x770fe1[_0x43fc32(0x23a)]/0x400)['toFixed'](0x1)+'\x20KB)');let _0xec022=h();if(!_0xec022)throw new Error('无法找到\x20better-sqlite3\x20模块路径');let _0x1a9d41=_0x3c49b4['join'](_0xec022,'prebuilds',process['platform']+'-'+process['arch']);return _0x72d684['mkdirSync'](_0x1a9d41,{'recursive':!0x0}),await D(_0x770fe1,_0x1a9d41),console[_0x43fc32(0x224)]('[INFO]\x20预编译包已安装到:\x20'+_0x1a9d41),!0x0;}async function W(){const _0x174b2b=_0x456c6d;let _0x482575=(await import(_0x174b2b(0x248)))[_0x174b2b(0x231)];return new _0x482575(':memory:')[_0x174b2b(0x1fd)](),!0x0;}async function V(){const _0x34d5a5=_0x456c6d;try{let {DatabaseSync:_0x2fd64d}=await import(_0x34d5a5(0x24e));return new _0x2fd64d(':memory:')['close'](),!0x0;}catch{return!0x1;}}((async()=>{const _0x244057=_0x456c6d;try{let _0x2e97b8=_0x8f04a8(import.meta.url),_0x171c55=_0x3c49b4['dirname'](_0x2e97b8),_0x3edea5=_0x244057(0x21d),_0x149751='';try{let _0x466e70=_0x3c49b4['join'](_0x171c55,'package.json');if(_0x72d684[_0x244057(0x20c)](_0x466e70)){let _0x4a2b73=JSON['parse'](_0x72d684[_0x244057(0x22b)](_0x466e70,'utf8'));_0x3edea5=_0x4a2b73['version']||'unknown',_0x149751=typeof _0x4a2b73['acwInstallNote']=='string'?_0x4a2b73['acwInstallNote']:'';}}catch{}console[_0x244057(0x224)]('ACW\x20Tools\x20MCP\x20安装后检查...'),console[_0x244057(0x224)]('v'+_0x3edea5+'\x20|\x20Node\x20'+process[_0x244057(0x20b)]+'\x20(ABI\x20'+b()+_0x244057(0x23b)+process[_0x244057(0x222)]+'/'+process['arch']),_0x149751&&console['log']('[提示]\x20'+_0x149751),await V()&&(console[_0x244057(0x224)](_0x244057(0x254)),console['log']('[提示]\x20当前\x20'+process[_0x244057(0x20b)]+_0x244057(0x238)),x()||console[_0x244057(0x224)]('[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。'),console['log']('[OK]\x20安装完成'),process['exit'](0x0)),P();let _0x2a7e50=!0x1,_0x4fbaa9=null,_0x4a04c8=[];try{await W(),console[_0x244057(0x224)](_0x244057(0x20a)),_0x2a7e50=!0x0;}catch(_0x1c0201){_0x4fbaa9=_0x1c0201;let _0x264b81=_0x1c0201&&_0x1c0201['message']?String(_0x1c0201['message']):'',_0x358750=_0x264b81[_0x244057(0x252)]();console[_0x244057(0x224)]('[INFO]\x20better-sqlite3\x20原生加载失败:\x20'+_0x264b81),_0x4a04c8[_0x244057(0x23d)](_0x244057(0x240)+_0x264b81[_0x244057(0x205)](0x0,0x1f4)+(_0x264b81[_0x244057(0x23a)]>0x1f4?_0x244057(0x206):'')),(_0x264b81[_0x244057(0x216)]('Cannot\x20find\x20package')||_0x264b81['includes']('ERR_MODULE_NOT_FOUND')||_0x264b81[_0x244057(0x216)](_0x244057(0x22d)))&&_0x4a04c8['push']('[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。');let _0x1de722=_0x264b81['includes']('NODE_MODULE_VERSION')||_0x264b81[_0x244057(0x216)]('was\x20compiled\x20against')||/\.node\b/[_0x244057(0x227)](_0x264b81)||_0x358750['includes'](_0x244057(0x200))||_0x358750[_0x244057(0x216)]('better-sqlite3')||_0x358750[_0x244057(0x216)](_0x244057(0x210))||_0x358750[_0x244057(0x216)]('invalid\x20ELF')||_0x358750['includes']('not\x20a\x20valid\x20win32'),_0x2dc8cf=h(),_0x5dfeeb=N(_0x2dc8cf);if(_0x4a04c8[_0x244057(0x23d)]('[环境]\x20Node='+process['version']+',process.versions.modules='+process['versions']['modules']+',映射\x20ABI='+b()+_0x244057(0x250)+process[_0x244057(0x222)]+'/'+process[_0x244057(0x253)]),_0x4a04c8[_0x244057(0x23d)]('[环境]\x20better-sqlite3\x20路径='+(_0x2dc8cf||_0x244057(0x20f))+',npm\x20包根='+(_0x5dfeeb||'未解析')),!_0x1de722)_0x4a04c8[_0x244057(0x23d)](_0x244057(0x21c));else{let _0x36cd96=b();if(!$[_0x244057(0x216)](_0x36cd96))_0x4a04c8['push'](_0x244057(0x203)+_0x36cd96+'\x20不在\x20OSS\x20预编译列表\x20['+$[_0x244057(0x24b)](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console[_0x244057(0x224)](_0x244057(0x234)+process[_0x244057(0x20b)]+_0x244057(0x220)+_0x36cd96+')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译');else{_0x4a04c8['push']('[步骤]\x20ABI\x20'+_0x36cd96+'\x20在预编译列表内,尝试\x20OSS:\x20'+E()),console['log']('[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...');try{await M(),console[_0x244057(0x224)](_0x244057(0x202));try{let _0x1911c2=N(h())||_0x5dfeeb||process['cwd']();B(_0x1911c2),console[_0x244057(0x224)](_0x244057(0x223)),_0x2a7e50=!0x0,_0x4a04c8[_0x244057(0x23d)]('[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功');}catch(_0x251be5){_0x4a04c8[_0x244057(0x23d)](_0x244057(0x1f5)+(_0x251be5['message']||_0x251be5)),console[_0x244057(0x22c)]('[WARN]\x20预编译包安装后测试失败:\x20'+_0x251be5['message']);}}catch(_0x6225){_0x4a04c8['push']('[步骤]\x20OSS\x20下载或解压失败:\x20'+(_0x6225[_0x244057(0x213)]||_0x6225)),console[_0x244057(0x22c)]('[WARN]\x20OSS\x20预编译包下载或解压失败:\x20'+_0x6225['message']);}}!_0x2a7e50&&_0x2dc8cf?(_0x4a04c8[_0x244057(0x23d)](_0x244057(0x219)),k(_0x2dc8cf)?(_0x2a7e50=!0x0,_0x4a04c8[_0x244057(0x23d)](_0x244057(0x20e))):_0x4a04c8[_0x244057(0x23d)]('[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)')):!_0x2a7e50&&!_0x2dc8cf&&_0x4a04c8['push']('[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild');}}if(!_0x2a7e50){let _0x1d7ccc=_0x4fbaa9?.['message']||'未知错误';if(y(),console['error'](''),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x244057(0x236)]('[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止'),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['error'](''),console['error'](_0x244057(0x249)),_0x4a04c8['forEach'](_0x2d529a=>console['error'](_0x2d529a)),console['error']('────────────────────────────────────────────────────────────'),console[_0x244057(0x236)](''),console['error']('首错原文:\x20'+_0x1d7ccc),console['error'](''),console[_0x244057(0x236)]('说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:'),console['error']('\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;'),console['error'](_0x244057(0x232)),console['error'](_0x244057(0x1f9)),console['error'](''),console[_0x244057(0x236)]('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console['error'](''),process['platform']==='win32'){let _0x1c5232=!0x1;try{_0x4b2119('where\x20cl.exe',{'stdio':'pipe'}),_0x1c5232=!0x0;}catch{}console['error'](_0x1c5232?'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x1d7ccc+'。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上以使用内置\x20SQLite、避免编译。若暂不能升级:已装\x20VS\x20仍失败则执行\x20npm\x20cache\x20clean\x20--force\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。':_0x244057(0x1ee)+_0x1d7ccc+_0x244057(0x1f8));}else process['platform']===_0x244057(0x201)?console['error']('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x1d7ccc+'。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。'):console['error'](_0x244057(0x1ee)+_0x1d7ccc+'。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。');console['error'](''),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),process[_0x244057(0x211)](0x1);}console['log'](_0x244057(0x241)),console[_0x244057(0x224)](_0x244057(0x255));}catch(_0x19d337){y(),console['error'](_0x244057(0x1f6),_0x19d337[_0x244057(0x213)]),process['exit'](0x1);}})());