@bangdao-ai/acw-tools 1.13.12 → 1.13.13
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/claudeCodeParser.js +1 -1
- package/cursorConversationParser.js +1 -1
- package/index.js +1 -1
- package/manifest.json +2 -1
- package/package.json +1 -1
- package/postinstall.js +1 -1
package/manifest.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ACW工具集",
|
|
3
3
|
"description": "ACW平台工具集:智能下载规则/技能到项目、上传技能到Skills广场、搜索技能、检查技能更新、上传/下载/检索个人知识库",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.13",
|
|
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",
|
|
8
8
|
"capabilities": [
|
|
9
9
|
"check_acw_connection",
|
|
10
|
+
"acw_mcp_status",
|
|
10
11
|
"download_rule",
|
|
11
12
|
"download_skill",
|
|
12
13
|
"upload_skill",
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const _0x37e7f7=_0x1fe1;(function(_0x4a10ee,_0x522505){const _0x15398b=_0x1fe1,_0x5037b2=_0x4a10ee();while(!![]){try{const _0x1e0d78=parseInt(_0x15398b(0x14c))/0x1+-parseInt(_0x15398b(0x1b0))/0x2*(parseInt(_0x15398b(0x158))/0x3)+parseInt(_0x15398b(0x192))/0x4*(-parseInt(_0x15398b(0x1bd))/0x5)+-parseInt(_0x15398b(0x1a0))/0x6*(parseInt(_0x15398b(0x19d))/0x7)+-parseInt(_0x15398b(0x17b))/0x8+parseInt(_0x15398b(0x171))/0x9+parseInt(_0x15398b(0x1bf))/0xa;if(_0x1e0d78===_0x522505)break;else _0x5037b2['push'](_0x5037b2['shift']());}catch(_0x1c05df){_0x5037b2['push'](_0x5037b2['shift']());}}}(_0x58bc,0x21672));import _0x4f81f7 from'fs';import _0x517910 from'path';function _0x58bc(){const _0x3f9d72=['MODULE_NOT_FOUND','platform','node_modules','505508hdNcSe','dlopen','exit','[INFO]\x20预编译包已安装,重新测试...',')\x20|\x20',',npm\x20包根=','[OK]\x20npm\x20rebuild\x20成功,better-sqlite3\x20已可加载','package.json','.tar.gz','...','https','235487dAoygs','说明:\x20已尝试\x20OSS\x20预编译与\x20npm\x20rebuild。仍失败时:务必把运行\x20npx\x20的\x20Node\x20升到\x2022.5+(内置\x20SQLite,从根上避免本问题)。其余检查:','────────────────────────────────────────────','6PLgWmr','[原因]\x20首次加载失败(动态\x20import):\x20','我的\x20ACW\x20MCP\x20安装失败(better-sqlite3\x20/\x20原生模块),错误:','[步骤]\x20OSS\x20下载或解压失败:\x20','win32','-node-v','arch','[提示]\x20【你当前的情况】当前为\x20','was\x20compiled\x20against',':memory:','本步骤失败,几乎总是「可选依赖\x20better-sqlite3」的原生模块无法在您当前环境加载或编译。','parse','npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts','\x20满足「内置\x20SQLite」路径:对话抓取不依赖\x20better-sqlite3,Windows\x20上无需\x20VS\x20Build\x20Tools\x20即可避免「模块编译失败」。','toString','[步骤]\x20npm\x20rebuild:\x20失败(见上方日志,多为缺少\x20cl.exe\x20/\x20Xcode\x20Command\x20Line\x20Tools\x20/\x20build-essential)','126828qeXltf','[OK]\x20better-sqlite3\x20修复成功(OSS\x20预编译)','error','version','。优先将\x20Node\x20升到\x2022.5+。否则\x20xcode-select\x20--install\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。','[WARN]\x20预编译包安装后测试失败:\x20','length','[提示]\x20【推荐环境】请使用\x20Node.js\x2022.5\x20及以上(LTS\x2022\x20的最新小版本即可)。','\x20在预编译列表内,尝试\x20OSS:\x20','acwInstallNote','versions','[INFO]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','stderr','5FlrvAS','better-sqlite3','1689350KJGNWP','split','Request\x20timeout','object','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','stdout','211821kLehXD','writeFileSync','\x20\x202)\x20若必须留在旧\x20Node:安装\x20C++\x20工具链后在包根目录执行\x20npm\x20rebuild\x20better-sqlite3\x20--foreground-scripts;','get','\x20\x203)\x20再执行\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','108','end','。优先请把运行\x20npx\x20的\x20Node\x20升级到\x2022.5\x20以上(免装\x20VS\x20Build\x20Tools)。否则请安装\x20Visual\x20Studio\x20Build\x20Tools\x20后再\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools。','where\x20cl.exe','根因:它需要与本机\x20Node\x20版本匹配的\x20C++\x20二进制;Windows\x20上缺\x20VS\x20Build\x20Tools\x20时极易报错。','[WARN]\x20无法确定\x20npm\x20包根目录,跳过\x20npm\x20rebuild','string','3jkYfcT','[INFO]\x20尝试从\x20OSS\x20下载预编译包:\x20','data','HTTP\x20','NODE_MODULE_VERSION','test','node:sqlite','[原因]\x20当前\x20ABI\x20','unknown','111','pipe','[原因]\x20better-sqlite3\x20未安装到位(多为\x20optional\x20依赖下载或编译失败);在\x20Node\x20低于\x2022.5\x20且无内置\x20SQLite\x20时会导致本步失败。','[步骤]\x20npm\x20rebuild:\x20成功','[提示]\x20当前\x20','warn','[INFO]\x20自动尝试本地编译:\x20在「','existsSync','[环境]\x20Node=',',平台=','ERR_MODULE_NOT_FOUND','[INFO]\x20(需本机已有\x20C++\x20构建环境;Windows\x20为\x20VS\x20Build\x20Tools,macOS\x20为\x20Xcode\x20CLT,Linux\x20为\x20build-essential)','[提示]\x20\x20\x20该版本起\x20Node\x20内置「node:sqlite」,安装时无需\x20better-sqlite3,Windows\x20上可避免出现「模块编译失败」。','127','115',')无对应\x20OSS\x20预编译包,跳过\x20OSS,将尝试本机编译','2207538tjRQEg','[步骤]\x20未找到\x20better-sqlite3\x20目录,无法执行\x20npm\x20rebuild','mkdirSync','未找到','137','未解析','utf8','darwin','dirname','[OK]\x20安装完成','2126304lnJtPK','[WARN]\x20npm\x20rebuild\x20未成功:\x20','[INFO]\x20better-sqlite3\x20原生加载失败:\x20','headers','(ABI\x20v','message','\x20(ABI\x20','slice','join','──────────\x20给用户的说明(安装失败)──────────','log','[INFO]\x20预编译包已安装到:\x20','\x20KB)','includes','──────────\x20诊断摘要(请整段复制给支持人员或\x20Cursor)──────────','push','forEach','modules','cwd','[提示]\x20【解决办法优先级】①\x20将运行\x20npx\x20的\x20Node\x20升级到\x2022.5+(最省事);②\x20安装对应系统的\x20C++\x20编译环境后再装本包;③\x20确保\x20Cursor\x20/\x20终端使用同一份\x20Node,避免\x20ABI\x20混用。'];_0x58bc=function(){return _0x3f9d72;};return _0x58bc();}import{fileURLToPath as _0x1c85ec}from'url';import{execSync as _0x3049e6}from'child_process';function _0x1fe1(_0x2f8e22,_0x4646a2){_0x2f8e22=_0x2f8e22-0x14a;const _0x58bc9b=_0x58bc();let _0x1fe1a5=_0x58bc9b[_0x2f8e22];return _0x1fe1a5;}import _0x3de89a from'https';import _0x7c83a2 from'http';import _0x47c2ee from'zlib';var C='12.4.1',L='https://bd-acw.oss-cn-beijing.aliyuncs.com/prebuilds/better-sqlite3',F={0x12:_0x37e7f7(0x151),0x13:_0x37e7f7(0x161),0x14:_0x37e7f7(0x16f),0x15:'120',0x16:'127',0x17:'131',0x18:_0x37e7f7(0x175),0x19:_0x37e7f7(0x175)},$=[_0x37e7f7(0x16f),_0x37e7f7(0x16e),'131','137'],I=parseInt(process[_0x37e7f7(0x1b3)]['slice'](0x1)['split']('.')[0x0],0xa),T=((()=>{const _0x75ff62=_0x37e7f7;let _0x3107ff=process[_0x75ff62(0x1b3)]['slice'](0x1)['split']('.');return parseInt(_0x3107ff[0x1]||'0',0xa);})());function x(){return I>0x16||I===0x16&&T>=0x5;}function P(){const _0x3ef1f7=_0x37e7f7;console[_0x3ef1f7(0x185)](''),console[_0x3ef1f7(0x185)]('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x3ef1f7(0x185)]('[提示]\x20【本包为什么要动\x20SQLite】需要读取\x20Cursor\x20本地的\x20state.vscdb(对话与\x20composer\x20数据)。'),console[_0x3ef1f7(0x185)](_0x3ef1f7(0x1b7)),console['log'](_0x3ef1f7(0x16d)),console['log'](_0x3ef1f7(0x1a7)+process[_0x3ef1f7(0x1b3)]+',未检测到可用的内置\x20node:sqlite(或运行时被禁用),因此走可选依赖\x20better-sqlite3。'),console['log']('[提示]\x20【为什么会编译失败】better-sqlite3\x20含\x20C++\x20扩展(.node\x20文件)。常见原因:'),console['log']('[提示]\x20\x20\x20·\x20Windows:未安装\x20Visual\x20Studio\x20Build\x20Tools(缺\x20cl.exe),node-gyp\x20无法编译;'),console['log']('[提示]\x20\x20\x20·\x20任意系统:执行\x20npx\x20的\x20Node\x20版本与当初编译该模块的\x20Node\x20ABI\x20不一致(报\x20NODE_MODULE_VERSION\x20/\x20was\x20compiled\x20against);'),console['log']('[提示]\x20\x20\x20·\x20公司网络拦截导致预编译包下载失败,被迫本地编译但本机无工具链。'),console[_0x3ef1f7(0x185)](_0x3ef1f7(0x18e)),console['log']('[提示]\x20━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['log']('');}function y(){const _0x581cd5=_0x37e7f7;console[_0x581cd5(0x1b2)](''),console['error'](_0x581cd5(0x184)),console['error'](_0x581cd5(0x1aa)),console[_0x581cd5(0x1b2)](_0x581cd5(0x155)),console[_0x581cd5(0x1b2)]('建议:将运行「npx\x20@bangdao-ai/acw-tools」的\x20Node\x20升级到\x2022.5\x20及以上,本包将改用内置\x20SQLite,一般不再需要编译。'),console['error']('package.json\x20中\x20engines\x20为\x20node>=20;要免编译、少踩坑,请以\x2022.5+\x20为准。'),console[_0x581cd5(0x1b2)](_0x581cd5(0x19f));}function b(){const _0x2a5229=_0x37e7f7;let _0x5f7ca4=parseInt(process[_0x2a5229(0x1b3)][_0x2a5229(0x182)](0x1)[_0x2a5229(0x1c0)]('.')[0x0],0xa);return F[_0x5f7ca4]||process[_0x2a5229(0x1ba)][_0x2a5229(0x18c)];}function E(){const _0x2b7864=_0x37e7f7;let _0x451ad2=C,_0x3133f2=b(),_0x2d8850=process[_0x2b7864(0x190)],_0x51a438=process[_0x2b7864(0x1a6)];return'better-sqlite3-v'+_0x451ad2+_0x2b7864(0x1a5)+_0x3133f2+'-'+_0x2d8850+'-'+_0x51a438+_0x2b7864(0x19a);}function v(_0x1914fc){return new Promise((_0x2b0df6,_0x2e46a8)=>{const _0x39f79c=_0x1fe1;let _0x936533=(_0x1914fc['startsWith'](_0x39f79c(0x19c))?_0x3de89a:_0x7c83a2)[_0x39f79c(0x14f)](_0x1914fc,{'timeout':0x7530},_0x4fcd30=>{const _0x7101d5=_0x39f79c;if(_0x4fcd30['statusCode']===0x12d||_0x4fcd30['statusCode']===0x12e){v(_0x4fcd30[_0x7101d5(0x17e)]['location'])['then'](_0x2b0df6)['catch'](_0x2e46a8);return;}if(_0x4fcd30['statusCode']!==0xc8){_0x2e46a8(new Error(_0x7101d5(0x15b)+_0x4fcd30['statusCode']));return;}let _0x3df81d=[];_0x4fcd30['on'](_0x7101d5(0x15a),_0x4eadd0=>_0x3df81d[_0x7101d5(0x18a)](_0x4eadd0)),_0x4fcd30['on'](_0x7101d5(0x152),()=>_0x2b0df6(Buffer['concat'](_0x3df81d))),_0x4fcd30['on']('error',_0x2e46a8);});_0x936533['on']('error',_0x2e46a8),_0x936533['on']('timeout',()=>{const _0x11753d=_0x39f79c;_0x936533['destroy'](),_0x2e46a8(new Error(_0x11753d(0x1c1)));});});}async function D(_0x50e4af,_0x5962c6){const _0x1a2b4f=_0x37e7f7;let _0x2a8555=_0x47c2ee['gunzipSync'](_0x50e4af),_0x417e63=0x200,_0x3628dd=0x0;for(;_0x3628dd<_0x2a8555['length']-_0x417e63;){let _0x500cc1=_0x2a8555['slice'](_0x3628dd,_0x3628dd+_0x417e63);if(_0x500cc1[0x0]===0x0)break;let _0x53aec9=_0x500cc1[_0x1a2b4f(0x182)](0x0,0x64)[_0x1a2b4f(0x1ae)](_0x1a2b4f(0x177))['replace'](/\0/g,'')['trim'](),_0x4462c1=_0x500cc1['slice'](0x7c,0x88)[_0x1a2b4f(0x1ae)]('utf8')['replace'](/\0/g,'')['trim'](),_0x1b9d85=parseInt(_0x4462c1,0x8)||0x0,_0x1d9ee3=String['fromCharCode'](_0x500cc1[0x9c]);if(_0x3628dd+=_0x417e63,_0x53aec9&&_0x1d9ee3==='0'||_0x1d9ee3==='\x00'){let _0x4619ea=_0x2a8555['slice'](_0x3628dd,_0x3628dd+_0x1b9d85),_0x533b00=_0x517910['join'](_0x5962c6,_0x517910['basename'](_0x53aec9));_0x4f81f7['mkdirSync'](_0x517910[_0x1a2b4f(0x179)](_0x533b00),{'recursive':!0x0}),_0x4f81f7[_0x1a2b4f(0x14d)](_0x533b00,_0x4619ea);}_0x3628dd+=Math['ceil'](_0x1b9d85/_0x417e63)*_0x417e63;}}function h(){const _0x3d3715=_0x37e7f7;let _0x1ae4a0=[_0x517910[_0x3d3715(0x183)](process[_0x3d3715(0x18d)](),_0x3d3715(0x191),_0x3d3715(0x1be)),_0x517910['join'](_0x1c85ec(import.meta.url),'..','node_modules','better-sqlite3')];try{let _0x2312dd=import.meta.resolve('better-sqlite3');if(_0x2312dd){let _0x1c8a1e=_0x1c85ec(_0x2312dd);_0x1ae4a0['unshift'](_0x517910[_0x3d3715(0x179)](_0x517910[_0x3d3715(0x179)](_0x1c8a1e)));}}catch{}for(let _0xe34084 of _0x1ae4a0)if(_0x4f81f7['existsSync'](_0x517910['join'](_0xe34084,_0x3d3715(0x199))))return _0xe34084;return null;}function N(_0x1cf3c1){if(!_0x1cf3c1)return null;let _0x5eae7d=_0x517910['dirname'](_0x1cf3c1);return _0x517910['basename'](_0x5eae7d)==='node_modules'?_0x517910['dirname'](_0x5eae7d):null;}function B(_0xab2bbd){const _0x4c3c78=_0x37e7f7;_0x3049e6('node\x20-e\x20\x22require(\x27better-sqlite3\x27)(\x27:memory:\x27).close()\x22',{'cwd':_0xab2bbd||process[_0x4c3c78(0x18d)](),'stdio':_0x4c3c78(0x162),'env':{...process['env']}});}function k(_0x338e2d){const _0x5ea1bc=_0x37e7f7;let _0xb4751b=N(_0x338e2d);if(!_0xb4751b||!_0x4f81f7['existsSync'](_0x517910['join'](_0xb4751b,_0x5ea1bc(0x199))))return console[_0x5ea1bc(0x166)](_0x5ea1bc(0x156)),!0x1;console['log'](''),console[_0x5ea1bc(0x185)](_0x5ea1bc(0x1bb)),console[_0x5ea1bc(0x185)](_0x5ea1bc(0x167)+_0xb4751b+'」执行\x20npm\x20rebuild\x20better-sqlite3'),console[_0x5ea1bc(0x185)](_0x5ea1bc(0x16c)),console[_0x5ea1bc(0x185)](_0x5ea1bc(0x1bb));try{return _0x3049e6(_0x5ea1bc(0x1ac),{'cwd':_0xb4751b,'stdio':'inherit','env':{...process['env']}}),B(_0xb4751b),console[_0x5ea1bc(0x185)](_0x5ea1bc(0x198)),!0x0;}catch(_0x464fa7){let _0x2e3158=_0x464fa7&&typeof _0x464fa7==_0x5ea1bc(0x1c2)?_0x464fa7:{},_0xc4e31b=_0x2e3158[_0x5ea1bc(0x1bc)]?String(_0x2e3158[_0x5ea1bc(0x1bc)]):'',_0x5df01b=_0x2e3158[_0x5ea1bc(0x14b)]?String(_0x2e3158[_0x5ea1bc(0x14b)]):'',_0x5b9f09=_0xc4e31b||_0x5df01b||(_0x464fa7&&_0x464fa7['message']?String(_0x464fa7[_0x5ea1bc(0x180)]):String(_0x464fa7));return console['warn'](_0x5ea1bc(0x17c)+_0x5b9f09['slice'](0x0,0x4b0)+(_0x5b9f09['length']>0x4b0?_0x5ea1bc(0x19b):'')),!0x1;}}async function M(){const _0x4f4735=_0x37e7f7;let _0x33b8fe=E(),_0x488837=L+'/v'+C+'/'+_0x33b8fe;console['log'](_0x4f4735(0x159)+_0x33b8fe);let _0x3d31df=await v(_0x488837);console[_0x4f4735(0x185)]('[INFO]\x20下载成功\x20('+(_0x3d31df['length']/0x400)['toFixed'](0x1)+_0x4f4735(0x187));let _0x52164d=h();if(!_0x52164d)throw new Error('无法找到\x20better-sqlite3\x20模块路径');let _0x1c05ca=_0x517910['join'](_0x52164d,'prebuilds',process['platform']+'-'+process['arch']);return _0x4f81f7[_0x4f4735(0x173)](_0x1c05ca,{'recursive':!0x0}),await D(_0x3d31df,_0x1c05ca),console[_0x4f4735(0x185)](_0x4f4735(0x186)+_0x1c05ca),!0x0;}async function W(){const _0x5a284d=_0x37e7f7;let _0x8fcf0c=(await import(_0x5a284d(0x1be)))['default'];return new _0x8fcf0c(':memory:')['close'](),!0x0;}async function V(){const _0x54083a=_0x37e7f7;try{let {DatabaseSync:_0x285a13}=await import(_0x54083a(0x15e));return new _0x285a13(_0x54083a(0x1a9))['close'](),!0x0;}catch{return!0x1;}}((async()=>{const _0x1d898c=_0x37e7f7;try{let _0x2caa86=_0x1c85ec(import.meta.url),_0x28d629=_0x517910['dirname'](_0x2caa86),_0xdcb50b=_0x1d898c(0x160),_0x159c5e='';try{let _0x47a357=_0x517910[_0x1d898c(0x183)](_0x28d629,'package.json');if(_0x4f81f7[_0x1d898c(0x168)](_0x47a357)){let _0x2ca160=JSON[_0x1d898c(0x1ab)](_0x4f81f7['readFileSync'](_0x47a357,_0x1d898c(0x177)));_0xdcb50b=_0x2ca160['version']||_0x1d898c(0x160),_0x159c5e=typeof _0x2ca160[_0x1d898c(0x1b9)]==_0x1d898c(0x157)?_0x2ca160[_0x1d898c(0x1b9)]:'';}}catch{}console['log']('ACW\x20Tools\x20MCP\x20安装后检查...'),console['log']('v'+_0xdcb50b+'\x20|\x20Node\x20'+process['version']+_0x1d898c(0x181)+b()+_0x1d898c(0x196)+process[_0x1d898c(0x190)]+'/'+process[_0x1d898c(0x1a6)]),_0x159c5e&&console[_0x1d898c(0x185)]('[提示]\x20'+_0x159c5e),await V()&&(console['log']('[OK]\x20已检测到\x20Node\x20内置\x20node:sqlite,安装检查通过。'),console[_0x1d898c(0x185)](_0x1d898c(0x165)+process['version']+_0x1d898c(0x1ad)),x()||console['log']('[提示]\x20说明:检测通过但主版本号低于文档推荐的\x2022.5+,若日后升级\x20Node,请以实际是否仍含\x20node:sqlite\x20为准。'),console['log'](_0x1d898c(0x17a)),process[_0x1d898c(0x194)](0x0)),P();let _0x1d7a23=!0x1,_0x3b5acc=null,_0x52a850=[];try{await W(),console[_0x1d898c(0x185)]('[OK]\x20better-sqlite3\x20加载成功'),_0x1d7a23=!0x0;}catch(_0x1f549b){_0x3b5acc=_0x1f549b;let _0x569889=_0x1f549b&&_0x1f549b['message']?String(_0x1f549b[_0x1d898c(0x180)]):'',_0x4f5541=_0x569889['toLowerCase']();console[_0x1d898c(0x185)](_0x1d898c(0x17d)+_0x569889),_0x52a850['push'](_0x1d898c(0x1a1)+_0x569889[_0x1d898c(0x182)](0x0,0x1f4)+(_0x569889[_0x1d898c(0x1b6)]>0x1f4?'...':'')),(_0x569889[_0x1d898c(0x188)]('Cannot\x20find\x20package')||_0x569889['includes'](_0x1d898c(0x16b))||_0x569889[_0x1d898c(0x188)](_0x1d898c(0x18f)))&&_0x52a850['push'](_0x1d898c(0x163));let _0x2e6036=_0x569889['includes'](_0x1d898c(0x15c))||_0x569889[_0x1d898c(0x188)](_0x1d898c(0x1a8))||/\.node\b/[_0x1d898c(0x15d)](_0x569889)||_0x4f5541['includes']('better_sqlite3')||_0x4f5541[_0x1d898c(0x188)]('better-sqlite3')||_0x4f5541['includes'](_0x1d898c(0x193))||_0x4f5541[_0x1d898c(0x188)]('invalid\x20ELF')||_0x4f5541['includes']('not\x20a\x20valid\x20win32'),_0x4b737e=h(),_0x13c459=N(_0x4b737e);if(_0x52a850['push'](_0x1d898c(0x169)+process['version']+',process.versions.modules='+process[_0x1d898c(0x1ba)]['modules']+',映射\x20ABI='+b()+_0x1d898c(0x16a)+process[_0x1d898c(0x190)]+'/'+process[_0x1d898c(0x1a6)]),_0x52a850[_0x1d898c(0x18a)]('[环境]\x20better-sqlite3\x20路径='+(_0x4b737e||_0x1d898c(0x174))+_0x1d898c(0x197)+(_0x13c459||_0x1d898c(0x176))),!_0x2e6036)_0x52a850[_0x1d898c(0x18a)]('[结论]\x20报错形态不像典型原生模块加载问题,未自动执行\x20OSS\x20/\x20rebuild,请根据完整堆栈排查。');else{let _0x43b483=b();if(!$[_0x1d898c(0x188)](_0x43b483))_0x52a850['push'](_0x1d898c(0x15f)+_0x43b483+'\x20不在\x20OSS\x20预编译列表\x20['+$['join'](',\x20')+'],不会下载预编译包(避免错配二进制)。将尝试本机\x20npm\x20rebuild。'),console['log']('[INFO]\x20当前\x20Node\x20'+process['version']+_0x1d898c(0x17f)+_0x43b483+_0x1d898c(0x170));else{_0x52a850['push']('[步骤]\x20ABI\x20'+_0x43b483+_0x1d898c(0x1b8)+E()),console[_0x1d898c(0x185)]('[INFO]\x20检测到原生模块加载异常,尝试从\x20OSS\x20拉取匹配当前\x20ABI\x20的预编译包...');try{await M(),console['log'](_0x1d898c(0x195));try{let _0x146170=N(h())||_0x13c459||process['cwd']();B(_0x146170),console[_0x1d898c(0x185)](_0x1d898c(0x1b1)),_0x1d7a23=!0x0,_0x52a850['push']('[步骤]\x20OSS\x20预编译\x20+\x20子进程校验:\x20成功');}catch(_0xccdbfa){_0x52a850[_0x1d898c(0x18a)]('[步骤]\x20OSS\x20预编译后子进程校验仍失败:\x20'+(_0xccdbfa[_0x1d898c(0x180)]||_0xccdbfa)),console[_0x1d898c(0x166)](_0x1d898c(0x1b5)+_0xccdbfa['message']);}}catch(_0x2afad7){_0x52a850[_0x1d898c(0x18a)](_0x1d898c(0x1a3)+(_0x2afad7['message']||_0x2afad7)),console['warn']('[WARN]\x20OSS\x20预编译包下载或解压失败:\x20'+_0x2afad7[_0x1d898c(0x180)]);}}!_0x1d7a23&&_0x4b737e?(_0x52a850['push']('[步骤]\x20执行自动\x20npm\x20rebuild\x20better-sqlite3(本机源码编译)'),k(_0x4b737e)?(_0x1d7a23=!0x0,_0x52a850[_0x1d898c(0x18a)](_0x1d898c(0x164))):_0x52a850['push'](_0x1d898c(0x1af))):!_0x1d7a23&&!_0x4b737e&&_0x52a850[_0x1d898c(0x18a)](_0x1d898c(0x172));}}if(!_0x1d7a23){let _0x110a9d=_0x3b5acc?.['message']||'未知错误';if(y(),console[_0x1d898c(0x1b2)](''),console['error'](_0x1d898c(0x14a)),console['error']('[ERROR]\x20better-sqlite3\x20模块加载失败,安装中止'),console['error']('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console['error'](''),console[_0x1d898c(0x1b2)](_0x1d898c(0x189)),_0x52a850[_0x1d898c(0x18b)](_0x11191f=>console[_0x1d898c(0x1b2)](_0x11191f)),console['error']('────────────────────────────────────────────────────────────'),console['error'](''),console[_0x1d898c(0x1b2)]('首错原文:\x20'+_0x110a9d),console['error'](''),console[_0x1d898c(0x1b2)](_0x1d898c(0x19e)),console[_0x1d898c(0x1b2)]('\x20\x201)\x20终端执行\x20node\x20-v\x20与\x20Cursor\x20调起\x20MCP\x20用的是否为同一\x20Node;'),console[_0x1d898c(0x1b2)](_0x1d898c(0x14e)),console[_0x1d898c(0x1b2)](_0x1d898c(0x150)),console[_0x1d898c(0x1b2)](''),console['error']('复制以下提示词发送给\x20Cursor,让\x20AI\x20帮你修复:'),console[_0x1d898c(0x1b2)](''),process['platform']===_0x1d898c(0x1a4)){let _0x4d789c=!0x1;try{_0x3049e6(_0x1d898c(0x154),{'stdio':'pipe'}),_0x4d789c=!0x0;}catch{}console['error'](_0x4d789c?_0x1d898c(0x1a2)+_0x110a9d+'。优先请把运行\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原生模块),错误:'+_0x110a9d+_0x1d898c(0x153));}else process['platform']===_0x1d898c(0x178)?console[_0x1d898c(0x1b2)](_0x1d898c(0x1a2)+_0x110a9d+_0x1d898c(0x1b4)):console['error'](_0x1d898c(0x1a2)+_0x110a9d+'。优先将\x20Node\x20升到\x2022.5+。否则\x20sudo\x20apt-get\x20install\x20build-essential\x20后\x20npm\x20install\x20-g\x20@bangdao-ai/acw-tools\x20重装。');console[_0x1d898c(0x1b2)](''),console[_0x1d898c(0x1b2)](_0x1d898c(0x14a)),process['exit'](0x1);}console['log']('[提示]\x20当前通过\x20better-sqlite3\x20完成检查。若希望免去原生依赖,可将\x20Node\x20升级到\x2022.5\x20及以上。'),console[_0x1d898c(0x185)]('[OK]\x20安装完成');}catch(_0x462443){y(),console[_0x1d898c(0x1b2)]('[ERROR]\x20postinstall\x20脚本执行出错:',_0x462443['message']),process[_0x1d898c(0x194)](0x1);}})());
|
|
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);}})());
|