@bangdao-ai/acw-tools 1.13.53 → 1.13.55

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.53",
4
+ "version": "1.13.55",
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.53",
3
+ "version": "1.13.55",
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 _0x1104a4=_0x2d16;(function(_0x4d04cc,_0x5ec052){const _0x410196=_0x2d16,_0x39e42e=_0x4d04cc();while(!![]){try{const _0x7563ce=-parseInt(_0x410196(0x17b))/0x1*(parseInt(_0x410196(0x177))/0x2)+-parseInt(_0x410196(0x19d))/0x3*(parseInt(_0x410196(0x19a))/0x4)+parseInt(_0x410196(0x17e))/0x5+-parseInt(_0x410196(0x186))/0x6+parseInt(_0x410196(0x175))/0x7+-parseInt(_0x410196(0x18f))/0x8*(-parseInt(_0x410196(0x1a0))/0x9)+-parseInt(_0x410196(0x136))/0xa*(-parseInt(_0x410196(0x16d))/0xb);if(_0x7563ce===_0x5ec052)break;else _0x39e42e['push'](_0x39e42e['shift']());}catch(_0x30c08a){_0x39e42e['push'](_0x39e42e['shift']());}}}(_0x12a6,0x2d9c9));import _0x115b37 from'fs';import _0x2f56e8 from'path';import{fileURLToPath as _0x47212e}from'url';import{execSync as _0x151dab}from'child_process';import _0xddca63 from'https';import _0x181719 from'http';import _0xf797a9 from'zlib';var C='12.4.1',L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:'108',0x13:_0x1104a4(0x181),0x14:'115',0x15:'120',0x16:_0x1104a4(0x166),0x17:'131',0x18:'137',0x19:_0x1104a4(0x170)},$=[_0x1104a4(0x178),'127','131',_0x1104a4(0x170)],I=parseInt(process[_0x1104a4(0x195)]['slice'](0x1)[_0x1104a4(0x140)]('.')[0x0],0xa),T=((()=>{const _0x175900=_0x1104a4;let _0x521a5e=process[_0x175900(0x195)]['slice'](0x1)['split']('.');return parseInt(_0x521a5e[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function _0x2d16(_0x3a5fc1,_0xd167b8){_0x3a5fc1=_0x3a5fc1-0x135;const _0x12a6fe=_0x12a6();let _0x2d165c=_0x12a6fe[_0x3a5fc1];return _0x2d165c;}function P(){const _0x4a4fb9=_0x1104a4;console[_0x4a4fb9(0x160)](''),console[_0x4a4fb9(0x160)](_0x4a4fb9(0x189)),console[_0x4a4fb9(0x160)]('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console['log'](_0x4a4fb9(0x13a)),console['log']('[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。'),console[_0x4a4fb9(0x160)]('[提示]\x20【你当前的情况】当前为\x20'+process[_0x4a4fb9(0x195)]+_0x4a4fb9(0x185)),console[_0x4a4fb9(0x160)]('[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:'),console[_0x4a4fb9(0x160)](_0x4a4fb9(0x183)),console[_0x4a4fb9(0x160)](_0x4a4fb9(0x174)),console[_0x4a4fb9(0x160)](_0x4a4fb9(0x167)),console[_0x4a4fb9(0x160)](_0x4a4fb9(0x146)),console[_0x4a4fb9(0x160)]('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['log']('');}function y(){const _0x5d8ddf=_0x1104a4;console['error'](''),console[_0x5d8ddf(0x176)](_0x5d8ddf(0x168)),console[_0x5d8ddf(0x176)](_0x5d8ddf(0x193)),console['error'](_0x5d8ddf(0x16c)),console[_0x5d8ddf(0x176)]('建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。'),console['error'](_0x5d8ddf(0x192)),console[_0x5d8ddf(0x176)]('────────────────────────────────────────────');}function b(){const _0x3ea2a5=_0x1104a4;let _0xeed2c4=parseInt(process[_0x3ea2a5(0x195)]['slice'](0x1)['split']('.')[0x0],0xa);return F[_0xeed2c4]||process['versions'][_0x3ea2a5(0x15a)];}function E(){const _0x58aa5d=_0x1104a4;let _0x1a1127=C,_0x51a7fe=b(),_0x57aafc=process[_0x58aa5d(0x191)],_0xb766a3=process['arch'];return'better-sqlite3-v'+_0x1a1127+_0x58aa5d(0x13d)+_0x51a7fe+'-'+_0x57aafc+'-'+_0xb766a3+'.tar.gz';}function v(_0xf9eb42){return new Promise((_0x4a93d6,_0x21dd75)=>{const _0x3b7460=_0x2d16;let _0x8c2003=(_0xf9eb42['startsWith']('https')?_0xddca63:_0x181719)[_0x3b7460(0x16b)](_0xf9eb42,{'timeout':0x7530},_0x4e1a39=>{const _0x244513=_0x3b7460;if(_0x4e1a39['statusCode']===0x12d||_0x4e1a39['statusCode']===0x12e){v(_0x4e1a39['headers'][_0x244513(0x135)])[_0x244513(0x17d)](_0x4a93d6)[_0x244513(0x16e)](_0x21dd75);return;}if(_0x4e1a39['statusCode']!==0xc8){_0x21dd75(new Error('HTTP\x20'+_0x4e1a39['statusCode']));return;}let _0x18b0a4=[];_0x4e1a39['on']('data',_0x5bfec2=>_0x18b0a4['push'](_0x5bfec2)),_0x4e1a39['on']('end',()=>_0x4a93d6(Buffer['concat'](_0x18b0a4))),_0x4e1a39['on']('error',_0x21dd75);});_0x8c2003['on'](_0x3b7460(0x176),_0x21dd75),_0x8c2003['on']('timeout',()=>{const _0x15eede=_0x3b7460;_0x8c2003['destroy'](),_0x21dd75(new Error(_0x15eede(0x1a1)));});});}async function D(_0x3fb732,_0x3f7cf4){const _0x164d40=_0x1104a4;let _0xe625e9=_0xf797a9['gunzipSync'](_0x3fb732),_0x14db22=0x200,_0x446e31=0x0;for(;_0x446e31<_0xe625e9[_0x164d40(0x154)]-_0x14db22;){let _0x475770=_0xe625e9[_0x164d40(0x149)](_0x446e31,_0x446e31+_0x14db22);if(_0x475770[0x0]===0x0)break;let _0x1e7d47=_0x475770['slice'](0x0,0x64)[_0x164d40(0x13c)](_0x164d40(0x14b))['replace'](/\0/g,'')['trim'](),_0x38eceb=_0x475770['slice'](0x7c,0x88)['toString'](_0x164d40(0x14b))[_0x164d40(0x15c)](/\0/g,'')['trim'](),_0x52d9df=parseInt(_0x38eceb,0x8)||0x0,_0x1ad97f=String[_0x164d40(0x16a)](_0x475770[0x9c]);if(_0x446e31+=_0x14db22,_0x1e7d47&&_0x1ad97f==='0'||_0x1ad97f==='\x00'){let _0x5e7831=_0xe625e9[_0x164d40(0x149)](_0x446e31,_0x446e31+_0x52d9df),_0x251722=_0x2f56e8[_0x164d40(0x197)](_0x3f7cf4,_0x2f56e8[_0x164d40(0x138)](_0x1e7d47));_0x115b37['mkdirSync'](_0x2f56e8[_0x164d40(0x14a)](_0x251722),{'recursive':!0x0}),_0x115b37[_0x164d40(0x163)](_0x251722,_0x5e7831);}_0x446e31+=Math[_0x164d40(0x190)](_0x52d9df/_0x14db22)*_0x14db22;}}function h(){const _0x3a8613=_0x1104a4;let _0x47d789=[_0x2f56e8[_0x3a8613(0x197)](process['cwd'](),'node_modules',_0x3a8613(0x194)),_0x2f56e8[_0x3a8613(0x197)](_0x47212e(import.meta.url),'..',_0x3a8613(0x182),_0x3a8613(0x194))];try{let _0x1bea5e=import.meta.resolve(_0x3a8613(0x194));if(_0x1bea5e){let _0x5da06a=_0x47212e(_0x1bea5e);_0x47d789[_0x3a8613(0x147)](_0x2f56e8[_0x3a8613(0x14a)](_0x2f56e8[_0x3a8613(0x14a)](_0x5da06a)));}}catch{}for(let _0x20013d of _0x47d789)if(_0x115b37[_0x3a8613(0x142)](_0x2f56e8['join'](_0x20013d,'package.json')))return _0x20013d;return null;}function N(_0x2c3cfa){const _0x39aa49=_0x1104a4;if(!_0x2c3cfa)return null;let _0x4fbbe4=_0x2f56e8['dirname'](_0x2c3cfa);return _0x2f56e8[_0x39aa49(0x138)](_0x4fbbe4)==='node_modules'?_0x2f56e8[_0x39aa49(0x14a)](_0x4fbbe4):null;}function B(_0x56724a){const _0x4f85e9=_0x1104a4;_0x151dab(_0x4f85e9(0x148),{'cwd':_0x56724a||process['cwd'](),'stdio':'pipe','env':{...process[_0x4f85e9(0x17a)]}});}function k(_0x10601d){const _0x5d87a3=_0x1104a4;let _0xaa7b9c=N(_0x10601d);if(!_0xaa7b9c||!_0x115b37[_0x5d87a3(0x142)](_0x2f56e8[_0x5d87a3(0x197)](_0xaa7b9c,_0x5d87a3(0x199))))return console[_0x5d87a3(0x155)](_0x5d87a3(0x13e)),!0x1;console['log'](''),console[_0x5d87a3(0x160)]('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x5d87a3(0x160)]('[INFO]\x20自动尝试本地编译:\x20在「'+_0xaa7b9c+_0x5d87a3(0x15e)),console['log'](_0x5d87a3(0x18d)),console[_0x5d87a3(0x160)]('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');try{return _0x151dab(_0x5d87a3(0x18b),{'cwd':_0xaa7b9c,'stdio':'inherit','env':{...process[_0x5d87a3(0x17a)]}}),B(_0xaa7b9c),console[_0x5d87a3(0x160)](_0x5d87a3(0x152)),!0x0;}catch(_0x19aeee){let _0x14f134=_0x19aeee&&typeof _0x19aeee==_0x5d87a3(0x139)?_0x19aeee:{},_0x31a649=_0x14f134[_0x5d87a3(0x188)]?String(_0x14f134['stderr']):'',_0x3faa50=_0x14f134[_0x5d87a3(0x159)]?String(_0x14f134['stdout']):'',_0xac16fa=_0x31a649||_0x3faa50||(_0x19aeee&&_0x19aeee[_0x5d87a3(0x15b)]?String(_0x19aeee[_0x5d87a3(0x15b)]):String(_0x19aeee));return console[_0x5d87a3(0x155)](_0x5d87a3(0x145)+_0xac16fa[_0x5d87a3(0x149)](0x0,0x4b0)+(_0xac16fa['length']>0x4b0?'...':'')),!0x1;}}async function M(){const _0x22657f=_0x1104a4;let _0x2bb4af=E(),_0x32b7db=L+'/v'+C+'/'+_0x2bb4af;console['log']('[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20'+_0x2bb4af);let _0x492b09=await v(_0x32b7db);console[_0x22657f(0x160)](_0x22657f(0x173)+(_0x492b09[_0x22657f(0x154)]/0x400)['toFixed'](0x1)+_0x22657f(0x156));let _0x4a6142=h();if(!_0x4a6142)throw new Error(_0x22657f(0x18a));let _0x1c7b39=_0x2f56e8['join'](_0x4a6142,'prebuilds',process['platform']+'-'+process['arch']);return _0x115b37['mkdirSync'](_0x1c7b39,{'recursive':!0x0}),await D(_0x492b09,_0x1c7b39),console['log']('[INFO]\x20预编译包已安装到:\x20'+_0x1c7b39),!0x0;}async function W(){const _0x79c69=_0x1104a4;let _0x52aaba=(await import(_0x79c69(0x194)))[_0x79c69(0x150)];return new _0x52aaba(':memory:')['close'](),!0x0;}async function V(){const _0x2bec22=_0x1104a4;try{let {DatabaseSync:_0x2c586c}=await import('node:sqlite');return new _0x2c586c(':memory:')[_0x2bec22(0x16f)](),!0x0;}catch{return!0x1;}}function _0x12a6(){const _0x28f3e9=['dirname','utf8','[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。','MODULE_NOT_FOUND','。优先请把运行\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重装。','pipe','default','exit','[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载','首错原文:\x20','length','warn','\x20KB)','[INFO]\x20预编译包已安装,重新测试...','[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。','stdout','modules','message','replace','[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild','」执行\x20npm\x20rebuild\x20better-sqlite3','test','log','acwInstallNote','。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','writeFileSync',',平台=','includes','127','[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。','──────────\x20给用户的说明(安装失败)──────────','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','fromCharCode','get','根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。','14443GkKTfm','catch','close','137','[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。','push','[INFO]\x20下载成功\x20(','[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);','1351084kncMAn','error','2FUOlxu','115',',process.versions.modules=','env','244786wMqtJQ','invalid\x20ELF','then','1772505IPVPxF','未知错误','darwin','111','node_modules','[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;','better_sqlite3',',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。','2192868ZpCSJN','[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)','stderr','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','无法找到\x20better-sqlite3\x20模块路径','npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts','forEach','[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)','arch','8OxEZNT','ceil','platform','package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','better-sqlite3','version','[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功','join','\x20|\x20Node\x20','package.json','4VFCRMX','[环境]\x20better-sqlite3\x20路径=','unknown','738357yqIoGj','was\x20compiled\x20against','(ABI\x20v','3114117YpsDmT','Request\x20timeout',')\x20|\x20','location','1140HmZJYa','[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','basename','object','[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。','[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20','toString','-node-v','[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild','[步骤]\x20npm\x20rebuild:\x20成功','split','Cannot\x20find\x20package','existsSync','[WARN]\x20预编译包安装后测试失败:\x20','\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','[WARN]\x20npm\x20rebuild\x20未成功:\x20','[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。','unshift','node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22','slice'];_0x12a6=function(){return _0x28f3e9;};return _0x12a6();}((async()=>{const _0x3cd20f=_0x1104a4;try{let _0x28d380=_0x47212e(import.meta.url),_0x4b92f5=_0x2f56e8['dirname'](_0x28d380),_0x586e08=_0x3cd20f(0x19c),_0x68de2c='';try{let _0x156b76=_0x2f56e8[_0x3cd20f(0x197)](_0x4b92f5,_0x3cd20f(0x199));if(_0x115b37['existsSync'](_0x156b76)){let _0x41b729=JSON['parse'](_0x115b37['readFileSync'](_0x156b76,_0x3cd20f(0x14b)));_0x586e08=_0x41b729[_0x3cd20f(0x195)]||'unknown',_0x68de2c=typeof _0x41b729['acwInstallNote']=='string'?_0x41b729[_0x3cd20f(0x161)]:'';}}catch{}console['log']('ACW\x20Tools\x20MCP\x20安装后检查...'),console['log']('v'+_0x586e08+_0x3cd20f(0x198)+process['version']+'\x20(ABI\x20'+b()+_0x3cd20f(0x1a2)+process[_0x3cd20f(0x191)]+'/'+process[_0x3cd20f(0x18e)]),_0x68de2c&&console[_0x3cd20f(0x160)]('[提示]\x20'+_0x68de2c),await V()&&(console[_0x3cd20f(0x160)](_0x3cd20f(0x14c)),console[_0x3cd20f(0x160)]('[提示]\x20当前\x20'+process['version']+'\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。'),x()||console['log'](_0x3cd20f(0x158)),console[_0x3cd20f(0x160)]('[OK]\x20安装完成'),process[_0x3cd20f(0x151)](0x0)),P();let _0x4ca129=!0x1,_0x1526f0=null,_0x41b748=[];try{await W(),console['log']('[OK]\x20better-sqlite3\x20加载成功'),_0x4ca129=!0x0;}catch(_0x426833){_0x1526f0=_0x426833;let _0x455f78=_0x426833&&_0x426833['message']?String(_0x426833['message']):'',_0x3663dc=_0x455f78['toLowerCase']();console['log']('[INFO]\x20better-sqlite3\x20原生加载失败:\x20'+_0x455f78),_0x41b748[_0x3cd20f(0x172)]('[原因]\x20首次加载失败(动态\x20import):\x20'+_0x455f78['slice'](0x0,0x1f4)+(_0x455f78['length']>0x1f4?'...':'')),(_0x455f78[_0x3cd20f(0x165)](_0x3cd20f(0x141))||_0x455f78['includes']('ERR_MODULE_NOT_FOUND')||_0x455f78['includes'](_0x3cd20f(0x14d)))&&_0x41b748[_0x3cd20f(0x172)]('[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。');let _0x119e95=_0x455f78['includes']('NODE_MODULE_VERSION')||_0x455f78[_0x3cd20f(0x165)](_0x3cd20f(0x19e))||/\.node\b/[_0x3cd20f(0x15f)](_0x455f78)||_0x3663dc[_0x3cd20f(0x165)](_0x3cd20f(0x184))||_0x3663dc['includes']('better-sqlite3')||_0x3663dc[_0x3cd20f(0x165)]('dlopen')||_0x3663dc['includes'](_0x3cd20f(0x17c))||_0x3663dc['includes']('not\x20a\x20valid\x20win32'),_0x1c24f5=h(),_0x51f6c4=N(_0x1c24f5);if(_0x41b748['push']('[环境]\x20Node='+process['version']+_0x3cd20f(0x179)+process['versions'][_0x3cd20f(0x15a)]+',映射\x20ABI='+b()+_0x3cd20f(0x164)+process['platform']+'/'+process['arch']),_0x41b748['push'](_0x3cd20f(0x19b)+(_0x1c24f5||'未找到')+',npm\x20包根='+(_0x51f6c4||'未解析')),!_0x119e95)_0x41b748['push'](_0x3cd20f(0x171));else{let _0x38cf83=b();if(!$[_0x3cd20f(0x165)](_0x38cf83))_0x41b748['push']('[原因]\x20当前\x20ABI\x20'+_0x38cf83+'\x20不在\x20OSS\x20预编译列表\x20['+$['join'](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console['log']('[INFO]\x20当前\x20Node\x20'+process[_0x3cd20f(0x195)]+_0x3cd20f(0x19f)+_0x38cf83+')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译');else{_0x41b748['push']('[步骤]\x20ABI\x20'+_0x38cf83+'\x20在预编译列表内,尝试\x20OSS:\x20'+E()),console['log']('[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...');try{await M(),console['log'](_0x3cd20f(0x157));try{let _0x8fe74b=N(h())||_0x51f6c4||process['cwd']();B(_0x8fe74b),console[_0x3cd20f(0x160)](_0x3cd20f(0x137)),_0x4ca129=!0x0,_0x41b748['push'](_0x3cd20f(0x196));}catch(_0x3df54e){_0x41b748[_0x3cd20f(0x172)](_0x3cd20f(0x13b)+(_0x3df54e['message']||_0x3df54e)),console[_0x3cd20f(0x155)](_0x3cd20f(0x143)+_0x3df54e[_0x3cd20f(0x15b)]);}}catch(_0x244c93){_0x41b748['push']('[步骤]\x20OSS\x20下载或解压失败:\x20'+(_0x244c93[_0x3cd20f(0x15b)]||_0x244c93)),console['warn']('[WARN]\x20OSS\x20预编译包下载或解压失败:\x20'+_0x244c93['message']);}}!_0x4ca129&&_0x1c24f5?(_0x41b748['push']('[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)'),k(_0x1c24f5)?(_0x4ca129=!0x0,_0x41b748[_0x3cd20f(0x172)](_0x3cd20f(0x13f))):_0x41b748['push'](_0x3cd20f(0x187))):!_0x4ca129&&!_0x1c24f5&&_0x41b748[_0x3cd20f(0x172)](_0x3cd20f(0x15d));}}if(!_0x4ca129){let _0x5800c2=_0x1526f0?.['message']||_0x3cd20f(0x17f);if(y(),console['error'](''),console[_0x3cd20f(0x176)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x3cd20f(0x176)]('[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止'),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['error'](''),console[_0x3cd20f(0x176)]('──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────'),_0x41b748[_0x3cd20f(0x18c)](_0x6b7cab=>console['error'](_0x6b7cab)),console['error']('────────────────────────────────────────────────────────────'),console[_0x3cd20f(0x176)](''),console['error'](_0x3cd20f(0x153)+_0x5800c2),console['error'](''),console[_0x3cd20f(0x176)]('说明:\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[_0x3cd20f(0x176)]('\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;'),console['error'](_0x3cd20f(0x144)),console['error'](''),console[_0x3cd20f(0x176)]('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console['error'](''),process[_0x3cd20f(0x191)]==='win32'){let _0x5bdd5b=!0x1;try{_0x151dab('where\x20cl.exe',{'stdio':_0x3cd20f(0x14f)}),_0x5bdd5b=!0x0;}catch{}console[_0x3cd20f(0x176)](_0x5bdd5b?_0x3cd20f(0x169)+_0x5800c2+_0x3cd20f(0x14e):_0x3cd20f(0x169)+_0x5800c2+_0x3cd20f(0x162));}else process['platform']===_0x3cd20f(0x180)?console[_0x3cd20f(0x176)]('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x5800c2+'。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。'):console['error'](_0x3cd20f(0x169)+_0x5800c2+'。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。');console[_0x3cd20f(0x176)](''),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),process['exit'](0x1);}console['log']('[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。'),console[_0x3cd20f(0x160)]('[OK]\x20安装完成');}catch(_0x9ba20e){y(),console['error']('[ERROR]\x20postinstall\x20脚本执行出错:',_0x9ba20e[_0x3cd20f(0x15b)]),process['exit'](0x1);}})());
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);}})());