@wujie-shell/core 3.0.2 → 4.0.0
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/dist/bin/wujie-shell.mjs +1 -1
- package/dist/src/agents/bundled-agent-skills.mjs +1 -1
- package/dist/src/agents/bundled-agents.mjs +1 -1
- package/dist/src/chat/media-archive.mjs +1 -1
- package/dist/src/chat/queue.mjs +1 -1
- package/dist/src/common/diagnostics.mjs +1 -1
- package/dist/src/common/logging.mjs +1 -1
- package/dist/src/common/runtime-logger.mjs +1 -1
- package/dist/src/common/user-events.mjs +1 -1
- package/dist/src/common/utils.mjs +1 -1
- package/dist/src/config/controller.mjs +1 -1
- package/dist/src/connectors/config-utils.mjs +1 -1
- package/dist/src/connectors/constants.mjs +1 -1
- package/dist/src/connectors/controller.mjs +1 -1
- package/dist/src/connectors/kdocs-cli.mjs +1 -1
- package/dist/src/electron/main.mjs +1 -1
- package/dist/src/electron/preload.mjs +1 -1
- package/dist/src/files/generated-files-store.mjs +1 -1
- package/dist/src/files/handlers.mjs +1 -1
- package/dist/src/gateway/chat-delta.mjs +1 -1
- package/dist/src/gateway/controller.mjs +1 -1
- package/dist/src/gateway/ws-client.mjs +1 -1
- package/dist/src/index.mjs +1 -1
- package/dist/src/log-reporting/handlers.mjs +1 -1
- package/dist/src/log-reporting/report-logs.mjs +1 -1
- package/dist/src/models/handlers.mjs +1 -1
- package/dist/src/preferences/store.mjs +1 -1
- package/dist/src/runtime/index.mjs +1 -1
- package/dist/src/runtime/patch-channel-plugin-runtime.mjs +1 -1
- package/dist/src/runtime/patch-chat-history-mixed-tool-content.mjs +1 -1
- package/dist/src/runtime/patch-session-store-sqlite.mjs +1 -1
- package/dist/src/runtime/plugin-sync.mjs +1 -1
- package/dist/src/sessions/agent-sessions-map-store.mjs +1 -1
- package/dist/src/sessions/runtime-bridge.mjs +1 -1
- package/dist/src/sessions/session-sqlite-store.mjs +1 -1
- package/dist/src/skills/import.mjs +1 -1
- package/dist/src/skills/market.mjs +1 -1
- package/dist/src/terminal/manager.mjs +1 -1
- package/dist/src/updates/controller.mjs +1 -1
- package/dist/src/updates/loader.mjs +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x565231,_0x5afe9a){const _0x3fe3d5=_0x2fb2,_0x4badbe=_0x565231();while(!![]){try{const _0x216e03=-parseInt(_0x3fe3d5(0x23d))/0x1*(-parseInt(_0x3fe3d5(0x23c))/0x2)+parseInt(_0x3fe3d5(0x3e0))/0x3+-parseInt(_0x3fe3d5(0x358))/0x4+parseInt(_0x3fe3d5(0x252))/0x5+-parseInt(_0x3fe3d5(0x32c))/0x6+-parseInt(_0x3fe3d5(0x34a))/0x7*(-parseInt(_0x3fe3d5(0x35d))/0x8)+-parseInt(_0x3fe3d5(0x267))/0x9;if(_0x216e03===_0x5afe9a)break;else _0x4badbe['push'](_0x4badbe['shift']());}catch(_0x3cbcbe){_0x4badbe['push'](_0x4badbe['shift']());}}}(_0x2fd5,0x2f07f));import{spawn}from'node:child_process';import{randomUUID}from'node:crypto';import{mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{homedir}from'node:os';import{dirname,join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'../common/utils.mjs';import{DEFAULT_FEISHU_REGISTRATION_ENV,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS,DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS,DINGTALK_DOC_MCP_SERVER_NAME,FEISHU_DOC_CONNECTOR_PLUGIN_ID,FEISHU_REGISTRATION_ENV_URLS,KDOCS_SKILL_ID,NETEASE_MAIL_CONNECTOR_PLUGIN_ID,QQBOT_PLUGIN_ID,QQ_MAIL_CONNECTOR_PLUGIN_ID,TENCENT_DOCS_SKILL_ID,TENCENT_DOCS_TOKEN_ENV,TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,WECOM_PLUGIN_ID,WECHAT_PLUGIN_ID}from'./constants.mjs';import{applyFeishuChannelConfig,createConnectorPluginEntry,createDingtalkDocMcpServerConfig,normalizeFeishuDmPolicy,normalizeFeishuGroupPolicy,readOpenClawMcpServersFromConfig,writeOpenClawMcpServersToConfig}from'./config-utils.mjs';const KDOCS_CLI_STEP_TIMEOUT_MS=0x2bf20,KDOCS_CLI_AUTH_POLL_INTERVAL_MS=0x5dc,FEISHU_DOC_CLI_STEP_TIMEOUT_MS=0xa*0x3c*0x3e8;function safeString(_0x22e38b){const _0x166d8d=_0x2fb2;return typeof _0x22e38b===_0x166d8d(0x2a0)?_0x22e38b[_0x166d8d(0x310)]():'';}function findDingtalkDocMcpServer(_0x5487fc){const _0xaf8acc=_0x2fb2,_0x2a418c=asRecord(_0x5487fc[DINGTALK_DOC_MCP_SERVER_NAME]);if(Object[_0xaf8acc(0x32d)](_0x2a418c)[_0xaf8acc(0x2d3)]>0x0)return _0x2a418c;for(const [_0x5ebe71,_0x3e1681]of Object[_0xaf8acc(0x2f9)](_0x5487fc)){const _0x3cb885=asRecord(_0x3e1681),_0x1f3239=getTrimmedString(_0x5ebe71)['toLowerC'+'ase'](),_0x364fdf=getTrimmedString(_0x3cb885[_0xaf8acc(0x348)])[_0xaf8acc(0x268)+'ase']();if(_0x1f3239[_0xaf8acc(0x3f2)](_0xaf8acc(0x318))||_0x1f3239[_0xaf8acc(0x3f2)](_0xaf8acc(0x293))||_0x1f3239[_0xaf8acc(0x3f2)]('钉钉')||_0x364fdf['includes'](_0xaf8acc(0x318))||_0x364fdf[_0xaf8acc(0x3f2)]('dingding'))return _0x3cb885;}return{};}function createFeishuRegistrationClient(){const _0x35420f=_0x2fb2,_0x5618bc=FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV];if(!_0x5618bc)throw new Error(_0x35420f(0x340)+_0x35420f(0x2d2)+_0x35420f(0x382)+_0x35420f(0x3be)+_0x35420f(0x39f)+DEFAULT_FEISHU_REGISTRATION_ENV);return{'baseUrl':_0x5618bc,'headers':{'Content-Type':_0x35420f(0x212)+'ion/x-ww'+'w-form-u'+'rlencode'+'d'},'timeoutMs':DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS};}async function postFeishuRegistration(_0x12b5a7,_0x473565){const _0x158c64=_0x2fb2,_0x41854a=await fetch(_0x12b5a7['baseUrl']+(_0x158c64(0x296)+'1/app/re'+'gistrati'+'on'),{'method':'POST','headers':_0x12b5a7[_0x158c64(0x224)],'body':new URLSearchParams(_0x473565)[_0x158c64(0x298)](),'signal':AbortSignal[_0x158c64(0x221)](_0x12b5a7['timeoutM'+'s'])}),_0x389197=await _0x41854a[_0x158c64(0x2a6)]()[_0x158c64(0x34f)](()=>({}));if(!_0x41854a['ok']){const _0x73072d=new Error('HTTP\x20'+_0x41854a['status']);_0x73072d['response'+_0x158c64(0x39b)]=_0x389197;throw _0x73072d;}return asRecord(_0x389197);}async function initFeishuRegistration(_0xbbe77f){const _0x27eacd=_0x2fb2;return postFeishuRegistration(_0xbbe77f,{'action':_0x27eacd(0x35a)});}async function beginFeishuRegistration(_0x10af71){const _0x4e1610=_0x2fb2;return postFeishuRegistration(_0x10af71,{'action':_0x4e1610(0x290),'archetype':_0x4e1610(0x362)+_0x4e1610(0x205),'auth_method':_0x4e1610(0x30b)+'ecret','request_user_info':_0x4e1610(0x375)});}async function pollFeishuRegistration(_0x15d592,_0x5e9c5f){const _0x4f3691=_0x2fb2;try{return await postFeishuRegistration(_0x15d592,{'action':_0x4f3691(0x39c),'device_code':_0x5e9c5f});}catch(_0x3d8ad9){if(_0x3d8ad9?.[_0x4f3691(0x238)+_0x4f3691(0x39b)]&&typeof _0x3d8ad9[_0x4f3691(0x238)+'Data']===_0x4f3691(0x3a7))return asRecord(_0x3d8ad9[_0x4f3691(0x238)+_0x4f3691(0x39b)]);throw _0x3d8ad9;}}function extractFeishuRegistrationAuthorizationUri(_0x572e56){const _0x4e25ba=_0x2fb2,_0x4f3978=getTrimmedString(_0x572e56[_0x4e25ba(0x21e)+_0x4e25ba(0x3e4)+'i_comple'+'te'])||getTrimmedString(_0x572e56['authoriz'+_0x4e25ba(0x3e4)+'i'])||getTrimmedString(_0x572e56[_0x4e25ba(0x24a)+_0x4e25ba(0x23f)+'ion_uri_'+_0x4e25ba(0x39d)])||getTrimmedString(_0x572e56[_0x4e25ba(0x24a)+'thorizat'+_0x4e25ba(0x2c9)])||getTrimmedString(_0x572e56['scope_au'+_0x4e25ba(0x23f)+'ion_url'])||getTrimmedString(_0x572e56[_0x4e25ba(0x21e)+'ation_ur'+'l']);if(_0x4f3978)return _0x4f3978;const _0x4f0039=getTrimmedString(_0x572e56[_0x4e25ba(0x255)])||getTrimmedString(_0x572e56[_0x4e25ba(0x24a)+_0x4e25ba(0x23f)+_0x4e25ba(0x1f8)+_0x4e25ba(0x2ff)]);return _0x4f0039?FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV]+('/page/sc'+_0x4e25ba(0x23b)+_0x4e25ba(0x209)+_0x4e25ba(0x2fc)+'d=')+encodeURIComponent(_0x4f0039):null;}function serializeFeishuRegistrationSession(_0x4a96b6){const _0x30922e=_0x2fb2;return{'sessionId':_0x4a96b6[_0x30922e(0x1f5)+'d'],'verificationUriComplete':_0x4a96b6['verifica'+_0x30922e(0x2da)+'omplete'],'expiresAt':new Date(_0x4a96b6['expiresA'+'t'])[_0x30922e(0x1f1)+'ing'](),'pollIntervalMs':_0x4a96b6[_0x30922e(0x2b9)+_0x30922e(0x328)],'status':_0x4a96b6[_0x30922e(0x399)],'errorMessage':_0x4a96b6[_0x30922e(0x2c6)+_0x30922e(0x2b8)],'purpose':_0x4a96b6[_0x30922e(0x380)],'authorizationUri':_0x4a96b6[_0x30922e(0x21e)+_0x30922e(0x3af)]};}function extractFirstUrl(_0x1444de){const _0x5402e2=_0x2fb2,_0x3e55e8=_0x1444de[_0x5402e2(0x25b)](/https?:\/\/[^\s"'<>]+/i);return _0x3e55e8?_0x3e55e8[0x0]:null;}function _0x2fd5(){const _0x3d697d=['markConf','\x20deleted','all_prox','authoriz','cliHostC','r-log','timeout','egistrat','accounts','headers','deviceCo','led','message','output','client_i','lugin\x20de',':user','onSucces','isArray','owFrom','stderr','的新版客户端','飞书用户身份','gin\x20upda','n\x20id\x20is\x20','prototyp','oot','ion\x20sess','openExte','response','setPlugi','config','ope-auth','78846jlRkpx','2kOidYa','Feishu\x20d','thorizat','clientSe','权状态验证超时','kill','失败,请确认\x20k','wechat-l','d\x20is\x20req','le-http','deleted','qqbot\x20ch','openId','scope_au','ase','exmail\x20c','--channe','ation_pe','ethods','allowlis','check','1694540DpLNSb','imap.163','auth','flow_id','tokenSta','skills','verifyTi','飞书绑定失败','wujie.ai','match','supporte','code','doc_conn','clear','正在验证金山文档','\x20已安装','kdocs','飞书开放平台未返','nfig\x20upd','red','已扫描','3944178bKjnyG','toLowerC','persistC','\x20updated','token','dmPolicy','usStarte','oc\x20CLI\x20s','slice','授权状态','search:d','openclaw','Kdocs\x20CL','user','enied','\x20config\x20','docs,dri','kdocs\x20sk','飞书\x20CLI\x20用','resolve','-code','appId','feishu-d','operty','QQ机器人\x20Ap','otRaw','expiresA','get','environm','uired','ll\x20updat','hint','tencent_','ent\x20does','igSnapsh','飞书开放平台应用','--device','docs\x20ski','expired','验证失败','ERROR','begin','cret','share','dingding','plugin','用户已取消飞书机','/oauth/v','验证超时','toString','gin\x20save','HTTP_PRO','zationCo','ctor\x20plu','account','ocr','授权页','string','ctor\x20del','exists','ogin','scriptPa','imap.qq.','json','docs','allow','ession\x20n','icy','金山文档已连接','wecom','Error','腾讯文档','mcp','connecto','wecom\x20ch','mableHtt','e_code:\x20','smtp.qq.','cess','飞书用户身份授权','https:','sage','pollInte','join','close','channel\x20','create','values','igWriteH','Local\x20lo','e\x20or\x20dev','then','\x20channel','器人绑定','.json','errorMes','onfig\x20de','device_c','ion_uri','wechat-s','access_d','WujieAI','\x20not\x20sup','飞书\x20CLI\x20连','tus','exmail','163\x20邮箱','ted\x20Feis','length','groupPol','tatus','oc-cli','search','annel\x20co','filter','tionUriC','com','streamin','权状态不符合用户','...(','timer','elConfig','connecti','setSkill','kdocs-cl','readConf','ated','--app-id','docs-cli','igRaw','--brand','正在进入用户授权','stdout','Missing\x20','OXY','\x20plugin\x20','now','飞书文档\x20CLI','managedB','process','企微助手\x20Sec','setChann','push','QR_READY','channels','feishu\x20d','entries','leted','EXPIRED','n?flow_i','飞书应用已创建,','--domain','_id','1.0.0','is\x20requi','error_de','skill','pluginId','ocs-cli\x20','feishu','imap.exm','ve,markd','nodeExec','已连接过','client_s','微信连接插件,请','split','illEntry','http:','trim','onfig','botId','function','Login\x20su','ent_secr','feishu_c','ttp\x20URL\x20','dingtalk','ecret','\x20专用应用凭据缺','cliAppId','feishu\x20c','ill\x20enab','行失败','footer','appSecre','ret\x20is\x20r','dated','ession\x20i','mail\x20con','id\x20is\x20re','oxy','interval','rvalMs','创建失败','onfigPat','logged\x20i','859812SwZPxr','keys','金山文档授权状态','deleteMc','und','valid','set','mail','identity','.com','-weixin','appDevic','_doc','or\x20plugi','disabled','ot\x20found','equired','pID\x20is\x20r','onMode','Feishu\x20r','Unsuppor','--no-wai','失,无法初始化','用绑定失败','<empty>','quired','appPollI','availabl','url','--scope','43477YNnpwX','env','delete','once','nfig\x20del','catch','Current\x20','setMcpSe','user_inf','qq\x20mail\x20','ector\x20de','金山文档','required','netease\x20','279164lSzDcn','.opencla','init','\x20doc\x20mcp','error','296LjXLuQ','mer','安装包含微信插件','plugins','金山文档登录启动','Personal','腾讯文档\x20Key','qq_mail','--app-se','onnector','ail.qq.c','enabled','max','lePath','回应用创建页面或','飞书应用创建超时','ame','boolean','扫码成功','export','接失败','bind','\x20connect','utable','open_id','websocke','nConfig','spawn','d_auth_m','Entry','重新生成','https_pr','飞书机器人','utf8','_complet','purpose','Connecto','hu\x20regis','connecte','当前飞书开放平台','ired','test','data','r\x20\x22','protocol','assign','ill\x20','enclaw\x20c','账号\x20is\x20re','n\x20update','tencent\x20',',sheets,','ll\x20conne','n\x20not\x20fo','山文档授权','appTimer','onfig\x20up','scriptio','name','wechat','status','netease_','Data','poll','complete','\x22\x20not\x20fo','env:\x20','d\x20auth','飞书\x20CLI\x20执','secret','slow_dow','gin\x20dele','r\x20plugin','连接成功','object','rcode','resolveS','飞书\x20CLI\x20授','QQ\x20邮箱','ternally','scanned','nector\x20p','ationUri','fig','无需重复连接','\x20exited\x20','ror:\x20','ready','HTTPS_PR','rnal','CLI\x20用户身份','腾讯企业邮箱','tateDir','qqbot','authStat','annelCon','identiti','tration\x20','飞书机器人\x20Ap','startedA','企微助手','appPollC','map','onFailur','feishu_d','xOf','eted','esAt','正在打开飞书用户','stdin','启动成功','read','with\x20cod','ode','end','--versio','verify','update','环境不支持创建\x20','http_pro','lark-cli','lastInde','ted','CLOSED','open','login','ntervalM','verifica','replace','expire_i','call','589239wOaxvr','cret-std','dAt','ector','ation_ur','projectR','文档\x20Strea','apiKey','\x20chars)','pSecret\x20','slides,b','eCode','lient','ion\x20not\x20','pServer','cliAppSe','usTimer','phase','includes','nding',',请先连接','streamab','pending','already\x20','import','toISOStr','channelI','正在验证飞书授权','请在浏览器完成金','sessionI','飞书\x20CLI\x20未','飞书\x20CLI\x20应','ion_flow','oc\x20conne','tion_uri','expired_','port\x20cli','QQ助手','deleteSk','钉钉文档\x20Str','Invalid\x20','ill\x20conn','own,wiki','accountN','eamableH','Agent','logout','andledIn','完成应用创建','orizatio','rver','login\x20--','stringif','ecret\x20应用','ocs:read','Bin','hannel\x20c','Channel\x20','applicat','\x20is\x20requ','parse','wechat-q','fresh','deleteCh','二维码已过期,请','权状态验证失败','p\x20URL'];_0x2fd5=function(){return _0x3d697d;};return _0x2fd5();}function _0x2fb2(_0x26110b,_0x33f8f2){_0x26110b=_0x26110b-0x1f0;const _0x2fd529=_0x2fd5();let _0x2fb2c1=_0x2fd529[_0x26110b];return _0x2fb2c1;}function isKdocsAuthStatusReady(_0x3a05a9){const _0x426fd4=_0x2fb2,_0xea0434=_0x3a05a9[_0x426fd4(0x268)+_0x426fd4(0x24b)]();if(/not\s+login|not\s+logged|unauth|未登录|未认证|未授权|失败/[_0x426fd4(0x386)](_0xea0434))return![];return/login|logged|auth|valid|success|已登录|已认证|已授权|有效|成功/[_0x426fd4(0x386)](_0xea0434);}function parseFeishuDocCliJson(_0x4656ef){const _0x154c33=_0x2fb2,_0x52562d=_0x4656ef['trim']();if(!_0x52562d)return{};try{return asRecord(JSON[_0x154c33(0x214)](_0x52562d));}catch{for(let _0x511736=_0x52562d['indexOf']('{');_0x511736>=0x0;_0x511736=_0x52562d['indexOf']('{',_0x511736+0x1)){for(let _0x3ae191=_0x52562d['lastInde'+_0x154c33(0x3c6)]('}');_0x3ae191>_0x511736;_0x3ae191=_0x52562d[_0x154c33(0x3d6)+_0x154c33(0x3c6)]('}',_0x3ae191-0x1)){try{return asRecord(JSON[_0x154c33(0x214)](_0x52562d[_0x154c33(0x26f)](_0x511736,_0x3ae191+0x1)));}catch{}}}return{};}}function summarizeCliOutput(_0x6dc7f6){const _0x3a0889=_0x2fb2,_0x81a45c=_0x6dc7f6[_0x3a0889(0x310)]();if(!_0x81a45c)return _0x3a0889(0x344);return _0x81a45c[_0x3a0889(0x2d3)]>0x320?_0x81a45c[_0x3a0889(0x26f)](0x0,0x320)+_0x3a0889(0x2de)+_0x81a45c[_0x3a0889(0x2d3)]+_0x3a0889(0x3e8):_0x81a45c;}function extractFeishuDocCliError(_0x2fcb20,_0x3a7aa7){const _0x122273=_0x2fb2,_0x280582=parseFeishuDocCliJson(_0x2fcb20),_0x5760a5=asRecord(_0x280582[_0x122273(0x35c)]),_0x269ff3=getTrimmedString(_0x5760a5[_0x122273(0x227)]),_0x54194b=getTrimmedString(_0x5760a5[_0x122273(0x286)]);if(_0x269ff3&&_0x54194b)return _0x269ff3+'\x0a'+_0x54194b;if(_0x269ff3)return _0x269ff3;return _0x2fcb20[_0x122273(0x310)]()||_0x3a7aa7;}function getFeishuDocCliFailureMessage(_0xb67d1f,_0x11205d,_0x2c7fca){const _0x36dab5=_0x2fb2,_0x1a54fa=_0x11205d[_0x36dab5(0x310)]()[_0x36dab5(0x30d)]('\x0a')[_0x36dab5(0x26f)](-0x8)[_0x36dab5(0x2ba)]('\x0a')['trim'](),_0x4c9da6=_0xb67d1f==='create'?_0x36dab5(0x28a)+_0x36dab5(0x329):_0xb67d1f===_0x36dab5(0x372)?_0x36dab5(0x1f7)+_0x36dab5(0x343):_0xb67d1f===_0x36dab5(0x254)?_0x36dab5(0x279)+'户授权失败':_0x36dab5(0x3aa)+_0x36dab5(0x219);return _0x1a54fa?_0x4c9da6+':\x20'+_0x1a54fa:_0x4c9da6+':\x20'+_0x2c7fca;}function ensureFeishuDocCliUserStatus(_0x145a6c){const _0x2d7b84=_0x2fb2,_0x746aeb=parseFeishuDocCliJson(_0x145a6c),_0x36e19=asRecord(_0x746aeb[_0x2d7b84(0x3bd)+'es']),_0x57d971=asRecord(_0x36e19['user']),_0x1a154f=getTrimmedString(_0x746aeb[_0x2d7b84(0x334)]),_0x3d26d1=getTrimmedString(_0x746aeb[_0x2d7b84(0x256)+_0x2d7b84(0x2cf)])||getTrimmedString(_0x57d971[_0x2d7b84(0x256)+_0x2d7b84(0x2cf)]),_0x267a16=getTrimmedString(_0x57d971[_0x2d7b84(0x399)]),_0x3fc405=_0x57d971[_0x2d7b84(0x347)+'e']===!![];if(_0x1a154f!==_0x2d7b84(0x274)||_0x267a16&&_0x267a16!==_0x2d7b84(0x3b4)||Object[_0x2d7b84(0x32d)](_0x57d971)[_0x2d7b84(0x2d3)]>0x0&&!_0x3fc405||_0x3d26d1!==_0x2d7b84(0x331)&&_0x3d26d1!=='needs_re'+_0x2d7b84(0x216))throw new Error(_0x2d7b84(0x3aa)+_0x2d7b84(0x2dd)+'身份要求:\x20'+_0x145a6c['trim']());}function createKdocsCliStatus(_0x4e951d){const _0x45a157=_0x2fb2;return{'sessionId':_0x4e951d[_0x45a157(0x1f5)+'d'],'status':_0x4e951d[_0x45a157(0x399)],'phase':_0x4e951d[_0x45a157(0x3f1)],'url':_0x4e951d[_0x45a157(0x348)],'message':_0x4e951d[_0x45a157(0x227)],'errorMessage':_0x4e951d['errorMes'+_0x45a157(0x2b8)]};}function createFeishuDocCliStatus(_0x208b72){const _0x27516e=_0x2fb2;return{'sessionId':_0x208b72[_0x27516e(0x1f5)+'d'],'status':_0x208b72[_0x27516e(0x399)],'phase':_0x208b72['phase'],'url':_0x208b72['url'],'message':_0x208b72[_0x27516e(0x227)],'errorMessage':_0x208b72[_0x27516e(0x2c6)+_0x27516e(0x2b8)]};}export function createConnectorController({shellConfig:_0x17cd65,configController:_0x5724ce,broadcast:_0x221e70,shell:_0x1e09a3,getRuntimeSpawnContext:_0x3e8899,openClawConfigHandlers:openClawConfigHandlers={},resolveRuntimeKdocsCliCommand:_0x414266,resolveRuntimeLarkCliCommand:_0x3f4fc3}){const _0x5f22af=_0x2fb2,_0x46aac2=new Map(),_0x222366=new Map(),_0x2c64a9=new Map();let _0x560f0f=null;const _0x29d527=()=>_0x5724ce['readConf'+_0x5f22af(0x2e8)]();async function _0x5b1448(_0x3d7888,_0x5b8434){const _0x58dad7=_0x5f22af;if(typeof openClawConfigHandlers[_0x58dad7(0x3d2)]==='function')return openClawConfigHandlers[_0x58dad7(0x3d2)](_0x5040b9=>{const _0x1aee72=_0x58dad7;for(const _0x2309ec of Object[_0x1aee72(0x32d)](_0x5040b9)){!Object[_0x1aee72(0x234)+'e']['hasOwnPr'+_0x1aee72(0x27e)][_0x1aee72(0x3df)](_0x3d7888,_0x2309ec)&&delete _0x5040b9[_0x2309ec];}Object[_0x1aee72(0x38a)](_0x5040b9,_0x3d7888);},_0x5b8434);return typeof _0x5724ce[_0x58dad7(0x269)+_0x58dad7(0x311)]===_0x58dad7(0x313)?await _0x5724ce[_0x58dad7(0x269)+_0x58dad7(0x311)](_0x3d7888,_0x5b8434):(_0x5724ce[_0x58dad7(0x21b)+_0x58dad7(0x2bf)+_0x58dad7(0x207)+_0x58dad7(0x3ac)]?.(),await _0x5724ce['writeCon'+_0x58dad7(0x3b0)](_0x3d7888,_0x5b8434)),{'ok':!![]};}function _0x2467ad(){const _0x3aacac=_0x5f22af;return join(_0x5724ce['resolveS'+_0x3aacac(0x3b9)](),_0x3aacac(0x27d)+_0x3aacac(0x2d6));}function _0x54ab32(){const _0x164798=_0x5f22af;return join(_0x2467ad(),_0x164798(0x359)+'w',_0x164798(0x272)+'.json');}async function _0x54f4d7(_0x25e42f={}){const _0x4686eb=_0x5f22af;return _0x3e8899(_0x17cd65[_0x4686eb(0x3e5)+_0x4686eb(0x235)],_0x25e42f);}async function _0x14158d(_0x417984,_0xc01e37){const _0x1028c3=_0x5f22af,{env:_0x4e6a39,runtime:_0x141b51}=await _0x54f4d7({'FORCE_COLOR':'0','HOME':homedir()}),_0x1e85f8=await _0x414266(_0x141b51);return _0x221e70(_0x1028c3(0x2b0)+_0x1028c3(0x220),{'connector':_0x1028c3(0x262),'phase':_0x1028c3(0x378),'message':'kdocs-cl'+'i\x20'+_0x417984['join']('\x20')}),new Promise((_0x4d28bf,_0x13d3c2)=>{const _0xc93ac0=_0x1028c3,_0x963ff8=spawn(_0x1e85f8['executab'+_0xc93ac0(0x36a)],_0x417984,{'cwd':homedir(),'env':_0x4e6a39});let _0x1fd6d7='';const _0x287d86=_0xbc5d61=>{const _0x1766fe=_0xc93ac0,_0x5dcd31=_0xbc5d61[_0x1766fe(0x298)]('utf8');_0x1fd6d7+=_0x5dcd31,_0x221e70(_0x1766fe(0x2b0)+_0x1766fe(0x220),{'connector':_0x1766fe(0x262),'phase':'output','message':_0x5dcd31});};_0x963ff8[_0xc93ac0(0x2eb)]['on'](_0xc93ac0(0x387),_0x287d86),_0x963ff8[_0xc93ac0(0x22f)]['on'](_0xc93ac0(0x387),_0x287d86),_0x963ff8[_0xc93ac0(0x34d)](_0xc93ac0(0x35c),_0x13d3c2),_0x963ff8[_0xc93ac0(0x34d)](_0xc93ac0(0x2bb),_0x56191c=>_0x4d28bf({'code':_0x56191c,'output':_0x1fd6d7}));if(typeof _0xc01e37===_0xc93ac0(0x2a0))_0x963ff8['stdin'][_0xc93ac0(0x3cf)](_0xc01e37);else _0x963ff8[_0xc93ac0(0x3ca)][_0xc93ac0(0x3cf)]();});}async function _0x2a0edb(){const _0x5ae097=_0x5f22af,_0x12ca0d=await _0x29d527(),_0x51d979=asRecord(_0x12ca0d[_0x5ae097(0x257)]),_0x3bca29=asRecord(_0x51d979[_0x5ae097(0x2f9)]),_0x2ef088={...asRecord(_0x3bca29[KDOCS_SKILL_ID]),'enabled':!![]};if(typeof openClawConfigHandlers[_0x5ae097(0x2e2)+'Entry']===_0x5ae097(0x313)){await openClawConfigHandlers['setSkill'+_0x5ae097(0x37a)]({'skillId':KDOCS_SKILL_ID,'entry':_0x2ef088,'reason':_0x5ae097(0x278)+'ill\x20enab'+_0x5ae097(0x226)});return;}_0x3bca29[KDOCS_SKILL_ID]=_0x2ef088,_0x51d979['entries']=_0x3bca29,_0x12ca0d[_0x5ae097(0x257)]=_0x51d979,await _0x5b1448(_0x12ca0d,_0x5ae097(0x278)+_0x5ae097(0x31d)+_0x5ae097(0x226));}async function _0x23b6d7(_0x1ed6de){const _0x277015=_0x5f22af,_0xbf15d4=await _0x29d527(),_0x5e973a=asRecord(_0xbf15d4[_0x277015(0x257)]),_0x3ad336=asRecord(_0x5e973a[_0x277015(0x2f9)]),_0x5d6cc9={...asRecord(_0x3ad336[KDOCS_SKILL_ID]),'enabled':Boolean(_0x1ed6de)};if(typeof openClawConfigHandlers['setSkill'+_0x277015(0x37a)]===_0x277015(0x313)){await openClawConfigHandlers[_0x277015(0x2e2)+_0x277015(0x37a)]({'skillId':KDOCS_SKILL_ID,'entry':_0x5d6cc9,'reason':'kdocs\x20sk'+_0x277015(0x38b)+(_0x1ed6de?'enabled':'disabled')});return;}_0x3ad336[KDOCS_SKILL_ID]=_0x5d6cc9,_0x5e973a[_0x277015(0x2f9)]=_0x3ad336,_0xbf15d4[_0x277015(0x257)]=_0x5e973a,await _0x5b1448(_0xbf15d4,_0x277015(0x278)+_0x277015(0x38b)+(_0x1ed6de?_0x277015(0x368):_0x277015(0x33a)));}async function _0x381203(){const _0x17cc7a=_0x5f22af;if(typeof openClawConfigHandlers[_0x17cc7a(0x1fe)+'illEntry']===_0x17cc7a(0x313)){await openClawConfigHandlers[_0x17cc7a(0x1fe)+_0x17cc7a(0x30e)]({'skillId':KDOCS_SKILL_ID,'reason':'kdocs\x20sk'+_0x17cc7a(0x201)+_0x17cc7a(0x354)+_0x17cc7a(0x2fa)});return;}const _0x43507d=await _0x29d527(),_0x2d3149=asRecord(_0x43507d[_0x17cc7a(0x257)]),_0x2ab3e=asRecord(_0x2d3149[_0x17cc7a(0x2f9)]);delete _0x2ab3e[KDOCS_SKILL_ID],_0x2d3149[_0x17cc7a(0x2f9)]=_0x2ab3e,_0x43507d[_0x17cc7a(0x257)]=_0x2d3149,await _0x5b1448(_0x43507d,_0x17cc7a(0x278)+_0x17cc7a(0x201)+_0x17cc7a(0x354)+_0x17cc7a(0x2fa));}async function _0x1407c8(){const _0x309b5c=_0x5f22af;if(!await _0x449207())throw new Error('金山文档尚未授权'+',请先完成\x20kd'+_0x309b5c(0x305)+'连接');return await _0x2a0edb(),{'ok':!![]};}async function _0x449207(){const _0x56684e=_0x5f22af,_0x298346=await _0x14158d(['auth',_0x56684e(0x399)])[_0x56684e(0x34f)](()=>({'code':null,'output':''}));return _0x298346[_0x56684e(0x25d)]===0x0&&isKdocsAuthStatusReady(_0x298346[_0x56684e(0x228)]);}async function _0x10c787({appId:_0x3bfe26,appSecret:_0xb7c60b,userInfo:userInfo=null}){const _0x4eb51b=_0x5f22af,_0x458121=await _0x29d527();applyFeishuChannelConfig(_0x458121,{'appId':_0x3bfe26,'appSecret':_0xb7c60b,'userInfo':userInfo});const _0x1e5260=asRecord(_0x458121[_0x4eb51b(0x2f7)]);if(typeof openClawConfigHandlers[_0x4eb51b(0x2f4)+_0x4eb51b(0x2e0)]==='function')return openClawConfigHandlers[_0x4eb51b(0x2f4)+_0x4eb51b(0x2e0)]({'channelId':'feishu','channel':asRecord(_0x1e5260[_0x4eb51b(0x306)]),'pluginId':_0x4eb51b(0x306),'pluginEnabled':!![],'reason':_0x4eb51b(0x31c)+_0x4eb51b(0x210)+'onfig\x20up'+'dated'});await _0x5b1448(_0x458121,'feishu\x20c'+_0x4eb51b(0x210)+_0x4eb51b(0x395)+_0x4eb51b(0x322));}async function _0x57bef3({appId:_0x526f90,appSecret:_0x1e238c,userInfo:userInfo=null,configPath:_0x9b41c0}){const _0x51a86b=_0x5f22af,_0x315ab9=getTrimmedString(userInfo?.[_0x51a86b(0x249)]),_0x6aab28={'channels':{'feishu':{'enabled':![],'appId':_0x526f90,'appSecret':_0x1e238c,'domain':_0x51a86b(0x306),'connectionMode':_0x51a86b(0x376)+'t','requireMention':!![],'dmPolicy':_0x315ab9?_0x51a86b(0x250)+'t':_0x51a86b(0x33a),'groupPolicy':_0x51a86b(0x33a),'streaming':!![],'allowFrom':_0x315ab9?[_0x315ab9]:[],'groupAllowFrom':[]}},'plugins':{'entries':{},'allow':[]},'tools':{'profile':'full'}};await mkdir(dirname(_0x9b41c0),{'recursive':!![]}),await writeFile(_0x9b41c0,JSON[_0x51a86b(0x20c)+'y'](_0x6aab28,null,0x2)+'\x0a',_0x51a86b(0x37e));}async function _0x3320d5(_0x52145d={}){const _0x3b809b=_0x5f22af,_0x58bae0=safeString(_0x52145d['appId']),_0x50487d=safeString(_0x52145d[_0x3b809b(0x320)+'t']);if(!_0x58bae0)throw new Error('飞书机器人\x20Ap'+'pID\x20is\x20r'+'equired');if(!_0x50487d)throw new Error(_0x3b809b(0x3bf)+_0x3b809b(0x3e9)+'is\x20requi'+_0x3b809b(0x265));return await _0x10c787({'appId':_0x58bae0,'appSecret':_0x50487d,'userInfo':null}),{'ok':!![]};}async function _0x4e3614(_0x35ae32={}){const _0x129eb0=_0x5f22af,_0x4c92d8=safeString(_0x35ae32[_0x129eb0(0x27c)]),_0x1adda6=safeString(_0x35ae32[_0x129eb0(0x240)+_0x129eb0(0x291)]);if(!_0x4c92d8)throw new Error(_0x129eb0(0x27f)+_0x129eb0(0x33d)+_0x129eb0(0x33c));if(!_0x1adda6)throw new Error(_0x129eb0(0x27f)+_0x129eb0(0x3e9)+_0x129eb0(0x301)+_0x129eb0(0x265));const _0x4ec584=await _0x29d527(),_0x47e2a7=asRecord(_0x4ec584[_0x129eb0(0x2f7)]),_0x13684b=asRecord(_0x47e2a7[_0x129eb0(0x3ba)]),_0x2e5f0e={'enabled':typeof _0x13684b[_0x129eb0(0x368)]===_0x129eb0(0x36e)?_0x13684b[_0x129eb0(0x368)]:!![],'allowFrom':['*'],'appId':_0x4c92d8,'clientSecret':_0x1adda6};if(typeof openClawConfigHandlers['setChann'+_0x129eb0(0x2e0)]==='function')return openClawConfigHandlers['setChann'+'elConfig']({'channelId':'qqbot','channel':_0x2e5f0e,'pluginId':QQBOT_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x129eb0(0x248)+_0x129eb0(0x2d8)+_0x129eb0(0x264)+_0x129eb0(0x2e5)});_0x47e2a7['qqbot']=_0x2e5f0e,_0x4ec584[_0x129eb0(0x2f7)]=_0x47e2a7;const _0x4ae28e=asRecord(_0x4ec584[_0x129eb0(0x360)]),_0x2d4fcb=asRecord(_0x4ae28e[_0x129eb0(0x2f9)]);return _0x2d4fcb[QQBOT_PLUGIN_ID]={...asRecord(_0x2d4fcb[QQBOT_PLUGIN_ID]),'enabled':!![]},_0x4ae28e[_0x129eb0(0x2f9)]=_0x2d4fcb,_0x4ae28e['allow']=dedupeStrings([...asStringArray(_0x4ae28e[_0x129eb0(0x2a8)]),QQBOT_PLUGIN_ID]),_0x4ec584[_0x129eb0(0x360)]=_0x4ae28e,await _0x5b1448(_0x4ec584,'qqbot\x20ch'+'annel\x20co'+_0x129eb0(0x264)+_0x129eb0(0x2e5)),{'ok':!![]};}async function _0x54ed61(_0x4795ba={}){const _0x4919db=_0x5f22af,_0x2c2eee=safeString(_0x4795ba[_0x4919db(0x312)]),_0x2a4375=safeString(_0x4795ba[_0x4919db(0x3a2)]);if(!_0x2c2eee)throw new Error('企微助手\x20Bot'+'ID\x20is\x20re'+'quired');if(!_0x2a4375)throw new Error(_0x4919db(0x2f3)+_0x4919db(0x321)+_0x4919db(0x33c));const _0x1e36f5=await _0x29d527(),_0x13a0c0=asRecord(_0x1e36f5[_0x4919db(0x2f7)]),_0x52b292=asRecord(_0x13a0c0['wecom']),_0x17262a={..._0x52b292,'enabled':typeof _0x52b292[_0x4919db(0x368)]==='boolean'?_0x52b292[_0x4919db(0x368)]:!![],'name':getTrimmedString(_0x52b292[_0x4919db(0x397)])||_0x4919db(0x3c1),'connectionMode':getTrimmedString(_0x52b292[_0x4919db(0x2e1)+_0x4919db(0x33e)])||_0x4919db(0x376)+'t','dmPolicy':normalizeFeishuDmPolicy(_0x52b292[_0x4919db(0x26c)])??_0x4919db(0x3d9),'groupPolicy':normalizeFeishuGroupPolicy(_0x52b292[_0x4919db(0x2d4)+_0x4919db(0x2aa)])??_0x4919db(0x3d9),'allowFrom':asStringArray(_0x52b292['allowFro'+'m']),'groupAllowFrom':asStringArray(_0x52b292['groupAll'+_0x4919db(0x22e)]),'botId':_0x2c2eee,'secret':_0x2a4375};if(typeof openClawConfigHandlers[_0x4919db(0x2f4)+'elConfig']==='function')return openClawConfigHandlers[_0x4919db(0x2f4)+'elConfig']({'channelId':_0x4919db(0x2ac),'channel':_0x17262a,'pluginId':WECOM_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x4919db(0x2b1)+_0x4919db(0x2d8)+_0x4919db(0x264)+_0x4919db(0x2e5)});_0x13a0c0[_0x4919db(0x2ac)]=_0x17262a,_0x1e36f5[_0x4919db(0x2f7)]=_0x13a0c0;const _0x5ace1c=asRecord(_0x1e36f5[_0x4919db(0x360)]),_0x182b94=asRecord(_0x5ace1c['entries']);return _0x182b94[WECOM_PLUGIN_ID]={...asRecord(_0x182b94[WECOM_PLUGIN_ID]),'enabled':!![]},_0x5ace1c[_0x4919db(0x2f9)]=_0x182b94,_0x5ace1c[_0x4919db(0x2a8)]=dedupeStrings([...asStringArray(_0x5ace1c['allow']),WECOM_PLUGIN_ID]),_0x1e36f5[_0x4919db(0x360)]=_0x5ace1c,await _0x5b1448(_0x1e36f5,_0x4919db(0x2b1)+_0x4919db(0x2d8)+_0x4919db(0x264)+_0x4919db(0x2e5)),{'ok':!![]};}async function _0x41774e(_0x31b665,_0x4739b8,_0x25b9d0,_0x5c56ee){const _0xc739fe=_0x5f22af,_0x12b3f1=safeString(_0x4739b8[_0xc739fe(0x29d)]),_0x46c222=String(_0x4739b8[_0xc739fe(0x21e)+'ationCod'+'e']||'')[_0xc739fe(0x3dd)](/\s+/g,'');if(!_0x12b3f1)throw new Error(_0x5c56ee+(_0xc739fe(0x38d)+'quired'));if(!_0x46c222)throw new Error(_0x5c56ee+('授权码\x20is\x20r'+_0xc739fe(0x33c)));const _0x78b454=await _0x29d527(),_0xa2121e=asRecord(_0x78b454[_0xc739fe(0x360)]),_0x2a37e0=asRecord(_0xa2121e[_0xc739fe(0x2f9)]),_0x1339e0=createConnectorPluginEntry(_0x31b665,_0x2a37e0[_0x31b665],!![],{'account':_0x12b3f1,'authorizationCode':_0x46c222,..._0x25b9d0});if(typeof openClawConfigHandlers['setPlugi'+_0xc739fe(0x377)]===_0xc739fe(0x313))return openClawConfigHandlers[_0xc739fe(0x239)+_0xc739fe(0x377)]({'pluginId':_0x31b665,'enabled':!![],'config':asRecord(_0x1339e0['config']),'reason':_0x31b665+(_0xc739fe(0x373)+_0xc739fe(0x339)+_0xc739fe(0x38e)+'d')});return _0x2a37e0[_0x31b665]=_0x1339e0,_0xa2121e[_0xc739fe(0x2f9)]=_0x2a37e0,_0xa2121e[_0xc739fe(0x2a8)]=dedupeStrings([...asStringArray(_0xa2121e['allow']),_0x31b665]),_0x78b454[_0xc739fe(0x360)]=_0xa2121e,await _0x5b1448(_0x78b454,_0x31b665+('\x20connect'+_0xc739fe(0x339)+_0xc739fe(0x38e)+'d')),{'ok':!![]};}const _0x372ecf=_0x50eb1b=>_0x41774e(QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x50eb1b,{'imapHost':_0x5f22af(0x2a5)+_0x5f22af(0x2db),'imapPort':0x3e1,'smtpHost':_0x5f22af(0x2b4)+_0x5f22af(0x2db),'smtpPort':0x1d1,'secure':!![]},_0x5f22af(0x3ab)),_0x27b808=_0x492343=>_0x41774e(NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x492343,{'imapHost':_0x5f22af(0x253)+_0x5f22af(0x335),'imapPort':0x3e1,'smtpHost':'smtp.163'+_0x5f22af(0x335),'smtpPort':0x1d1,'imapClientName':_0x5f22af(0x2cc),'imapClientVersion':_0x5f22af(0x300),'imapClientVendor':'WujieAI','imapClientSupportEmail':'support@'+_0x5f22af(0x25a),'secure':!![]},_0x5f22af(0x2d1)),_0x48b0d6=_0x134dd1=>_0x41774e(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x134dd1,{'imapHost':_0x5f22af(0x307)+_0x5f22af(0x367)+'om','imapPort':0x3e1,'smtpHost':'smtp.exm'+_0x5f22af(0x367)+'om','smtpPort':0x1d1,'secure':!![]},_0x5f22af(0x3b8));async function _0x108fc7(_0x25bd44={}){const _0x2fe5f6=_0x5f22af,_0x2e7c13=safeString(_0x25bd44[_0x2fe5f6(0x203)+_0x2fe5f6(0x36d)])||'飞书用户身份',_0x414ccb=await _0x29d527(),_0x106182=asRecord(_0x414ccb[_0x2fe5f6(0x360)]),_0x4979b1=asRecord(_0x106182[_0x2fe5f6(0x2f9)]),_0x2add94=createConnectorPluginEntry(FEISHU_DOC_CONNECTOR_PLUGIN_ID,_0x4979b1[FEISHU_DOC_CONNECTOR_PLUGIN_ID],!![],{'authMode':_0x2fe5f6(0x274),'accountName':_0x2e7c13});if(typeof openClawConfigHandlers[_0x2fe5f6(0x239)+'nConfig']===_0x2fe5f6(0x313))return openClawConfigHandlers[_0x2fe5f6(0x239)+_0x2fe5f6(0x377)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':!![],'config':asRecord(_0x2add94['config']),'reason':_0x2fe5f6(0x2f8)+_0x2fe5f6(0x1f9)+_0x2fe5f6(0x29c)+_0x2fe5f6(0x232)+_0x2fe5f6(0x3d7)});return _0x4979b1[FEISHU_DOC_CONNECTOR_PLUGIN_ID]=_0x2add94,_0x106182[_0x2fe5f6(0x2f9)]=_0x4979b1,_0x106182[_0x2fe5f6(0x2a8)]=dedupeStrings([...asStringArray(_0x106182[_0x2fe5f6(0x2a8)]),FEISHU_DOC_CONNECTOR_PLUGIN_ID]),_0x414ccb[_0x2fe5f6(0x360)]=_0x106182,await _0x5b1448(_0x414ccb,'feishu\x20d'+_0x2fe5f6(0x1f9)+'ctor\x20plu'+_0x2fe5f6(0x232)+_0x2fe5f6(0x3d7)),{'ok':!![]};}async function _0x46ce45(_0x4be341={}){const _0x4f4a66=_0x5f22af,_0x7dcf99=safeString(_0x4be341[_0x4f4a66(0x3e7)]);if(!_0x7dcf99)throw new Error(_0x4f4a66(0x363)+_0x4f4a66(0x213)+_0x4f4a66(0x385));const _0x4f2f38=await _0x29d527(),_0x5bc89b=asRecord(_0x4f2f38[_0x4f4a66(0x257)]),_0x4135d1=asRecord(_0x5bc89b[_0x4f4a66(0x2f9)]),_0x301d54=asRecord(_0x4135d1[TENCENT_DOCS_SKILL_ID]),_0x1f2406={..._0x301d54,'enabled':!![],'env':{...asRecord(_0x301d54[_0x4f4a66(0x34b)]),[TENCENT_DOCS_TOKEN_ENV]:_0x7dcf99}};if(typeof openClawConfigHandlers[_0x4f4a66(0x2e2)+_0x4f4a66(0x37a)]===_0x4f4a66(0x313))return openClawConfigHandlers[_0x4f4a66(0x2e2)+_0x4f4a66(0x37a)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':_0x1f2406,'reason':_0x4f4a66(0x38f)+_0x4f4a66(0x28c)+_0x4f4a66(0x285)+'ed'});return _0x4135d1[TENCENT_DOCS_SKILL_ID]=_0x1f2406,_0x5bc89b[_0x4f4a66(0x2f9)]=_0x4135d1,_0x4f2f38[_0x4f4a66(0x257)]=_0x5bc89b,await _0x5b1448(_0x4f2f38,_0x4f4a66(0x38f)+_0x4f4a66(0x28c)+_0x4f4a66(0x285)+'ed'),{'ok':!![]};}async function _0x4fb3b7(_0x243377={}){const _0xd0e4ff=_0x5f22af,_0x5b0e71=safeString(_0x243377['url']);if(!_0x5b0e71)throw new Error(_0xd0e4ff(0x1ff)+_0xd0e4ff(0x204)+_0xd0e4ff(0x317)+'is\x20requi'+'red');try{const _0x197393=new URL(_0x5b0e71);if(![_0xd0e4ff(0x30f),_0xd0e4ff(0x2b7)]['includes'](_0x197393[_0xd0e4ff(0x389)]))throw new Error(_0xd0e4ff(0x200)+_0xd0e4ff(0x389));}catch{throw new Error('请输入有效的钉钉'+_0xd0e4ff(0x3e6)+_0xd0e4ff(0x2b2)+_0xd0e4ff(0x21a));}if(typeof openClawConfigHandlers['setMcpSe'+_0xd0e4ff(0x20a)]===_0xd0e4ff(0x313))return openClawConfigHandlers[_0xd0e4ff(0x351)+_0xd0e4ff(0x20a)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'server':createDingtalkDocMcpServerConfig(_0x5b0e71),'reason':'dingtalk'+_0xd0e4ff(0x35b)+_0xd0e4ff(0x26a)});const _0x367d0c=await _0x29d527(),_0x335bf4=readOpenClawMcpServersFromConfig(_0x367d0c);return _0x335bf4[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x5b0e71),writeOpenClawMcpServersToConfig(_0x367d0c,_0x335bf4),await _0x5b1448(_0x367d0c,'dingtalk'+'\x20doc\x20mcp'+_0xd0e4ff(0x26a)),{'ok':!![]};}async function _0x2bd9e0(){const _0x23ed7a=_0x5f22af,_0x433a84=await _0x29d527(),_0x57a12a=asRecord(_0x433a84[_0x23ed7a(0x360)]),_0x3d9c77=asRecord(_0x57a12a[_0x23ed7a(0x2f9)]),_0x5461e8=asRecord(_0x433a84['skills']),_0x4ef583=asRecord(_0x5461e8[_0x23ed7a(0x2f9)]),_0x1cf88f={},_0x20c5fb=_0xc3ca=>{const _0x517f4f=_0x23ed7a,_0xf691e0=asRecord(_0x3d9c77[_0xc3ca]);return{'entry':_0xf691e0,'config':asRecord(_0xf691e0[_0x517f4f(0x23a)])};},_0x4b0294=(_0x3e8a2a,_0x4d517,_0xaf7955)=>{const _0x59405e=_0x23ed7a,{entry:_0x158c01,config:_0x3b88e9}=_0x20c5fb(_0x4d517),_0x1151f8=getTrimmedString(_0x3b88e9[_0x59405e(0x29d)]);if(!_0x1151f8)return;_0x1cf88f[_0x3e8a2a]={'provider':_0x3e8a2a,'sourceType':_0x59405e(0x294),'adapter':_0x4d517,'enabled':_0x158c01['enabled']!==![]&&_0x3b88e9['enabled']!==![],'account':_0x1151f8,'credentialRef':_0x4d517+(':authori'+_0x59405e(0x29b)+'de'),'name':_0xaf7955};};_0x4b0294(_0x23ed7a(0x364),QQ_MAIL_CONNECTOR_PLUGIN_ID,'QQ\x20邮箱'),_0x4b0294(_0x23ed7a(0x39a)+_0x23ed7a(0x333),NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x23ed7a(0x2d1)),_0x4b0294(_0x23ed7a(0x287)+_0x23ed7a(0x2d0),TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x23ed7a(0x3b8));const _0x5d188e=_0x20c5fb(FEISHU_DOC_CONNECTOR_PLUGIN_ID),_0x12a8e3=getTrimmedString(_0x5d188e['config'][_0x23ed7a(0x203)+_0x23ed7a(0x36d)]);_0x12a8e3&&(_0x1cf88f[_0x23ed7a(0x306)]={'provider':_0x23ed7a(0x306),'sourceType':_0x23ed7a(0x3d5),'adapter':_0x23ed7a(0x316)+'li_user','enabled':_0x5d188e['entry']['enabled']!==![]&&_0x5d188e['config'][_0x23ed7a(0x368)]!==![],'authMode':'user','accountName':_0x12a8e3,'account':_0x12a8e3,'credentialRef':FEISHU_DOC_CONNECTOR_PLUGIN_ID+_0x23ed7a(0x22b),'capabilities':['latest',_0x23ed7a(0x2d7),'create',_0x23ed7a(0x3cc),'update','delete','export']});const _0x39535c=asRecord(_0x4ef583[TENCENT_DOCS_SKILL_ID]),_0x5c7644=asRecord(_0x39535c[_0x23ed7a(0x34b)]),_0x4c9de1=getTrimmedString(_0x5c7644[TENCENT_DOCS_TOKEN_ENV]);_0x4c9de1&&(_0x1cf88f[_0x23ed7a(0x287)+'docs']={'provider':_0x23ed7a(0x287)+_0x23ed7a(0x2a7),'sourceType':_0x23ed7a(0x303),'adapter':TENCENT_DOCS_SKILL_ID,'enabled':_0x39535c[_0x23ed7a(0x368)]!==![],'account':_0x23ed7a(0x2ae),'credentialRef':TENCENT_DOCS_SKILL_ID+':'+TENCENT_DOCS_TOKEN_ENV,'capabilities':[_0x23ed7a(0x2bd),'read',_0x23ed7a(0x3d2),'delete','import',_0x23ed7a(0x370),_0x23ed7a(0x29e)]});const _0x3b9463=asRecord(_0x4ef583[KDOCS_SKILL_ID]);Object[_0x23ed7a(0x32d)](_0x3b9463)[_0x23ed7a(0x2d3)]>0x0&&await _0x449207()&&(_0x1cf88f[_0x23ed7a(0x262)]={'provider':_0x23ed7a(0x262),'sourceType':_0x23ed7a(0x303),'adapter':KDOCS_SKILL_ID,'enabled':_0x3b9463[_0x23ed7a(0x368)]!==![],'account':_0x23ed7a(0x355),'credentialRef':_0x23ed7a(0x2e3)+'i:keycha'+'in','capabilities':['create','read',_0x23ed7a(0x3d2),'search',_0x23ed7a(0x292),_0x23ed7a(0x1f0),_0x23ed7a(0x370)]});const _0x29c199=readOpenClawMcpServersFromConfig(_0x433a84),_0x34b2c0=findDingtalkDocMcpServer(_0x29c199),_0x1e5407=getTrimmedString(_0x34b2c0['url']);return _0x1e5407&&(_0x1cf88f[_0x23ed7a(0x318)+_0x23ed7a(0x338)]={'provider':_0x23ed7a(0x318)+_0x23ed7a(0x338),'sourceType':_0x23ed7a(0x2af),'adapter':DINGTALK_DOC_MCP_SERVER_NAME,'enabled':_0x34b2c0[_0x23ed7a(0x368)]!==![],'url':_0x1e5407,'transport':getTrimmedString(_0x34b2c0['transpor'+'t'])||_0x23ed7a(0x3f5)+_0x23ed7a(0x246)}),_0x1cf88f;}async function _0x49252a(){const _0x56c3f2=_0x5f22af,_0x38fa01=await _0x5724ce[_0x56c3f2(0x2e4)+_0x56c3f2(0x289)+_0x56c3f2(0x280)]();return{..._0x38fa01,'connectors':{...asRecord(_0x38fa01[_0x56c3f2(0x2b0)+'rs']),...await _0x2bd9e0()}};}function _0x461263(_0x14dc2c){const _0x1491ed=_0x5f22af;if(!_0x14dc2c[_0x1491ed(0x258)+_0x1491ed(0x35e)])return;clearTimeout(_0x14dc2c['verifyTi'+_0x1491ed(0x35e)]),_0x14dc2c['verifyTi'+'mer']=null;}function _0x35b0f4(_0x2492e4,_0x334efa=KDOCS_CLI_AUTH_POLL_INTERVAL_MS){const _0x5f353c=_0x5f22af;if(_0x2492e4[_0x5f353c(0x399)]!==_0x5f353c(0x3f6))return;_0x461263(_0x2492e4),_0x2492e4['verifyTi'+_0x5f353c(0x35e)]=setTimeout(()=>void _0x4b69f6(_0x2492e4),_0x334efa);}async function _0x4b69f6(_0x4f8f77){const _0x45c967=_0x5f22af;if(_0x4f8f77[_0x45c967(0x399)]!==_0x45c967(0x3f6))return;_0x4f8f77['phase']=_0x45c967(0x3d1),_0x4f8f77[_0x45c967(0x227)]=_0x45c967(0x260)+'授权状态';try{const _0x19ea6f=await _0x14158d(['auth',_0x45c967(0x399)]);_0x4f8f77[_0x45c967(0x228)]=_0x19ea6f[_0x45c967(0x228)];if(_0x19ea6f['code']===0x0&&isKdocsAuthStatusReady(_0x19ea6f[_0x45c967(0x228)])){_0x461263(_0x4f8f77),await _0x2a0edb(),_0x4f8f77['phase']='complete'+'d',_0x4f8f77[_0x45c967(0x399)]='complete'+'d',_0x4f8f77[_0x45c967(0x227)]=_0x45c967(0x2ab);return;}if(Date[_0x45c967(0x2ef)]()-_0x4f8f77[_0x45c967(0x3c0)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4f8f77[_0x45c967(0x399)]=_0x45c967(0x35c),_0x4f8f77[_0x45c967(0x2c6)+'sage']='金山文档授权状态'+_0x45c967(0x297);return;}_0x35b0f4(_0x4f8f77);}catch(_0x4854bf){if(Date[_0x45c967(0x2ef)]()-_0x4f8f77[_0x45c967(0x3c0)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4f8f77[_0x45c967(0x399)]=_0x45c967(0x35c),_0x4f8f77[_0x45c967(0x2c6)+_0x45c967(0x2b8)]=_0x4854bf instanceof Error?_0x4854bf['message']:_0x45c967(0x32e)+_0x45c967(0x28e);return;}_0x35b0f4(_0x4f8f77);}}async function _0x59756d(){const _0x1bb8ce=_0x5f22af,_0x22c599=randomUUID(),_0x954378={'sessionId':_0x22c599,'status':_0x1bb8ce(0x3f6),'phase':_0x1bb8ce(0x251),'url':null,'message':'正在启动金山文档'+'登录','errorMessage':null,'output':'','process':null,'verifyTimer':null,'startedAt':Date['now']()};return _0x46aac2[_0x1bb8ce(0x332)](_0x22c599,_0x954378),void _0x54f4d7({'FORCE_COLOR':'0','HOME':homedir()})[_0x1bb8ce(0x2c2)](async({env:_0xd6a38e,runtime:_0x430266})=>{const _0x34f640=_0x1bb8ce,_0x552038=await _0x414266(_0x430266);_0x221e70(_0x34f640(0x2b0)+_0x34f640(0x220),{'connector':_0x34f640(0x262),'phase':_0x34f640(0x378),'message':_0x34f640(0x2e3)+'i\x20auth\x20l'+_0x34f640(0x2a3)});const _0x3b4e51=spawn(_0x552038['executab'+_0x34f640(0x36a)],[_0x34f640(0x254),_0x34f640(0x3da)],{'cwd':homedir(),'env':_0xd6a38e});_0x954378[_0x34f640(0x2f2)]=_0x3b4e51;const _0x4ba9e7=setTimeout(()=>{const _0x164ff3=_0x34f640;if(_0x954378[_0x164ff3(0x399)]!=='pending')return;_0x3b4e51[_0x164ff3(0x242)](),_0x954378['status']='error',_0x954378[_0x164ff3(0x2c6)+_0x164ff3(0x2b8)]=_0x164ff3(0x361)+'超时',_0x954378[_0x164ff3(0x2f2)]=null;},KDOCS_CLI_STEP_TIMEOUT_MS),_0x37c4cb=_0x51784f=>{const _0x336656=_0x34f640,_0x3434b3=_0x51784f['toString'](_0x336656(0x37e));_0x954378[_0x336656(0x228)]+=_0x3434b3,_0x221e70(_0x336656(0x2b0)+_0x336656(0x220),{'connector':_0x336656(0x262),'phase':_0x336656(0x228),'message':_0x3434b3});const _0x52e0b8=extractFirstUrl(_0x954378[_0x336656(0x228)]);_0x52e0b8&&!_0x954378['url']&&(_0x954378[_0x336656(0x348)]=_0x52e0b8,_0x954378[_0x336656(0x3f1)]='auth',_0x954378['message']=_0x336656(0x1f4)+_0x336656(0x393),_0x35b0f4(_0x954378,0x1f4),void _0x1e09a3[_0x336656(0x237)+_0x336656(0x3b6)](_0x52e0b8)[_0x336656(0x34f)](()=>{}));};_0x3b4e51[_0x34f640(0x2eb)]['on']('data',_0x37c4cb),_0x3b4e51['stderr']['on'](_0x34f640(0x387),_0x37c4cb),_0x3b4e51[_0x34f640(0x3ca)][_0x34f640(0x3cf)](),_0x3b4e51[_0x34f640(0x34d)](_0x34f640(0x35c),_0x5e8472=>{const _0x5acf0e=_0x34f640;clearTimeout(_0x4ba9e7),_0x954378[_0x5acf0e(0x399)]=_0x5acf0e(0x35c),_0x954378[_0x5acf0e(0x2c6)+_0x5acf0e(0x2b8)]=_0x5e8472 instanceof Error?_0x5e8472[_0x5acf0e(0x227)]:_0x5acf0e(0x361)+_0x5acf0e(0x243)+_0x5acf0e(0x2e7)+_0x5acf0e(0x261),_0x954378[_0x5acf0e(0x2f2)]=null,_0x221e70(_0x5acf0e(0x2b0)+_0x5acf0e(0x220),{'connector':_0x5acf0e(0x262),'phase':_0x5acf0e(0x35c),'message':_0x954378[_0x5acf0e(0x2c6)+_0x5acf0e(0x2b8)]});}),_0x3b4e51['once']('close',_0x2a138b=>{const _0x1861f8=_0x34f640;clearTimeout(_0x4ba9e7),_0x954378[_0x1861f8(0x2f2)]=null;if(_0x954378[_0x1861f8(0x399)]!==_0x1861f8(0x3f6))return;const _0x290faa=extractFirstUrl(_0x954378[_0x1861f8(0x228)]);if(_0x290faa&&!_0x954378[_0x1861f8(0x348)]){_0x954378[_0x1861f8(0x348)]=_0x290faa,_0x954378[_0x1861f8(0x3f1)]=_0x1861f8(0x254),_0x954378[_0x1861f8(0x227)]='请在浏览器完成金'+_0x1861f8(0x393),_0x35b0f4(_0x954378,0x1f4);return;}if(_0x2a138b!==0x0){_0x954378[_0x1861f8(0x399)]=_0x1861f8(0x35c),_0x954378[_0x1861f8(0x2c6)+_0x1861f8(0x2b8)]=_0x954378[_0x1861f8(0x228)][_0x1861f8(0x310)]()||_0x1861f8(0x361)+_0x1861f8(0x243)+_0x1861f8(0x2e7)+'\x20已安装',_0x221e70(_0x1861f8(0x2b0)+_0x1861f8(0x220),{'connector':_0x1861f8(0x262),'phase':_0x1861f8(0x35c),'message':_0x954378[_0x1861f8(0x2c6)+_0x1861f8(0x2b8)]});return;}_0x954378[_0x1861f8(0x3f1)]=_0x1861f8(0x3d1),_0x954378[_0x1861f8(0x227)]=_0x1861f8(0x260)+_0x1861f8(0x270),_0x35b0f4(_0x954378,0x1f4);});})['catch'](_0xcbb611=>{const _0x7c5572=_0x1bb8ce;_0x954378['status']=_0x7c5572(0x35c),_0x954378[_0x7c5572(0x2c6)+_0x7c5572(0x2b8)]=_0xcbb611 instanceof Error?_0xcbb611[_0x7c5572(0x227)]:_0x7c5572(0x361)+_0x7c5572(0x243)+'docs-cli'+_0x7c5572(0x261),_0x221e70(_0x7c5572(0x2b0)+'r-log',{'connector':_0x7c5572(0x262),'phase':'error','message':_0x954378['errorMes'+_0x7c5572(0x2b8)]});}),createKdocsCliStatus(_0x954378);}function _0x334d82(_0x504523={}){const _0x1f6a7c=_0x5f22af,_0x1b861a=safeString(_0x504523[_0x1f6a7c(0x1f5)+'d']);if(!_0x1b861a)throw new Error('Kdocs\x20CL'+'I\x20sessio'+_0x1f6a7c(0x233)+_0x1f6a7c(0x356));const _0xfd3564=_0x46aac2['get'](_0x1b861a);if(!_0xfd3564)throw new Error(_0x1f6a7c(0x273)+'I\x20sessio'+_0x1f6a7c(0x392)+'und');return createKdocsCliStatus(_0xfd3564);}function _0x99803b(_0x15a33d={}){const _0x3ad6a9=_0x5f22af,_0xdea030=safeString(_0x15a33d[_0x3ad6a9(0x1f5)+'d']);if(!_0xdea030)return{'ok':!![]};const _0x337da1=_0x46aac2['get'](_0xdea030);if(!_0x337da1)return{'ok':!![]};return _0x461263(_0x337da1),_0x337da1[_0x3ad6a9(0x2f2)]?.['kill'](),_0x46aac2[_0x3ad6a9(0x34c)](_0xdea030),{'ok':!![]};}function _0x1d676b(_0x1df5ed){const _0x4ebcf1=_0x5f22af;if(!_0x1df5ed['timer'])return;clearTimeout(_0x1df5ed[_0x4ebcf1(0x2df)]),_0x1df5ed[_0x4ebcf1(0x2df)]=null;}function _0x33a0d6(_0x516856){const _0x165ef8=_0x5f22af,_0x42b1ae=_0x222366[_0x165ef8(0x282)](_0x516856);if(!_0x42b1ae||_0x42b1ae[_0x165ef8(0x399)]!=='pending')return;_0x1d676b(_0x42b1ae),_0x42b1ae[_0x165ef8(0x2df)]=setTimeout(()=>void _0x4ca4e8(_0x516856),_0x42b1ae[_0x165ef8(0x2b9)+_0x165ef8(0x328)]);}async function _0x4ca4e8(_0x2ac278){const _0x22b86a=_0x5f22af,_0x3b40d3=_0x222366[_0x22b86a(0x282)](_0x2ac278);if(!_0x3b40d3||_0x3b40d3[_0x22b86a(0x399)]!==_0x22b86a(0x3f6))return;if(Date[_0x22b86a(0x2ef)]()>=_0x3b40d3[_0x22b86a(0x281)+'t']){_0x3b40d3['status']='expired',_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=_0x22b86a(0x218)+_0x22b86a(0x37b),_0x1d676b(_0x3b40d3);return;}try{const _0x508538=await pollFeishuRegistration(_0x3b40d3['client'],_0x3b40d3['deviceCo'+'de']),_0x3d7570=getTrimmedString(_0x508538[_0x22b86a(0x229)+'d']),_0x293bf7=getTrimmedString(_0x508538[_0x22b86a(0x30b)+_0x22b86a(0x319)]),_0x46e181=getTrimmedString(_0x508538[_0x22b86a(0x35c)]),_0x617e38=extractFeishuRegistrationAuthorizationUri(_0x508538)||_0x3b40d3[_0x22b86a(0x21e)+_0x22b86a(0x3af)];if(_0x617e38!==_0x3b40d3[_0x22b86a(0x21e)+'ationUri'])_0x3b40d3[_0x22b86a(0x21e)+'ationUri']=_0x617e38;if(_0x3d7570&&_0x293bf7){const _0x42b601=asRecord(_0x508538[_0x22b86a(0x352)+'o']);await _0x10c787({'appId':_0x3d7570,'appSecret':_0x293bf7,'userInfo':{'openId':getTrimmedString(_0x42b601['open_id'])||null}}),_0x3b40d3[_0x22b86a(0x399)]=_0x22b86a(0x39d)+'d',_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=null,_0x1d676b(_0x3b40d3);return;}if(!_0x46e181||_0x46e181===_0x22b86a(0x21e)+'ation_pe'+_0x22b86a(0x3f3)){_0x33a0d6(_0x2ac278);return;}if(_0x46e181===_0x22b86a(0x3a3)+'n'){_0x3b40d3[_0x22b86a(0x2b9)+_0x22b86a(0x328)]+=0x1388,_0x33a0d6(_0x2ac278);return;}if(_0x46e181===_0x22b86a(0x1fb)+_0x22b86a(0x26b)){_0x3b40d3[_0x22b86a(0x399)]='expired',_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=_0x22b86a(0x218)+_0x22b86a(0x37b),_0x1d676b(_0x3b40d3);return;}_0x3b40d3[_0x22b86a(0x399)]=_0x22b86a(0x35c),_0x3b40d3['errorMes'+'sage']=getTrimmedString(_0x508538['error_de'+_0x22b86a(0x396)+'n'])||(_0x46e181===_0x22b86a(0x2cb)+_0x22b86a(0x275)?_0x22b86a(0x295)+_0x22b86a(0x2c4):'飞书绑定失败:'+_0x46e181),_0x1d676b(_0x3b40d3);}catch(_0x40e322){_0x3b40d3[_0x22b86a(0x399)]=_0x22b86a(0x35c),_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=_0x40e322 instanceof Error?_0x40e322['message']:_0x22b86a(0x259),_0x1d676b(_0x3b40d3);}}async function _0x5935c8(_0x2cda7d={}){const _0x266260=_0x5f22af,_0x13d128=_0x2cda7d[_0x266260(0x380)]===_0x266260(0x25e)+'ector'?_0x266260(0x25e)+_0x266260(0x3e3):'channel',_0x1ab4c4=createFeishuRegistrationClient(),_0x396257=await initFeishuRegistration(_0x1ab4c4),_0x10141a=Array[_0x266260(0x22d)](_0x396257[_0x266260(0x25c)+_0x266260(0x379)+'ethods'])?_0x396257['supporte'+_0x266260(0x379)+_0x266260(0x24f)][_0x266260(0x3c3)](getTrimmedString)['filter'](Boolean):[];if(!_0x10141a[_0x266260(0x3f2)]('client_s'+_0x266260(0x319)))throw new Error(_0x266260(0x350)+_0x266260(0x283)+_0x266260(0x288)+_0x266260(0x2cd)+_0x266260(0x1fc)+_0x266260(0x315)+'et\x20auth.');const _0x7c0943=await beginFeishuRegistration(_0x1ab4c4),_0x3adf6b=getTrimmedString(_0x7c0943[_0x266260(0x3dc)+_0x266260(0x1fa)+_0x266260(0x37f)+'e']),_0x2b0c51=extractFeishuRegistrationAuthorizationUri(_0x7c0943),_0xb7763d=getTrimmedString(_0x7c0943[_0x266260(0x2c8)+_0x266260(0x3ce)]),_0x17c478=Number(_0x7c0943[_0x266260(0x3de)+'n'])||0x258,_0x256df7=Number(_0x7c0943[_0x266260(0x327)])||0x5;if(!_0x3adf6b||!_0xb7763d)throw new Error(_0x266260(0x2ec)+_0x266260(0x3dc)+_0x266260(0x1fa)+_0x266260(0x37f)+_0x266260(0x2c1)+'ice_code'+'\x20in\x20begi'+'n\x20respon'+'se.');const _0x4d732b=randomUUID(),_0x322b1d={'sessionId':_0x4d732b,'purpose':_0x13d128,'client':_0x1ab4c4,'deviceCode':_0xb7763d,'verificationUriComplete':_0x3adf6b,'authorizationUri':_0x2b0c51,'expiresAt':Date['now']()+_0x17c478*0x3e8,'pollIntervalMs':Math[_0x266260(0x369)](_0x256df7*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'status':'pending','errorMessage':null,'timer':null};return _0x222366[_0x266260(0x332)](_0x4d732b,_0x322b1d),_0x33a0d6(_0x4d732b),serializeFeishuRegistrationSession(_0x322b1d);}function _0x461c31(_0x417959={}){const _0x45b169=_0x5f22af,_0x76b32=safeString(_0x417959['sessionI'+'d']);if(!_0x76b32)throw new Error(_0x45b169(0x33f)+_0x45b169(0x222)+_0x45b169(0x236)+'ion\x20id\x20i'+'s\x20requir'+'ed');const _0x3f9fb6=_0x222366[_0x45b169(0x282)](_0x76b32);if(!_0x3f9fb6)throw new Error(_0x45b169(0x33f)+'egistrat'+_0x45b169(0x236)+_0x45b169(0x3ed)+'found');return serializeFeishuRegistrationSession(_0x3f9fb6);}function _0x25607d(_0x47f4d2={}){const _0x4d41ee=_0x5f22af,_0x1065ce=safeString(_0x47f4d2[_0x4d41ee(0x1f5)+'d']);if(!_0x1065ce)return{'ok':!![]};const _0x5720e7=_0x222366[_0x4d41ee(0x282)](_0x1065ce);if(!_0x5720e7)return{'ok':!![]};return _0x1d676b(_0x5720e7),_0x222366[_0x4d41ee(0x34c)](_0x1065ce),{'ok':!![]};}async function _0x2fcc81(_0x5181d9,_0xa9dee7){const _0x2c0e2=_0x5f22af,_0x289157=_0x2467ad(),{env:_0x4b165d,runtime:_0x5004b1}=await _0x54f4d7({'FORCE_COLOR':'0','HOME':homedir(),'LARK_CLI_NO_PROXY':'1','OPENCLAW_HOME':_0x289157,'OPENCLAW_CONFIG_PATH':_0x5181d9['cliHostC'+'onfigPat'+'h']});await mkdir(_0x289157,{'recursive':!![]});const _0xfc6880=await _0x3f4fc3(_0x5004b1);for(const _0x317070 of[_0x2c0e2(0x29a)+'XY',_0x2c0e2(0x3b5)+_0x2c0e2(0x2ed),'ALL_PROX'+'Y',_0x2c0e2(0x3d4)+'xy',_0x2c0e2(0x37c)+_0x2c0e2(0x326),_0x2c0e2(0x21d)+'y']){delete _0x4b165d[_0x317070];}return new Promise((_0x371522,_0x449ceb)=>{const _0x2f23a2=_0x2c0e2;_0x221e70('connecto'+_0x2f23a2(0x220),{'connector':'feishu_d'+'oc','phase':'spawn','message':_0x2f23a2(0x3d5)+'\x20'+_0xa9dee7[_0x2f23a2(0x2ba)]('\x20')});const _0x2801f6=spawn(_0xfc6880[_0x2f23a2(0x309)+_0x2f23a2(0x374)],[_0xfc6880[_0x2f23a2(0x2a4)+'th'],..._0xa9dee7],{'cwd':_0x289157,'env':_0x4b165d});let _0x4e7462=![];_0x2801f6[_0x2f23a2(0x34d)](_0x2f23a2(0x378),()=>{_0x4e7462=!![],_0x371522(_0x2801f6);}),_0x2801f6[_0x2f23a2(0x34d)](_0x2f23a2(0x35c),_0x10ec72=>{if(_0x4e7462)return;_0x449ceb(_0x10ec72);});});}function _0x3b5223(_0x2bc2f2,_0x166458,_0x45cab7){const _0x3a832a=_0x5f22af;_0x2bc2f2[_0x3a832a(0x3f1)]=_0x45cab7[_0x3a832a(0x3f1)],_0x2bc2f2[_0x3a832a(0x227)]=_0x45cab7[_0x3a832a(0x227)];if(_0x45cab7[_0x3a832a(0x3f1)]!==_0x3a832a(0x3d1))_0x2bc2f2[_0x3a832a(0x348)]=null;_0x2bc2f2[_0x3a832a(0x228)]='',void _0x2fcc81(_0x2bc2f2,_0x166458)[_0x3a832a(0x2c2)](_0x4f44af=>{const _0xd442da=_0x3a832a;_0x2bc2f2[_0xd442da(0x2f2)]=_0x4f44af;const _0x4f3ef4=setTimeout(()=>{const _0x50c307=_0xd442da;if(_0x2bc2f2[_0x50c307(0x399)]!==_0x50c307(0x3f6))return;_0x4f44af[_0x50c307(0x242)](),_0x2bc2f2[_0x50c307(0x399)]=_0x50c307(0x35c),_0x2bc2f2[_0x50c307(0x2c6)+_0x50c307(0x2b8)]=_0x45cab7[_0x50c307(0x227)]+'超时',_0x2bc2f2[_0x50c307(0x2f2)]=null;},FEISHU_DOC_CLI_STEP_TIMEOUT_MS),_0x2675ad=_0x53f573=>{const _0x5be926=_0xd442da,_0x3909a1=_0x53f573[_0x5be926(0x298)]('utf8');_0x2bc2f2[_0x5be926(0x228)]+=_0x3909a1,_0x221e70(_0x5be926(0x2b0)+_0x5be926(0x220),{'connector':_0x5be926(0x3c5)+'oc','phase':_0x45cab7['phase'],'message':_0x3909a1});};_0x4f44af[_0xd442da(0x2eb)]['on'](_0xd442da(0x387),_0x2675ad),_0x4f44af[_0xd442da(0x22f)]['on'](_0xd442da(0x387),_0x2675ad);if(typeof _0x45cab7[_0xd442da(0x3ca)]===_0xd442da(0x2a0))_0x4f44af[_0xd442da(0x3ca)][_0xd442da(0x3cf)](_0x45cab7['stdin']);else _0x4f44af[_0xd442da(0x3ca)][_0xd442da(0x3cf)]();_0x4f44af['on'](_0xd442da(0x35c),_0x55c2c4=>{const _0x4f9b96=_0xd442da;clearTimeout(_0x4f3ef4),_0x2bc2f2[_0x4f9b96(0x399)]=_0x4f9b96(0x35c),_0x2bc2f2[_0x4f9b96(0x2c6)+'sage']=_0x55c2c4 instanceof Error?_0x55c2c4['message']:'飞书\x20CLI\x20执'+_0x4f9b96(0x31e),_0x2bc2f2['process']=null,_0x221e70(_0x4f9b96(0x2b0)+'r-log',{'connector':_0x4f9b96(0x3c5)+'oc','phase':_0x4f9b96(0x35c),'message':_0x2bc2f2[_0x4f9b96(0x2c6)+_0x4f9b96(0x2b8)]});}),_0x4f44af['on'](_0xd442da(0x2bb),_0x38f5d9=>{const _0x3a04e5=_0xd442da;clearTimeout(_0x4f3ef4),_0x2bc2f2[_0x3a04e5(0x2f2)]=null;if(_0x2bc2f2[_0x3a04e5(0x399)]!==_0x3a04e5(0x3f6))return;if(_0x38f5d9!==0x0){if(_0x45cab7[_0x3a04e5(0x3c4)+'e']){void Promise['resolve'](_0x45cab7['onFailur'+'e'](_0x38f5d9,_0x2bc2f2[_0x3a04e5(0x228)]))[_0x3a04e5(0x34f)](_0x37a28f=>{const _0x4c8b6f=_0x3a04e5;_0x2bc2f2[_0x4c8b6f(0x399)]=_0x4c8b6f(0x35c),_0x2bc2f2[_0x4c8b6f(0x2c6)+_0x4c8b6f(0x2b8)]=_0x37a28f instanceof Error?_0x37a28f['message']:_0x4c8b6f(0x2ce)+_0x4c8b6f(0x371);});return;}_0x2bc2f2[_0x3a04e5(0x399)]=_0x3a04e5(0x35c),_0x2bc2f2[_0x3a04e5(0x2c6)+_0x3a04e5(0x2b8)]=getFeishuDocCliFailureMessage(_0x45cab7[_0x3a04e5(0x3f1)],extractFeishuDocCliError(_0x2bc2f2[_0x3a04e5(0x228)],_0x3a04e5(0x3d5)+'\x20'+_0x166458[_0x3a04e5(0x2ba)]('\x20')+(_0x3a04e5(0x3b2)+_0x3a04e5(0x3cd)+'e\x20')+_0x38f5d9),'lark-cli'+'\x20'+_0x166458[_0x3a04e5(0x2ba)]('\x20')+('\x20exited\x20'+'with\x20cod'+'e\x20')+_0x38f5d9),_0x221e70(_0x3a04e5(0x2b0)+_0x3a04e5(0x220),{'connector':_0x3a04e5(0x3c5)+'oc','phase':'error','message':_0x2bc2f2['errorMes'+_0x3a04e5(0x2b8)]});return;}void Promise[_0x3a04e5(0x27a)](_0x45cab7[_0x3a04e5(0x22c)+'s']())[_0x3a04e5(0x34f)](_0x3e6948=>{const _0x457381=_0x3a04e5;_0x2bc2f2[_0x457381(0x399)]=_0x457381(0x35c),_0x2bc2f2[_0x457381(0x2c6)+'sage']=_0x3e6948 instanceof Error?_0x3e6948['message']:_0x457381(0x2ce)+_0x457381(0x371);});});})[_0x3a832a(0x34f)](_0x59a630=>{const _0x2dcceb=_0x3a832a;_0x2bc2f2[_0x2dcceb(0x399)]=_0x2dcceb(0x35c),_0x2bc2f2[_0x2dcceb(0x2c6)+'sage']=_0x59a630 instanceof Error?_0x59a630[_0x2dcceb(0x227)]:_0x2dcceb(0x3a1)+_0x2dcceb(0x31e),_0x2bc2f2[_0x2dcceb(0x2f2)]=null,_0x221e70('connecto'+_0x2dcceb(0x220),{'connector':_0x2dcceb(0x3c5)+'oc','phase':_0x2dcceb(0x35c),'message':_0x2bc2f2['errorMes'+_0x2dcceb(0x2b8)]});});}function _0x4a2a9b(_0x850a43){const _0x443cf2=_0x5f22af;if(!_0x850a43[_0x443cf2(0x394)])return;clearTimeout(_0x850a43[_0x443cf2(0x394)]),_0x850a43[_0x443cf2(0x394)]=null;}function _0x5d4363(_0x302e28){const _0x401f93=_0x5f22af;if(!_0x302e28[_0x401f93(0x3bb)+_0x401f93(0x3f0)])return;clearTimeout(_0x302e28[_0x401f93(0x3bb)+_0x401f93(0x3f0)]),_0x302e28[_0x401f93(0x3bb)+_0x401f93(0x3f0)]=null;}function _0x43e960(_0x17be66,_0x51f001=0x7d0){const _0x4f1a98=_0x5f22af;if(_0x17be66[_0x4f1a98(0x399)]!=='pending')return;_0x5d4363(_0x17be66),_0x17be66[_0x4f1a98(0x3bb)+_0x4f1a98(0x3f0)]=setTimeout(()=>{const _0x460b19=_0x4f1a98;_0x3b5223(_0x17be66,[_0x460b19(0x254),'status'],{'phase':_0x460b19(0x3d1),'message':_0x460b19(0x1f3)+'状态','onFailure':(_0x22df04,_0x3a5c8a)=>{const _0xcc0806=_0x460b19;if(Date['now']()-_0x17be66[_0xcc0806(0x3bb)+_0xcc0806(0x26d)+'dAt']>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x17be66[_0xcc0806(0x399)]='error',_0x17be66[_0xcc0806(0x2c6)+'sage']=getFeishuDocCliFailureMessage(_0xcc0806(0x3d1),extractFeishuDocCliError(_0x3a5c8a,_0xcc0806(0x3aa)+_0xcc0806(0x241)),'飞书\x20CLI\x20授'+'权状态验证超时');return;}_0x43e960(_0x17be66);},'onSuccess':()=>{const _0xd3040c=_0x460b19;try{ensureFeishuDocCliUserStatus(_0x17be66[_0xd3040c(0x228)]);}catch(_0xd9622b){if(Date[_0xd3040c(0x2ef)]()-_0x17be66[_0xd3040c(0x3bb)+_0xd3040c(0x26d)+'dAt']>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x17be66['status']=_0xd3040c(0x35c),_0x17be66['errorMes'+_0xd3040c(0x2b8)]=_0xd9622b instanceof Error?_0xd9622b[_0xd3040c(0x227)]:_0xd3040c(0x3aa)+'权状态验证失败';return;}_0x43e960(_0x17be66);return;}return _0x5d4363(_0x17be66),_0x2c58aa(_0x17be66);}});},_0x51f001);}function _0x1d1667(_0x2b1fd1){const _0x4a6b92=_0x5f22af;if(!_0x2b1fd1['cliAppId']||!_0x2b1fd1[_0x4a6b92(0x3ef)+'cret']){_0x2b1fd1[_0x4a6b92(0x399)]=_0x4a6b92(0x35c),_0x2b1fd1[_0x4a6b92(0x2c6)+'sage']=_0x4a6b92(0x2f0)+_0x4a6b92(0x31a)+_0x4a6b92(0x342);return;}const _0x13b2b3=_0x2b1fd1[_0x4a6b92(0x31b)],_0x429c30=_0x2b1fd1[_0x4a6b92(0x3ef)+_0x4a6b92(0x291)];_0x3b5223(_0x2b1fd1,[_0x4a6b92(0x3d0)+'n'],{'phase':_0x4a6b92(0x372),'message':'正在检查飞书\x20C'+'LI','onSuccess':()=>{const _0x5bf402=_0x4a6b92;_0x3b5223(_0x2b1fd1,[_0x5bf402(0x23a),_0x5bf402(0x35a),'--force-'+_0x5bf402(0x35a),_0x5bf402(0x2e6),_0x13b2b3,_0x5bf402(0x365)+_0x5bf402(0x3e1)+'in',_0x5bf402(0x2e9),_0x5bf402(0x306)],{'phase':_0x5bf402(0x372),'message':'正在初始化飞书\x20'+_0x5bf402(0x3b7)+'应用','stdin':_0x429c30,'onSuccess':()=>{const _0x2755bb=_0x5bf402;_0x3b5223(_0x2b1fd1,[_0x2755bb(0x254),_0x2755bb(0x3da),_0x2755bb(0x2fe),_0x2755bb(0x277)+_0x2755bb(0x308)+_0x2755bb(0x202)+_0x2755bb(0x390)+_0x2755bb(0x3ea)+_0x2755bb(0x24b),_0x2755bb(0x349),_0x2755bb(0x271)+_0x2755bb(0x20e),_0x2755bb(0x341)+'t'],{'phase':'auth','message':_0x2755bb(0x3c9)+_0x2755bb(0x29f),'onSuccess':()=>{const _0x4114f1=_0x2755bb,_0x50ce64=parseFeishuDocCliJson(_0x2b1fd1[_0x4114f1(0x228)]),_0x227f9c=getTrimmedString(_0x50ce64[_0x4114f1(0x3dc)+_0x4114f1(0x1fa)+_0x4114f1(0x37f)+'e'])||getTrimmedString(_0x50ce64[_0x4114f1(0x3dc)+'tion_url'])||getTrimmedString(_0x50ce64[_0x4114f1(0x3dc)+_0x4114f1(0x1fa)]),_0x370981=getTrimmedString(_0x50ce64[_0x4114f1(0x2c8)+_0x4114f1(0x3ce)]);if(!_0x227f9c||!_0x370981){_0x2b1fd1[_0x4114f1(0x399)]=_0x4114f1(0x35c),_0x2b1fd1[_0x4114f1(0x2c6)+_0x4114f1(0x2b8)]=_0x4114f1(0x1f6)+'返回授权\x20URL'+'\x20或\x20devic'+_0x4114f1(0x2b3)+summarizeCliOutput(_0x2b1fd1[_0x4114f1(0x228)]);return;}_0x2b1fd1[_0x4114f1(0x348)]=_0x227f9c,_0x2b1fd1[_0x4114f1(0x225)+'de']=_0x370981,void _0x1e09a3[_0x4114f1(0x237)+_0x4114f1(0x3b6)](_0x227f9c)['catch'](()=>{}),_0x3b5223(_0x2b1fd1,[_0x4114f1(0x254),_0x4114f1(0x3da),_0x4114f1(0x28b)+_0x4114f1(0x27b),_0x370981],{'phase':_0x4114f1(0x3d1),'message':'等待飞书用户授权'+'完成','onSuccess':()=>{const _0x884a18=_0x4114f1;_0x2b1fd1['authStat'+_0x884a18(0x26d)+_0x884a18(0x3e2)]=Date[_0x884a18(0x2ef)](),_0x43e960(_0x2b1fd1,0x1f4);}});}});}});}});}function _0x5bd48c(_0x545a81){const _0x21897a=_0x5f22af;if(_0x545a81[_0x21897a(0x399)]!==_0x21897a(0x3f6))return;_0x4a2a9b(_0x545a81),_0x545a81[_0x21897a(0x394)]=setTimeout(()=>void _0x2e8010(_0x545a81),_0x545a81[_0x21897a(0x346)+_0x21897a(0x3db)+'s']);}async function _0x2e8010(_0x37bb3c){const _0x25f04c=_0x5f22af;if(_0x37bb3c['status']!=='pending'||_0x37bb3c['phase']!==_0x25f04c(0x2bd)||!_0x37bb3c[_0x25f04c(0x3c2)+_0x25f04c(0x3ec)]||!_0x37bb3c[_0x25f04c(0x337)+_0x25f04c(0x3eb)])return;if(Date[_0x25f04c(0x2ef)]()>=_0x37bb3c['appExpir'+_0x25f04c(0x3c8)]){_0x37bb3c[_0x25f04c(0x399)]=_0x25f04c(0x35c),_0x37bb3c[_0x25f04c(0x2c6)+_0x25f04c(0x2b8)]=_0x25f04c(0x36c)+',请重新连接',_0x4a2a9b(_0x37bb3c);return;}try{const _0x3e94b3=await pollFeishuRegistration(_0x37bb3c['appPollC'+_0x25f04c(0x3ec)],_0x37bb3c['appDevic'+_0x25f04c(0x3eb)]),_0x19cf2b=getTrimmedString(_0x3e94b3['client_i'+'d']),_0x4bd919=getTrimmedString(_0x3e94b3['client_s'+_0x25f04c(0x319)]),_0x2d826c=getTrimmedString(_0x3e94b3[_0x25f04c(0x35c)]);if(_0x19cf2b&&_0x4bd919){const _0x496e7a=asRecord(_0x3e94b3[_0x25f04c(0x352)+'o']);await _0x57bef3({'appId':_0x19cf2b,'appSecret':_0x4bd919,'userInfo':{'openId':getTrimmedString(_0x496e7a['open_id'])||null},'configPath':_0x37bb3c[_0x25f04c(0x21f)+_0x25f04c(0x32a)+'h']}),_0x37bb3c['cliAppId']=_0x19cf2b,_0x37bb3c['cliAppSe'+_0x25f04c(0x291)]=_0x4bd919,_0x4a2a9b(_0x37bb3c),_0x37bb3c[_0x25f04c(0x227)]=_0x25f04c(0x2fd)+_0x25f04c(0x2ea),_0x1d1667(_0x37bb3c);return;}if(!_0x2d826c||_0x2d826c===_0x25f04c(0x21e)+_0x25f04c(0x24e)+_0x25f04c(0x3f3)){_0x5bd48c(_0x37bb3c);return;}if(_0x2d826c===_0x25f04c(0x3a3)+'n'){_0x37bb3c[_0x25f04c(0x346)+'ntervalM'+'s']+=0x1388,_0x5bd48c(_0x37bb3c);return;}_0x37bb3c[_0x25f04c(0x399)]=_0x25f04c(0x35c),_0x37bb3c[_0x25f04c(0x2c6)+'sage']=getTrimmedString(_0x3e94b3[_0x25f04c(0x302)+_0x25f04c(0x396)+'n'])||'飞书应用创建失败'+':'+_0x2d826c,_0x4a2a9b(_0x37bb3c);}catch(_0x32c0df){_0x37bb3c[_0x25f04c(0x399)]=_0x25f04c(0x35c),_0x37bb3c[_0x25f04c(0x2c6)+_0x25f04c(0x2b8)]=_0x32c0df instanceof Error?_0x32c0df[_0x25f04c(0x227)]:'飞书应用创建失败',_0x4a2a9b(_0x37bb3c);}}async function _0x2c58aa(_0x32c109){const _0x589f3d=_0x5f22af;await _0x108fc7({'accountName':_0x589f3d(0x231)}),_0x32c109['status']=_0x589f3d(0x39d)+'d',_0x32c109[_0x589f3d(0x3f1)]=_0x589f3d(0x39d)+'d',_0x32c109[_0x589f3d(0x227)]=_0x589f3d(0x2b6)+'完成',_0x32c109[_0x589f3d(0x2c6)+_0x589f3d(0x2b8)]=null;}async function _0x2642c0(){const _0x331132=_0x5f22af,_0x53ece4=createFeishuRegistrationClient(),_0xe9fa88=await initFeishuRegistration(_0x53ece4),_0x11ee96=Array[_0x331132(0x22d)](_0xe9fa88['supporte'+_0x331132(0x379)+'ethods'])?_0xe9fa88['supporte'+_0x331132(0x379)+_0x331132(0x24f)][_0x331132(0x3c3)](getTrimmedString)[_0x331132(0x2d9)](Boolean):[];if(!_0x11ee96[_0x331132(0x3f2)](_0x331132(0x30b)+_0x331132(0x319)))throw new Error(_0x331132(0x384)+_0x331132(0x3d3)+_0x331132(0x30b)+_0x331132(0x20d));const _0x169ae5=await beginFeishuRegistration(_0x53ece4),_0x1ea97b=getTrimmedString(_0x169ae5[_0x331132(0x3dc)+'tion_uri'+'_complet'+'e']),_0x2e300c=getTrimmedString(_0x169ae5['device_c'+_0x331132(0x3ce)]),_0x4df434=Number(_0x169ae5[_0x331132(0x3de)+'n'])||0x258,_0x97c578=Number(_0x169ae5[_0x331132(0x327)])||0x5;if(!_0x1ea97b||!_0x2e300c)throw new Error(_0x331132(0x263)+_0x331132(0x36b)+'\x20device_'+'code,请重试');const _0x1d5372=randomUUID(),_0x51b9a2={'sessionId':_0x1d5372,'status':'pending','phase':_0x331132(0x2bd),'url':_0x1ea97b,'appDeviceCode':_0x2e300c,'appPollClient':_0x53ece4,'appPollIntervalMs':Math[_0x331132(0x369)](_0x97c578*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'appExpiresAt':Date[_0x331132(0x2ef)]()+_0x4df434*0x3e8,'appTimer':null,'authStatusTimer':null,'authStatusStartedAt':0x0,'deviceCode':null,'message':'请在飞书开放平台'+_0x331132(0x208),'errorMessage':null,'process':null,'output':'','cliHostConfigPath':_0x54ab32(),'cliAppId':null,'cliAppSecret':null};return _0x2c64a9[_0x331132(0x332)](_0x1d5372,_0x51b9a2),_0x5bd48c(_0x51b9a2),createFeishuDocCliStatus(_0x51b9a2);}function _0x53ee11(_0x3773b1={}){const _0x169054=_0x5f22af,_0x2cc831=safeString(_0x3773b1[_0x169054(0x1f5)+'d']);if(!_0x2cc831)throw new Error('Feishu\x20d'+'oc\x20CLI\x20s'+_0x169054(0x323)+'d\x20is\x20req'+_0x169054(0x284));const _0xfe720f=_0x2c64a9[_0x169054(0x282)](_0x2cc831);if(!_0xfe720f)throw new Error(_0x169054(0x23e)+_0x169054(0x26e)+'ession\x20n'+_0x169054(0x33b));return createFeishuDocCliStatus(_0xfe720f);}function _0x56a326(_0x162533={}){const _0x2ade34=_0x5f22af,_0x47e36f=safeString(_0x162533[_0x2ade34(0x1f5)+'d']);if(!_0x47e36f)return{'ok':!![]};const _0x3c9c46=_0x2c64a9[_0x2ade34(0x282)](_0x47e36f);if(!_0x3c9c46)return{'ok':!![]};return _0x4a2a9b(_0x3c9c46),_0x5d4363(_0x3c9c46),_0x3c9c46[_0x2ade34(0x2f2)]?.[_0x2ade34(0x242)](),_0x2c64a9['delete'](_0x47e36f),{'ok':!![]};}function _0x3792c0(_0x5b735c={}){const _0x3bf7dd=_0x5f22af,_0x13cbde=safeString(_0x5b735c[_0x3bf7dd(0x1f5)+'d']);if(!_0x13cbde)throw new Error(_0x3bf7dd(0x23e)+_0x3bf7dd(0x26e)+_0x3bf7dd(0x323)+_0x3bf7dd(0x245)+_0x3bf7dd(0x284));const _0x1745e5=_0x2c64a9[_0x3bf7dd(0x282)](_0x13cbde);if(!_0x1745e5)throw new Error(_0x3bf7dd(0x23e)+_0x3bf7dd(0x26e)+_0x3bf7dd(0x2a9)+_0x3bf7dd(0x33b));if(_0x1745e5[_0x3bf7dd(0x399)]==='error')throw new Error(_0x1745e5['errorMes'+_0x3bf7dd(0x2b8)]||_0x3bf7dd(0x2ce)+_0x3bf7dd(0x371));return{'ok':!![]};}async function _0x274c30(_0x28dba0){const _0x8df1f2=_0x5f22af,_0x438aeb=asRecord(_0x28dba0[_0x8df1f2(0x360)]),_0x2c5951=asRecord(_0x438aeb['entries']),_0x4a9b4e=asStringArray(_0x438aeb[_0x8df1f2(0x2a8)]),_0x1e9c46=asRecord(_0x2c5951[WECHAT_PLUGIN_ID]),_0x3c5366=_0x1e9c46[_0x8df1f2(0x368)]===!![]||_0x4a9b4e['includes'](WECHAT_PLUGIN_ID),_0x537125=join(_0x5724ce[_0x8df1f2(0x3a9)+_0x8df1f2(0x3b9)](),WECHAT_PLUGIN_ID),_0x2d4c3e=join(_0x537125,_0x8df1f2(0x223)+'.json');let _0x370148=![];try{const _0x21e84e=(await readFile(_0x2d4c3e,_0x8df1f2(0x37e)))['trim']();if(_0x21e84e){const _0x2beb42=JSON['parse'](_0x21e84e);_0x370148=Array[_0x8df1f2(0x22d)](_0x2beb42)?_0x2beb42[_0x8df1f2(0x2d3)]>0x0:Object[_0x8df1f2(0x32d)](asRecord(_0x2beb42))[_0x8df1f2(0x2d3)]>0x0;}}catch{}if(!_0x370148)try{_0x370148=(await readdir(join(_0x537125,'accounts')))[_0x8df1f2(0x2d3)]>0x0;}catch{}return{'exists':_0x3c5366||_0x370148,'enabled':_0x3c5366,'connected':_0x3c5366&&_0x370148};}async function _0x20f0d1(){const _0x3397eb=_0x5f22af,_0x12f096=await _0x29d527(),_0x234179=asRecord(_0x12f096[_0x3397eb(0x2f7)]),_0x560969=[],_0x18d021=await _0x274c30(_0x12f096);_0x18d021[_0x3397eb(0x2a2)]&&_0x560969[_0x3397eb(0x2f5)]({'id':WECHAT_PLUGIN_ID,'type':_0x3397eb(0x398),'name':'微信','enabled':_0x18d021['enabled'],'connected':_0x18d021[_0x3397eb(0x383)+'d']});const _0x1d13b4=asRecord(_0x234179[_0x3397eb(0x3ba)]),_0x58742d=getTrimmedString(_0x1d13b4[_0x3397eb(0x27c)]),_0x1c71e2=getTrimmedString(_0x1d13b4[_0x3397eb(0x240)+_0x3397eb(0x291)]);_0x58742d&&_0x1c71e2&&_0x560969['push']({'id':'qqbot','type':_0x3397eb(0x3ba),'name':_0x3397eb(0x1fd),'enabled':_0x1d13b4['enabled']!==![],'appId':_0x58742d,'clientSecret':_0x1c71e2});const _0x2070ce=asRecord(_0x234179[_0x3397eb(0x2ac)]),_0x27fa7d=getTrimmedString(_0x2070ce[_0x3397eb(0x312)]),_0x4e4692=getTrimmedString(_0x2070ce[_0x3397eb(0x3a2)]);_0x27fa7d&&_0x4e4692&&_0x560969['push']({'id':_0x3397eb(0x2ac),'type':'wecom','name':_0x3397eb(0x3c1),'enabled':_0x2070ce[_0x3397eb(0x368)]!==![],'botId':_0x27fa7d,'secret':_0x4e4692});const _0x280f95=asRecord(_0x234179[_0x3397eb(0x306)]),_0x3a7067=getTrimmedString(_0x280f95[_0x3397eb(0x27c)]),_0xc573a2=getTrimmedString(_0x280f95[_0x3397eb(0x320)+'t']);return _0x3a7067&&_0xc573a2&&getTrimmedString(_0x280f95[_0x3397eb(0x2f1)+'y'])!==FEISHU_DOC_CONNECTOR_PLUGIN_ID&&_0x560969['push']({'id':_0x3397eb(0x306),'type':_0x3397eb(0x306),'name':_0x3397eb(0x37d),'enabled':_0x280f95[_0x3397eb(0x368)]!==![],'appId':_0x3a7067,'appSecret':_0xc573a2}),_0x560969;}async function _0x2217b4(_0x45f7aa){const _0x48e3f2=_0x5f22af;if(typeof openClawConfigHandlers[_0x48e3f2(0x239)+'nConfig']==='function')return openClawConfigHandlers[_0x48e3f2(0x239)+_0x48e3f2(0x377)]({'pluginId':WECHAT_PLUGIN_ID,'enabled':Boolean(_0x45f7aa),'reason':WECHAT_PLUGIN_ID+_0x48e3f2(0x2ee)+(_0x45f7aa?_0x48e3f2(0x368):'disabled')});const _0x308d06=await _0x29d527(),_0xb29689=asRecord(_0x308d06[_0x48e3f2(0x360)]),_0x414b4a=asRecord(_0xb29689[_0x48e3f2(0x2f9)]);return _0x414b4a[WECHAT_PLUGIN_ID]={...asRecord(_0x414b4a[WECHAT_PLUGIN_ID]),'enabled':Boolean(_0x45f7aa)},_0xb29689['entries']=_0x414b4a,_0xb29689[_0x48e3f2(0x2a8)]=_0x45f7aa?dedupeStrings([...asStringArray(_0xb29689[_0x48e3f2(0x2a8)]),WECHAT_PLUGIN_ID]):asStringArray(_0xb29689[_0x48e3f2(0x2a8)])['filter'](_0x11dcee=>_0x11dcee!==WECHAT_PLUGIN_ID),_0x308d06[_0x48e3f2(0x360)]=_0xb29689,await _0x5b1448(_0x308d06,WECHAT_PLUGIN_ID+_0x48e3f2(0x2ee)+(_0x45f7aa?_0x48e3f2(0x368):_0x48e3f2(0x33a))),{'ok':!![]};}async function _0x46a5ef(_0xb69513={}){const _0x25a462=_0x5f22af,_0xb1e74a=safeString(_0xb69513[_0x25a462(0x1f2)+'d']||_0xb69513['id']);if(!_0xb1e74a)throw new Error('Channel\x20'+_0x25a462(0x325)+_0x25a462(0x345));const _0x58a02b=await _0x29d527(),_0x17964a=asRecord(_0x58a02b[_0x25a462(0x2f7)]),_0x390274=asRecord(_0x58a02b[_0x25a462(0x360)]),_0x286460=asRecord(_0x390274[_0x25a462(0x2f9)]),_0x1d4323=_0x2c3f94=>{const _0x17bddc=_0x25a462;_0x286460[_0x2c3f94]=createConnectorPluginEntry(_0x2c3f94,_0x286460[_0x2c3f94],![],{}),_0x390274['allow']=asStringArray(_0x390274[_0x17bddc(0x2a8)])[_0x17bddc(0x2d9)](_0xe3073a=>_0xe3073a!==_0x2c3f94),_0x390274[_0x17bddc(0x2f9)]=_0x286460,_0x58a02b[_0x17bddc(0x360)]=_0x390274;};if(_0xb1e74a==='feishu_d'+'oc')return _0x1d4323(FEISHU_DOC_CONNECTOR_PLUGIN_ID),getTrimmedString(asRecord(_0x17964a['feishu'])[_0x25a462(0x2f1)+'y'])===FEISHU_DOC_CONNECTOR_PLUGIN_ID&&(delete _0x17964a[_0x25a462(0x306)],_0x58a02b['channels']=_0x17964a),await rm(_0x2467ad(),{'recursive':!![],'force':!![]})['catch'](()=>{}),_0x5b1448(_0x58a02b,_0x25a462(0x2f8)+'oc\x20conne'+_0x25a462(0x29c)+_0x25a462(0x3a4)+'ted');if(_0xb1e74a==='qq_mail'){if(typeof openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x25a462(0x353)+_0x25a462(0x2b0)+'r\x20plugin'+_0x25a462(0x21c)});return _0x1d4323(QQ_MAIL_CONNECTOR_PLUGIN_ID),_0x5b1448(_0x58a02b,_0x25a462(0x353)+_0x25a462(0x2b0)+_0x25a462(0x3a5)+_0x25a462(0x21c));}if(_0xb1e74a===_0x25a462(0x39a)+_0x25a462(0x333)){if(typeof openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x239)+'nConfig']({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x25a462(0x357)+_0x25a462(0x324)+_0x25a462(0x3ae)+_0x25a462(0x22a)+_0x25a462(0x2fa)});return _0x1d4323(NETEASE_MAIL_CONNECTOR_PLUGIN_ID),_0x5b1448(_0x58a02b,'netease\x20'+'mail\x20con'+_0x25a462(0x3ae)+'lugin\x20de'+_0x25a462(0x2fa));}if(_0xb1e74a===_0x25a462(0x287)+_0x25a462(0x2d0)){if(typeof openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]===_0x25a462(0x313))return openClawConfigHandlers['setPlugi'+_0x25a462(0x377)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x25a462(0x38f)+_0x25a462(0x24c)+_0x25a462(0x366)+_0x25a462(0x2ee)+_0x25a462(0x247)});return _0x1d4323(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID),_0x5b1448(_0x58a02b,'tencent\x20'+_0x25a462(0x24c)+_0x25a462(0x366)+_0x25a462(0x2ee)+_0x25a462(0x247));}if(_0xb1e74a===_0x25a462(0x287)+_0x25a462(0x2a7)){if(typeof openClawConfigHandlers['deleteSk'+'illEntry']===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x1fe)+_0x25a462(0x30e)]({'skillId':TENCENT_DOCS_SKILL_ID,'reason':'tencent\x20'+_0x25a462(0x28c)+_0x25a462(0x391)+'ctor\x20del'+_0x25a462(0x3c7)});const _0x5c285b=asRecord(_0x58a02b['skills']),_0x546729=asRecord(_0x5c285b[_0x25a462(0x2f9)]);return delete _0x546729[TENCENT_DOCS_SKILL_ID],_0x5c285b[_0x25a462(0x2f9)]=_0x546729,_0x58a02b[_0x25a462(0x257)]=_0x5c285b,_0x5b1448(_0x58a02b,_0x25a462(0x38f)+_0x25a462(0x28c)+'ll\x20conne'+_0x25a462(0x2a1)+_0x25a462(0x3c7));}if(_0xb1e74a===_0x25a462(0x262))return await _0x14158d([_0x25a462(0x254),_0x25a462(0x206)])['catch'](()=>({'code':null,'output':''})),await _0x381203(),{'ok':!![]};if(_0xb1e74a===_0x25a462(0x318)+'_doc'){if(typeof openClawConfigHandlers[_0x25a462(0x32f)+_0x25a462(0x3ee)]===_0x25a462(0x313))return openClawConfigHandlers['deleteMc'+'pServer']({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'reason':_0x25a462(0x318)+_0x25a462(0x35b)+_0x25a462(0x21c)});const _0x5f3f45=readOpenClawMcpServersFromConfig(_0x58a02b);return delete _0x5f3f45[DINGTALK_DOC_MCP_SERVER_NAME],writeOpenClawMcpServersToConfig(_0x58a02b,_0x5f3f45),_0x5b1448(_0x58a02b,'dingtalk'+'\x20doc\x20mcp'+'\x20deleted');}if(_0xb1e74a===WECHAT_PLUGIN_ID||_0xb1e74a===_0x25a462(0x272)+_0x25a462(0x336)){_0x286460[WECHAT_PLUGIN_ID]={...asRecord(_0x286460[WECHAT_PLUGIN_ID]),'enabled':![]},_0x390274[_0x25a462(0x2f9)]=_0x286460,_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274['allow'])['filter'](_0x2f47d5=>_0x2f47d5!==WECHAT_PLUGIN_ID&&_0x2f47d5!==_0x25a462(0x272)+_0x25a462(0x336)),_0x58a02b[_0x25a462(0x360)]=_0x390274;const _0x205d7d=join(_0x5724ce['resolveS'+_0x25a462(0x3b9)](),WECHAT_PLUGIN_ID);return await rm(join(_0x205d7d,'accounts'+_0x25a462(0x2c5)),{'force':!![]})[_0x25a462(0x34f)](()=>{}),await rm(join(_0x205d7d,_0x25a462(0x223)),{'recursive':!![],'force':!![]})[_0x25a462(0x34f)](()=>{}),_0x5b1448(_0x58a02b,_0xb1e74a+(_0x25a462(0x2c3)+_0x25a462(0x276)+'deleted'));}if(_0xb1e74a===_0x25a462(0x306)){if(typeof openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+_0x25a462(0x3b0)]===_0x25a462(0x313))return openClawConfigHandlers['deleteCh'+_0x25a462(0x3bc)+_0x25a462(0x3b0)]({'channelId':_0x25a462(0x306),'pluginId':'feishu','reason':_0x25a462(0x31c)+_0x25a462(0x210)+_0x25a462(0x2c7)+_0x25a462(0x2fa)});return delete _0x17964a[_0x25a462(0x306)],_0x58a02b[_0x25a462(0x2f7)]=_0x17964a,_0x286460[_0x25a462(0x306)]={...asRecord(_0x286460[_0x25a462(0x306)]),'enabled':![]},_0x390274[_0x25a462(0x2f9)]=_0x286460,_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274[_0x25a462(0x2a8)])[_0x25a462(0x2d9)](_0x4dac9a=>_0x4dac9a!==_0x25a462(0x306)),_0x58a02b[_0x25a462(0x360)]=_0x390274,_0x5b1448(_0x58a02b,_0x25a462(0x31c)+_0x25a462(0x210)+'onfig\x20de'+'leted');}if(_0xb1e74a==='qqbot'){if(typeof openClawConfigHandlers[_0x25a462(0x217)+'annelCon'+_0x25a462(0x3b0)]===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+'fig']({'channelId':_0x25a462(0x3ba),'pluginId':QQBOT_PLUGIN_ID,'reason':_0x25a462(0x248)+_0x25a462(0x2d8)+_0x25a462(0x34e)+_0x25a462(0x3c7)});delete _0x17964a[_0x25a462(0x3ba)],_0x286460[QQBOT_PLUGIN_ID]={...asRecord(_0x286460[QQBOT_PLUGIN_ID]),'enabled':![]},_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274[_0x25a462(0x2a8)])['filter'](_0x34df7b=>_0x34df7b!==QQBOT_PLUGIN_ID);}if(_0xb1e74a===_0x25a462(0x2ac)){if(typeof openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+'fig']==='function')return openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+'fig']({'channelId':_0x25a462(0x2ac),'pluginId':WECOM_PLUGIN_ID,'reason':'wecom\x20ch'+'annel\x20co'+'nfig\x20del'+_0x25a462(0x3c7)});delete _0x17964a[_0x25a462(0x2ac)],_0x286460[WECOM_PLUGIN_ID]={...asRecord(_0x286460[WECOM_PLUGIN_ID]),'enabled':![]},_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274[_0x25a462(0x2a8)])[_0x25a462(0x2d9)](_0x24b995=>_0x24b995!==WECOM_PLUGIN_ID);}return _0x58a02b[_0x25a462(0x2f7)]=_0x17964a,_0x390274[_0x25a462(0x2f9)]=_0x286460,_0x58a02b[_0x25a462(0x360)]=_0x390274,_0x5b1448(_0x58a02b,_0xb1e74a+(_0x25a462(0x2c3)+'\x20config\x20'+_0x25a462(0x247)));}async function _0x4c454d(_0x531dda={}){const _0xef1a92=_0x5f22af,_0x5dbdff=safeString(_0x531dda[_0xef1a92(0x1f2)+'d']||_0x531dda['id']);if(!_0x5dbdff)throw new Error(_0xef1a92(0x211)+_0xef1a92(0x325)+_0xef1a92(0x345));const _0x573c4e=_0x531dda[_0xef1a92(0x368)]===!![],_0x527e10=await _0x29d527(),_0x13e1e7=asRecord(_0x527e10[_0xef1a92(0x360)]),_0x3322cf=asRecord(_0x13e1e7[_0xef1a92(0x2f9)]),_0x356b55=_0x1872cc=>{const _0x356be8=_0xef1a92;_0x3322cf[_0x1872cc]=createConnectorPluginEntry(_0x1872cc,_0x3322cf[_0x1872cc],_0x573c4e,{},{'preserveExistingConfig':!![]}),_0x13e1e7['allow']=_0x573c4e?dedupeStrings([...asStringArray(_0x13e1e7[_0x356be8(0x2a8)]),_0x1872cc]):asStringArray(_0x13e1e7[_0x356be8(0x2a8)])[_0x356be8(0x2d9)](_0x1e48d9=>_0x1e48d9!==_0x1872cc),_0x13e1e7[_0x356be8(0x2f9)]=_0x3322cf,_0x527e10[_0x356be8(0x360)]=_0x13e1e7;};if(_0x5dbdff===_0xef1a92(0x3c5)+'oc'){const _0x36cc48=asRecord(_0x3322cf[FEISHU_DOC_CONNECTOR_PLUGIN_ID]);if(Object[_0xef1a92(0x32d)](_0x36cc48)['length']===0x0)throw new Error(_0xef1a92(0x381)+_0xef1a92(0x388)+_0x5dbdff+(_0xef1a92(0x39e)+_0xef1a92(0x330)));if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(FEISHU_DOC_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff===_0xef1a92(0x364)){if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+_0xef1a92(0x276))+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(QQ_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff===_0xef1a92(0x39a)+'mail'){if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+('\x20channel'+_0xef1a92(0x276))+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(NETEASE_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff===_0xef1a92(0x287)+_0xef1a92(0x2d0)){if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers['setPlugi'+'nConfig']({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff==='tencent_'+_0xef1a92(0x2a7)){const _0x423f97=asRecord(_0x527e10[_0xef1a92(0x257)]),_0x5c9f30=asRecord(_0x423f97[_0xef1a92(0x2f9)]),_0x3f6314=asRecord(_0x5c9f30[TENCENT_DOCS_SKILL_ID]);if(typeof openClawConfigHandlers[_0xef1a92(0x2e2)+_0xef1a92(0x37a)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x2e2)+'Entry']({'skillId':TENCENT_DOCS_SKILL_ID,'entry':{..._0x3f6314,'enabled':_0x573c4e},'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):'disabled')});_0x5c9f30[TENCENT_DOCS_SKILL_ID]={..._0x3f6314,'enabled':_0x573c4e},_0x423f97[_0xef1a92(0x2f9)]=_0x5c9f30,_0x527e10[_0xef1a92(0x257)]=_0x423f97;}else{if(_0x5dbdff===_0xef1a92(0x262)){if(_0x573c4e&&!await _0x449207())throw new Error('金山文档尚未授权'+_0xef1a92(0x3f4));return await _0x23b6d7(_0x573c4e),{'ok':!![]};}else{if(_0x5dbdff===_0xef1a92(0x318)+_0xef1a92(0x338)){const _0x6edb2d=readOpenClawMcpServersFromConfig(_0x527e10),_0x40e348=findDingtalkDocMcpServer(_0x6edb2d);if(!getTrimmedString(_0x40e348[_0xef1a92(0x348)]))throw new Error(_0xef1a92(0x381)+_0xef1a92(0x388)+_0x5dbdff+(_0xef1a92(0x39e)+'und'));_0x6edb2d[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x40e348['url'],{'enabled':_0x573c4e}),writeOpenClawMcpServersToConfig(_0x527e10,_0x6edb2d);}else{const _0x1b71f7=asRecord(_0x527e10['channels']),_0x191d0d=asRecord(_0x1b71f7[_0x5dbdff]);if(Object['keys'](_0x191d0d)[_0xef1a92(0x2d3)]===0x0)throw new Error(_0xef1a92(0x211)+'\x22'+_0x5dbdff+(_0xef1a92(0x39e)+'und'));_0x191d0d[_0xef1a92(0x368)]=_0x573c4e;let _0x221b95=null;_0x5dbdff===_0xef1a92(0x306)&&(_0x221b95=_0xef1a92(0x306),_0x573c4e&&(_0x191d0d[_0xef1a92(0x2dc)+'g']=!![],delete _0x191d0d[_0xef1a92(0x31f)]));if(_0x5dbdff===_0xef1a92(0x3ba))_0x221b95=QQBOT_PLUGIN_ID;if(_0x5dbdff===_0xef1a92(0x2ac))_0x221b95=WECOM_PLUGIN_ID;if(_0x221b95&&typeof openClawConfigHandlers[_0xef1a92(0x2f4)+_0xef1a92(0x2e0)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x2f4)+_0xef1a92(0x2e0)]({'channelId':_0x5dbdff,'channel':_0x191d0d,'pluginId':_0x221b95,'pluginEnabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x1b71f7[_0x5dbdff]=_0x191d0d,_0x527e10[_0xef1a92(0x2f7)]=_0x1b71f7;if(_0x5dbdff===_0xef1a92(0x306))_0x356b55(_0xef1a92(0x306));if(_0x5dbdff===_0xef1a92(0x3ba))_0x356b55(QQBOT_PLUGIN_ID);if(_0x5dbdff===_0xef1a92(0x2ac))_0x356b55(WECOM_PLUGIN_ID);}}}}}}}return _0x5b1448(_0x527e10,_0x5dbdff+(_0xef1a92(0x2c3)+_0xef1a92(0x276))+(_0x573c4e?_0xef1a92(0x368):'disabled'));}async function _0x8a0a63({gatewayPort:_0x39a064,gatewayToken:_0x2d473d}={}){const _0x5483b3=_0x5f22af;_0x560f0f&&(_0x560f0f[_0x5483b3(0x242)](),_0x560f0f=null);const {cwd:_0x1a9bbf,env:_0x15cba2,runtime:_0x31ff63}=await _0x54f4d7({'FORCE_COLOR':'0',..._0x39a064?{'OPENCLAW_GATEWAY_PORT':String(_0x39a064)}:{},..._0x2d473d?{'OPENCLAW_GATEWAY_TOKEN':_0x2d473d}:{}}),_0x54567b=_0x31ff63[_0x5483b3(0x360)]['find'](_0x4b8cc8=>_0x4b8cc8[_0x5483b3(0x304)]===WECHAT_PLUGIN_ID);if(!_0x54567b){const _0x505839='当前客户端未内置'+_0x5483b3(0x30c)+_0x5483b3(0x35f)+_0x5483b3(0x230);return _0x221e70(_0x5483b3(0x2ca)+_0x5483b3(0x2d5),'ERROR'),_0x221e70(_0x5483b3(0x244)+'og',_0x505839),{'ok':![],'error':_0x505839};}await _0x2217b4(!![]),_0x221e70(_0x5483b3(0x244)+'og','spawn\x20op'+_0x5483b3(0x38c)+'hannels\x20'+_0x5483b3(0x20b)+_0x5483b3(0x2bc)+_0x54567b['pluginId']),_0x560f0f=spawn(_0x31ff63[_0x5483b3(0x309)+_0x5483b3(0x374)],[_0x31ff63[_0x5483b3(0x272)+_0x5483b3(0x20f)],_0x5483b3(0x2f7),_0x5483b3(0x3da),_0x5483b3(0x24d)+'l',_0x54567b[_0x5483b3(0x304)]],{'cwd':_0x1a9bbf,'env':_0x15cba2});let _0x5b4ad3='',_0xcac917=![],_0x37749=![];const _0x2858a7=_0x343887=>{const _0x150efb=_0x5483b3,_0x1adcd4=_0x343887['toString']();_0x5b4ad3+=_0x1adcd4;if(!_0xcac917){const _0x365d4a=_0x5b4ad3['match'](/(https:\/\/(?:[a-zA-Z0-9-]+\.)*weixin\.qq\.com\S+)/i);_0x365d4a?.[0x1]&&(_0xcac917=!![],_0x221e70(_0x150efb(0x215)+_0x150efb(0x3a8),_0x365d4a[0x1]),_0x221e70(_0x150efb(0x2ca)+'tatus',_0x150efb(0x2f6)));}if(_0x1adcd4['includes'](_0x150efb(0x266))||_0x1adcd4[_0x150efb(0x3f2)]('Scan\x20suc'+_0x150efb(0x2b5))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3ad)))_0x221e70(_0x150efb(0x2ca)+_0x150efb(0x2d5),'SCANNED');else{if(_0x1adcd4[_0x150efb(0x3f2)]('登录成功')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3a6))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x36f))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x32b)+'n')||_0x1adcd4['includes'](_0x150efb(0x314)+'ccess')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3cb))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x30a))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3b1))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3f7)+_0x150efb(0x383)+'d')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x2c0)+_0x150efb(0x299)+_0x150efb(0x3a0)))_0x37749=!![],_0x221e70(_0x150efb(0x2ca)+_0x150efb(0x2d5),'SUCCESS'),setTimeout(()=>{const _0x29c56f=_0x150efb;_0x560f0f&&(_0x560f0f[_0x29c56f(0x242)](),_0x560f0f=null);},0xbb8);else{if(_0x1adcd4[_0x150efb(0x3f2)]('过期')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x28d)))_0x221e70('wechat-s'+_0x150efb(0x2d5),_0x150efb(0x2fb));else(_0x1adcd4[_0x150efb(0x3f2)]('失败')||_0x1adcd4[_0x150efb(0x3f2)]('Failed')||_0x1adcd4['includes'](_0x150efb(0x2ad)))&&_0x221e70(_0x150efb(0x2ca)+_0x150efb(0x2d5),_0x150efb(0x28f));}}_0x221e70('wechat-l'+'og',_0x1adcd4);};return _0x560f0f[_0x5483b3(0x2eb)]?.['on'](_0x5483b3(0x387),_0x2858a7),_0x560f0f[_0x5483b3(0x22f)]?.['on'](_0x5483b3(0x387),_0x2858a7),_0x560f0f['on']('error',_0x295a85=>{const _0x5ef32a=_0x5483b3;_0x560f0f=null,_0x221e70('wechat-s'+_0x5ef32a(0x2d5),'ERROR'),_0x221e70(_0x5ef32a(0x244)+'og','Spawn\x20er'+_0x5ef32a(0x3b3)+_0x295a85[_0x5ef32a(0x227)]);}),_0x560f0f['on']('close',_0x1d46ff=>{const _0x2b34a6=_0x5483b3;_0x560f0f=null,_0x37749?_0x2217b4(!![])['catch'](()=>{}):(_0x2217b4(![])[_0x2b34a6(0x34f)](()=>{}),_0x221e70(_0x2b34a6(0x2ca)+'tatus',_0x1d46ff===0x0?_0x2b34a6(0x3d8):_0x2b34a6(0x28f)));}),{'ok':!![]};}function _0x547634(){const _0xbc2945=_0x5f22af;return _0x560f0f&&(_0x560f0f[_0xbc2945(0x242)](),_0x560f0f=null),{'ok':!![]};}function _0x4e9a23(){const _0x8ce216=_0x5f22af;for(const _0x1ee22a of _0x46aac2[_0x8ce216(0x2be)]()){_0x461263(_0x1ee22a),_0x1ee22a[_0x8ce216(0x2f2)]?.[_0x8ce216(0x242)]();}_0x46aac2[_0x8ce216(0x25f)]();for(const _0x25c457 of _0x222366[_0x8ce216(0x2be)]()){_0x1d676b(_0x25c457);}_0x222366['clear']();for(const _0x24407a of _0x2c64a9['values']()){_0x4a2a9b(_0x24407a),_0x5d4363(_0x24407a),_0x24407a['process']?.[_0x8ce216(0x242)]();}_0x2c64a9[_0x8ce216(0x25f)](),_0x560f0f&&(_0x560f0f['kill'](),_0x560f0f=null);}return{'saveFeishuChannelConfig':_0x3320d5,'saveQqbotChannelConfig':_0x4e3614,'saveWecomChannelConfig':_0x54ed61,'saveQqMailConnectorConfig':_0x372ecf,'saveNetEaseMailConnectorConfig':_0x27b808,'saveTencentExmailConnectorConfig':_0x48b0d6,'saveFeishuDocConnectorConfig':_0x108fc7,'saveTencentDocsConnectorConfig':_0x46ce45,'saveKdocsConnectorConfig':_0x1407c8,'saveDingtalkDocConnectorConfig':_0x4fb3b7,'readConfigSnapshot':_0x49252a,'startKdocsCliConnectSession':_0x59756d,'getKdocsCliConnectStatus':_0x334d82,'cancelKdocsCliConnectSession':_0x99803b,'startFeishuDocCliConnectSession':_0x2642c0,'getFeishuDocCliConnectStatus':_0x53ee11,'cancelFeishuDocCliConnectSession':_0x56a326,'completeFeishuDocCliConnectSession':_0x3792c0,'startFeishuRegistrationSession':_0x5935c8,'getFeishuRegistrationStatus':_0x461c31,'cancelFeishuRegistrationSession':_0x25607d,'listImChannelConfigs':_0x20f0d1,'deleteImChannelConfig':_0x46a5ef,'setImChannelEnabled':_0x4c454d,'startWechatChannelSession':_0x8a0a63,'cancelWechatChannelSession':_0x547634,'dispose':_0x4e9a23};}
|
|
1
|
+
(function(_0x11b430,_0x4cf597){const _0xda2583=_0x3a32,_0xc96364=_0x11b430();while(!![]){try{const _0x2b5add=-parseInt(_0xda2583(0x1ee))/0x1+-parseInt(_0xda2583(0x302))/0x2+-parseInt(_0xda2583(0x24f))/0x3+parseInt(_0xda2583(0x1b0))/0x4*(parseInt(_0xda2583(0x14a))/0x5)+parseInt(_0xda2583(0x1b7))/0x6+parseInt(_0xda2583(0x2c7))/0x7*(parseInt(_0xda2583(0x138))/0x8)+parseInt(_0xda2583(0x314))/0x9;if(_0x2b5add===_0x4cf597)break;else _0xc96364['push'](_0xc96364['shift']());}catch(_0x45411c){_0xc96364['push'](_0xc96364['shift']());}}}(_0x375a,0x88971));import{spawn}from'node:child_process';import{randomUUID}from'node:crypto';import{mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{homedir}from'node:os';import{dirname,join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'../common/utils.mjs';import{DEFAULT_FEISHU_REGISTRATION_ENV,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS,DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS,DINGTALK_DOC_MCP_SERVER_NAME,FEISHU_DOC_CONNECTOR_PLUGIN_ID,FEISHU_REGISTRATION_ENV_URLS,KDOCS_SKILL_ID,NETEASE_MAIL_CONNECTOR_PLUGIN_ID,QQBOT_PLUGIN_ID,QQ_MAIL_CONNECTOR_PLUGIN_ID,TENCENT_DOCS_SKILL_ID,TENCENT_DOCS_TOKEN_ENV,TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,WECOM_PLUGIN_ID,WECHAT_PLUGIN_ID}from'./constants.mjs';import{applyFeishuChannelConfig,createConnectorPluginEntry,createDingtalkDocMcpServerConfig,normalizeFeishuDmPolicy,normalizeFeishuGroupPolicy,readOpenClawMcpServersFromConfig,writeOpenClawMcpServersToConfig}from'./config-utils.mjs';const KDOCS_CLI_STEP_TIMEOUT_MS=0x2bf20,KDOCS_CLI_AUTH_POLL_INTERVAL_MS=0x5dc,FEISHU_DOC_CLI_STEP_TIMEOUT_MS=0xa*0x3c*0x3e8;function safeString(_0x9c1199){const _0x2822f0=_0x3a32;return typeof _0x9c1199===_0x2822f0(0x287)?_0x9c1199[_0x2822f0(0x311)]():'';}function findDingtalkDocMcpServer(_0x26aa8d){const _0x58f52d=_0x3a32,_0x585bda=asRecord(_0x26aa8d[DINGTALK_DOC_MCP_SERVER_NAME]);if(Object['keys'](_0x585bda)[_0x58f52d(0x20a)]>0x0)return _0x585bda;for(const [_0x33bf6e,_0x53b2ae]of Object[_0x58f52d(0x148)](_0x26aa8d)){const _0x19f2dd=asRecord(_0x53b2ae),_0x3a86aa=getTrimmedString(_0x33bf6e)['toLowerC'+_0x58f52d(0x335)](),_0x492557=getTrimmedString(_0x19f2dd['url'])[_0x58f52d(0x20d)+_0x58f52d(0x335)]();if(_0x3a86aa['includes'](_0x58f52d(0x2b7))||_0x3a86aa[_0x58f52d(0x2e7)](_0x58f52d(0x18f))||_0x3a86aa[_0x58f52d(0x2e7)]('钉钉')||_0x492557[_0x58f52d(0x2e7)](_0x58f52d(0x2b7))||_0x492557['includes'](_0x58f52d(0x18f)))return _0x19f2dd;}return{};}function createFeishuRegistrationClient(){const _0x427eb3=_0x3a32,_0x44fe68=FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV];if(!_0x44fe68)throw new Error(_0x427eb3(0x220)+_0x427eb3(0x18b)+_0x427eb3(0x168)+_0x427eb3(0x187)+_0x427eb3(0x1ec)+DEFAULT_FEISHU_REGISTRATION_ENV);return{'baseUrl':_0x44fe68,'headers':{'Content-Type':_0x427eb3(0x238)+'ion/x-ww'+_0x427eb3(0x2cd)+_0x427eb3(0x232)+'d'},'timeoutMs':DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS};}async function postFeishuRegistration(_0x84768c,_0xa59adf){const _0x3fee1f=_0x3a32,_0x5a142a=await fetch(_0x84768c[_0x3fee1f(0x1dc)]+(_0x3fee1f(0x217)+_0x3fee1f(0x1c4)+_0x3fee1f(0x23c)+'on'),{'method':'POST','headers':_0x84768c[_0x3fee1f(0x27e)],'body':new URLSearchParams(_0xa59adf)[_0x3fee1f(0x1c7)](),'signal':AbortSignal[_0x3fee1f(0x1c6)](_0x84768c[_0x3fee1f(0x325)+'s'])}),_0x4ff67f=await _0x5a142a[_0x3fee1f(0x327)]()[_0x3fee1f(0x14d)](()=>({}));if(!_0x5a142a['ok']){const _0x529e9e=new Error(_0x3fee1f(0x31f)+_0x5a142a[_0x3fee1f(0x147)]);_0x529e9e[_0x3fee1f(0x1a9)+_0x3fee1f(0x169)]=_0x4ff67f;throw _0x529e9e;}return asRecord(_0x4ff67f);}function _0x3a32(_0x14bdf9,_0x46c90a){_0x14bdf9=_0x14bdf9-0x12f;const _0x375a88=_0x375a();let _0x3a3269=_0x375a88[_0x14bdf9];return _0x3a3269;}async function initFeishuRegistration(_0x3347bc){const _0x268a85=_0x3a32;return postFeishuRegistration(_0x3347bc,{'action':_0x268a85(0x159)});}function _0x375a(){const _0x47bf07=['hasOwnPr','own,wiki','账号\x20is\x20re','onSucces','openExte','already\x20','skills','/oauth/v','\x22\x20not\x20fo','ctor\x20plu','正在启动金山文档','QQ机器人\x20Ap','isArray','r-log','split','飞书\x20CLI\x20执','Unsuppor','权状态验证失败','Login\x20su','lePath','elConfig','请在飞书开放平台','ent\x20does','wechat-s','nodeExec','identiti','li_user','金山文档已连接','ill\x20','163\x20邮箱','e_code:\x20','deviceCo','--versio','feishu','rlencode','auth','max','连接成功','name','ope-auth','applicat','user_inf','full','ail.qq.c','gistrati','回应用创建页面或','安装包含微信插件','slice','Current\x20','ill\x20enab','r\x20\x22','n\x20respon','wechat','--app-se','http:','feishu\x20c','.com','search:d','\x20config\x20','toISOStr','indexOf','account','ationCod','2428827pesWFS','flow_id','update','gin\x20dele','process','purpose','Feishu\x20r','<empty>','/page/sc','i\x20auth\x20l','persistC','utable','filter','二维码已过期,请','正在进入用户授权','tion_url','mail','enclaw\x20c','p\x20URL','groupPol','igRaw','utf8','ntervalM','器人绑定','slow_dow','Agent','smtp.exm','ocr','wecom\x20ch','appPollI','found','now','飞书开放平台未返','QQ\x20邮箱','nfig\x20del','appTimer','scriptPa','eted','飞书绑定失败:','\x20deleted','lient','phase','cret-std','join','keys','nConfig','rnal','headers','文档\x20Strea','ent_secr','websocke','client_i','allowFro','ode','config','spawn','string','then','Invalid\x20','und','失败,请确认\x20k','transpor','allowlis','飞书\x20CLI\x20用','url','创建失败','verify','netease\x20','\x20exited\x20','nector\x20p','\x20chars)','or\x20plugi',':authori','login','ion\x20sess','close','ion\x20id\x20i','qq\x20mail\x20','qq_mail','飞书\x20CLI\x20授','logout','mcp','飞书\x20CLI\x20连','docs\x20ski','\x20in\x20begi','dAt','tencent_','groupAll','tokenSta','Entry','timer','env','oc\x20conne','deleteSk','户授权失败','Bin','bind','r\x20plugin','ationUri','setSkill','verifyTi','kdocs','resolve','imap.163','dingtalk','support@','ill\x20conn','message','oxy','身份要求:\x20','feishu\x20d','availabl','ired','feishu_c','wechat-l','ion_uri_','setPlugi','http_pro','接失败','tion_uri','357iImXfT','Connecto','\x20connect','le-http','onFailur','owFrom','w-form-u','--force-','expiresA','pID\x20is\x20r','streamab','飞书应用创建超时','金山文档授权状态','e\x20or\x20dev','authStat','stringif','EXPIRED','writeCon','error_de','授权状态','飞书机器人\x20Ap','channelI','parse','行失败','set','valid','expired','identity','stdout','interval','企微助手','setMcpSe','includes','protocol','disabled','rcode','push','data','\x20doc\x20mcp','hannels\x20','smtp.163','thorizat','sessionI','hannel\x20c','mer','onfig','正在检查飞书\x20C','登录成功','飞书应用创建失败','assign','error','secret','ethods','i_comple','验证失败','onfig\x20de','权状态验证超时','rvalMs','ccess','1677162KDBoNZ','CLOSED','nding','启动成功','supporte','\x20已安装','ation_pe','clear','equired','spawn\x20op','token','cliAppId','appId','\x20device_','扫码成功','trim','飞书用户身份授权','ve,markd','11809152enAcPH','expire_i','d\x20auth','钉钉文档\x20Str','exmail\x20c','scriptio','environm','\x20not\x20sup','无需重复连接','get','appExpir','HTTP\x20','飞书应用已创建,','poll','ready','ession\x20i','orizatio','timeoutM','正在初始化飞书\x20','json','output','annelCon','leted','import','tencent\x20','ecret\x20应用','all_prox','企微助手\x20Sec','Error','egistrat','ret\x20is\x20r','boolean','map','ase','values','lastInde','onfigPat','open_id','ocs-cli\x20','n\x20not\x20fo','--scope','ation_ur','skill','dmPolicy','15000zBckWb','Scan\x20suc','Personal','qqbot','usStarte','ERROR','飞书\x20CLI\x20未','executab','authoriz','match','ll\x20updat','startedA','山文档授权','pluginId','\x20专用应用凭据缺','status','entries','eamableH','15Zosnir','usTimer','腾讯文档\x20Key','catch','setChann','find','ector\x20de','ice_code','accounts','n\x20update','zationCo','enabled','ctor\x20del','Local\x20lo','doc_conn','init','end','ot\x20found','errorMes','.json','deleted','once','腾讯企业邮箱','kill','smtp.qq.','docs','andledIn','quired','check','feishu_d','hu\x20regis','Data','金山文档登录启动','create','stderr','ecret','connecte','飞书绑定失败','fig','tatus','等待飞书用户授权','飞书文档\x20CLI','tionUriC','金山文档','sage','user','deleteMc','id\x20is\x20re','--channe','projectR','cret','正在打开飞书用户','ion\x20not\x20','--device','环境不支持创建\x20','ame','test','fresh','openclaw','oot','n\x20id\x20is\x20','tration\x20','readConf','operty','allow','ted\x20Feis','\x20updated','wecom','SUCCESS','dingding','expired_','igWriteH','deleteCh','ttp\x20URL\x20','gin\x20save','QR_READY','I\x20sessio','HTTP_PRO','完成应用创建','HTTPS_PR','ALL_PROX','ll\x20conne','nfig\x20upd','cliAppSe','pSecret\x20','clientSe','with\x20cod','export','正在验证飞书授权','object','channel\x20','appDevic','SCANNED','se.',':user','response','feishu-d','logged\x20i','飞书用户身份','illEntry','enied','scope_au','665660ToHWgN','d_auth_m','oc\x20CLI\x20s','connecto','ated','返回授权\x20URL','docs-cli','3846084orOxPe','mableHtt','read','connecti','i:keycha','_doc','eCode','用绑定失败','\x20is\x20requ','Kdocs\x20CL','function','ession\x20n','pServer','1/app/re','client','timeout','toString','access_d','exmail','_complet','client_s','plugin','resolveS','netease_','ector','飞书\x20CLI\x20应','当前飞书开放平台','apiKey','wujie.ai','Channel\x20','微信连接插件,请','Failed','accountN','footer','complete','cliHostC','channels','baseUrl','verifica','\x20plugin\x20','lark-cli','dated','xOf','已连接过','Feishu\x20d','正在验证金山文档','required','qqbot\x20ch','annel\x20co','com','oc-cli','权状态不符合用户','ocs:read','env:\x20','WujieAI','340349vFDgsD','code','esAt','managedB','onMode','delete','hint','kdocs-cl','red','gin\x20upda','pollInte','plugins','stdin','cess','失,无法初始化','kdocs\x20sk','ogin','lugin\x20de','uired','授权码\x20is\x20r','\x20channel','-weixin','scanned','open',',请先连接','Missing\x20','onnector','ted','length','appPollC','device_c','toLowerC','appSecre','pending'];_0x375a=function(){return _0x47bf07;};return _0x375a();}async function beginFeishuRegistration(_0x2d7971){const _0x513e4d=_0x3a32;return postFeishuRegistration(_0x2d7971,{'action':'begin','archetype':_0x513e4d(0x13a)+_0x513e4d(0x268),'auth_method':_0x513e4d(0x1cb)+'ecret','request_user_info':_0x513e4d(0x131)});}async function pollFeishuRegistration(_0x540945,_0x3efe72){const _0x1d6a2f=_0x3a32;try{return await postFeishuRegistration(_0x540945,{'action':_0x1d6a2f(0x321),'device_code':_0x3efe72});}catch(_0x5b74ea){if(_0x5b74ea?.[_0x1d6a2f(0x1a9)+_0x1d6a2f(0x169)]&&typeof _0x5b74ea['response'+_0x1d6a2f(0x169)]===_0x1d6a2f(0x1a3))return asRecord(_0x5b74ea[_0x1d6a2f(0x1a9)+_0x1d6a2f(0x169)]);throw _0x5b74ea;}}function extractFeishuRegistrationAuthorizationUri(_0x542a8b){const _0x1550b2=_0x3a32,_0x1cb480=getTrimmedString(_0x542a8b[_0x1550b2(0x140)+_0x1550b2(0x135)+_0x1550b2(0x2fc)+'te'])||getTrimmedString(_0x542a8b[_0x1550b2(0x140)+_0x1550b2(0x135)+'i'])||getTrimmedString(_0x542a8b['scope_au'+_0x1550b2(0x2f0)+_0x1550b2(0x2c2)+_0x1550b2(0x1d9)])||getTrimmedString(_0x542a8b[_0x1550b2(0x1af)+_0x1550b2(0x2f0)+'ion_uri'])||getTrimmedString(_0x542a8b['scope_au'+_0x1550b2(0x2f0)+'ion_url'])||getTrimmedString(_0x542a8b[_0x1550b2(0x140)+_0x1550b2(0x135)+'l']);if(_0x1cb480)return _0x1cb480;const _0x8d6497=getTrimmedString(_0x542a8b[_0x1550b2(0x250)])||getTrimmedString(_0x542a8b[_0x1550b2(0x1af)+'thorizat'+'ion_flow'+'_id']);return _0x8d6497?FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV]+(_0x1550b2(0x257)+_0x1550b2(0x237)+_0x1550b2(0x324)+'n?flow_i'+'d=')+encodeURIComponent(_0x8d6497):null;}function serializeFeishuRegistrationSession(_0x511985){const _0x5b1321=_0x3a32;return{'sessionId':_0x511985[_0x5b1321(0x2f1)+'d'],'verificationUriComplete':_0x511985[_0x5b1321(0x1dd)+_0x5b1321(0x174)+'omplete'],'expiresAt':new Date(_0x511985['expiresA'+'t'])[_0x5b1321(0x24b)+'ing'](),'pollIntervalMs':_0x511985['pollInte'+_0x5b1321(0x300)],'status':_0x511985[_0x5b1321(0x147)],'errorMessage':_0x511985['errorMes'+_0x5b1321(0x176)],'purpose':_0x511985['purpose'],'authorizationUri':_0x511985[_0x5b1321(0x140)+'ationUri']};}function extractFirstUrl(_0x557480){const _0x376815=_0x557480['match'](/https?:\/\/[^\s"'<>]+/i);return _0x376815?_0x376815[0x0]:null;}function isKdocsAuthStatusReady(_0x151244){const _0x3a2592=_0x3a32,_0x220878=_0x151244[_0x3a2592(0x20d)+_0x3a2592(0x335)]();if(/not\s+login|not\s+logged|unauth|未登录|未认证|未授权|失败/[_0x3a2592(0x182)](_0x220878))return![];return/login|logged|auth|valid|success|已登录|已认证|已授权|有效|成功/['test'](_0x220878);}function parseFeishuDocCliJson(_0x218304){const _0x17767b=_0x3a32,_0x1e032e=_0x218304['trim']();if(!_0x1e032e)return{};try{return asRecord(JSON[_0x17767b(0x2dd)](_0x1e032e));}catch{for(let _0x50dd9f=_0x1e032e[_0x17767b(0x24c)]('{');_0x50dd9f>=0x0;_0x50dd9f=_0x1e032e[_0x17767b(0x24c)]('{',_0x50dd9f+0x1)){for(let _0x222dc4=_0x1e032e[_0x17767b(0x12f)+_0x17767b(0x1e1)]('}');_0x222dc4>_0x50dd9f;_0x222dc4=_0x1e032e['lastInde'+_0x17767b(0x1e1)]('}',_0x222dc4-0x1)){try{return asRecord(JSON['parse'](_0x1e032e[_0x17767b(0x23f)](_0x50dd9f,_0x222dc4+0x1)));}catch{}}}return{};}}function summarizeCliOutput(_0x386998){const _0x662747=_0x3a32,_0x5b4816=_0x386998[_0x662747(0x311)]();if(!_0x5b4816)return _0x662747(0x256);return _0x5b4816['length']>0x320?_0x5b4816['slice'](0x0,0x320)+'...('+_0x5b4816[_0x662747(0x20a)]+_0x662747(0x295):_0x5b4816;}function extractFeishuDocCliError(_0x521bb0,_0x5a6825){const _0x5dcf20=_0x3a32,_0x10b7a4=parseFeishuDocCliJson(_0x521bb0),_0x51b8a6=asRecord(_0x10b7a4[_0x5dcf20(0x2f9)]),_0x38b648=getTrimmedString(_0x51b8a6[_0x5dcf20(0x2ba)]),_0x2f5493=getTrimmedString(_0x51b8a6[_0x5dcf20(0x1f4)]);if(_0x38b648&&_0x2f5493)return _0x38b648+'\x0a'+_0x2f5493;if(_0x38b648)return _0x38b648;return _0x521bb0['trim']()||_0x5a6825;}function getFeishuDocCliFailureMessage(_0x1359d3,_0x166f57,_0x2a998c){const _0x33cd92=_0x3a32,_0x499b77=_0x166f57[_0x33cd92(0x311)]()[_0x33cd92(0x21e)]('\x0a')['slice'](-0x8)[_0x33cd92(0x27a)]('\x0a')[_0x33cd92(0x311)](),_0x35e0c8=_0x1359d3===_0x33cd92(0x16b)?'飞书开放平台应用'+_0x33cd92(0x290):_0x1359d3===_0x33cd92(0x2af)?_0x33cd92(0x1d0)+_0x33cd92(0x1be):_0x1359d3===_0x33cd92(0x233)?_0x33cd92(0x28e)+_0x33cd92(0x2ad):_0x33cd92(0x29e)+_0x33cd92(0x221);return _0x499b77?_0x35e0c8+':\x20'+_0x499b77:_0x35e0c8+':\x20'+_0x2a998c;}function ensureFeishuDocCliUserStatus(_0x14a6f1){const _0x55fd60=_0x3a32,_0x3ef6c4=parseFeishuDocCliJson(_0x14a6f1),_0x5cfe5b=asRecord(_0x3ef6c4[_0x55fd60(0x229)+'es']),_0xcca0ef=asRecord(_0x5cfe5b['user']),_0x5dd577=getTrimmedString(_0x3ef6c4[_0x55fd60(0x2e2)]),_0xabc6ce=getTrimmedString(_0x3ef6c4[_0x55fd60(0x2a7)+'tus'])||getTrimmedString(_0xcca0ef[_0x55fd60(0x2a7)+'tus']),_0xa6fb8c=getTrimmedString(_0xcca0ef['status']),_0x41840a=_0xcca0ef[_0x55fd60(0x2be)+'e']===!![];if(_0x5dd577!==_0x55fd60(0x177)||_0xa6fb8c&&_0xa6fb8c!==_0x55fd60(0x322)||Object[_0x55fd60(0x27b)](_0xcca0ef)[_0x55fd60(0x20a)]>0x0&&!_0x41840a||_0xabc6ce!==_0x55fd60(0x2e0)&&_0xabc6ce!=='needs_re'+_0x55fd60(0x183))throw new Error('飞书\x20CLI\x20授'+_0x55fd60(0x1ea)+_0x55fd60(0x2bc)+_0x14a6f1[_0x55fd60(0x311)]());}function createKdocsCliStatus(_0x5efe2e){const _0x34fa3e=_0x3a32;return{'sessionId':_0x5efe2e[_0x34fa3e(0x2f1)+'d'],'status':_0x5efe2e[_0x34fa3e(0x147)],'phase':_0x5efe2e[_0x34fa3e(0x278)],'url':_0x5efe2e[_0x34fa3e(0x28f)],'message':_0x5efe2e['message'],'errorMessage':_0x5efe2e[_0x34fa3e(0x15c)+_0x34fa3e(0x176)]};}function createFeishuDocCliStatus(_0x4d297d){const _0x45b121=_0x3a32;return{'sessionId':_0x4d297d[_0x45b121(0x2f1)+'d'],'status':_0x4d297d[_0x45b121(0x147)],'phase':_0x4d297d[_0x45b121(0x278)],'url':_0x4d297d['url'],'message':_0x4d297d[_0x45b121(0x2ba)],'errorMessage':_0x4d297d['errorMes'+_0x45b121(0x176)]};}export function createConnectorController({shellConfig:_0x7d8c27,configController:_0x3c90c7,broadcast:_0x5480d5,shell:_0x2df123,getRuntimeSpawnContext:_0x40c6d0,openClawConfigHandlers:openClawConfigHandlers={},resolveRuntimeKdocsCliCommand:_0x299829,resolveRuntimeLarkCliCommand:_0x4209a5}){const _0x2b295d=_0x3a32,_0x431985=new Map(),_0xf32f18=new Map(),_0x4584d2=new Map();let _0x3b45c3=null;const _0xacda93=()=>_0x3c90c7[_0x2b295d(0x188)+_0x2b295d(0x263)]();async function _0x3bdeb2(_0x20bb38,_0xd1df62){const _0x304093=_0x2b295d;if(typeof openClawConfigHandlers[_0x304093(0x251)]==='function')return openClawConfigHandlers[_0x304093(0x251)](_0x358738=>{const _0xfa04f2=_0x304093;for(const _0x756d42 of Object[_0xfa04f2(0x27b)](_0x358738)){!Object['prototyp'+'e'][_0xfa04f2(0x210)+_0xfa04f2(0x189)]['call'](_0x20bb38,_0x756d42)&&delete _0x358738[_0x756d42];}Object[_0xfa04f2(0x2f8)](_0x358738,_0x20bb38);},_0xd1df62);return typeof _0x3c90c7[_0x304093(0x259)+_0x304093(0x2f4)]===_0x304093(0x1c1)?await _0x3c90c7[_0x304093(0x259)+'onfig'](_0x20bb38,_0xd1df62):(_0x3c90c7['markConf'+_0x304093(0x191)+_0x304093(0x164)+'ternally']?.(),await _0x3c90c7[_0x304093(0x2d8)+'fig'](_0x20bb38,_0xd1df62)),{'ok':!![]};}function _0x2882df(){const _0x4ac97d=_0x2b295d;return join(_0x3c90c7[_0x4ac97d(0x1cd)+'tateDir'](),_0x4ac97d(0x1aa)+_0x4ac97d(0x1e9));}function _0x291571(){const _0x1a5fdd=_0x2b295d;return join(_0x2882df(),'.opencla'+'w',_0x1a5fdd(0x184)+_0x1a5fdd(0x15d));}async function _0x30d9df(_0x2a6705={}){const _0x3076b0=_0x2b295d;return _0x40c6d0(_0x7d8c27[_0x3076b0(0x17b)+_0x3076b0(0x185)],_0x2a6705);}async function _0x50f63e(_0x55ba92,_0x114f31){const _0x370e99=_0x2b295d,{env:_0x5488b1,runtime:_0x4887ee}=await _0x30d9df({'FORCE_COLOR':'0','HOME':homedir()}),_0x484922=await _0x299829(_0x4887ee);return _0x5480d5('connecto'+'r-log',{'connector':'kdocs','phase':'spawn','message':'kdocs-cl'+'i\x20'+_0x55ba92[_0x370e99(0x27a)]('\x20')}),new Promise((_0x264a36,_0x5cf0f3)=>{const _0x426fda=_0x370e99,_0x2c1eee=spawn(_0x484922['executab'+_0x426fda(0x223)],_0x55ba92,{'cwd':homedir(),'env':_0x5488b1});let _0x540e3c='';const _0x3ad213=_0x28cfc1=>{const _0x496b44=_0x426fda,_0x2f4fd7=_0x28cfc1[_0x496b44(0x1c7)](_0x496b44(0x264));_0x540e3c+=_0x2f4fd7,_0x5480d5(_0x496b44(0x1b3)+_0x496b44(0x21d),{'connector':_0x496b44(0x2b4),'phase':_0x496b44(0x328),'message':_0x2f4fd7});};_0x2c1eee[_0x426fda(0x2e3)]['on'](_0x426fda(0x2ec),_0x3ad213),_0x2c1eee[_0x426fda(0x16c)]['on']('data',_0x3ad213),_0x2c1eee[_0x426fda(0x15f)]('error',_0x5cf0f3),_0x2c1eee[_0x426fda(0x15f)](_0x426fda(0x29a),_0x102478=>_0x264a36({'code':_0x102478,'output':_0x540e3c}));if(typeof _0x114f31==='string')_0x2c1eee[_0x426fda(0x1fa)][_0x426fda(0x15a)](_0x114f31);else _0x2c1eee[_0x426fda(0x1fa)]['end']();});}async function _0x3c1253(){const _0x22f131=_0x2b295d,_0x3bdb53=await _0xacda93(),_0xb53835=asRecord(_0x3bdb53[_0x22f131(0x216)]),_0x36cd6d=asRecord(_0xb53835[_0x22f131(0x148)]),_0x4df965={...asRecord(_0x36cd6d[KDOCS_SKILL_ID]),'enabled':!![]};if(typeof openClawConfigHandlers[_0x22f131(0x2b2)+_0x22f131(0x2a8)]===_0x22f131(0x1c1)){await openClawConfigHandlers[_0x22f131(0x2b2)+'Entry']({'skillId':KDOCS_SKILL_ID,'entry':_0x4df965,'reason':_0x22f131(0x1fd)+_0x22f131(0x241)+'led'});return;}_0x36cd6d[KDOCS_SKILL_ID]=_0x4df965,_0xb53835['entries']=_0x36cd6d,_0x3bdb53[_0x22f131(0x216)]=_0xb53835,await _0x3bdeb2(_0x3bdb53,_0x22f131(0x1fd)+_0x22f131(0x241)+'led');}async function _0x237a9b(_0x3f3688){const _0x40ab37=_0x2b295d,_0x56498b=await _0xacda93(),_0x4dda98=asRecord(_0x56498b[_0x40ab37(0x216)]),_0x331e6b=asRecord(_0x4dda98[_0x40ab37(0x148)]),_0x3ee750={...asRecord(_0x331e6b[KDOCS_SKILL_ID]),'enabled':Boolean(_0x3f3688)};if(typeof openClawConfigHandlers[_0x40ab37(0x2b2)+_0x40ab37(0x2a8)]==='function'){await openClawConfigHandlers[_0x40ab37(0x2b2)+_0x40ab37(0x2a8)]({'skillId':KDOCS_SKILL_ID,'entry':_0x3ee750,'reason':'kdocs\x20sk'+_0x40ab37(0x22c)+(_0x3f3688?_0x40ab37(0x155):_0x40ab37(0x2e9))});return;}_0x331e6b[KDOCS_SKILL_ID]=_0x3ee750,_0x4dda98[_0x40ab37(0x148)]=_0x331e6b,_0x56498b[_0x40ab37(0x216)]=_0x4dda98,await _0x3bdeb2(_0x56498b,_0x40ab37(0x1fd)+_0x40ab37(0x22c)+(_0x3f3688?_0x40ab37(0x155):_0x40ab37(0x2e9)));}async function _0x1fff4e(){const _0x137821=_0x2b295d;if(typeof openClawConfigHandlers[_0x137821(0x2ac)+'illEntry']===_0x137821(0x1c1)){await openClawConfigHandlers[_0x137821(0x2ac)+'illEntry']({'skillId':KDOCS_SKILL_ID,'reason':_0x137821(0x1fd)+_0x137821(0x2b9)+_0x137821(0x150)+'leted'});return;}const _0x16b223=await _0xacda93(),_0x2485b3=asRecord(_0x16b223['skills']),_0x3abc08=asRecord(_0x2485b3['entries']);delete _0x3abc08[KDOCS_SKILL_ID],_0x2485b3[_0x137821(0x148)]=_0x3abc08,_0x16b223[_0x137821(0x216)]=_0x2485b3,await _0x3bdeb2(_0x16b223,_0x137821(0x1fd)+_0x137821(0x2b9)+_0x137821(0x150)+_0x137821(0x32a));}async function _0xe613cf(){const _0x49dd67=_0x2b295d;if(!await _0x308b3d())throw new Error('金山文档尚未授权'+',请先完成\x20kd'+_0x49dd67(0x132)+'连接');return await _0x3c1253(),{'ok':!![]};}async function _0x308b3d(){const _0x2e0dad=_0x2b295d,_0x47f03c=await _0x50f63e(['auth',_0x2e0dad(0x147)])['catch'](()=>({'code':null,'output':''}));return _0x47f03c[_0x2e0dad(0x1ef)]===0x0&&isKdocsAuthStatusReady(_0x47f03c[_0x2e0dad(0x328)]);}async function _0x50d372({appId:_0x40d596,appSecret:_0xc49d6a,userInfo:userInfo=null}){const _0x5e3323=_0x2b295d,_0x12b8e4=await _0xacda93();applyFeishuChannelConfig(_0x12b8e4,{'appId':_0x40d596,'appSecret':_0xc49d6a,'userInfo':userInfo});const _0x138e01=asRecord(_0x12b8e4[_0x5e3323(0x1db)]);if(typeof openClawConfigHandlers['setChann'+_0x5e3323(0x224)]==='function')return openClawConfigHandlers['setChann'+_0x5e3323(0x224)]({'channelId':_0x5e3323(0x231),'channel':asRecord(_0x138e01['feishu']),'pluginId':_0x5e3323(0x231),'pluginEnabled':!![],'reason':_0x5e3323(0x247)+_0x5e3323(0x2f2)+'onfig\x20up'+_0x5e3323(0x1e0)});await _0x3bdeb2(_0x12b8e4,_0x5e3323(0x247)+_0x5e3323(0x2f2)+'onfig\x20up'+_0x5e3323(0x1e0));}async function _0x6d2486({appId:_0x497950,appSecret:_0x55e1b7,userInfo:userInfo=null,configPath:_0x4fd179}){const _0x4d6f2b=_0x2b295d,_0x41c53e=getTrimmedString(userInfo?.['openId']),_0x1ac2ea={'channels':{'feishu':{'enabled':![],'appId':_0x497950,'appSecret':_0x55e1b7,'domain':'feishu','connectionMode':_0x4d6f2b(0x281)+'t','requireMention':!![],'dmPolicy':_0x41c53e?_0x4d6f2b(0x28d)+'t':'disabled','groupPolicy':'disabled','streaming':!![],'allowFrom':_0x41c53e?[_0x41c53e]:[],'groupAllowFrom':[]}},'plugins':{'entries':{},'allow':[]},'tools':{'profile':_0x4d6f2b(0x23a)}};await mkdir(dirname(_0x4fd179),{'recursive':!![]}),await writeFile(_0x4fd179,JSON[_0x4d6f2b(0x2d6)+'y'](_0x1ac2ea,null,0x2)+'\x0a','utf8');}async function _0x3d758c(_0x50f887={}){const _0x515222=_0x2b295d,_0x4f049a=safeString(_0x50f887[_0x515222(0x30e)]),_0xeec678=safeString(_0x50f887['appSecre'+'t']);if(!_0x4f049a)throw new Error(_0x515222(0x2db)+_0x515222(0x2d0)+'equired');if(!_0xeec678)throw new Error('飞书机器人\x20Ap'+_0x515222(0x19e)+'is\x20requi'+_0x515222(0x1f6));return await _0x50d372({'appId':_0x4f049a,'appSecret':_0xeec678,'userInfo':null}),{'ok':!![]};}async function _0x12c203(_0x39555f={}){const _0x5d0e9d=_0x2b295d,_0x1547ea=safeString(_0x39555f[_0x5d0e9d(0x30e)]),_0x121fe1=safeString(_0x39555f[_0x5d0e9d(0x19f)+_0x5d0e9d(0x17c)]);if(!_0x1547ea)throw new Error('QQ机器人\x20Ap'+_0x5d0e9d(0x2d0)+_0x5d0e9d(0x30a));if(!_0x121fe1)throw new Error(_0x5d0e9d(0x21b)+_0x5d0e9d(0x19e)+'is\x20requi'+'red');const _0x237036=await _0xacda93(),_0x190ae7=asRecord(_0x237036[_0x5d0e9d(0x1db)]),_0x41c50d=asRecord(_0x190ae7['qqbot']),_0x5db60c={'enabled':typeof _0x41c50d[_0x5d0e9d(0x155)]===_0x5d0e9d(0x333)?_0x41c50d['enabled']:!![],'allowFrom':['*'],'appId':_0x1547ea,'clientSecret':_0x121fe1};if(typeof openClawConfigHandlers['setChann'+_0x5d0e9d(0x224)]==='function')return openClawConfigHandlers[_0x5d0e9d(0x14e)+_0x5d0e9d(0x224)]({'channelId':_0x5d0e9d(0x13b),'channel':_0x5db60c,'pluginId':QQBOT_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x5d0e9d(0x1e6)+_0x5d0e9d(0x1e7)+'nfig\x20upd'+_0x5d0e9d(0x1b4)});_0x190ae7[_0x5d0e9d(0x13b)]=_0x5db60c,_0x237036[_0x5d0e9d(0x1db)]=_0x190ae7;const _0x48d4d5=asRecord(_0x237036['plugins']),_0x2de9cc=asRecord(_0x48d4d5[_0x5d0e9d(0x148)]);return _0x2de9cc[QQBOT_PLUGIN_ID]={...asRecord(_0x2de9cc[QQBOT_PLUGIN_ID]),'enabled':!![]},_0x48d4d5['entries']=_0x2de9cc,_0x48d4d5[_0x5d0e9d(0x18a)]=dedupeStrings([...asStringArray(_0x48d4d5[_0x5d0e9d(0x18a)]),QQBOT_PLUGIN_ID]),_0x237036[_0x5d0e9d(0x1f9)]=_0x48d4d5,await _0x3bdeb2(_0x237036,_0x5d0e9d(0x1e6)+_0x5d0e9d(0x1e7)+_0x5d0e9d(0x19c)+_0x5d0e9d(0x1b4)),{'ok':!![]};}async function _0x412da2(_0x57cab3={}){const _0xf09b9=_0x2b295d,_0x1448a0=safeString(_0x57cab3['botId']),_0x1181ae=safeString(_0x57cab3[_0xf09b9(0x2fa)]);if(!_0x1448a0)throw new Error('企微助手\x20Bot'+'ID\x20is\x20re'+_0xf09b9(0x165));if(!_0x1181ae)throw new Error(_0xf09b9(0x32f)+_0xf09b9(0x332)+'equired');const _0x224112=await _0xacda93(),_0x5ba9b8=asRecord(_0x224112[_0xf09b9(0x1db)]),_0xf765e=asRecord(_0x5ba9b8['wecom']),_0x3dc669={..._0xf765e,'enabled':typeof _0xf765e[_0xf09b9(0x155)]===_0xf09b9(0x333)?_0xf765e[_0xf09b9(0x155)]:!![],'name':getTrimmedString(_0xf765e[_0xf09b9(0x236)])||_0xf09b9(0x2e5),'connectionMode':getTrimmedString(_0xf765e[_0xf09b9(0x1ba)+_0xf09b9(0x1f2)])||'websocke'+'t','dmPolicy':normalizeFeishuDmPolicy(_0xf765e[_0xf09b9(0x137)])??'open','groupPolicy':normalizeFeishuGroupPolicy(_0xf765e[_0xf09b9(0x262)+'icy'])??_0xf09b9(0x205),'allowFrom':asStringArray(_0xf765e[_0xf09b9(0x283)+'m']),'groupAllowFrom':asStringArray(_0xf765e[_0xf09b9(0x2a6)+_0xf09b9(0x2cc)]),'botId':_0x1448a0,'secret':_0x1181ae};if(typeof openClawConfigHandlers['setChann'+'elConfig']===_0xf09b9(0x1c1))return openClawConfigHandlers[_0xf09b9(0x14e)+_0xf09b9(0x224)]({'channelId':_0xf09b9(0x18d),'channel':_0x3dc669,'pluginId':WECOM_PLUGIN_ID,'pluginEnabled':!![],'reason':'wecom\x20ch'+_0xf09b9(0x1e7)+'nfig\x20upd'+_0xf09b9(0x1b4)});_0x5ba9b8[_0xf09b9(0x18d)]=_0x3dc669,_0x224112[_0xf09b9(0x1db)]=_0x5ba9b8;const _0x1833c5=asRecord(_0x224112[_0xf09b9(0x1f9)]),_0x1aafd8=asRecord(_0x1833c5[_0xf09b9(0x148)]);return _0x1aafd8[WECOM_PLUGIN_ID]={...asRecord(_0x1aafd8[WECOM_PLUGIN_ID]),'enabled':!![]},_0x1833c5[_0xf09b9(0x148)]=_0x1aafd8,_0x1833c5[_0xf09b9(0x18a)]=dedupeStrings([...asStringArray(_0x1833c5[_0xf09b9(0x18a)]),WECOM_PLUGIN_ID]),_0x224112[_0xf09b9(0x1f9)]=_0x1833c5,await _0x3bdeb2(_0x224112,_0xf09b9(0x26b)+'annel\x20co'+'nfig\x20upd'+_0xf09b9(0x1b4)),{'ok':!![]};}async function _0x19de98(_0xac8bb2,_0x405eaa,_0x787995,_0xbb042d){const _0x2929f4=_0x2b295d,_0x3945ec=safeString(_0x405eaa[_0x2929f4(0x24d)]),_0x463a96=String(_0x405eaa['authoriz'+_0x2929f4(0x24e)+'e']||'')['replace'](/\s+/g,'');if(!_0x3945ec)throw new Error(_0xbb042d+(_0x2929f4(0x212)+_0x2929f4(0x165)));if(!_0x463a96)throw new Error(_0xbb042d+(_0x2929f4(0x201)+_0x2929f4(0x30a)));const _0x3aa331=await _0xacda93(),_0x1660e9=asRecord(_0x3aa331['plugins']),_0x1ea534=asRecord(_0x1660e9['entries']),_0x13a788=createConnectorPluginEntry(_0xac8bb2,_0x1ea534[_0xac8bb2],!![],{'account':_0x3945ec,'authorizationCode':_0x463a96,..._0x787995});if(typeof openClawConfigHandlers[_0x2929f4(0x2c3)+'nConfig']===_0x2929f4(0x1c1))return openClawConfigHandlers[_0x2929f4(0x2c3)+_0x2929f4(0x27c)]({'pluginId':_0xac8bb2,'enabled':!![],'config':asRecord(_0x13a788[_0x2929f4(0x285)]),'reason':_0xac8bb2+(_0x2929f4(0x2c9)+_0x2929f4(0x296)+_0x2929f4(0x153)+'d')});return _0x1ea534[_0xac8bb2]=_0x13a788,_0x1660e9[_0x2929f4(0x148)]=_0x1ea534,_0x1660e9[_0x2929f4(0x18a)]=dedupeStrings([...asStringArray(_0x1660e9[_0x2929f4(0x18a)]),_0xac8bb2]),_0x3aa331[_0x2929f4(0x1f9)]=_0x1660e9,await _0x3bdeb2(_0x3aa331,_0xac8bb2+(_0x2929f4(0x2c9)+_0x2929f4(0x296)+_0x2929f4(0x153)+'d')),{'ok':!![]};}const _0x2088d3=_0x4cc6c2=>_0x19de98(QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x4cc6c2,{'imapHost':'imap.qq.'+'com','imapPort':0x3e1,'smtpHost':_0x2b295d(0x162)+_0x2b295d(0x1e8),'smtpPort':0x1d1,'secure':!![]},_0x2b295d(0x270)),_0x5ec606=_0x4190e4=>_0x19de98(NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x4190e4,{'imapHost':_0x2b295d(0x2b6)+_0x2b295d(0x248),'imapPort':0x3e1,'smtpHost':_0x2b295d(0x2ef)+'.com','smtpPort':0x1d1,'imapClientName':_0x2b295d(0x1ed),'imapClientVersion':'1.0.0','imapClientVendor':_0x2b295d(0x1ed),'imapClientSupportEmail':_0x2b295d(0x2b8)+_0x2b295d(0x1d3),'secure':!![]},_0x2b295d(0x22d)),_0x297d4a=_0x3bb69=>_0x19de98(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x3bb69,{'imapHost':'imap.exm'+_0x2b295d(0x23b)+'om','imapPort':0x3e1,'smtpHost':_0x2b295d(0x269)+_0x2b295d(0x23b)+'om','smtpPort':0x1d1,'secure':!![]},_0x2b295d(0x160));async function _0x34b5c0(_0x4c69f8={}){const _0x60f7e0=_0x2b295d,_0x2f3af3=safeString(_0x4c69f8['accountN'+_0x60f7e0(0x181)])||_0x60f7e0(0x1ac),_0x5f05a6=await _0xacda93(),_0x52a2eb=asRecord(_0x5f05a6[_0x60f7e0(0x1f9)]),_0x34f170=asRecord(_0x52a2eb[_0x60f7e0(0x148)]),_0x43eb02=createConnectorPluginEntry(FEISHU_DOC_CONNECTOR_PLUGIN_ID,_0x34f170[FEISHU_DOC_CONNECTOR_PLUGIN_ID],!![],{'authMode':_0x60f7e0(0x177),'accountName':_0x2f3af3});if(typeof openClawConfigHandlers[_0x60f7e0(0x2c3)+'nConfig']===_0x60f7e0(0x1c1))return openClawConfigHandlers[_0x60f7e0(0x2c3)+_0x60f7e0(0x27c)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':!![],'config':asRecord(_0x43eb02[_0x60f7e0(0x285)]),'reason':_0x60f7e0(0x2bd)+_0x60f7e0(0x2ab)+_0x60f7e0(0x219)+_0x60f7e0(0x1f7)+'ted'});return _0x34f170[FEISHU_DOC_CONNECTOR_PLUGIN_ID]=_0x43eb02,_0x52a2eb[_0x60f7e0(0x148)]=_0x34f170,_0x52a2eb['allow']=dedupeStrings([...asStringArray(_0x52a2eb[_0x60f7e0(0x18a)]),FEISHU_DOC_CONNECTOR_PLUGIN_ID]),_0x5f05a6[_0x60f7e0(0x1f9)]=_0x52a2eb,await _0x3bdeb2(_0x5f05a6,'feishu\x20d'+_0x60f7e0(0x2ab)+'ctor\x20plu'+_0x60f7e0(0x1f7)+_0x60f7e0(0x209)),{'ok':!![]};}async function _0xc96fdc(_0x4eb105={}){const _0x490647=_0x2b295d,_0x1629d4=safeString(_0x4eb105[_0x490647(0x1d2)]);if(!_0x1629d4)throw new Error(_0x490647(0x14c)+_0x490647(0x1bf)+_0x490647(0x2bf));const _0x184cb2=await _0xacda93(),_0x38e7cf=asRecord(_0x184cb2['skills']),_0x50e1b9=asRecord(_0x38e7cf['entries']),_0x123652=asRecord(_0x50e1b9[TENCENT_DOCS_SKILL_ID]),_0x1dbd71={..._0x123652,'enabled':!![],'env':{...asRecord(_0x123652[_0x490647(0x2aa)]),[TENCENT_DOCS_TOKEN_ENV]:_0x1629d4}};if(typeof openClawConfigHandlers['setSkill'+_0x490647(0x2a8)]===_0x490647(0x1c1))return openClawConfigHandlers[_0x490647(0x2b2)+_0x490647(0x2a8)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':_0x1dbd71,'reason':_0x490647(0x32c)+_0x490647(0x2a2)+_0x490647(0x142)+'ed'});return _0x50e1b9[TENCENT_DOCS_SKILL_ID]=_0x1dbd71,_0x38e7cf['entries']=_0x50e1b9,_0x184cb2[_0x490647(0x216)]=_0x38e7cf,await _0x3bdeb2(_0x184cb2,_0x490647(0x32c)+_0x490647(0x2a2)+_0x490647(0x142)+'ed'),{'ok':!![]};}async function _0x148981(_0x3ed08f={}){const _0x31d813=_0x2b295d,_0x2205fd=safeString(_0x3ed08f['url']);if(!_0x2205fd)throw new Error(_0x31d813(0x317)+_0x31d813(0x149)+_0x31d813(0x193)+'is\x20requi'+_0x31d813(0x1f6));try{const _0x1aa7ae=new URL(_0x2205fd);if(![_0x31d813(0x246),'https:'][_0x31d813(0x2e7)](_0x1aa7ae['protocol']))throw new Error(_0x31d813(0x289)+_0x31d813(0x2e8));}catch{throw new Error('请输入有效的钉钉'+_0x31d813(0x27f)+_0x31d813(0x1b8)+_0x31d813(0x261));}if(typeof openClawConfigHandlers[_0x31d813(0x2e6)+'rver']==='function')return openClawConfigHandlers['setMcpSe'+'rver']({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'server':createDingtalkDocMcpServerConfig(_0x2205fd),'reason':'dingtalk'+'\x20doc\x20mcp'+_0x31d813(0x18c)});const _0x198e02=await _0xacda93(),_0x47b0a9=readOpenClawMcpServersFromConfig(_0x198e02);return _0x47b0a9[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x2205fd),writeOpenClawMcpServersToConfig(_0x198e02,_0x47b0a9),await _0x3bdeb2(_0x198e02,'dingtalk'+_0x31d813(0x2ed)+'\x20updated'),{'ok':!![]};}async function _0x519d83(){const _0x44fbd6=_0x2b295d,_0x28a523=await _0xacda93(),_0x15f1b1=asRecord(_0x28a523[_0x44fbd6(0x1f9)]),_0x4b1844=asRecord(_0x15f1b1['entries']),_0x323d01=asRecord(_0x28a523[_0x44fbd6(0x216)]),_0x4a66c3=asRecord(_0x323d01[_0x44fbd6(0x148)]),_0x562293={},_0x5aee3f=_0x5d1bf9=>{const _0x3d2fad=_0x44fbd6,_0x215592=asRecord(_0x4b1844[_0x5d1bf9]);return{'entry':_0x215592,'config':asRecord(_0x215592[_0x3d2fad(0x285)])};},_0x1e8905=(_0x4d141d,_0x59079c,_0x48a47b)=>{const _0x594c18=_0x44fbd6,{entry:_0xf6f580,config:_0x38e2f9}=_0x5aee3f(_0x59079c),_0x20f590=getTrimmedString(_0x38e2f9[_0x594c18(0x24d)]);if(!_0x20f590)return;_0x562293[_0x4d141d]={'provider':_0x4d141d,'sourceType':_0x594c18(0x1cc),'adapter':_0x59079c,'enabled':_0xf6f580[_0x594c18(0x155)]!==![]&&_0x38e2f9[_0x594c18(0x155)]!==![],'account':_0x20f590,'credentialRef':_0x59079c+(_0x594c18(0x297)+_0x594c18(0x154)+'de'),'name':_0x48a47b};};_0x1e8905('qq_mail',QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x44fbd6(0x270)),_0x1e8905('netease_'+_0x44fbd6(0x25f),NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x44fbd6(0x22d)),_0x1e8905(_0x44fbd6(0x2a5)+_0x44fbd6(0x1c9),TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'腾讯企业邮箱');const _0xcd0820=_0x5aee3f(FEISHU_DOC_CONNECTOR_PLUGIN_ID),_0xb9a247=getTrimmedString(_0xcd0820['config'][_0x44fbd6(0x1d7)+_0x44fbd6(0x181)]);_0xb9a247&&(_0x562293[_0x44fbd6(0x231)]={'provider':_0x44fbd6(0x231),'sourceType':'lark-cli','adapter':_0x44fbd6(0x2c0)+_0x44fbd6(0x22a),'enabled':_0xcd0820['entry'][_0x44fbd6(0x155)]!==![]&&_0xcd0820[_0x44fbd6(0x285)][_0x44fbd6(0x155)]!==![],'authMode':_0x44fbd6(0x177),'accountName':_0xb9a247,'account':_0xb9a247,'credentialRef':FEISHU_DOC_CONNECTOR_PLUGIN_ID+_0x44fbd6(0x1a8),'capabilities':['latest','search',_0x44fbd6(0x16b),_0x44fbd6(0x1b9),'update',_0x44fbd6(0x1f3),'export']});const _0x1403ba=asRecord(_0x4a66c3[TENCENT_DOCS_SKILL_ID]),_0x61232d=asRecord(_0x1403ba[_0x44fbd6(0x2aa)]),_0x16d00b=getTrimmedString(_0x61232d[TENCENT_DOCS_TOKEN_ENV]);_0x16d00b&&(_0x562293[_0x44fbd6(0x2a5)+_0x44fbd6(0x163)]={'provider':_0x44fbd6(0x2a5)+'docs','sourceType':_0x44fbd6(0x136),'adapter':TENCENT_DOCS_SKILL_ID,'enabled':_0x1403ba['enabled']!==![],'account':'腾讯文档','credentialRef':TENCENT_DOCS_SKILL_ID+':'+TENCENT_DOCS_TOKEN_ENV,'capabilities':[_0x44fbd6(0x16b),'read',_0x44fbd6(0x251),'delete','import','export',_0x44fbd6(0x26a)]});const _0x1d29e7=asRecord(_0x4a66c3[KDOCS_SKILL_ID]);Object[_0x44fbd6(0x27b)](_0x1d29e7)[_0x44fbd6(0x20a)]>0x0&&await _0x308b3d()&&(_0x562293[_0x44fbd6(0x2b4)]={'provider':_0x44fbd6(0x2b4),'sourceType':_0x44fbd6(0x136),'adapter':KDOCS_SKILL_ID,'enabled':_0x1d29e7[_0x44fbd6(0x155)]!==![],'account':_0x44fbd6(0x175),'credentialRef':_0x44fbd6(0x1f5)+_0x44fbd6(0x1bb)+'in','capabilities':[_0x44fbd6(0x16b),_0x44fbd6(0x1b9),_0x44fbd6(0x251),'search','share',_0x44fbd6(0x32b),_0x44fbd6(0x1a1)]});const _0x268e55=readOpenClawMcpServersFromConfig(_0x28a523),_0x3dd290=findDingtalkDocMcpServer(_0x268e55),_0x57b6d2=getTrimmedString(_0x3dd290['url']);return _0x57b6d2&&(_0x562293['dingtalk'+_0x44fbd6(0x1bc)]={'provider':_0x44fbd6(0x2b7)+'_doc','sourceType':_0x44fbd6(0x2a0),'adapter':DINGTALK_DOC_MCP_SERVER_NAME,'enabled':_0x3dd290[_0x44fbd6(0x155)]!==![],'url':_0x57b6d2,'transport':getTrimmedString(_0x3dd290[_0x44fbd6(0x28c)+'t'])||_0x44fbd6(0x2d1)+_0x44fbd6(0x2ca)}),_0x562293;}async function _0xec3788(){const _0x397e99=_0x2b295d,_0x1aa8f0=await _0x3c90c7[_0x397e99(0x188)+'igSnapsh'+'otRaw']();return{..._0x1aa8f0,'connectors':{...asRecord(_0x1aa8f0['connecto'+'rs']),...await _0x519d83()}};}function _0x5a065e(_0xeb44f9){const _0x30ed08=_0x2b295d;if(!_0xeb44f9[_0x30ed08(0x2b3)+_0x30ed08(0x2f3)])return;clearTimeout(_0xeb44f9[_0x30ed08(0x2b3)+'mer']),_0xeb44f9[_0x30ed08(0x2b3)+_0x30ed08(0x2f3)]=null;}function _0x20bf2a(_0x171c1b,_0x4b8750=KDOCS_CLI_AUTH_POLL_INTERVAL_MS){const _0x3f8c0c=_0x2b295d;if(_0x171c1b[_0x3f8c0c(0x147)]!==_0x3f8c0c(0x20f))return;_0x5a065e(_0x171c1b),_0x171c1b[_0x3f8c0c(0x2b3)+'mer']=setTimeout(()=>void _0x498b64(_0x171c1b),_0x4b8750);}async function _0x498b64(_0x56c9b2){const _0x2c430a=_0x2b295d;if(_0x56c9b2['status']!==_0x2c430a(0x20f))return;_0x56c9b2['phase']='verify',_0x56c9b2[_0x2c430a(0x2ba)]='正在验证金山文档'+_0x2c430a(0x2da);try{const _0x528130=await _0x50f63e([_0x2c430a(0x233),_0x2c430a(0x147)]);_0x56c9b2['output']=_0x528130[_0x2c430a(0x328)];if(_0x528130[_0x2c430a(0x1ef)]===0x0&&isKdocsAuthStatusReady(_0x528130[_0x2c430a(0x328)])){_0x5a065e(_0x56c9b2),await _0x3c1253(),_0x56c9b2[_0x2c430a(0x278)]=_0x2c430a(0x1d9)+'d',_0x56c9b2[_0x2c430a(0x147)]='complete'+'d',_0x56c9b2[_0x2c430a(0x2ba)]=_0x2c430a(0x22b);return;}if(Date[_0x2c430a(0x26e)]()-_0x56c9b2[_0x2c430a(0x143)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x56c9b2[_0x2c430a(0x147)]=_0x2c430a(0x2f9),_0x56c9b2[_0x2c430a(0x15c)+_0x2c430a(0x176)]=_0x2c430a(0x2d3)+'验证超时';return;}_0x20bf2a(_0x56c9b2);}catch(_0x4a5422){if(Date[_0x2c430a(0x26e)]()-_0x56c9b2[_0x2c430a(0x143)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x56c9b2[_0x2c430a(0x147)]=_0x2c430a(0x2f9),_0x56c9b2['errorMes'+_0x2c430a(0x176)]=_0x4a5422 instanceof Error?_0x4a5422[_0x2c430a(0x2ba)]:_0x2c430a(0x2d3)+_0x2c430a(0x2fd);return;}_0x20bf2a(_0x56c9b2);}}async function _0x2b6c48(){const _0xf94cae=_0x2b295d,_0xff4728=randomUUID(),_0xb0fbb3={'sessionId':_0xff4728,'status':'pending','phase':_0xf94cae(0x166),'url':null,'message':_0xf94cae(0x21a)+'登录','errorMessage':null,'output':'','process':null,'verifyTimer':null,'startedAt':Date[_0xf94cae(0x26e)]()};return _0x431985[_0xf94cae(0x2df)](_0xff4728,_0xb0fbb3),void _0x30d9df({'FORCE_COLOR':'0','HOME':homedir()})[_0xf94cae(0x288)](async({env:_0x552038,runtime:_0x1db96a})=>{const _0x5d035a=_0xf94cae,_0xa8f831=await _0x299829(_0x1db96a);_0x5480d5(_0x5d035a(0x1b3)+_0x5d035a(0x21d),{'connector':_0x5d035a(0x2b4),'phase':_0x5d035a(0x286),'message':'kdocs-cl'+_0x5d035a(0x258)+_0x5d035a(0x1fe)});const _0x1f192b=spawn(_0xa8f831[_0x5d035a(0x13f)+'lePath'],[_0x5d035a(0x233),_0x5d035a(0x298)],{'cwd':homedir(),'env':_0x552038});_0xb0fbb3[_0x5d035a(0x253)]=_0x1f192b;const _0x2461a5=setTimeout(()=>{const _0x1d4ac4=_0x5d035a;if(_0xb0fbb3[_0x1d4ac4(0x147)]!==_0x1d4ac4(0x20f))return;_0x1f192b[_0x1d4ac4(0x161)](),_0xb0fbb3[_0x1d4ac4(0x147)]=_0x1d4ac4(0x2f9),_0xb0fbb3['errorMes'+_0x1d4ac4(0x176)]=_0x1d4ac4(0x16a)+'超时',_0xb0fbb3[_0x1d4ac4(0x253)]=null;},KDOCS_CLI_STEP_TIMEOUT_MS),_0x49f5d7=_0x1d826e=>{const _0x13f6ae=_0x5d035a,_0x37ed4d=_0x1d826e[_0x13f6ae(0x1c7)]('utf8');_0xb0fbb3[_0x13f6ae(0x328)]+=_0x37ed4d,_0x5480d5(_0x13f6ae(0x1b3)+_0x13f6ae(0x21d),{'connector':_0x13f6ae(0x2b4),'phase':_0x13f6ae(0x328),'message':_0x37ed4d});const _0x4c0d59=extractFirstUrl(_0xb0fbb3[_0x13f6ae(0x328)]);_0x4c0d59&&!_0xb0fbb3[_0x13f6ae(0x28f)]&&(_0xb0fbb3[_0x13f6ae(0x28f)]=_0x4c0d59,_0xb0fbb3[_0x13f6ae(0x278)]='auth',_0xb0fbb3[_0x13f6ae(0x2ba)]='请在浏览器完成金'+_0x13f6ae(0x144),_0x20bf2a(_0xb0fbb3,0x1f4),void _0x2df123[_0x13f6ae(0x214)+_0x13f6ae(0x27d)](_0x4c0d59)[_0x13f6ae(0x14d)](()=>{}));};_0x1f192b[_0x5d035a(0x2e3)]['on'](_0x5d035a(0x2ec),_0x49f5d7),_0x1f192b[_0x5d035a(0x16c)]['on'](_0x5d035a(0x2ec),_0x49f5d7),_0x1f192b[_0x5d035a(0x1fa)][_0x5d035a(0x15a)](),_0x1f192b['once']('error',_0x2e0056=>{const _0x1a4d41=_0x5d035a;clearTimeout(_0x2461a5),_0xb0fbb3['status']='error',_0xb0fbb3[_0x1a4d41(0x15c)+'sage']=_0x2e0056 instanceof Error?_0x2e0056['message']:_0x1a4d41(0x16a)+_0x1a4d41(0x28b)+'docs-cli'+'\x20已安装',_0xb0fbb3[_0x1a4d41(0x253)]=null,_0x5480d5(_0x1a4d41(0x1b3)+_0x1a4d41(0x21d),{'connector':'kdocs','phase':_0x1a4d41(0x2f9),'message':_0xb0fbb3[_0x1a4d41(0x15c)+_0x1a4d41(0x176)]});}),_0x1f192b[_0x5d035a(0x15f)](_0x5d035a(0x29a),_0x5226a0=>{const _0x221eaf=_0x5d035a;clearTimeout(_0x2461a5),_0xb0fbb3[_0x221eaf(0x253)]=null;if(_0xb0fbb3[_0x221eaf(0x147)]!==_0x221eaf(0x20f))return;const _0x19697b=extractFirstUrl(_0xb0fbb3[_0x221eaf(0x328)]);if(_0x19697b&&!_0xb0fbb3[_0x221eaf(0x28f)]){_0xb0fbb3[_0x221eaf(0x28f)]=_0x19697b,_0xb0fbb3[_0x221eaf(0x278)]=_0x221eaf(0x233),_0xb0fbb3[_0x221eaf(0x2ba)]='请在浏览器完成金'+_0x221eaf(0x144),_0x20bf2a(_0xb0fbb3,0x1f4);return;}if(_0x5226a0!==0x0){_0xb0fbb3[_0x221eaf(0x147)]='error',_0xb0fbb3[_0x221eaf(0x15c)+_0x221eaf(0x176)]=_0xb0fbb3[_0x221eaf(0x328)][_0x221eaf(0x311)]()||_0x221eaf(0x16a)+_0x221eaf(0x28b)+_0x221eaf(0x1b6)+_0x221eaf(0x307),_0x5480d5(_0x221eaf(0x1b3)+'r-log',{'connector':_0x221eaf(0x2b4),'phase':_0x221eaf(0x2f9),'message':_0xb0fbb3['errorMes'+'sage']});return;}_0xb0fbb3[_0x221eaf(0x278)]='verify',_0xb0fbb3[_0x221eaf(0x2ba)]=_0x221eaf(0x1e4)+'授权状态',_0x20bf2a(_0xb0fbb3,0x1f4);});})[_0xf94cae(0x14d)](_0xccb967=>{const _0x198f23=_0xf94cae;_0xb0fbb3[_0x198f23(0x147)]=_0x198f23(0x2f9),_0xb0fbb3[_0x198f23(0x15c)+'sage']=_0xccb967 instanceof Error?_0xccb967['message']:'金山文档登录启动'+_0x198f23(0x28b)+_0x198f23(0x1b6)+_0x198f23(0x307),_0x5480d5(_0x198f23(0x1b3)+'r-log',{'connector':_0x198f23(0x2b4),'phase':_0x198f23(0x2f9),'message':_0xb0fbb3[_0x198f23(0x15c)+_0x198f23(0x176)]});}),createKdocsCliStatus(_0xb0fbb3);}function _0x462c38(_0x144280={}){const _0x3a3c1e=_0x2b295d,_0x22cfe9=safeString(_0x144280[_0x3a3c1e(0x2f1)+'d']);if(!_0x22cfe9)throw new Error('Kdocs\x20CL'+_0x3a3c1e(0x196)+_0x3a3c1e(0x186)+_0x3a3c1e(0x1e5));const _0x156d80=_0x431985[_0x3a3c1e(0x31d)](_0x22cfe9);if(!_0x156d80)throw new Error(_0x3a3c1e(0x1c0)+'I\x20sessio'+_0x3a3c1e(0x133)+'und');return createKdocsCliStatus(_0x156d80);}function _0xbb2484(_0x7d1d13={}){const _0xd28099=_0x2b295d,_0x3e98bb=safeString(_0x7d1d13[_0xd28099(0x2f1)+'d']);if(!_0x3e98bb)return{'ok':!![]};const _0x490f08=_0x431985['get'](_0x3e98bb);if(!_0x490f08)return{'ok':!![]};return _0x5a065e(_0x490f08),_0x490f08[_0xd28099(0x253)]?.['kill'](),_0x431985[_0xd28099(0x1f3)](_0x3e98bb),{'ok':!![]};}function _0x156ed7(_0x2b89b4){const _0x50aea3=_0x2b295d;if(!_0x2b89b4[_0x50aea3(0x2a9)])return;clearTimeout(_0x2b89b4['timer']),_0x2b89b4[_0x50aea3(0x2a9)]=null;}function _0x380fd1(_0x3b06a6){const _0x240098=_0x2b295d,_0x3518a0=_0xf32f18[_0x240098(0x31d)](_0x3b06a6);if(!_0x3518a0||_0x3518a0[_0x240098(0x147)]!=='pending')return;_0x156ed7(_0x3518a0),_0x3518a0[_0x240098(0x2a9)]=setTimeout(()=>void _0x20050c(_0x3b06a6),_0x3518a0[_0x240098(0x1f8)+_0x240098(0x300)]);}async function _0x20050c(_0x266e6d){const _0x1c6b03=_0x2b295d,_0x13b92e=_0xf32f18['get'](_0x266e6d);if(!_0x13b92e||_0x13b92e['status']!==_0x1c6b03(0x20f))return;if(Date[_0x1c6b03(0x26e)]()>=_0x13b92e[_0x1c6b03(0x2cf)+'t']){_0x13b92e['status']='expired',_0x13b92e[_0x1c6b03(0x15c)+'sage']=_0x1c6b03(0x25c)+'重新生成',_0x156ed7(_0x13b92e);return;}try{const _0x3c9c93=await pollFeishuRegistration(_0x13b92e[_0x1c6b03(0x1c5)],_0x13b92e['deviceCo'+'de']),_0x27e4ae=getTrimmedString(_0x3c9c93[_0x1c6b03(0x282)+'d']),_0x25b02b=getTrimmedString(_0x3c9c93['client_s'+_0x1c6b03(0x16d)]),_0x3aa03d=getTrimmedString(_0x3c9c93[_0x1c6b03(0x2f9)]),_0xede098=extractFeishuRegistrationAuthorizationUri(_0x3c9c93)||_0x13b92e[_0x1c6b03(0x140)+_0x1c6b03(0x2b1)];if(_0xede098!==_0x13b92e[_0x1c6b03(0x140)+_0x1c6b03(0x2b1)])_0x13b92e[_0x1c6b03(0x140)+_0x1c6b03(0x2b1)]=_0xede098;if(_0x27e4ae&&_0x25b02b){const _0x3dedba=asRecord(_0x3c9c93[_0x1c6b03(0x239)+'o']);await _0x50d372({'appId':_0x27e4ae,'appSecret':_0x25b02b,'userInfo':{'openId':getTrimmedString(_0x3dedba[_0x1c6b03(0x131)])||null}}),_0x13b92e[_0x1c6b03(0x147)]=_0x1c6b03(0x1d9)+'d',_0x13b92e[_0x1c6b03(0x15c)+_0x1c6b03(0x176)]=null,_0x156ed7(_0x13b92e);return;}if(!_0x3aa03d||_0x3aa03d===_0x1c6b03(0x140)+'ation_pe'+'nding'){_0x380fd1(_0x266e6d);return;}if(_0x3aa03d===_0x1c6b03(0x267)+'n'){_0x13b92e['pollInte'+_0x1c6b03(0x300)]+=0x1388,_0x380fd1(_0x266e6d);return;}if(_0x3aa03d===_0x1c6b03(0x190)+_0x1c6b03(0x30c)){_0x13b92e[_0x1c6b03(0x147)]='expired',_0x13b92e[_0x1c6b03(0x15c)+_0x1c6b03(0x176)]=_0x1c6b03(0x25c)+'重新生成',_0x156ed7(_0x13b92e);return;}_0x13b92e[_0x1c6b03(0x147)]='error',_0x13b92e[_0x1c6b03(0x15c)+_0x1c6b03(0x176)]=getTrimmedString(_0x3c9c93[_0x1c6b03(0x2d9)+_0x1c6b03(0x319)+'n'])||(_0x3aa03d===_0x1c6b03(0x1c8)+_0x1c6b03(0x1ae)?'用户已取消飞书机'+_0x1c6b03(0x266):_0x1c6b03(0x275)+_0x3aa03d),_0x156ed7(_0x13b92e);}catch(_0x266db4){_0x13b92e[_0x1c6b03(0x147)]=_0x1c6b03(0x2f9),_0x13b92e['errorMes'+'sage']=_0x266db4 instanceof Error?_0x266db4[_0x1c6b03(0x2ba)]:_0x1c6b03(0x16f),_0x156ed7(_0x13b92e);}}async function _0x14b16b(_0x31b241={}){const _0x277a47=_0x2b295d,_0x1f00c0=_0x31b241[_0x277a47(0x254)]==='doc_conn'+_0x277a47(0x1cf)?_0x277a47(0x158)+_0x277a47(0x1cf):'channel',_0x3ea42b=createFeishuRegistrationClient(),_0x239b78=await initFeishuRegistration(_0x3ea42b),_0x19b69c=Array[_0x277a47(0x21c)](_0x239b78['supporte'+_0x277a47(0x1b1)+_0x277a47(0x2fb)])?_0x239b78[_0x277a47(0x306)+'d_auth_m'+_0x277a47(0x2fb)][_0x277a47(0x334)](getTrimmedString)[_0x277a47(0x25b)](Boolean):[];if(!_0x19b69c[_0x277a47(0x2e7)](_0x277a47(0x1cb)+_0x277a47(0x16d)))throw new Error(_0x277a47(0x240)+_0x277a47(0x31a)+_0x277a47(0x226)+_0x277a47(0x31b)+'port\x20cli'+_0x277a47(0x280)+'et\x20auth.');const _0x114a01=await beginFeishuRegistration(_0x3ea42b),_0x360f75=getTrimmedString(_0x114a01[_0x277a47(0x1dd)+_0x277a47(0x2c6)+'_complet'+'e']),_0x19471f=extractFeishuRegistrationAuthorizationUri(_0x114a01),_0xee21b9=getTrimmedString(_0x114a01[_0x277a47(0x20c)+_0x277a47(0x284)]),_0x4cbdc0=Number(_0x114a01[_0x277a47(0x315)+'n'])||0x258,_0x6bdd91=Number(_0x114a01[_0x277a47(0x2e4)])||0x5;if(!_0x360f75||!_0xee21b9)throw new Error(_0x277a47(0x207)+'verifica'+_0x277a47(0x2c6)+'_complet'+_0x277a47(0x2d4)+_0x277a47(0x151)+_0x277a47(0x2a3)+_0x277a47(0x243)+_0x277a47(0x1a7));const _0x347d6a=randomUUID(),_0x6dde81={'sessionId':_0x347d6a,'purpose':_0x1f00c0,'client':_0x3ea42b,'deviceCode':_0xee21b9,'verificationUriComplete':_0x360f75,'authorizationUri':_0x19471f,'expiresAt':Date['now']()+_0x4cbdc0*0x3e8,'pollIntervalMs':Math[_0x277a47(0x234)](_0x6bdd91*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'status':_0x277a47(0x20f),'errorMessage':null,'timer':null};return _0xf32f18[_0x277a47(0x2df)](_0x347d6a,_0x6dde81),_0x380fd1(_0x347d6a),serializeFeishuRegistrationSession(_0x6dde81);}function _0x499a72(_0x486834={}){const _0x37b8d4=_0x2b295d,_0x277f47=safeString(_0x486834['sessionI'+'d']);if(!_0x277f47)throw new Error('Feishu\x20r'+_0x37b8d4(0x331)+_0x37b8d4(0x299)+_0x37b8d4(0x29b)+'s\x20requir'+'ed');const _0x3e1f8d=_0xf32f18[_0x37b8d4(0x31d)](_0x277f47);if(!_0x3e1f8d)throw new Error(_0x37b8d4(0x255)+_0x37b8d4(0x331)+_0x37b8d4(0x299)+_0x37b8d4(0x17e)+_0x37b8d4(0x26d));return serializeFeishuRegistrationSession(_0x3e1f8d);}function _0x542f5e(_0x14e06b={}){const _0x119821=_0x2b295d,_0x48138a=safeString(_0x14e06b['sessionI'+'d']);if(!_0x48138a)return{'ok':!![]};const _0x2d6596=_0xf32f18[_0x119821(0x31d)](_0x48138a);if(!_0x2d6596)return{'ok':!![]};return _0x156ed7(_0x2d6596),_0xf32f18[_0x119821(0x1f3)](_0x48138a),{'ok':!![]};}async function _0x277a9e(_0x2decb6,_0x2093b9){const _0x2ba18d=_0x2b295d,_0x1b886b=_0x2882df(),{env:_0x50fe08,runtime:_0x1fb5ff}=await _0x30d9df({'FORCE_COLOR':'0','HOME':homedir(),'LARK_CLI_NO_PROXY':'1','OPENCLAW_HOME':_0x1b886b,'OPENCLAW_CONFIG_PATH':_0x2decb6[_0x2ba18d(0x1da)+_0x2ba18d(0x130)+'h']});await mkdir(_0x1b886b,{'recursive':!![]});const _0x49d192=await _0x4209a5(_0x1fb5ff);for(const _0x425433 of[_0x2ba18d(0x197)+'XY',_0x2ba18d(0x199)+'OXY',_0x2ba18d(0x19a)+'Y',_0x2ba18d(0x2c4)+'xy','https_pr'+_0x2ba18d(0x2bb),_0x2ba18d(0x32e)+'y']){delete _0x50fe08[_0x425433];}return new Promise((_0x23d682,_0x3dbef6)=>{const _0x297114=_0x2ba18d;_0x5480d5('connecto'+_0x297114(0x21d),{'connector':_0x297114(0x167)+'oc','phase':_0x297114(0x286),'message':_0x297114(0x1df)+'\x20'+_0x2093b9[_0x297114(0x27a)]('\x20')});const _0x415ed7=spawn(_0x49d192[_0x297114(0x228)+'utable'],[_0x49d192[_0x297114(0x273)+'th'],..._0x2093b9],{'cwd':_0x1b886b,'env':_0x50fe08});let _0x52d872=![];_0x415ed7[_0x297114(0x15f)](_0x297114(0x286),()=>{_0x52d872=!![],_0x23d682(_0x415ed7);}),_0x415ed7[_0x297114(0x15f)]('error',_0x2d56c4=>{if(_0x52d872)return;_0x3dbef6(_0x2d56c4);});});}function _0x1618d1(_0x52b470,_0xd414eb,_0x4c0274){const _0xbfbde6=_0x2b295d;_0x52b470[_0xbfbde6(0x278)]=_0x4c0274[_0xbfbde6(0x278)],_0x52b470[_0xbfbde6(0x2ba)]=_0x4c0274['message'];if(_0x4c0274['phase']!==_0xbfbde6(0x291))_0x52b470[_0xbfbde6(0x28f)]=null;_0x52b470[_0xbfbde6(0x328)]='',void _0x277a9e(_0x52b470,_0xd414eb)['then'](_0x2f8a68=>{const _0x4efed5=_0xbfbde6;_0x52b470[_0x4efed5(0x253)]=_0x2f8a68;const _0x59502d=setTimeout(()=>{const _0x4a67a0=_0x4efed5;if(_0x52b470[_0x4a67a0(0x147)]!==_0x4a67a0(0x20f))return;_0x2f8a68[_0x4a67a0(0x161)](),_0x52b470[_0x4a67a0(0x147)]=_0x4a67a0(0x2f9),_0x52b470[_0x4a67a0(0x15c)+_0x4a67a0(0x176)]=_0x4c0274[_0x4a67a0(0x2ba)]+'超时',_0x52b470[_0x4a67a0(0x253)]=null;},FEISHU_DOC_CLI_STEP_TIMEOUT_MS),_0xda8cd5=_0x2ef7e4=>{const _0x108c25=_0x4efed5,_0x114c14=_0x2ef7e4['toString'](_0x108c25(0x264));_0x52b470[_0x108c25(0x328)]+=_0x114c14,_0x5480d5(_0x108c25(0x1b3)+_0x108c25(0x21d),{'connector':'feishu_d'+'oc','phase':_0x4c0274[_0x108c25(0x278)],'message':_0x114c14});};_0x2f8a68[_0x4efed5(0x2e3)]['on']('data',_0xda8cd5),_0x2f8a68[_0x4efed5(0x16c)]['on']('data',_0xda8cd5);if(typeof _0x4c0274[_0x4efed5(0x1fa)]===_0x4efed5(0x287))_0x2f8a68[_0x4efed5(0x1fa)]['end'](_0x4c0274[_0x4efed5(0x1fa)]);else _0x2f8a68[_0x4efed5(0x1fa)]['end']();_0x2f8a68['on']('error',_0x83ce29=>{const _0x26ee28=_0x4efed5;clearTimeout(_0x59502d),_0x52b470[_0x26ee28(0x147)]='error',_0x52b470['errorMes'+_0x26ee28(0x176)]=_0x83ce29 instanceof Error?_0x83ce29[_0x26ee28(0x2ba)]:_0x26ee28(0x21f)+'行失败',_0x52b470[_0x26ee28(0x253)]=null,_0x5480d5(_0x26ee28(0x1b3)+_0x26ee28(0x21d),{'connector':_0x26ee28(0x167)+'oc','phase':_0x26ee28(0x2f9),'message':_0x52b470[_0x26ee28(0x15c)+_0x26ee28(0x176)]});}),_0x2f8a68['on']('close',_0xf1f826=>{const _0x58b1a5=_0x4efed5;clearTimeout(_0x59502d),_0x52b470[_0x58b1a5(0x253)]=null;if(_0x52b470[_0x58b1a5(0x147)]!==_0x58b1a5(0x20f))return;if(_0xf1f826!==0x0){if(_0x4c0274[_0x58b1a5(0x2cb)+'e']){void Promise[_0x58b1a5(0x2b5)](_0x4c0274[_0x58b1a5(0x2cb)+'e'](_0xf1f826,_0x52b470['output']))[_0x58b1a5(0x14d)](_0xdd45db=>{const _0x498f59=_0x58b1a5;_0x52b470[_0x498f59(0x147)]=_0x498f59(0x2f9),_0x52b470[_0x498f59(0x15c)+'sage']=_0xdd45db instanceof Error?_0xdd45db['message']:'飞书\x20CLI\x20连'+_0x498f59(0x2c5);});return;}_0x52b470['status']=_0x58b1a5(0x2f9),_0x52b470[_0x58b1a5(0x15c)+_0x58b1a5(0x176)]=getFeishuDocCliFailureMessage(_0x4c0274[_0x58b1a5(0x278)],extractFeishuDocCliError(_0x52b470[_0x58b1a5(0x328)],_0x58b1a5(0x1df)+'\x20'+_0xd414eb[_0x58b1a5(0x27a)]('\x20')+(_0x58b1a5(0x293)+_0x58b1a5(0x1a0)+'e\x20')+_0xf1f826),_0x58b1a5(0x1df)+'\x20'+_0xd414eb[_0x58b1a5(0x27a)]('\x20')+(_0x58b1a5(0x293)+_0x58b1a5(0x1a0)+'e\x20')+_0xf1f826),_0x5480d5(_0x58b1a5(0x1b3)+_0x58b1a5(0x21d),{'connector':_0x58b1a5(0x167)+'oc','phase':_0x58b1a5(0x2f9),'message':_0x52b470['errorMes'+'sage']});return;}void Promise['resolve'](_0x4c0274[_0x58b1a5(0x213)+'s']())[_0x58b1a5(0x14d)](_0x5c1ddd=>{const _0x245d1f=_0x58b1a5;_0x52b470[_0x245d1f(0x147)]='error',_0x52b470[_0x245d1f(0x15c)+'sage']=_0x5c1ddd instanceof Error?_0x5c1ddd[_0x245d1f(0x2ba)]:_0x245d1f(0x2a1)+_0x245d1f(0x2c5);});});})[_0xbfbde6(0x14d)](_0x2fc8ed=>{const _0x251ba2=_0xbfbde6;_0x52b470['status']=_0x251ba2(0x2f9),_0x52b470[_0x251ba2(0x15c)+_0x251ba2(0x176)]=_0x2fc8ed instanceof Error?_0x2fc8ed[_0x251ba2(0x2ba)]:_0x251ba2(0x21f)+_0x251ba2(0x2de),_0x52b470[_0x251ba2(0x253)]=null,_0x5480d5(_0x251ba2(0x1b3)+_0x251ba2(0x21d),{'connector':_0x251ba2(0x167)+'oc','phase':'error','message':_0x52b470[_0x251ba2(0x15c)+'sage']});});}function _0x2080bb(_0x249a60){const _0x305456=_0x2b295d;if(!_0x249a60['appTimer'])return;clearTimeout(_0x249a60['appTimer']),_0x249a60[_0x305456(0x272)]=null;}function _0x505af9(_0x17bc07){const _0xbfcbb=_0x2b295d;if(!_0x17bc07['authStat'+_0xbfcbb(0x14b)])return;clearTimeout(_0x17bc07['authStat'+_0xbfcbb(0x14b)]),_0x17bc07[_0xbfcbb(0x2d5)+_0xbfcbb(0x14b)]=null;}function _0xcaf130(_0x3fb753,_0x463463=0x7d0){const _0x45b765=_0x2b295d;if(_0x3fb753[_0x45b765(0x147)]!==_0x45b765(0x20f))return;_0x505af9(_0x3fb753),_0x3fb753['authStat'+_0x45b765(0x14b)]=setTimeout(()=>{const _0x3e027a=_0x45b765;_0x1618d1(_0x3fb753,[_0x3e027a(0x233),_0x3e027a(0x147)],{'phase':'verify','message':_0x3e027a(0x1a2)+'状态','onFailure':(_0x2814da,_0x7be537)=>{const _0x5cc1ad=_0x3e027a;if(Date['now']()-_0x3fb753[_0x5cc1ad(0x2d5)+_0x5cc1ad(0x13c)+_0x5cc1ad(0x2a4)]>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x3fb753['status']=_0x5cc1ad(0x2f9),_0x3fb753[_0x5cc1ad(0x15c)+_0x5cc1ad(0x176)]=getFeishuDocCliFailureMessage(_0x5cc1ad(0x291),extractFeishuDocCliError(_0x7be537,'飞书\x20CLI\x20授'+_0x5cc1ad(0x2ff)),'飞书\x20CLI\x20授'+_0x5cc1ad(0x2ff));return;}_0xcaf130(_0x3fb753);},'onSuccess':()=>{const _0x3983e3=_0x3e027a;try{ensureFeishuDocCliUserStatus(_0x3fb753[_0x3983e3(0x328)]);}catch(_0x2c7d94){if(Date[_0x3983e3(0x26e)]()-_0x3fb753[_0x3983e3(0x2d5)+'usStarte'+_0x3983e3(0x2a4)]>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x3fb753[_0x3983e3(0x147)]='error',_0x3fb753[_0x3983e3(0x15c)+_0x3983e3(0x176)]=_0x2c7d94 instanceof Error?_0x2c7d94['message']:_0x3983e3(0x29e)+'权状态验证失败';return;}_0xcaf130(_0x3fb753);return;}return _0x505af9(_0x3fb753),_0x123a9f(_0x3fb753);}});},_0x463463);}function _0x186dbc(_0x1a78f5){const _0x5ee36e=_0x2b295d;if(!_0x1a78f5[_0x5ee36e(0x30d)]||!_0x1a78f5[_0x5ee36e(0x19d)+_0x5ee36e(0x17c)]){_0x1a78f5[_0x5ee36e(0x147)]=_0x5ee36e(0x2f9),_0x1a78f5[_0x5ee36e(0x15c)+_0x5ee36e(0x176)]=_0x5ee36e(0x173)+_0x5ee36e(0x146)+_0x5ee36e(0x1fc);return;}const _0x557179=_0x1a78f5[_0x5ee36e(0x30d)],_0x148062=_0x1a78f5[_0x5ee36e(0x19d)+_0x5ee36e(0x17c)];_0x1618d1(_0x1a78f5,[_0x5ee36e(0x230)+'n'],{'phase':_0x5ee36e(0x2af),'message':_0x5ee36e(0x2f5)+'LI','onSuccess':()=>{const _0xa08f40=_0x5ee36e;_0x1618d1(_0x1a78f5,[_0xa08f40(0x285),'init',_0xa08f40(0x2ce)+'init','--app-id',_0x557179,_0xa08f40(0x245)+_0xa08f40(0x279)+'in','--brand',_0xa08f40(0x231)],{'phase':_0xa08f40(0x2af),'message':_0xa08f40(0x326)+'CLI\x20用户身份'+'应用','stdin':_0x148062,'onSuccess':()=>{const _0xe45c61=_0xa08f40;_0x1618d1(_0x1a78f5,[_0xe45c61(0x233),'login','--domain','docs,dri'+_0xe45c61(0x313)+_0xe45c61(0x211)+',sheets,'+'slides,b'+_0xe45c61(0x335),_0xe45c61(0x134),_0xe45c61(0x249)+_0xe45c61(0x1eb),'--no-wai'+'t'],{'phase':'auth','message':_0xe45c61(0x17d)+'授权页','onSuccess':()=>{const _0x2cd003=_0xe45c61,_0x22067b=parseFeishuDocCliJson(_0x1a78f5[_0x2cd003(0x328)]),_0x307133=getTrimmedString(_0x22067b['verifica'+'tion_uri'+_0x2cd003(0x1ca)+'e'])||getTrimmedString(_0x22067b['verifica'+_0x2cd003(0x25e)])||getTrimmedString(_0x22067b['verifica'+_0x2cd003(0x2c6)]),_0x4c3798=getTrimmedString(_0x22067b[_0x2cd003(0x20c)+_0x2cd003(0x284)]);if(!_0x307133||!_0x4c3798){_0x1a78f5[_0x2cd003(0x147)]=_0x2cd003(0x2f9),_0x1a78f5[_0x2cd003(0x15c)+'sage']=_0x2cd003(0x13e)+_0x2cd003(0x1b5)+'\x20或\x20devic'+_0x2cd003(0x22e)+summarizeCliOutput(_0x1a78f5[_0x2cd003(0x328)]);return;}_0x1a78f5['url']=_0x307133,_0x1a78f5[_0x2cd003(0x22f)+'de']=_0x4c3798,void _0x2df123[_0x2cd003(0x214)+_0x2cd003(0x27d)](_0x307133)[_0x2cd003(0x14d)](()=>{}),_0x1618d1(_0x1a78f5,[_0x2cd003(0x233),_0x2cd003(0x298),_0x2cd003(0x17f)+'-code',_0x4c3798],{'phase':'verify','message':_0x2cd003(0x172)+'完成','onSuccess':()=>{const _0x147fce=_0x2cd003;_0x1a78f5['authStat'+_0x147fce(0x13c)+'dAt']=Date['now'](),_0xcaf130(_0x1a78f5,0x1f4);}});}});}});}});}function _0x7306bb(_0x52ace3){const _0x13236e=_0x2b295d;if(_0x52ace3[_0x13236e(0x147)]!==_0x13236e(0x20f))return;_0x2080bb(_0x52ace3),_0x52ace3[_0x13236e(0x272)]=setTimeout(()=>void _0x31ee84(_0x52ace3),_0x52ace3[_0x13236e(0x26c)+_0x13236e(0x265)+'s']);}async function _0x31ee84(_0x499178){const _0x42b18b=_0x2b295d;if(_0x499178['status']!==_0x42b18b(0x20f)||_0x499178[_0x42b18b(0x278)]!=='create'||!_0x499178[_0x42b18b(0x20b)+_0x42b18b(0x277)]||!_0x499178[_0x42b18b(0x1a5)+'eCode'])return;if(Date['now']()>=_0x499178[_0x42b18b(0x31e)+_0x42b18b(0x1f0)]){_0x499178[_0x42b18b(0x147)]=_0x42b18b(0x2f9),_0x499178['errorMes'+_0x42b18b(0x176)]=_0x42b18b(0x2d2)+',请重新连接',_0x2080bb(_0x499178);return;}try{const _0x5d5ef0=await pollFeishuRegistration(_0x499178[_0x42b18b(0x20b)+'lient'],_0x499178[_0x42b18b(0x1a5)+_0x42b18b(0x1bd)]),_0x5754f4=getTrimmedString(_0x5d5ef0[_0x42b18b(0x282)+'d']),_0x5a94f1=getTrimmedString(_0x5d5ef0[_0x42b18b(0x1cb)+'ecret']),_0x1f4779=getTrimmedString(_0x5d5ef0['error']);if(_0x5754f4&&_0x5a94f1){const _0xd353a3=asRecord(_0x5d5ef0[_0x42b18b(0x239)+'o']);await _0x6d2486({'appId':_0x5754f4,'appSecret':_0x5a94f1,'userInfo':{'openId':getTrimmedString(_0xd353a3[_0x42b18b(0x131)])||null},'configPath':_0x499178[_0x42b18b(0x1da)+'onfigPat'+'h']}),_0x499178['cliAppId']=_0x5754f4,_0x499178[_0x42b18b(0x19d)+'cret']=_0x5a94f1,_0x2080bb(_0x499178),_0x499178[_0x42b18b(0x2ba)]=_0x42b18b(0x320)+_0x42b18b(0x25d),_0x186dbc(_0x499178);return;}if(!_0x1f4779||_0x1f4779==='authoriz'+_0x42b18b(0x308)+_0x42b18b(0x304)){_0x7306bb(_0x499178);return;}if(_0x1f4779==='slow_dow'+'n'){_0x499178[_0x42b18b(0x26c)+_0x42b18b(0x265)+'s']+=0x1388,_0x7306bb(_0x499178);return;}_0x499178[_0x42b18b(0x147)]='error',_0x499178[_0x42b18b(0x15c)+_0x42b18b(0x176)]=getTrimmedString(_0x5d5ef0[_0x42b18b(0x2d9)+_0x42b18b(0x319)+'n'])||_0x42b18b(0x2f7)+':'+_0x1f4779,_0x2080bb(_0x499178);}catch(_0x155548){_0x499178[_0x42b18b(0x147)]=_0x42b18b(0x2f9),_0x499178[_0x42b18b(0x15c)+_0x42b18b(0x176)]=_0x155548 instanceof Error?_0x155548[_0x42b18b(0x2ba)]:_0x42b18b(0x2f7),_0x2080bb(_0x499178);}}async function _0x123a9f(_0xa43c89){const _0x266526=_0x2b295d;await _0x34b5c0({'accountName':_0x266526(0x1ac)}),_0xa43c89['status']=_0x266526(0x1d9)+'d',_0xa43c89['phase']=_0x266526(0x1d9)+'d',_0xa43c89[_0x266526(0x2ba)]=_0x266526(0x312)+'完成',_0xa43c89[_0x266526(0x15c)+_0x266526(0x176)]=null;}async function _0x13050b(){const _0x58cbac=_0x2b295d,_0x3b07b1=createFeishuRegistrationClient(),_0xa6cc8d=await initFeishuRegistration(_0x3b07b1),_0x34c9ee=Array[_0x58cbac(0x21c)](_0xa6cc8d[_0x58cbac(0x306)+_0x58cbac(0x1b1)+_0x58cbac(0x2fb)])?_0xa6cc8d[_0x58cbac(0x306)+_0x58cbac(0x1b1)+_0x58cbac(0x2fb)][_0x58cbac(0x334)](getTrimmedString)[_0x58cbac(0x25b)](Boolean):[];if(!_0x34c9ee[_0x58cbac(0x2e7)](_0x58cbac(0x1cb)+'ecret'))throw new Error(_0x58cbac(0x1d1)+_0x58cbac(0x180)+_0x58cbac(0x1cb)+_0x58cbac(0x32d));const _0x51cf8c=await beginFeishuRegistration(_0x3b07b1),_0x216c31=getTrimmedString(_0x51cf8c['verifica'+_0x58cbac(0x2c6)+_0x58cbac(0x1ca)+'e']),_0x2de2e4=getTrimmedString(_0x51cf8c[_0x58cbac(0x20c)+_0x58cbac(0x284)]),_0x3d56bb=Number(_0x51cf8c['expire_i'+'n'])||0x258,_0x5592f1=Number(_0x51cf8c['interval'])||0x5;if(!_0x216c31||!_0x2de2e4)throw new Error(_0x58cbac(0x26f)+_0x58cbac(0x23d)+_0x58cbac(0x30f)+'code,请重试');const _0x5daff1=randomUUID(),_0xa515c4={'sessionId':_0x5daff1,'status':_0x58cbac(0x20f),'phase':_0x58cbac(0x16b),'url':_0x216c31,'appDeviceCode':_0x2de2e4,'appPollClient':_0x3b07b1,'appPollIntervalMs':Math['max'](_0x5592f1*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'appExpiresAt':Date['now']()+_0x3d56bb*0x3e8,'appTimer':null,'authStatusTimer':null,'authStatusStartedAt':0x0,'deviceCode':null,'message':_0x58cbac(0x225)+_0x58cbac(0x198),'errorMessage':null,'process':null,'output':'','cliHostConfigPath':_0x291571(),'cliAppId':null,'cliAppSecret':null};return _0x4584d2[_0x58cbac(0x2df)](_0x5daff1,_0xa515c4),_0x7306bb(_0xa515c4),createFeishuDocCliStatus(_0xa515c4);}function _0xa8bf62(_0x40cc7a={}){const _0xc8c4a1=_0x2b295d,_0x3d6ce7=safeString(_0x40cc7a['sessionI'+'d']);if(!_0x3d6ce7)throw new Error(_0xc8c4a1(0x1e3)+_0xc8c4a1(0x1b2)+_0xc8c4a1(0x323)+'d\x20is\x20req'+_0xc8c4a1(0x200));const _0x4fa740=_0x4584d2[_0xc8c4a1(0x31d)](_0x3d6ce7);if(!_0x4fa740)throw new Error(_0xc8c4a1(0x1e3)+_0xc8c4a1(0x1b2)+_0xc8c4a1(0x1c2)+_0xc8c4a1(0x15b));return createFeishuDocCliStatus(_0x4fa740);}function _0x2cb298(_0x1728ba={}){const _0x3b1dfb=_0x2b295d,_0x519a9e=safeString(_0x1728ba[_0x3b1dfb(0x2f1)+'d']);if(!_0x519a9e)return{'ok':!![]};const _0x569f4d=_0x4584d2[_0x3b1dfb(0x31d)](_0x519a9e);if(!_0x569f4d)return{'ok':!![]};return _0x2080bb(_0x569f4d),_0x505af9(_0x569f4d),_0x569f4d[_0x3b1dfb(0x253)]?.[_0x3b1dfb(0x161)](),_0x4584d2[_0x3b1dfb(0x1f3)](_0x519a9e),{'ok':!![]};}function _0xe0f44d(_0x4fa4a3={}){const _0x577490=_0x2b295d,_0x548c14=safeString(_0x4fa4a3[_0x577490(0x2f1)+'d']);if(!_0x548c14)throw new Error(_0x577490(0x1e3)+_0x577490(0x1b2)+'ession\x20i'+'d\x20is\x20req'+'uired');const _0x4f3166=_0x4584d2[_0x577490(0x31d)](_0x548c14);if(!_0x4f3166)throw new Error(_0x577490(0x1e3)+'oc\x20CLI\x20s'+_0x577490(0x1c2)+_0x577490(0x15b));if(_0x4f3166[_0x577490(0x147)]===_0x577490(0x2f9))throw new Error(_0x4f3166[_0x577490(0x15c)+_0x577490(0x176)]||_0x577490(0x2a1)+_0x577490(0x2c5));return{'ok':!![]};}async function _0x7b93b5(_0x2f1450){const _0x26deda=_0x2b295d,_0x5893f6=asRecord(_0x2f1450[_0x26deda(0x1f9)]),_0x3fabba=asRecord(_0x5893f6[_0x26deda(0x148)]),_0xc53e53=asStringArray(_0x5893f6[_0x26deda(0x18a)]),_0xc0f0a2=asRecord(_0x3fabba[WECHAT_PLUGIN_ID]),_0x49449d=_0xc0f0a2['enabled']===!![]||_0xc53e53['includes'](WECHAT_PLUGIN_ID),_0x5a8a15=join(_0x3c90c7[_0x26deda(0x1cd)+'tateDir'](),WECHAT_PLUGIN_ID),_0x45afb7=join(_0x5a8a15,'accounts'+_0x26deda(0x15d));let _0x5e1bda=![];try{const _0x2de1f4=(await readFile(_0x45afb7,_0x26deda(0x264)))['trim']();if(_0x2de1f4){const _0x3ae081=JSON[_0x26deda(0x2dd)](_0x2de1f4);_0x5e1bda=Array[_0x26deda(0x21c)](_0x3ae081)?_0x3ae081[_0x26deda(0x20a)]>0x0:Object[_0x26deda(0x27b)](asRecord(_0x3ae081))[_0x26deda(0x20a)]>0x0;}}catch{}if(!_0x5e1bda)try{_0x5e1bda=(await readdir(join(_0x5a8a15,_0x26deda(0x152))))[_0x26deda(0x20a)]>0x0;}catch{}return{'exists':_0x49449d||_0x5e1bda,'enabled':_0x49449d,'connected':_0x49449d&&_0x5e1bda};}async function _0x3c86e4(){const _0x32b22c=_0x2b295d,_0xe56aab=await _0xacda93(),_0x832908=asRecord(_0xe56aab[_0x32b22c(0x1db)]),_0x1d9977=[],_0x2c7ab0=await _0x7b93b5(_0xe56aab);_0x2c7ab0['exists']&&_0x1d9977[_0x32b22c(0x2eb)]({'id':WECHAT_PLUGIN_ID,'type':_0x32b22c(0x244),'name':'微信','enabled':_0x2c7ab0[_0x32b22c(0x155)],'connected':_0x2c7ab0['connecte'+'d']});const _0xe9c4c7=asRecord(_0x832908[_0x32b22c(0x13b)]),_0x5aafaf=getTrimmedString(_0xe9c4c7[_0x32b22c(0x30e)]),_0x1e4acd=getTrimmedString(_0xe9c4c7[_0x32b22c(0x19f)+_0x32b22c(0x17c)]);_0x5aafaf&&_0x1e4acd&&_0x1d9977[_0x32b22c(0x2eb)]({'id':'qqbot','type':_0x32b22c(0x13b),'name':'QQ助手','enabled':_0xe9c4c7[_0x32b22c(0x155)]!==![],'appId':_0x5aafaf,'clientSecret':_0x1e4acd});const _0x3dba8e=asRecord(_0x832908[_0x32b22c(0x18d)]),_0x2d6321=getTrimmedString(_0x3dba8e['botId']),_0x44f463=getTrimmedString(_0x3dba8e[_0x32b22c(0x2fa)]);_0x2d6321&&_0x44f463&&_0x1d9977[_0x32b22c(0x2eb)]({'id':_0x32b22c(0x18d),'type':'wecom','name':_0x32b22c(0x2e5),'enabled':_0x3dba8e[_0x32b22c(0x155)]!==![],'botId':_0x2d6321,'secret':_0x44f463});const _0x27dcb3=asRecord(_0x832908[_0x32b22c(0x231)]),_0x569639=getTrimmedString(_0x27dcb3[_0x32b22c(0x30e)]),_0xb75848=getTrimmedString(_0x27dcb3[_0x32b22c(0x20e)+'t']);return _0x569639&&_0xb75848&&getTrimmedString(_0x27dcb3[_0x32b22c(0x1f1)+'y'])!==FEISHU_DOC_CONNECTOR_PLUGIN_ID&&_0x1d9977[_0x32b22c(0x2eb)]({'id':_0x32b22c(0x231),'type':_0x32b22c(0x231),'name':'飞书机器人','enabled':_0x27dcb3[_0x32b22c(0x155)]!==![],'appId':_0x569639,'appSecret':_0xb75848}),_0x1d9977;}async function _0x542be1(_0x16c158){const _0x5497b4=_0x2b295d;if(typeof openClawConfigHandlers[_0x5497b4(0x2c3)+_0x5497b4(0x27c)]===_0x5497b4(0x1c1))return openClawConfigHandlers[_0x5497b4(0x2c3)+'nConfig']({'pluginId':WECHAT_PLUGIN_ID,'enabled':Boolean(_0x16c158),'reason':WECHAT_PLUGIN_ID+_0x5497b4(0x1de)+(_0x16c158?_0x5497b4(0x155):_0x5497b4(0x2e9))});const _0x2be7e4=await _0xacda93(),_0xb8a2c9=asRecord(_0x2be7e4['plugins']),_0x4416e4=asRecord(_0xb8a2c9[_0x5497b4(0x148)]);return _0x4416e4[WECHAT_PLUGIN_ID]={...asRecord(_0x4416e4[WECHAT_PLUGIN_ID]),'enabled':Boolean(_0x16c158)},_0xb8a2c9['entries']=_0x4416e4,_0xb8a2c9[_0x5497b4(0x18a)]=_0x16c158?dedupeStrings([...asStringArray(_0xb8a2c9[_0x5497b4(0x18a)]),WECHAT_PLUGIN_ID]):asStringArray(_0xb8a2c9[_0x5497b4(0x18a)])['filter'](_0x3c48ff=>_0x3c48ff!==WECHAT_PLUGIN_ID),_0x2be7e4[_0x5497b4(0x1f9)]=_0xb8a2c9,await _0x3bdeb2(_0x2be7e4,WECHAT_PLUGIN_ID+'\x20plugin\x20'+(_0x16c158?_0x5497b4(0x155):_0x5497b4(0x2e9))),{'ok':!![]};}async function _0x57eb2c(_0x143c96={}){const _0x134677=_0x2b295d,_0x23e7a5=safeString(_0x143c96[_0x134677(0x2dc)+'d']||_0x143c96['id']);if(!_0x23e7a5)throw new Error(_0x134677(0x1d4)+_0x134677(0x179)+_0x134677(0x165));const _0x4f121c=await _0xacda93(),_0x27bfc0=asRecord(_0x4f121c[_0x134677(0x1db)]),_0x42a342=asRecord(_0x4f121c[_0x134677(0x1f9)]),_0x1c0222=asRecord(_0x42a342[_0x134677(0x148)]),_0x219c7f=_0x5f11d1=>{const _0x339efc=_0x134677;_0x1c0222[_0x5f11d1]=createConnectorPluginEntry(_0x5f11d1,_0x1c0222[_0x5f11d1],![],{}),_0x42a342[_0x339efc(0x18a)]=asStringArray(_0x42a342['allow'])[_0x339efc(0x25b)](_0x99b142=>_0x99b142!==_0x5f11d1),_0x42a342['entries']=_0x1c0222,_0x4f121c[_0x339efc(0x1f9)]=_0x42a342;};if(_0x23e7a5===_0x134677(0x167)+'oc')return _0x219c7f(FEISHU_DOC_CONNECTOR_PLUGIN_ID),getTrimmedString(asRecord(_0x27bfc0[_0x134677(0x231)])['managedB'+'y'])===FEISHU_DOC_CONNECTOR_PLUGIN_ID&&(delete _0x27bfc0[_0x134677(0x231)],_0x4f121c[_0x134677(0x1db)]=_0x27bfc0),await rm(_0x2882df(),{'recursive':!![],'force':!![]})[_0x134677(0x14d)](()=>{}),_0x3bdeb2(_0x4f121c,_0x134677(0x2bd)+_0x134677(0x2ab)+_0x134677(0x219)+_0x134677(0x252)+_0x134677(0x209));if(_0x23e7a5===_0x134677(0x29d)){if(typeof openClawConfigHandlers[_0x134677(0x2c3)+_0x134677(0x27c)]==='function')return openClawConfigHandlers[_0x134677(0x2c3)+_0x134677(0x27c)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x134677(0x29c)+_0x134677(0x1b3)+_0x134677(0x2b0)+'\x20deleted'});return _0x219c7f(QQ_MAIL_CONNECTOR_PLUGIN_ID),_0x3bdeb2(_0x4f121c,_0x134677(0x29c)+'connecto'+'r\x20plugin'+_0x134677(0x276));}if(_0x23e7a5===_0x134677(0x1ce)+_0x134677(0x25f)){if(typeof openClawConfigHandlers[_0x134677(0x2c3)+'nConfig']===_0x134677(0x1c1))return openClawConfigHandlers['setPlugi'+'nConfig']({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x134677(0x292)+'mail\x20con'+_0x134677(0x294)+_0x134677(0x1ff)+_0x134677(0x32a)});return _0x219c7f(NETEASE_MAIL_CONNECTOR_PLUGIN_ID),_0x3bdeb2(_0x4f121c,_0x134677(0x292)+'mail\x20con'+_0x134677(0x294)+_0x134677(0x1ff)+'leted');}if(_0x23e7a5===_0x134677(0x2a5)+_0x134677(0x1c9)){if(typeof openClawConfigHandlers['setPlugi'+_0x134677(0x27c)]===_0x134677(0x1c1))return openClawConfigHandlers[_0x134677(0x2c3)+_0x134677(0x27c)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x134677(0x32c)+_0x134677(0x318)+_0x134677(0x208)+'\x20plugin\x20'+_0x134677(0x15e)});return _0x219c7f(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID),_0x3bdeb2(_0x4f121c,_0x134677(0x32c)+'exmail\x20c'+'onnector'+_0x134677(0x1de)+_0x134677(0x15e));}if(_0x23e7a5===_0x134677(0x2a5)+_0x134677(0x163)){if(typeof openClawConfigHandlers[_0x134677(0x2ac)+_0x134677(0x1ad)]===_0x134677(0x1c1))return openClawConfigHandlers['deleteSk'+_0x134677(0x1ad)]({'skillId':TENCENT_DOCS_SKILL_ID,'reason':_0x134677(0x32c)+_0x134677(0x2a2)+'ll\x20conne'+_0x134677(0x156)+_0x134677(0x274)});const _0x4f42ab=asRecord(_0x4f121c[_0x134677(0x216)]),_0x228433=asRecord(_0x4f42ab[_0x134677(0x148)]);return delete _0x228433[TENCENT_DOCS_SKILL_ID],_0x4f42ab['entries']=_0x228433,_0x4f121c[_0x134677(0x216)]=_0x4f42ab,_0x3bdeb2(_0x4f121c,_0x134677(0x32c)+_0x134677(0x2a2)+_0x134677(0x19b)+'ctor\x20del'+_0x134677(0x274));}if(_0x23e7a5===_0x134677(0x2b4))return await _0x50f63e([_0x134677(0x233),_0x134677(0x29f)])[_0x134677(0x14d)](()=>({'code':null,'output':''})),await _0x1fff4e(),{'ok':!![]};if(_0x23e7a5===_0x134677(0x2b7)+_0x134677(0x1bc)){if(typeof openClawConfigHandlers['deleteMc'+_0x134677(0x1c3)]===_0x134677(0x1c1))return openClawConfigHandlers[_0x134677(0x178)+'pServer']({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'reason':_0x134677(0x2b7)+_0x134677(0x2ed)+'\x20deleted'});const _0x381a63=readOpenClawMcpServersFromConfig(_0x4f121c);return delete _0x381a63[DINGTALK_DOC_MCP_SERVER_NAME],writeOpenClawMcpServersToConfig(_0x4f121c,_0x381a63),_0x3bdeb2(_0x4f121c,_0x134677(0x2b7)+_0x134677(0x2ed)+_0x134677(0x276));}if(_0x23e7a5===WECHAT_PLUGIN_ID||_0x23e7a5===_0x134677(0x184)+_0x134677(0x203)){_0x1c0222[WECHAT_PLUGIN_ID]={...asRecord(_0x1c0222[WECHAT_PLUGIN_ID]),'enabled':![]},_0x42a342[_0x134677(0x148)]=_0x1c0222,_0x42a342['allow']=asStringArray(_0x42a342[_0x134677(0x18a)])['filter'](_0x1f14de=>_0x1f14de!==WECHAT_PLUGIN_ID&&_0x1f14de!==_0x134677(0x184)+_0x134677(0x203)),_0x4f121c[_0x134677(0x1f9)]=_0x42a342;const _0x49144e=join(_0x3c90c7['resolveS'+'tateDir'](),WECHAT_PLUGIN_ID);return await rm(join(_0x49144e,_0x134677(0x152)+_0x134677(0x15d)),{'force':!![]})[_0x134677(0x14d)](()=>{}),await rm(join(_0x49144e,'accounts'),{'recursive':!![],'force':!![]})[_0x134677(0x14d)](()=>{}),_0x3bdeb2(_0x4f121c,_0x23e7a5+(_0x134677(0x202)+_0x134677(0x24a)+_0x134677(0x15e)));}if(_0x23e7a5===_0x134677(0x231)){if(typeof openClawConfigHandlers[_0x134677(0x192)+'annelCon'+_0x134677(0x170)]===_0x134677(0x1c1))return openClawConfigHandlers[_0x134677(0x192)+_0x134677(0x329)+_0x134677(0x170)]({'channelId':_0x134677(0x231),'pluginId':'feishu','reason':_0x134677(0x247)+_0x134677(0x2f2)+_0x134677(0x2fe)+_0x134677(0x32a)});return delete _0x27bfc0[_0x134677(0x231)],_0x4f121c[_0x134677(0x1db)]=_0x27bfc0,_0x1c0222[_0x134677(0x231)]={...asRecord(_0x1c0222[_0x134677(0x231)]),'enabled':![]},_0x42a342['entries']=_0x1c0222,_0x42a342[_0x134677(0x18a)]=asStringArray(_0x42a342[_0x134677(0x18a)])[_0x134677(0x25b)](_0x4664de=>_0x4664de!=='feishu'),_0x4f121c[_0x134677(0x1f9)]=_0x42a342,_0x3bdeb2(_0x4f121c,_0x134677(0x247)+_0x134677(0x2f2)+_0x134677(0x2fe)+_0x134677(0x32a));}if(_0x23e7a5===_0x134677(0x13b)){if(typeof openClawConfigHandlers[_0x134677(0x192)+_0x134677(0x329)+_0x134677(0x170)]===_0x134677(0x1c1))return openClawConfigHandlers[_0x134677(0x192)+'annelCon'+_0x134677(0x170)]({'channelId':_0x134677(0x13b),'pluginId':QQBOT_PLUGIN_ID,'reason':_0x134677(0x1e6)+'annel\x20co'+'nfig\x20del'+'eted'});delete _0x27bfc0[_0x134677(0x13b)],_0x1c0222[QQBOT_PLUGIN_ID]={...asRecord(_0x1c0222[QQBOT_PLUGIN_ID]),'enabled':![]},_0x42a342[_0x134677(0x18a)]=asStringArray(_0x42a342['allow'])[_0x134677(0x25b)](_0x2fbdd1=>_0x2fbdd1!==QQBOT_PLUGIN_ID);}if(_0x23e7a5==='wecom'){if(typeof openClawConfigHandlers[_0x134677(0x192)+_0x134677(0x329)+_0x134677(0x170)]===_0x134677(0x1c1))return openClawConfigHandlers[_0x134677(0x192)+'annelCon'+'fig']({'channelId':_0x134677(0x18d),'pluginId':WECOM_PLUGIN_ID,'reason':_0x134677(0x26b)+_0x134677(0x1e7)+_0x134677(0x271)+_0x134677(0x274)});delete _0x27bfc0[_0x134677(0x18d)],_0x1c0222[WECOM_PLUGIN_ID]={...asRecord(_0x1c0222[WECOM_PLUGIN_ID]),'enabled':![]},_0x42a342[_0x134677(0x18a)]=asStringArray(_0x42a342[_0x134677(0x18a)])['filter'](_0x5a5434=>_0x5a5434!==WECOM_PLUGIN_ID);}return _0x4f121c[_0x134677(0x1db)]=_0x27bfc0,_0x42a342['entries']=_0x1c0222,_0x4f121c['plugins']=_0x42a342,_0x3bdeb2(_0x4f121c,_0x23e7a5+(_0x134677(0x202)+_0x134677(0x24a)+_0x134677(0x15e)));}async function _0x30636c(_0x319a45={}){const _0x1a947b=_0x2b295d,_0x2dc853=safeString(_0x319a45[_0x1a947b(0x2dc)+'d']||_0x319a45['id']);if(!_0x2dc853)throw new Error(_0x1a947b(0x1d4)+'id\x20is\x20re'+'quired');const _0x2c0aa8=_0x319a45[_0x1a947b(0x155)]===!![],_0x11f01f=await _0xacda93(),_0x4e6244=asRecord(_0x11f01f[_0x1a947b(0x1f9)]),_0x594bfa=asRecord(_0x4e6244[_0x1a947b(0x148)]),_0x2fe7ac=_0x350c76=>{const _0x52c5e4=_0x1a947b;_0x594bfa[_0x350c76]=createConnectorPluginEntry(_0x350c76,_0x594bfa[_0x350c76],_0x2c0aa8,{},{'preserveExistingConfig':!![]}),_0x4e6244[_0x52c5e4(0x18a)]=_0x2c0aa8?dedupeStrings([...asStringArray(_0x4e6244[_0x52c5e4(0x18a)]),_0x350c76]):asStringArray(_0x4e6244[_0x52c5e4(0x18a)])[_0x52c5e4(0x25b)](_0x2a1ab7=>_0x2a1ab7!==_0x350c76),_0x4e6244[_0x52c5e4(0x148)]=_0x594bfa,_0x11f01f[_0x52c5e4(0x1f9)]=_0x4e6244;};if(_0x2dc853==='feishu_d'+'oc'){const _0x161cea=asRecord(_0x594bfa[FEISHU_DOC_CONNECTOR_PLUGIN_ID]);if(Object[_0x1a947b(0x27b)](_0x161cea)[_0x1a947b(0x20a)]===0x0)throw new Error(_0x1a947b(0x2c8)+_0x1a947b(0x242)+_0x2dc853+(_0x1a947b(0x218)+_0x1a947b(0x28a)));if(typeof openClawConfigHandlers[_0x1a947b(0x2c3)+'nConfig']===_0x1a947b(0x1c1))return openClawConfigHandlers['setPlugi'+_0x1a947b(0x27c)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':_0x2c0aa8,'reason':_0x2dc853+(_0x1a947b(0x202)+_0x1a947b(0x24a))+(_0x2c0aa8?_0x1a947b(0x155):_0x1a947b(0x2e9))});_0x2fe7ac(FEISHU_DOC_CONNECTOR_PLUGIN_ID);}else{if(_0x2dc853===_0x1a947b(0x29d)){if(typeof openClawConfigHandlers[_0x1a947b(0x2c3)+_0x1a947b(0x27c)]===_0x1a947b(0x1c1))return openClawConfigHandlers['setPlugi'+_0x1a947b(0x27c)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x2c0aa8,'reason':_0x2dc853+(_0x1a947b(0x202)+_0x1a947b(0x24a))+(_0x2c0aa8?'enabled':_0x1a947b(0x2e9))});_0x2fe7ac(QQ_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x2dc853===_0x1a947b(0x1ce)+_0x1a947b(0x25f)){if(typeof openClawConfigHandlers['setPlugi'+_0x1a947b(0x27c)]===_0x1a947b(0x1c1))return openClawConfigHandlers[_0x1a947b(0x2c3)+_0x1a947b(0x27c)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x2c0aa8,'reason':_0x2dc853+(_0x1a947b(0x202)+_0x1a947b(0x24a))+(_0x2c0aa8?'enabled':'disabled')});_0x2fe7ac(NETEASE_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x2dc853==='tencent_'+_0x1a947b(0x1c9)){if(typeof openClawConfigHandlers[_0x1a947b(0x2c3)+'nConfig']===_0x1a947b(0x1c1))return openClawConfigHandlers['setPlugi'+_0x1a947b(0x27c)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x2c0aa8,'reason':_0x2dc853+('\x20channel'+_0x1a947b(0x24a))+(_0x2c0aa8?_0x1a947b(0x155):_0x1a947b(0x2e9))});_0x2fe7ac(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x2dc853==='tencent_'+_0x1a947b(0x163)){const _0x53007d=asRecord(_0x11f01f[_0x1a947b(0x216)]),_0x38e0ea=asRecord(_0x53007d['entries']),_0x29425a=asRecord(_0x38e0ea[TENCENT_DOCS_SKILL_ID]);if(typeof openClawConfigHandlers['setSkill'+'Entry']===_0x1a947b(0x1c1))return openClawConfigHandlers[_0x1a947b(0x2b2)+_0x1a947b(0x2a8)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':{..._0x29425a,'enabled':_0x2c0aa8},'reason':_0x2dc853+(_0x1a947b(0x202)+_0x1a947b(0x24a))+(_0x2c0aa8?_0x1a947b(0x155):_0x1a947b(0x2e9))});_0x38e0ea[TENCENT_DOCS_SKILL_ID]={..._0x29425a,'enabled':_0x2c0aa8},_0x53007d[_0x1a947b(0x148)]=_0x38e0ea,_0x11f01f[_0x1a947b(0x216)]=_0x53007d;}else{if(_0x2dc853===_0x1a947b(0x2b4)){if(_0x2c0aa8&&!await _0x308b3d())throw new Error('金山文档尚未授权'+_0x1a947b(0x206));return await _0x237a9b(_0x2c0aa8),{'ok':!![]};}else{if(_0x2dc853===_0x1a947b(0x2b7)+_0x1a947b(0x1bc)){const _0x271132=readOpenClawMcpServersFromConfig(_0x11f01f),_0x2bf15a=findDingtalkDocMcpServer(_0x271132);if(!getTrimmedString(_0x2bf15a[_0x1a947b(0x28f)]))throw new Error(_0x1a947b(0x2c8)+_0x1a947b(0x242)+_0x2dc853+(_0x1a947b(0x218)+'und'));_0x271132[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x2bf15a[_0x1a947b(0x28f)],{'enabled':_0x2c0aa8}),writeOpenClawMcpServersToConfig(_0x11f01f,_0x271132);}else{const _0x7596fc=asRecord(_0x11f01f[_0x1a947b(0x1db)]),_0x566bf4=asRecord(_0x7596fc[_0x2dc853]);if(Object['keys'](_0x566bf4)[_0x1a947b(0x20a)]===0x0)throw new Error(_0x1a947b(0x1d4)+'\x22'+_0x2dc853+(_0x1a947b(0x218)+_0x1a947b(0x28a)));_0x566bf4[_0x1a947b(0x155)]=_0x2c0aa8;let _0x19b3fb=null;_0x2dc853===_0x1a947b(0x231)&&(_0x19b3fb=_0x1a947b(0x231),_0x2c0aa8&&(_0x566bf4['streamin'+'g']=!![],delete _0x566bf4[_0x1a947b(0x1d8)]));if(_0x2dc853===_0x1a947b(0x13b))_0x19b3fb=QQBOT_PLUGIN_ID;if(_0x2dc853===_0x1a947b(0x18d))_0x19b3fb=WECOM_PLUGIN_ID;if(_0x19b3fb&&typeof openClawConfigHandlers['setChann'+_0x1a947b(0x224)]==='function')return openClawConfigHandlers['setChann'+_0x1a947b(0x224)]({'channelId':_0x2dc853,'channel':_0x566bf4,'pluginId':_0x19b3fb,'pluginEnabled':_0x2c0aa8,'reason':_0x2dc853+(_0x1a947b(0x202)+_0x1a947b(0x24a))+(_0x2c0aa8?_0x1a947b(0x155):_0x1a947b(0x2e9))});_0x7596fc[_0x2dc853]=_0x566bf4,_0x11f01f[_0x1a947b(0x1db)]=_0x7596fc;if(_0x2dc853===_0x1a947b(0x231))_0x2fe7ac(_0x1a947b(0x231));if(_0x2dc853==='qqbot')_0x2fe7ac(QQBOT_PLUGIN_ID);if(_0x2dc853===_0x1a947b(0x18d))_0x2fe7ac(WECOM_PLUGIN_ID);}}}}}}}return _0x3bdeb2(_0x11f01f,_0x2dc853+(_0x1a947b(0x202)+_0x1a947b(0x24a))+(_0x2c0aa8?_0x1a947b(0x155):_0x1a947b(0x2e9)));}async function _0x290a9b({gatewayPort:_0x4a1940,gatewayToken:_0x4ed0ea}={}){const _0x2ac9df=_0x2b295d;_0x3b45c3&&(_0x3b45c3[_0x2ac9df(0x161)](),_0x3b45c3=null);const {cwd:_0x3dd234,env:_0x23138a,runtime:_0x32ce87}=await _0x30d9df({'FORCE_COLOR':'0',..._0x4a1940?{'OPENCLAW_GATEWAY_PORT':String(_0x4a1940)}:{},..._0x4ed0ea?{'OPENCLAW_GATEWAY_TOKEN':_0x4ed0ea}:{}}),_0x52be07=_0x32ce87[_0x2ac9df(0x1f9)][_0x2ac9df(0x14f)](_0x3ca243=>_0x3ca243[_0x2ac9df(0x145)]===WECHAT_PLUGIN_ID);if(!_0x52be07){const _0x1efa56='当前客户端未内置'+_0x2ac9df(0x1d5)+_0x2ac9df(0x23e)+'的新版客户端';return _0x5480d5(_0x2ac9df(0x227)+_0x2ac9df(0x171),_0x2ac9df(0x13d)),_0x5480d5(_0x2ac9df(0x2c1)+'og',_0x1efa56),{'ok':![],'error':_0x1efa56};}await _0x542be1(!![]),_0x5480d5(_0x2ac9df(0x2c1)+'og',_0x2ac9df(0x30b)+_0x2ac9df(0x260)+_0x2ac9df(0x2ee)+'login\x20--'+_0x2ac9df(0x1a4)+_0x52be07[_0x2ac9df(0x145)]),_0x3b45c3=spawn(_0x32ce87[_0x2ac9df(0x228)+_0x2ac9df(0x25a)],[_0x32ce87[_0x2ac9df(0x184)+_0x2ac9df(0x2ae)],'channels',_0x2ac9df(0x298),_0x2ac9df(0x17a)+'l',_0x52be07[_0x2ac9df(0x145)]],{'cwd':_0x3dd234,'env':_0x23138a});let _0x2214c4='',_0x4978f5=![],_0x1b64fa=![];const _0x503ba4=_0x1d6a97=>{const _0x56f2e8=_0x2ac9df,_0x3b9247=_0x1d6a97['toString']();_0x2214c4+=_0x3b9247;if(!_0x4978f5){const _0x559806=_0x2214c4[_0x56f2e8(0x141)](/(https:\/\/(?:[a-zA-Z0-9-]+\.)*weixin\.qq\.com\S+)/i);_0x559806?.[0x1]&&(_0x4978f5=!![],_0x5480d5('wechat-q'+_0x56f2e8(0x2ea),_0x559806[0x1]),_0x5480d5('wechat-s'+'tatus',_0x56f2e8(0x195)));}if(_0x3b9247['includes']('已扫描')||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x139)+_0x56f2e8(0x1fb))||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x204)))_0x5480d5(_0x56f2e8(0x227)+_0x56f2e8(0x171),_0x56f2e8(0x1a6));else{if(_0x3b9247['includes'](_0x56f2e8(0x2f6))||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x235))||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x310))||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x1ab)+'n')||_0x3b9247['includes'](_0x56f2e8(0x222)+_0x56f2e8(0x301))||_0x3b9247['includes'](_0x56f2e8(0x305))||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x1e2))||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x31c))||_0x3b9247['includes'](_0x56f2e8(0x215)+_0x56f2e8(0x16e)+'d')||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x157)+_0x56f2e8(0x194)+_0x56f2e8(0x316)))_0x1b64fa=!![],_0x5480d5(_0x56f2e8(0x227)+_0x56f2e8(0x171),_0x56f2e8(0x18e)),setTimeout(()=>{const _0x136f2b=_0x56f2e8;_0x3b45c3&&(_0x3b45c3[_0x136f2b(0x161)](),_0x3b45c3=null);},0xbb8);else{if(_0x3b9247[_0x56f2e8(0x2e7)]('过期')||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x2e1)))_0x5480d5('wechat-s'+_0x56f2e8(0x171),_0x56f2e8(0x2d7));else(_0x3b9247[_0x56f2e8(0x2e7)]('失败')||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x1d6))||_0x3b9247[_0x56f2e8(0x2e7)](_0x56f2e8(0x330)))&&_0x5480d5(_0x56f2e8(0x227)+_0x56f2e8(0x171),_0x56f2e8(0x13d));}}_0x5480d5('wechat-l'+'og',_0x3b9247);};return _0x3b45c3[_0x2ac9df(0x2e3)]?.['on'](_0x2ac9df(0x2ec),_0x503ba4),_0x3b45c3['stderr']?.['on'](_0x2ac9df(0x2ec),_0x503ba4),_0x3b45c3['on'](_0x2ac9df(0x2f9),_0x47e20b=>{const _0x168ace=_0x2ac9df;_0x3b45c3=null,_0x5480d5(_0x168ace(0x227)+'tatus','ERROR'),_0x5480d5(_0x168ace(0x2c1)+'og','Spawn\x20er'+'ror:\x20'+_0x47e20b[_0x168ace(0x2ba)]);}),_0x3b45c3['on'](_0x2ac9df(0x29a),_0x4e92ef=>{const _0x3191a4=_0x2ac9df;_0x3b45c3=null,_0x1b64fa?_0x542be1(!![])[_0x3191a4(0x14d)](()=>{}):(_0x542be1(![])[_0x3191a4(0x14d)](()=>{}),_0x5480d5(_0x3191a4(0x227)+_0x3191a4(0x171),_0x4e92ef===0x0?_0x3191a4(0x303):_0x3191a4(0x13d)));}),{'ok':!![]};}function _0x486313(){const _0x4d9dc5=_0x2b295d;return _0x3b45c3&&(_0x3b45c3[_0x4d9dc5(0x161)](),_0x3b45c3=null),{'ok':!![]};}function _0x592c53(){const _0x1717cc=_0x2b295d;for(const _0x2f605d of _0x431985['values']()){_0x5a065e(_0x2f605d),_0x2f605d[_0x1717cc(0x253)]?.[_0x1717cc(0x161)]();}_0x431985['clear']();for(const _0xddf9a9 of _0xf32f18[_0x1717cc(0x336)]()){_0x156ed7(_0xddf9a9);}_0xf32f18[_0x1717cc(0x309)]();for(const _0x709654 of _0x4584d2[_0x1717cc(0x336)]()){_0x2080bb(_0x709654),_0x505af9(_0x709654),_0x709654[_0x1717cc(0x253)]?.[_0x1717cc(0x161)]();}_0x4584d2[_0x1717cc(0x309)](),_0x3b45c3&&(_0x3b45c3[_0x1717cc(0x161)](),_0x3b45c3=null);}return{'saveFeishuChannelConfig':_0x3d758c,'saveQqbotChannelConfig':_0x12c203,'saveWecomChannelConfig':_0x412da2,'saveQqMailConnectorConfig':_0x2088d3,'saveNetEaseMailConnectorConfig':_0x5ec606,'saveTencentExmailConnectorConfig':_0x297d4a,'saveFeishuDocConnectorConfig':_0x34b5c0,'saveTencentDocsConnectorConfig':_0xc96fdc,'saveKdocsConnectorConfig':_0xe613cf,'saveDingtalkDocConnectorConfig':_0x148981,'readConfigSnapshot':_0xec3788,'startKdocsCliConnectSession':_0x2b6c48,'getKdocsCliConnectStatus':_0x462c38,'cancelKdocsCliConnectSession':_0xbb2484,'startFeishuDocCliConnectSession':_0x13050b,'getFeishuDocCliConnectStatus':_0xa8bf62,'cancelFeishuDocCliConnectSession':_0x2cb298,'completeFeishuDocCliConnectSession':_0xe0f44d,'startFeishuRegistrationSession':_0x14b16b,'getFeishuRegistrationStatus':_0x499a72,'cancelFeishuRegistrationSession':_0x542f5e,'listImChannelConfigs':_0x3c86e4,'deleteImChannelConfig':_0x57eb2c,'setImChannelEnabled':_0x30636c,'startWechatChannelSession':_0x290a9b,'cancelWechatChannelSession':_0x486313,'dispose':_0x592c53};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x13ecdf=_0x947d;function _0x58b2(){const _0x6d8e97=['hell:run','with\x20cod','runtimeR','join','trim','ory','isFile','i\x20alread','resume','e\x20kdocs\x20','ld_proce','2976530pOrWil','resolved','info','download','then','ime\x0a','ebuild\x20t','isDirect','.zip','catch','endsWith','772884FEAvWt','1224sQaJXy','om\x20','ut\x20after','i\x20instal','\x20failed\x20','sing\x20fro','6780036HOGAQL','pipe','llPaths','scdn.cn/','includes','toString','close','o\x20resolv','extract\x20','statusCo','me.','cwd','wujie-sh','rsion\x20fr','\x20timed\x20o','re\x22\x20to\x20r','ell-runt','now','windows','[wujie-s','platform','map','label','1261344guAQtH','tools','filter','/pro','node:chi','40KUIkzT','.kdocs-c','Unable\x20t','led','win32','stdout','time]\x20do','SIGTERM','test','\x20not\x20fou','816UMQuGH','.cache','oot','m\x20OpenCl','data','match','arch','Bundled\x20','y\x20instal','https://','i.exe','ll\x20prepa','wnloadin','wpsai.wp','SKILL.md','8778294buqwuQ','skill\x20ve','skillhub','pid','push','aw\x20runti','runtimeL','212821hrcXjV','env','utf8','href','he\x20runti','.source','error','ogger','me:\x20','name','openclaw','ct-','location','x64','kill','kdocs-cl'];_0x58b2=function(){return _0x6d8e97;};return _0x58b2();}(function(_0x4fa877,_0x56a0e5){const _0x933734=_0x947d,_0x558061=_0x4fa877();while(!![]){try{const _0x1a01b6=parseInt(_0x933734(0x16b))/0x1*(-parseInt(_0x933734(0x12e))/0x2)+parseInt(_0x933734(0x11f))/0x3+parseInt(_0x933734(0x108))/0x4+parseInt(_0x933734(0x15f))/0x5+-parseInt(_0x933734(0x16a))/0x6+parseInt(_0x933734(0x144))/0x7*(-parseInt(_0x933734(0x124))/0x8)+-parseInt(_0x933734(0x13d))/0x9;if(_0x1a01b6===_0x56a0e5)break;else _0x558061['push'](_0x558061['shift']());}catch(_0xa2f193){_0x558061['push'](_0x558061['shift']());}}}(_0x58b2,0xe9328));import{existsSync,readdirSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{get}from'node:https';import{pipeline}from'node:stream/promises';const KDOCS_CLI_CDN_BASE=(process.env.KDOCS_CLI_CDN??_0x13ecdf(0x137)+_0x13ecdf(0x13b)+_0x13ecdf(0x10b)+_0x13ecdf(0x13f)+_0x13ecdf(0x122))['replace'](/\/$/,''),DOWNLOAD_TIMEOUT_MS=0xf*0x3c*0x3e8;async function runProcess(_0x323d2d,_0x31bf5b,_0x3dbd43={}){const _0x1cb69e=_0x13ecdf,{spawn:_0x461733}=await import(_0x1cb69e(0x123)+_0x1cb69e(0x15e)+'ss'),_0x571309=_0x3dbd43[_0x1cb69e(0x11e)]||[_0x323d2d,..._0x31bf5b][_0x1cb69e(0x157)]('\x20'),_0x484f04=_0x3dbd43['timeoutM'+'s']??DOWNLOAD_TIMEOUT_MS;return await new Promise((_0x3ace23,_0x3dd830)=>{const _0x4db07e=_0x1cb69e,_0x4d3360=_0x461733(_0x323d2d,_0x31bf5b,{'cwd':_0x3dbd43[_0x4db07e(0x113)],'env':_0x3dbd43[_0x4db07e(0x145)],'stdio':['ignore',_0x4db07e(0x109),_0x4db07e(0x109)]});let _0x2fbef8='',_0x335271='';const _0x4a601b=setTimeout(()=>{const _0x24a9d8=_0x4db07e;_0x4d3360[_0x24a9d8(0x152)](_0x24a9d8(0x12b)),_0x3dd830(new Error(_0x571309+(_0x24a9d8(0x116)+_0x24a9d8(0x16d)+'\x20')+_0x484f04+'ms'));},_0x484f04);_0x4d3360[_0x4db07e(0x129)]['on'](_0x4db07e(0x132),_0x593a56=>{const _0x40e852=_0x4db07e;_0x2fbef8+=_0x593a56[_0x40e852(0x10d)]();}),_0x4d3360['stderr']['on'](_0x4db07e(0x132),_0x2e27e=>{const _0x133e69=_0x4db07e;_0x335271+=_0x2e27e[_0x133e69(0x10d)]();}),_0x4d3360['on'](_0x4db07e(0x14a),_0x4fd02d=>{clearTimeout(_0x4a601b),_0x3dd830(_0x4fd02d);}),_0x4d3360['on'](_0x4db07e(0x10e),_0x51c46d=>{const _0x4da958=_0x4db07e;clearTimeout(_0x4a601b);if(_0x51c46d===0x0)_0x3ace23({'stdout':_0x2fbef8,'stderr':_0x335271,'code':_0x51c46d});else _0x3dd830(new Error(_0x571309+(_0x4da958(0x16f)+_0x4da958(0x155)+'e\x20')+_0x51c46d+':\x20'+(_0x335271||_0x2fbef8)));});});}async function downloadFile(_0x1adc2b,_0x286dfa){await mkdir(dirname(_0x286dfa),{'recursive':!![]});const _0x253145=await new Promise((_0x1d67e8,_0x4ea09b)=>{const _0x1fe997=_0x947d,_0x124ba1=get(_0x1adc2b,_0x65eb7b=>{const _0x43850a=_0x947d;if([0x12d,0x12e,0x12f,0x133,0x134][_0x43850a(0x10c)](_0x65eb7b[_0x43850a(0x111)+'de']||0x0)&&_0x65eb7b['headers'][_0x43850a(0x150)]){_0x65eb7b[_0x43850a(0x15c)](),downloadFile(new URL(_0x65eb7b['headers'][_0x43850a(0x150)],_0x1adc2b)[_0x43850a(0x147)],_0x286dfa)[_0x43850a(0x163)](()=>_0x1d67e8(null))[_0x43850a(0x168)](_0x4ea09b);return;}if((_0x65eb7b[_0x43850a(0x111)+'de']||0x0)>=0x190){_0x65eb7b[_0x43850a(0x15c)](),_0x4ea09b(new Error(_0x43850a(0x162)+_0x43850a(0x16f)+_0x65eb7b[_0x43850a(0x111)+'de']+':\x20'+_0x1adc2b));return;}_0x1d67e8(_0x65eb7b);});_0x124ba1['on'](_0x1fe997(0x14a),_0x4ea09b);});if(!_0x253145)return;await pipeline(_0x253145,createWriteStream(_0x286dfa));}async function findRuntimeKdocsCliBin(_0x1a9b3e){const _0x5f35aa=_0x13ecdf,_0xd261d6=join(_0x1a9b3e[_0x5f35aa(0x14e)+'WorkingD'+'ir'],_0x5f35aa(0x120),_0x5f35aa(0x153)+'i'),_0x5ee446=join(_0xd261d6,process['platform']===_0x5f35aa(0x128)?_0x5f35aa(0x153)+'i.exe':_0x5f35aa(0x153)+'i');return{'installDir':_0xd261d6,'binPath':existsSync(_0x5ee446)?_0x5ee446:null};}export async function resolveRuntimeKdocsCliCommand(_0x562358){const _0x1a5e64=_0x13ecdf,{installDir:_0x243a15,binPath:_0x2cfc75}=await findRuntimeKdocsCliBin(_0x562358);if(!_0x2cfc75||!existsSync(_0x2cfc75))throw new Error(_0x1a5e64(0x135)+'kdocs-cl'+'i\x20is\x20mis'+_0x1a5e64(0x170)+_0x1a5e64(0x131)+_0x1a5e64(0x142)+_0x1a5e64(0x14c)+_0x243a15+('.\x20Run\x20\x22w'+'ujie-she'+_0x1a5e64(0x139)+_0x1a5e64(0x117)+_0x1a5e64(0x165)+_0x1a5e64(0x148)+_0x1a5e64(0x112)));return{'executablePath':_0x2cfc75,'installDir':_0x243a15};}function toKdocsCliPlatform(_0x331cae){const _0x4cbb2d=_0x13ecdf;if(_0x331cae===_0x4cbb2d(0x128))return _0x4cbb2d(0x11a);return _0x331cae;}function _0x947d(_0x104463,_0x15c9e1){_0x104463=_0x104463-0x108;const _0x58b26b=_0x58b2();let _0x947df5=_0x58b26b[_0x104463];return _0x947df5;}function toKdocsCliArch(_0x34186d){const _0x37134a=_0x13ecdf;if(_0x34186d===_0x37134a(0x151))return'amd64';return _0x34186d;}async function resolveKdocsSkillVersion(_0x1db4ae){const _0x14082f=_0x13ecdf,_0x332772=_0x1db4ae['openclaw']['resolved'+'LocalSki'+_0x14082f(0x10a)]??[],_0x5d09b5=[];for(const _0x6eb84c of _0x332772){if(!existsSync(_0x6eb84c))continue;_0x5d09b5[_0x14082f(0x141)](join(_0x6eb84c,_0x14082f(0x13c))),_0x5d09b5['push'](...(await readdir(_0x6eb84c,{'withFileTypes':!![]}))[_0x14082f(0x121)](_0x4a5679=>_0x4a5679[_0x14082f(0x166)+_0x14082f(0x159)]())[_0x14082f(0x11d)](_0x281ef4=>join(_0x6eb84c,_0x281ef4['name'],_0x14082f(0x13c))));}for(const _0x58400a of _0x5d09b5){if(!existsSync(_0x58400a))continue;const _0x19abe9=await readFile(_0x58400a,_0x14082f(0x146));if(!/^name:\s*kdocs\s*$/m[_0x14082f(0x12c)](_0x19abe9))continue;const _0x438fc0=_0x19abe9[_0x14082f(0x133)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x438fc0?.[0x1])return _0x438fc0[0x1];}throw new Error(_0x14082f(0x126)+_0x14082f(0x10f)+_0x14082f(0x15d)+_0x14082f(0x13e)+_0x14082f(0x115)+_0x14082f(0x16c)+_0x332772[_0x14082f(0x157)](',\x20'));}export async function hasConfiguredKdocsSkill(_0x56a05c){const _0x5714d9=_0x13ecdf,_0x1cd371=_0x56a05c[_0x5714d9(0x14e)][_0x5714d9(0x160)+'LocalSki'+_0x5714d9(0x10a)]??[],_0xed1c1f=[];for(const _0x1c484a of _0x1cd371){if(!existsSync(_0x1c484a))continue;_0xed1c1f[_0x5714d9(0x141)](join(_0x1c484a,_0x5714d9(0x13c))),_0xed1c1f[_0x5714d9(0x141)](...(await readdir(_0x1c484a,{'withFileTypes':!![]}))['filter'](_0x1c3936=>_0x1c3936['isDirect'+'ory']())[_0x5714d9(0x11d)](_0x400181=>join(_0x1c484a,_0x400181[_0x5714d9(0x14d)],'SKILL.md')));}for(const _0x11a987 of _0xed1c1f){if(!existsSync(_0x11a987))continue;const _0x2a8e0c=await readFile(_0x11a987,'utf8');if(/^name:\s*kdocs\s*$/m[_0x5714d9(0x12c)](_0x2a8e0c))return!![];}return![];}export const __test__={'hasConfiguredKdocsSkill':hasConfiguredKdocsSkill,'resolveKdocsSkillVersion':resolveKdocsSkillVersion};function findFileByName(_0x4a0d9f,_0x26252d){const _0x16f700=_0x13ecdf;if(!existsSync(_0x4a0d9f))return null;for(const _0x464a9c of readdirSync(_0x4a0d9f,{'withFileTypes':!![]})){const _0x2bf650=join(_0x4a0d9f,_0x464a9c[_0x16f700(0x14d)]);if(_0x464a9c[_0x16f700(0x166)+_0x16f700(0x159)]()){const _0x23f160=findFileByName(_0x2bf650,_0x26252d);if(_0x23f160)return _0x23f160;continue;}if(_0x464a9c[_0x16f700(0x15a)]()&&_0x464a9c['name']===_0x26252d)return _0x2bf650;}return null;}export async function installKdocsCliBinary(_0x2605b3,_0x406969,_0x445f1b={}){const _0x4692d4=_0x13ecdf,_0x3f681a=await resolveKdocsSkillVersion(_0x2605b3),_0x32b3f7=toKdocsCliPlatform(process[_0x4692d4(0x11c)]),_0xceb8d5=toKdocsCliArch(process[_0x4692d4(0x134)]),_0x3c147a=process['platform']===_0x4692d4(0x128)?'kdocs-cl'+_0x4692d4(0x138):_0x4692d4(0x153)+'i',_0x8d9e15=join(_0x406969[_0x4692d4(0x14e)+'WorkingD'+'ir'],_0x4692d4(0x120),_0x4692d4(0x153)+'i'),_0x3e3372=join(_0x8d9e15,_0x3c147a);if(existsSync(_0x3e3372))try{const _0x1c8fec=(await runProcess(_0x3e3372,['version'],{'label':_0x4692d4(0x153)+'i\x20versio'+'n','timeoutMs':0x7530}))[_0x4692d4(0x129)][_0x4692d4(0x158)]();if(_0x1c8fec===_0x3f681a){_0x445f1b[_0x4692d4(0x143)+_0x4692d4(0x14b)]?.[_0x4692d4(0x161)](_0x4692d4(0x153)+_0x4692d4(0x15b)+_0x4692d4(0x136)+_0x4692d4(0x127),{'version':_0x3f681a,'installDir':_0x8d9e15});return;}}catch{}const _0x2552fd=_0x32b3f7==='windows'?_0x4692d4(0x167):'.tar.gz',_0x3337d1=_0x4692d4(0x153)+'i-'+_0x3f681a+'-'+_0x32b3f7+'-'+_0xceb8d5+_0x2552fd,_0xbe01a=join(_0x406969[_0x4692d4(0x156)+'oot'],_0x4692d4(0x12f)),_0x1fadf8=join(_0xbe01a,_0x3337d1),_0x53d12d=join(_0x406969[_0x4692d4(0x156)+_0x4692d4(0x130)],_0x4692d4(0x125)+'li-extra'+_0x4692d4(0x14f)+process[_0x4692d4(0x140)]+'-'+Date[_0x4692d4(0x119)]()),_0x422295=KDOCS_CLI_CDN_BASE+'/v'+_0x3f681a+('/release'+'s/')+_0x3337d1;await mkdir(_0xbe01a,{'recursive':!![]});!existsSync(_0x1fadf8)&&(console['log'](_0x4692d4(0x11b)+_0x4692d4(0x154)+_0x4692d4(0x12a)+_0x4692d4(0x13a)+'g\x20'+_0x422295),await downloadFile(_0x422295,_0x1fadf8));await rm(_0x53d12d,{'recursive':!![],'force':!![]}),await mkdir(_0x53d12d,{'recursive':!![]});_0x1fadf8[_0x4692d4(0x169)](_0x4692d4(0x167))?await runProcess('unzip',['-q',_0x1fadf8,'-d',_0x53d12d],{'label':_0x4692d4(0x110)+_0x3337d1}):await runProcess('tar',['-xzf',_0x1fadf8,'-C',_0x53d12d],{'label':_0x4692d4(0x110)+_0x3337d1});const _0x2832b6=findFileByName(_0x53d12d,_0x3c147a);if(!_0x2832b6)throw new Error('kdocs-cl'+'i\x20binary'+_0x4692d4(0x12d)+'nd\x20in\x20ar'+'chive:\x20'+_0x3337d1);await rm(_0x8d9e15,{'recursive':!![],'force':!![]}),await mkdir(_0x8d9e15,{'recursive':!![]}),await cp(_0x2832b6,_0x3e3372);if(process[_0x4692d4(0x11c)]!==_0x4692d4(0x128))await chmod(_0x3e3372,0x1ed);await writeFile(join(_0x8d9e15,_0x4692d4(0x149)),_0x4692d4(0x114)+_0x4692d4(0x118)+_0x4692d4(0x164),_0x4692d4(0x146)),await rm(_0x53d12d,{'recursive':!![],'force':!![]}),_0x445f1b[_0x4692d4(0x143)+_0x4692d4(0x14b)]?.['info'](_0x4692d4(0x153)+_0x4692d4(0x16e)+'led',{'version':_0x3f681a,'installDir':_0x8d9e15,'binPath':_0x3e3372});}
|
|
1
|
+
const _0x3c4d64=_0x497d;(function(_0x4e5508,_0x5dd27d){const _0x11077c=_0x497d,_0x10c1a0=_0x4e5508();while(!![]){try{const _0x5c2e18=parseInt(_0x11077c(0x1f6))/0x1*(-parseInt(_0x11077c(0x1fb))/0x2)+-parseInt(_0x11077c(0x1b6))/0x3*(-parseInt(_0x11077c(0x1b5))/0x4)+parseInt(_0x11077c(0x1e9))/0x5*(parseInt(_0x11077c(0x1da))/0x6)+parseInt(_0x11077c(0x204))/0x7*(-parseInt(_0x11077c(0x1c5))/0x8)+-parseInt(_0x11077c(0x1b0))/0x9*(-parseInt(_0x11077c(0x1b7))/0xa)+parseInt(_0x11077c(0x1e7))/0xb+-parseInt(_0x11077c(0x1ad))/0xc*(parseInt(_0x11077c(0x20f))/0xd);if(_0x5c2e18===_0x5dd27d)break;else _0x10c1a0['push'](_0x10c1a0['shift']());}catch(_0x5908b7){_0x10c1a0['push'](_0x10c1a0['shift']());}}}(_0x2691,0xa0e47));import{existsSync,readdirSync}from'node:fs';import{createWriteStream}from'node:fs';function _0x2691(){const _0x439ab2=['LocalSki','led','119DdOjWQ','headers','m\x20OpenCl','statusCo','re\x22\x20to\x20r','pid','pipe','log','me:\x20','me.','SKILL.md','87841IvZSJo','now','skillhub','catch','tar','ory','llPaths','ignore','Unable\x20t','win32','1860SbKaSl','toString','chive:\x20','9927144fqEghX','e\x20kdocs\x20','.cache','node:chi','ell-runt','3151276WvMxEk','3oxnmmS','10HTfjBo','download','data','oot','location','utf8','tools','/release','with\x20cod','openclaw','isFile','SIGTERM','info','i\x20versio','381272dQMAas','WorkingD','ll\x20prepa','Bundled\x20','platform','extract\x20','kdocs-cl','runtimeR','join','isDirect','href','trim','kill','push','endsWith','i\x20instal','resolved','map','windows','version','x64','3594dGQDnH','ebuild\x20t','includes','match','stderr','label','i\x20binary','\x20failed\x20','skill\x20ve','timeoutM','runtimeL','time]\x20do','arch','3916594WEUXFK','then','9305pFWnzX','name','ogger','.\x20Run\x20\x22w','rsion\x20fr','li-extra','i\x20alread','hell:run','replace','om\x20','i.exe','https://','amd64','2195cUqzSR','filter','resume','test','-xzf','770GfHWOq','stdout','sing\x20fro','.kdocs-c','ld_proce','ime\x0a','.zip'];_0x2691=function(){return _0x439ab2;};return _0x2691();}import{chmod,cp,mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{get}from'node:https';import{pipeline}from'node:stream/promises';const KDOCS_CLI_CDN_BASE=(process.env.KDOCS_CLI_CDN??_0x3c4d64(0x1f4)+'wpsai.wp'+'scdn.cn/'+_0x3c4d64(0x1a5)+'/pro')[_0x3c4d64(0x1f1)](/\/$/,''),DOWNLOAD_TIMEOUT_MS=0xf*0x3c*0x3e8;async function runProcess(_0x5b1af2,_0x145d9f,_0x1d700b={}){const _0xfb639d=_0x3c4d64,{spawn:_0x5e4917}=await import(_0xfb639d(0x1b3)+_0xfb639d(0x1ff)+'ss'),_0x40d5ea=_0x1d700b[_0xfb639d(0x1df)]||[_0x5b1af2,..._0x145d9f][_0xfb639d(0x1cd)]('\x20'),_0x40dcd4=_0x1d700b[_0xfb639d(0x1e3)+'s']??DOWNLOAD_TIMEOUT_MS;return await new Promise((_0x20d17a,_0x50ba1c)=>{const _0x9bcb96=_0xfb639d,_0x2d1713=_0x5e4917(_0x5b1af2,_0x145d9f,{'cwd':_0x1d700b['cwd'],'env':_0x1d700b['env'],'stdio':[_0x9bcb96(0x1aa),_0x9bcb96(0x20a),_0x9bcb96(0x20a)]});let _0x46f4b4='',_0x2dfae3='';const _0x1bbb8b=setTimeout(()=>{const _0x5b1c74=_0x9bcb96;_0x2d1713[_0x5b1c74(0x1d1)](_0x5b1c74(0x1c2)),_0x50ba1c(new Error(_0x40d5ea+('\x20timed\x20o'+'ut\x20after'+'\x20')+_0x40dcd4+'ms'));},_0x40dcd4);_0x2d1713[_0x9bcb96(0x1fc)]['on']('data',_0x5c0599=>{const _0x4d899c=_0x9bcb96;_0x46f4b4+=_0x5c0599[_0x4d899c(0x1ae)]();}),_0x2d1713[_0x9bcb96(0x1de)]['on'](_0x9bcb96(0x1b9),_0x2de150=>{_0x2dfae3+=_0x2de150['toString']();}),_0x2d1713['on']('error',_0x1b4490=>{clearTimeout(_0x1bbb8b),_0x50ba1c(_0x1b4490);}),_0x2d1713['on']('close',_0x52993c=>{const _0x4a4fe8=_0x9bcb96;clearTimeout(_0x1bbb8b);if(_0x52993c===0x0)_0x20d17a({'stdout':_0x46f4b4,'stderr':_0x2dfae3,'code':_0x52993c});else _0x50ba1c(new Error(_0x40d5ea+('\x20failed\x20'+_0x4a4fe8(0x1bf)+'e\x20')+_0x52993c+':\x20'+(_0x2dfae3||_0x46f4b4)));});});}async function downloadFile(_0x1ad7dc,_0x1a00f7){await mkdir(dirname(_0x1a00f7),{'recursive':!![]});const _0xede3a7=await new Promise((_0x2a04db,_0x50cd71)=>{const _0x427290=get(_0x1ad7dc,_0x181367=>{const _0x29c102=_0x497d;if([0x12d,0x12e,0x12f,0x133,0x134][_0x29c102(0x1dc)](_0x181367[_0x29c102(0x207)+'de']||0x0)&&_0x181367[_0x29c102(0x205)]['location']){_0x181367[_0x29c102(0x1f8)](),downloadFile(new URL(_0x181367[_0x29c102(0x205)][_0x29c102(0x1bb)],_0x1ad7dc)[_0x29c102(0x1cf)],_0x1a00f7)[_0x29c102(0x1e8)](()=>_0x2a04db(null))[_0x29c102(0x1a6)](_0x50cd71);return;}if((_0x181367['statusCo'+'de']||0x0)>=0x190){_0x181367[_0x29c102(0x1f8)](),_0x50cd71(new Error(_0x29c102(0x1b8)+_0x29c102(0x1e1)+_0x181367['statusCo'+'de']+':\x20'+_0x1ad7dc));return;}_0x2a04db(_0x181367);});_0x427290['on']('error',_0x50cd71);});if(!_0xede3a7)return;await pipeline(_0xede3a7,createWriteStream(_0x1a00f7));}async function findRuntimeKdocsCliBin(_0x58c9c8){const _0xb54fc0=_0x3c4d64,_0x307276=join(_0x58c9c8[_0xb54fc0(0x1c0)+'WorkingD'+'ir'],_0xb54fc0(0x1bd),_0xb54fc0(0x1cb)+'i'),_0x2e2fc1=join(_0x307276,process[_0xb54fc0(0x1c9)]===_0xb54fc0(0x1ac)?'kdocs-cl'+_0xb54fc0(0x1f3):_0xb54fc0(0x1cb)+'i');return{'installDir':_0x307276,'binPath':existsSync(_0x2e2fc1)?_0x2e2fc1:null};}export async function resolveRuntimeKdocsCliCommand(_0x293ae0){const _0x3fab35=_0x3c4d64,{installDir:_0x304522,binPath:_0x11c5d3}=await findRuntimeKdocsCliBin(_0x293ae0);if(!_0x11c5d3||!existsSync(_0x11c5d3))throw new Error(_0x3fab35(0x1c8)+_0x3fab35(0x1cb)+'i\x20is\x20mis'+_0x3fab35(0x1fd)+_0x3fab35(0x206)+'aw\x20runti'+_0x3fab35(0x20c)+_0x304522+(_0x3fab35(0x1ec)+'ujie-she'+_0x3fab35(0x1c7)+_0x3fab35(0x208)+_0x3fab35(0x1db)+'he\x20runti'+_0x3fab35(0x20d)));return{'executablePath':_0x11c5d3,'installDir':_0x304522};}function _0x497d(_0x4f018c,_0x61398c){_0x4f018c=_0x4f018c-0x1a4;const _0x269169=_0x2691();let _0x497d7b=_0x269169[_0x4f018c];return _0x497d7b;}function toKdocsCliPlatform(_0x3b6ae3){const _0x1c415d=_0x3c4d64;if(_0x3b6ae3===_0x1c415d(0x1ac))return'windows';return _0x3b6ae3;}function toKdocsCliArch(_0x6c2f5e){const _0x2ca236=_0x3c4d64;if(_0x6c2f5e===_0x2ca236(0x1d9))return _0x2ca236(0x1f5);return _0x6c2f5e;}async function resolveKdocsSkillVersion(_0x1c749c){const _0x32e833=_0x3c4d64,_0x1ccaef=_0x1c749c[_0x32e833(0x1c0)][_0x32e833(0x1d5)+_0x32e833(0x202)+_0x32e833(0x1a9)]??[],_0x1a4d84=[];for(const _0x4a4a52 of _0x1ccaef){if(!existsSync(_0x4a4a52))continue;_0x1a4d84[_0x32e833(0x1d2)](join(_0x4a4a52,_0x32e833(0x20e))),_0x1a4d84[_0x32e833(0x1d2)](...(await readdir(_0x4a4a52,{'withFileTypes':!![]}))[_0x32e833(0x1f7)](_0x154394=>_0x154394[_0x32e833(0x1ce)+_0x32e833(0x1a8)]())[_0x32e833(0x1d6)](_0x3ef132=>join(_0x4a4a52,_0x3ef132[_0x32e833(0x1ea)],_0x32e833(0x20e))));}for(const _0x7822dd of _0x1a4d84){if(!existsSync(_0x7822dd))continue;const _0x35b6cc=await readFile(_0x7822dd,'utf8');if(!/^name:\s*kdocs\s*$/m['test'](_0x35b6cc))continue;const _0x43e86f=_0x35b6cc[_0x32e833(0x1dd)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x43e86f?.[0x1])return _0x43e86f[0x1];}throw new Error(_0x32e833(0x1ab)+'o\x20resolv'+_0x32e833(0x1b1)+_0x32e833(0x1e2)+_0x32e833(0x1ed)+_0x32e833(0x1f2)+_0x1ccaef[_0x32e833(0x1cd)](',\x20'));}export async function hasConfiguredKdocsSkill(_0x54c589){const _0x3eefdb=_0x3c4d64,_0x5bb14c=_0x54c589[_0x3eefdb(0x1c0)][_0x3eefdb(0x1d5)+_0x3eefdb(0x202)+_0x3eefdb(0x1a9)]??[],_0x2c428f=[];for(const _0x17ba0a of _0x5bb14c){if(!existsSync(_0x17ba0a))continue;_0x2c428f[_0x3eefdb(0x1d2)](join(_0x17ba0a,_0x3eefdb(0x20e))),_0x2c428f['push'](...(await readdir(_0x17ba0a,{'withFileTypes':!![]}))[_0x3eefdb(0x1f7)](_0x2b5d6c=>_0x2b5d6c[_0x3eefdb(0x1ce)+_0x3eefdb(0x1a8)]())['map'](_0x285fef=>join(_0x17ba0a,_0x285fef[_0x3eefdb(0x1ea)],'SKILL.md')));}for(const _0x48e587 of _0x2c428f){if(!existsSync(_0x48e587))continue;const _0x1d2a68=await readFile(_0x48e587,'utf8');if(/^name:\s*kdocs\s*$/m[_0x3eefdb(0x1f9)](_0x1d2a68))return!![];}return![];}export const __test__={'hasConfiguredKdocsSkill':hasConfiguredKdocsSkill,'resolveKdocsSkillVersion':resolveKdocsSkillVersion};function findFileByName(_0xea0c94,_0x5b7985){const _0x17fca2=_0x3c4d64;if(!existsSync(_0xea0c94))return null;for(const _0x3d9333 of readdirSync(_0xea0c94,{'withFileTypes':!![]})){const _0x1f1db3=join(_0xea0c94,_0x3d9333[_0x17fca2(0x1ea)]);if(_0x3d9333[_0x17fca2(0x1ce)+_0x17fca2(0x1a8)]()){const _0x3864c0=findFileByName(_0x1f1db3,_0x5b7985);if(_0x3864c0)return _0x3864c0;continue;}if(_0x3d9333[_0x17fca2(0x1c1)]()&&_0x3d9333[_0x17fca2(0x1ea)]===_0x5b7985)return _0x1f1db3;}return null;}export async function installKdocsCliBinary(_0x369b86,_0x28d074,_0x10cae1={}){const _0x5a238d=_0x3c4d64,_0x542856=await resolveKdocsSkillVersion(_0x369b86),_0x5b3ec4=toKdocsCliPlatform(process[_0x5a238d(0x1c9)]),_0x2f2b08=toKdocsCliArch(process[_0x5a238d(0x1e6)]),_0x4192bc=process[_0x5a238d(0x1c9)]==='win32'?_0x5a238d(0x1cb)+_0x5a238d(0x1f3):_0x5a238d(0x1cb)+'i',_0x86a156=join(_0x28d074['openclaw'+_0x5a238d(0x1c6)+'ir'],'tools',_0x5a238d(0x1cb)+'i'),_0xf5e3b8=join(_0x86a156,_0x4192bc);if(existsSync(_0xf5e3b8))try{const _0x14b3b7=(await runProcess(_0xf5e3b8,[_0x5a238d(0x1d8)],{'label':_0x5a238d(0x1cb)+_0x5a238d(0x1c4)+'n','timeoutMs':0x7530}))[_0x5a238d(0x1fc)][_0x5a238d(0x1d0)]();if(_0x14b3b7===_0x542856){_0x10cae1['runtimeL'+_0x5a238d(0x1eb)]?.[_0x5a238d(0x1c3)](_0x5a238d(0x1cb)+_0x5a238d(0x1ef)+'y\x20instal'+_0x5a238d(0x203),{'version':_0x542856,'installDir':_0x86a156});return;}}catch{}const _0x508cd9=_0x5b3ec4===_0x5a238d(0x1d7)?'.zip':'.tar.gz',_0x2362c9=_0x5a238d(0x1cb)+'i-'+_0x542856+'-'+_0x5b3ec4+'-'+_0x2f2b08+_0x508cd9,_0x52e829=join(_0x28d074[_0x5a238d(0x1cc)+'oot'],_0x5a238d(0x1b2)),_0x101890=join(_0x52e829,_0x2362c9),_0x1b77b5=join(_0x28d074[_0x5a238d(0x1cc)+_0x5a238d(0x1ba)],_0x5a238d(0x1fe)+_0x5a238d(0x1ee)+'ct-'+process[_0x5a238d(0x209)]+'-'+Date[_0x5a238d(0x1a4)]()),_0x364ee4=KDOCS_CLI_CDN_BASE+'/v'+_0x542856+(_0x5a238d(0x1be)+'s/')+_0x2362c9;await mkdir(_0x52e829,{'recursive':!![]});!existsSync(_0x101890)&&(console[_0x5a238d(0x20b)]('[wujie-s'+_0x5a238d(0x1f0)+_0x5a238d(0x1e5)+'wnloadin'+'g\x20'+_0x364ee4),await downloadFile(_0x364ee4,_0x101890));await rm(_0x1b77b5,{'recursive':!![],'force':!![]}),await mkdir(_0x1b77b5,{'recursive':!![]});_0x101890[_0x5a238d(0x1d3)](_0x5a238d(0x201))?await runProcess('unzip',['-q',_0x101890,'-d',_0x1b77b5],{'label':_0x5a238d(0x1ca)+_0x2362c9}):await runProcess(_0x5a238d(0x1a7),[_0x5a238d(0x1fa),_0x101890,'-C',_0x1b77b5],{'label':_0x5a238d(0x1ca)+_0x2362c9});const _0x2acb26=findFileByName(_0x1b77b5,_0x4192bc);if(!_0x2acb26)throw new Error(_0x5a238d(0x1cb)+_0x5a238d(0x1e0)+'\x20not\x20fou'+'nd\x20in\x20ar'+_0x5a238d(0x1af)+_0x2362c9);await rm(_0x86a156,{'recursive':!![],'force':!![]}),await mkdir(_0x86a156,{'recursive':!![]}),await cp(_0x2acb26,_0xf5e3b8);if(process[_0x5a238d(0x1c9)]!=='win32')await chmod(_0xf5e3b8,0x1ed);await writeFile(join(_0x86a156,'.source'),'wujie-sh'+_0x5a238d(0x1b4)+_0x5a238d(0x200),_0x5a238d(0x1bc)),await rm(_0x1b77b5,{'recursive':!![],'force':!![]}),_0x10cae1[_0x5a238d(0x1e4)+_0x5a238d(0x1eb)]?.['info'](_0x5a238d(0x1cb)+_0x5a238d(0x1d4)+_0x5a238d(0x203),{'version':_0x542856,'installDir':_0x86a156,'binPath':_0xf5e3b8});}
|