@wujie-shell/core 3.0.2 → 4.0.1
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(_0x39fe4e,_0x240e4b){const _0x34a761=_0x163c,_0x1e4a59=_0x39fe4e();while(!![]){try{const _0x2c65e6=-parseInt(_0x34a761(0x2aa))/0x1*(-parseInt(_0x34a761(0x2f6))/0x2)+-parseInt(_0x34a761(0x2f5))/0x3+-parseInt(_0x34a761(0x2c6))/0x4*(parseInt(_0x34a761(0x10c))/0x5)+-parseInt(_0x34a761(0x133))/0x6+-parseInt(_0x34a761(0x28c))/0x7*(parseInt(_0x34a761(0x1ec))/0x8)+-parseInt(_0x34a761(0x28b))/0x9+parseInt(_0x34a761(0x11a))/0xa*(parseInt(_0x34a761(0x203))/0xb);if(_0x2c65e6===_0x240e4b)break;else _0x1e4a59['push'](_0x1e4a59['shift']());}catch(_0x375cea){_0x1e4a59['push'](_0x1e4a59['shift']());}}}(_0x5d43,0x4fb57));import{spawn}from'node:child_process';import{randomUUID}from'node:crypto';function _0x5d43(){const _0x5f1c90=['用户已取消飞书机','HTTP_PRO','_doc','utf8','rnal','飞书\x20CLI\x20执','n\x20respon','tateDir','腾讯企业邮箱','annel\x20co','ector','kdocs','expiresA','openExte','client_s','回应用创建页面或','--force-','I\x20sessio','ternally','resolve','\x20in\x20begi','get','ecret\x20应用','QQ机器人\x20Ap','Entry','金山文档登录启动','openclaw','appTimer','max','lastInde','lient','startedA','search','gistrati','slice','tration\x20','已扫描','map','正在检查飞书\x20C','login\x20--','init','飞书\x20CLI\x20授','scanned','r\x20\x22','ctor\x20plu','ocs-cli\x20','smtp.qq.','channelI','d\x20is\x20req','et\x20auth.','pollInte','\x20chars)','mail\x20con','persistC','\x20deleted','SCANNED','pServer','li_user','se.','Kdocs\x20CL','163\x20邮箱','\x22\x20not\x20fo','ion_url','304ojwCyy','error','keys','exmail','d\x20auth','授权状态','n\x20not\x20fo','auth','eCode','plugins','的新版客户端','utable','tus','mail','netease\x20','登录成功','ired','tion_url','share','begin','\x20channel','kdocs\x20sk','_id','4499TBSEzY','delete','igWriteH','setSkill','skills','lugin\x20de','status','wecom','Spawn\x20er','dated','streamin','xOf','权状态不符合用户','飞书文档\x20CLI','client_i','\x20updated','url','onFailur','headers','push','fresh','ion\x20not\x20','streamab',',sheets,','fig','enclaw\x20c','nodeExec','complete','ase','--scope','nfig\x20del','clear','supporte','process','baseUrl','rvalMs','values','zationCo','pID\x20is\x20r','1.0.0','环境不支持创建\x20','operty','rlencode','deviceCo','飞书用户身份授权','name','wechat-l','authStat','scope_au','find','Error','重新生成','ion_flow','igRaw','<empty>','export','文档\x20Strea','ID\x20is\x20re','飞书\x20CLI\x20应','timer','\x20config\x20','ll\x20conne','eamableH','open_id','正在打开飞书用户','verifyTi','Feishu\x20d','wujie.ai','http:','nConfig','扫码成功','disabled','Channel\x20','请输入有效的钉钉','setPlugi','toString','assign','kdocs-cl','leted','ion_uri_','/page/sc','tencent_','exmail\x20c','isArray','ing','uired','markConf','ent\x20does','illEntry','is\x20requi','phase','stderr','device_c','i_comple','飞书应用创建失败','entry','飞书应用创建超时','imap.exm','update','error_de','.opencla',':authori','netease_','wecom\x20ch','CLOSED','allowFro','appExpir','join','imap.163','企微助手\x20Sec','egistrat','失,无法初始化','\x20not\x20sup','权状态验证失败','\x20device_','ted','用绑定失败','cliAppId','expired','pSecret\x20','parse','deleteCh','annelCon','required','安装包含微信插件','Local\x20lo','slow_dow','Invalid\x20','请在飞书开放平台','now','end','otRaw','.json','once','oc\x20conne','ode','1421901oQamxY','107205RuZJNP','ation_ur','oc\x20CLI\x20s','飞书\x20CLI\x20未','tion_uri','secret','https_pr','1/app/re','gin\x20save','eted','channels','accountN','onSucces','quired','id\x20is\x20re','e_code:\x20','stdout','spawn','read','feishu-d','onfig\x20up','验证失败','kill','金山文档','includes','山文档授权','allow','_complet','Failed','token','333BwaoMl','usTimer','飞书应用已创建,','valid','docs\x20ski','无需重复连接',':user','正在验证金山文档','dAt','企微助手','flow_id','腾讯文档\x20Key','response','创建失败','managedB','smtp.163','setChann','executab','logged\x20i','Missing\x20','wechat-s','connecte','lark-cli','飞书开放平台应用','ll\x20updat','docs-cli','entries','spawn\x20op','9228bSDqCb','errorMes','latest','plugin','wechat','Agent','--no-wai','feishu_d','d_auth_m','led','ror:\x20','gin\x20dele','deleted','ice_code','open','飞书机器人\x20Ap','length','trim','port\x20cli','le-http','config','当前客户端未内置','scriptio','Connecto','with\x20cod','exists','identity','object','ion/x-ww',',请重新连接','icy','interval','mer','ethods','toLowerC','stdin','string','onfig\x20de','\x20is\x20requ','user','ntervalM','tokenSta','apiKey','com','test','imap.qq.','mableHtt','1614369kCNTmv','106okbTvB','create','nfig\x20upd','poll','needs_re','footer','appPollC','权状态验证超时','启动成功','client','ALL_PROX','account','clientSe','ill\x20enab','import','Scan\x20suc','check','35WglVfD','cliAppSe','ill\x20conn','HTTPS_PR','authoriz','飞书\x20CLI\x20连','verify','qqbot','bind','cliHostC','器人绑定','wechat-q','applicat','accounts','50370EtEVSV','writeCon','QQ\x20邮箱','ot\x20found','feishu','nector\x20p','飞书绑定失败:','projectR','indexOf','二维码已过期,请','QQ助手','availabl','Feishu\x20r','feishu\x20d','户授权失败','.com','function','all_prox','QR_READY','support@','catch','ail.qq.c','s\x20requir','\x20doc\x20mcp','cret','2742384VefhsA','set','toISOStr','tatus','ready','botId','cret-std','doc_conn','data','own,wiki','hu\x20regis','match','HTTP\x20','login','ession\x20n','tencent\x20','appSecre','hannel\x20c','p\x20URL','scriptPa','pluginId','nding','ession\x20i','equired','pending',',请先连接','ogin','readConf','thorizat','--app-id','Data','...(','code','appPollI','appId','qq\x20mail\x20','connecto','groupPol','n\x20update','message','ecret','dingding','full','igSnapsh','onfig','qq_mail','r-log','ationCod','appDevic','完成应用创建','ationUri','feishu_c','授权码\x20is\x20r','deleteSk','ated','output','dingtalk','e\x20or\x20dev','ope-auth','金山文档尚未授权','sage','purpose','oot','Bin','POST','hint','feishu\x20c','正在进入用户授权','lePath','r\x20plugin','usStarte','deleteMc','\x20plugin\x20','groupAll','elConfig','filter','env:\x20','sessionI','金山文档已连接','请在浏览器完成金','user_inf','resolveS','失败,请确认\x20k','boolean','esAt','ation_pe','ion\x20sess','ctor\x20del','\x20或\x20devic','replace','i:keycha','ERROR','企微助手\x20Bot','飞书用户身份','行失败','接失败','prototyp','close','then','verifica','等待飞书用户授权','onMode','onfigPat','飞书开放平台未返','transpor','call','飞书绑定失败','env','und','identiti','enabled','WujieAI','docs','CLI\x20用户身份','n\x20id\x20is\x20','allowlis','red','rver','ame','\x20已安装','微信连接插件,请','connecti'];_0x5d43=function(){return _0x5f1c90;};return _0x5d43();}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(_0x5a8f28){const _0x3d0809=_0x163c;return typeof _0x5a8f28==='string'?_0x5a8f28[_0x3d0809(0x2d7)]():'';}function findDingtalkDocMcpServer(_0x307d7b){const _0x583dda=_0x163c,_0x576641=asRecord(_0x307d7b[DINGTALK_DOC_MCP_SERVER_NAME]);if(Object[_0x583dda(0x1ee)](_0x576641)[_0x583dda(0x2d6)]>0x0)return _0x576641;for(const [_0x699cc6,_0x54cfcc]of Object[_0x583dda(0x2c4)](_0x307d7b)){const _0x25fccc=asRecord(_0x54cfcc),_0x3a8c0e=getTrimmedString(_0x699cc6)[_0x583dda(0x2e8)+'ase'](),_0x164621=getTrimmedString(_0x25fccc[_0x583dda(0x213)])[_0x583dda(0x2e8)+_0x583dda(0x21f)]();if(_0x3a8c0e['includes'](_0x583dda(0x16b))||_0x3a8c0e[_0x583dda(0x2a4)](_0x583dda(0x15c))||_0x3a8c0e[_0x583dda(0x2a4)]('钉钉')||_0x164621['includes']('dingtalk')||_0x164621[_0x583dda(0x2a4)](_0x583dda(0x15c)))return _0x25fccc;}return{};}function createFeishuRegistrationClient(){const _0x26d72b=_0x163c,_0x586c05=FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV];if(!_0x586c05)throw new Error('Unsuppor'+'ted\x20Feis'+_0x26d72b(0x13d)+_0x26d72b(0x1d0)+_0x26d72b(0x17f)+DEFAULT_FEISHU_REGISTRATION_ENV);return{'baseUrl':_0x586c05,'headers':{'Content-Type':_0x26d72b(0x118)+_0x26d72b(0x2e2)+'w-form-u'+_0x26d72b(0x22d)+'d'},'timeoutMs':DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS};}async function postFeishuRegistration(_0x246c45,_0x3ca461){const _0x333ed4=_0x163c,_0x408888=await fetch(_0x246c45[_0x333ed4(0x225)]+('/oauth/v'+_0x333ed4(0x293)+_0x333ed4(0x1ce)+'on'),{'method':_0x333ed4(0x173),'headers':_0x246c45[_0x333ed4(0x215)],'body':new URLSearchParams(_0x3ca461)[_0x333ed4(0x24e)](),'signal':AbortSignal['timeout'](_0x246c45['timeoutM'+'s'])}),_0x3463b2=await _0x408888['json']()[_0x333ed4(0x12e)](()=>({}));if(!_0x408888['ok']){const _0x54344a=new Error(_0x333ed4(0x13f)+_0x408888[_0x333ed4(0x209)]);_0x54344a[_0x333ed4(0x2b6)+_0x333ed4(0x151)]=_0x3463b2;throw _0x54344a;}return asRecord(_0x3463b2);}async function initFeishuRegistration(_0x3f0138){const _0x139606=_0x163c;return postFeishuRegistration(_0x3f0138,{'action':_0x139606(0x1d5)});}async function beginFeishuRegistration(_0x2de3d8){const _0x53ff73=_0x163c;return postFeishuRegistration(_0x2de3d8,{'action':_0x53ff73(0x1ff),'archetype':'Personal'+_0x53ff73(0x2cb),'auth_method':_0x53ff73(0x1bb)+_0x53ff73(0x15b),'request_user_info':_0x53ff73(0x242)});}async function pollFeishuRegistration(_0x55e3a3,_0x2d6964){const _0x539796=_0x163c;try{return await postFeishuRegistration(_0x55e3a3,{'action':_0x539796(0x2f9),'device_code':_0x2d6964});}catch(_0x310186){if(_0x310186?.[_0x539796(0x2b6)+_0x539796(0x151)]&&typeof _0x310186['response'+_0x539796(0x151)]===_0x539796(0x2e1))return asRecord(_0x310186['response'+'Data']);throw _0x310186;}}function extractFeishuRegistrationAuthorizationUri(_0x2ac1b6){const _0x9833bb=_0x163c,_0xf16870=getTrimmedString(_0x2ac1b6[_0x9833bb(0x110)+_0x9833bb(0x28d)+_0x9833bb(0x260)+'te'])||getTrimmedString(_0x2ac1b6[_0x9833bb(0x110)+_0x9833bb(0x28d)+'i'])||getTrimmedString(_0x2ac1b6['scope_au'+_0x9833bb(0x14f)+_0x9833bb(0x252)+'complete'])||getTrimmedString(_0x2ac1b6[_0x9833bb(0x233)+_0x9833bb(0x14f)+'ion_uri'])||getTrimmedString(_0x2ac1b6[_0x9833bb(0x233)+_0x9833bb(0x14f)+_0x9833bb(0x1eb)])||getTrimmedString(_0x2ac1b6['authoriz'+'ation_ur'+'l']);if(_0xf16870)return _0xf16870;const _0x482975=getTrimmedString(_0x2ac1b6[_0x9833bb(0x2b4)])||getTrimmedString(_0x2ac1b6[_0x9833bb(0x233)+_0x9833bb(0x14f)+_0x9833bb(0x237)+_0x9833bb(0x202)]);return _0x482975?FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV]+(_0x9833bb(0x253)+_0x9833bb(0x16d)+'orizatio'+'n?flow_i'+'d=')+encodeURIComponent(_0x482975):null;}function serializeFeishuRegistrationSession(_0x53b661){const _0x28f4b8=_0x163c;return{'sessionId':_0x53b661[_0x28f4b8(0x180)+'d'],'verificationUriComplete':_0x53b661[_0x28f4b8(0x196)+'tionUriC'+'omplete'],'expiresAt':new Date(_0x53b661['expiresA'+'t'])[_0x28f4b8(0x135)+_0x28f4b8(0x257)](),'pollIntervalMs':_0x53b661[_0x28f4b8(0x1df)+_0x28f4b8(0x226)],'status':_0x53b661['status'],'errorMessage':_0x53b661[_0x28f4b8(0x2c7)+_0x28f4b8(0x16f)],'purpose':_0x53b661['purpose'],'authorizationUri':_0x53b661[_0x28f4b8(0x110)+_0x28f4b8(0x165)]};}function extractFirstUrl(_0x38f897){const _0x27c8a=_0x163c,_0x395793=_0x38f897[_0x27c8a(0x13e)](/https?:\/\/[^\s"'<>]+/i);return _0x395793?_0x395793[0x0]:null;}function isKdocsAuthStatusReady(_0x51bc5){const _0x3cd35c=_0x163c,_0x4e1902=_0x51bc5[_0x3cd35c(0x2e8)+_0x3cd35c(0x21f)]();if(/not\s+login|not\s+logged|unauth|未登录|未认证|未授权|失败/['test'](_0x4e1902))return![];return/login|logged|auth|valid|success|已登录|已认证|已授权|有效|成功/[_0x3cd35c(0x2f2)](_0x4e1902);}function parseFeishuDocCliJson(_0x5c7264){const _0x8b242b=_0x163c,_0x32535d=_0x5c7264[_0x8b242b(0x2d7)]();if(!_0x32535d)return{};try{return asRecord(JSON[_0x8b242b(0x27b)](_0x32535d));}catch{for(let _0x56fcf6=_0x32535d[_0x8b242b(0x122)]('{');_0x56fcf6>=0x0;_0x56fcf6=_0x32535d[_0x8b242b(0x122)]('{',_0x56fcf6+0x1)){for(let _0x10976b=_0x32535d[_0x8b242b(0x1ca)+_0x8b242b(0x20e)]('}');_0x10976b>_0x56fcf6;_0x10976b=_0x32535d['lastInde'+'xOf']('}',_0x10976b-0x1)){try{return asRecord(JSON['parse'](_0x32535d['slice'](_0x56fcf6,_0x10976b+0x1)));}catch{}}}return{};}}function summarizeCliOutput(_0x358c54){const _0x1bd45c=_0x163c,_0x5e9ce=_0x358c54['trim']();if(!_0x5e9ce)return _0x1bd45c(0x239);return _0x5e9ce[_0x1bd45c(0x2d6)]>0x320?_0x5e9ce[_0x1bd45c(0x1cf)](0x0,0x320)+_0x1bd45c(0x152)+_0x5e9ce['length']+_0x1bd45c(0x1e0):_0x5e9ce;}function extractFeishuDocCliError(_0x4f192f,_0x179a6b){const _0xc9c14f=_0x163c,_0x424ec0=parseFeishuDocCliJson(_0x4f192f),_0x24c00a=asRecord(_0x424ec0['error']),_0x2f3728=getTrimmedString(_0x24c00a[_0xc9c14f(0x15a)]),_0x4eff8b=getTrimmedString(_0x24c00a[_0xc9c14f(0x174)]);if(_0x2f3728&&_0x4eff8b)return _0x2f3728+'\x0a'+_0x4eff8b;if(_0x2f3728)return _0x2f3728;return _0x4f192f[_0xc9c14f(0x2d7)]()||_0x179a6b;}function getFeishuDocCliFailureMessage(_0x7136cb,_0x7e5dd4,_0x127207){const _0x6be16b=_0x163c,_0x2126c8=_0x7e5dd4[_0x6be16b(0x2d7)]()['split']('\x0a')[_0x6be16b(0x1cf)](-0x8)['join']('\x0a')[_0x6be16b(0x2d7)](),_0x1d5301=_0x7136cb==='create'?_0x6be16b(0x2c1)+_0x6be16b(0x2b7):_0x7136cb===_0x6be16b(0x114)?_0x6be16b(0x23d)+_0x6be16b(0x277):_0x7136cb===_0x6be16b(0x1f3)?'飞书\x20CLI\x20用'+_0x6be16b(0x128):_0x6be16b(0x1d6)+_0x6be16b(0x274);return _0x2126c8?_0x1d5301+':\x20'+_0x2126c8:_0x1d5301+':\x20'+_0x127207;}function ensureFeishuDocCliUserStatus(_0x329b82){const _0x506ddb=_0x163c,_0x871e2e=parseFeishuDocCliJson(_0x329b82),_0x462b34=asRecord(_0x871e2e[_0x506ddb(0x1a0)+'es']),_0x144145=asRecord(_0x462b34[_0x506ddb(0x2ed)]),_0x595c3b=getTrimmedString(_0x871e2e[_0x506ddb(0x2e0)]),_0x52b68b=getTrimmedString(_0x871e2e[_0x506ddb(0x2ef)+_0x506ddb(0x1f8)])||getTrimmedString(_0x144145[_0x506ddb(0x2ef)+'tus']),_0x11e64=getTrimmedString(_0x144145[_0x506ddb(0x209)]),_0x26876a=_0x144145[_0x506ddb(0x125)+'e']===!![];if(_0x595c3b!==_0x506ddb(0x2ed)||_0x11e64&&_0x11e64!==_0x506ddb(0x137)||Object[_0x506ddb(0x1ee)](_0x144145)['length']>0x0&&!_0x26876a||_0x52b68b!==_0x506ddb(0x2ad)&&_0x52b68b!==_0x506ddb(0x2fa)+_0x506ddb(0x217))throw new Error('飞书\x20CLI\x20授'+_0x506ddb(0x20f)+'身份要求:\x20'+_0x329b82[_0x506ddb(0x2d7)]());}function createKdocsCliStatus(_0x38985d){const _0x308a4d=_0x163c;return{'sessionId':_0x38985d[_0x308a4d(0x180)+'d'],'status':_0x38985d[_0x308a4d(0x209)],'phase':_0x38985d[_0x308a4d(0x25d)],'url':_0x38985d[_0x308a4d(0x213)],'message':_0x38985d[_0x308a4d(0x15a)],'errorMessage':_0x38985d[_0x308a4d(0x2c7)+'sage']};}function _0x163c(_0x19e763,_0x457162){_0x19e763=_0x19e763-0x106;const _0x5d43b1=_0x5d43();let _0x163c7e=_0x5d43b1[_0x19e763];return _0x163c7e;}function createFeishuDocCliStatus(_0x57e9bd){const _0x117f99=_0x163c;return{'sessionId':_0x57e9bd['sessionI'+'d'],'status':_0x57e9bd[_0x117f99(0x209)],'phase':_0x57e9bd[_0x117f99(0x25d)],'url':_0x57e9bd[_0x117f99(0x213)],'message':_0x57e9bd[_0x117f99(0x15a)],'errorMessage':_0x57e9bd[_0x117f99(0x2c7)+_0x117f99(0x16f)]};}export function createConnectorController({shellConfig:_0x56b47f,configController:_0x25b596,broadcast:_0x4df633,shell:_0x5658fc,getRuntimeSpawnContext:_0x339c50,openClawConfigHandlers:openClawConfigHandlers={},resolveRuntimeKdocsCliCommand:_0x22cd09,resolveRuntimeLarkCliCommand:_0xb3cc5f}){const _0x5b0699=_0x163c,_0x52a7a1=new Map(),_0x15d7f3=new Map(),_0x49c39e=new Map();let _0x81d817=null;const _0x4b13cb=()=>_0x25b596['readConf'+_0x5b0699(0x238)]();async function _0x59ffb5(_0x4179ac,_0x12eb32){const _0x484287=_0x5b0699;if(typeof openClawConfigHandlers[_0x484287(0x265)]===_0x484287(0x12a))return openClawConfigHandlers['update'](_0xb479cf=>{const _0x2594bd=_0x484287;for(const _0x3391ad of Object[_0x2594bd(0x1ee)](_0xb479cf)){!Object[_0x2594bd(0x193)+'e']['hasOwnPr'+_0x2594bd(0x22c)][_0x2594bd(0x19c)](_0x4179ac,_0x3391ad)&&delete _0xb479cf[_0x3391ad];}Object[_0x2594bd(0x24f)](_0xb479cf,_0x4179ac);},_0x12eb32);return typeof _0x25b596[_0x484287(0x1e2)+'onfig']===_0x484287(0x12a)?await _0x25b596[_0x484287(0x1e2)+_0x484287(0x15f)](_0x4179ac,_0x12eb32):(_0x25b596[_0x484287(0x259)+_0x484287(0x205)+'andledIn'+_0x484287(0x1bf)]?.(),await _0x25b596[_0x484287(0x11b)+_0x484287(0x21b)](_0x4179ac,_0x12eb32)),{'ok':!![]};}function _0xda103c(){const _0x254a3f=_0x5b0699;return join(_0x25b596[_0x254a3f(0x184)+'tateDir'](),_0x254a3f(0x29f)+'oc-cli');}function _0x5d1f72(){const _0x156fcc=_0x5b0699;return join(_0xda103c(),_0x156fcc(0x267)+'w',_0x156fcc(0x1c7)+_0x156fcc(0x287));}async function _0x4834f0(_0xe2bd6f={}){const _0x52f810=_0x5b0699;return _0x339c50(_0x56b47f[_0x52f810(0x121)+_0x52f810(0x171)],_0xe2bd6f);}async function _0x1d5878(_0x50fee9,_0xe2d9df){const _0x168c33=_0x5b0699,{env:_0x50f569,runtime:_0x23d011}=await _0x4834f0({'FORCE_COLOR':'0','HOME':homedir()}),_0xc6790c=await _0x22cd09(_0x23d011);return _0x4df633(_0x168c33(0x157)+_0x168c33(0x161),{'connector':_0x168c33(0x1b8),'phase':_0x168c33(0x29d),'message':_0x168c33(0x250)+'i\x20'+_0x50fee9[_0x168c33(0x26e)]('\x20')}),new Promise((_0x29b75c,_0xd12353)=>{const _0xa6ee3a=_0x168c33,_0x1b370c=spawn(_0xc6790c[_0xa6ee3a(0x2bb)+_0xa6ee3a(0x177)],_0x50fee9,{'cwd':homedir(),'env':_0x50f569});let _0x31e8bf='';const _0x115d38=_0x565ef9=>{const _0x461106=_0xa6ee3a,_0x5b0a3b=_0x565ef9[_0x461106(0x24e)]('utf8');_0x31e8bf+=_0x5b0a3b,_0x4df633(_0x461106(0x157)+_0x461106(0x161),{'connector':_0x461106(0x1b8),'phase':_0x461106(0x16a),'message':_0x5b0a3b});};_0x1b370c[_0xa6ee3a(0x29c)]['on'](_0xa6ee3a(0x13b),_0x115d38),_0x1b370c['stderr']['on'](_0xa6ee3a(0x13b),_0x115d38),_0x1b370c['once'](_0xa6ee3a(0x1ed),_0xd12353),_0x1b370c[_0xa6ee3a(0x288)](_0xa6ee3a(0x194),_0x33a6d8=>_0x29b75c({'code':_0x33a6d8,'output':_0x31e8bf}));if(typeof _0xe2d9df===_0xa6ee3a(0x2ea))_0x1b370c[_0xa6ee3a(0x2e9)][_0xa6ee3a(0x285)](_0xe2d9df);else _0x1b370c['stdin'][_0xa6ee3a(0x285)]();});}async function _0xf15bb6(){const _0x4cd0c3=_0x5b0699,_0xec7f5b=await _0x4b13cb(),_0x38789f=asRecord(_0xec7f5b[_0x4cd0c3(0x207)]),_0x353160=asRecord(_0x38789f['entries']),_0x544cd9={...asRecord(_0x353160[KDOCS_SKILL_ID]),'enabled':!![]};if(typeof openClawConfigHandlers[_0x4cd0c3(0x206)+_0x4cd0c3(0x1c5)]===_0x4cd0c3(0x12a)){await openClawConfigHandlers['setSkill'+_0x4cd0c3(0x1c5)]({'skillId':KDOCS_SKILL_ID,'entry':_0x544cd9,'reason':_0x4cd0c3(0x201)+_0x4cd0c3(0x108)+_0x4cd0c3(0x2cf)});return;}_0x353160[KDOCS_SKILL_ID]=_0x544cd9,_0x38789f[_0x4cd0c3(0x2c4)]=_0x353160,_0xec7f5b[_0x4cd0c3(0x207)]=_0x38789f,await _0x59ffb5(_0xec7f5b,_0x4cd0c3(0x201)+_0x4cd0c3(0x108)+_0x4cd0c3(0x2cf));}async function _0x556637(_0x47a6b8){const _0x3b63f8=_0x5b0699,_0x991012=await _0x4b13cb(),_0x5220f6=asRecord(_0x991012[_0x3b63f8(0x207)]),_0x1b4e6f=asRecord(_0x5220f6[_0x3b63f8(0x2c4)]),_0x283e04={...asRecord(_0x1b4e6f[KDOCS_SKILL_ID]),'enabled':Boolean(_0x47a6b8)};if(typeof openClawConfigHandlers[_0x3b63f8(0x206)+_0x3b63f8(0x1c5)]===_0x3b63f8(0x12a)){await openClawConfigHandlers[_0x3b63f8(0x206)+_0x3b63f8(0x1c5)]({'skillId':KDOCS_SKILL_ID,'entry':_0x283e04,'reason':_0x3b63f8(0x201)+'ill\x20'+(_0x47a6b8?_0x3b63f8(0x1a1):_0x3b63f8(0x24a))});return;}_0x1b4e6f[KDOCS_SKILL_ID]=_0x283e04,_0x5220f6['entries']=_0x1b4e6f,_0x991012['skills']=_0x5220f6,await _0x59ffb5(_0x991012,_0x3b63f8(0x201)+'ill\x20'+(_0x47a6b8?_0x3b63f8(0x1a1):_0x3b63f8(0x24a)));}async function _0xffa74c(){const _0x23c6bb=_0x5b0699;if(typeof openClawConfigHandlers[_0x23c6bb(0x168)+_0x23c6bb(0x25b)]==='function'){await openClawConfigHandlers[_0x23c6bb(0x168)+_0x23c6bb(0x25b)]({'skillId':KDOCS_SKILL_ID,'reason':_0x23c6bb(0x201)+_0x23c6bb(0x10e)+'ector\x20de'+_0x23c6bb(0x251)});return;}const _0x261ff2=await _0x4b13cb(),_0x882e8c=asRecord(_0x261ff2[_0x23c6bb(0x207)]),_0x509895=asRecord(_0x882e8c[_0x23c6bb(0x2c4)]);delete _0x509895[KDOCS_SKILL_ID],_0x882e8c['entries']=_0x509895,_0x261ff2[_0x23c6bb(0x207)]=_0x882e8c,await _0x59ffb5(_0x261ff2,_0x23c6bb(0x201)+_0x23c6bb(0x10e)+'ector\x20de'+'leted');}async function _0x3bb8bc(){const _0x3252d6=_0x5b0699;if(!await _0x2cee31())throw new Error(_0x3252d6(0x16e)+',请先完成\x20kd'+_0x3252d6(0x1da)+'连接');return await _0xf15bb6(),{'ok':!![]};}async function _0x2cee31(){const _0x55d324=_0x5b0699,_0x58a3b0=await _0x1d5878([_0x55d324(0x1f3),_0x55d324(0x209)])[_0x55d324(0x12e)](()=>({'code':null,'output':''}));return _0x58a3b0[_0x55d324(0x153)]===0x0&&isKdocsAuthStatusReady(_0x58a3b0['output']);}async function _0x59dfe6({appId:_0x1d5c23,appSecret:_0x43b2f4,userInfo:userInfo=null}){const _0x335339=_0x5b0699,_0x2cb6ca=await _0x4b13cb();applyFeishuChannelConfig(_0x2cb6ca,{'appId':_0x1d5c23,'appSecret':_0x43b2f4,'userInfo':userInfo});const _0x48eef3=asRecord(_0x2cb6ca[_0x335339(0x296)]);if(typeof openClawConfigHandlers['setChann'+_0x335339(0x17d)]==='function')return openClawConfigHandlers[_0x335339(0x2ba)+_0x335339(0x17d)]({'channelId':_0x335339(0x11e),'channel':asRecord(_0x48eef3[_0x335339(0x11e)]),'pluginId':_0x335339(0x11e),'pluginEnabled':!![],'reason':_0x335339(0x175)+_0x335339(0x144)+_0x335339(0x2a0)+'dated'});await _0x59ffb5(_0x2cb6ca,_0x335339(0x175)+_0x335339(0x144)+'onfig\x20up'+_0x335339(0x20c));}async function _0x266483({appId:_0x4e6933,appSecret:_0x3fa07c,userInfo:userInfo=null,configPath:_0x3469b3}){const _0x303ced=_0x5b0699,_0x45f027=getTrimmedString(userInfo?.['openId']),_0x142254={'channels':{'feishu':{'enabled':![],'appId':_0x4e6933,'appSecret':_0x3fa07c,'domain':_0x303ced(0x11e),'connectionMode':'websocke'+'t','requireMention':!![],'dmPolicy':_0x45f027?_0x303ced(0x1a6)+'t':_0x303ced(0x24a),'groupPolicy':_0x303ced(0x24a),'streaming':!![],'allowFrom':_0x45f027?[_0x45f027]:[],'groupAllowFrom':[]}},'plugins':{'entries':{},'allow':[]},'tools':{'profile':_0x303ced(0x15d)}};await mkdir(dirname(_0x3469b3),{'recursive':!![]}),await writeFile(_0x3469b3,JSON['stringif'+'y'](_0x142254,null,0x2)+'\x0a',_0x303ced(0x1b0));}async function _0x23ea2d(_0x5ab9cd={}){const _0x1ac634=_0x5b0699,_0x46439c=safeString(_0x5ab9cd[_0x1ac634(0x155)]),_0x515e27=safeString(_0x5ab9cd[_0x1ac634(0x143)+'t']);if(!_0x46439c)throw new Error(_0x1ac634(0x2d5)+_0x1ac634(0x229)+_0x1ac634(0x14a));if(!_0x515e27)throw new Error(_0x1ac634(0x2d5)+_0x1ac634(0x27a)+_0x1ac634(0x25c)+_0x1ac634(0x1a7));return await _0x59dfe6({'appId':_0x46439c,'appSecret':_0x515e27,'userInfo':null}),{'ok':!![]};}async function _0x5d85e0(_0xfa147a={}){const _0x100bfb=_0x5b0699,_0x37e336=safeString(_0xfa147a[_0x100bfb(0x155)]),_0x2b2f98=safeString(_0xfa147a[_0x100bfb(0x107)+_0x100bfb(0x132)]);if(!_0x37e336)throw new Error(_0x100bfb(0x1c4)+_0x100bfb(0x229)+'equired');if(!_0x2b2f98)throw new Error(_0x100bfb(0x1c4)+_0x100bfb(0x27a)+_0x100bfb(0x25c)+_0x100bfb(0x1a7));const _0x45d5f8=await _0x4b13cb(),_0x5aa8e9=asRecord(_0x45d5f8[_0x100bfb(0x296)]),_0x4db31f=asRecord(_0x5aa8e9[_0x100bfb(0x113)]),_0x2be02d={'enabled':typeof _0x4db31f['enabled']==='boolean'?_0x4db31f[_0x100bfb(0x1a1)]:!![],'allowFrom':['*'],'appId':_0x37e336,'clientSecret':_0x2b2f98};if(typeof openClawConfigHandlers[_0x100bfb(0x2ba)+_0x100bfb(0x17d)]===_0x100bfb(0x12a))return openClawConfigHandlers['setChann'+_0x100bfb(0x17d)]({'channelId':_0x100bfb(0x113),'channel':_0x2be02d,'pluginId':QQBOT_PLUGIN_ID,'pluginEnabled':!![],'reason':'qqbot\x20ch'+_0x100bfb(0x1b6)+_0x100bfb(0x2f8)+'ated'});_0x5aa8e9['qqbot']=_0x2be02d,_0x45d5f8[_0x100bfb(0x296)]=_0x5aa8e9;const _0x181006=asRecord(_0x45d5f8[_0x100bfb(0x1f5)]),_0x222b51=asRecord(_0x181006[_0x100bfb(0x2c4)]);return _0x222b51[QQBOT_PLUGIN_ID]={...asRecord(_0x222b51[QQBOT_PLUGIN_ID]),'enabled':!![]},_0x181006['entries']=_0x222b51,_0x181006[_0x100bfb(0x2a6)]=dedupeStrings([...asStringArray(_0x181006[_0x100bfb(0x2a6)]),QQBOT_PLUGIN_ID]),_0x45d5f8[_0x100bfb(0x1f5)]=_0x181006,await _0x59ffb5(_0x45d5f8,'qqbot\x20ch'+'annel\x20co'+_0x100bfb(0x2f8)+_0x100bfb(0x169)),{'ok':!![]};}async function _0x55e9aa(_0x210700={}){const _0x4e9b7b=_0x5b0699,_0x5de86b=safeString(_0x210700[_0x4e9b7b(0x138)]),_0x416342=safeString(_0x210700[_0x4e9b7b(0x291)]);if(!_0x5de86b)throw new Error(_0x4e9b7b(0x18f)+_0x4e9b7b(0x23c)+_0x4e9b7b(0x299));if(!_0x416342)throw new Error(_0x4e9b7b(0x270)+'ret\x20is\x20r'+_0x4e9b7b(0x14a));const _0x46a78a=await _0x4b13cb(),_0x583bc6=asRecord(_0x46a78a[_0x4e9b7b(0x296)]),_0x366cdf=asRecord(_0x583bc6[_0x4e9b7b(0x20a)]),_0x3b7ade={..._0x366cdf,'enabled':typeof _0x366cdf['enabled']===_0x4e9b7b(0x186)?_0x366cdf['enabled']:!![],'name':getTrimmedString(_0x366cdf[_0x4e9b7b(0x230)])||_0x4e9b7b(0x2b3),'connectionMode':getTrimmedString(_0x366cdf[_0x4e9b7b(0x1ac)+_0x4e9b7b(0x198)])||'websocke'+'t','dmPolicy':normalizeFeishuDmPolicy(_0x366cdf['dmPolicy'])??_0x4e9b7b(0x2d4),'groupPolicy':normalizeFeishuGroupPolicy(_0x366cdf[_0x4e9b7b(0x158)+_0x4e9b7b(0x2e4)])??_0x4e9b7b(0x2d4),'allowFrom':asStringArray(_0x366cdf[_0x4e9b7b(0x26c)+'m']),'groupAllowFrom':asStringArray(_0x366cdf[_0x4e9b7b(0x17c)+'owFrom']),'botId':_0x5de86b,'secret':_0x416342};if(typeof openClawConfigHandlers['setChann'+_0x4e9b7b(0x17d)]===_0x4e9b7b(0x12a))return openClawConfigHandlers[_0x4e9b7b(0x2ba)+_0x4e9b7b(0x17d)]({'channelId':'wecom','channel':_0x3b7ade,'pluginId':WECOM_PLUGIN_ID,'pluginEnabled':!![],'reason':'wecom\x20ch'+_0x4e9b7b(0x1b6)+_0x4e9b7b(0x2f8)+_0x4e9b7b(0x169)});_0x583bc6[_0x4e9b7b(0x20a)]=_0x3b7ade,_0x46a78a[_0x4e9b7b(0x296)]=_0x583bc6;const _0x1e562b=asRecord(_0x46a78a[_0x4e9b7b(0x1f5)]),_0x5d8e06=asRecord(_0x1e562b['entries']);return _0x5d8e06[WECOM_PLUGIN_ID]={...asRecord(_0x5d8e06[WECOM_PLUGIN_ID]),'enabled':!![]},_0x1e562b['entries']=_0x5d8e06,_0x1e562b[_0x4e9b7b(0x2a6)]=dedupeStrings([...asStringArray(_0x1e562b[_0x4e9b7b(0x2a6)]),WECOM_PLUGIN_ID]),_0x46a78a[_0x4e9b7b(0x1f5)]=_0x1e562b,await _0x59ffb5(_0x46a78a,_0x4e9b7b(0x26a)+_0x4e9b7b(0x1b6)+'nfig\x20upd'+'ated'),{'ok':!![]};}async function _0x3e85f1(_0x26324e,_0x445217,_0x3c9ed3,_0x3cb889){const _0x4485b3=_0x5b0699,_0x30cb22=safeString(_0x445217[_0x4485b3(0x106)]),_0x13f542=String(_0x445217[_0x4485b3(0x110)+_0x4485b3(0x162)+'e']||'')[_0x4485b3(0x18c)](/\s+/g,'');if(!_0x30cb22)throw new Error(_0x3cb889+('账号\x20is\x20re'+'quired'));if(!_0x13f542)throw new Error(_0x3cb889+(_0x4485b3(0x167)+_0x4485b3(0x14a)));const _0x58524d=await _0x4b13cb(),_0x203774=asRecord(_0x58524d['plugins']),_0x5cad7d=asRecord(_0x203774[_0x4485b3(0x2c4)]),_0x367e1d=createConnectorPluginEntry(_0x26324e,_0x5cad7d[_0x26324e],!![],{'account':_0x30cb22,'authorizationCode':_0x13f542,..._0x3c9ed3});if(typeof openClawConfigHandlers['setPlugi'+_0x4485b3(0x248)]===_0x4485b3(0x12a))return openClawConfigHandlers[_0x4485b3(0x24d)+_0x4485b3(0x248)]({'pluginId':_0x26324e,'enabled':!![],'config':asRecord(_0x367e1d[_0x4485b3(0x2da)]),'reason':_0x26324e+('\x20connect'+'or\x20plugi'+_0x4485b3(0x159)+'d')});return _0x5cad7d[_0x26324e]=_0x367e1d,_0x203774[_0x4485b3(0x2c4)]=_0x5cad7d,_0x203774['allow']=dedupeStrings([...asStringArray(_0x203774[_0x4485b3(0x2a6)]),_0x26324e]),_0x58524d['plugins']=_0x203774,await _0x59ffb5(_0x58524d,_0x26324e+('\x20connect'+'or\x20plugi'+_0x4485b3(0x159)+'d')),{'ok':!![]};}const _0x3bc8c6=_0x4cb27f=>_0x3e85f1(QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x4cb27f,{'imapHost':_0x5b0699(0x2f3)+'com','imapPort':0x3e1,'smtpHost':_0x5b0699(0x1db)+_0x5b0699(0x2f1),'smtpPort':0x1d1,'secure':!![]},_0x5b0699(0x11c)),_0x263b46=_0x32d7b0=>_0x3e85f1(NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x32d7b0,{'imapHost':_0x5b0699(0x26f)+_0x5b0699(0x129),'imapPort':0x3e1,'smtpHost':_0x5b0699(0x2b9)+_0x5b0699(0x129),'smtpPort':0x1d1,'imapClientName':_0x5b0699(0x1a2),'imapClientVersion':_0x5b0699(0x22a),'imapClientVendor':_0x5b0699(0x1a2),'imapClientSupportEmail':_0x5b0699(0x12d)+_0x5b0699(0x246),'secure':!![]},_0x5b0699(0x1e9)),_0xf98631=_0x3abaf1=>_0x3e85f1(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x3abaf1,{'imapHost':_0x5b0699(0x264)+_0x5b0699(0x12f)+'om','imapPort':0x3e1,'smtpHost':'smtp.exm'+_0x5b0699(0x12f)+'om','smtpPort':0x1d1,'secure':!![]},_0x5b0699(0x1b5));async function _0x571874(_0x3ba968={}){const _0x239835=_0x5b0699,_0x306528=safeString(_0x3ba968['accountN'+_0x239835(0x1a9)])||_0x239835(0x190),_0x22a0f1=await _0x4b13cb(),_0x338ee2=asRecord(_0x22a0f1[_0x239835(0x1f5)]),_0x4be6ad=asRecord(_0x338ee2[_0x239835(0x2c4)]),_0x30ecf8=createConnectorPluginEntry(FEISHU_DOC_CONNECTOR_PLUGIN_ID,_0x4be6ad[FEISHU_DOC_CONNECTOR_PLUGIN_ID],!![],{'authMode':_0x239835(0x2ed),'accountName':_0x306528});if(typeof openClawConfigHandlers[_0x239835(0x24d)+'nConfig']==='function')return openClawConfigHandlers[_0x239835(0x24d)+_0x239835(0x248)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':!![],'config':asRecord(_0x30ecf8['config']),'reason':_0x239835(0x127)+'oc\x20conne'+_0x239835(0x1d9)+'gin\x20upda'+_0x239835(0x276)});return _0x4be6ad[FEISHU_DOC_CONNECTOR_PLUGIN_ID]=_0x30ecf8,_0x338ee2[_0x239835(0x2c4)]=_0x4be6ad,_0x338ee2[_0x239835(0x2a6)]=dedupeStrings([...asStringArray(_0x338ee2[_0x239835(0x2a6)]),FEISHU_DOC_CONNECTOR_PLUGIN_ID]),_0x22a0f1['plugins']=_0x338ee2,await _0x59ffb5(_0x22a0f1,_0x239835(0x127)+_0x239835(0x289)+_0x239835(0x1d9)+'gin\x20upda'+'ted'),{'ok':!![]};}async function _0x3c44df(_0x14f2d9={}){const _0x4a117d=_0x5b0699,_0x73f902=safeString(_0x14f2d9[_0x4a117d(0x2f0)]);if(!_0x73f902)throw new Error(_0x4a117d(0x2b5)+_0x4a117d(0x2ec)+_0x4a117d(0x1fc));const _0x17bc80=await _0x4b13cb(),_0x4eedc3=asRecord(_0x17bc80['skills']),_0x3c66b4=asRecord(_0x4eedc3['entries']),_0x37cfa7=asRecord(_0x3c66b4[TENCENT_DOCS_SKILL_ID]),_0x2a0ec6={..._0x37cfa7,'enabled':!![],'env':{...asRecord(_0x37cfa7[_0x4a117d(0x19e)]),[TENCENT_DOCS_TOKEN_ENV]:_0x73f902}};if(typeof openClawConfigHandlers[_0x4a117d(0x206)+_0x4a117d(0x1c5)]===_0x4a117d(0x12a))return openClawConfigHandlers[_0x4a117d(0x206)+_0x4a117d(0x1c5)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':_0x2a0ec6,'reason':_0x4a117d(0x142)+_0x4a117d(0x2ae)+_0x4a117d(0x2c2)+'ed'});return _0x3c66b4[TENCENT_DOCS_SKILL_ID]=_0x2a0ec6,_0x4eedc3[_0x4a117d(0x2c4)]=_0x3c66b4,_0x17bc80[_0x4a117d(0x207)]=_0x4eedc3,await _0x59ffb5(_0x17bc80,_0x4a117d(0x142)+_0x4a117d(0x2ae)+_0x4a117d(0x2c2)+'ed'),{'ok':!![]};}async function _0x5ccbcf(_0x200f72={}){const _0x355059=_0x5b0699,_0x5051df=safeString(_0x200f72['url']);if(!_0x5051df)throw new Error('钉钉文档\x20Str'+_0x355059(0x241)+'ttp\x20URL\x20'+_0x355059(0x25c)+_0x355059(0x1a7));try{const _0x4a9784=new URL(_0x5051df);if(![_0x355059(0x247),'https:'][_0x355059(0x2a4)](_0x4a9784['protocol']))throw new Error(_0x355059(0x282)+'protocol');}catch{throw new Error(_0x355059(0x24c)+_0x355059(0x23b)+_0x355059(0x2f4)+_0x355059(0x145));}if(typeof openClawConfigHandlers['setMcpSe'+'rver']===_0x355059(0x12a))return openClawConfigHandlers['setMcpSe'+_0x355059(0x1a8)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'server':createDingtalkDocMcpServerConfig(_0x5051df),'reason':'dingtalk'+_0x355059(0x131)+_0x355059(0x212)});const _0x1770d7=await _0x4b13cb(),_0x3c0c42=readOpenClawMcpServersFromConfig(_0x1770d7);return _0x3c0c42[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x5051df),writeOpenClawMcpServersToConfig(_0x1770d7,_0x3c0c42),await _0x59ffb5(_0x1770d7,_0x355059(0x16b)+'\x20doc\x20mcp'+_0x355059(0x212)),{'ok':!![]};}async function _0x4bb43e(){const _0x321813=_0x5b0699,_0x147d1a=await _0x4b13cb(),_0x242dd5=asRecord(_0x147d1a[_0x321813(0x1f5)]),_0x198ba5=asRecord(_0x242dd5[_0x321813(0x2c4)]),_0x4eb14b=asRecord(_0x147d1a[_0x321813(0x207)]),_0x1e723a=asRecord(_0x4eb14b[_0x321813(0x2c4)]),_0x3cdc97={},_0x545cd6=_0x17ec43=>{const _0x41c39b=_0x321813,_0x2ea15e=asRecord(_0x198ba5[_0x17ec43]);return{'entry':_0x2ea15e,'config':asRecord(_0x2ea15e[_0x41c39b(0x2da)])};},_0x265b35=(_0x4d82d0,_0x29413c,_0x497eb5)=>{const _0x35b9ec=_0x321813,{entry:_0x12dbcf,config:_0x4c7774}=_0x545cd6(_0x29413c),_0x29ad0a=getTrimmedString(_0x4c7774[_0x35b9ec(0x106)]);if(!_0x29ad0a)return;_0x3cdc97[_0x4d82d0]={'provider':_0x4d82d0,'sourceType':_0x35b9ec(0x2c9),'adapter':_0x29413c,'enabled':_0x12dbcf[_0x35b9ec(0x1a1)]!==![]&&_0x4c7774[_0x35b9ec(0x1a1)]!==![],'account':_0x29ad0a,'credentialRef':_0x29413c+(_0x35b9ec(0x268)+_0x35b9ec(0x228)+'de'),'name':_0x497eb5};};_0x265b35(_0x321813(0x160),QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x321813(0x11c)),_0x265b35(_0x321813(0x269)+'mail',NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x321813(0x1e9)),_0x265b35(_0x321813(0x254)+'exmail',TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x321813(0x1b5));const _0x43e8fa=_0x545cd6(FEISHU_DOC_CONNECTOR_PLUGIN_ID),_0x9fc465=getTrimmedString(_0x43e8fa[_0x321813(0x2da)][_0x321813(0x297)+_0x321813(0x1a9)]);_0x9fc465&&(_0x3cdc97[_0x321813(0x11e)]={'provider':_0x321813(0x11e),'sourceType':'lark-cli','adapter':_0x321813(0x166)+_0x321813(0x1e6),'enabled':_0x43e8fa[_0x321813(0x262)][_0x321813(0x1a1)]!==![]&&_0x43e8fa[_0x321813(0x2da)]['enabled']!==![],'authMode':'user','accountName':_0x9fc465,'account':_0x9fc465,'credentialRef':FEISHU_DOC_CONNECTOR_PLUGIN_ID+_0x321813(0x2b0),'capabilities':[_0x321813(0x2c8),_0x321813(0x1cd),_0x321813(0x2f7),'read','update',_0x321813(0x204),'export']});const _0x55747f=asRecord(_0x1e723a[TENCENT_DOCS_SKILL_ID]),_0x2658bc=asRecord(_0x55747f[_0x321813(0x19e)]),_0x353697=getTrimmedString(_0x2658bc[TENCENT_DOCS_TOKEN_ENV]);_0x353697&&(_0x3cdc97[_0x321813(0x254)+_0x321813(0x1a3)]={'provider':_0x321813(0x254)+'docs','sourceType':'skill','adapter':TENCENT_DOCS_SKILL_ID,'enabled':_0x55747f['enabled']!==![],'account':'腾讯文档','credentialRef':TENCENT_DOCS_SKILL_ID+':'+TENCENT_DOCS_TOKEN_ENV,'capabilities':[_0x321813(0x2f7),_0x321813(0x29e),'update','delete',_0x321813(0x109),'export','ocr']});const _0x2b516c=asRecord(_0x1e723a[KDOCS_SKILL_ID]);Object[_0x321813(0x1ee)](_0x2b516c)['length']>0x0&&await _0x2cee31()&&(_0x3cdc97[_0x321813(0x1b8)]={'provider':_0x321813(0x1b8),'sourceType':'skill','adapter':KDOCS_SKILL_ID,'enabled':_0x2b516c[_0x321813(0x1a1)]!==![],'account':_0x321813(0x2a3),'credentialRef':_0x321813(0x250)+_0x321813(0x18d)+'in','capabilities':[_0x321813(0x2f7),_0x321813(0x29e),_0x321813(0x265),_0x321813(0x1cd),_0x321813(0x1fe),_0x321813(0x109),_0x321813(0x23a)]});const _0x1d61a1=readOpenClawMcpServersFromConfig(_0x147d1a),_0x448a6d=findDingtalkDocMcpServer(_0x1d61a1),_0x38872b=getTrimmedString(_0x448a6d[_0x321813(0x213)]);return _0x38872b&&(_0x3cdc97['dingtalk'+_0x321813(0x1af)]={'provider':_0x321813(0x16b)+_0x321813(0x1af),'sourceType':'mcp','adapter':DINGTALK_DOC_MCP_SERVER_NAME,'enabled':_0x448a6d[_0x321813(0x1a1)]!==![],'url':_0x38872b,'transport':getTrimmedString(_0x448a6d[_0x321813(0x19b)+'t'])||_0x321813(0x219)+_0x321813(0x2d9)}),_0x3cdc97;}async function _0x3f917e(){const _0x5e3a24=_0x5b0699,_0x4a4131=await _0x25b596[_0x5e3a24(0x14e)+_0x5e3a24(0x15e)+_0x5e3a24(0x286)]();return{..._0x4a4131,'connectors':{...asRecord(_0x4a4131['connecto'+'rs']),...await _0x4bb43e()}};}function _0x1498ba(_0x15ed0b){const _0x2840fc=_0x5b0699;if(!_0x15ed0b[_0x2840fc(0x244)+_0x2840fc(0x2e6)])return;clearTimeout(_0x15ed0b[_0x2840fc(0x244)+'mer']),_0x15ed0b['verifyTi'+'mer']=null;}function _0x543518(_0x4044d2,_0x13a211=KDOCS_CLI_AUTH_POLL_INTERVAL_MS){const _0x225772=_0x5b0699;if(_0x4044d2[_0x225772(0x209)]!==_0x225772(0x14b))return;_0x1498ba(_0x4044d2),_0x4044d2['verifyTi'+_0x225772(0x2e6)]=setTimeout(()=>void _0x32de8f(_0x4044d2),_0x13a211);}async function _0x32de8f(_0x1c87c7){const _0x2f7315=_0x5b0699;if(_0x1c87c7[_0x2f7315(0x209)]!==_0x2f7315(0x14b))return;_0x1c87c7[_0x2f7315(0x25d)]=_0x2f7315(0x112),_0x1c87c7[_0x2f7315(0x15a)]=_0x2f7315(0x2b1)+_0x2f7315(0x1f1);try{const _0x5b8c02=await _0x1d5878([_0x2f7315(0x1f3),_0x2f7315(0x209)]);_0x1c87c7[_0x2f7315(0x16a)]=_0x5b8c02[_0x2f7315(0x16a)];if(_0x5b8c02[_0x2f7315(0x153)]===0x0&&isKdocsAuthStatusReady(_0x5b8c02[_0x2f7315(0x16a)])){_0x1498ba(_0x1c87c7),await _0xf15bb6(),_0x1c87c7[_0x2f7315(0x25d)]=_0x2f7315(0x21e)+'d',_0x1c87c7[_0x2f7315(0x209)]=_0x2f7315(0x21e)+'d',_0x1c87c7[_0x2f7315(0x15a)]=_0x2f7315(0x181);return;}if(Date[_0x2f7315(0x284)]()-_0x1c87c7[_0x2f7315(0x1cc)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x1c87c7[_0x2f7315(0x209)]=_0x2f7315(0x1ed),_0x1c87c7[_0x2f7315(0x2c7)+_0x2f7315(0x16f)]='金山文档授权状态'+'验证超时';return;}_0x543518(_0x1c87c7);}catch(_0x3dc974){if(Date[_0x2f7315(0x284)]()-_0x1c87c7[_0x2f7315(0x1cc)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x1c87c7['status']='error',_0x1c87c7[_0x2f7315(0x2c7)+_0x2f7315(0x16f)]=_0x3dc974 instanceof Error?_0x3dc974[_0x2f7315(0x15a)]:'金山文档授权状态'+_0x2f7315(0x2a1);return;}_0x543518(_0x1c87c7);}}async function _0xd1e150(){const _0x396537=_0x5b0699,_0x40ada1=randomUUID(),_0x106684={'sessionId':_0x40ada1,'status':_0x396537(0x14b),'phase':_0x396537(0x10b),'url':null,'message':'正在启动金山文档'+'登录','errorMessage':null,'output':'','process':null,'verifyTimer':null,'startedAt':Date['now']()};return _0x52a7a1[_0x396537(0x134)](_0x40ada1,_0x106684),void _0x4834f0({'FORCE_COLOR':'0','HOME':homedir()})[_0x396537(0x195)](async({env:_0x223fd1,runtime:_0x46458a})=>{const _0x368c90=_0x396537,_0x436a39=await _0x22cd09(_0x46458a);_0x4df633('connecto'+'r-log',{'connector':_0x368c90(0x1b8),'phase':_0x368c90(0x29d),'message':'kdocs-cl'+'i\x20auth\x20l'+_0x368c90(0x14d)});const _0x311e8e=spawn(_0x436a39[_0x368c90(0x2bb)+'lePath'],[_0x368c90(0x1f3),_0x368c90(0x140)],{'cwd':homedir(),'env':_0x223fd1});_0x106684['process']=_0x311e8e;const _0x583478=setTimeout(()=>{const _0x13a70a=_0x368c90;if(_0x106684[_0x13a70a(0x209)]!==_0x13a70a(0x14b))return;_0x311e8e[_0x13a70a(0x2a2)](),_0x106684['status']='error',_0x106684[_0x13a70a(0x2c7)+_0x13a70a(0x16f)]=_0x13a70a(0x1c6)+'超时',_0x106684[_0x13a70a(0x224)]=null;},KDOCS_CLI_STEP_TIMEOUT_MS),_0x4d57da=_0xf3c6ad=>{const _0x454b0d=_0x368c90,_0x3c276d=_0xf3c6ad[_0x454b0d(0x24e)](_0x454b0d(0x1b0));_0x106684[_0x454b0d(0x16a)]+=_0x3c276d,_0x4df633(_0x454b0d(0x157)+_0x454b0d(0x161),{'connector':'kdocs','phase':_0x454b0d(0x16a),'message':_0x3c276d});const _0x7b1208=extractFirstUrl(_0x106684[_0x454b0d(0x16a)]);_0x7b1208&&!_0x106684[_0x454b0d(0x213)]&&(_0x106684['url']=_0x7b1208,_0x106684[_0x454b0d(0x25d)]=_0x454b0d(0x1f3),_0x106684['message']='请在浏览器完成金'+_0x454b0d(0x2a5),_0x543518(_0x106684,0x1f4),void _0x5658fc[_0x454b0d(0x1ba)+_0x454b0d(0x1b1)](_0x7b1208)['catch'](()=>{}));};_0x311e8e[_0x368c90(0x29c)]['on'](_0x368c90(0x13b),_0x4d57da),_0x311e8e[_0x368c90(0x25e)]['on'](_0x368c90(0x13b),_0x4d57da),_0x311e8e[_0x368c90(0x2e9)]['end'](),_0x311e8e[_0x368c90(0x288)](_0x368c90(0x1ed),_0x51228b=>{const _0x5e156e=_0x368c90;clearTimeout(_0x583478),_0x106684[_0x5e156e(0x209)]=_0x5e156e(0x1ed),_0x106684['errorMes'+_0x5e156e(0x16f)]=_0x51228b instanceof Error?_0x51228b[_0x5e156e(0x15a)]:_0x5e156e(0x1c6)+'失败,请确认\x20k'+_0x5e156e(0x2c3)+'\x20已安装',_0x106684['process']=null,_0x4df633(_0x5e156e(0x157)+_0x5e156e(0x161),{'connector':'kdocs','phase':_0x5e156e(0x1ed),'message':_0x106684[_0x5e156e(0x2c7)+_0x5e156e(0x16f)]});}),_0x311e8e['once'](_0x368c90(0x194),_0x1b10f4=>{const _0x1b7dcc=_0x368c90;clearTimeout(_0x583478),_0x106684['process']=null;if(_0x106684[_0x1b7dcc(0x209)]!==_0x1b7dcc(0x14b))return;const _0x1c5b66=extractFirstUrl(_0x106684['output']);if(_0x1c5b66&&!_0x106684[_0x1b7dcc(0x213)]){_0x106684['url']=_0x1c5b66,_0x106684[_0x1b7dcc(0x25d)]=_0x1b7dcc(0x1f3),_0x106684[_0x1b7dcc(0x15a)]=_0x1b7dcc(0x182)+_0x1b7dcc(0x2a5),_0x543518(_0x106684,0x1f4);return;}if(_0x1b10f4!==0x0){_0x106684[_0x1b7dcc(0x209)]=_0x1b7dcc(0x1ed),_0x106684['errorMes'+_0x1b7dcc(0x16f)]=_0x106684[_0x1b7dcc(0x16a)][_0x1b7dcc(0x2d7)]()||_0x1b7dcc(0x1c6)+_0x1b7dcc(0x185)+_0x1b7dcc(0x2c3)+_0x1b7dcc(0x1aa),_0x4df633(_0x1b7dcc(0x157)+_0x1b7dcc(0x161),{'connector':_0x1b7dcc(0x1b8),'phase':'error','message':_0x106684[_0x1b7dcc(0x2c7)+'sage']});return;}_0x106684['phase']=_0x1b7dcc(0x112),_0x106684[_0x1b7dcc(0x15a)]='正在验证金山文档'+_0x1b7dcc(0x1f1),_0x543518(_0x106684,0x1f4);});})['catch'](_0x4243a5=>{const _0x5eee10=_0x396537;_0x106684[_0x5eee10(0x209)]=_0x5eee10(0x1ed),_0x106684[_0x5eee10(0x2c7)+_0x5eee10(0x16f)]=_0x4243a5 instanceof Error?_0x4243a5[_0x5eee10(0x15a)]:_0x5eee10(0x1c6)+'失败,请确认\x20k'+_0x5eee10(0x2c3)+'\x20已安装',_0x4df633(_0x5eee10(0x157)+_0x5eee10(0x161),{'connector':'kdocs','phase':_0x5eee10(0x1ed),'message':_0x106684[_0x5eee10(0x2c7)+_0x5eee10(0x16f)]});}),createKdocsCliStatus(_0x106684);}function _0x4fe16c(_0x44af50={}){const _0x4513b1=_0x5b0699,_0x3d02c4=safeString(_0x44af50[_0x4513b1(0x180)+'d']);if(!_0x3d02c4)throw new Error(_0x4513b1(0x1e8)+_0x4513b1(0x1be)+_0x4513b1(0x1a5)+_0x4513b1(0x27e));const _0x4f3cc0=_0x52a7a1['get'](_0x3d02c4);if(!_0x4f3cc0)throw new Error('Kdocs\x20CL'+_0x4513b1(0x1be)+_0x4513b1(0x1f2)+_0x4513b1(0x19f));return createKdocsCliStatus(_0x4f3cc0);}function _0x39f3bb(_0x9dbb7a={}){const _0x267263=_0x5b0699,_0x42486b=safeString(_0x9dbb7a[_0x267263(0x180)+'d']);if(!_0x42486b)return{'ok':!![]};const _0x23dd9c=_0x52a7a1[_0x267263(0x1c2)](_0x42486b);if(!_0x23dd9c)return{'ok':!![]};return _0x1498ba(_0x23dd9c),_0x23dd9c['process']?.[_0x267263(0x2a2)](),_0x52a7a1[_0x267263(0x204)](_0x42486b),{'ok':!![]};}function _0x562707(_0x51b6f8){const _0x8ccb13=_0x5b0699;if(!_0x51b6f8[_0x8ccb13(0x23e)])return;clearTimeout(_0x51b6f8['timer']),_0x51b6f8[_0x8ccb13(0x23e)]=null;}function _0x2aecb0(_0x4539e6){const _0x30f2d9=_0x5b0699,_0x458405=_0x15d7f3['get'](_0x4539e6);if(!_0x458405||_0x458405[_0x30f2d9(0x209)]!=='pending')return;_0x562707(_0x458405),_0x458405[_0x30f2d9(0x23e)]=setTimeout(()=>void _0x3a0d20(_0x4539e6),_0x458405[_0x30f2d9(0x1df)+_0x30f2d9(0x226)]);}async function _0x3a0d20(_0x1f59e3){const _0x53a012=_0x5b0699,_0x49f22d=_0x15d7f3['get'](_0x1f59e3);if(!_0x49f22d||_0x49f22d[_0x53a012(0x209)]!==_0x53a012(0x14b))return;if(Date[_0x53a012(0x284)]()>=_0x49f22d[_0x53a012(0x1b9)+'t']){_0x49f22d[_0x53a012(0x209)]=_0x53a012(0x279),_0x49f22d[_0x53a012(0x2c7)+_0x53a012(0x16f)]=_0x53a012(0x123)+_0x53a012(0x236),_0x562707(_0x49f22d);return;}try{const _0x3ceed7=await pollFeishuRegistration(_0x49f22d[_0x53a012(0x2ff)],_0x49f22d['deviceCo'+'de']),_0x461df2=getTrimmedString(_0x3ceed7[_0x53a012(0x211)+'d']),_0xd363e7=getTrimmedString(_0x3ceed7[_0x53a012(0x1bb)+_0x53a012(0x15b)]),_0x42419b=getTrimmedString(_0x3ceed7[_0x53a012(0x1ed)]),_0x159f0a=extractFeishuRegistrationAuthorizationUri(_0x3ceed7)||_0x49f22d[_0x53a012(0x110)+_0x53a012(0x165)];if(_0x159f0a!==_0x49f22d['authoriz'+_0x53a012(0x165)])_0x49f22d['authoriz'+_0x53a012(0x165)]=_0x159f0a;if(_0x461df2&&_0xd363e7){const _0x3d4e50=asRecord(_0x3ceed7['user_inf'+'o']);await _0x59dfe6({'appId':_0x461df2,'appSecret':_0xd363e7,'userInfo':{'openId':getTrimmedString(_0x3d4e50['open_id'])||null}}),_0x49f22d[_0x53a012(0x209)]=_0x53a012(0x21e)+'d',_0x49f22d['errorMes'+_0x53a012(0x16f)]=null,_0x562707(_0x49f22d);return;}if(!_0x42419b||_0x42419b===_0x53a012(0x110)+_0x53a012(0x188)+_0x53a012(0x148)){_0x2aecb0(_0x1f59e3);return;}if(_0x42419b==='slow_dow'+'n'){_0x49f22d[_0x53a012(0x1df)+_0x53a012(0x226)]+=0x1388,_0x2aecb0(_0x1f59e3);return;}if(_0x42419b==='expired_'+_0x53a012(0x2a9)){_0x49f22d['status']='expired',_0x49f22d[_0x53a012(0x2c7)+_0x53a012(0x16f)]=_0x53a012(0x123)+_0x53a012(0x236),_0x562707(_0x49f22d);return;}_0x49f22d['status']=_0x53a012(0x1ed),_0x49f22d[_0x53a012(0x2c7)+_0x53a012(0x16f)]=getTrimmedString(_0x3ceed7[_0x53a012(0x266)+_0x53a012(0x2dc)+'n'])||(_0x42419b==='access_d'+'enied'?_0x53a012(0x1ad)+_0x53a012(0x116):_0x53a012(0x120)+_0x42419b),_0x562707(_0x49f22d);}catch(_0x1b8931){_0x49f22d[_0x53a012(0x209)]=_0x53a012(0x1ed),_0x49f22d[_0x53a012(0x2c7)+'sage']=_0x1b8931 instanceof Error?_0x1b8931[_0x53a012(0x15a)]:_0x53a012(0x19d),_0x562707(_0x49f22d);}}async function _0x5ae86d(_0x4bf5c1={}){const _0x2cf82e=_0x5b0699,_0x224642=_0x4bf5c1[_0x2cf82e(0x170)]===_0x2cf82e(0x13a)+_0x2cf82e(0x1b7)?_0x2cf82e(0x13a)+_0x2cf82e(0x1b7):'channel',_0x306ade=createFeishuRegistrationClient(),_0x27ec28=await initFeishuRegistration(_0x306ade),_0x1c2de5=Array['isArray'](_0x27ec28[_0x2cf82e(0x223)+_0x2cf82e(0x2ce)+_0x2cf82e(0x2e7)])?_0x27ec28['supporte'+_0x2cf82e(0x2ce)+_0x2cf82e(0x2e7)][_0x2cf82e(0x1d2)](getTrimmedString)[_0x2cf82e(0x17e)](Boolean):[];if(!_0x1c2de5[_0x2cf82e(0x2a4)](_0x2cf82e(0x1bb)+_0x2cf82e(0x15b)))throw new Error('Current\x20'+'environm'+_0x2cf82e(0x25a)+_0x2cf82e(0x273)+_0x2cf82e(0x2d8)+'ent_secr'+_0x2cf82e(0x1de));const _0x539bac=await beginFeishuRegistration(_0x306ade),_0x4bc333=getTrimmedString(_0x539bac[_0x2cf82e(0x196)+_0x2cf82e(0x290)+_0x2cf82e(0x2a7)+'e']),_0x4e3a36=extractFeishuRegistrationAuthorizationUri(_0x539bac),_0x1b9c14=getTrimmedString(_0x539bac[_0x2cf82e(0x25f)+_0x2cf82e(0x28a)]),_0x374393=Number(_0x539bac['expire_i'+'n'])||0x258,_0x44c8fd=Number(_0x539bac[_0x2cf82e(0x2e5)])||0x5;if(!_0x4bc333||!_0x1b9c14)throw new Error(_0x2cf82e(0x2bd)+_0x2cf82e(0x196)+_0x2cf82e(0x290)+'_complet'+_0x2cf82e(0x16c)+_0x2cf82e(0x2d3)+_0x2cf82e(0x1c1)+_0x2cf82e(0x1b3)+_0x2cf82e(0x1e7));const _0x49bfa4=randomUUID(),_0x301666={'sessionId':_0x49bfa4,'purpose':_0x224642,'client':_0x306ade,'deviceCode':_0x1b9c14,'verificationUriComplete':_0x4bc333,'authorizationUri':_0x4e3a36,'expiresAt':Date[_0x2cf82e(0x284)]()+_0x374393*0x3e8,'pollIntervalMs':Math[_0x2cf82e(0x1c9)](_0x44c8fd*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'status':_0x2cf82e(0x14b),'errorMessage':null,'timer':null};return _0x15d7f3[_0x2cf82e(0x134)](_0x49bfa4,_0x301666),_0x2aecb0(_0x49bfa4),serializeFeishuRegistrationSession(_0x301666);}function _0x129af7(_0x2744f3={}){const _0x554c6d=_0x5b0699,_0x40cac0=safeString(_0x2744f3[_0x554c6d(0x180)+'d']);if(!_0x40cac0)throw new Error(_0x554c6d(0x126)+_0x554c6d(0x271)+_0x554c6d(0x189)+'ion\x20id\x20i'+_0x554c6d(0x130)+'ed');const _0x3a7f0e=_0x15d7f3[_0x554c6d(0x1c2)](_0x40cac0);if(!_0x3a7f0e)throw new Error(_0x554c6d(0x126)+_0x554c6d(0x271)+'ion\x20sess'+_0x554c6d(0x218)+'found');return serializeFeishuRegistrationSession(_0x3a7f0e);}function _0x252f0d(_0x50731d={}){const _0x5d6b23=_0x5b0699,_0x46c73a=safeString(_0x50731d['sessionI'+'d']);if(!_0x46c73a)return{'ok':!![]};const _0x5a8e0b=_0x15d7f3[_0x5d6b23(0x1c2)](_0x46c73a);if(!_0x5a8e0b)return{'ok':!![]};return _0x562707(_0x5a8e0b),_0x15d7f3[_0x5d6b23(0x204)](_0x46c73a),{'ok':!![]};}async function _0x1121ac(_0x27d7a4,_0x2bab44){const _0x20777b=_0x5b0699,_0x1357b3=_0xda103c(),{env:_0x4f0086,runtime:_0x489b45}=await _0x4834f0({'FORCE_COLOR':'0','HOME':homedir(),'LARK_CLI_NO_PROXY':'1','OPENCLAW_HOME':_0x1357b3,'OPENCLAW_CONFIG_PATH':_0x27d7a4[_0x20777b(0x115)+'onfigPat'+'h']});await mkdir(_0x1357b3,{'recursive':!![]});const _0x40b157=await _0xb3cc5f(_0x489b45);for(const _0x4715e6 of[_0x20777b(0x1ae)+'XY',_0x20777b(0x10f)+'OXY',_0x20777b(0x300)+'Y','http_pro'+'xy',_0x20777b(0x292)+'oxy',_0x20777b(0x12b)+'y']){delete _0x4f0086[_0x4715e6];}return new Promise((_0x53b75a,_0xb12b08)=>{const _0x118e98=_0x20777b;_0x4df633('connecto'+_0x118e98(0x161),{'connector':_0x118e98(0x2cd)+'oc','phase':_0x118e98(0x29d),'message':_0x118e98(0x2c0)+'\x20'+_0x2bab44[_0x118e98(0x26e)]('\x20')});const _0x3a5195=spawn(_0x40b157[_0x118e98(0x21d)+'utable'],[_0x40b157[_0x118e98(0x146)+'th'],..._0x2bab44],{'cwd':_0x1357b3,'env':_0x4f0086});let _0x296238=![];_0x3a5195[_0x118e98(0x288)](_0x118e98(0x29d),()=>{_0x296238=!![],_0x53b75a(_0x3a5195);}),_0x3a5195[_0x118e98(0x288)](_0x118e98(0x1ed),_0x1ebb10=>{if(_0x296238)return;_0xb12b08(_0x1ebb10);});});}function _0x2734be(_0x3a8223,_0x320885,_0x3ef956){const _0x25fd1d=_0x5b0699;_0x3a8223['phase']=_0x3ef956[_0x25fd1d(0x25d)],_0x3a8223[_0x25fd1d(0x15a)]=_0x3ef956[_0x25fd1d(0x15a)];if(_0x3ef956[_0x25fd1d(0x25d)]!==_0x25fd1d(0x112))_0x3a8223['url']=null;_0x3a8223['output']='',void _0x1121ac(_0x3a8223,_0x320885)[_0x25fd1d(0x195)](_0x8765d9=>{const _0x90499f=_0x25fd1d;_0x3a8223[_0x90499f(0x224)]=_0x8765d9;const _0x243461=setTimeout(()=>{const _0x1caa01=_0x90499f;if(_0x3a8223[_0x1caa01(0x209)]!==_0x1caa01(0x14b))return;_0x8765d9[_0x1caa01(0x2a2)](),_0x3a8223[_0x1caa01(0x209)]=_0x1caa01(0x1ed),_0x3a8223[_0x1caa01(0x2c7)+_0x1caa01(0x16f)]=_0x3ef956[_0x1caa01(0x15a)]+'超时',_0x3a8223['process']=null;},FEISHU_DOC_CLI_STEP_TIMEOUT_MS),_0x4ef817=_0x4a8b50=>{const _0x31b241=_0x90499f,_0x3d8a53=_0x4a8b50['toString']('utf8');_0x3a8223[_0x31b241(0x16a)]+=_0x3d8a53,_0x4df633('connecto'+'r-log',{'connector':_0x31b241(0x2cd)+'oc','phase':_0x3ef956['phase'],'message':_0x3d8a53});};_0x8765d9[_0x90499f(0x29c)]['on'](_0x90499f(0x13b),_0x4ef817),_0x8765d9['stderr']['on'](_0x90499f(0x13b),_0x4ef817);if(typeof _0x3ef956['stdin']===_0x90499f(0x2ea))_0x8765d9['stdin']['end'](_0x3ef956[_0x90499f(0x2e9)]);else _0x8765d9['stdin'][_0x90499f(0x285)]();_0x8765d9['on'](_0x90499f(0x1ed),_0xd9b4aa=>{const _0x43ff32=_0x90499f;clearTimeout(_0x243461),_0x3a8223[_0x43ff32(0x209)]=_0x43ff32(0x1ed),_0x3a8223['errorMes'+_0x43ff32(0x16f)]=_0xd9b4aa instanceof Error?_0xd9b4aa[_0x43ff32(0x15a)]:_0x43ff32(0x1b2)+_0x43ff32(0x191),_0x3a8223[_0x43ff32(0x224)]=null,_0x4df633(_0x43ff32(0x157)+_0x43ff32(0x161),{'connector':_0x43ff32(0x2cd)+'oc','phase':_0x43ff32(0x1ed),'message':_0x3a8223[_0x43ff32(0x2c7)+_0x43ff32(0x16f)]});}),_0x8765d9['on'](_0x90499f(0x194),_0x22219d=>{const _0x554d7a=_0x90499f;clearTimeout(_0x243461),_0x3a8223[_0x554d7a(0x224)]=null;if(_0x3a8223['status']!==_0x554d7a(0x14b))return;if(_0x22219d!==0x0){if(_0x3ef956[_0x554d7a(0x214)+'e']){void Promise[_0x554d7a(0x1c0)](_0x3ef956[_0x554d7a(0x214)+'e'](_0x22219d,_0x3a8223[_0x554d7a(0x16a)]))[_0x554d7a(0x12e)](_0x27ce60=>{const _0x520c98=_0x554d7a;_0x3a8223[_0x520c98(0x209)]=_0x520c98(0x1ed),_0x3a8223['errorMes'+_0x520c98(0x16f)]=_0x27ce60 instanceof Error?_0x27ce60['message']:_0x520c98(0x111)+'接失败';});return;}_0x3a8223[_0x554d7a(0x209)]=_0x554d7a(0x1ed),_0x3a8223[_0x554d7a(0x2c7)+_0x554d7a(0x16f)]=getFeishuDocCliFailureMessage(_0x3ef956[_0x554d7a(0x25d)],extractFeishuDocCliError(_0x3a8223[_0x554d7a(0x16a)],_0x554d7a(0x2c0)+'\x20'+_0x320885[_0x554d7a(0x26e)]('\x20')+('\x20exited\x20'+_0x554d7a(0x2de)+'e\x20')+_0x22219d),'lark-cli'+'\x20'+_0x320885[_0x554d7a(0x26e)]('\x20')+('\x20exited\x20'+'with\x20cod'+'e\x20')+_0x22219d),_0x4df633(_0x554d7a(0x157)+_0x554d7a(0x161),{'connector':_0x554d7a(0x2cd)+'oc','phase':_0x554d7a(0x1ed),'message':_0x3a8223[_0x554d7a(0x2c7)+'sage']});return;}void Promise[_0x554d7a(0x1c0)](_0x3ef956[_0x554d7a(0x298)+'s']())[_0x554d7a(0x12e)](_0x59f907=>{const _0x2c78af=_0x554d7a;_0x3a8223[_0x2c78af(0x209)]=_0x2c78af(0x1ed),_0x3a8223[_0x2c78af(0x2c7)+_0x2c78af(0x16f)]=_0x59f907 instanceof Error?_0x59f907[_0x2c78af(0x15a)]:_0x2c78af(0x111)+_0x2c78af(0x192);});});})[_0x25fd1d(0x12e)](_0x354adf=>{const _0x542566=_0x25fd1d;_0x3a8223['status']=_0x542566(0x1ed),_0x3a8223['errorMes'+_0x542566(0x16f)]=_0x354adf instanceof Error?_0x354adf[_0x542566(0x15a)]:_0x542566(0x1b2)+_0x542566(0x191),_0x3a8223['process']=null,_0x4df633(_0x542566(0x157)+_0x542566(0x161),{'connector':_0x542566(0x2cd)+'oc','phase':'error','message':_0x3a8223[_0x542566(0x2c7)+'sage']});});}function _0x52de49(_0x25d0ef){const _0x145d62=_0x5b0699;if(!_0x25d0ef[_0x145d62(0x1c8)])return;clearTimeout(_0x25d0ef[_0x145d62(0x1c8)]),_0x25d0ef[_0x145d62(0x1c8)]=null;}function _0x4df2c7(_0x4152ce){const _0x42fdda=_0x5b0699;if(!_0x4152ce[_0x42fdda(0x232)+'usTimer'])return;clearTimeout(_0x4152ce[_0x42fdda(0x232)+'usTimer']),_0x4152ce['authStat'+'usTimer']=null;}function _0x35ac82(_0x7d3581,_0x6fd2fa=0x7d0){const _0x31bb1c=_0x5b0699;if(_0x7d3581[_0x31bb1c(0x209)]!==_0x31bb1c(0x14b))return;_0x4df2c7(_0x7d3581),_0x7d3581[_0x31bb1c(0x232)+_0x31bb1c(0x2ab)]=setTimeout(()=>{const _0x2b65e4=_0x31bb1c;_0x2734be(_0x7d3581,[_0x2b65e4(0x1f3),_0x2b65e4(0x209)],{'phase':_0x2b65e4(0x112),'message':'正在验证飞书授权'+'状态','onFailure':(_0x1ca5e9,_0x39f50b)=>{const _0x11c859=_0x2b65e4;if(Date['now']()-_0x7d3581['authStat'+_0x11c859(0x179)+_0x11c859(0x2b2)]>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x7d3581[_0x11c859(0x209)]=_0x11c859(0x1ed),_0x7d3581['errorMes'+_0x11c859(0x16f)]=getFeishuDocCliFailureMessage(_0x11c859(0x112),extractFeishuDocCliError(_0x39f50b,_0x11c859(0x1d6)+_0x11c859(0x2fd)),_0x11c859(0x1d6)+'权状态验证超时');return;}_0x35ac82(_0x7d3581);},'onSuccess':()=>{const _0x4ca3c7=_0x2b65e4;try{ensureFeishuDocCliUserStatus(_0x7d3581[_0x4ca3c7(0x16a)]);}catch(_0x5cc49b){if(Date[_0x4ca3c7(0x284)]()-_0x7d3581[_0x4ca3c7(0x232)+_0x4ca3c7(0x179)+_0x4ca3c7(0x2b2)]>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x7d3581[_0x4ca3c7(0x209)]=_0x4ca3c7(0x1ed),_0x7d3581[_0x4ca3c7(0x2c7)+_0x4ca3c7(0x16f)]=_0x5cc49b instanceof Error?_0x5cc49b[_0x4ca3c7(0x15a)]:_0x4ca3c7(0x1d6)+_0x4ca3c7(0x274);return;}_0x35ac82(_0x7d3581);return;}return _0x4df2c7(_0x7d3581),_0x429e4e(_0x7d3581);}});},_0x6fd2fa);}function _0x3e7fd5(_0x212558){const _0x5667f3=_0x5b0699;if(!_0x212558[_0x5667f3(0x278)]||!_0x212558['cliAppSe'+_0x5667f3(0x132)]){_0x212558[_0x5667f3(0x209)]=_0x5667f3(0x1ed),_0x212558[_0x5667f3(0x2c7)+_0x5667f3(0x16f)]=_0x5667f3(0x210)+'\x20专用应用凭据缺'+_0x5667f3(0x272);return;}const _0x2fd927=_0x212558[_0x5667f3(0x278)],_0x12f12f=_0x212558['cliAppSe'+'cret'];_0x2734be(_0x212558,['--versio'+'n'],{'phase':'bind','message':_0x5667f3(0x1d3)+'LI','onSuccess':()=>{const _0x3e5ee4=_0x5667f3;_0x2734be(_0x212558,[_0x3e5ee4(0x2da),_0x3e5ee4(0x1d5),_0x3e5ee4(0x1bd)+_0x3e5ee4(0x1d5),_0x3e5ee4(0x150),_0x2fd927,'--app-se'+_0x3e5ee4(0x139)+'in','--brand',_0x3e5ee4(0x11e)],{'phase':'bind','message':'正在初始化飞书\x20'+_0x3e5ee4(0x1a4)+'应用','stdin':_0x12f12f,'onSuccess':()=>{const _0x3f7fef=_0x3e5ee4;_0x2734be(_0x212558,[_0x3f7fef(0x1f3),_0x3f7fef(0x140),'--domain','docs,dri'+'ve,markd'+_0x3f7fef(0x13c)+_0x3f7fef(0x21a)+'slides,b'+_0x3f7fef(0x21f),_0x3f7fef(0x220),'search:d'+'ocs:read',_0x3f7fef(0x2cc)+'t'],{'phase':_0x3f7fef(0x1f3),'message':_0x3f7fef(0x243)+'授权页','onSuccess':()=>{const _0x17c75c=_0x3f7fef,_0x49a8cf=parseFeishuDocCliJson(_0x212558[_0x17c75c(0x16a)]),_0x52670f=getTrimmedString(_0x49a8cf[_0x17c75c(0x196)+_0x17c75c(0x290)+'_complet'+'e'])||getTrimmedString(_0x49a8cf[_0x17c75c(0x196)+_0x17c75c(0x1fd)])||getTrimmedString(_0x49a8cf[_0x17c75c(0x196)+_0x17c75c(0x290)]),_0x1e47b3=getTrimmedString(_0x49a8cf[_0x17c75c(0x25f)+_0x17c75c(0x28a)]);if(!_0x52670f||!_0x1e47b3){_0x212558[_0x17c75c(0x209)]=_0x17c75c(0x1ed),_0x212558[_0x17c75c(0x2c7)+_0x17c75c(0x16f)]=_0x17c75c(0x28f)+'返回授权\x20URL'+_0x17c75c(0x18b)+_0x17c75c(0x29b)+summarizeCliOutput(_0x212558[_0x17c75c(0x16a)]);return;}_0x212558[_0x17c75c(0x213)]=_0x52670f,_0x212558[_0x17c75c(0x22e)+'de']=_0x1e47b3,void _0x5658fc[_0x17c75c(0x1ba)+_0x17c75c(0x1b1)](_0x52670f)[_0x17c75c(0x12e)](()=>{}),_0x2734be(_0x212558,[_0x17c75c(0x1f3),'login','--device'+'-code',_0x1e47b3],{'phase':'verify','message':_0x17c75c(0x197)+'完成','onSuccess':()=>{const _0x40bfc3=_0x17c75c;_0x212558[_0x40bfc3(0x232)+_0x40bfc3(0x179)+'dAt']=Date[_0x40bfc3(0x284)](),_0x35ac82(_0x212558,0x1f4);}});}});}});}});}function _0x52d0be(_0xfca402){const _0x50c7f8=_0x5b0699;if(_0xfca402[_0x50c7f8(0x209)]!==_0x50c7f8(0x14b))return;_0x52de49(_0xfca402),_0xfca402[_0x50c7f8(0x1c8)]=setTimeout(()=>void _0x186d93(_0xfca402),_0xfca402[_0x50c7f8(0x154)+_0x50c7f8(0x2ee)+'s']);}async function _0x186d93(_0x57b61d){const _0x59d1cf=_0x5b0699;if(_0x57b61d['status']!==_0x59d1cf(0x14b)||_0x57b61d[_0x59d1cf(0x25d)]!=='create'||!_0x57b61d[_0x59d1cf(0x2fc)+_0x59d1cf(0x1cb)]||!_0x57b61d[_0x59d1cf(0x163)+'eCode'])return;if(Date[_0x59d1cf(0x284)]()>=_0x57b61d[_0x59d1cf(0x26d)+_0x59d1cf(0x187)]){_0x57b61d['status']='error',_0x57b61d[_0x59d1cf(0x2c7)+'sage']=_0x59d1cf(0x263)+_0x59d1cf(0x2e3),_0x52de49(_0x57b61d);return;}try{const _0x5577b5=await pollFeishuRegistration(_0x57b61d[_0x59d1cf(0x2fc)+_0x59d1cf(0x1cb)],_0x57b61d[_0x59d1cf(0x163)+_0x59d1cf(0x1f4)]),_0x3b2021=getTrimmedString(_0x5577b5[_0x59d1cf(0x211)+'d']),_0x181ece=getTrimmedString(_0x5577b5[_0x59d1cf(0x1bb)+_0x59d1cf(0x15b)]),_0x4128c2=getTrimmedString(_0x5577b5[_0x59d1cf(0x1ed)]);if(_0x3b2021&&_0x181ece){const _0x428eea=asRecord(_0x5577b5[_0x59d1cf(0x183)+'o']);await _0x266483({'appId':_0x3b2021,'appSecret':_0x181ece,'userInfo':{'openId':getTrimmedString(_0x428eea['open_id'])||null},'configPath':_0x57b61d[_0x59d1cf(0x115)+_0x59d1cf(0x199)+'h']}),_0x57b61d['cliAppId']=_0x3b2021,_0x57b61d[_0x59d1cf(0x10d)+_0x59d1cf(0x132)]=_0x181ece,_0x52de49(_0x57b61d),_0x57b61d[_0x59d1cf(0x15a)]=_0x59d1cf(0x2ac)+_0x59d1cf(0x176),_0x3e7fd5(_0x57b61d);return;}if(!_0x4128c2||_0x4128c2===_0x59d1cf(0x110)+_0x59d1cf(0x188)+_0x59d1cf(0x148)){_0x52d0be(_0x57b61d);return;}if(_0x4128c2===_0x59d1cf(0x281)+'n'){_0x57b61d[_0x59d1cf(0x154)+_0x59d1cf(0x2ee)+'s']+=0x1388,_0x52d0be(_0x57b61d);return;}_0x57b61d[_0x59d1cf(0x209)]=_0x59d1cf(0x1ed),_0x57b61d['errorMes'+_0x59d1cf(0x16f)]=getTrimmedString(_0x5577b5[_0x59d1cf(0x266)+_0x59d1cf(0x2dc)+'n'])||_0x59d1cf(0x261)+':'+_0x4128c2,_0x52de49(_0x57b61d);}catch(_0x21d5e9){_0x57b61d[_0x59d1cf(0x209)]=_0x59d1cf(0x1ed),_0x57b61d[_0x59d1cf(0x2c7)+'sage']=_0x21d5e9 instanceof Error?_0x21d5e9[_0x59d1cf(0x15a)]:_0x59d1cf(0x261),_0x52de49(_0x57b61d);}}async function _0x429e4e(_0x4dfc28){const _0x4a46aa=_0x5b0699;await _0x571874({'accountName':_0x4a46aa(0x190)}),_0x4dfc28[_0x4a46aa(0x209)]=_0x4a46aa(0x21e)+'d',_0x4dfc28[_0x4a46aa(0x25d)]=_0x4a46aa(0x21e)+'d',_0x4dfc28[_0x4a46aa(0x15a)]=_0x4a46aa(0x22f)+'完成',_0x4dfc28[_0x4a46aa(0x2c7)+_0x4a46aa(0x16f)]=null;}async function _0x44f6c7(){const _0x4aa899=_0x5b0699,_0x326a57=createFeishuRegistrationClient(),_0x5c3c93=await initFeishuRegistration(_0x326a57),_0x4310ce=Array['isArray'](_0x5c3c93[_0x4aa899(0x223)+'d_auth_m'+_0x4aa899(0x2e7)])?_0x5c3c93[_0x4aa899(0x223)+'d_auth_m'+_0x4aa899(0x2e7)]['map'](getTrimmedString)[_0x4aa899(0x17e)](Boolean):[];if(!_0x4310ce[_0x4aa899(0x2a4)](_0x4aa899(0x1bb)+'ecret'))throw new Error('当前飞书开放平台'+_0x4aa899(0x22b)+_0x4aa899(0x1bb)+_0x4aa899(0x1c3));const _0xcf1849=await beginFeishuRegistration(_0x326a57),_0x4101c8=getTrimmedString(_0xcf1849['verifica'+'tion_uri'+_0x4aa899(0x2a7)+'e']),_0x3798bb=getTrimmedString(_0xcf1849['device_c'+_0x4aa899(0x28a)]),_0x3d824a=Number(_0xcf1849['expire_i'+'n'])||0x258,_0x5ebfe5=Number(_0xcf1849[_0x4aa899(0x2e5)])||0x5;if(!_0x4101c8||!_0x3798bb)throw new Error(_0x4aa899(0x19a)+_0x4aa899(0x1bc)+_0x4aa899(0x275)+'code,请重试');const _0x5d7d53=randomUUID(),_0xe7cea6={'sessionId':_0x5d7d53,'status':'pending','phase':_0x4aa899(0x2f7),'url':_0x4101c8,'appDeviceCode':_0x3798bb,'appPollClient':_0x326a57,'appPollIntervalMs':Math['max'](_0x5ebfe5*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'appExpiresAt':Date[_0x4aa899(0x284)]()+_0x3d824a*0x3e8,'appTimer':null,'authStatusTimer':null,'authStatusStartedAt':0x0,'deviceCode':null,'message':_0x4aa899(0x283)+_0x4aa899(0x164),'errorMessage':null,'process':null,'output':'','cliHostConfigPath':_0x5d1f72(),'cliAppId':null,'cliAppSecret':null};return _0x49c39e[_0x4aa899(0x134)](_0x5d7d53,_0xe7cea6),_0x52d0be(_0xe7cea6),createFeishuDocCliStatus(_0xe7cea6);}function _0x226bb0(_0x517f8b={}){const _0x4db8c8=_0x5b0699,_0x401a9d=safeString(_0x517f8b[_0x4db8c8(0x180)+'d']);if(!_0x401a9d)throw new Error(_0x4db8c8(0x245)+_0x4db8c8(0x28e)+_0x4db8c8(0x149)+'d\x20is\x20req'+_0x4db8c8(0x258));const _0x4a61b5=_0x49c39e[_0x4db8c8(0x1c2)](_0x401a9d);if(!_0x4a61b5)throw new Error('Feishu\x20d'+_0x4db8c8(0x28e)+_0x4db8c8(0x141)+'ot\x20found');return createFeishuDocCliStatus(_0x4a61b5);}function _0x8b37a3(_0x2a29ad={}){const _0xf0db3e=_0x5b0699,_0x3900db=safeString(_0x2a29ad[_0xf0db3e(0x180)+'d']);if(!_0x3900db)return{'ok':!![]};const _0x13d47a=_0x49c39e['get'](_0x3900db);if(!_0x13d47a)return{'ok':!![]};return _0x52de49(_0x13d47a),_0x4df2c7(_0x13d47a),_0x13d47a[_0xf0db3e(0x224)]?.[_0xf0db3e(0x2a2)](),_0x49c39e['delete'](_0x3900db),{'ok':!![]};}function _0x5c28b0(_0x477cab={}){const _0x3d3f90=_0x5b0699,_0xb0ab29=safeString(_0x477cab[_0x3d3f90(0x180)+'d']);if(!_0xb0ab29)throw new Error(_0x3d3f90(0x245)+_0x3d3f90(0x28e)+'ession\x20i'+_0x3d3f90(0x1dd)+_0x3d3f90(0x258));const _0x4dd219=_0x49c39e[_0x3d3f90(0x1c2)](_0xb0ab29);if(!_0x4dd219)throw new Error(_0x3d3f90(0x245)+_0x3d3f90(0x28e)+_0x3d3f90(0x141)+_0x3d3f90(0x11d));if(_0x4dd219['status']===_0x3d3f90(0x1ed))throw new Error(_0x4dd219[_0x3d3f90(0x2c7)+_0x3d3f90(0x16f)]||_0x3d3f90(0x111)+'接失败');return{'ok':!![]};}async function _0xfa1aef(_0xecdf7){const _0x271195=_0x5b0699,_0x559599=asRecord(_0xecdf7[_0x271195(0x1f5)]),_0x5a1919=asRecord(_0x559599['entries']),_0x4ca681=asStringArray(_0x559599['allow']),_0x5a8488=asRecord(_0x5a1919[WECHAT_PLUGIN_ID]),_0x41b8c3=_0x5a8488[_0x271195(0x1a1)]===!![]||_0x4ca681[_0x271195(0x2a4)](WECHAT_PLUGIN_ID),_0x1bb7a2=join(_0x25b596[_0x271195(0x184)+'tateDir'](),WECHAT_PLUGIN_ID),_0x3e97cc=join(_0x1bb7a2,_0x271195(0x119)+_0x271195(0x287));let _0x948c62=![];try{const _0x9ef766=(await readFile(_0x3e97cc,'utf8'))[_0x271195(0x2d7)]();if(_0x9ef766){const _0x794cfe=JSON['parse'](_0x9ef766);_0x948c62=Array[_0x271195(0x256)](_0x794cfe)?_0x794cfe[_0x271195(0x2d6)]>0x0:Object['keys'](asRecord(_0x794cfe))['length']>0x0;}}catch{}if(!_0x948c62)try{_0x948c62=(await readdir(join(_0x1bb7a2,_0x271195(0x119))))[_0x271195(0x2d6)]>0x0;}catch{}return{'exists':_0x41b8c3||_0x948c62,'enabled':_0x41b8c3,'connected':_0x41b8c3&&_0x948c62};}async function _0x2032ae(){const _0x58f080=_0x5b0699,_0x43f75e=await _0x4b13cb(),_0x264c7d=asRecord(_0x43f75e[_0x58f080(0x296)]),_0x5a6353=[],_0x5f2d79=await _0xfa1aef(_0x43f75e);_0x5f2d79[_0x58f080(0x2df)]&&_0x5a6353['push']({'id':WECHAT_PLUGIN_ID,'type':_0x58f080(0x2ca),'name':'微信','enabled':_0x5f2d79[_0x58f080(0x1a1)],'connected':_0x5f2d79[_0x58f080(0x2bf)+'d']});const _0x151fc7=asRecord(_0x264c7d['qqbot']),_0x2154df=getTrimmedString(_0x151fc7[_0x58f080(0x155)]),_0x33c69d=getTrimmedString(_0x151fc7[_0x58f080(0x107)+'cret']);_0x2154df&&_0x33c69d&&_0x5a6353[_0x58f080(0x216)]({'id':_0x58f080(0x113),'type':'qqbot','name':_0x58f080(0x124),'enabled':_0x151fc7[_0x58f080(0x1a1)]!==![],'appId':_0x2154df,'clientSecret':_0x33c69d});const _0x3e0c5f=asRecord(_0x264c7d[_0x58f080(0x20a)]),_0x1a1c95=getTrimmedString(_0x3e0c5f[_0x58f080(0x138)]),_0x423874=getTrimmedString(_0x3e0c5f[_0x58f080(0x291)]);_0x1a1c95&&_0x423874&&_0x5a6353[_0x58f080(0x216)]({'id':_0x58f080(0x20a),'type':'wecom','name':_0x58f080(0x2b3),'enabled':_0x3e0c5f[_0x58f080(0x1a1)]!==![],'botId':_0x1a1c95,'secret':_0x423874});const _0x4902a1=asRecord(_0x264c7d[_0x58f080(0x11e)]),_0xe1dc1c=getTrimmedString(_0x4902a1[_0x58f080(0x155)]),_0x5e7f7a=getTrimmedString(_0x4902a1['appSecre'+'t']);return _0xe1dc1c&&_0x5e7f7a&&getTrimmedString(_0x4902a1[_0x58f080(0x2b8)+'y'])!==FEISHU_DOC_CONNECTOR_PLUGIN_ID&&_0x5a6353[_0x58f080(0x216)]({'id':'feishu','type':_0x58f080(0x11e),'name':'飞书机器人','enabled':_0x4902a1[_0x58f080(0x1a1)]!==![],'appId':_0xe1dc1c,'appSecret':_0x5e7f7a}),_0x5a6353;}async function _0x57f983(_0x3157be){const _0x186d87=_0x5b0699;if(typeof openClawConfigHandlers['setPlugi'+_0x186d87(0x248)]===_0x186d87(0x12a))return openClawConfigHandlers['setPlugi'+'nConfig']({'pluginId':WECHAT_PLUGIN_ID,'enabled':Boolean(_0x3157be),'reason':WECHAT_PLUGIN_ID+_0x186d87(0x17b)+(_0x3157be?'enabled':_0x186d87(0x24a))});const _0x31f044=await _0x4b13cb(),_0x5ccb65=asRecord(_0x31f044['plugins']),_0x29792e=asRecord(_0x5ccb65[_0x186d87(0x2c4)]);return _0x29792e[WECHAT_PLUGIN_ID]={...asRecord(_0x29792e[WECHAT_PLUGIN_ID]),'enabled':Boolean(_0x3157be)},_0x5ccb65[_0x186d87(0x2c4)]=_0x29792e,_0x5ccb65[_0x186d87(0x2a6)]=_0x3157be?dedupeStrings([...asStringArray(_0x5ccb65['allow']),WECHAT_PLUGIN_ID]):asStringArray(_0x5ccb65[_0x186d87(0x2a6)])[_0x186d87(0x17e)](_0x3a652e=>_0x3a652e!==WECHAT_PLUGIN_ID),_0x31f044['plugins']=_0x5ccb65,await _0x59ffb5(_0x31f044,WECHAT_PLUGIN_ID+_0x186d87(0x17b)+(_0x3157be?'enabled':_0x186d87(0x24a))),{'ok':!![]};}async function _0x2218ba(_0x5126a7={}){const _0x2c9ca4=_0x5b0699,_0x4f9c54=safeString(_0x5126a7[_0x2c9ca4(0x1dc)+'d']||_0x5126a7['id']);if(!_0x4f9c54)throw new Error(_0x2c9ca4(0x24b)+_0x2c9ca4(0x29a)+_0x2c9ca4(0x299));const _0x48b296=await _0x4b13cb(),_0x262ae6=asRecord(_0x48b296[_0x2c9ca4(0x296)]),_0x2e237c=asRecord(_0x48b296[_0x2c9ca4(0x1f5)]),_0x1c8c91=asRecord(_0x2e237c[_0x2c9ca4(0x2c4)]),_0x13c93b=_0x4f802e=>{const _0x199fe8=_0x2c9ca4;_0x1c8c91[_0x4f802e]=createConnectorPluginEntry(_0x4f802e,_0x1c8c91[_0x4f802e],![],{}),_0x2e237c[_0x199fe8(0x2a6)]=asStringArray(_0x2e237c['allow'])[_0x199fe8(0x17e)](_0x3c4ab3=>_0x3c4ab3!==_0x4f802e),_0x2e237c[_0x199fe8(0x2c4)]=_0x1c8c91,_0x48b296[_0x199fe8(0x1f5)]=_0x2e237c;};if(_0x4f9c54===_0x2c9ca4(0x2cd)+'oc')return _0x13c93b(FEISHU_DOC_CONNECTOR_PLUGIN_ID),getTrimmedString(asRecord(_0x262ae6['feishu'])[_0x2c9ca4(0x2b8)+'y'])===FEISHU_DOC_CONNECTOR_PLUGIN_ID&&(delete _0x262ae6[_0x2c9ca4(0x11e)],_0x48b296[_0x2c9ca4(0x296)]=_0x262ae6),await rm(_0xda103c(),{'recursive':!![],'force':!![]})[_0x2c9ca4(0x12e)](()=>{}),_0x59ffb5(_0x48b296,_0x2c9ca4(0x127)+'oc\x20conne'+_0x2c9ca4(0x1d9)+_0x2c9ca4(0x2d1)+_0x2c9ca4(0x276));if(_0x4f9c54===_0x2c9ca4(0x160)){if(typeof openClawConfigHandlers[_0x2c9ca4(0x24d)+'nConfig']===_0x2c9ca4(0x12a))return openClawConfigHandlers[_0x2c9ca4(0x24d)+_0x2c9ca4(0x248)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x2c9ca4(0x156)+'connecto'+'r\x20plugin'+'\x20deleted'});return _0x13c93b(QQ_MAIL_CONNECTOR_PLUGIN_ID),_0x59ffb5(_0x48b296,_0x2c9ca4(0x156)+'connecto'+_0x2c9ca4(0x178)+_0x2c9ca4(0x1e3));}if(_0x4f9c54==='netease_'+_0x2c9ca4(0x1f9)){if(typeof openClawConfigHandlers['setPlugi'+_0x2c9ca4(0x248)]==='function')return openClawConfigHandlers['setPlugi'+_0x2c9ca4(0x248)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x2c9ca4(0x1fa)+'mail\x20con'+_0x2c9ca4(0x11f)+_0x2c9ca4(0x208)+_0x2c9ca4(0x251)});return _0x13c93b(NETEASE_MAIL_CONNECTOR_PLUGIN_ID),_0x59ffb5(_0x48b296,'netease\x20'+_0x2c9ca4(0x1e1)+_0x2c9ca4(0x11f)+_0x2c9ca4(0x208)+_0x2c9ca4(0x251));}if(_0x4f9c54===_0x2c9ca4(0x254)+_0x2c9ca4(0x1ef)){if(typeof openClawConfigHandlers[_0x2c9ca4(0x24d)+_0x2c9ca4(0x248)]===_0x2c9ca4(0x12a))return openClawConfigHandlers[_0x2c9ca4(0x24d)+_0x2c9ca4(0x248)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x2c9ca4(0x142)+_0x2c9ca4(0x255)+'onnector'+_0x2c9ca4(0x17b)+_0x2c9ca4(0x2d2)});return _0x13c93b(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID),_0x59ffb5(_0x48b296,_0x2c9ca4(0x142)+_0x2c9ca4(0x255)+'onnector'+_0x2c9ca4(0x17b)+'deleted');}if(_0x4f9c54===_0x2c9ca4(0x254)+'docs'){if(typeof openClawConfigHandlers[_0x2c9ca4(0x168)+'illEntry']==='function')return openClawConfigHandlers[_0x2c9ca4(0x168)+_0x2c9ca4(0x25b)]({'skillId':TENCENT_DOCS_SKILL_ID,'reason':_0x2c9ca4(0x142)+_0x2c9ca4(0x2ae)+'ll\x20conne'+_0x2c9ca4(0x18a)+_0x2c9ca4(0x295)});const _0xbf7712=asRecord(_0x48b296[_0x2c9ca4(0x207)]),_0x35492f=asRecord(_0xbf7712[_0x2c9ca4(0x2c4)]);return delete _0x35492f[TENCENT_DOCS_SKILL_ID],_0xbf7712[_0x2c9ca4(0x2c4)]=_0x35492f,_0x48b296[_0x2c9ca4(0x207)]=_0xbf7712,_0x59ffb5(_0x48b296,_0x2c9ca4(0x142)+_0x2c9ca4(0x2ae)+_0x2c9ca4(0x240)+'ctor\x20del'+'eted');}if(_0x4f9c54===_0x2c9ca4(0x1b8))return await _0x1d5878([_0x2c9ca4(0x1f3),'logout'])[_0x2c9ca4(0x12e)](()=>({'code':null,'output':''})),await _0xffa74c(),{'ok':!![]};if(_0x4f9c54===_0x2c9ca4(0x16b)+'_doc'){if(typeof openClawConfigHandlers['deleteMc'+_0x2c9ca4(0x1e5)]===_0x2c9ca4(0x12a))return openClawConfigHandlers[_0x2c9ca4(0x17a)+_0x2c9ca4(0x1e5)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'reason':_0x2c9ca4(0x16b)+'\x20doc\x20mcp'+_0x2c9ca4(0x1e3)});const _0x1188bc=readOpenClawMcpServersFromConfig(_0x48b296);return delete _0x1188bc[DINGTALK_DOC_MCP_SERVER_NAME],writeOpenClawMcpServersToConfig(_0x48b296,_0x1188bc),_0x59ffb5(_0x48b296,'dingtalk'+_0x2c9ca4(0x131)+_0x2c9ca4(0x1e3));}if(_0x4f9c54===WECHAT_PLUGIN_ID||_0x4f9c54==='openclaw'+'-weixin'){_0x1c8c91[WECHAT_PLUGIN_ID]={...asRecord(_0x1c8c91[WECHAT_PLUGIN_ID]),'enabled':![]},_0x2e237c['entries']=_0x1c8c91,_0x2e237c[_0x2c9ca4(0x2a6)]=asStringArray(_0x2e237c[_0x2c9ca4(0x2a6)])[_0x2c9ca4(0x17e)](_0xf1d1df=>_0xf1d1df!==WECHAT_PLUGIN_ID&&_0xf1d1df!=='openclaw'+'-weixin'),_0x48b296['plugins']=_0x2e237c;const _0x3b2c7d=join(_0x25b596[_0x2c9ca4(0x184)+_0x2c9ca4(0x1b4)](),WECHAT_PLUGIN_ID);return await rm(join(_0x3b2c7d,'accounts'+_0x2c9ca4(0x287)),{'force':!![]})[_0x2c9ca4(0x12e)](()=>{}),await rm(join(_0x3b2c7d,_0x2c9ca4(0x119)),{'recursive':!![],'force':!![]})[_0x2c9ca4(0x12e)](()=>{}),_0x59ffb5(_0x48b296,_0x4f9c54+('\x20channel'+_0x2c9ca4(0x23f)+'deleted'));}if(_0x4f9c54==='feishu'){if(typeof openClawConfigHandlers[_0x2c9ca4(0x27c)+_0x2c9ca4(0x27d)+_0x2c9ca4(0x21b)]==='function')return openClawConfigHandlers[_0x2c9ca4(0x27c)+_0x2c9ca4(0x27d)+_0x2c9ca4(0x21b)]({'channelId':_0x2c9ca4(0x11e),'pluginId':_0x2c9ca4(0x11e),'reason':_0x2c9ca4(0x175)+_0x2c9ca4(0x144)+_0x2c9ca4(0x2eb)+_0x2c9ca4(0x251)});return delete _0x262ae6[_0x2c9ca4(0x11e)],_0x48b296['channels']=_0x262ae6,_0x1c8c91['feishu']={...asRecord(_0x1c8c91[_0x2c9ca4(0x11e)]),'enabled':![]},_0x2e237c[_0x2c9ca4(0x2c4)]=_0x1c8c91,_0x2e237c[_0x2c9ca4(0x2a6)]=asStringArray(_0x2e237c[_0x2c9ca4(0x2a6)])[_0x2c9ca4(0x17e)](_0x1b3206=>_0x1b3206!==_0x2c9ca4(0x11e)),_0x48b296[_0x2c9ca4(0x1f5)]=_0x2e237c,_0x59ffb5(_0x48b296,_0x2c9ca4(0x175)+_0x2c9ca4(0x144)+_0x2c9ca4(0x2eb)+'leted');}if(_0x4f9c54===_0x2c9ca4(0x113)){if(typeof openClawConfigHandlers[_0x2c9ca4(0x27c)+_0x2c9ca4(0x27d)+_0x2c9ca4(0x21b)]==='function')return openClawConfigHandlers[_0x2c9ca4(0x27c)+_0x2c9ca4(0x27d)+_0x2c9ca4(0x21b)]({'channelId':'qqbot','pluginId':QQBOT_PLUGIN_ID,'reason':'qqbot\x20ch'+_0x2c9ca4(0x1b6)+'nfig\x20del'+'eted'});delete _0x262ae6[_0x2c9ca4(0x113)],_0x1c8c91[QQBOT_PLUGIN_ID]={...asRecord(_0x1c8c91[QQBOT_PLUGIN_ID]),'enabled':![]},_0x2e237c[_0x2c9ca4(0x2a6)]=asStringArray(_0x2e237c[_0x2c9ca4(0x2a6)])[_0x2c9ca4(0x17e)](_0x1fb0ed=>_0x1fb0ed!==QQBOT_PLUGIN_ID);}if(_0x4f9c54===_0x2c9ca4(0x20a)){if(typeof openClawConfigHandlers[_0x2c9ca4(0x27c)+'annelCon'+_0x2c9ca4(0x21b)]==='function')return openClawConfigHandlers[_0x2c9ca4(0x27c)+_0x2c9ca4(0x27d)+'fig']({'channelId':'wecom','pluginId':WECOM_PLUGIN_ID,'reason':'wecom\x20ch'+'annel\x20co'+_0x2c9ca4(0x221)+_0x2c9ca4(0x295)});delete _0x262ae6[_0x2c9ca4(0x20a)],_0x1c8c91[WECOM_PLUGIN_ID]={...asRecord(_0x1c8c91[WECOM_PLUGIN_ID]),'enabled':![]},_0x2e237c[_0x2c9ca4(0x2a6)]=asStringArray(_0x2e237c['allow'])[_0x2c9ca4(0x17e)](_0x2f6309=>_0x2f6309!==WECOM_PLUGIN_ID);}return _0x48b296[_0x2c9ca4(0x296)]=_0x262ae6,_0x2e237c[_0x2c9ca4(0x2c4)]=_0x1c8c91,_0x48b296[_0x2c9ca4(0x1f5)]=_0x2e237c,_0x59ffb5(_0x48b296,_0x4f9c54+(_0x2c9ca4(0x200)+_0x2c9ca4(0x23f)+_0x2c9ca4(0x2d2)));}async function _0x2a56ab(_0x560018={}){const _0x26a2f7=_0x5b0699,_0x205592=safeString(_0x560018[_0x26a2f7(0x1dc)+'d']||_0x560018['id']);if(!_0x205592)throw new Error(_0x26a2f7(0x24b)+'id\x20is\x20re'+_0x26a2f7(0x299));const _0x173a8d=_0x560018['enabled']===!![],_0x38554f=await _0x4b13cb(),_0x53b076=asRecord(_0x38554f[_0x26a2f7(0x1f5)]),_0x2bdcec=asRecord(_0x53b076[_0x26a2f7(0x2c4)]),_0x57ca49=_0x467d39=>{const _0x319d3e=_0x26a2f7;_0x2bdcec[_0x467d39]=createConnectorPluginEntry(_0x467d39,_0x2bdcec[_0x467d39],_0x173a8d,{},{'preserveExistingConfig':!![]}),_0x53b076['allow']=_0x173a8d?dedupeStrings([...asStringArray(_0x53b076[_0x319d3e(0x2a6)]),_0x467d39]):asStringArray(_0x53b076['allow'])[_0x319d3e(0x17e)](_0x7c51ad=>_0x7c51ad!==_0x467d39),_0x53b076['entries']=_0x2bdcec,_0x38554f['plugins']=_0x53b076;};if(_0x205592==='feishu_d'+'oc'){const _0x190f9f=asRecord(_0x2bdcec[FEISHU_DOC_CONNECTOR_PLUGIN_ID]);if(Object[_0x26a2f7(0x1ee)](_0x190f9f)['length']===0x0)throw new Error(_0x26a2f7(0x2dd)+_0x26a2f7(0x1d8)+_0x205592+(_0x26a2f7(0x1ea)+'und'));if(typeof openClawConfigHandlers[_0x26a2f7(0x24d)+_0x26a2f7(0x248)]===_0x26a2f7(0x12a))return openClawConfigHandlers[_0x26a2f7(0x24d)+_0x26a2f7(0x248)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':_0x173a8d,'reason':_0x205592+(_0x26a2f7(0x200)+_0x26a2f7(0x23f))+(_0x173a8d?_0x26a2f7(0x1a1):_0x26a2f7(0x24a))});_0x57ca49(FEISHU_DOC_CONNECTOR_PLUGIN_ID);}else{if(_0x205592==='qq_mail'){if(typeof openClawConfigHandlers[_0x26a2f7(0x24d)+_0x26a2f7(0x248)]===_0x26a2f7(0x12a))return openClawConfigHandlers[_0x26a2f7(0x24d)+'nConfig']({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x173a8d,'reason':_0x205592+(_0x26a2f7(0x200)+_0x26a2f7(0x23f))+(_0x173a8d?_0x26a2f7(0x1a1):'disabled')});_0x57ca49(QQ_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x205592===_0x26a2f7(0x269)+_0x26a2f7(0x1f9)){if(typeof openClawConfigHandlers[_0x26a2f7(0x24d)+'nConfig']===_0x26a2f7(0x12a))return openClawConfigHandlers[_0x26a2f7(0x24d)+'nConfig']({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x173a8d,'reason':_0x205592+(_0x26a2f7(0x200)+'\x20config\x20')+(_0x173a8d?_0x26a2f7(0x1a1):_0x26a2f7(0x24a))});_0x57ca49(NETEASE_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x205592===_0x26a2f7(0x254)+'exmail'){if(typeof openClawConfigHandlers[_0x26a2f7(0x24d)+_0x26a2f7(0x248)]==='function')return openClawConfigHandlers[_0x26a2f7(0x24d)+'nConfig']({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x173a8d,'reason':_0x205592+(_0x26a2f7(0x200)+_0x26a2f7(0x23f))+(_0x173a8d?_0x26a2f7(0x1a1):'disabled')});_0x57ca49(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x205592===_0x26a2f7(0x254)+_0x26a2f7(0x1a3)){const _0x35d24d=asRecord(_0x38554f[_0x26a2f7(0x207)]),_0x6f6f23=asRecord(_0x35d24d[_0x26a2f7(0x2c4)]),_0x2209c6=asRecord(_0x6f6f23[TENCENT_DOCS_SKILL_ID]);if(typeof openClawConfigHandlers[_0x26a2f7(0x206)+_0x26a2f7(0x1c5)]===_0x26a2f7(0x12a))return openClawConfigHandlers[_0x26a2f7(0x206)+'Entry']({'skillId':TENCENT_DOCS_SKILL_ID,'entry':{..._0x2209c6,'enabled':_0x173a8d},'reason':_0x205592+(_0x26a2f7(0x200)+_0x26a2f7(0x23f))+(_0x173a8d?_0x26a2f7(0x1a1):_0x26a2f7(0x24a))});_0x6f6f23[TENCENT_DOCS_SKILL_ID]={..._0x2209c6,'enabled':_0x173a8d},_0x35d24d[_0x26a2f7(0x2c4)]=_0x6f6f23,_0x38554f[_0x26a2f7(0x207)]=_0x35d24d;}else{if(_0x205592==='kdocs'){if(_0x173a8d&&!await _0x2cee31())throw new Error(_0x26a2f7(0x16e)+_0x26a2f7(0x14c));return await _0x556637(_0x173a8d),{'ok':!![]};}else{if(_0x205592==='dingtalk'+_0x26a2f7(0x1af)){const _0x52aafc=readOpenClawMcpServersFromConfig(_0x38554f),_0x4a9aeb=findDingtalkDocMcpServer(_0x52aafc);if(!getTrimmedString(_0x4a9aeb[_0x26a2f7(0x213)]))throw new Error(_0x26a2f7(0x2dd)+_0x26a2f7(0x1d8)+_0x205592+(_0x26a2f7(0x1ea)+_0x26a2f7(0x19f)));_0x52aafc[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x4a9aeb[_0x26a2f7(0x213)],{'enabled':_0x173a8d}),writeOpenClawMcpServersToConfig(_0x38554f,_0x52aafc);}else{const _0x39900c=asRecord(_0x38554f[_0x26a2f7(0x296)]),_0x4043fd=asRecord(_0x39900c[_0x205592]);if(Object[_0x26a2f7(0x1ee)](_0x4043fd)[_0x26a2f7(0x2d6)]===0x0)throw new Error(_0x26a2f7(0x24b)+'\x22'+_0x205592+('\x22\x20not\x20fo'+_0x26a2f7(0x19f)));_0x4043fd[_0x26a2f7(0x1a1)]=_0x173a8d;let _0x17067c=null;_0x205592===_0x26a2f7(0x11e)&&(_0x17067c=_0x26a2f7(0x11e),_0x173a8d&&(_0x4043fd[_0x26a2f7(0x20d)+'g']=!![],delete _0x4043fd[_0x26a2f7(0x2fb)]));if(_0x205592==='qqbot')_0x17067c=QQBOT_PLUGIN_ID;if(_0x205592===_0x26a2f7(0x20a))_0x17067c=WECOM_PLUGIN_ID;if(_0x17067c&&typeof openClawConfigHandlers['setChann'+_0x26a2f7(0x17d)]===_0x26a2f7(0x12a))return openClawConfigHandlers['setChann'+'elConfig']({'channelId':_0x205592,'channel':_0x4043fd,'pluginId':_0x17067c,'pluginEnabled':_0x173a8d,'reason':_0x205592+(_0x26a2f7(0x200)+'\x20config\x20')+(_0x173a8d?'enabled':_0x26a2f7(0x24a))});_0x39900c[_0x205592]=_0x4043fd,_0x38554f['channels']=_0x39900c;if(_0x205592===_0x26a2f7(0x11e))_0x57ca49(_0x26a2f7(0x11e));if(_0x205592===_0x26a2f7(0x113))_0x57ca49(QQBOT_PLUGIN_ID);if(_0x205592===_0x26a2f7(0x20a))_0x57ca49(WECOM_PLUGIN_ID);}}}}}}}return _0x59ffb5(_0x38554f,_0x205592+(_0x26a2f7(0x200)+_0x26a2f7(0x23f))+(_0x173a8d?'enabled':'disabled'));}async function _0x5ce0c1({gatewayPort:_0x5b4e1e,gatewayToken:_0x28744b}={}){const _0x3ac694=_0x5b0699;_0x81d817&&(_0x81d817[_0x3ac694(0x2a2)](),_0x81d817=null);const {cwd:_0x473fff,env:_0x3d6647,runtime:_0xe150a9}=await _0x4834f0({'FORCE_COLOR':'0',..._0x5b4e1e?{'OPENCLAW_GATEWAY_PORT':String(_0x5b4e1e)}:{},..._0x28744b?{'OPENCLAW_GATEWAY_TOKEN':_0x28744b}:{}}),_0x284adb=_0xe150a9[_0x3ac694(0x1f5)][_0x3ac694(0x234)](_0x54e5ff=>_0x54e5ff[_0x3ac694(0x147)]===WECHAT_PLUGIN_ID);if(!_0x284adb){const _0x998cfe=_0x3ac694(0x2db)+_0x3ac694(0x1ab)+_0x3ac694(0x27f)+_0x3ac694(0x1f6);return _0x4df633(_0x3ac694(0x2be)+'tatus',_0x3ac694(0x18e)),_0x4df633(_0x3ac694(0x231)+'og',_0x998cfe),{'ok':![],'error':_0x998cfe};}await _0x57f983(!![]),_0x4df633(_0x3ac694(0x231)+'og',_0x3ac694(0x2c5)+_0x3ac694(0x21c)+'hannels\x20'+_0x3ac694(0x1d4)+'channel\x20'+_0x284adb[_0x3ac694(0x147)]),_0x81d817=spawn(_0xe150a9[_0x3ac694(0x21d)+_0x3ac694(0x1f7)],[_0xe150a9[_0x3ac694(0x1c7)+_0x3ac694(0x172)],_0x3ac694(0x296),_0x3ac694(0x140),'--channe'+'l',_0x284adb[_0x3ac694(0x147)]],{'cwd':_0x473fff,'env':_0x3d6647});let _0x37b690='',_0x20aba1=![],_0x22bf80=![];const _0x337261=_0x26d425=>{const _0x43f273=_0x3ac694,_0x5f36d2=_0x26d425['toString']();_0x37b690+=_0x5f36d2;if(!_0x20aba1){const _0x46f72a=_0x37b690['match'](/(https:\/\/(?:[a-zA-Z0-9-]+\.)*weixin\.qq\.com\S+)/i);_0x46f72a?.[0x1]&&(_0x20aba1=!![],_0x4df633(_0x43f273(0x117)+'rcode',_0x46f72a[0x1]),_0x4df633('wechat-s'+_0x43f273(0x136),_0x43f273(0x12c)));}if(_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x1d1))||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x10a)+'cess')||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x1d7)))_0x4df633(_0x43f273(0x2be)+'tatus',_0x43f273(0x1e4));else{if(_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x1fb))||_0x5f36d2[_0x43f273(0x2a4)]('连接成功')||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x249))||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x2bc)+'n')||_0x5f36d2[_0x43f273(0x2a4)]('Login\x20su'+'ccess')||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x2fe))||_0x5f36d2[_0x43f273(0x2a4)]('已连接过')||_0x5f36d2['includes'](_0x43f273(0x2af))||_0x5f36d2[_0x43f273(0x2a4)]('already\x20'+_0x43f273(0x2bf)+'d')||_0x5f36d2['includes'](_0x43f273(0x280)+_0x43f273(0x294)+_0x43f273(0x1f0)))_0x22bf80=!![],_0x4df633(_0x43f273(0x2be)+_0x43f273(0x136),'SUCCESS'),setTimeout(()=>{const _0x1a531b=_0x43f273;_0x81d817&&(_0x81d817[_0x1a531b(0x2a2)](),_0x81d817=null);},0xbb8);else{if(_0x5f36d2['includes']('过期')||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x279)))_0x4df633(_0x43f273(0x2be)+_0x43f273(0x136),'EXPIRED');else(_0x5f36d2[_0x43f273(0x2a4)]('失败')||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x2a8))||_0x5f36d2[_0x43f273(0x2a4)](_0x43f273(0x235)))&&_0x4df633('wechat-s'+_0x43f273(0x136),_0x43f273(0x18e));}}_0x4df633(_0x43f273(0x231)+'og',_0x5f36d2);};return _0x81d817['stdout']?.['on'](_0x3ac694(0x13b),_0x337261),_0x81d817[_0x3ac694(0x25e)]?.['on'](_0x3ac694(0x13b),_0x337261),_0x81d817['on'](_0x3ac694(0x1ed),_0x377303=>{const _0x4c0753=_0x3ac694;_0x81d817=null,_0x4df633(_0x4c0753(0x2be)+_0x4c0753(0x136),_0x4c0753(0x18e)),_0x4df633(_0x4c0753(0x231)+'og',_0x4c0753(0x20b)+_0x4c0753(0x2d0)+_0x377303[_0x4c0753(0x15a)]);}),_0x81d817['on']('close',_0x2372b1=>{const _0x53de9d=_0x3ac694;_0x81d817=null,_0x22bf80?_0x57f983(!![])[_0x53de9d(0x12e)](()=>{}):(_0x57f983(![])[_0x53de9d(0x12e)](()=>{}),_0x4df633('wechat-s'+_0x53de9d(0x136),_0x2372b1===0x0?_0x53de9d(0x26b):_0x53de9d(0x18e)));}),{'ok':!![]};}function _0x4d21f6(){const _0x24d554=_0x5b0699;return _0x81d817&&(_0x81d817[_0x24d554(0x2a2)](),_0x81d817=null),{'ok':!![]};}function _0x51e541(){const _0x3f4276=_0x5b0699;for(const _0x2cb9aa of _0x52a7a1['values']()){_0x1498ba(_0x2cb9aa),_0x2cb9aa['process']?.[_0x3f4276(0x2a2)]();}_0x52a7a1[_0x3f4276(0x222)]();for(const _0x5a55b2 of _0x15d7f3['values']()){_0x562707(_0x5a55b2);}_0x15d7f3[_0x3f4276(0x222)]();for(const _0xd19612 of _0x49c39e[_0x3f4276(0x227)]()){_0x52de49(_0xd19612),_0x4df2c7(_0xd19612),_0xd19612['process']?.[_0x3f4276(0x2a2)]();}_0x49c39e['clear'](),_0x81d817&&(_0x81d817[_0x3f4276(0x2a2)](),_0x81d817=null);}return{'saveFeishuChannelConfig':_0x23ea2d,'saveQqbotChannelConfig':_0x5d85e0,'saveWecomChannelConfig':_0x55e9aa,'saveQqMailConnectorConfig':_0x3bc8c6,'saveNetEaseMailConnectorConfig':_0x263b46,'saveTencentExmailConnectorConfig':_0xf98631,'saveFeishuDocConnectorConfig':_0x571874,'saveTencentDocsConnectorConfig':_0x3c44df,'saveKdocsConnectorConfig':_0x3bb8bc,'saveDingtalkDocConnectorConfig':_0x5ccbcf,'readConfigSnapshot':_0x3f917e,'startKdocsCliConnectSession':_0xd1e150,'getKdocsCliConnectStatus':_0x4fe16c,'cancelKdocsCliConnectSession':_0x39f3bb,'startFeishuDocCliConnectSession':_0x44f6c7,'getFeishuDocCliConnectStatus':_0x226bb0,'cancelFeishuDocCliConnectSession':_0x8b37a3,'completeFeishuDocCliConnectSession':_0x5c28b0,'startFeishuRegistrationSession':_0x5ae86d,'getFeishuRegistrationStatus':_0x129af7,'cancelFeishuRegistrationSession':_0x252f0d,'listImChannelConfigs':_0x2032ae,'deleteImChannelConfig':_0x2218ba,'setImChannelEnabled':_0x2a56ab,'startWechatChannelSession':_0x5ce0c1,'cancelWechatChannelSession':_0x4d21f6,'dispose':_0x51e541};}
|
|
@@ -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 _0x572e21=_0x2bd8;(function(_0x2385f6,_0x7cde73){const _0x51137f=_0x2bd8,_0xfeb6ea=_0x2385f6();while(!![]){try{const _0x2223fc=parseInt(_0x51137f(0x167))/0x1+-parseInt(_0x51137f(0x152))/0x2*(parseInt(_0x51137f(0x17c))/0x3)+parseInt(_0x51137f(0x144))/0x4*(-parseInt(_0x51137f(0x186))/0x5)+parseInt(_0x51137f(0x134))/0x6+parseInt(_0x51137f(0x143))/0x7*(-parseInt(_0x51137f(0x145))/0x8)+-parseInt(_0x51137f(0x15a))/0x9+parseInt(_0x51137f(0x171))/0xa;if(_0x2223fc===_0x7cde73)break;else _0xfeb6ea['push'](_0xfeb6ea['shift']());}catch(_0xe82e5a){_0xfeb6ea['push'](_0xfeb6ea['shift']());}}}(_0x131a,0x4c2dd));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??_0x572e21(0x16f)+_0x572e21(0x131)+_0x572e21(0x17d)+_0x572e21(0x18c)+'/pro')[_0x572e21(0x194)](/\/$/,''),DOWNLOAD_TIMEOUT_MS=0xf*0x3c*0x3e8;async function runProcess(_0x1fd26b,_0x4082ee,_0x5da85f={}){const _0x1b9feb=_0x572e21,{spawn:_0x1a950a}=await import(_0x1b9feb(0x138)+_0x1b9feb(0x184)+'ss'),_0x33de70=_0x5da85f[_0x1b9feb(0x14c)]||[_0x1fd26b,..._0x4082ee][_0x1b9feb(0x169)]('\x20'),_0x17bab7=_0x5da85f[_0x1b9feb(0x173)+'s']??DOWNLOAD_TIMEOUT_MS;return await new Promise((_0x135fbd,_0x119c33)=>{const _0x4e4149=_0x1b9feb,_0x541281=_0x1a950a(_0x1fd26b,_0x4082ee,{'cwd':_0x5da85f[_0x4e4149(0x15f)],'env':_0x5da85f['env'],'stdio':['ignore','pipe',_0x4e4149(0x161)]});let _0xb6e5ba='',_0x4ecaf6='';const _0x3b2f9b=setTimeout(()=>{const _0x789b05=_0x4e4149;_0x541281[_0x789b05(0x130)](_0x789b05(0x14d)),_0x119c33(new Error(_0x33de70+(_0x789b05(0x168)+_0x789b05(0x148)+'\x20')+_0x17bab7+'ms'));},_0x17bab7);_0x541281[_0x4e4149(0x157)]['on'](_0x4e4149(0x137),_0x11d356=>{const _0x1d6656=_0x4e4149;_0xb6e5ba+=_0x11d356[_0x1d6656(0x174)]();}),_0x541281[_0x4e4149(0x146)]['on'](_0x4e4149(0x137),_0x53f035=>{const _0x25d003=_0x4e4149;_0x4ecaf6+=_0x53f035[_0x25d003(0x174)]();}),_0x541281['on'](_0x4e4149(0x13d),_0x2d4a31=>{clearTimeout(_0x3b2f9b),_0x119c33(_0x2d4a31);}),_0x541281['on'](_0x4e4149(0x13b),_0x1c12fc=>{const _0x4245bd=_0x4e4149;clearTimeout(_0x3b2f9b);if(_0x1c12fc===0x0)_0x135fbd({'stdout':_0xb6e5ba,'stderr':_0x4ecaf6,'code':_0x1c12fc});else _0x119c33(new Error(_0x33de70+('\x20failed\x20'+_0x4245bd(0x181)+'e\x20')+_0x1c12fc+':\x20'+(_0x4ecaf6||_0xb6e5ba)));});});}function _0x2bd8(_0x3135a4,_0x55d55c){_0x3135a4=_0x3135a4-0x12c;const _0x131a5a=_0x131a();let _0x2bd848=_0x131a5a[_0x3135a4];return _0x2bd848;}async function downloadFile(_0x8667fa,_0x484114){await mkdir(dirname(_0x484114),{'recursive':!![]});const _0x1daf29=await new Promise((_0x3394c3,_0xbdf720)=>{const _0x338784=_0x2bd8,_0x1f157d=get(_0x8667fa,_0x27fef4=>{const _0x286465=_0x2bd8;if([0x12d,0x12e,0x12f,0x133,0x134]['includes'](_0x27fef4[_0x286465(0x195)+'de']||0x0)&&_0x27fef4[_0x286465(0x14a)][_0x286465(0x16c)]){_0x27fef4[_0x286465(0x149)](),downloadFile(new URL(_0x27fef4[_0x286465(0x14a)][_0x286465(0x16c)],_0x8667fa)[_0x286465(0x14f)],_0x484114)[_0x286465(0x142)](()=>_0x3394c3(null))['catch'](_0xbdf720);return;}if((_0x27fef4[_0x286465(0x195)+'de']||0x0)>=0x190){_0x27fef4[_0x286465(0x149)](),_0xbdf720(new Error(_0x286465(0x162)+_0x286465(0x17a)+_0x27fef4[_0x286465(0x195)+'de']+':\x20'+_0x8667fa));return;}_0x3394c3(_0x27fef4);});_0x1f157d['on'](_0x338784(0x13d),_0xbdf720);});if(!_0x1daf29)return;await pipeline(_0x1daf29,createWriteStream(_0x484114));}async function findRuntimeKdocsCliBin(_0x373a00){const _0x505072=_0x572e21,_0x37e1f0=join(_0x373a00[_0x505072(0x18d)+_0x505072(0x133)+'ir'],_0x505072(0x147),'kdocs-cl'+'i'),_0x4ee288=join(_0x37e1f0,process[_0x505072(0x19c)]==='win32'?_0x505072(0x14e)+_0x505072(0x14b):'kdocs-cl'+'i');return{'installDir':_0x37e1f0,'binPath':existsSync(_0x4ee288)?_0x4ee288:null};}export async function resolveRuntimeKdocsCliCommand(_0x465ca0){const _0x5d621f=_0x572e21,{installDir:_0x214836,binPath:_0xad8651}=await findRuntimeKdocsCliBin(_0x465ca0);if(!_0xad8651||!existsSync(_0xad8651))throw new Error(_0x5d621f(0x165)+'kdocs-cl'+_0x5d621f(0x199)+_0x5d621f(0x13f)+_0x5d621f(0x15e)+_0x5d621f(0x139)+'me:\x20'+_0x214836+(_0x5d621f(0x196)+_0x5d621f(0x170)+_0x5d621f(0x155)+'re\x22\x20to\x20r'+'ebuild\x20t'+_0x5d621f(0x15b)+_0x5d621f(0x12d)));return{'executablePath':_0xad8651,'installDir':_0x214836};}function toKdocsCliPlatform(_0xed33df){if(_0xed33df==='win32')return'windows';return _0xed33df;}function toKdocsCliArch(_0x4df887){const _0x3af351=_0x572e21;if(_0x4df887===_0x3af351(0x12e))return'amd64';return _0x4df887;}async function resolveKdocsSkillVersion(_0x77d0fc){const _0x54ae4c=_0x572e21,_0xad1166=_0x77d0fc[_0x54ae4c(0x18d)]['resolved'+'LocalSki'+_0x54ae4c(0x182)]??[],_0x45e3bb=[];for(const _0x29a19c of _0xad1166){if(!existsSync(_0x29a19c))continue;_0x45e3bb[_0x54ae4c(0x15c)](join(_0x29a19c,_0x54ae4c(0x178))),_0x45e3bb['push'](...(await readdir(_0x29a19c,{'withFileTypes':!![]}))[_0x54ae4c(0x150)](_0x555b47=>_0x555b47['isDirect'+'ory']())[_0x54ae4c(0x198)](_0x5924bc=>join(_0x29a19c,_0x5924bc[_0x54ae4c(0x160)],'SKILL.md')));}for(const _0x3eef22 of _0x45e3bb){if(!existsSync(_0x3eef22))continue;const _0x2d7ef5=await readFile(_0x3eef22,_0x54ae4c(0x154));if(!/^name:\s*kdocs\s*$/m[_0x54ae4c(0x19b)](_0x2d7ef5))continue;const _0x17040b=_0x2d7ef5[_0x54ae4c(0x188)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x17040b?.[0x1])return _0x17040b[0x1];}throw new Error(_0x54ae4c(0x17f)+_0x54ae4c(0x189)+_0x54ae4c(0x12c)+_0x54ae4c(0x18a)+_0x54ae4c(0x13e)+_0x54ae4c(0x175)+_0xad1166[_0x54ae4c(0x169)](',\x20'));}export async function hasConfiguredKdocsSkill(_0x37e5ee){const _0x272563=_0x572e21,_0x672d33=_0x37e5ee[_0x272563(0x18d)][_0x272563(0x13c)+_0x272563(0x172)+'llPaths']??[],_0x5df44f=[];for(const _0x101372 of _0x672d33){if(!existsSync(_0x101372))continue;_0x5df44f[_0x272563(0x15c)](join(_0x101372,_0x272563(0x178))),_0x5df44f[_0x272563(0x15c)](...(await readdir(_0x101372,{'withFileTypes':!![]}))[_0x272563(0x150)](_0x229c06=>_0x229c06[_0x272563(0x185)+_0x272563(0x18e)]())['map'](_0x147b7a=>join(_0x101372,_0x147b7a[_0x272563(0x160)],_0x272563(0x178))));}for(const _0x202e3d of _0x5df44f){if(!existsSync(_0x202e3d))continue;const _0x5ccb21=await readFile(_0x202e3d,'utf8');if(/^name:\s*kdocs\s*$/m[_0x272563(0x19b)](_0x5ccb21))return!![];}return![];}export const __test__={'hasConfiguredKdocsSkill':hasConfiguredKdocsSkill,'resolveKdocsSkillVersion':resolveKdocsSkillVersion};function _0x131a(){const _0x24e739=['.source','runtimeL','pid','replace','statusCo','.\x20Run\x20\x22w','ell-runt','map','i\x20is\x20mis','[wujie-s','test','platform','e\x20kdocs\x20','me.','x64','ct-','kill','wpsai.wp','\x20not\x20fou','WorkingD','1554702JONhnz','runtimeR','i\x20instal','data','node:chi','aw\x20runti','unzip','close','resolved','error','rsion\x20fr','sing\x20fro','ogger','trim','then','16044xtBJFe','16onNzox','936QqOUnI','stderr','tools','ut\x20after','resume','headers','i.exe','label','SIGTERM','kdocs-cl','href','filter','led','2284yaDUyB','.zip','utf8','ll\x20prepa','arch','stdout','extract\x20','i\x20binary','4326120nLEDyd','he\x20runti','push','now','m\x20OpenCl','cwd','name','pipe','download','tar','info','Bundled\x20','.kdocs-c','431996UmIndm','\x20timed\x20o','join','li-extra','win32','location','isFile','.cache','https://','ujie-she','13251900aQSceJ','LocalSki','timeoutM','toString','om\x20','hell:run','ime\x0a','SKILL.md','i\x20versio','\x20failed\x20','chive:\x20','1053PHvjwX','scdn.cn/','time]\x20do','Unable\x20t','log','with\x20cod','llPaths','wnloadin','ld_proce','isDirect','693235MkSXGj','wujie-sh','match','o\x20resolv','skill\x20ve','oot','skillhub','openclaw','ory','version','-xzf'];_0x131a=function(){return _0x24e739;};return _0x131a();}function findFileByName(_0x1e0c72,_0x4dd6b8){const _0x4299c9=_0x572e21;if(!existsSync(_0x1e0c72))return null;for(const _0x16d997 of readdirSync(_0x1e0c72,{'withFileTypes':!![]})){const _0x830a28=join(_0x1e0c72,_0x16d997[_0x4299c9(0x160)]);if(_0x16d997[_0x4299c9(0x185)+_0x4299c9(0x18e)]()){const _0xe9da97=findFileByName(_0x830a28,_0x4dd6b8);if(_0xe9da97)return _0xe9da97;continue;}if(_0x16d997[_0x4299c9(0x16d)]()&&_0x16d997['name']===_0x4dd6b8)return _0x830a28;}return null;}export async function installKdocsCliBinary(_0x2f8166,_0x4e43eb,_0xac43a={}){const _0x515da4=_0x572e21,_0x47bf35=await resolveKdocsSkillVersion(_0x2f8166),_0x3f41f3=toKdocsCliPlatform(process['platform']),_0x10b677=toKdocsCliArch(process[_0x515da4(0x156)]),_0x1f3a3f=process[_0x515da4(0x19c)]===_0x515da4(0x16b)?_0x515da4(0x14e)+_0x515da4(0x14b):'kdocs-cl'+'i',_0x219b4a=join(_0x4e43eb[_0x515da4(0x18d)+_0x515da4(0x133)+'ir'],_0x515da4(0x147),'kdocs-cl'+'i'),_0x384b94=join(_0x219b4a,_0x1f3a3f);if(existsSync(_0x384b94))try{const _0x267f31=(await runProcess(_0x384b94,[_0x515da4(0x18f)],{'label':'kdocs-cl'+_0x515da4(0x179)+'n','timeoutMs':0x7530}))[_0x515da4(0x157)][_0x515da4(0x141)]();if(_0x267f31===_0x47bf35){_0xac43a[_0x515da4(0x192)+_0x515da4(0x140)]?.[_0x515da4(0x164)]('kdocs-cl'+'i\x20alread'+'y\x20instal'+_0x515da4(0x151),{'version':_0x47bf35,'installDir':_0x219b4a});return;}}catch{}const _0x5e064e=_0x3f41f3==='windows'?_0x515da4(0x153):'.tar.gz',_0x11838a=_0x515da4(0x14e)+'i-'+_0x47bf35+'-'+_0x3f41f3+'-'+_0x10b677+_0x5e064e,_0x2c5796=join(_0x4e43eb[_0x515da4(0x135)+_0x515da4(0x18b)],_0x515da4(0x16e)),_0x2c05d5=join(_0x2c5796,_0x11838a),_0x56220f=join(_0x4e43eb[_0x515da4(0x135)+'oot'],_0x515da4(0x166)+_0x515da4(0x16a)+_0x515da4(0x12f)+process[_0x515da4(0x193)]+'-'+Date[_0x515da4(0x15d)]()),_0x51660b=KDOCS_CLI_CDN_BASE+'/v'+_0x47bf35+('/release'+'s/')+_0x11838a;await mkdir(_0x2c5796,{'recursive':!![]});!existsSync(_0x2c05d5)&&(console[_0x515da4(0x180)](_0x515da4(0x19a)+_0x515da4(0x176)+_0x515da4(0x17e)+_0x515da4(0x183)+'g\x20'+_0x51660b),await downloadFile(_0x51660b,_0x2c05d5));await rm(_0x56220f,{'recursive':!![],'force':!![]}),await mkdir(_0x56220f,{'recursive':!![]});_0x2c05d5['endsWith'](_0x515da4(0x153))?await runProcess(_0x515da4(0x13a),['-q',_0x2c05d5,'-d',_0x56220f],{'label':_0x515da4(0x158)+_0x11838a}):await runProcess(_0x515da4(0x163),[_0x515da4(0x190),_0x2c05d5,'-C',_0x56220f],{'label':_0x515da4(0x158)+_0x11838a});const _0xa916bd=findFileByName(_0x56220f,_0x1f3a3f);if(!_0xa916bd)throw new Error(_0x515da4(0x14e)+_0x515da4(0x159)+_0x515da4(0x132)+'nd\x20in\x20ar'+_0x515da4(0x17b)+_0x11838a);await rm(_0x219b4a,{'recursive':!![],'force':!![]}),await mkdir(_0x219b4a,{'recursive':!![]}),await cp(_0xa916bd,_0x384b94);if(process[_0x515da4(0x19c)]!=='win32')await chmod(_0x384b94,0x1ed);await writeFile(join(_0x219b4a,_0x515da4(0x191)),_0x515da4(0x187)+_0x515da4(0x197)+_0x515da4(0x177),'utf8'),await rm(_0x56220f,{'recursive':!![],'force':!![]}),_0xac43a[_0x515da4(0x192)+'ogger']?.[_0x515da4(0x164)](_0x515da4(0x14e)+_0x515da4(0x136)+_0x515da4(0x151),{'version':_0x47bf35,'installDir':_0x219b4a,'binPath':_0x384b94});}
|