@bangdao-ai/acw-tools 1.13.13 → 1.13.14

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.13",
4
+ "version": "1.13.14",
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.13",
3
+ "version": "1.13.14",
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 _0x5a1853=_0x1832;(function(_0x41a837,_0x274bcf){const _0x5e2d31=_0x1832,_0x4b0da8=_0x41a837();while(!![]){try{const _0x4ba223=-parseInt(_0x5e2d31(0xc3))/0x1*(-parseInt(_0x5e2d31(0xe9))/0x2)+parseInt(_0x5e2d31(0xf3))/0x3+parseInt(_0x5e2d31(0xc0))/0x4+parseInt(_0x5e2d31(0xab))/0x5*(-parseInt(_0x5e2d31(0xfe))/0x6)+-parseInt(_0x5e2d31(0x9c))/0x7*(-parseInt(_0x5e2d31(0xb1))/0x8)+-parseInt(_0x5e2d31(0xaf))/0x9+-parseInt(_0x5e2d31(0xa4))/0xa;if(_0x4ba223===_0x274bcf)break;else _0x4b0da8['push'](_0x4b0da8['shift']());}catch(_0x1bd057){_0x4b0da8['push'](_0x4b0da8['shift']());}}}(_0x23e4,0x4abb0));import _0xf1518d from'fs';import _0x2a2608 from'path';function _0x1832(_0x3a8b2b,_0x51ad30){_0x3a8b2b=_0x3a8b2b-0x95;const _0x23e49f=_0x23e4();let _0x1832b1=_0x23e49f[_0x3a8b2b];return _0x1832b1;}import{fileURLToPath as _0x59e2ac}from'url';import{execSync as _0x5bf7c2}from'child_process';import _0x204467 from'https';import _0x107028 from'http';import _0x5969e4 from'zlib';var C=_0x5a1853(0xdd),L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:_0x5a1853(0xc9),0x13:'111',0x14:_0x5a1853(0xda),0x15:_0x5a1853(0xe8),0x16:'127',0x17:'131',0x18:_0x5a1853(0xd9),0x19:'137'},$=['115','127','131','137'],I=parseInt(process[_0x5a1853(0xce)]['slice'](0x1)[_0x5a1853(0xf2)]('.')[0x0],0xa),T=((()=>{const _0x432b29=_0x5a1853;let _0x3188ce=process[_0x432b29(0xce)][_0x432b29(0x9e)](0x1)[_0x432b29(0xf2)]('.');return parseInt(_0x3188ce[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x75a0f2=_0x5a1853;console[_0x75a0f2(0xf4)](''),console['log']('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['log'](_0x75a0f2(0xbe)),console[_0x75a0f2(0xf4)](_0x75a0f2(0xac)),console[_0x75a0f2(0xf4)]('[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。'),console['log']('[提示]\x20【你当前的情况】当前为\x20'+process[_0x75a0f2(0xce)]+_0x75a0f2(0xf0)),console[_0x75a0f2(0xf4)]('[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:'),console[_0x75a0f2(0xf4)](_0x75a0f2(0x9f)),console['log'](_0x75a0f2(0xe6)),console[_0x75a0f2(0xf4)](_0x75a0f2(0xf1)),console['log']('[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。'),console['log'](_0x75a0f2(0xd6)),console[_0x75a0f2(0xf4)]('');}function y(){const _0x2cbcc2=_0x5a1853;console['error'](''),console[_0x2cbcc2(0xa3)](_0x2cbcc2(0x102)),console[_0x2cbcc2(0xa3)](_0x2cbcc2(0xba)),console['error']('根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。'),console['error']('建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。'),console[_0x2cbcc2(0xa3)]('package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。'),console['error'](_0x2cbcc2(0x99));}function b(){const _0x35119c=_0x5a1853;let _0x3cf35d=parseInt(process[_0x35119c(0xce)]['slice'](0x1)['split']('.')[0x0],0xa);return F[_0x3cf35d]||process[_0x35119c(0xc6)]['modules'];}function E(){const _0xd78545=_0x5a1853;let _0x3b2f4d=C,_0x4c72d=b(),_0x38c13e=process[_0xd78545(0xcf)],_0x38a6ec=process[_0xd78545(0xa2)];return'better-sqlite3-v'+_0x3b2f4d+_0xd78545(0xc5)+_0x4c72d+'-'+_0x38c13e+'-'+_0x38a6ec+_0xd78545(0xfc);}function _0x23e4(){const _0x43abfb=['includes',',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。','[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。','split','421302nYoMsq','log','[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。','────────────────────────────────────────────────────────────','not\x20a\x20valid\x20win32','catch','dlopen','unshift','[步骤]\x20OSS\x20下载或解压失败:\x20','.tar.gz','join','7884DBEgUw',',process.versions.modules=','MODULE_NOT_FOUND','\x20KB)','──────────\x20给用户的说明(安装失败)──────────','inherit','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','[INFO]\x20下载成功\x20(','warn','Request\x20timeout','close','invalid\x20ELF','\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;','────────────────────────────────────────────','说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:','...','959flusTU','stdout','slice','[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;','push','],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。','arch','error','3959240peHwIN','ERR_MODULE_NOT_FOUND','better-sqlite3','无法找到\x20better-sqlite3\x20模块路径','首错原文:\x20','pipe','[INFO]\x20预编译包已安装,重新测试...','2315eKdlyh','[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。',':memory:','[WARN]\x20OSS\x20预编译包下载或解压失败:\x20','2921751fjIkuK','[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','20104KlQKpL','string','[WARN]\x20npm\x20rebuild\x20未成功:\x20','acwInstallNote','[INFO]\x20预编译包已安装到:\x20','get','utf8','[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)','stderr','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','toString','[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载','end','[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。','\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','2400388pMdQAI','node_modules','[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild','47fEFtAG','package.json','-node-v','versions','env','length','108','dirname','[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功','[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。','statusCode','version','platform','[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','message',',平台=','复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:','NODE_MODULE_VERSION','未知错误','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','test','\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。','137','115','unknown','\x20在预编译列表内,尝试\x20OSS:\x20','12.4.1','ACW\x20Tools\x20MCP\x20安装后检查...','[OK]\x20安装完成','cwd','。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild','[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。','object','node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22','[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);','existsSync','120','23414GDOMpW','trim','where\x20cl.exe','replace','better_sqlite3','\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;'];_0x23e4=function(){return _0x43abfb;};return _0x23e4();}function v(_0x3b99e2){return new Promise((_0x42340e,_0x396337)=>{const _0x5df938=_0x1832;let _0x101e5=(_0x3b99e2['startsWith']('https')?_0x204467:_0x107028)[_0x5df938(0xb6)](_0x3b99e2,{'timeout':0x7530},_0x3a3017=>{const _0x3a4180=_0x5df938;if(_0x3a3017['statusCode']===0x12d||_0x3a3017['statusCode']===0x12e){v(_0x3a3017['headers']['location'])['then'](_0x42340e)[_0x3a4180(0xf8)](_0x396337);return;}if(_0x3a3017[_0x3a4180(0xcd)]!==0xc8){_0x396337(new Error('HTTP\x20'+_0x3a3017[_0x3a4180(0xcd)]));return;}let _0x503686=[];_0x3a3017['on']('data',_0x35f452=>_0x503686['push'](_0x35f452)),_0x3a3017['on'](_0x3a4180(0xbd),()=>_0x42340e(Buffer['concat'](_0x503686))),_0x3a3017['on'](_0x3a4180(0xa3),_0x396337);});_0x101e5['on'](_0x5df938(0xa3),_0x396337),_0x101e5['on']('timeout',()=>{const _0x1cc780=_0x5df938;_0x101e5['destroy'](),_0x396337(new Error(_0x1cc780(0x95)));});});}async function D(_0x2acff5,_0x47d661){const _0x3e85cd=_0x5a1853;let _0x3b6b38=_0x5969e4['gunzipSync'](_0x2acff5),_0x1ba1a0=0x200,_0x11b496=0x0;for(;_0x11b496<_0x3b6b38[_0x3e85cd(0xc8)]-_0x1ba1a0;){let _0x1f1b30=_0x3b6b38['slice'](_0x11b496,_0x11b496+_0x1ba1a0);if(_0x1f1b30[0x0]===0x0)break;let _0x459b75=_0x1f1b30['slice'](0x0,0x64)['toString'](_0x3e85cd(0xb7))[_0x3e85cd(0xec)](/\0/g,'')['trim'](),_0x277a9e=_0x1f1b30['slice'](0x7c,0x88)[_0x3e85cd(0xbb)]('utf8')['replace'](/\0/g,'')[_0x3e85cd(0xea)](),_0x531189=parseInt(_0x277a9e,0x8)||0x0,_0x566c35=String['fromCharCode'](_0x1f1b30[0x9c]);if(_0x11b496+=_0x1ba1a0,_0x459b75&&_0x566c35==='0'||_0x566c35==='\x00'){let _0x5c3293=_0x3b6b38[_0x3e85cd(0x9e)](_0x11b496,_0x11b496+_0x531189),_0x1b0508=_0x2a2608[_0x3e85cd(0xfd)](_0x47d661,_0x2a2608['basename'](_0x459b75));_0xf1518d['mkdirSync'](_0x2a2608[_0x3e85cd(0xca)](_0x1b0508),{'recursive':!0x0}),_0xf1518d['writeFileSync'](_0x1b0508,_0x5c3293);}_0x11b496+=Math['ceil'](_0x531189/_0x1ba1a0)*_0x1ba1a0;}}function h(){const _0x500c7a=_0x5a1853;let _0xb041b2=[_0x2a2608['join'](process[_0x500c7a(0xe0)](),'node_modules',_0x500c7a(0xa6)),_0x2a2608['join'](_0x59e2ac(import.meta.url),'..',_0x500c7a(0xc1),_0x500c7a(0xa6))];try{let _0x1e6fa9=import.meta.resolve('better-sqlite3');if(_0x1e6fa9){let _0x25f510=_0x59e2ac(_0x1e6fa9);_0xb041b2[_0x500c7a(0xfa)](_0x2a2608['dirname'](_0x2a2608['dirname'](_0x25f510)));}}catch{}for(let _0x4a7184 of _0xb041b2)if(_0xf1518d[_0x500c7a(0xe7)](_0x2a2608['join'](_0x4a7184,_0x500c7a(0xc4))))return _0x4a7184;return null;}function N(_0x39bcde){const _0x124121=_0x5a1853;if(!_0x39bcde)return null;let _0x4d77f0=_0x2a2608[_0x124121(0xca)](_0x39bcde);return _0x2a2608['basename'](_0x4d77f0)==='node_modules'?_0x2a2608['dirname'](_0x4d77f0):null;}function B(_0x4a152f){const _0x40043f=_0x5a1853;_0x5bf7c2(_0x40043f(0xe5),{'cwd':_0x4a152f||process['cwd'](),'stdio':_0x40043f(0xa9),'env':{...process['env']}});}function k(_0x55a6ea){const _0x3c35e1=_0x5a1853;let _0x27a19a=N(_0x55a6ea);if(!_0x27a19a||!_0xf1518d[_0x3c35e1(0xe7)](_0x2a2608['join'](_0x27a19a,'package.json')))return console['warn'](_0x3c35e1(0xe2)),!0x1;console['log'](''),console['log']('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x3c35e1(0xf4)]('[INFO]\x20自动尝试本地编译:\x20在「'+_0x27a19a+'」执行\x20npm\x20rebuild\x20better-sqlite3'),console['log']('[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)'),console[_0x3c35e1(0xf4)](_0x3c35e1(0xd0));try{return _0x5bf7c2('npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts',{'cwd':_0x27a19a,'stdio':_0x3c35e1(0x103),'env':{...process[_0x3c35e1(0xc7)]}}),B(_0x27a19a),console[_0x3c35e1(0xf4)](_0x3c35e1(0xbc)),!0x0;}catch(_0xf748e4){let _0x407597=_0xf748e4&&typeof _0xf748e4==_0x3c35e1(0xe4)?_0xf748e4:{},_0x470a08=_0x407597[_0x3c35e1(0xb9)]?String(_0x407597['stderr']):'',_0x5d3aff=_0x407597[_0x3c35e1(0x9d)]?String(_0x407597['stdout']):'',_0x951c5c=_0x470a08||_0x5d3aff||(_0xf748e4&&_0xf748e4['message']?String(_0xf748e4['message']):String(_0xf748e4));return console['warn'](_0x3c35e1(0xb3)+_0x951c5c['slice'](0x0,0x4b0)+(_0x951c5c[_0x3c35e1(0xc8)]>0x4b0?_0x3c35e1(0x9b):'')),!0x1;}}async function M(){const _0x47e411=_0x5a1853;let _0x269323=E(),_0x2afe11=L+'/v'+C+'/'+_0x269323;console[_0x47e411(0xf4)]('[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20'+_0x269323);let _0x5d9f7f=await v(_0x2afe11);console[_0x47e411(0xf4)](_0x47e411(0x105)+(_0x5d9f7f[_0x47e411(0xc8)]/0x400)['toFixed'](0x1)+_0x47e411(0x101));let _0x1f4fd2=h();if(!_0x1f4fd2)throw new Error(_0x47e411(0xa7));let _0x269014=_0x2a2608['join'](_0x1f4fd2,'prebuilds',process[_0x47e411(0xcf)]+'-'+process['arch']);return _0xf1518d['mkdirSync'](_0x269014,{'recursive':!0x0}),await D(_0x5d9f7f,_0x269014),console['log'](_0x47e411(0xb5)+_0x269014),!0x0;}async function W(){const _0x2afd5b=_0x5a1853;let _0x14d2b3=(await import('better-sqlite3'))['default'];return new _0x14d2b3(':memory:')[_0x2afd5b(0x96)](),!0x0;}async function V(){const _0x452e99=_0x5a1853;try{let {DatabaseSync:_0x345bac}=await import('node:sqlite');return new _0x345bac(_0x452e99(0xad))['close'](),!0x0;}catch{return!0x1;}}((async()=>{const _0xea782f=_0x5a1853;try{let _0x41346e=_0x59e2ac(import.meta.url),_0x5b4213=_0x2a2608['dirname'](_0x41346e),_0x19bf64=_0xea782f(0xdb),_0x33acaf='';try{let _0x5bc784=_0x2a2608[_0xea782f(0xfd)](_0x5b4213,'package.json');if(_0xf1518d['existsSync'](_0x5bc784)){let _0x23af63=JSON['parse'](_0xf1518d['readFileSync'](_0x5bc784,'utf8'));_0x19bf64=_0x23af63[_0xea782f(0xce)]||'unknown',_0x33acaf=typeof _0x23af63[_0xea782f(0xb4)]==_0xea782f(0xb2)?_0x23af63[_0xea782f(0xb4)]:'';}}catch{}console[_0xea782f(0xf4)](_0xea782f(0xde)),console[_0xea782f(0xf4)]('v'+_0x19bf64+'\x20|\x20Node\x20'+process[_0xea782f(0xce)]+'\x20(ABI\x20'+b()+')\x20|\x20'+process['platform']+'/'+process['arch']),_0x33acaf&&console['log']('[提示]\x20'+_0x33acaf),await V()&&(console['log'](_0xea782f(0xe3)),console[_0xea782f(0xf4)]('[提示]\x20当前\x20'+process[_0xea782f(0xce)]+_0xea782f(0xd8)),x()||console[_0xea782f(0xf4)](_0xea782f(0xcc)),console['log'](_0xea782f(0xdf)),process['exit'](0x0)),P();let _0x5b4156=!0x1,_0x23f187=null,_0x4ed89d=[];try{await W(),console[_0xea782f(0xf4)]('[OK]\x20better-sqlite3\x20加载成功'),_0x5b4156=!0x0;}catch(_0x1391f2){_0x23f187=_0x1391f2;let _0x230c7d=_0x1391f2&&_0x1391f2['message']?String(_0x1391f2[_0xea782f(0xd1)]):'',_0x403bd6=_0x230c7d['toLowerCase']();console[_0xea782f(0xf4)]('[INFO]\x20better-sqlite3\x20原生加载失败:\x20'+_0x230c7d),_0x4ed89d['push']('[原因]\x20首次加载失败(动态\x20import):\x20'+_0x230c7d['slice'](0x0,0x1f4)+(_0x230c7d['length']>0x1f4?_0xea782f(0x9b):'')),(_0x230c7d[_0xea782f(0xef)]('Cannot\x20find\x20package')||_0x230c7d['includes'](_0xea782f(0xa5))||_0x230c7d[_0xea782f(0xef)](_0xea782f(0x100)))&&_0x4ed89d['push']('[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。');let _0x172e98=_0x230c7d['includes'](_0xea782f(0xd4))||_0x230c7d['includes']('was\x20compiled\x20against')||/\.node\b/[_0xea782f(0xd7)](_0x230c7d)||_0x403bd6['includes'](_0xea782f(0xed))||_0x403bd6['includes'](_0xea782f(0xa6))||_0x403bd6['includes'](_0xea782f(0xf9))||_0x403bd6['includes'](_0xea782f(0x97))||_0x403bd6[_0xea782f(0xef)](_0xea782f(0xf7)),_0x8fdea2=h(),_0x17cf9d=N(_0x8fdea2);if(_0x4ed89d[_0xea782f(0xa0)]('[环境]\x20Node='+process[_0xea782f(0xce)]+_0xea782f(0xff)+process['versions']['modules']+',映射\x20ABI='+b()+_0xea782f(0xd2)+process['platform']+'/'+process['arch']),_0x4ed89d[_0xea782f(0xa0)]('[环境]\x20better-sqlite3\x20路径='+(_0x8fdea2||'未找到')+',npm\x20包根='+(_0x17cf9d||'未解析')),!_0x172e98)_0x4ed89d['push']('[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。');else{let _0x536bcf=b();if(!$['includes'](_0x536bcf))_0x4ed89d['push']('[原因]\x20当前\x20ABI\x20'+_0x536bcf+'\x20不在\x20OSS\x20预编译列表\x20['+$['join'](',\x20')+_0xea782f(0xa1)),console['log']('[INFO]\x20当前\x20Node\x20'+process[_0xea782f(0xce)]+'(ABI\x20v'+_0x536bcf+')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译');else{_0x4ed89d['push']('[步骤]\x20ABI\x20'+_0x536bcf+_0xea782f(0xdc)+E()),console['log']('[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...');try{await M(),console[_0xea782f(0xf4)](_0xea782f(0xaa));try{let _0x36df95=N(h())||_0x17cf9d||process['cwd']();B(_0x36df95),console[_0xea782f(0xf4)](_0xea782f(0xb0)),_0x5b4156=!0x0,_0x4ed89d['push'](_0xea782f(0xcb));}catch(_0x15d3e8){_0x4ed89d['push']('[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20'+(_0x15d3e8['message']||_0x15d3e8)),console[_0xea782f(0x106)]('[WARN]\x20预编译包安装后测试失败:\x20'+_0x15d3e8[_0xea782f(0xd1)]);}}catch(_0x26e7c3){_0x4ed89d[_0xea782f(0xa0)](_0xea782f(0xfb)+(_0x26e7c3['message']||_0x26e7c3)),console[_0xea782f(0x106)](_0xea782f(0xae)+_0x26e7c3[_0xea782f(0xd1)]);}}!_0x5b4156&&_0x8fdea2?(_0x4ed89d[_0xea782f(0xa0)](_0xea782f(0xb8)),k(_0x8fdea2)?(_0x5b4156=!0x0,_0x4ed89d['push']('[步骤]\x20npm\x20rebuild:\x20成功')):_0x4ed89d[_0xea782f(0xa0)]('[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)')):!_0x5b4156&&!_0x8fdea2&&_0x4ed89d[_0xea782f(0xa0)](_0xea782f(0xc2));}}if(!_0x5b4156){let _0x1acf4a=_0x23f187?.[_0xea782f(0xd1)]||_0xea782f(0xd5);if(y(),console['error'](''),console[_0xea782f(0xa3)](_0xea782f(0x104)),console[_0xea782f(0xa3)]('[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止'),console[_0xea782f(0xa3)](_0xea782f(0x104)),console[_0xea782f(0xa3)](''),console['error']('──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────'),_0x4ed89d['forEach'](_0x12e9ee=>console['error'](_0x12e9ee)),console['error'](_0xea782f(0xf6)),console[_0xea782f(0xa3)](''),console['error'](_0xea782f(0xa8)+_0x1acf4a),console['error'](''),console[_0xea782f(0xa3)](_0xea782f(0x9a)),console[_0xea782f(0xa3)](_0xea782f(0xee)),console[_0xea782f(0xa3)](_0xea782f(0x98)),console['error'](_0xea782f(0xbf)),console[_0xea782f(0xa3)](''),console['error'](_0xea782f(0xd3)),console[_0xea782f(0xa3)](''),process['platform']==='win32'){let _0x576cce=!0x1;try{_0x5bf7c2(_0xea782f(0xeb),{'stdio':'pipe'}),_0x576cce=!0x0;}catch{}console['error'](_0x576cce?'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x1acf4a+'。优先请把运行\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原生模块),错误:'+_0x1acf4a+_0xea782f(0xe1));}else process['platform']==='darwin'?console['error']('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x1acf4a+'。优先将\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原生模块),错误:'+_0x1acf4a+'。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。');console['error'](''),console[_0xea782f(0xa3)](_0xea782f(0x104)),process['exit'](0x1);}console['log'](_0xea782f(0xf5)),console['log'](_0xea782f(0xdf));}catch(_0x49f38b){y(),console[_0xea782f(0xa3)]('[ERROR]\x20postinstall\x20脚本执行出错:',_0x49f38b['message']),process['exit'](0x1);}})());
2
+ const _0x29856c=_0x5a2b;(function(_0x167156,_0x4172a0){const _0x29bd9e=_0x5a2b,_0x384795=_0x167156();while(!![]){try{const _0x365e5d=parseInt(_0x29bd9e(0x16f))/0x1*(-parseInt(_0x29bd9e(0x167))/0x2)+-parseInt(_0x29bd9e(0x185))/0x3*(parseInt(_0x29bd9e(0x157))/0x4)+parseInt(_0x29bd9e(0x171))/0x5+parseInt(_0x29bd9e(0x1a9))/0x6+parseInt(_0x29bd9e(0x168))/0x7*(-parseInt(_0x29bd9e(0x182))/0x8)+parseInt(_0x29bd9e(0x177))/0x9+parseInt(_0x29bd9e(0x1b4))/0xa;if(_0x365e5d===_0x4172a0)break;else _0x384795['push'](_0x384795['shift']());}catch(_0x28e2ef){_0x384795['push'](_0x384795['shift']());}}}(_0x568b,0x981ab));import _0x1f3a31 from'fs';import _0x2b3ccf from'path';import{fileURLToPath as _0x4e2779}from'url';import{execSync as _0x404eb0}from'child_process';import _0x237d4d from'https';import _0x1d7fe5 from'http';import _0x194670 from'zlib';var C=_0x29856c(0x193),L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:_0x29856c(0x1bc),0x13:'111',0x14:_0x29856c(0x186),0x15:_0x29856c(0x1b5),0x16:_0x29856c(0x198),0x17:'131',0x18:'137',0x19:'137'},$=['115','127','131','137'],I=parseInt(process[_0x29856c(0x194)][_0x29856c(0x1b9)](0x1)['split']('.')[0x0],0xa),T=((()=>{const _0x45546f=_0x29856c;let _0x1cd55e=process['version'][_0x45546f(0x1b9)](0x1)['split']('.');return parseInt(_0x1cd55e[0x1]||'0',0xa);})());function _0x5a2b(_0x3f0ac7,_0x141bcf){_0x3f0ac7=_0x3f0ac7-0x14d;const _0x568be9=_0x568b();let _0x5a2b94=_0x568be9[_0x3f0ac7];return _0x5a2b94;}function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x5910b4=_0x29856c;console[_0x5910b4(0x1c4)](''),console[_0x5910b4(0x1c4)](_0x5910b4(0x153)),console['log'](_0x5910b4(0x1a8)),console[_0x5910b4(0x1c4)](_0x5910b4(0x15e)),console[_0x5910b4(0x1c4)]('[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。'),console[_0x5910b4(0x1c4)]('[提示]\x20【你当前的情况】当前为\x20'+process['version']+',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。'),console[_0x5910b4(0x1c4)](_0x5910b4(0x1a3)),console['log'](_0x5910b4(0x184)),console[_0x5910b4(0x1c4)]('[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);'),console[_0x5910b4(0x1c4)]('[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。'),console['log']('[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。'),console['log'](_0x5910b4(0x153)),console[_0x5910b4(0x1c4)]('');}function y(){const _0x883b35=_0x29856c;console['error'](''),console[_0x883b35(0x18f)]('──────────\x20给用户的说明(安装失败)──────────'),console['error'](_0x883b35(0x18e)),console[_0x883b35(0x18f)](_0x883b35(0x179)),console[_0x883b35(0x18f)]('建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。'),console[_0x883b35(0x18f)](_0x883b35(0x196)),console[_0x883b35(0x18f)](_0x883b35(0x16e));}function b(){const _0x5a8df0=_0x29856c;let _0x30b463=parseInt(process['version'][_0x5a8df0(0x1b9)](0x1)[_0x5a8df0(0x1a7)]('.')[0x0],0xa);return F[_0x30b463]||process[_0x5a8df0(0x1b7)][_0x5a8df0(0x1bb)];}function E(){const _0xc0c2e2=_0x29856c;let _0x4eb2aa=C,_0x3dfcd5=b(),_0x275d26=process[_0xc0c2e2(0x14f)],_0x4bc468=process['arch'];return'better-sqlite3-v'+_0x4eb2aa+'-node-v'+_0x3dfcd5+'-'+_0x275d26+'-'+_0x4bc468+'.tar.gz';}function _0x568b(){const _0x4a203c=['5442708CcLYfy','。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。','unknown','[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild','\x20KB)','[WARN]\x20OSS\x20预编译包下载或解压失败:\x20','[INFO]\x20预编译包已安装,重新测试...','exit','toString','toFixed','better_sqlite3','5176740TDBUbh','120','MODULE_NOT_FOUND','versions','[ERROR]\x20postinstall\x20脚本执行出错:','slice','\x20在预编译列表内,尝试\x20OSS:\x20','modules','108','[环境]\x20better-sqlite3\x20路径=','。优先请把运行\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重装。','Cannot\x20find\x20package','NODE_MODULE_VERSION','existsSync',':memory:','...','log','node_modules',')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译','catch','[INFO]\x20预编译包已安装到:\x20','headers','[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。','arch','首错原文:\x20','platform','prebuilds','push','\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','stderr','includes','[OK]\x20better-sqlite3\x20加载成功','20tnQdAg','where\x20cl.exe',',平台=','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','toLowerCase','writeFileSync','basename','[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。','说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:','[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止','length','darwin','not\x20a\x20valid\x20win32','statusCode','[步骤]\x20ABI\x20','readFileSync','8UqGNBp','3804647KDvzZc','[步骤]\x20npm\x20rebuild:\x20成功','utf8','forEach','string','[INFO]\x20下载成功\x20(','────────────────────────────────────────────','30856NHeEDx','warn','2201670cpjnOB','未知错误','mkdirSync','[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功','。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。','startsWith','1797687FZlMwq','未找到','根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。','pipe','message','ERR_MODULE_NOT_FOUND','[步骤]\x20OSS\x20下载或解压失败:\x20','[提示]\x20','[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)','[OK]\x20安装完成','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','8ewjHIb','better-sqlite3','[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;','464943bhuuPb','115','object','env','trim','\x20|\x20Node\x20','[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。','[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)','unshift','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','error',',npm\x20包根=','[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。','12.4.1','version','close','package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。','cwd','127','package.json','get','[INFO]\x20当前\x20Node\x20','[环境]\x20Node=','[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20','[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载','。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','dirname','acwInstallNote','join','[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:','\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;','fromCharCode','无法找到\x20better-sqlite3\x20模块路径','split','[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'];_0x568b=function(){return _0x4a203c;};return _0x568b();}function v(_0x27aaea){return new Promise((_0x16a908,_0x1e41f2)=>{const _0x55ecc2=_0x5a2b;let _0x437a5d=(_0x27aaea[_0x55ecc2(0x176)]('https')?_0x237d4d:_0x1d7fe5)[_0x55ecc2(0x19a)](_0x27aaea,{'timeout':0x7530},_0x145abe=>{const _0x1d2b8e=_0x55ecc2;if(_0x145abe['statusCode']===0x12d||_0x145abe[_0x1d2b8e(0x164)]===0x12e){v(_0x145abe[_0x1d2b8e(0x1c9)]['location'])['then'](_0x16a908)[_0x1d2b8e(0x1c7)](_0x1e41f2);return;}if(_0x145abe['statusCode']!==0xc8){_0x1e41f2(new Error('HTTP\x20'+_0x145abe['statusCode']));return;}let _0x592f20=[];_0x145abe['on']('data',_0x2c40b5=>_0x592f20[_0x1d2b8e(0x151)](_0x2c40b5)),_0x145abe['on']('end',()=>_0x16a908(Buffer['concat'](_0x592f20))),_0x145abe['on'](_0x1d2b8e(0x18f),_0x1e41f2);});_0x437a5d['on']('error',_0x1e41f2),_0x437a5d['on']('timeout',()=>{_0x437a5d['destroy'](),_0x1e41f2(new Error('Request\x20timeout'));});});}async function D(_0x4891ef,_0x1c2fce){const _0x17b27f=_0x29856c;let _0x9f615e=_0x194670['gunzipSync'](_0x4891ef),_0x2d4cea=0x200,_0x377826=0x0;for(;_0x377826<_0x9f615e[_0x17b27f(0x161)]-_0x2d4cea;){let _0x3739c3=_0x9f615e['slice'](_0x377826,_0x377826+_0x2d4cea);if(_0x3739c3[0x0]===0x0)break;let _0x2354f0=_0x3739c3[_0x17b27f(0x1b9)](0x0,0x64)['toString']('utf8')['replace'](/\0/g,'')[_0x17b27f(0x189)](),_0x3d89bb=_0x3739c3['slice'](0x7c,0x88)[_0x17b27f(0x1b1)](_0x17b27f(0x16a))['replace'](/\0/g,'')['trim'](),_0x4a5202=parseInt(_0x3d89bb,0x8)||0x0,_0x4ec848=String[_0x17b27f(0x1a5)](_0x3739c3[0x9c]);if(_0x377826+=_0x2d4cea,_0x2354f0&&_0x4ec848==='0'||_0x4ec848==='\x00'){let _0x22b477=_0x9f615e['slice'](_0x377826,_0x377826+_0x4a5202),_0x2255ad=_0x2b3ccf[_0x17b27f(0x1a2)](_0x1c2fce,_0x2b3ccf[_0x17b27f(0x15d)](_0x2354f0));_0x1f3a31['mkdirSync'](_0x2b3ccf[_0x17b27f(0x1a0)](_0x2255ad),{'recursive':!0x0}),_0x1f3a31[_0x17b27f(0x15c)](_0x2255ad,_0x22b477);}_0x377826+=Math['ceil'](_0x4a5202/_0x2d4cea)*_0x2d4cea;}}function h(){const _0x464dca=_0x29856c;let _0x134b73=[_0x2b3ccf[_0x464dca(0x1a2)](process[_0x464dca(0x197)](),_0x464dca(0x1c5),'better-sqlite3'),_0x2b3ccf[_0x464dca(0x1a2)](_0x4e2779(import.meta.url),'..',_0x464dca(0x1c5),_0x464dca(0x183))];try{let _0x30b28b=import.meta.resolve(_0x464dca(0x183));if(_0x30b28b){let _0x58eae6=_0x4e2779(_0x30b28b);_0x134b73[_0x464dca(0x18d)](_0x2b3ccf['dirname'](_0x2b3ccf['dirname'](_0x58eae6)));}}catch{}for(let _0x63c492 of _0x134b73)if(_0x1f3a31[_0x464dca(0x1c1)](_0x2b3ccf['join'](_0x63c492,'package.json')))return _0x63c492;return null;}function N(_0x33847b){const _0x1b69b2=_0x29856c;if(!_0x33847b)return null;let _0x4d347c=_0x2b3ccf[_0x1b69b2(0x1a0)](_0x33847b);return _0x2b3ccf[_0x1b69b2(0x15d)](_0x4d347c)==='node_modules'?_0x2b3ccf[_0x1b69b2(0x1a0)](_0x4d347c):null;}function B(_0x52f4ee){const _0x3612d7=_0x29856c;_0x404eb0('node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22',{'cwd':_0x52f4ee||process['cwd'](),'stdio':_0x3612d7(0x17a),'env':{...process[_0x3612d7(0x188)]}});}function k(_0x168ee6){const _0x1e61b8=_0x29856c;let _0x54a877=N(_0x168ee6);if(!_0x54a877||!_0x1f3a31['existsSync'](_0x2b3ccf['join'](_0x54a877,_0x1e61b8(0x199))))return console['warn']('[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild'),!0x1;console['log'](''),console['log'](_0x1e61b8(0x191)),console['log']('[INFO]\x20自动尝试本地编译:\x20在「'+_0x54a877+'」执行\x20npm\x20rebuild\x20better-sqlite3'),console['log']('[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)'),console[_0x1e61b8(0x1c4)]('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');try{return _0x404eb0('npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts',{'cwd':_0x54a877,'stdio':'inherit','env':{...process['env']}}),B(_0x54a877),console[_0x1e61b8(0x1c4)](_0x1e61b8(0x19e)),!0x0;}catch(_0x1afdb4){let _0x1bbfce=_0x1afdb4&&typeof _0x1afdb4==_0x1e61b8(0x187)?_0x1afdb4:{},_0x563918=_0x1bbfce['stderr']?String(_0x1bbfce[_0x1e61b8(0x154)]):'',_0x265bba=_0x1bbfce['stdout']?String(_0x1bbfce['stdout']):'',_0x29d407=_0x563918||_0x265bba||(_0x1afdb4&&_0x1afdb4[_0x1e61b8(0x17b)]?String(_0x1afdb4['message']):String(_0x1afdb4));return console['warn']('[WARN]\x20npm\x20rebuild\x20未成功:\x20'+_0x29d407['slice'](0x0,0x4b0)+(_0x29d407['length']>0x4b0?'...':'')),!0x1;}}async function M(){const _0x2da765=_0x29856c;let _0x30faf1=E(),_0x1d629d=L+'/v'+C+'/'+_0x30faf1;console[_0x2da765(0x1c4)]('[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20'+_0x30faf1);let _0x367c0c=await v(_0x1d629d);console[_0x2da765(0x1c4)](_0x2da765(0x16d)+(_0x367c0c[_0x2da765(0x161)]/0x400)[_0x2da765(0x1b2)](0x1)+_0x2da765(0x1ad));let _0x4dbf7c=h();if(!_0x4dbf7c)throw new Error(_0x2da765(0x1a6));let _0x3d58d=_0x2b3ccf['join'](_0x4dbf7c,_0x2da765(0x150),process[_0x2da765(0x14f)]+'-'+process['arch']);return _0x1f3a31[_0x2da765(0x173)](_0x3d58d,{'recursive':!0x0}),await D(_0x367c0c,_0x3d58d),console[_0x2da765(0x1c4)](_0x2da765(0x1c8)+_0x3d58d),!0x0;}async function W(){const _0x28d514=_0x29856c;let _0x4d7a2d=(await import('better-sqlite3'))['default'];return new _0x4d7a2d(':memory:')[_0x28d514(0x195)](),!0x0;}async function V(){const _0x1c020e=_0x29856c;try{let {DatabaseSync:_0x21c356}=await import('node:sqlite');return new _0x21c356(_0x1c020e(0x1c2))[_0x1c020e(0x195)](),!0x0;}catch{return!0x1;}}((async()=>{const _0x559076=_0x29856c;try{let _0x514a86=_0x4e2779(import.meta.url),_0x356bc1=_0x2b3ccf[_0x559076(0x1a0)](_0x514a86),_0x4cdfca=_0x559076(0x1ab),_0x1b7499='';try{let _0x175b6d=_0x2b3ccf['join'](_0x356bc1,'package.json');if(_0x1f3a31['existsSync'](_0x175b6d)){let _0xe1b7cc=JSON['parse'](_0x1f3a31[_0x559076(0x166)](_0x175b6d,'utf8'));_0x4cdfca=_0xe1b7cc['version']||'unknown',_0x1b7499=typeof _0xe1b7cc[_0x559076(0x1a1)]==_0x559076(0x16c)?_0xe1b7cc[_0x559076(0x1a1)]:'';}}catch{}console[_0x559076(0x1c4)]('ACW\x20Tools\x20MCP\x20安装后检查...'),console[_0x559076(0x1c4)]('v'+_0x4cdfca+_0x559076(0x18a)+process[_0x559076(0x194)]+'\x20(ABI\x20'+b()+')\x20|\x20'+process[_0x559076(0x14f)]+'/'+process[_0x559076(0x14d)]),_0x1b7499&&console['log'](_0x559076(0x17e)+_0x1b7499),await V()&&(console[_0x559076(0x1c4)](_0x559076(0x192)),console[_0x559076(0x1c4)]('[提示]\x20当前\x20'+process[_0x559076(0x194)]+'\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。'),x()||console['log'](_0x559076(0x18b)),console['log'](_0x559076(0x180)),process['exit'](0x0)),P();let _0x4d1645=!0x1,_0x501623=null,_0x121288=[];try{await W(),console[_0x559076(0x1c4)](_0x559076(0x156)),_0x4d1645=!0x0;}catch(_0x4be321){_0x501623=_0x4be321;let _0x1c9d9e=_0x4be321&&_0x4be321[_0x559076(0x17b)]?String(_0x4be321[_0x559076(0x17b)]):'',_0x4fd38d=_0x1c9d9e[_0x559076(0x15b)]();console[_0x559076(0x1c4)]('[INFO]\x20better-sqlite3\x20原生加载失败:\x20'+_0x1c9d9e),_0x121288[_0x559076(0x151)]('[原因]\x20首次加载失败(动态\x20import):\x20'+_0x1c9d9e['slice'](0x0,0x1f4)+(_0x1c9d9e[_0x559076(0x161)]>0x1f4?_0x559076(0x1c3):'')),(_0x1c9d9e[_0x559076(0x155)](_0x559076(0x1bf))||_0x1c9d9e['includes'](_0x559076(0x17c))||_0x1c9d9e['includes'](_0x559076(0x1b6)))&&_0x121288['push']('[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。');let _0x43b0b=_0x1c9d9e['includes'](_0x559076(0x1c0))||_0x1c9d9e[_0x559076(0x155)]('was\x20compiled\x20against')||/\.node\b/['test'](_0x1c9d9e)||_0x4fd38d['includes'](_0x559076(0x1b3))||_0x4fd38d['includes'](_0x559076(0x183))||_0x4fd38d['includes']('dlopen')||_0x4fd38d[_0x559076(0x155)]('invalid\x20ELF')||_0x4fd38d['includes'](_0x559076(0x163)),_0x122e4e=h(),_0x5d7346=N(_0x122e4e);if(_0x121288[_0x559076(0x151)](_0x559076(0x19c)+process[_0x559076(0x194)]+',process.versions.modules='+process[_0x559076(0x1b7)]['modules']+',映射\x20ABI='+b()+_0x559076(0x159)+process['platform']+'/'+process[_0x559076(0x14d)]),_0x121288[_0x559076(0x151)](_0x559076(0x1bd)+(_0x122e4e||_0x559076(0x178))+_0x559076(0x190)+(_0x5d7346||'未解析')),!_0x43b0b)_0x121288['push'](_0x559076(0x1ca));else{let _0x4997d1=b();if(!$['includes'](_0x4997d1))_0x121288['push']('[原因]\x20当前\x20ABI\x20'+_0x4997d1+'\x20不在\x20OSS\x20预编译列表\x20['+$[_0x559076(0x1a2)](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console[_0x559076(0x1c4)](_0x559076(0x19b)+process['version']+'(ABI\x20v'+_0x4997d1+_0x559076(0x1c6));else{_0x121288['push'](_0x559076(0x165)+_0x4997d1+_0x559076(0x1ba)+E()),console['log']('[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...');try{await M(),console['log'](_0x559076(0x1af));try{let _0x4c9844=N(h())||_0x5d7346||process[_0x559076(0x197)]();B(_0x4c9844),console[_0x559076(0x1c4)]('[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)'),_0x4d1645=!0x0,_0x121288[_0x559076(0x151)](_0x559076(0x174));}catch(_0xd8060d){_0x121288[_0x559076(0x151)](_0x559076(0x19d)+(_0xd8060d['message']||_0xd8060d)),console[_0x559076(0x170)]('[WARN]\x20预编译包安装后测试失败:\x20'+_0xd8060d['message']);}}catch(_0x1c3f6b){_0x121288['push'](_0x559076(0x17d)+(_0x1c3f6b[_0x559076(0x17b)]||_0x1c3f6b)),console[_0x559076(0x170)](_0x559076(0x1ae)+_0x1c3f6b['message']);}}!_0x4d1645&&_0x122e4e?(_0x121288['push'](_0x559076(0x18c)),k(_0x122e4e)?(_0x4d1645=!0x0,_0x121288['push'](_0x559076(0x169))):_0x121288[_0x559076(0x151)](_0x559076(0x17f))):!_0x4d1645&&!_0x122e4e&&_0x121288['push'](_0x559076(0x1ac));}}if(!_0x4d1645){let _0x146039=_0x501623?.[_0x559076(0x17b)]||_0x559076(0x172);if(y(),console[_0x559076(0x18f)](''),console[_0x559076(0x18f)](_0x559076(0x15a)),console[_0x559076(0x18f)](_0x559076(0x160)),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['error'](''),console['error']('──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────'),_0x121288[_0x559076(0x16b)](_0x463654=>console[_0x559076(0x18f)](_0x463654)),console[_0x559076(0x18f)]('────────────────────────────────────────────────────────────'),console['error'](''),console[_0x559076(0x18f)](_0x559076(0x14e)+_0x146039),console['error'](''),console['error'](_0x559076(0x15f)),console['error']('\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;'),console['error'](_0x559076(0x1a4)),console['error'](_0x559076(0x152)),console[_0x559076(0x18f)](''),console[_0x559076(0x18f)]('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console['error'](''),process[_0x559076(0x14f)]==='win32'){let _0x5c4b00=!0x1;try{_0x404eb0(_0x559076(0x158),{'stdio':_0x559076(0x17a)}),_0x5c4b00=!0x0;}catch{}console['error'](_0x5c4b00?_0x559076(0x181)+_0x146039+_0x559076(0x1be):'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x146039+_0x559076(0x19f));}else process['platform']===_0x559076(0x162)?console['error'](_0x559076(0x181)+_0x146039+_0x559076(0x175)):console[_0x559076(0x18f)]('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x146039+_0x559076(0x1aa));console[_0x559076(0x18f)](''),console[_0x559076(0x18f)](_0x559076(0x15a)),process[_0x559076(0x1b0)](0x1);}console['log']('[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。'),console[_0x559076(0x1c4)](_0x559076(0x180));}catch(_0x5bece9){y(),console['error'](_0x559076(0x1b8),_0x5bece9[_0x559076(0x17b)]),process['exit'](0x1);}})());