@bangdao-ai/acw-tools 1.13.38 → 1.13.39
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/chatGrabState.js +1 -1
- package/claudeCodeParser.js +1 -1
- package/codexParser.js +1 -1
- package/codexRepair.js +1 -1
- package/cursorCliParser.js +1 -1
- package/cursorConversationParser.js +1 -1
- package/index.js +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/postinstall.js +1 -1
package/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ACW工具集",
|
|
3
3
|
"description": "ACW平台工具集:智能下载规则/技能到项目、上传技能到Skills广场、搜索技能、检查技能更新、上传/下载/检索个人知识库",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.39",
|
|
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
package/postinstall.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const _0x46a2c7=_0x51bd;(function(_0x379c3f,_0x486c3a){const _0x17641b=_0x51bd,_0x4bab13=_0x379c3f();while(!![]){try{const _0x30e76b=-parseInt(_0x17641b(0x205))/0x1+parseInt(_0x17641b(0x25e))/0x2*(parseInt(_0x17641b(0x24a))/0x3)+parseInt(_0x17641b(0x23a))/0x4*(-parseInt(_0x17641b(0x216))/0x5)+parseInt(_0x17641b(0x250))/0x6*(parseInt(_0x17641b(0x231))/0x7)+-parseInt(_0x17641b(0x259))/0x8*(parseInt(_0x17641b(0x232))/0x9)+-parseInt(_0x17641b(0x252))/0xa+-parseInt(_0x17641b(0x227))/0xb*(-parseInt(_0x17641b(0x207))/0xc);if(_0x30e76b===_0x486c3a)break;else _0x4bab13['push'](_0x4bab13['shift']());}catch(_0x400463){_0x4bab13['push'](_0x4bab13['shift']());}}}(_0x182a,0x3ca95));import _0xbc174f from'fs';import _0x288b80 from'path';import{fileURLToPath as _0x42d6c9}from'url';import{execSync as _0x41d422}from'child_process';import _0x22f2ac from'https';import _0x5309b5 from'http';import _0xe07e9b from'zlib';var C=_0x46a2c7(0x1f3),L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:_0x46a2c7(0x234),0x13:_0x46a2c7(0x1f2),0x14:'115',0x15:_0x46a2c7(0x24c),0x16:'127',0x17:'131',0x18:_0x46a2c7(0x25f),0x19:_0x46a2c7(0x25f)},$=['115',_0x46a2c7(0x20e),_0x46a2c7(0x20b),_0x46a2c7(0x25f)],I=parseInt(process[_0x46a2c7(0x246)][_0x46a2c7(0x20f)](0x1)['split']('.')[0x0],0xa),T=((()=>{const _0x89d2fb=_0x46a2c7;let _0x5c44ac=process[_0x89d2fb(0x246)]['slice'](0x1)['split']('.');return parseInt(_0x5c44ac[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x3b4c2b=_0x46a2c7;console[_0x3b4c2b(0x23e)](''),console[_0x3b4c2b(0x23e)]('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['log']('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console[_0x3b4c2b(0x23e)](_0x3b4c2b(0x230)),console[_0x3b4c2b(0x23e)](_0x3b4c2b(0x1f5)),console['log'](_0x3b4c2b(0x260)+process[_0x3b4c2b(0x246)]+_0x3b4c2b(0x222)),console['log'](_0x3b4c2b(0x213)),console[_0x3b4c2b(0x23e)](_0x3b4c2b(0x21c)),console['log'](_0x3b4c2b(0x25c)),console[_0x3b4c2b(0x23e)](_0x3b4c2b(0x241)),console[_0x3b4c2b(0x23e)](_0x3b4c2b(0x249)),console['log'](_0x3b4c2b(0x261)),console['log']('');}function y(){const _0x27ecdb=_0x46a2c7;console[_0x27ecdb(0x223)](''),console[_0x27ecdb(0x223)]('──────────\x20给用户的说明(安装失败)──────────'),console[_0x27ecdb(0x223)](_0x27ecdb(0x251)),console['error']('根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。'),console['error'](_0x27ecdb(0x23c)),console['error']('package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。'),console[_0x27ecdb(0x223)]('────────────────────────────────────────────');}function b(){const _0x385879=_0x46a2c7;let _0xeb9baa=parseInt(process['version']['slice'](0x1)[_0x385879(0x24b)]('.')[0x0],0xa);return F[_0xeb9baa]||process['versions'][_0x385879(0x263)];}function E(){const _0x5dcb72=_0x46a2c7;let _0x590177=C,_0x30c89e=b(),_0x3a7c92=process[_0x5dcb72(0x21a)],_0x55dbf1=process[_0x5dcb72(0x242)];return'better-sqlite3-v'+_0x590177+'-node-v'+_0x30c89e+'-'+_0x3a7c92+'-'+_0x55dbf1+'.tar.gz';}function v(_0x63420b){return new Promise((_0x171403,_0x3fb5ae)=>{const _0x535219=_0x51bd;let _0x406580=(_0x63420b['startsWith'](_0x535219(0x210))?_0x22f2ac:_0x5309b5)['get'](_0x63420b,{'timeout':0x7530},_0x3dfd96=>{const _0x15c534=_0x535219;if(_0x3dfd96['statusCode']===0x12d||_0x3dfd96[_0x15c534(0x264)]===0x12e){v(_0x3dfd96[_0x15c534(0x266)][_0x15c534(0x22f)])[_0x15c534(0x1ff)](_0x171403)[_0x15c534(0x209)](_0x3fb5ae);return;}if(_0x3dfd96[_0x15c534(0x264)]!==0xc8){_0x3fb5ae(new Error('HTTP\x20'+_0x3dfd96[_0x15c534(0x264)]));return;}let _0x581af6=[];_0x3dfd96['on']('data',_0x32eedc=>_0x581af6['push'](_0x32eedc)),_0x3dfd96['on']('end',()=>_0x171403(Buffer[_0x15c534(0x25b)](_0x581af6))),_0x3dfd96['on'](_0x15c534(0x223),_0x3fb5ae);});_0x406580['on'](_0x535219(0x223),_0x3fb5ae),_0x406580['on'](_0x535219(0x240),()=>{const _0x3b8a35=_0x535219;_0x406580['destroy'](),_0x3fb5ae(new Error(_0x3b8a35(0x21e)));});});}function _0x182a(){const _0x5005ce=['42DbfDNq','76653LAkOQR','readFileSync','108','[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。','close','join','[提示]\x20当前\x20','win32','68yWMEJM','prebuilds','建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。','toLowerCase','log','pipe','timeout','[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。','arch','toString','。优先请把运行\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重装。','basename','version','not\x20a\x20valid\x20win32','。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。','[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。','2757OFlRgi','split','120','trim','ceil','[步骤]\x20ABI\x20','387246WFxQIi','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','4312450nlqOQE','[步骤]\x20OSS\x20下载或解压失败:\x20','was\x20compiled\x20against','\x20KB)','cwd','package.json','\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','344OPgEra','unknown','concat','[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);','length','270hPXDdK','137','[提示]\x20【你当前的情况】当前为\x20','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','未找到','modules','statusCode','\x20(ABI\x20','headers','111','12.4.1','stdout','[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。','[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。','existsSync','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','includes','dirname','[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)',')\x20|\x20','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:',',npm\x20包根=','then','[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild','[ERROR]\x20postinstall\x20脚本执行出错:','Cannot\x20find\x20package','default','test','240146IRvrat','object','24lwiuAg','[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)','catch','toFixed','131','[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止','message','127','slice','https','[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)','[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:','mkdirSync','────────────────────────────────────────────────────────────','45720nOLcQr','better_sqlite3','[OK]\x20安装完成','node_modules','platform','env','[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;','...','Request\x20timeout','push','未解析','better-sqlite3',',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。','error','utf8','ERR_MODULE_NOT_FOUND',',平台=','5116254qjbtJx','warn','invalid\x20ELF','replace','versions','MODULE_NOT_FOUND','[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。','[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...','location','[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。'];_0x182a=function(){return _0x5005ce;};return _0x182a();}async function D(_0x52607d,_0x16e0da){const _0x10c960=_0x46a2c7;let _0x107440=_0xe07e9b['gunzipSync'](_0x52607d),_0x2fe1e9=0x200,_0x1a1500=0x0;for(;_0x1a1500<_0x107440[_0x10c960(0x25d)]-_0x2fe1e9;){let _0xdd7644=_0x107440['slice'](_0x1a1500,_0x1a1500+_0x2fe1e9);if(_0xdd7644[0x0]===0x0)break;let _0x3720b7=_0xdd7644['slice'](0x0,0x64)[_0x10c960(0x243)](_0x10c960(0x224))[_0x10c960(0x22a)](/\0/g,'')[_0x10c960(0x24d)](),_0x2d8356=_0xdd7644[_0x10c960(0x20f)](0x7c,0x88)['toString']('utf8')[_0x10c960(0x22a)](/\0/g,'')['trim'](),_0x11e7c4=parseInt(_0x2d8356,0x8)||0x0,_0x18ba11=String['fromCharCode'](_0xdd7644[0x9c]);if(_0x1a1500+=_0x2fe1e9,_0x3720b7&&_0x18ba11==='0'||_0x18ba11==='\x00'){let _0x4274d8=_0x107440[_0x10c960(0x20f)](_0x1a1500,_0x1a1500+_0x11e7c4),_0x280d6b=_0x288b80[_0x10c960(0x237)](_0x16e0da,_0x288b80[_0x10c960(0x245)](_0x3720b7));_0xbc174f[_0x10c960(0x214)](_0x288b80['dirname'](_0x280d6b),{'recursive':!0x0}),_0xbc174f['writeFileSync'](_0x280d6b,_0x4274d8);}_0x1a1500+=Math[_0x10c960(0x24e)](_0x11e7c4/_0x2fe1e9)*_0x2fe1e9;}}function h(){const _0x26699a=_0x46a2c7;let _0x268190=[_0x288b80['join'](process[_0x26699a(0x256)](),'node_modules',_0x26699a(0x221)),_0x288b80[_0x26699a(0x237)](_0x42d6c9(import.meta.url),'..',_0x26699a(0x219),'better-sqlite3')];try{let _0x15800a=import.meta.resolve('better-sqlite3');if(_0x15800a){let _0x272e6a=_0x42d6c9(_0x15800a);_0x268190['unshift'](_0x288b80['dirname'](_0x288b80[_0x26699a(0x1fa)](_0x272e6a)));}}catch{}for(let _0x594a0f of _0x268190)if(_0xbc174f[_0x26699a(0x1f7)](_0x288b80['join'](_0x594a0f,_0x26699a(0x257))))return _0x594a0f;return null;}function N(_0xfb328){const _0x166b1b=_0x46a2c7;if(!_0xfb328)return null;let _0x4e392b=_0x288b80['dirname'](_0xfb328);return _0x288b80[_0x166b1b(0x245)](_0x4e392b)==='node_modules'?_0x288b80['dirname'](_0x4e392b):null;}function B(_0x49e48a){const _0x1dc735=_0x46a2c7;_0x41d422('node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22',{'cwd':_0x49e48a||process[_0x1dc735(0x256)](),'stdio':_0x1dc735(0x23f),'env':{...process['env']}});}function k(_0xd7598a){const _0x1efbf1=_0x46a2c7;let _0x46d782=N(_0xd7598a);if(!_0x46d782||!_0xbc174f[_0x1efbf1(0x1f7)](_0x288b80[_0x1efbf1(0x237)](_0x46d782,_0x1efbf1(0x257))))return console['warn']('[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild'),!0x1;console['log'](''),console[_0x1efbf1(0x23e)]('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x1efbf1(0x23e)]('[INFO]\x20自动尝试本地编译:\x20在「'+_0x46d782+'」执行\x20npm\x20rebuild\x20better-sqlite3'),console['log'](_0x1efbf1(0x208)),console['log']('[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');try{return _0x41d422('npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts',{'cwd':_0x46d782,'stdio':'inherit','env':{...process[_0x1efbf1(0x21b)]}}),B(_0x46d782),console['log']('[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载'),!0x0;}catch(_0x3150ee){let _0x4a9f7b=_0x3150ee&&typeof _0x3150ee==_0x1efbf1(0x206)?_0x3150ee:{},_0x3c7c03=_0x4a9f7b['stderr']?String(_0x4a9f7b['stderr']):'',_0xfb153f=_0x4a9f7b[_0x1efbf1(0x1f4)]?String(_0x4a9f7b['stdout']):'',_0x44da6c=_0x3c7c03||_0xfb153f||(_0x3150ee&&_0x3150ee['message']?String(_0x3150ee['message']):String(_0x3150ee));return console[_0x1efbf1(0x228)]('[WARN]\x20npm\x20rebuild\x20未成功:\x20'+_0x44da6c['slice'](0x0,0x4b0)+(_0x44da6c[_0x1efbf1(0x25d)]>0x4b0?_0x1efbf1(0x21d):'')),!0x1;}}function _0x51bd(_0x2b0ec2,_0x312753){_0x2b0ec2=_0x2b0ec2-0x1f2;const _0x182af0=_0x182a();let _0x51bd57=_0x182af0[_0x2b0ec2];return _0x51bd57;}async function M(){const _0x2c2475=_0x46a2c7;let _0x42633d=E(),_0x74c25c=L+'/v'+C+'/'+_0x42633d;console['log']('[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20'+_0x42633d);let _0x20d51b=await v(_0x74c25c);console['log']('[INFO]\x20下载成功\x20('+(_0x20d51b['length']/0x400)[_0x2c2475(0x20a)](0x1)+_0x2c2475(0x255));let _0x1cf2a0=h();if(!_0x1cf2a0)throw new Error('无法找到\x20better-sqlite3\x20模块路径');let _0x3945d5=_0x288b80['join'](_0x1cf2a0,_0x2c2475(0x23b),process[_0x2c2475(0x21a)]+'-'+process[_0x2c2475(0x242)]);return _0xbc174f['mkdirSync'](_0x3945d5,{'recursive':!0x0}),await D(_0x20d51b,_0x3945d5),console[_0x2c2475(0x23e)]('[INFO]\x20预编译包已安装到:\x20'+_0x3945d5),!0x0;}async function W(){const _0x369061=_0x46a2c7;let _0xf282f5=(await import(_0x369061(0x221)))[_0x369061(0x203)];return new _0xf282f5(':memory:')[_0x369061(0x236)](),!0x0;}async function V(){try{let {DatabaseSync:_0x4f63f7}=await import('node:sqlite');return new _0x4f63f7(':memory:')['close'](),!0x0;}catch{return!0x1;}}((async()=>{const _0x4797a8=_0x46a2c7;try{let _0x448595=_0x42d6c9(import.meta.url),_0x1ca913=_0x288b80[_0x4797a8(0x1fa)](_0x448595),_0x2fc41d='unknown',_0x3f1f10='';try{let _0x418a09=_0x288b80['join'](_0x1ca913,_0x4797a8(0x257));if(_0xbc174f['existsSync'](_0x418a09)){let _0x586933=JSON['parse'](_0xbc174f[_0x4797a8(0x233)](_0x418a09,'utf8'));_0x2fc41d=_0x586933[_0x4797a8(0x246)]||_0x4797a8(0x25a),_0x3f1f10=typeof _0x586933['acwInstallNote']=='string'?_0x586933['acwInstallNote']:'';}}catch{}console['log']('ACW\x20Tools\x20MCP\x20安装后检查...'),console[_0x4797a8(0x23e)]('v'+_0x2fc41d+'\x20|\x20Node\x20'+process[_0x4797a8(0x246)]+_0x4797a8(0x265)+b()+_0x4797a8(0x1fc)+process[_0x4797a8(0x21a)]+'/'+process['arch']),_0x3f1f10&&console['log']('[提示]\x20'+_0x3f1f10),await V()&&(console['log']('[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。'),console['log'](_0x4797a8(0x238)+process['version']+'\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。'),x()||console[_0x4797a8(0x23e)](_0x4797a8(0x22d)),console[_0x4797a8(0x23e)]('[OK]\x20安装完成'),process['exit'](0x0)),P();let _0x2c191e=!0x1,_0x2957cb=null,_0xde9cc=[];try{await W(),console[_0x4797a8(0x23e)]('[OK]\x20better-sqlite3\x20加载成功'),_0x2c191e=!0x0;}catch(_0x8a2897){_0x2957cb=_0x8a2897;let _0x13ccee=_0x8a2897&&_0x8a2897['message']?String(_0x8a2897['message']):'',_0x2d7839=_0x13ccee[_0x4797a8(0x23d)]();console['log']('[INFO]\x20better-sqlite3\x20原生加载失败:\x20'+_0x13ccee),_0xde9cc[_0x4797a8(0x21f)]('[原因]\x20首次加载失败(动态\x20import):\x20'+_0x13ccee[_0x4797a8(0x20f)](0x0,0x1f4)+(_0x13ccee[_0x4797a8(0x25d)]>0x1f4?'...':'')),(_0x13ccee[_0x4797a8(0x1f9)](_0x4797a8(0x202))||_0x13ccee[_0x4797a8(0x1f9)](_0x4797a8(0x225))||_0x13ccee['includes'](_0x4797a8(0x22c)))&&_0xde9cc['push'](_0x4797a8(0x235));let _0x5a7c61=_0x13ccee[_0x4797a8(0x1f9)]('NODE_MODULE_VERSION')||_0x13ccee['includes'](_0x4797a8(0x254))||/\.node\b/[_0x4797a8(0x204)](_0x13ccee)||_0x2d7839[_0x4797a8(0x1f9)](_0x4797a8(0x217))||_0x2d7839['includes'](_0x4797a8(0x221))||_0x2d7839['includes']('dlopen')||_0x2d7839['includes'](_0x4797a8(0x229))||_0x2d7839[_0x4797a8(0x1f9)](_0x4797a8(0x247)),_0x362cc7=h(),_0x52c33d=N(_0x362cc7);if(_0xde9cc[_0x4797a8(0x21f)]('[环境]\x20Node='+process['version']+',process.versions.modules='+process[_0x4797a8(0x22b)]['modules']+',映射\x20ABI='+b()+_0x4797a8(0x226)+process['platform']+'/'+process[_0x4797a8(0x242)]),_0xde9cc[_0x4797a8(0x21f)]('[环境]\x20better-sqlite3\x20路径='+(_0x362cc7||_0x4797a8(0x262))+_0x4797a8(0x1fe)+(_0x52c33d||_0x4797a8(0x220))),!_0x5a7c61)_0xde9cc[_0x4797a8(0x21f)](_0x4797a8(0x1f6));else{let _0x3deab0=b();if(!$['includes'](_0x3deab0))_0xde9cc[_0x4797a8(0x21f)]('[原因]\x20当前\x20ABI\x20'+_0x3deab0+'\x20不在\x20OSS\x20预编译列表\x20['+$[_0x4797a8(0x237)](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console['log']('[INFO]\x20当前\x20Node\x20'+process[_0x4797a8(0x246)]+'(ABI\x20v'+_0x3deab0+')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译');else{_0xde9cc['push'](_0x4797a8(0x24f)+_0x3deab0+'\x20在预编译列表内,尝试\x20OSS:\x20'+E()),console['log'](_0x4797a8(0x22e));try{await M(),console['log']('[INFO]\x20预编译包已安装,重新测试...');try{let _0x556499=N(h())||_0x52c33d||process['cwd']();B(_0x556499),console[_0x4797a8(0x23e)](_0x4797a8(0x212)),_0x2c191e=!0x0,_0xde9cc['push']('[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功');}catch(_0x4bd717){_0xde9cc[_0x4797a8(0x21f)]('[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20'+(_0x4bd717[_0x4797a8(0x20d)]||_0x4bd717)),console[_0x4797a8(0x228)]('[WARN]\x20预编译包安装后测试失败:\x20'+_0x4bd717[_0x4797a8(0x20d)]);}}catch(_0xbea75){_0xde9cc[_0x4797a8(0x21f)](_0x4797a8(0x253)+(_0xbea75[_0x4797a8(0x20d)]||_0xbea75)),console['warn']('[WARN]\x20OSS\x20预编译包下载或解压失败:\x20'+_0xbea75['message']);}}!_0x2c191e&&_0x362cc7?(_0xde9cc['push'](_0x4797a8(0x211)),k(_0x362cc7)?(_0x2c191e=!0x0,_0xde9cc['push']('[步骤]\x20npm\x20rebuild:\x20成功')):_0xde9cc['push'](_0x4797a8(0x1fb))):!_0x2c191e&&!_0x362cc7&&_0xde9cc[_0x4797a8(0x21f)](_0x4797a8(0x200));}}if(!_0x2c191e){let _0x4f4c73=_0x2957cb?.[_0x4797a8(0x20d)]||'未知错误';if(y(),console['error'](''),console[_0x4797a8(0x223)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x4797a8(0x223)](_0x4797a8(0x20c)),console[_0x4797a8(0x223)](_0x4797a8(0x1f8)),console[_0x4797a8(0x223)](''),console['error']('──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────'),_0xde9cc['forEach'](_0x2a6bf4=>console[_0x4797a8(0x223)](_0x2a6bf4)),console['error'](_0x4797a8(0x215)),console[_0x4797a8(0x223)](''),console[_0x4797a8(0x223)]('首错原文:\x20'+_0x4f4c73),console[_0x4797a8(0x223)](''),console[_0x4797a8(0x223)]('说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:'),console[_0x4797a8(0x223)]('\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;'),console['error']('\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;'),console['error'](_0x4797a8(0x258)),console['error'](''),console[_0x4797a8(0x223)]('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console[_0x4797a8(0x223)](''),process[_0x4797a8(0x21a)]===_0x4797a8(0x239)){let _0x33e773=!0x1;try{_0x41d422('where\x20cl.exe',{'stdio':'pipe'}),_0x33e773=!0x0;}catch{}console['error'](_0x33e773?'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x4f4c73+_0x4797a8(0x244):'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x4f4c73+'。优先请把运行\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[_0x4797a8(0x223)]('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x4f4c73+'。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。'):console[_0x4797a8(0x223)](_0x4797a8(0x1fd)+_0x4f4c73+_0x4797a8(0x248));console[_0x4797a8(0x223)](''),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),process['exit'](0x1);}console['log']('[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。'),console[_0x4797a8(0x23e)](_0x4797a8(0x218));}catch(_0xb37eed){y(),console[_0x4797a8(0x223)](_0x4797a8(0x201),_0xb37eed[_0x4797a8(0x20d)]),process['exit'](0x1);}})());
|
|
2
|
+
const _0x5ad66a=_0x5c9e;(function(_0x40371b,_0x142418){const _0x43234f=_0x5c9e,_0x432468=_0x40371b();while(!![]){try{const _0x262e8a=parseInt(_0x43234f(0x124))/0x1*(parseInt(_0x43234f(0x10f))/0x2)+parseInt(_0x43234f(0x118))/0x3+parseInt(_0x43234f(0x14b))/0x4+-parseInt(_0x43234f(0x11b))/0x5*(parseInt(_0x43234f(0xe5))/0x6)+parseInt(_0x43234f(0xfc))/0x7*(parseInt(_0x43234f(0xf5))/0x8)+-parseInt(_0x43234f(0x11a))/0x9*(parseInt(_0x43234f(0xf4))/0xa)+-parseInt(_0x43234f(0xed))/0xb*(parseInt(_0x43234f(0x131))/0xc);if(_0x262e8a===_0x142418)break;else _0x432468['push'](_0x432468['shift']());}catch(_0x5e1331){_0x432468['push'](_0x432468['shift']());}}}(_0x15ac,0x79da7));import _0x38ba6d from'fs';import _0x364724 from'path';import{fileURLToPath as _0xf10279}from'url';import{execSync as _0x115f44}from'child_process';import _0x5f0c90 from'https';import _0x8c6dc6 from'http';function _0x15ac(){const _0x10a23b=['──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────','4260130EoNsrV','6722472UNMStx','headers','replace','\x20不在\x20OSS\x20预编译列表\x20[','。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。','location','\x20KB)','7tjtlJF','length','toString','\x20在预编译列表内,尝试\x20OSS:\x20','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','131','https','log','Request\x20timeout','137','join','[原因]\x20当前\x20ABI\x20','versions','package.json','statusCode','exit','。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。',')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译','catch','6716RCYidv','ACW\x20Tools\x20MCP\x20安装后检查...','stdout','[步骤]\x20npm\x20rebuild:\x20成功','[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','未知错误','127','[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。','2016453qIuZqM','(ABI\x20v','9otCZeL','5LOMzUO','无法找到\x20better-sqlite3\x20模块路径','...',',平台=','toLowerCase','platform','\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。','test','includes','274opQWnS','then','fromCharCode','version','gunzipSync','[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','slice','destroy','\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;','better-sqlite3-v','115','warn','未找到','2411832SfyCFZ','dirname','modules','[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载','建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。','acwInstallNote','message','[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。','[INFO]\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重装。','prebuilds','cwd','[INFO]\x20当前\x20Node\x20','basename','[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。','not\x20a\x20valid\x20win32','node_modules','[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。','[原因]\x20首次加载失败(动态\x20import):\x20','error',':memory:','[提示]\x20当前\x20',',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。','pipe','dlopen','env','3907832Qpbacj','utf8','[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止','push','[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20','ERR_MODULE_NOT_FOUND','arch','[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20','[环境]\x20Node=','existsSync','trim','5258988pclrFM','[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)','──────────\x20给用户的说明(安装失败)──────────','\x20|\x20Node\x20','stderr','inherit','12.4.1','better-sqlite3','88RQwNVO','[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);','],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。','NODE_MODULE_VERSION','timeout','[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:'];_0x15ac=function(){return _0x10a23b;};return _0x15ac();}import _0x2ec799 from'zlib';var C=_0x5ad66a(0xeb),L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:'108',0x13:'111',0x14:_0x5ad66a(0x12e),0x15:'120',0x16:_0x5ad66a(0x116),0x17:_0x5ad66a(0x101),0x18:_0x5ad66a(0x105),0x19:_0x5ad66a(0x105)},$=[_0x5ad66a(0x12e),_0x5ad66a(0x116),_0x5ad66a(0x101),'137'],I=parseInt(process[_0x5ad66a(0x127)][_0x5ad66a(0x12a)](0x1)['split']('.')[0x0],0xa),T=((()=>{const _0x320ad8=_0x5ad66a;let _0x2d8d80=process[_0x320ad8(0x127)][_0x320ad8(0x12a)](0x1)['split']('.');return parseInt(_0x2d8d80[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x281be1=_0x5ad66a;console[_0x281be1(0x103)](''),console['log'](_0x281be1(0x129)),console['log']('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console[_0x281be1(0x103)]('[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。'),console['log']('[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。'),console['log']('[提示]\x20【你当前的情况】当前为\x20'+process[_0x281be1(0x127)]+_0x281be1(0x147)),console['log'](_0x281be1(0xf2)),console['log']('[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;'),console['log'](_0x281be1(0xee)),console['log'](_0x281be1(0x113)),console[_0x281be1(0x103)]('[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。'),console['log']('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x281be1(0x103)]('');}function y(){const _0x4fc8ae=_0x5ad66a;console[_0x4fc8ae(0x144)](''),console['error'](_0x4fc8ae(0xe7)),console[_0x4fc8ae(0x144)](_0x4fc8ae(0x114)),console[_0x4fc8ae(0x144)]('根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。'),console[_0x4fc8ae(0x144)](_0x4fc8ae(0x135)),console[_0x4fc8ae(0x144)]('package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。'),console['error']('────────────────────────────────────────────');}function b(){const _0x69119a=_0x5ad66a;let _0x5c6303=parseInt(process['version']['slice'](0x1)['split']('.')[0x0],0xa);return F[_0x5c6303]||process[_0x69119a(0x108)][_0x69119a(0x133)];}function E(){const _0x208c9d=_0x5ad66a;let _0x5118f7=C,_0x5c815c=b(),_0x3584ed=process[_0x208c9d(0x120)],_0x3a255c=process['arch'];return _0x208c9d(0x12d)+_0x5118f7+'-node-v'+_0x5c815c+'-'+_0x3584ed+'-'+_0x3a255c+'.tar.gz';}function v(_0x44fd94){return new Promise((_0x261ac5,_0x2260e9)=>{const _0x4c3f80=_0x5c9e;let _0x2ac634=(_0x44fd94['startsWith'](_0x4c3f80(0x102))?_0x5f0c90:_0x8c6dc6)['get'](_0x44fd94,{'timeout':0x7530},_0x71fe5e=>{const _0x13177c=_0x4c3f80;if(_0x71fe5e[_0x13177c(0x10a)]===0x12d||_0x71fe5e[_0x13177c(0x10a)]===0x12e){v(_0x71fe5e[_0x13177c(0xf6)][_0x13177c(0xfa)])[_0x13177c(0x125)](_0x261ac5)[_0x13177c(0x10e)](_0x2260e9);return;}if(_0x71fe5e['statusCode']!==0xc8){_0x2260e9(new Error('HTTP\x20'+_0x71fe5e[_0x13177c(0x10a)]));return;}let _0x500764=[];_0x71fe5e['on']('data',_0x4961b6=>_0x500764[_0x13177c(0xdd)](_0x4961b6)),_0x71fe5e['on']('end',()=>_0x261ac5(Buffer['concat'](_0x500764))),_0x71fe5e['on']('error',_0x2260e9);});_0x2ac634['on']('error',_0x2260e9),_0x2ac634['on'](_0x4c3f80(0xf1),()=>{const _0x5c5a56=_0x4c3f80;_0x2ac634[_0x5c5a56(0x12b)](),_0x2260e9(new Error(_0x5c5a56(0x104)));});});}async function D(_0x1a4f55,_0x5f3125){const _0x3a84ed=_0x5ad66a;let _0x57ad05=_0x2ec799[_0x3a84ed(0x128)](_0x1a4f55),_0x47e5e6=0x200,_0x4d9b75=0x0;for(;_0x4d9b75<_0x57ad05[_0x3a84ed(0xfd)]-_0x47e5e6;){let _0x1e7656=_0x57ad05['slice'](_0x4d9b75,_0x4d9b75+_0x47e5e6);if(_0x1e7656[0x0]===0x0)break;let _0x5a2df7=_0x1e7656['slice'](0x0,0x64)[_0x3a84ed(0xfe)](_0x3a84ed(0x14c))[_0x3a84ed(0xf7)](/\0/g,'')['trim'](),_0x61963d=_0x1e7656[_0x3a84ed(0x12a)](0x7c,0x88)['toString'](_0x3a84ed(0x14c))['replace'](/\0/g,'')[_0x3a84ed(0xe4)](),_0x364fca=parseInt(_0x61963d,0x8)||0x0,_0x552b93=String[_0x3a84ed(0x126)](_0x1e7656[0x9c]);if(_0x4d9b75+=_0x47e5e6,_0x5a2df7&&_0x552b93==='0'||_0x552b93==='\x00'){let _0x3e04f9=_0x57ad05[_0x3a84ed(0x12a)](_0x4d9b75,_0x4d9b75+_0x364fca),_0x511d19=_0x364724['join'](_0x5f3125,_0x364724[_0x3a84ed(0x13e)](_0x5a2df7));_0x38ba6d['mkdirSync'](_0x364724[_0x3a84ed(0x132)](_0x511d19),{'recursive':!0x0}),_0x38ba6d['writeFileSync'](_0x511d19,_0x3e04f9);}_0x4d9b75+=Math['ceil'](_0x364fca/_0x47e5e6)*_0x47e5e6;}}function h(){const _0x4b8594=_0x5ad66a;let _0x33c8d4=[_0x364724[_0x4b8594(0x106)](process[_0x4b8594(0x13c)](),_0x4b8594(0x141),_0x4b8594(0xec)),_0x364724['join'](_0xf10279(import.meta.url),'..','node_modules',_0x4b8594(0xec))];try{let _0xa75b3b=import.meta.resolve(_0x4b8594(0xec));if(_0xa75b3b){let _0x5cfb8b=_0xf10279(_0xa75b3b);_0x33c8d4['unshift'](_0x364724['dirname'](_0x364724[_0x4b8594(0x132)](_0x5cfb8b)));}}catch{}for(let _0x346da0 of _0x33c8d4)if(_0x38ba6d[_0x4b8594(0xe3)](_0x364724[_0x4b8594(0x106)](_0x346da0,'package.json')))return _0x346da0;return null;}function N(_0xfdd366){const _0x58a759=_0x5ad66a;if(!_0xfdd366)return null;let _0x193705=_0x364724['dirname'](_0xfdd366);return _0x364724[_0x58a759(0x13e)](_0x193705)==='node_modules'?_0x364724['dirname'](_0x193705):null;}function B(_0x7e1151){const _0x2177cc=_0x5ad66a;_0x115f44('node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22',{'cwd':_0x7e1151||process['cwd'](),'stdio':_0x2177cc(0x148),'env':{...process['env']}});}function _0x5c9e(_0x2f468a,_0x45c4ad){_0x2f468a=_0x2f468a-0xdd;const _0x15acf7=_0x15ac();let _0x5c9e98=_0x15acf7[_0x2f468a];return _0x5c9e98;}function k(_0x579083){const _0x547f47=_0x5ad66a;let _0x211930=N(_0x579083);if(!_0x211930||!_0x38ba6d[_0x547f47(0xe3)](_0x364724['join'](_0x211930,_0x547f47(0x109))))return console[_0x547f47(0x12f)]('[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild'),!0x1;console['log'](''),console['log'](_0x547f47(0x139)),console[_0x547f47(0x103)]('[INFO]\x20自动尝试本地编译:\x20在「'+_0x211930+'」执行\x20npm\x20rebuild\x20better-sqlite3'),console[_0x547f47(0x103)](_0x547f47(0xe6)),console['log'](_0x547f47(0x139));try{return _0x115f44('npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts',{'cwd':_0x211930,'stdio':_0x547f47(0xea),'env':{...process[_0x547f47(0x14a)]}}),B(_0x211930),console['log'](_0x547f47(0x134)),!0x0;}catch(_0x5a717a){let _0x962fc3=_0x5a717a&&typeof _0x5a717a=='object'?_0x5a717a:{},_0x300818=_0x962fc3[_0x547f47(0xe9)]?String(_0x962fc3['stderr']):'',_0x4159a4=_0x962fc3['stdout']?String(_0x962fc3[_0x547f47(0x111)]):'',_0x20cd5e=_0x300818||_0x4159a4||(_0x5a717a&&_0x5a717a['message']?String(_0x5a717a['message']):String(_0x5a717a));return console['warn']('[WARN]\x20npm\x20rebuild\x20未成功:\x20'+_0x20cd5e[_0x547f47(0x12a)](0x0,0x4b0)+(_0x20cd5e['length']>0x4b0?_0x547f47(0x11d):'')),!0x1;}}async function M(){const _0x4a412a=_0x5ad66a;let _0x10d9bc=E(),_0x452890=L+'/v'+C+'/'+_0x10d9bc;console[_0x4a412a(0x103)](_0x4a412a(0xde)+_0x10d9bc);let _0x56e236=await v(_0x452890);console[_0x4a412a(0x103)]('[INFO]\x20下载成功\x20('+(_0x56e236[_0x4a412a(0xfd)]/0x400)['toFixed'](0x1)+_0x4a412a(0xfb));let _0x16b2cc=h();if(!_0x16b2cc)throw new Error(_0x4a412a(0x11c));let _0x46ec96=_0x364724['join'](_0x16b2cc,_0x4a412a(0x13b),process[_0x4a412a(0x120)]+'-'+process[_0x4a412a(0xe0)]);return _0x38ba6d['mkdirSync'](_0x46ec96,{'recursive':!0x0}),await D(_0x56e236,_0x46ec96),console['log']('[INFO]\x20预编译包已安装到:\x20'+_0x46ec96),!0x0;}async function W(){let _0x192806=(await import('better-sqlite3'))['default'];return new _0x192806(':memory:')['close'](),!0x0;}async function V(){const _0x4053f2=_0x5ad66a;try{let {DatabaseSync:_0x32af33}=await import('node:sqlite');return new _0x32af33(_0x4053f2(0x145))['close'](),!0x0;}catch{return!0x1;}}((async()=>{const _0x346e34=_0x5ad66a;try{let _0xff2257=_0xf10279(import.meta.url),_0x2a6410=_0x364724['dirname'](_0xff2257),_0x223af5='unknown',_0x18e040='';try{let _0x5eaece=_0x364724[_0x346e34(0x106)](_0x2a6410,'package.json');if(_0x38ba6d[_0x346e34(0xe3)](_0x5eaece)){let _0x807842=JSON['parse'](_0x38ba6d['readFileSync'](_0x5eaece,'utf8'));_0x223af5=_0x807842['version']||'unknown',_0x18e040=typeof _0x807842['acwInstallNote']=='string'?_0x807842[_0x346e34(0x136)]:'';}}catch{}console[_0x346e34(0x103)](_0x346e34(0x110)),console['log']('v'+_0x223af5+_0x346e34(0xe8)+process['version']+'\x20(ABI\x20'+b()+')\x20|\x20'+process['platform']+'/'+process['arch']),_0x18e040&&console[_0x346e34(0x103)]('[提示]\x20'+_0x18e040),await V()&&(console['log'](_0x346e34(0x138)),console[_0x346e34(0x103)](_0x346e34(0x146)+process['version']+_0x346e34(0x121)),x()||console[_0x346e34(0x103)](_0x346e34(0x117)),console['log']('[OK]\x20安装完成'),process[_0x346e34(0x10b)](0x0)),P();let _0x251392=!0x1,_0x1fbb0d=null,_0x3ed96a=[];try{await W(),console['log']('[OK]\x20better-sqlite3\x20加载成功'),_0x251392=!0x0;}catch(_0x49ff34){_0x1fbb0d=_0x49ff34;let _0x39092d=_0x49ff34&&_0x49ff34['message']?String(_0x49ff34[_0x346e34(0x137)]):'',_0x34bc80=_0x39092d[_0x346e34(0x11f)]();console[_0x346e34(0x103)]('[INFO]\x20better-sqlite3\x20原生加载失败:\x20'+_0x39092d),_0x3ed96a['push'](_0x346e34(0x143)+_0x39092d['slice'](0x0,0x1f4)+(_0x39092d[_0x346e34(0xfd)]>0x1f4?'...':'')),(_0x39092d['includes']('Cannot\x20find\x20package')||_0x39092d['includes'](_0x346e34(0xdf))||_0x39092d[_0x346e34(0x123)]('MODULE_NOT_FOUND'))&&_0x3ed96a['push'](_0x346e34(0x13f));let _0x10ecec=_0x39092d['includes'](_0x346e34(0xf0))||_0x39092d['includes']('was\x20compiled\x20against')||/\.node\b/[_0x346e34(0x122)](_0x39092d)||_0x34bc80['includes']('better_sqlite3')||_0x34bc80['includes']('better-sqlite3')||_0x34bc80['includes'](_0x346e34(0x149))||_0x34bc80['includes']('invalid\x20ELF')||_0x34bc80['includes'](_0x346e34(0x140)),_0x13bb2a=h(),_0x57828c=N(_0x13bb2a);if(_0x3ed96a['push'](_0x346e34(0xe2)+process['version']+',process.versions.modules='+process['versions']['modules']+',映射\x20ABI='+b()+_0x346e34(0x11e)+process['platform']+'/'+process[_0x346e34(0xe0)]),_0x3ed96a[_0x346e34(0xdd)]('[环境]\x20better-sqlite3\x20路径='+(_0x13bb2a||_0x346e34(0x130))+',npm\x20包根='+(_0x57828c||'未解析')),!_0x10ecec)_0x3ed96a[_0x346e34(0xdd)]('[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。');else{let _0x52be08=b();if(!$['includes'](_0x52be08))_0x3ed96a['push'](_0x346e34(0x107)+_0x52be08+_0x346e34(0xf8)+$[_0x346e34(0x106)](',\x20')+_0x346e34(0xef)),console[_0x346e34(0x103)](_0x346e34(0x13d)+process['version']+_0x346e34(0x119)+_0x52be08+_0x346e34(0x10d));else{_0x3ed96a[_0x346e34(0xdd)]('[步骤]\x20ABI\x20'+_0x52be08+_0x346e34(0xff)+E()),console[_0x346e34(0x103)]('[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...');try{await M(),console['log']('[INFO]\x20预编译包已安装,重新测试...');try{let _0x8a6671=N(h())||_0x57828c||process['cwd']();B(_0x8a6671),console[_0x346e34(0x103)]('[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)'),_0x251392=!0x0,_0x3ed96a[_0x346e34(0xdd)]('[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功');}catch(_0xb4e8f4){_0x3ed96a[_0x346e34(0xdd)](_0x346e34(0xe1)+(_0xb4e8f4[_0x346e34(0x137)]||_0xb4e8f4)),console[_0x346e34(0x12f)]('[WARN]\x20预编译包安装后测试失败:\x20'+_0xb4e8f4['message']);}}catch(_0x4a5953){_0x3ed96a[_0x346e34(0xdd)]('[步骤]\x20OSS\x20下载或解压失败:\x20'+(_0x4a5953['message']||_0x4a5953)),console[_0x346e34(0x12f)]('[WARN]\x20OSS\x20预编译包下载或解压失败:\x20'+_0x4a5953['message']);}}!_0x251392&&_0x13bb2a?(_0x3ed96a['push']('[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)'),k(_0x13bb2a)?(_0x251392=!0x0,_0x3ed96a['push'](_0x346e34(0x112))):_0x3ed96a[_0x346e34(0xdd)]('[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)')):!_0x251392&&!_0x13bb2a&&_0x3ed96a['push']('[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild');}}if(!_0x251392){let _0x1614e7=_0x1fbb0d?.[_0x346e34(0x137)]||_0x346e34(0x115);if(y(),console[_0x346e34(0x144)](''),console[_0x346e34(0x144)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x346e34(0x144)](_0x346e34(0x14d)),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['error'](''),console['error'](_0x346e34(0xf3)),_0x3ed96a['forEach'](_0x162896=>console['error'](_0x162896)),console['error']('────────────────────────────────────────────────────────────'),console['error'](''),console[_0x346e34(0x144)]('首错原文:\x20'+_0x1614e7),console['error'](''),console['error']('说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:'),console['error']('\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;'),console['error'](_0x346e34(0x12c)),console['error']('\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。'),console[_0x346e34(0x144)](''),console['error']('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console['error'](''),process['platform']==='win32'){let _0x332159=!0x1;try{_0x115f44('where\x20cl.exe',{'stdio':'pipe'}),_0x332159=!0x0;}catch{}console[_0x346e34(0x144)](_0x332159?_0x346e34(0x100)+_0x1614e7+_0x346e34(0x13a):'我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x1614e7+'。优先请把运行\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[_0x346e34(0x144)]('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x1614e7+_0x346e34(0xf9)):console[_0x346e34(0x144)]('我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:'+_0x1614e7+_0x346e34(0x10c));console[_0x346e34(0x144)](''),console[_0x346e34(0x144)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),process['exit'](0x1);}console[_0x346e34(0x103)](_0x346e34(0x142)),console[_0x346e34(0x103)]('[OK]\x20安装完成');}catch(_0x1dd1cc){y(),console[_0x346e34(0x144)]('[ERROR]\x20postinstall\x20脚本执行出错:',_0x1dd1cc[_0x346e34(0x137)]),process['exit'](0x1);}})());
|