@bangdao-ai/acw-tools 1.13.49 → 1.13.51

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.49",
4
+ "version": "1.13.51",
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.49",
3
+ "version": "1.13.51",
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
- function _0x20da(){const _0x3bfdf5=['[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功','[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:','better-sqlite3','[OK]\x20安装完成','close','slice','includes','3026EpOWsY','[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止','[提示]\x20【你当前的情况】当前为\x20','────────────────────────────────────────────','未找到','[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。','toString',',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。','warn','」执行\x20npm\x20rebuild\x20better-sqlite3','toFixed','54UcAaze','[INFO]\x20下载成功\x20(','MODULE_NOT_FOUND','utf8','\x20|\x20Node\x20','[INFO]\x20预编译包已安装,重新测试...','env','replace','127','[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。','-node-v','。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。','split','acwInstallNote','catch','137','forEach','...',',映射\x20ABI=','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','get','489531kSlXRR','[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。','length','cwd','1497555NBQRHW','[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','statusCode','version','194190ShResl','dlopen','ACW\x20Tools\x20MCP\x20安装后检查...','[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20','string','stdout','platform','[提示]\x20','https','633088oFQvRb','[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;','join','exit','ERR_MODULE_NOT_FOUND','[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;','basename','──────────\x20给用户的说明(安装失败)──────────','[WARN]\x20OSS\x20预编译包下载或解压失败:\x20','[INFO]\x20better-sqlite3\x20原生加载失败:\x20','40IifDyW','arch','[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild','startsWith','package.json','首错原文:\x20','。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。',':memory:','log','\x20KB)','existsSync','ceil','error','versions','mkdirSync','1788290DkiqjW','better_sqlite3','[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);','darwin','push','50YnYyjh','108','dirname','建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。','[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。','test','inherit','.tar.gz','node_modules','message','[WARN]\x20npm\x20rebuild\x20未成功:\x20','[环境]\x20better-sqlite3\x20路径=','12.4.1','[OK]\x20better-sqlite3\x20加载成功','[INFO]\x20当前\x20Node\x20','[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','10DmTzzY','package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。','[WARN]\x20预编译包安装后测试失败:\x20','[ERROR]\x20postinstall\x20脚本执行出错:','[步骤]\x20OSS\x20下载或解压失败:\x20','win32','(ABI\x20v','[原因]\x20首次加载失败(动态\x20import):\x20','342529alZiBJ','unshift','[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。'];_0x20da=function(){return _0x3bfdf5;};return _0x20da();}const _0x36d94b=_0x68d2;(function(_0x245821,_0x43e2a5){const _0x230ae0=_0x68d2,_0x29f339=_0x245821();while(!![]){try{const _0x258101=-parseInt(_0x230ae0(0xfc))/0x1*(parseInt(_0x230ae0(0x164))/0x2)+-parseInt(_0x230ae0(0x111))/0x3+-parseInt(_0x230ae0(0x123))/0x4+-parseInt(_0x230ae0(0x142))/0x5*(-parseInt(_0x230ae0(0x11a))/0x6)+-parseInt(_0x230ae0(0x13d))/0x7+-parseInt(_0x230ae0(0x12e))/0x8*(-parseInt(_0x230ae0(0x115))/0x9)+-parseInt(_0x230ae0(0x152))/0xa*(parseInt(_0x230ae0(0x15a))/0xb);if(_0x258101===_0x43e2a5)break;else _0x29f339['push'](_0x29f339['shift']());}catch(_0x1d27d4){_0x29f339['push'](_0x29f339['shift']());}}}(_0x20da,0x71bc9));function _0x68d2(_0x3d1888,_0x1c5a49){_0x3d1888=_0x3d1888-0xf2;const _0x20dad5=_0x20da();let _0x68d249=_0x20dad5[_0x3d1888];return _0x68d249;}import _0x46394f from'fs';import _0x482d19 from'path';import{fileURLToPath as _0x1f1ee8}from'url';import{execSync as _0x5d47ff}from'child_process';import _0x23eca2 from'https';import _0x47821d from'http';import _0x1a7b49 from'zlib';var C=_0x36d94b(0x14e),L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:_0x36d94b(0x143),0x13:'111',0x14:'115',0x15:'120',0x16:_0x36d94b(0x104),0x17:'131',0x18:_0x36d94b(0x10b),0x19:_0x36d94b(0x10b)},$=['115','127','131',_0x36d94b(0x10b)],I=parseInt(process[_0x36d94b(0x119)][_0x36d94b(0x162)](0x1)['split']('.')[0x0],0xa),T=((()=>{const _0x4d73b1=_0x36d94b;let _0x22eefe=process[_0x4d73b1(0x119)]['slice'](0x1)[_0x4d73b1(0x108)]('.');return parseInt(_0x22eefe[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x1c4cea=_0x36d94b;console[_0x1c4cea(0x136)](''),console['log']('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x1c4cea(0x136)]('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console['log']('[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。'),console['log'](_0x1c4cea(0x112)),console['log'](_0x1c4cea(0xf3)+process['version']+_0x1c4cea(0xf8)),console[_0x1c4cea(0x136)](_0x1c4cea(0x15e)),console['log'](_0x1c4cea(0x129)),console[_0x1c4cea(0x136)](_0x1c4cea(0x13f)),console['log']('[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。'),console[_0x1c4cea(0x136)](_0x1c4cea(0x146)),console['log'](_0x1c4cea(0x166)),console[_0x1c4cea(0x136)]('');}function y(){const _0x18203f=_0x36d94b;console['error'](''),console[_0x18203f(0x13a)](_0x18203f(0x12b)),console[_0x18203f(0x13a)]('本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。'),console[_0x18203f(0x13a)]('根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。'),console[_0x18203f(0x13a)](_0x18203f(0x145)),console['error'](_0x18203f(0x153)),console[_0x18203f(0x13a)](_0x18203f(0xf4));}function b(){const _0xd0bf92=_0x36d94b;let _0x4533f6=parseInt(process[_0xd0bf92(0x119)][_0xd0bf92(0x162)](0x1)[_0xd0bf92(0x108)]('.')[0x0],0xa);return F[_0x4533f6]||process[_0xd0bf92(0x13b)]['modules'];}function E(){const _0xd39a72=_0x36d94b;let _0x499499=C,_0x3fd850=b(),_0x97b900=process[_0xd39a72(0x120)],_0x5ae958=process['arch'];return'better-sqlite3-v'+_0x499499+_0xd39a72(0x106)+_0x3fd850+'-'+_0x97b900+'-'+_0x5ae958+_0xd39a72(0x149);}function v(_0x1ac072){return new Promise((_0x4a32e5,_0x50a7a0)=>{const _0x88ee2f=_0x68d2;let _0x39a700=(_0x1ac072[_0x88ee2f(0x131)](_0x88ee2f(0x122))?_0x23eca2:_0x47821d)[_0x88ee2f(0x110)](_0x1ac072,{'timeout':0x7530},_0x59df85=>{const _0x4dcd54=_0x88ee2f;if(_0x59df85[_0x4dcd54(0x118)]===0x12d||_0x59df85[_0x4dcd54(0x118)]===0x12e){v(_0x59df85['headers']['location'])['then'](_0x4a32e5)[_0x4dcd54(0x10a)](_0x50a7a0);return;}if(_0x59df85['statusCode']!==0xc8){_0x50a7a0(new Error('HTTP\x20'+_0x59df85[_0x4dcd54(0x118)]));return;}let _0x147db6=[];_0x59df85['on']('data',_0x3344c3=>_0x147db6['push'](_0x3344c3)),_0x59df85['on']('end',()=>_0x4a32e5(Buffer['concat'](_0x147db6))),_0x59df85['on']('error',_0x50a7a0);});_0x39a700['on'](_0x88ee2f(0x13a),_0x50a7a0),_0x39a700['on']('timeout',()=>{_0x39a700['destroy'](),_0x50a7a0(new Error('Request\x20timeout'));});});}async function D(_0xaf9d3a,_0x37f59a){const _0x21bb7c=_0x36d94b;let _0x524d03=_0x1a7b49['gunzipSync'](_0xaf9d3a),_0x3e1347=0x200,_0x3b17ae=0x0;for(;_0x3b17ae<_0x524d03[_0x21bb7c(0x113)]-_0x3e1347;){let _0x2cb4f6=_0x524d03['slice'](_0x3b17ae,_0x3b17ae+_0x3e1347);if(_0x2cb4f6[0x0]===0x0)break;let _0x532522=_0x2cb4f6['slice'](0x0,0x64)[_0x21bb7c(0xf7)](_0x21bb7c(0xff))[_0x21bb7c(0x103)](/\0/g,'')['trim'](),_0x17b3dd=_0x2cb4f6['slice'](0x7c,0x88)[_0x21bb7c(0xf7)](_0x21bb7c(0xff))['replace'](/\0/g,'')['trim'](),_0x5634cd=parseInt(_0x17b3dd,0x8)||0x0,_0x4c0f0a=String['fromCharCode'](_0x2cb4f6[0x9c]);if(_0x3b17ae+=_0x3e1347,_0x532522&&_0x4c0f0a==='0'||_0x4c0f0a==='\x00'){let _0x1c0e58=_0x524d03['slice'](_0x3b17ae,_0x3b17ae+_0x5634cd),_0x14ead4=_0x482d19[_0x21bb7c(0x126)](_0x37f59a,_0x482d19[_0x21bb7c(0x12a)](_0x532522));_0x46394f[_0x21bb7c(0x13c)](_0x482d19[_0x21bb7c(0x144)](_0x14ead4),{'recursive':!0x0}),_0x46394f['writeFileSync'](_0x14ead4,_0x1c0e58);}_0x3b17ae+=Math[_0x21bb7c(0x139)](_0x5634cd/_0x3e1347)*_0x3e1347;}}function h(){const _0x2ae432=_0x36d94b;let _0x1f3527=[_0x482d19[_0x2ae432(0x126)](process[_0x2ae432(0x114)](),_0x2ae432(0x14a),_0x2ae432(0x15f)),_0x482d19[_0x2ae432(0x126)](_0x1f1ee8(import.meta.url),'..',_0x2ae432(0x14a),'better-sqlite3')];try{let _0x4db32d=import.meta.resolve(_0x2ae432(0x15f));if(_0x4db32d){let _0x32e4db=_0x1f1ee8(_0x4db32d);_0x1f3527[_0x2ae432(0x15b)](_0x482d19['dirname'](_0x482d19['dirname'](_0x32e4db)));}}catch{}for(let _0x7e3cbc of _0x1f3527)if(_0x46394f['existsSync'](_0x482d19[_0x2ae432(0x126)](_0x7e3cbc,_0x2ae432(0x132))))return _0x7e3cbc;return null;}function N(_0x301f7f){const _0x3c42fd=_0x36d94b;if(!_0x301f7f)return null;let _0x2b9030=_0x482d19['dirname'](_0x301f7f);return _0x482d19[_0x3c42fd(0x12a)](_0x2b9030)==='node_modules'?_0x482d19[_0x3c42fd(0x144)](_0x2b9030):null;}function B(_0x24f00d){_0x5d47ff('node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22',{'cwd':_0x24f00d||process['cwd'](),'stdio':'pipe','env':{...process['env']}});}function k(_0x1f2a10){const _0x52fdcf=_0x36d94b;let _0x4cb2b8=N(_0x1f2a10);if(!_0x4cb2b8||!_0x46394f[_0x52fdcf(0x138)](_0x482d19[_0x52fdcf(0x126)](_0x4cb2b8,'package.json')))return console[_0x52fdcf(0xf9)](_0x52fdcf(0x130)),!0x1;console['log'](''),console[_0x52fdcf(0x136)]('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x52fdcf(0x136)]('[INFO]\x20自动尝试本地编译:\x20在「'+_0x4cb2b8+_0x52fdcf(0xfa)),console['log']('[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)'),console[_0x52fdcf(0x136)](_0x52fdcf(0x151));try{return _0x5d47ff('npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts',{'cwd':_0x4cb2b8,'stdio':_0x52fdcf(0x148),'env':{...process[_0x52fdcf(0x102)]}}),B(_0x4cb2b8),console[_0x52fdcf(0x136)]('[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载'),!0x0;}catch(_0x1b5404){let _0x3bb649=_0x1b5404&&typeof _0x1b5404=='object'?_0x1b5404:{},_0x5256ff=_0x3bb649['stderr']?String(_0x3bb649['stderr']):'',_0x19d756=_0x3bb649['stdout']?String(_0x3bb649[_0x52fdcf(0x11f)]):'',_0x1b904f=_0x5256ff||_0x19d756||(_0x1b5404&&_0x1b5404[_0x52fdcf(0x14b)]?String(_0x1b5404['message']):String(_0x1b5404));return console['warn'](_0x52fdcf(0x14c)+_0x1b904f['slice'](0x0,0x4b0)+(_0x1b904f[_0x52fdcf(0x113)]>0x4b0?_0x52fdcf(0x10d):'')),!0x1;}}async function M(){const _0x81554c=_0x36d94b;let _0x35e98c=E(),_0x5dcc6c=L+'/v'+C+'/'+_0x35e98c;console['log'](_0x81554c(0x11d)+_0x35e98c);let _0x279c6f=await v(_0x5dcc6c);console[_0x81554c(0x136)](_0x81554c(0xfd)+(_0x279c6f[_0x81554c(0x113)]/0x400)[_0x81554c(0xfb)](0x1)+_0x81554c(0x137));let _0x3bb4ad=h();if(!_0x3bb4ad)throw new Error('无法找到\x20better-sqlite3\x20模块路径');let _0x2d9e1d=_0x482d19['join'](_0x3bb4ad,'prebuilds',process['platform']+'-'+process['arch']);return _0x46394f[_0x81554c(0x13c)](_0x2d9e1d,{'recursive':!0x0}),await D(_0x279c6f,_0x2d9e1d),console[_0x81554c(0x136)]('[INFO]\x20预编译包已安装到:\x20'+_0x2d9e1d),!0x0;}async function W(){const _0x34d7d4=_0x36d94b;let _0x44517d=(await import('better-sqlite3'))['default'];return new _0x44517d(_0x34d7d4(0x135))['close'](),!0x0;}async function V(){const _0x49a893=_0x36d94b;try{let {DatabaseSync:_0x5c69b2}=await import('node:sqlite');return new _0x5c69b2(':memory:')[_0x49a893(0x161)](),!0x0;}catch{return!0x1;}}((async()=>{const _0xc2e8b8=_0x36d94b;try{let _0x88c9fd=_0x1f1ee8(import.meta.url),_0x5dc569=_0x482d19['dirname'](_0x88c9fd),_0x7407a0='unknown',_0x2a20bb='';try{let _0x150934=_0x482d19[_0xc2e8b8(0x126)](_0x5dc569,'package.json');if(_0x46394f['existsSync'](_0x150934)){let _0x428f6c=JSON['parse'](_0x46394f['readFileSync'](_0x150934,'utf8'));_0x7407a0=_0x428f6c[_0xc2e8b8(0x119)]||'unknown',_0x2a20bb=typeof _0x428f6c['acwInstallNote']==_0xc2e8b8(0x11e)?_0x428f6c[_0xc2e8b8(0x109)]:'';}}catch{}console['log'](_0xc2e8b8(0x11c)),console[_0xc2e8b8(0x136)]('v'+_0x7407a0+_0xc2e8b8(0x100)+process[_0xc2e8b8(0x119)]+'\x20(ABI\x20'+b()+')\x20|\x20'+process['platform']+'/'+process['arch']),_0x2a20bb&&console[_0xc2e8b8(0x136)](_0xc2e8b8(0x121)+_0x2a20bb),await V()&&(console['log']('[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。'),console[_0xc2e8b8(0x136)]('[提示]\x20当前\x20'+process['version']+'\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。'),x()||console[_0xc2e8b8(0x136)](_0xc2e8b8(0x105)),console[_0xc2e8b8(0x136)]('[OK]\x20安装完成'),process['exit'](0x0)),P();let _0x3f8de6=!0x1,_0x5f9ece=null,_0x2f61dd=[];try{await W(),console[_0xc2e8b8(0x136)](_0xc2e8b8(0x14f)),_0x3f8de6=!0x0;}catch(_0x1c6b94){_0x5f9ece=_0x1c6b94;let _0x50f24f=_0x1c6b94&&_0x1c6b94['message']?String(_0x1c6b94['message']):'',_0x255ef7=_0x50f24f['toLowerCase']();console['log'](_0xc2e8b8(0x12d)+_0x50f24f),_0x2f61dd[_0xc2e8b8(0x141)](_0xc2e8b8(0x159)+_0x50f24f['slice'](0x0,0x1f4)+(_0x50f24f['length']>0x1f4?_0xc2e8b8(0x10d):'')),(_0x50f24f[_0xc2e8b8(0x163)]('Cannot\x20find\x20package')||_0x50f24f[_0xc2e8b8(0x163)](_0xc2e8b8(0x128))||_0x50f24f[_0xc2e8b8(0x163)](_0xc2e8b8(0xfe)))&&_0x2f61dd['push'](_0xc2e8b8(0xf6));let _0x12a67a=_0x50f24f['includes']('NODE_MODULE_VERSION')||_0x50f24f[_0xc2e8b8(0x163)]('was\x20compiled\x20against')||/\.node\b/[_0xc2e8b8(0x147)](_0x50f24f)||_0x255ef7['includes'](_0xc2e8b8(0x13e))||_0x255ef7['includes'](_0xc2e8b8(0x15f))||_0x255ef7['includes'](_0xc2e8b8(0x11b))||_0x255ef7[_0xc2e8b8(0x163)]('invalid\x20ELF')||_0x255ef7[_0xc2e8b8(0x163)]('not\x20a\x20valid\x20win32'),_0x327a1e=h(),_0x248f90=N(_0x327a1e);if(_0x2f61dd[_0xc2e8b8(0x141)]('[环境]\x20Node='+process[_0xc2e8b8(0x119)]+',process.versions.modules='+process['versions']['modules']+_0xc2e8b8(0x10e)+b()+',平台='+process[_0xc2e8b8(0x120)]+'/'+process[_0xc2e8b8(0x12f)]),_0x2f61dd[_0xc2e8b8(0x141)](_0xc2e8b8(0x14d)+(_0x327a1e||_0xc2e8b8(0xf5))+',npm\x20包根='+(_0x248f90||'未解析')),!_0x12a67a)_0x2f61dd[_0xc2e8b8(0x141)]('[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。');else{let _0x3950fd=b();if(!$[_0xc2e8b8(0x163)](_0x3950fd))_0x2f61dd[_0xc2e8b8(0x141)]('[原因]\x20当前\x20ABI\x20'+_0x3950fd+'\x20不在\x20OSS\x20预编译列表\x20['+$[_0xc2e8b8(0x126)](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console['log'](_0xc2e8b8(0x150)+process[_0xc2e8b8(0x119)]+_0xc2e8b8(0x158)+_0x3950fd+')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译');else{_0x2f61dd[_0xc2e8b8(0x141)]('[步骤]\x20ABI\x20'+_0x3950fd+'\x20在预编译列表内,尝试\x20OSS:\x20'+E()),console[_0xc2e8b8(0x136)](_0xc2e8b8(0x165));try{await M(),console['log'](_0xc2e8b8(0x101));try{let _0x4fb6c5=N(h())||_0x248f90||process['cwd']();B(_0x4fb6c5),console[_0xc2e8b8(0x136)](_0xc2e8b8(0x124)),_0x3f8de6=!0x0,_0x2f61dd[_0xc2e8b8(0x141)](_0xc2e8b8(0x15d));}catch(_0x3c9971){_0x2f61dd[_0xc2e8b8(0x141)](_0xc2e8b8(0x116)+(_0x3c9971[_0xc2e8b8(0x14b)]||_0x3c9971)),console[_0xc2e8b8(0xf9)](_0xc2e8b8(0x154)+_0x3c9971[_0xc2e8b8(0x14b)]);}}catch(_0x1c030b){_0x2f61dd[_0xc2e8b8(0x141)](_0xc2e8b8(0x156)+(_0x1c030b[_0xc2e8b8(0x14b)]||_0x1c030b)),console[_0xc2e8b8(0xf9)](_0xc2e8b8(0x12c)+_0x1c030b[_0xc2e8b8(0x14b)]);}}!_0x3f8de6&&_0x327a1e?(_0x2f61dd[_0xc2e8b8(0x141)]('[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)'),k(_0x327a1e)?(_0x3f8de6=!0x0,_0x2f61dd[_0xc2e8b8(0x141)]('[步骤]\x20npm\x20rebuild:\x20成功')):_0x2f61dd['push']('[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)')):!_0x3f8de6&&!_0x327a1e&&_0x2f61dd[_0xc2e8b8(0x141)]('[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild');}}if(!_0x3f8de6){let _0x2fee86=_0x5f9ece?.[_0xc2e8b8(0x14b)]||'未知错误';if(y(),console['error'](''),console[_0xc2e8b8(0x13a)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['error'](_0xc2e8b8(0xf2)),console[_0xc2e8b8(0x13a)](_0xc2e8b8(0x117)),console[_0xc2e8b8(0x13a)](''),console['error']('──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────'),_0x2f61dd[_0xc2e8b8(0x10c)](_0x280939=>console['error'](_0x280939)),console['error']('────────────────────────────────────────────────────────────'),console['error'](''),console[_0xc2e8b8(0x13a)](_0xc2e8b8(0x133)+_0x2fee86),console['error'](''),console[_0xc2e8b8(0x13a)]('说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:'),console['error'](_0xc2e8b8(0x125)),console[_0xc2e8b8(0x13a)]('\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;'),console[_0xc2e8b8(0x13a)]('\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。'),console['error'](''),console[_0xc2e8b8(0x13a)]('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console[_0xc2e8b8(0x13a)](''),process['platform']===_0xc2e8b8(0x157)){let _0x290b3a=!0x1;try{_0x5d47ff('where\x20cl.exe',{'stdio':'pipe'}),_0x290b3a=!0x0;}catch{}console[_0xc2e8b8(0x13a)](_0x290b3a?_0xc2e8b8(0x10f)+_0x2fee86+'。优先请把运行\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重装。':_0xc2e8b8(0x10f)+_0x2fee86+'。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。');}else process[_0xc2e8b8(0x120)]===_0xc2e8b8(0x140)?console[_0xc2e8b8(0x13a)](_0xc2e8b8(0x10f)+_0x2fee86+_0xc2e8b8(0x134)):console[_0xc2e8b8(0x13a)](_0xc2e8b8(0x10f)+_0x2fee86+_0xc2e8b8(0x107));console[_0xc2e8b8(0x13a)](''),console[_0xc2e8b8(0x13a)](_0xc2e8b8(0x117)),process['exit'](0x1);}console[_0xc2e8b8(0x136)](_0xc2e8b8(0x15c)),console['log'](_0xc2e8b8(0x160));}catch(_0x12c163){y(),console['error'](_0xc2e8b8(0x155),_0x12c163[_0xc2e8b8(0x14b)]),process[_0xc2e8b8(0x127)](0x1);}})());
2
+ const _0x1113c5=_0x12fd;(function(_0x2775ff,_0xd55271){const _0x4f1ab3=_0x12fd,_0xa3ea4b=_0x2775ff();while(!![]){try{const _0x4069b9=parseInt(_0x4f1ab3(0xc8))/0x1*(parseInt(_0x4f1ab3(0xc2))/0x2)+-parseInt(_0x4f1ab3(0xba))/0x3*(-parseInt(_0x4f1ab3(0xfc))/0x4)+-parseInt(_0x4f1ab3(0xdb))/0x5*(parseInt(_0x4f1ab3(0xc7))/0x6)+-parseInt(_0x4f1ab3(0x9a))/0x7*(-parseInt(_0x4f1ab3(0xfe))/0x8)+-parseInt(_0x4f1ab3(0xcb))/0x9+parseInt(_0x4f1ab3(0xe1))/0xa*(-parseInt(_0x4f1ab3(0xb3))/0xb)+parseInt(_0x4f1ab3(0x94))/0xc;if(_0x4069b9===_0xd55271)break;else _0xa3ea4b['push'](_0xa3ea4b['shift']());}catch(_0x2fef7e){_0xa3ea4b['push'](_0xa3ea4b['shift']());}}}(_0x27c7,0x87493));import _0xed2996 from'fs';function _0x27c7(){const _0x27f48c=['[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','38kaMwlB','slice','[环境]\x20Node=','existsSync','ACW\x20Tools\x20MCP\x20安装后检查...','318PpaxDU','28524HRgRHf','[原因]\x20首次加载失败(动态\x20import):\x20','dirname','9901494tFHSPi','platform','https','forEach','push','[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...','npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts','parse','mkdirSync','[步骤]\x20ABI\x20','prebuilds','error','toLowerCase','better_sqlite3','destroy','length','88565CaErWS','better-sqlite3','\x20不在\x20OSS\x20预编译列表\x20[','[步骤]\x20OSS\x20下载或解压失败:\x20','modules','...','4958270fhvtUo','[ERROR]\x20postinstall\x20脚本执行出错:','trim','未找到','(ABI\x20v','join','versions','[原因]\x20当前\x20ABI\x20','headers','[INFO]\x20下载成功\x20(','131','[提示]\x20','log','[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:','then','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:','[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;','was\x20compiled\x20against','get','.tar.gz','\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。','[INFO]\x20当前\x20Node\x20','location','stderr','message','node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22','355212FDJQin','\x20在预编译列表内,尝试\x20OSS:\x20','56RqBOrf','catch','node_modules','package.json','[INFO]\x20预编译包已安装到:\x20','gunzipSync','warn','node:sqlite','utf8','24892200obOXOq','[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。','[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。','137','[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载','[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20','295001UdeKvm','[INFO]\x20better-sqlite3\x20原生加载失败:\x20','ERR_MODULE_NOT_FOUND','[INFO]\x20预编译包已安装,重新测试...','建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。','[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。','end','[OK]\x20安装完成','includes','[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','unshift','fromCharCode','[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);','[WARN]\x20npm\x20rebuild\x20未成功:\x20','writeFileSync','version',':memory:','toString','close','[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。','arch','dlopen','120','object','11eXjHGA','127','──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────','[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。','exit','无法找到\x20better-sqlite3\x20模块路径',',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。','6cbANmp','string','cwd','[环境]\x20better-sqlite3\x20路径=','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;'];_0x27c7=function(){return _0x27f48c;};return _0x27c7();}import _0x5c7a19 from'path';import{fileURLToPath as _0x562346}from'url';import{execSync as _0x4b4d64}from'child_process';import _0x1908e1 from'https';import _0xb32273 from'http';import _0xecf812 from'zlib';var C='12.4.1',L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:'108',0x13:'111',0x14:'115',0x15:_0x1113c5(0xb1),0x16:_0x1113c5(0xb4),0x17:'131',0x18:_0x1113c5(0x97),0x19:'137'},$=['115','127',_0x1113c5(0xeb),'137'],I=parseInt(process[_0x1113c5(0xaa)][_0x1113c5(0xc3)](0x1)['split']('.')[0x0],0xa),T=((()=>{const _0x3a4e1b=_0x1113c5;let _0x16005d=process[_0x3a4e1b(0xaa)][_0x3a4e1b(0xc3)](0x1)['split']('.');return parseInt(_0x16005d[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x1dab51=_0x1113c5;console['log'](''),console['log']('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x1dab51(0xed)]('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console['log']('[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。'),console['log'](_0x1dab51(0x95)),console['log']('[提示]\x20【你当前的情况】当前为\x20'+process['version']+_0x1dab51(0xb9)),console[_0x1dab51(0xed)](_0x1dab51(0xee)),console['log'](_0x1dab51(0xf2)),console['log'](_0x1dab51(0xa7)),console['log'](_0x1dab51(0xae)),console[_0x1dab51(0xed)](_0x1dab51(0xb6)),console[_0x1dab51(0xed)](_0x1dab51(0xbf)),console[_0x1dab51(0xed)]('');}function y(){const _0x42497a=_0x1113c5;console['error'](''),console['error']('──────────\x20给用户的说明(安装失败)──────────'),console['error'](_0x42497a(0xa4)),console[_0x42497a(0xd6)]('根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。'),console[_0x42497a(0xd6)](_0x42497a(0x9e)),console['error']('package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。'),console[_0x42497a(0xd6)]('────────────────────────────────────────────');}function b(){const _0x34927b=_0x1113c5;let _0x5b277b=parseInt(process[_0x34927b(0xaa)][_0x34927b(0xc3)](0x1)['split']('.')[0x0],0xa);return F[_0x5b277b]||process[_0x34927b(0xe7)]['modules'];}function E(){const _0x5926ab=_0x1113c5;let _0xc4c2f2=C,_0xedb28e=b(),_0xd5ef3d=process['platform'],_0x1e951=process['arch'];return'better-sqlite3-v'+_0xc4c2f2+'-node-v'+_0xedb28e+'-'+_0xd5ef3d+'-'+_0x1e951+_0x5926ab(0xf5);}function v(_0x4403ad){return new Promise((_0x480256,_0x5433de)=>{const _0x4b2bed=_0x12fd;let _0xba1b25=(_0x4403ad['startsWith'](_0x4b2bed(0xcd))?_0x1908e1:_0xb32273)[_0x4b2bed(0xf4)](_0x4403ad,{'timeout':0x7530},_0x2e63e1=>{const _0x4ead68=_0x4b2bed;if(_0x2e63e1['statusCode']===0x12d||_0x2e63e1['statusCode']===0x12e){v(_0x2e63e1[_0x4ead68(0xe9)][_0x4ead68(0xf8)])[_0x4ead68(0xef)](_0x480256)[_0x4ead68(0xff)](_0x5433de);return;}if(_0x2e63e1['statusCode']!==0xc8){_0x5433de(new Error('HTTP\x20'+_0x2e63e1['statusCode']));return;}let _0x5c7985=[];_0x2e63e1['on']('data',_0x468163=>_0x5c7985['push'](_0x468163)),_0x2e63e1['on'](_0x4ead68(0xa0),()=>_0x480256(Buffer['concat'](_0x5c7985))),_0x2e63e1['on']('error',_0x5433de);});_0xba1b25['on']('error',_0x5433de),_0xba1b25['on']('timeout',()=>{const _0x53bde1=_0x4b2bed;_0xba1b25[_0x53bde1(0xd9)](),_0x5433de(new Error('Request\x20timeout'));});});}async function D(_0x308d85,_0x1758c8){const _0x3bc632=_0x1113c5;let _0x45b6b5=_0xecf812[_0x3bc632(0x103)](_0x308d85),_0x347b18=0x200,_0x61ed94=0x0;for(;_0x61ed94<_0x45b6b5['length']-_0x347b18;){let _0xc65d44=_0x45b6b5[_0x3bc632(0xc3)](_0x61ed94,_0x61ed94+_0x347b18);if(_0xc65d44[0x0]===0x0)break;let _0x4f497a=_0xc65d44['slice'](0x0,0x64)[_0x3bc632(0xac)](_0x3bc632(0x106))['replace'](/\0/g,'')[_0x3bc632(0xe3)](),_0x35ca2d=_0xc65d44[_0x3bc632(0xc3)](0x7c,0x88)[_0x3bc632(0xac)]('utf8')['replace'](/\0/g,'')['trim'](),_0x2b9c4e=parseInt(_0x35ca2d,0x8)||0x0,_0x2b4c06=String[_0x3bc632(0xa6)](_0xc65d44[0x9c]);if(_0x61ed94+=_0x347b18,_0x4f497a&&_0x2b4c06==='0'||_0x2b4c06==='\x00'){let _0x139d3a=_0x45b6b5['slice'](_0x61ed94,_0x61ed94+_0x2b9c4e),_0x5719c8=_0x5c7a19['join'](_0x1758c8,_0x5c7a19['basename'](_0x4f497a));_0xed2996[_0x3bc632(0xd3)](_0x5c7a19['dirname'](_0x5719c8),{'recursive':!0x0}),_0xed2996[_0x3bc632(0xa9)](_0x5719c8,_0x139d3a);}_0x61ed94+=Math['ceil'](_0x2b9c4e/_0x347b18)*_0x347b18;}}function h(){const _0x23395d=_0x1113c5;let _0x246d4e=[_0x5c7a19[_0x23395d(0xe6)](process[_0x23395d(0xbc)](),'node_modules',_0x23395d(0xdc)),_0x5c7a19[_0x23395d(0xe6)](_0x562346(import.meta.url),'..',_0x23395d(0x100),'better-sqlite3')];try{let _0x549975=import.meta.resolve(_0x23395d(0xdc));if(_0x549975){let _0x10bb4a=_0x562346(_0x549975);_0x246d4e[_0x23395d(0xa5)](_0x5c7a19[_0x23395d(0xca)](_0x5c7a19[_0x23395d(0xca)](_0x10bb4a)));}}catch{}for(let _0x846a88 of _0x246d4e)if(_0xed2996['existsSync'](_0x5c7a19[_0x23395d(0xe6)](_0x846a88,_0x23395d(0x101))))return _0x846a88;return null;}function N(_0x3351fe){const _0x5ddc16=_0x1113c5;if(!_0x3351fe)return null;let _0x171add=_0x5c7a19[_0x5ddc16(0xca)](_0x3351fe);return _0x5c7a19['basename'](_0x171add)===_0x5ddc16(0x100)?_0x5c7a19[_0x5ddc16(0xca)](_0x171add):null;}function B(_0x75b088){const _0x314848=_0x1113c5;_0x4b4d64(_0x314848(0xfb),{'cwd':_0x75b088||process['cwd'](),'stdio':'pipe','env':{...process['env']}});}function k(_0xbdd095){const _0x20650e=_0x1113c5;let _0x31b7d3=N(_0xbdd095);if(!_0x31b7d3||!_0xed2996[_0x20650e(0xc5)](_0x5c7a19['join'](_0x31b7d3,'package.json')))return console['warn']('[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild'),!0x1;console[_0x20650e(0xed)](''),console[_0x20650e(0xed)]('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x20650e(0xed)]('[INFO]\x20自动尝试本地编译:\x20在「'+_0x31b7d3+'」执行\x20npm\x20rebuild\x20better-sqlite3'),console['log']('[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)'),console['log']('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');try{return _0x4b4d64(_0x20650e(0xd1),{'cwd':_0x31b7d3,'stdio':'inherit','env':{...process['env']}}),B(_0x31b7d3),console[_0x20650e(0xed)](_0x20650e(0x98)),!0x0;}catch(_0x1f482c){let _0x1e816e=_0x1f482c&&typeof _0x1f482c==_0x20650e(0xb2)?_0x1f482c:{},_0x87bf51=_0x1e816e[_0x20650e(0xf9)]?String(_0x1e816e[_0x20650e(0xf9)]):'',_0x3e28f6=_0x1e816e['stdout']?String(_0x1e816e['stdout']):'',_0x556849=_0x87bf51||_0x3e28f6||(_0x1f482c&&_0x1f482c['message']?String(_0x1f482c['message']):String(_0x1f482c));return console[_0x20650e(0x104)](_0x20650e(0xa8)+_0x556849[_0x20650e(0xc3)](0x0,0x4b0)+(_0x556849[_0x20650e(0xda)]>0x4b0?_0x20650e(0xe0):'')),!0x1;}}async function M(){const _0x3fe53d=_0x1113c5;let _0x424a3d=E(),_0x15f9e9=L+'/v'+C+'/'+_0x424a3d;console[_0x3fe53d(0xed)](_0x3fe53d(0x99)+_0x424a3d);let _0x26d23d=await v(_0x15f9e9);console['log'](_0x3fe53d(0xea)+(_0x26d23d['length']/0x400)['toFixed'](0x1)+'\x20KB)');let _0x17af39=h();if(!_0x17af39)throw new Error(_0x3fe53d(0xb8));let _0x557534=_0x5c7a19[_0x3fe53d(0xe6)](_0x17af39,_0x3fe53d(0xd5),process['platform']+'-'+process['arch']);return _0xed2996['mkdirSync'](_0x557534,{'recursive':!0x0}),await D(_0x26d23d,_0x557534),console['log'](_0x3fe53d(0x102)+_0x557534),!0x0;}function _0x12fd(_0x1b42e1,_0x2ca1b2){_0x1b42e1=_0x1b42e1-0x94;const _0x27c708=_0x27c7();let _0x12fd2d=_0x27c708[_0x1b42e1];return _0x12fd2d;}async function W(){const _0x3fc1eb=_0x1113c5;let _0x3541af=(await import('better-sqlite3'))['default'];return new _0x3541af(_0x3fc1eb(0xab))['close'](),!0x0;}async function V(){const _0x2a4a16=_0x1113c5;try{let {DatabaseSync:_0x35bfc5}=await import(_0x2a4a16(0x105));return new _0x35bfc5(':memory:')[_0x2a4a16(0xad)](),!0x0;}catch{return!0x1;}}((async()=>{const _0x31f008=_0x1113c5;try{let _0x2706d3=_0x562346(import.meta.url),_0x8a354c=_0x5c7a19['dirname'](_0x2706d3),_0x3a8214='unknown',_0x5ec75e='';try{let _0x20aea1=_0x5c7a19[_0x31f008(0xe6)](_0x8a354c,'package.json');if(_0xed2996[_0x31f008(0xc5)](_0x20aea1)){let _0x182d0d=JSON[_0x31f008(0xd2)](_0xed2996['readFileSync'](_0x20aea1,'utf8'));_0x3a8214=_0x182d0d[_0x31f008(0xaa)]||'unknown',_0x5ec75e=typeof _0x182d0d['acwInstallNote']==_0x31f008(0xbb)?_0x182d0d['acwInstallNote']:'';}}catch{}console['log'](_0x31f008(0xc6)),console[_0x31f008(0xed)]('v'+_0x3a8214+'\x20|\x20Node\x20'+process['version']+'\x20(ABI\x20'+b()+')\x20|\x20'+process[_0x31f008(0xcc)]+'/'+process[_0x31f008(0xaf)]),_0x5ec75e&&console['log'](_0x31f008(0xec)+_0x5ec75e),await V()&&(console[_0x31f008(0xed)](_0x31f008(0x96)),console[_0x31f008(0xed)]('[提示]\x20当前\x20'+process['version']+_0x31f008(0xf6)),x()||console['log']('[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。'),console['log']('[OK]\x20安装完成'),process[_0x31f008(0xb7)](0x0)),P();let _0x1918e5=!0x1,_0x3e68e9=null,_0x4ae1c6=[];try{await W(),console['log']('[OK]\x20better-sqlite3\x20加载成功'),_0x1918e5=!0x0;}catch(_0x5e899e){_0x3e68e9=_0x5e899e;let _0x12ec1c=_0x5e899e&&_0x5e899e['message']?String(_0x5e899e['message']):'',_0x950c85=_0x12ec1c[_0x31f008(0xd7)]();console['log'](_0x31f008(0x9b)+_0x12ec1c),_0x4ae1c6[_0x31f008(0xcf)](_0x31f008(0xc9)+_0x12ec1c[_0x31f008(0xc3)](0x0,0x1f4)+(_0x12ec1c[_0x31f008(0xda)]>0x1f4?'...':'')),(_0x12ec1c[_0x31f008(0xa2)]('Cannot\x20find\x20package')||_0x12ec1c[_0x31f008(0xa2)](_0x31f008(0x9c))||_0x12ec1c[_0x31f008(0xa2)]('MODULE_NOT_FOUND'))&&_0x4ae1c6['push']('[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。');let _0x1b7978=_0x12ec1c['includes']('NODE_MODULE_VERSION')||_0x12ec1c['includes'](_0x31f008(0xf3))||/\.node\b/['test'](_0x12ec1c)||_0x950c85[_0x31f008(0xa2)](_0x31f008(0xd8))||_0x950c85['includes']('better-sqlite3')||_0x950c85['includes'](_0x31f008(0xb0))||_0x950c85[_0x31f008(0xa2)]('invalid\x20ELF')||_0x950c85['includes']('not\x20a\x20valid\x20win32'),_0x3e64de=h(),_0x4f71e6=N(_0x3e64de);if(_0x4ae1c6['push'](_0x31f008(0xc4)+process[_0x31f008(0xaa)]+',process.versions.modules='+process['versions'][_0x31f008(0xdf)]+',映射\x20ABI='+b()+',平台='+process[_0x31f008(0xcc)]+'/'+process['arch']),_0x4ae1c6[_0x31f008(0xcf)](_0x31f008(0xbd)+(_0x3e64de||_0x31f008(0xe4))+',npm\x20包根='+(_0x4f71e6||'未解析')),!_0x1b7978)_0x4ae1c6['push'](_0x31f008(0x9f));else{let _0x1532b5=b();if(!$['includes'](_0x1532b5))_0x4ae1c6['push'](_0x31f008(0xe8)+_0x1532b5+_0x31f008(0xdd)+$[_0x31f008(0xe6)](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console[_0x31f008(0xed)](_0x31f008(0xf7)+process['version']+_0x31f008(0xe5)+_0x1532b5+')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译');else{_0x4ae1c6[_0x31f008(0xcf)](_0x31f008(0xd4)+_0x1532b5+_0x31f008(0xfd)+E()),console[_0x31f008(0xed)](_0x31f008(0xd0));try{await M(),console[_0x31f008(0xed)](_0x31f008(0x9d));try{let _0x11e77d=N(h())||_0x4f71e6||process['cwd']();B(_0x11e77d),console['log'](_0x31f008(0xc1)),_0x1918e5=!0x0,_0x4ae1c6['push']('[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功');}catch(_0x11f6b9){_0x4ae1c6[_0x31f008(0xcf)]('[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20'+(_0x11f6b9[_0x31f008(0xfa)]||_0x11f6b9)),console['warn']('[WARN]\x20预编译包安装后测试失败:\x20'+_0x11f6b9[_0x31f008(0xfa)]);}}catch(_0xfdefc5){_0x4ae1c6['push'](_0x31f008(0xde)+(_0xfdefc5['message']||_0xfdefc5)),console['warn']('[WARN]\x20OSS\x20预编译包下载或解压失败:\x20'+_0xfdefc5[_0x31f008(0xfa)]);}}!_0x1918e5&&_0x3e64de?(_0x4ae1c6[_0x31f008(0xcf)]('[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)'),k(_0x3e64de)?(_0x1918e5=!0x0,_0x4ae1c6[_0x31f008(0xcf)]('[步骤]\x20npm\x20rebuild:\x20成功')):_0x4ae1c6['push']('[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)')):!_0x1918e5&&!_0x3e64de&&_0x4ae1c6['push']('[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild');}}if(!_0x1918e5){let _0x5e1b4f=_0x3e68e9?.[_0x31f008(0xfa)]||'未知错误';if(y(),console['error'](''),console[_0x31f008(0xd6)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['error'](_0x31f008(0xa3)),console[_0x31f008(0xd6)](_0x31f008(0xbe)),console['error'](''),console[_0x31f008(0xd6)](_0x31f008(0xb5)),_0x4ae1c6[_0x31f008(0xce)](_0x5c8171=>console['error'](_0x5c8171)),console['error']('────────────────────────────────────────────────────────────'),console[_0x31f008(0xd6)](''),console['error']('首错原文:\x20'+_0x5e1b4f),console[_0x31f008(0xd6)](''),console[_0x31f008(0xd6)](_0x31f008(0xf1)),console[_0x31f008(0xd6)]('\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;'),console[_0x31f008(0xd6)](_0x31f008(0xc0)),console['error']('\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。'),console['error'](''),console[_0x31f008(0xd6)]('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console['error'](''),process['platform']==='win32'){let _0xfdeee2=!0x1;try{_0x4b4d64('where\x20cl.exe',{'stdio':'pipe'}),_0xfdeee2=!0x0;}catch{}console['error'](_0xfdeee2?'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x5e1b4f+'。优先请把运行\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重装。':_0x31f008(0xf0)+_0x5e1b4f+'。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。');}else process['platform']==='darwin'?console['error'](_0x31f008(0xf0)+_0x5e1b4f+'。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。'):console['error'](_0x31f008(0xf0)+_0x5e1b4f+'。优先将\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'](_0x31f008(0xbe)),process[_0x31f008(0xb7)](0x1);}console[_0x31f008(0xed)]('[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。'),console[_0x31f008(0xed)](_0x31f008(0xa1));}catch(_0x10139e){y(),console['error'](_0x31f008(0xe2),_0x10139e[_0x31f008(0xfa)]),process[_0x31f008(0xb7)](0x1);}})());