@wujie-shell/core 2.0.1 → 2.0.2
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/README.md +3 -3
- 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/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/plugin-sync.mjs +1 -1
- package/dist/src/sessions/agent-sessions-map-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/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x1a9b2e,_0x2c1896){const _0x2b7244=_0xc852,_0xad95d9=_0x1a9b2e();while(!![]){try{const _0x1e627a=parseInt(_0x2b7244(0x22f))/0x1*(-parseInt(_0x2b7244(0x27b))/0x2)+-parseInt(_0x2b7244(0x181))/0x3*(parseInt(_0x2b7244(0xce))/0x4)+parseInt(_0x2b7244(0x2a8))/0x5+-parseInt(_0x2b7244(0x129))/0x6*(parseInt(_0x2b7244(0x1c4))/0x7)+parseInt(_0x2b7244(0x105))/0x8*(-parseInt(_0x2b7244(0xdf))/0x9)+-parseInt(_0x2b7244(0x182))/0xa+parseInt(_0x2b7244(0x233))/0xb;if(_0x1e627a===_0x2c1896)break;else _0xad95d9['push'](_0xad95d9['shift']());}catch(_0x99b8e3){_0xad95d9['push'](_0xad95d9['shift']());}}}(_0x88a4,0xd2388));import{spawn}from'node:child_process';function _0xc852(_0x382915,_0x2ffdea){_0x382915=_0x382915-0xc3;const _0x88a483=_0x88a4();let _0xc852a1=_0x88a483[_0x382915];return _0xc852a1;}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(_0x1af5a0){const _0x724253=_0xc852;return typeof _0x1af5a0===_0x724253(0x21f)?_0x1af5a0[_0x724253(0x13f)]():'';}function findDingtalkDocMcpServer(_0x31eb14){const _0xe36a94=_0xc852,_0x14f8e1=asRecord(_0x31eb14[DINGTALK_DOC_MCP_SERVER_NAME]);if(Object[_0xe36a94(0x1fa)](_0x14f8e1)[_0xe36a94(0x116)]>0x0)return _0x14f8e1;for(const [_0x8961a2,_0x49b6e3]of Object[_0xe36a94(0x281)](_0x31eb14)){const _0x4dec14=asRecord(_0x49b6e3),_0x2a0e72=getTrimmedString(_0x8961a2)[_0xe36a94(0x154)+_0xe36a94(0x1ae)](),_0x35148a=getTrimmedString(_0x4dec14['url'])['toLowerC'+_0xe36a94(0x1ae)]();if(_0x2a0e72[_0xe36a94(0x1ac)](_0xe36a94(0x26e))||_0x2a0e72[_0xe36a94(0x1ac)](_0xe36a94(0x158))||_0x2a0e72[_0xe36a94(0x1ac)]('钉钉')||_0x35148a['includes'](_0xe36a94(0x26e))||_0x35148a[_0xe36a94(0x1ac)]('dingding'))return _0x4dec14;}return{};}function _0x88a4(){const _0x405602=['now','正在验证飞书授权','Connecto','sage','ion\x20id\x20i','code,请重试','onMode','omplete','json','timeoutM','\x20plugin\x20','transpor','gin\x20dele','ill\x20','slow_dow','ctor\x20del','ector\x20de','EXPIRED','/page/sc','replace','飞书机器人','search:d','ocr','_id','ccess','deleteMc','http:','oc\x20CLI\x20s','output','function','auth','poll','lugin\x20de','飞书\x20CLI\x20执','\x20或\x20devic','et\x20auth.','--app-se','includes','usTimer','ase','rcode','groupAll','p\x20URL','lient','验证超时','eCode','complete','tration\x20','飞书绑定失败:','identity','Entry','Feishu\x20d','企微助手\x20Bot','WujieAI','expired_','skill','qq_mail','boolean','igSnapsh','ted','权状态验证超时','231gORFha','ill\x20enab','n\x20respon','ill\x20conn','onfig','企微助手\x20Sec','\x20is\x20requ','id\x20is\x20re','exists','plugins','openclaw','--device','权状态不符合用户','apiKey','se.','interval','uired','当前飞书开放平台','返回授权\x20URL','hint','wujie.ai','export','delete','wechat-l','spawn','logged\x20i','docs\x20ski','kdocs','tus','netease\x20','process','tion_uri','bind','Channel\x20','\x20connect','login\x20--','onfig\x20up','hannel\x20c','nfig\x20del','rvalMs','search','tatus','oc\x20conne','ector','usStarte','setSkill','botId','already\x20','飞书\x20CLI\x20应','onfigPat','lePath','nector\x20p','xOf','open','keys','appSecre','login','deleteSk','ation_pe','--channe','HTTPS_PR','ode','data','feishu_d','deviceCo','gin\x20upda','连接成功','clear','ecret','SUCCESS','identiti','status','飞书应用创建超时','正在打开飞书用户','error_de','appId','ll\x20conne','cliAppId','appExpir','quired','金山文档授权状态','cret','feishu-d','appDevic','accountN','\x20in\x20begi','map','then','金山文档登录启动','ion\x20not\x20','resolveS','string','<empty>','失,无法初始化','docs-cli','ated','elConfig','docs,dri','streamab','onfig\x20de','prototyp','...(','response','li_user','r-log','金山文档','entry','1681127HSsYQc','create','kdocs-cl','secret','47743311jObVOe','update',',请先完成\x20kd','setChann','wecom\x20ch','verify','飞书\x20CLI\x20用','eamableH','required','\x20channel','nodeExec','飞书开放平台应用','ttp\x20URL\x20','allowFro','Login\x20su','账号\x20is\x20re','mail','spawn\x20op','tencent\x20','https_pr','persistC','ready','失败,请确认\x20k','account','push','\x20已安装','飞书\x20CLI\x20连','scanned','env','cliHostC','\x20exited\x20','微信连接插件,请','errorMes','rlencode','ion_url','Data','的新版客户端','QR_READY','client_s','websocke','山文档授权','catch','pollInte','ope-auth','.json',',请重新连接','groupPol','disabled','nConfig','valid','授权码\x20is\x20r','qqbot\x20ch','enclaw\x20c','feishu\x20d','二维码已过期,请','flow_id','projectR','dAt','eted','dingtalk','egistrat','飞书应用已创建,','\x20not\x20sup','led','rver','com','d\x20auth','mcp','access_d','values','ing','begin','2YLXkOr','QQ机器人\x20Ap','lark-cli','with\x20cod','imap.163','飞书绑定失败','entries','1.0.0','supporte','正在检查飞书\x20C','HTTP\x20','stdout','ion_uri','--no-wai','owFrom','red','QQ\x20邮箱','验证失败','cliAppSe','accounts','oxy','channelI','n?flow_i','ecret\x20应用','nding','error','ired','wechat','orizatio','expired','name','verifyTi','purpose','feishu','check','ion_flow','logout','connecti','timeout','doc_conn','env:\x20','\x22\x20not\x20fo','channel','行失败','Agent','6779415pazSin','企微助手','钉钉文档\x20Str','rnal','--scope','飞书应用创建失败','slides,b','ocs-cli\x20','close','illEntry','fig','ot\x20found','Unsuppor','skills','client_i','scriptio','join','enabled','ternally','1/app/re','imap.qq.','r\x20plugin','find','get','hu\x20regis','完成应用创建','kill','ationUri','annel\x20co','授权状态','share','timer','_doc','d_auth_m','is\x20requi','Personal','金山文档尚未授权','cess','set','imap.exm','\x20chars)','executab','ession\x20i','_complet','mableHtt','smtp.exm','当前客户端未内置','ation_ur','channels','正在验证金山文档','availabl','ion\x20sess','HTTP_PRO','Local\x20lo','4OIvXmj','n\x20update','zationCo','appPollI','请在浏览器完成金','kdocs\x20sk','utf8','登录成功','QQ助手','飞书机器人\x20Ap','message','飞书\x20CLI\x20未','\x20device_','init','正在进入用户授权','dmPolicy','\x20doc\x20mcp','9KFFAcJ','tencent_','ocs:read','operty','POST','slice','\x20config\x20','Invalid\x20','deleteCh','i:keycha','config','setMcpSe','appTimer','ion_uri_','飞书\x20CLI\x20授','igRaw','onnector','ame','腾讯文档','ll\x20updat','connecto','--versio','plugin','once','n\x20not\x20fo','ion/x-ww','netease_','user','wechat-s','openExte','飞书用户身份',',sheets,','allow','Scan\x20suc','docs','setPlugi','权状态验证失败',':authori','7477912VZkFXR','assign','annelCon','腾讯企业邮箱','ctor\x20plu','https:','ession\x20n','max','金山文档已连接','腾讯文档\x20Key','无需重复连接','filter','ERROR','expire_i','onFailur','client','文档\x20Strea','length','mail\x20con','call','tionUriC','all_prox','thorizat','gin\x20save','user_inf','isArray','Failed','e_code:\x20','toString','pluginId','.com','code','stringif','match','ethods','--domain','135840ocGZdK','飞书用户身份授权','已扫描','已连接过','回应用创建页面或','Error','Current\x20','utable','用绑定失败','authStat','icy','qqbot','stdin','protocol','port\x20cli','请在飞书开放平台','url','support@','leted','appPollC','pending','object','trim','clientSe','qq\x20mail\x20','--force-','环境不支持创建\x20','le-http','or\x20plugi','end','--brand','ve,markd','scope_au','wechat-q','authoriz','.opencla','ntervalM','fresh','import','\x20deleted','open_id','重新生成','parse','toLowerC','wecom','d\x20is\x20req','phase','dingding','own,wiki','mer','oc-cli','lastInde','接失败','-weixin','full','feishu\x20c','equired','pSecret\x20','nfig\x20upd','用户已取消飞书机','ent_secr','\x20updated','headers','test','und','e\x20or\x20dev','found','feishu_c','otRaw','deleted','安装包含微信插件','exmail\x20c','environm','Kdocs\x20CL','r\x20\x22','sessionI','163\x20邮箱','applicat','expiresA','enied','/oauth/v','tateDir','I\x20sessio','ogin','pServer','pID\x20is\x20r','read','verifica','3852375uzSxcj','1880090hhFEpO','stderr','device_c','connecte','footer'];_0x88a4=function(){return _0x405602;};return _0x88a4();}function createFeishuRegistrationClient(){const _0xae7516=_0xc852,_0x39a7e6=FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV];if(!_0x39a7e6)throw new Error(_0xae7516(0x2b4)+'ted\x20Feis'+_0xae7516(0x2c0)+_0xae7516(0x1b6)+_0xae7516(0x2a3)+DEFAULT_FEISHU_REGISTRATION_ENV);return{'baseUrl':_0x39a7e6,'headers':{'Content-Type':_0xae7516(0x176)+_0xae7516(0xf8)+'w-form-u'+_0xae7516(0x254)+'d'},'timeoutMs':DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS};}async function postFeishuRegistration(_0x28748a,_0x4932da){const _0x2578bf=_0xc852,_0x39f8e4=await fetch(_0x28748a['baseUrl']+(_0x2578bf(0x179)+_0x2578bf(0x2bb)+'gistrati'+'on'),{'method':_0x2578bf(0xe3),'headers':_0x28748a[_0x2578bf(0x167)],'body':new URLSearchParams(_0x4932da)[_0x2578bf(0x121)](),'signal':AbortSignal[_0x2578bf(0x2a1)](_0x28748a[_0x2578bf(0x190)+'s'])}),_0x3ea338=await _0x39f8e4[_0x2578bf(0x18f)]()[_0x2578bf(0x25c)](()=>({}));if(!_0x39f8e4['ok']){const _0x4ec993=new Error(_0x2578bf(0x285)+_0x39f8e4[_0x2578bf(0x20b)]);_0x4ec993['response'+_0x2578bf(0x256)]=_0x3ea338;throw _0x4ec993;}return asRecord(_0x3ea338);}async function initFeishuRegistration(_0x4c1c0f){const _0x22e10e=_0xc852;return postFeishuRegistration(_0x4c1c0f,{'action':_0x22e10e(0xdb)});}async function beginFeishuRegistration(_0x4032b4){const _0x4df7b8=_0xc852;return postFeishuRegistration(_0x4032b4,{'action':_0x4df7b8(0x27a),'archetype':_0x4df7b8(0x2cb)+_0x4df7b8(0x2a7),'auth_method':_0x4df7b8(0x259)+_0x4df7b8(0x208),'request_user_info':_0x4df7b8(0x151)});}async function pollFeishuRegistration(_0x5c3fa5,_0x23d55c){const _0x38386d=_0xc852;try{return await postFeishuRegistration(_0x5c3fa5,{'action':_0x38386d(0x1a6),'device_code':_0x23d55c});}catch(_0x456d7c){if(_0x456d7c?.[_0x38386d(0x22a)+_0x38386d(0x256)]&&typeof _0x456d7c[_0x38386d(0x22a)+_0x38386d(0x256)]===_0x38386d(0x13e))return asRecord(_0x456d7c[_0x38386d(0x22a)+_0x38386d(0x256)]);throw _0x456d7c;}}function extractFeishuRegistrationAuthorizationUri(_0x2f3937){const _0x462120=_0xc852,_0x532fd7=getTrimmedString(_0x2f3937[_0x462120(0x14b)+_0x462120(0xc7)+'i_comple'+'te'])||getTrimmedString(_0x2f3937[_0x462120(0x14b)+_0x462120(0xc7)+'i'])||getTrimmedString(_0x2f3937['scope_au'+'thorizat'+_0x462120(0xec)+_0x462120(0x1b5)])||getTrimmedString(_0x2f3937[_0x462120(0x149)+'thorizat'+_0x462120(0x287)])||getTrimmedString(_0x2f3937[_0x462120(0x149)+'thorizat'+_0x462120(0x255)])||getTrimmedString(_0x2f3937[_0x462120(0x14b)+_0x462120(0xc7)+'l']);if(_0x532fd7)return _0x532fd7;const _0x4f114a=getTrimmedString(_0x2f3937[_0x462120(0x26a)])||getTrimmedString(_0x2f3937[_0x462120(0x149)+_0x462120(0x11b)+_0x462120(0x29e)+_0x462120(0x19e)]);return _0x4f114a?FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV]+(_0x462120(0x199)+_0x462120(0x25e)+_0x462120(0x297)+_0x462120(0x291)+'d=')+encodeURIComponent(_0x4f114a):null;}function serializeFeishuRegistrationSession(_0x29706e){const _0x551e14=_0xc852;return{'sessionId':_0x29706e[_0x551e14(0x174)+'d'],'verificationUriComplete':_0x29706e[_0x551e14(0x180)+_0x551e14(0x119)+_0x551e14(0x18e)],'expiresAt':new Date(_0x29706e[_0x551e14(0x177)+'t'])['toISOStr'+_0x551e14(0x279)](),'pollIntervalMs':_0x29706e[_0x551e14(0x25d)+_0x551e14(0x1eb)],'status':_0x29706e[_0x551e14(0x20b)],'errorMessage':_0x29706e[_0x551e14(0x253)+_0x551e14(0x18a)],'purpose':_0x29706e[_0x551e14(0x29b)],'authorizationUri':_0x29706e[_0x551e14(0x14b)+'ationUri']};}function extractFirstUrl(_0x24d742){const _0x9e64e4=_0xc852,_0x38db3f=_0x24d742[_0x9e64e4(0x126)](/https?:\/\/[^\s"'<>]+/i);return _0x38db3f?_0x38db3f[0x0]:null;}function isKdocsAuthStatusReady(_0x360247){const _0x205185=_0xc852,_0x10c744=_0x360247[_0x205185(0x154)+'ase']();if(/not\s+login|not\s+logged|unauth|未登录|未认证|未授权|失败/[_0x205185(0x168)](_0x10c744))return![];return/login|logged|auth|valid|success|已登录|已认证|已授权|有效|成功/['test'](_0x10c744);}function parseFeishuDocCliJson(_0x7f764a){const _0x883177=_0xc852,_0x442f2d=_0x7f764a['trim']();if(!_0x442f2d)return{};try{return asRecord(JSON['parse'](_0x442f2d));}catch{for(let _0x3fc034=_0x442f2d['indexOf']('{');_0x3fc034>=0x0;_0x3fc034=_0x442f2d['indexOf']('{',_0x3fc034+0x1)){for(let _0x5da312=_0x442f2d[_0x883177(0x15c)+_0x883177(0x1f8)]('}');_0x5da312>_0x3fc034;_0x5da312=_0x442f2d[_0x883177(0x15c)+_0x883177(0x1f8)]('}',_0x5da312-0x1)){try{return asRecord(JSON[_0x883177(0x153)](_0x442f2d['slice'](_0x3fc034,_0x5da312+0x1)));}catch{}}}return{};}}function summarizeCliOutput(_0x4c8b2b){const _0x2d8c39=_0xc852,_0x226e53=_0x4c8b2b[_0x2d8c39(0x13f)]();if(!_0x226e53)return _0x2d8c39(0x220);return _0x226e53['length']>0x320?_0x226e53[_0x2d8c39(0xe4)](0x0,0x320)+_0x2d8c39(0x229)+_0x226e53[_0x2d8c39(0x116)]+_0x2d8c39(0x2d0):_0x226e53;}function extractFeishuDocCliError(_0x47f497,_0x1d6536){const _0x54af6a=_0xc852,_0x155cc5=parseFeishuDocCliJson(_0x47f497),_0x55ea2e=asRecord(_0x155cc5[_0x54af6a(0x294)]),_0x514ad3=getTrimmedString(_0x55ea2e[_0x54af6a(0xd8)]),_0x45f318=getTrimmedString(_0x55ea2e[_0x54af6a(0x1d7)]);if(_0x514ad3&&_0x45f318)return _0x514ad3+'\x0a'+_0x45f318;if(_0x514ad3)return _0x514ad3;return _0x47f497[_0x54af6a(0x13f)]()||_0x1d6536;}function getFeishuDocCliFailureMessage(_0x1691bb,_0x565e25,_0xe75012){const _0x599b07=_0xc852,_0x146834=_0x565e25['trim']()['split']('\x0a')['slice'](-0x8)[_0x599b07(0x2b8)]('\x0a')[_0x599b07(0x13f)](),_0x373a0a=_0x1691bb==='create'?_0x599b07(0x23e)+'创建失败':_0x1691bb===_0x599b07(0x1e4)?_0x599b07(0x1f4)+_0x599b07(0x131):_0x1691bb===_0x599b07(0x1a5)?_0x599b07(0x239)+'户授权失败':_0x599b07(0xed)+_0x599b07(0x103);return _0x146834?_0x373a0a+':\x20'+_0x146834:_0x373a0a+':\x20'+_0xe75012;}function ensureFeishuDocCliUserStatus(_0x4fc19e){const _0x253640=_0xc852,_0x5ee904=parseFeishuDocCliJson(_0x4fc19e),_0x32f0a6=asRecord(_0x5ee904[_0x253640(0x20a)+'es']),_0xa3320c=asRecord(_0x32f0a6[_0x253640(0xfa)]),_0x5a47ab=getTrimmedString(_0x5ee904[_0x253640(0x1b8)]),_0x2ce87c=getTrimmedString(_0x5ee904['tokenSta'+_0x253640(0x1e0)])||getTrimmedString(_0xa3320c['tokenSta'+_0x253640(0x1e0)]),_0x3cd402=getTrimmedString(_0xa3320c[_0x253640(0x20b)]),_0x54ab8b=_0xa3320c[_0x253640(0xca)+'e']===!![];if(_0x5a47ab!==_0x253640(0xfa)||_0x3cd402&&_0x3cd402!==_0x253640(0x248)||Object[_0x253640(0x1fa)](_0xa3320c)[_0x253640(0x116)]>0x0&&!_0x54ab8b||_0x2ce87c!==_0x253640(0x264)&&_0x2ce87c!=='needs_re'+_0x253640(0x14e))throw new Error(_0x253640(0xed)+_0x253640(0x1d0)+'身份要求:\x20'+_0x4fc19e[_0x253640(0x13f)]());}function createKdocsCliStatus(_0x5e1fe2){const _0xbceb7f=_0xc852;return{'sessionId':_0x5e1fe2['sessionI'+'d'],'status':_0x5e1fe2[_0xbceb7f(0x20b)],'phase':_0x5e1fe2[_0xbceb7f(0x157)],'url':_0x5e1fe2[_0xbceb7f(0x139)],'message':_0x5e1fe2[_0xbceb7f(0xd8)],'errorMessage':_0x5e1fe2[_0xbceb7f(0x253)+_0xbceb7f(0x18a)]};}function createFeishuDocCliStatus(_0x1aedc5){const _0x27e91f=_0xc852;return{'sessionId':_0x1aedc5[_0x27e91f(0x174)+'d'],'status':_0x1aedc5[_0x27e91f(0x20b)],'phase':_0x1aedc5[_0x27e91f(0x157)],'url':_0x1aedc5['url'],'message':_0x1aedc5[_0x27e91f(0xd8)],'errorMessage':_0x1aedc5[_0x27e91f(0x253)+_0x27e91f(0x18a)]};}export function createConnectorController({shellConfig:_0x482635,configController:_0x3aad17,broadcast:_0x3868f8,shell:_0x54639c,getRuntimeSpawnContext:_0x38e3ab,openClawConfigHandlers:openClawConfigHandlers={},resolveRuntimeKdocsCliCommand:_0x4245cc,resolveRuntimeLarkCliCommand:_0x3c9e36}){const _0x35ea73=_0xc852,_0x7c6eef=new Map(),_0x931e4c=new Map(),_0x3c1879=new Map();let _0x2ba560=null;const _0x2d7664=()=>_0x3aad17['readConf'+_0x35ea73(0xee)]();async function _0x17ccc5(_0x8bed95,_0x30c1bb){const _0x6e5239=_0x35ea73;if(typeof openClawConfigHandlers['update']==='function')return openClawConfigHandlers[_0x6e5239(0x234)](_0x132011=>{const _0x4ca5d4=_0x6e5239;for(const _0x2073fd of Object[_0x4ca5d4(0x1fa)](_0x132011)){!Object[_0x4ca5d4(0x228)+'e']['hasOwnPr'+_0x4ca5d4(0xe2)][_0x4ca5d4(0x118)](_0x8bed95,_0x2073fd)&&delete _0x132011[_0x2073fd];}Object[_0x4ca5d4(0x106)](_0x132011,_0x8bed95);},_0x30c1bb);return typeof _0x3aad17[_0x6e5239(0x247)+_0x6e5239(0x1c8)]==='function'?await _0x3aad17[_0x6e5239(0x247)+_0x6e5239(0x1c8)](_0x8bed95,_0x30c1bb):(_0x3aad17['markConf'+'igWriteH'+'andledIn'+_0x6e5239(0x2ba)]?.(),await _0x3aad17['writeCon'+_0x6e5239(0x2b2)](_0x8bed95,_0x30c1bb)),{'ok':!![]};}function _0x326b6e(){const _0x44ebf9=_0x35ea73;return join(_0x3aad17[_0x44ebf9(0x21e)+_0x44ebf9(0x17a)](),_0x44ebf9(0x216)+_0x44ebf9(0x15b));}function _0x12b48f(){const _0xb99771=_0x35ea73;return join(_0x326b6e(),_0xb99771(0x14c)+'w',_0xb99771(0x1ce)+'.json');}async function _0x403451(_0x1bcbed={}){const _0x1e8aa5=_0x35ea73;return _0x38e3ab(_0x482635[_0x1e8aa5(0x26b)+'oot'],_0x1bcbed);}async function _0x24f352(_0x1e3d5f,_0x531bc8){const _0x2acc13=_0x35ea73,{env:_0x57d5f9,runtime:_0x38a115}=await _0x403451({'FORCE_COLOR':'0','HOME':homedir()}),_0x2aa2fe=await _0x4245cc(_0x38a115);return _0x3868f8(_0x2acc13(0xf3)+_0x2acc13(0x22c),{'connector':_0x2acc13(0x1df),'phase':'spawn','message':'kdocs-cl'+'i\x20'+_0x1e3d5f['join']('\x20')}),new Promise((_0x12819c,_0x388042)=>{const _0xc99c69=_0x2acc13,_0x5e5375=spawn(_0x2aa2fe[_0xc99c69(0x2d1)+_0xc99c69(0x1f6)],_0x1e3d5f,{'cwd':homedir(),'env':_0x57d5f9});let _0x5c5ed7='';const _0x18c737=_0x1f3a24=>{const _0x2b0bfa=_0xc99c69,_0x1a9498=_0x1f3a24[_0x2b0bfa(0x121)]('utf8');_0x5c5ed7+=_0x1a9498,_0x3868f8('connecto'+_0x2b0bfa(0x22c),{'connector':_0x2b0bfa(0x1df),'phase':_0x2b0bfa(0x1a3),'message':_0x1a9498});};_0x5e5375[_0xc99c69(0x286)]['on'](_0xc99c69(0x202),_0x18c737),_0x5e5375[_0xc99c69(0x183)]['on'](_0xc99c69(0x202),_0x18c737),_0x5e5375[_0xc99c69(0xf6)](_0xc99c69(0x294),_0x388042),_0x5e5375['once'](_0xc99c69(0x2b0),_0xf1d5df=>_0x12819c({'code':_0xf1d5df,'output':_0x5c5ed7}));if(typeof _0x531bc8==='string')_0x5e5375[_0xc99c69(0x135)][_0xc99c69(0x146)](_0x531bc8);else _0x5e5375[_0xc99c69(0x135)][_0xc99c69(0x146)]();});}async function _0x3d41b8(){const _0x2b169f=_0x35ea73,_0x17287c=await _0x2d7664(),_0x3e3157=asRecord(_0x17287c[_0x2b169f(0x2b5)]),_0xa4576a=asRecord(_0x3e3157[_0x2b169f(0x281)]),_0x18837a={...asRecord(_0xa4576a[KDOCS_SKILL_ID]),'enabled':!![]};if(typeof openClawConfigHandlers[_0x2b169f(0x1f1)+_0x2b169f(0x1b9)]===_0x2b169f(0x1a4)){await openClawConfigHandlers[_0x2b169f(0x1f1)+_0x2b169f(0x1b9)]({'skillId':KDOCS_SKILL_ID,'entry':_0x18837a,'reason':_0x2b169f(0xd3)+_0x2b169f(0x1c5)+_0x2b169f(0x272)});return;}_0xa4576a[KDOCS_SKILL_ID]=_0x18837a,_0x3e3157['entries']=_0xa4576a,_0x17287c[_0x2b169f(0x2b5)]=_0x3e3157,await _0x17ccc5(_0x17287c,_0x2b169f(0xd3)+'ill\x20enab'+'led');}async function _0x5a187c(_0x8c4b27){const _0x3054d3=_0x35ea73,_0x4a6298=await _0x2d7664(),_0x2f2027=asRecord(_0x4a6298[_0x3054d3(0x2b5)]),_0x3a4717=asRecord(_0x2f2027[_0x3054d3(0x281)]),_0x4ed209={...asRecord(_0x3a4717[KDOCS_SKILL_ID]),'enabled':Boolean(_0x8c4b27)};if(typeof openClawConfigHandlers[_0x3054d3(0x1f1)+'Entry']===_0x3054d3(0x1a4)){await openClawConfigHandlers[_0x3054d3(0x1f1)+_0x3054d3(0x1b9)]({'skillId':KDOCS_SKILL_ID,'entry':_0x4ed209,'reason':_0x3054d3(0xd3)+'ill\x20'+(_0x8c4b27?_0x3054d3(0x2b9):_0x3054d3(0x262))});return;}_0x3a4717[KDOCS_SKILL_ID]=_0x4ed209,_0x2f2027[_0x3054d3(0x281)]=_0x3a4717,_0x4a6298['skills']=_0x2f2027,await _0x17ccc5(_0x4a6298,_0x3054d3(0xd3)+_0x3054d3(0x194)+(_0x8c4b27?'enabled':_0x3054d3(0x262)));}async function _0x397015(){const _0x4cc2e9=_0x35ea73;if(typeof openClawConfigHandlers[_0x4cc2e9(0x1fd)+'illEntry']==='function'){await openClawConfigHandlers[_0x4cc2e9(0x1fd)+_0x4cc2e9(0x2b1)]({'skillId':KDOCS_SKILL_ID,'reason':_0x4cc2e9(0xd3)+'ill\x20conn'+_0x4cc2e9(0x197)+_0x4cc2e9(0x13b)});return;}const _0x122607=await _0x2d7664(),_0x397ed2=asRecord(_0x122607[_0x4cc2e9(0x2b5)]),_0x365a11=asRecord(_0x397ed2['entries']);delete _0x365a11[KDOCS_SKILL_ID],_0x397ed2['entries']=_0x365a11,_0x122607[_0x4cc2e9(0x2b5)]=_0x397ed2,await _0x17ccc5(_0x122607,_0x4cc2e9(0xd3)+_0x4cc2e9(0x1c7)+_0x4cc2e9(0x197)+'leted');}async function _0x4bff87(){const _0x23bf37=_0x35ea73;if(!await _0x5c6e4b())throw new Error(_0x23bf37(0x2cc)+_0x23bf37(0x235)+_0x23bf37(0x2af)+'连接');return await _0x3d41b8(),{'ok':!![]};}async function _0x5c6e4b(){const _0x46e10f=_0x35ea73,_0x4f8626=await _0x24f352(['auth',_0x46e10f(0x20b)])[_0x46e10f(0x25c)](()=>({'code':null,'output':''}));return _0x4f8626[_0x46e10f(0x124)]===0x0&&isKdocsAuthStatusReady(_0x4f8626[_0x46e10f(0x1a3)]);}async function _0x232720({appId:_0x8f522b,appSecret:_0xc20c21,userInfo:userInfo=null}){const _0x2673c2=_0x35ea73,_0xbdf7d4=await _0x2d7664();applyFeishuChannelConfig(_0xbdf7d4,{'appId':_0x8f522b,'appSecret':_0xc20c21,'userInfo':userInfo});const _0x5b41ea=asRecord(_0xbdf7d4[_0x2673c2(0xc8)]);if(typeof openClawConfigHandlers['setChann'+_0x2673c2(0x224)]===_0x2673c2(0x1a4))return openClawConfigHandlers[_0x2673c2(0x236)+'elConfig']({'channelId':_0x2673c2(0x29c),'channel':asRecord(_0x5b41ea['feishu']),'pluginId':_0x2673c2(0x29c),'pluginEnabled':!![],'reason':_0x2673c2(0x160)+_0x2673c2(0x1e9)+_0x2673c2(0x1e8)+'dated'});await _0x17ccc5(_0xbdf7d4,'feishu\x20c'+_0x2673c2(0x1e9)+_0x2673c2(0x1e8)+'dated');}async function _0x4e5b4e({appId:_0x3e0c63,appSecret:_0x24be88,userInfo:userInfo=null,configPath:_0x476b38}){const _0x5678b9=_0x35ea73,_0x472c66=getTrimmedString(userInfo?.['openId']),_0x10e89c={'channels':{'feishu':{'enabled':![],'appId':_0x3e0c63,'appSecret':_0x24be88,'domain':_0x5678b9(0x29c),'connectionMode':_0x5678b9(0x25a)+'t','requireMention':!![],'dmPolicy':_0x472c66?'allowlis'+'t':_0x5678b9(0x262),'groupPolicy':_0x5678b9(0x262),'streaming':!![],'allowFrom':_0x472c66?[_0x472c66]:[],'groupAllowFrom':[]}},'plugins':{'entries':{},'allow':[]},'tools':{'profile':_0x5678b9(0x15f)}};await mkdir(dirname(_0x476b38),{'recursive':!![]}),await writeFile(_0x476b38,JSON[_0x5678b9(0x125)+'y'](_0x10e89c,null,0x2)+'\x0a',_0x5678b9(0xd4));}async function _0x3d6a66(_0x3109b8={}){const _0x31e1ba=_0x35ea73,_0x439e77=safeString(_0x3109b8[_0x31e1ba(0x20f)]),_0x351692=safeString(_0x3109b8['appSecre'+'t']);if(!_0x439e77)throw new Error('飞书机器人\x20Ap'+_0x31e1ba(0x17e)+_0x31e1ba(0x161));if(!_0x351692)throw new Error(_0x31e1ba(0xd7)+_0x31e1ba(0x162)+_0x31e1ba(0x2ca)+'red');return await _0x232720({'appId':_0x439e77,'appSecret':_0x351692,'userInfo':null}),{'ok':!![]};}async function _0x44013a(_0x7cb8f1={}){const _0x23ebd7=_0x35ea73,_0x12d972=safeString(_0x7cb8f1[_0x23ebd7(0x20f)]),_0xc7a0ea=safeString(_0x7cb8f1[_0x23ebd7(0x140)+'cret']);if(!_0x12d972)throw new Error(_0x23ebd7(0x27c)+_0x23ebd7(0x17e)+'equired');if(!_0xc7a0ea)throw new Error('QQ机器人\x20Ap'+'pSecret\x20'+_0x23ebd7(0x2ca)+_0x23ebd7(0x28a));const _0xd292da=await _0x2d7664(),_0x5ddc50=asRecord(_0xd292da[_0x23ebd7(0xc8)]),_0x170f26=asRecord(_0x5ddc50[_0x23ebd7(0x134)]),_0x2bd8d2={'enabled':typeof _0x170f26['enabled']===_0x23ebd7(0x1c0)?_0x170f26[_0x23ebd7(0x2b9)]:!![],'allowFrom':['*'],'appId':_0x12d972,'clientSecret':_0xc7a0ea};if(typeof openClawConfigHandlers['setChann'+_0x23ebd7(0x224)]===_0x23ebd7(0x1a4))return openClawConfigHandlers['setChann'+_0x23ebd7(0x224)]({'channelId':_0x23ebd7(0x134),'channel':_0x2bd8d2,'pluginId':QQBOT_PLUGIN_ID,'pluginEnabled':!![],'reason':'qqbot\x20ch'+'annel\x20co'+'nfig\x20upd'+_0x23ebd7(0x223)});_0x5ddc50[_0x23ebd7(0x134)]=_0x2bd8d2,_0xd292da[_0x23ebd7(0xc8)]=_0x5ddc50;const _0x5029f1=asRecord(_0xd292da['plugins']),_0x56216b=asRecord(_0x5029f1[_0x23ebd7(0x281)]);return _0x56216b[QQBOT_PLUGIN_ID]={...asRecord(_0x56216b[QQBOT_PLUGIN_ID]),'enabled':!![]},_0x5029f1[_0x23ebd7(0x281)]=_0x56216b,_0x5029f1['allow']=dedupeStrings([...asStringArray(_0x5029f1[_0x23ebd7(0xff)]),QQBOT_PLUGIN_ID]),_0xd292da[_0x23ebd7(0x1cd)]=_0x5029f1,await _0x17ccc5(_0xd292da,_0x23ebd7(0x266)+_0x23ebd7(0x2c4)+_0x23ebd7(0x163)+_0x23ebd7(0x223)),{'ok':!![]};}async function _0x155db7(_0x9589c1={}){const _0xb768b7=_0x35ea73,_0x58b3bf=safeString(_0x9589c1[_0xb768b7(0x1f2)]),_0xb2740=safeString(_0x9589c1[_0xb768b7(0x232)]);if(!_0x58b3bf)throw new Error(_0xb768b7(0x1bb)+'ID\x20is\x20re'+_0xb768b7(0x213));if(!_0xb2740)throw new Error(_0xb768b7(0x1c9)+'ret\x20is\x20r'+'equired');const _0x37bc17=await _0x2d7664(),_0x3940d9=asRecord(_0x37bc17[_0xb768b7(0xc8)]),_0x3dbb4a=asRecord(_0x3940d9[_0xb768b7(0x155)]),_0x3eaae4={..._0x3dbb4a,'enabled':typeof _0x3dbb4a['enabled']===_0xb768b7(0x1c0)?_0x3dbb4a['enabled']:!![],'name':getTrimmedString(_0x3dbb4a[_0xb768b7(0x299)])||'企微助手','connectionMode':getTrimmedString(_0x3dbb4a[_0xb768b7(0x2a0)+_0xb768b7(0x18d)])||_0xb768b7(0x25a)+'t','dmPolicy':normalizeFeishuDmPolicy(_0x3dbb4a[_0xb768b7(0xdd)])??_0xb768b7(0x1f9),'groupPolicy':normalizeFeishuGroupPolicy(_0x3dbb4a[_0xb768b7(0x261)+_0xb768b7(0x133)])??'open','allowFrom':asStringArray(_0x3dbb4a[_0xb768b7(0x240)+'m']),'groupAllowFrom':asStringArray(_0x3dbb4a[_0xb768b7(0x1b0)+_0xb768b7(0x289)]),'botId':_0x58b3bf,'secret':_0xb2740};if(typeof openClawConfigHandlers[_0xb768b7(0x236)+_0xb768b7(0x224)]===_0xb768b7(0x1a4))return openClawConfigHandlers[_0xb768b7(0x236)+_0xb768b7(0x224)]({'channelId':'wecom','channel':_0x3eaae4,'pluginId':WECOM_PLUGIN_ID,'pluginEnabled':!![],'reason':_0xb768b7(0x237)+_0xb768b7(0x2c4)+_0xb768b7(0x163)+_0xb768b7(0x223)});_0x3940d9[_0xb768b7(0x155)]=_0x3eaae4,_0x37bc17[_0xb768b7(0xc8)]=_0x3940d9;const _0x30f7e0=asRecord(_0x37bc17[_0xb768b7(0x1cd)]),_0x364e48=asRecord(_0x30f7e0['entries']);return _0x364e48[WECOM_PLUGIN_ID]={...asRecord(_0x364e48[WECOM_PLUGIN_ID]),'enabled':!![]},_0x30f7e0[_0xb768b7(0x281)]=_0x364e48,_0x30f7e0['allow']=dedupeStrings([...asStringArray(_0x30f7e0[_0xb768b7(0xff)]),WECOM_PLUGIN_ID]),_0x37bc17[_0xb768b7(0x1cd)]=_0x30f7e0,await _0x17ccc5(_0x37bc17,_0xb768b7(0x237)+'annel\x20co'+'nfig\x20upd'+'ated'),{'ok':!![]};}async function _0xa38c5c(_0x16f836,_0x1ca8de,_0x3f68e2,_0x5148cd){const _0x147e09=_0x35ea73,_0x23607f=safeString(_0x1ca8de[_0x147e09(0x24a)]),_0x22c0b2=String(_0x1ca8de[_0x147e09(0x14b)+'ationCod'+'e']||'')[_0x147e09(0x19a)](/\s+/g,'');if(!_0x23607f)throw new Error(_0x5148cd+(_0x147e09(0x242)+'quired'));if(!_0x22c0b2)throw new Error(_0x5148cd+(_0x147e09(0x265)+_0x147e09(0x161)));const _0x172c27=await _0x2d7664(),_0x1d80a8=asRecord(_0x172c27['plugins']),_0x1b83d7=asRecord(_0x1d80a8[_0x147e09(0x281)]),_0x3a34c8=createConnectorPluginEntry(_0x16f836,_0x1b83d7[_0x16f836],!![],{'account':_0x23607f,'authorizationCode':_0x22c0b2,..._0x3f68e2});if(typeof openClawConfigHandlers[_0x147e09(0x102)+_0x147e09(0x263)]==='function')return openClawConfigHandlers[_0x147e09(0x102)+'nConfig']({'pluginId':_0x16f836,'enabled':!![],'config':asRecord(_0x3a34c8[_0x147e09(0xe9)]),'reason':_0x16f836+(_0x147e09(0x1e6)+'or\x20plugi'+'n\x20update'+'d')});return _0x1b83d7[_0x16f836]=_0x3a34c8,_0x1d80a8['entries']=_0x1b83d7,_0x1d80a8[_0x147e09(0xff)]=dedupeStrings([...asStringArray(_0x1d80a8[_0x147e09(0xff)]),_0x16f836]),_0x172c27[_0x147e09(0x1cd)]=_0x1d80a8,await _0x17ccc5(_0x172c27,_0x16f836+(_0x147e09(0x1e6)+_0x147e09(0x145)+_0x147e09(0xcf)+'d')),{'ok':!![]};}const _0x3f87f7=_0x3c269c=>_0xa38c5c(QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x3c269c,{'imapHost':_0x35ea73(0x2bc)+_0x35ea73(0x274),'imapPort':0x3e1,'smtpHost':'smtp.qq.'+_0x35ea73(0x274),'smtpPort':0x1d1,'secure':!![]},_0x35ea73(0x28b)),_0x3832f8=_0x480b6e=>_0xa38c5c(NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x480b6e,{'imapHost':_0x35ea73(0x27f)+_0x35ea73(0x123),'imapPort':0x3e1,'smtpHost':'smtp.163'+_0x35ea73(0x123),'smtpPort':0x1d1,'imapClientName':_0x35ea73(0x1bc),'imapClientVersion':_0x35ea73(0x282),'imapClientVendor':_0x35ea73(0x1bc),'imapClientSupportEmail':_0x35ea73(0x13a)+_0x35ea73(0x1d8),'secure':!![]},_0x35ea73(0x175)),_0x8ce02f=_0x305d0f=>_0xa38c5c(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x305d0f,{'imapHost':_0x35ea73(0x2cf)+'ail.qq.c'+'om','imapPort':0x3e1,'smtpHost':_0x35ea73(0xc5)+'ail.qq.c'+'om','smtpPort':0x1d1,'secure':!![]},_0x35ea73(0x108));async function _0x5994a2(_0x4eee41={}){const _0x2c9ba6=_0x35ea73,_0x9ab875=safeString(_0x4eee41[_0x2c9ba6(0x218)+_0x2c9ba6(0xf0)])||_0x2c9ba6(0xfd),_0x3d9980=await _0x2d7664(),_0x4997e1=asRecord(_0x3d9980[_0x2c9ba6(0x1cd)]),_0x386db5=asRecord(_0x4997e1[_0x2c9ba6(0x281)]),_0xcb94f=createConnectorPluginEntry(FEISHU_DOC_CONNECTOR_PLUGIN_ID,_0x386db5[FEISHU_DOC_CONNECTOR_PLUGIN_ID],!![],{'authMode':_0x2c9ba6(0xfa),'accountName':_0x9ab875});if(typeof openClawConfigHandlers['setPlugi'+'nConfig']===_0x2c9ba6(0x1a4))return openClawConfigHandlers[_0x2c9ba6(0x102)+_0x2c9ba6(0x263)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':!![],'config':asRecord(_0xcb94f['config']),'reason':'feishu\x20d'+_0x2c9ba6(0x1ee)+_0x2c9ba6(0x109)+_0x2c9ba6(0x205)+_0x2c9ba6(0x1c2)});return _0x386db5[FEISHU_DOC_CONNECTOR_PLUGIN_ID]=_0xcb94f,_0x4997e1['entries']=_0x386db5,_0x4997e1['allow']=dedupeStrings([...asStringArray(_0x4997e1[_0x2c9ba6(0xff)]),FEISHU_DOC_CONNECTOR_PLUGIN_ID]),_0x3d9980['plugins']=_0x4997e1,await _0x17ccc5(_0x3d9980,_0x2c9ba6(0x268)+'oc\x20conne'+_0x2c9ba6(0x109)+_0x2c9ba6(0x205)+_0x2c9ba6(0x1c2)),{'ok':!![]};}async function _0x241ec7(_0x1e0713={}){const _0x30dcf7=_0x35ea73,_0x4f594b=safeString(_0x1e0713[_0x30dcf7(0x1d1)]);if(!_0x4f594b)throw new Error(_0x30dcf7(0x10e)+_0x30dcf7(0x1ca)+_0x30dcf7(0x295));const _0x2d8d46=await _0x2d7664(),_0x5ba587=asRecord(_0x2d8d46['skills']),_0x8c5e49=asRecord(_0x5ba587['entries']),_0x47d5c9=asRecord(_0x8c5e49[TENCENT_DOCS_SKILL_ID]),_0x559591={..._0x47d5c9,'enabled':!![],'env':{...asRecord(_0x47d5c9[_0x30dcf7(0x24f)]),[TENCENT_DOCS_TOKEN_ENV]:_0x4f594b}};if(typeof openClawConfigHandlers[_0x30dcf7(0x1f1)+'Entry']==='function')return openClawConfigHandlers['setSkill'+_0x30dcf7(0x1b9)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':_0x559591,'reason':_0x30dcf7(0x245)+_0x30dcf7(0x1de)+_0x30dcf7(0xf2)+'ed'});return _0x8c5e49[TENCENT_DOCS_SKILL_ID]=_0x559591,_0x5ba587[_0x30dcf7(0x281)]=_0x8c5e49,_0x2d8d46[_0x30dcf7(0x2b5)]=_0x5ba587,await _0x17ccc5(_0x2d8d46,'tencent\x20'+_0x30dcf7(0x1de)+_0x30dcf7(0xf2)+'ed'),{'ok':!![]};}async function _0x5c77bf(_0x1eff4c={}){const _0x2096db=_0x35ea73,_0x3f90a9=safeString(_0x1eff4c[_0x2096db(0x139)]);if(!_0x3f90a9)throw new Error(_0x2096db(0x2aa)+_0x2096db(0x23a)+_0x2096db(0x23f)+'is\x20requi'+_0x2096db(0x28a));try{const _0x28542d=new URL(_0x3f90a9);if(![_0x2096db(0x1a1),_0x2096db(0x10a)][_0x2096db(0x1ac)](_0x28542d[_0x2096db(0x136)]))throw new Error(_0x2096db(0xe6)+'protocol');}catch{throw new Error('请输入有效的钉钉'+_0x2096db(0x115)+_0x2096db(0xc4)+_0x2096db(0x1b1));}if(typeof openClawConfigHandlers['setMcpSe'+'rver']===_0x2096db(0x1a4))return openClawConfigHandlers[_0x2096db(0xea)+_0x2096db(0x273)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'server':createDingtalkDocMcpServerConfig(_0x3f90a9),'reason':_0x2096db(0x26e)+_0x2096db(0xde)+_0x2096db(0x166)});const _0x30aab3=await _0x2d7664(),_0x808bff=readOpenClawMcpServersFromConfig(_0x30aab3);return _0x808bff[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x3f90a9),writeOpenClawMcpServersToConfig(_0x30aab3,_0x808bff),await _0x17ccc5(_0x30aab3,_0x2096db(0x26e)+_0x2096db(0xde)+'\x20updated'),{'ok':!![]};}async function _0x508e02(){const _0x2ab55b=_0x35ea73,_0x17c764=await _0x2d7664(),_0xd07083=asRecord(_0x17c764['plugins']),_0x535e2e=asRecord(_0xd07083[_0x2ab55b(0x281)]),_0x41bc74=asRecord(_0x17c764[_0x2ab55b(0x2b5)]),_0x352319=asRecord(_0x41bc74[_0x2ab55b(0x281)]),_0x25bcc9={},_0x56ed7b=_0x2f112d=>{const _0x321b14=_0x2ab55b,_0x176fa8=asRecord(_0x535e2e[_0x2f112d]);return{'entry':_0x176fa8,'config':asRecord(_0x176fa8[_0x321b14(0xe9)])};},_0xff18c2=(_0x4082c4,_0x5b5cc9,_0x149c16)=>{const _0x17fec1=_0x2ab55b,{entry:_0x496916,config:_0x328cad}=_0x56ed7b(_0x5b5cc9),_0x45afae=getTrimmedString(_0x328cad[_0x17fec1(0x24a)]);if(!_0x45afae)return;_0x25bcc9[_0x4082c4]={'provider':_0x4082c4,'sourceType':_0x17fec1(0xf5),'adapter':_0x5b5cc9,'enabled':_0x496916[_0x17fec1(0x2b9)]!==![]&&_0x328cad[_0x17fec1(0x2b9)]!==![],'account':_0x45afae,'credentialRef':_0x5b5cc9+(_0x17fec1(0x104)+_0x17fec1(0xd0)+'de'),'name':_0x149c16};};_0xff18c2(_0x2ab55b(0x1bf),QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x2ab55b(0x28b)),_0xff18c2('netease_'+_0x2ab55b(0x243),NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x2ab55b(0x175)),_0xff18c2(_0x2ab55b(0xe0)+'exmail',TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'腾讯企业邮箱');const _0x10431b=_0x56ed7b(FEISHU_DOC_CONNECTOR_PLUGIN_ID),_0x420a21=getTrimmedString(_0x10431b['config'][_0x2ab55b(0x218)+_0x2ab55b(0xf0)]);_0x420a21&&(_0x25bcc9[_0x2ab55b(0x29c)]={'provider':_0x2ab55b(0x29c),'sourceType':_0x2ab55b(0x27d),'adapter':_0x2ab55b(0x16c)+_0x2ab55b(0x22b),'enabled':_0x10431b[_0x2ab55b(0x22e)][_0x2ab55b(0x2b9)]!==![]&&_0x10431b[_0x2ab55b(0xe9)][_0x2ab55b(0x2b9)]!==![],'authMode':_0x2ab55b(0xfa),'accountName':_0x420a21,'account':_0x420a21,'credentialRef':FEISHU_DOC_CONNECTOR_PLUGIN_ID+':user','capabilities':['latest',_0x2ab55b(0x1ec),_0x2ab55b(0x230),_0x2ab55b(0x17f),'update',_0x2ab55b(0x1da),_0x2ab55b(0x1d9)]});const _0x2e1d2e=asRecord(_0x352319[TENCENT_DOCS_SKILL_ID]),_0x4122fd=asRecord(_0x2e1d2e['env']),_0x417b76=getTrimmedString(_0x4122fd[TENCENT_DOCS_TOKEN_ENV]);_0x417b76&&(_0x25bcc9[_0x2ab55b(0xe0)+'docs']={'provider':_0x2ab55b(0xe0)+'docs','sourceType':_0x2ab55b(0x1be),'adapter':TENCENT_DOCS_SKILL_ID,'enabled':_0x2e1d2e[_0x2ab55b(0x2b9)]!==![],'account':_0x2ab55b(0xf1),'credentialRef':TENCENT_DOCS_SKILL_ID+':'+TENCENT_DOCS_TOKEN_ENV,'capabilities':[_0x2ab55b(0x230),'read','update',_0x2ab55b(0x1da),_0x2ab55b(0x14f),'export',_0x2ab55b(0x19d)]});const _0x4292ba=asRecord(_0x352319[KDOCS_SKILL_ID]);Object['keys'](_0x4292ba)[_0x2ab55b(0x116)]>0x0&&await _0x5c6e4b()&&(_0x25bcc9[_0x2ab55b(0x1df)]={'provider':'kdocs','sourceType':_0x2ab55b(0x1be),'adapter':KDOCS_SKILL_ID,'enabled':_0x4292ba[_0x2ab55b(0x2b9)]!==![],'account':_0x2ab55b(0x22d),'credentialRef':_0x2ab55b(0x231)+_0x2ab55b(0xe8)+'in','capabilities':[_0x2ab55b(0x230),_0x2ab55b(0x17f),_0x2ab55b(0x234),_0x2ab55b(0x1ec),_0x2ab55b(0x2c6),_0x2ab55b(0x14f),_0x2ab55b(0x1d9)]});const _0x1d9d0a=readOpenClawMcpServersFromConfig(_0x17c764),_0x2c38f4=findDingtalkDocMcpServer(_0x1d9d0a),_0x433fad=getTrimmedString(_0x2c38f4[_0x2ab55b(0x139)]);return _0x433fad&&(_0x25bcc9[_0x2ab55b(0x26e)+'_doc']={'provider':_0x2ab55b(0x26e)+_0x2ab55b(0x2c8),'sourceType':_0x2ab55b(0x276),'adapter':DINGTALK_DOC_MCP_SERVER_NAME,'enabled':_0x2c38f4[_0x2ab55b(0x2b9)]!==![],'url':_0x433fad,'transport':getTrimmedString(_0x2c38f4[_0x2ab55b(0x192)+'t'])||_0x2ab55b(0x226)+_0x2ab55b(0x144)}),_0x25bcc9;}async function _0x158514(){const _0x25410b=_0x35ea73,_0xa03cb0=await _0x3aad17['readConf'+_0x25410b(0x1c1)+_0x25410b(0x16d)]();return{..._0xa03cb0,'connectors':{...asRecord(_0xa03cb0[_0x25410b(0xf3)+'rs']),...await _0x508e02()}};}function _0x4538e9(_0x2b9b37){const _0xe670e6=_0x35ea73;if(!_0x2b9b37[_0xe670e6(0x29a)+_0xe670e6(0x15a)])return;clearTimeout(_0x2b9b37['verifyTi'+'mer']),_0x2b9b37[_0xe670e6(0x29a)+_0xe670e6(0x15a)]=null;}function _0x3f2539(_0x3d283c,_0x14f76c=KDOCS_CLI_AUTH_POLL_INTERVAL_MS){const _0x55d3c8=_0x35ea73;if(_0x3d283c[_0x55d3c8(0x20b)]!==_0x55d3c8(0x13d))return;_0x4538e9(_0x3d283c),_0x3d283c['verifyTi'+_0x55d3c8(0x15a)]=setTimeout(()=>void _0x5cd4cb(_0x3d283c),_0x14f76c);}async function _0x5cd4cb(_0x535f6d){const _0x3679b6=_0x35ea73;if(_0x535f6d[_0x3679b6(0x20b)]!==_0x3679b6(0x13d))return;_0x535f6d[_0x3679b6(0x157)]=_0x3679b6(0x238),_0x535f6d[_0x3679b6(0xd8)]=_0x3679b6(0xc9)+_0x3679b6(0x2c5);try{const _0x680f33=await _0x24f352([_0x3679b6(0x1a5),_0x3679b6(0x20b)]);_0x535f6d['output']=_0x680f33['output'];if(_0x680f33['code']===0x0&&isKdocsAuthStatusReady(_0x680f33[_0x3679b6(0x1a3)])){_0x4538e9(_0x535f6d),await _0x3d41b8(),_0x535f6d[_0x3679b6(0x157)]=_0x3679b6(0x1b5)+'d',_0x535f6d['status']=_0x3679b6(0x1b5)+'d',_0x535f6d['message']=_0x3679b6(0x10d);return;}if(Date['now']()-_0x535f6d['startedA'+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x535f6d['status']=_0x3679b6(0x294),_0x535f6d[_0x3679b6(0x253)+_0x3679b6(0x18a)]='金山文档授权状态'+_0x3679b6(0x1b3);return;}_0x3f2539(_0x535f6d);}catch(_0x17d3f6){if(Date[_0x3679b6(0x187)]()-_0x535f6d['startedA'+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x535f6d[_0x3679b6(0x20b)]=_0x3679b6(0x294),_0x535f6d[_0x3679b6(0x253)+'sage']=_0x17d3f6 instanceof Error?_0x17d3f6[_0x3679b6(0xd8)]:_0x3679b6(0x214)+_0x3679b6(0x28c);return;}_0x3f2539(_0x535f6d);}}async function _0x4fb3c5(){const _0x17c410=_0x35ea73,_0x496f14=randomUUID(),_0x32c849={'sessionId':_0x496f14,'status':'pending','phase':_0x17c410(0x29d),'url':null,'message':'正在启动金山文档'+'登录','errorMessage':null,'output':'','process':null,'verifyTimer':null,'startedAt':Date['now']()};return _0x7c6eef[_0x17c410(0x2ce)](_0x496f14,_0x32c849),void _0x403451({'FORCE_COLOR':'0','HOME':homedir()})['then'](async({env:_0xd1e26f,runtime:_0x78bf8d})=>{const _0x1f4c92=_0x17c410,_0x13fca6=await _0x4245cc(_0x78bf8d);_0x3868f8(_0x1f4c92(0xf3)+_0x1f4c92(0x22c),{'connector':_0x1f4c92(0x1df),'phase':_0x1f4c92(0x1dc),'message':_0x1f4c92(0x231)+'i\x20auth\x20l'+_0x1f4c92(0x17c)});const _0x5cdc7e=spawn(_0x13fca6['executab'+_0x1f4c92(0x1f6)],[_0x1f4c92(0x1a5),'login'],{'cwd':homedir(),'env':_0xd1e26f});_0x32c849[_0x1f4c92(0x1e2)]=_0x5cdc7e;const _0x27e9fe=setTimeout(()=>{const _0x51c086=_0x1f4c92;if(_0x32c849['status']!==_0x51c086(0x13d))return;_0x5cdc7e['kill'](),_0x32c849[_0x51c086(0x20b)]='error',_0x32c849[_0x51c086(0x253)+'sage']=_0x51c086(0x21c)+'超时',_0x32c849[_0x51c086(0x1e2)]=null;},KDOCS_CLI_STEP_TIMEOUT_MS),_0x1803bb=_0x2ccd8f=>{const _0xab816b=_0x1f4c92,_0x1ca8bb=_0x2ccd8f['toString'](_0xab816b(0xd4));_0x32c849[_0xab816b(0x1a3)]+=_0x1ca8bb,_0x3868f8(_0xab816b(0xf3)+_0xab816b(0x22c),{'connector':_0xab816b(0x1df),'phase':_0xab816b(0x1a3),'message':_0x1ca8bb});const _0x5e663b=extractFirstUrl(_0x32c849['output']);_0x5e663b&&!_0x32c849[_0xab816b(0x139)]&&(_0x32c849[_0xab816b(0x139)]=_0x5e663b,_0x32c849['phase']=_0xab816b(0x1a5),_0x32c849['message']=_0xab816b(0xd2)+_0xab816b(0x25b),_0x3f2539(_0x32c849,0x1f4),void _0x54639c[_0xab816b(0xfc)+_0xab816b(0x2ab)](_0x5e663b)[_0xab816b(0x25c)](()=>{}));};_0x5cdc7e['stdout']['on'](_0x1f4c92(0x202),_0x1803bb),_0x5cdc7e[_0x1f4c92(0x183)]['on'](_0x1f4c92(0x202),_0x1803bb),_0x5cdc7e['stdin'][_0x1f4c92(0x146)](),_0x5cdc7e['once'](_0x1f4c92(0x294),_0x386486=>{const _0x594575=_0x1f4c92;clearTimeout(_0x27e9fe),_0x32c849[_0x594575(0x20b)]=_0x594575(0x294),_0x32c849[_0x594575(0x253)+_0x594575(0x18a)]=_0x386486 instanceof Error?_0x386486[_0x594575(0xd8)]:'金山文档登录启动'+_0x594575(0x249)+_0x594575(0x222)+_0x594575(0x24c),_0x32c849['process']=null,_0x3868f8(_0x594575(0xf3)+_0x594575(0x22c),{'connector':_0x594575(0x1df),'phase':'error','message':_0x32c849[_0x594575(0x253)+'sage']});}),_0x5cdc7e[_0x1f4c92(0xf6)](_0x1f4c92(0x2b0),_0x263174=>{const _0x43be4a=_0x1f4c92;clearTimeout(_0x27e9fe),_0x32c849['process']=null;if(_0x32c849[_0x43be4a(0x20b)]!==_0x43be4a(0x13d))return;const _0x2e3a6e=extractFirstUrl(_0x32c849[_0x43be4a(0x1a3)]);if(_0x2e3a6e&&!_0x32c849[_0x43be4a(0x139)]){_0x32c849['url']=_0x2e3a6e,_0x32c849['phase']=_0x43be4a(0x1a5),_0x32c849[_0x43be4a(0xd8)]=_0x43be4a(0xd2)+_0x43be4a(0x25b),_0x3f2539(_0x32c849,0x1f4);return;}if(_0x263174!==0x0){_0x32c849['status']=_0x43be4a(0x294),_0x32c849[_0x43be4a(0x253)+'sage']=_0x32c849[_0x43be4a(0x1a3)]['trim']()||_0x43be4a(0x21c)+'失败,请确认\x20k'+_0x43be4a(0x222)+'\x20已安装',_0x3868f8(_0x43be4a(0xf3)+'r-log',{'connector':_0x43be4a(0x1df),'phase':_0x43be4a(0x294),'message':_0x32c849[_0x43be4a(0x253)+_0x43be4a(0x18a)]});return;}_0x32c849[_0x43be4a(0x157)]=_0x43be4a(0x238),_0x32c849[_0x43be4a(0xd8)]=_0x43be4a(0xc9)+'授权状态',_0x3f2539(_0x32c849,0x1f4);});})['catch'](_0x3e52bf=>{const _0x2b01e7=_0x17c410;_0x32c849[_0x2b01e7(0x20b)]=_0x2b01e7(0x294),_0x32c849[_0x2b01e7(0x253)+_0x2b01e7(0x18a)]=_0x3e52bf instanceof Error?_0x3e52bf[_0x2b01e7(0xd8)]:_0x2b01e7(0x21c)+'失败,请确认\x20k'+'docs-cli'+_0x2b01e7(0x24c),_0x3868f8('connecto'+'r-log',{'connector':_0x2b01e7(0x1df),'phase':_0x2b01e7(0x294),'message':_0x32c849['errorMes'+_0x2b01e7(0x18a)]});}),createKdocsCliStatus(_0x32c849);}function _0x3fa367(_0x34de23={}){const _0x3bb26c=_0x35ea73,_0x13cf52=safeString(_0x34de23[_0x3bb26c(0x174)+'d']);if(!_0x13cf52)throw new Error(_0x3bb26c(0x172)+_0x3bb26c(0x17b)+'n\x20id\x20is\x20'+_0x3bb26c(0x23b));const _0x4ee358=_0x7c6eef[_0x3bb26c(0x2bf)](_0x13cf52);if(!_0x4ee358)throw new Error(_0x3bb26c(0x172)+_0x3bb26c(0x17b)+_0x3bb26c(0xf7)+_0x3bb26c(0x169));return createKdocsCliStatus(_0x4ee358);}function _0x2b223d(_0x18f13b={}){const _0x251607=_0x35ea73,_0x2b9f4e=safeString(_0x18f13b[_0x251607(0x174)+'d']);if(!_0x2b9f4e)return{'ok':!![]};const _0x54edd9=_0x7c6eef[_0x251607(0x2bf)](_0x2b9f4e);if(!_0x54edd9)return{'ok':!![]};return _0x4538e9(_0x54edd9),_0x54edd9['process']?.[_0x251607(0x2c2)](),_0x7c6eef[_0x251607(0x1da)](_0x2b9f4e),{'ok':!![]};}function _0x23a31f(_0x152c2a){const _0x34d8d9=_0x35ea73;if(!_0x152c2a[_0x34d8d9(0x2c7)])return;clearTimeout(_0x152c2a[_0x34d8d9(0x2c7)]),_0x152c2a[_0x34d8d9(0x2c7)]=null;}function _0x3c2725(_0x39b4ef){const _0x11aaaf=_0x35ea73,_0x3d4aa8=_0x931e4c['get'](_0x39b4ef);if(!_0x3d4aa8||_0x3d4aa8[_0x11aaaf(0x20b)]!==_0x11aaaf(0x13d))return;_0x23a31f(_0x3d4aa8),_0x3d4aa8['timer']=setTimeout(()=>void _0x24fe64(_0x39b4ef),_0x3d4aa8['pollInte'+'rvalMs']);}async function _0x24fe64(_0x237520){const _0x1de433=_0x35ea73,_0x3e3d4a=_0x931e4c['get'](_0x237520);if(!_0x3e3d4a||_0x3e3d4a['status']!==_0x1de433(0x13d))return;if(Date[_0x1de433(0x187)]()>=_0x3e3d4a['expiresA'+'t']){_0x3e3d4a[_0x1de433(0x20b)]='expired',_0x3e3d4a[_0x1de433(0x253)+'sage']=_0x1de433(0x269)+'重新生成',_0x23a31f(_0x3e3d4a);return;}try{const _0x5a634b=await pollFeishuRegistration(_0x3e3d4a[_0x1de433(0x114)],_0x3e3d4a[_0x1de433(0x204)+'de']),_0x1d807c=getTrimmedString(_0x5a634b[_0x1de433(0x2b6)+'d']),_0x526996=getTrimmedString(_0x5a634b[_0x1de433(0x259)+_0x1de433(0x208)]),_0x2fa121=getTrimmedString(_0x5a634b[_0x1de433(0x294)]),_0x95dc37=extractFeishuRegistrationAuthorizationUri(_0x5a634b)||_0x3e3d4a[_0x1de433(0x14b)+_0x1de433(0x2c3)];if(_0x95dc37!==_0x3e3d4a[_0x1de433(0x14b)+'ationUri'])_0x3e3d4a[_0x1de433(0x14b)+_0x1de433(0x2c3)]=_0x95dc37;if(_0x1d807c&&_0x526996){const _0x1bc59f=asRecord(_0x5a634b['user_inf'+'o']);await _0x232720({'appId':_0x1d807c,'appSecret':_0x526996,'userInfo':{'openId':getTrimmedString(_0x1bc59f[_0x1de433(0x151)])||null}}),_0x3e3d4a['status']=_0x1de433(0x1b5)+'d',_0x3e3d4a[_0x1de433(0x253)+_0x1de433(0x18a)]=null,_0x23a31f(_0x3e3d4a);return;}if(!_0x2fa121||_0x2fa121===_0x1de433(0x14b)+_0x1de433(0x1fe)+_0x1de433(0x293)){_0x3c2725(_0x237520);return;}if(_0x2fa121==='slow_dow'+'n'){_0x3e3d4a[_0x1de433(0x25d)+'rvalMs']+=0x1388,_0x3c2725(_0x237520);return;}if(_0x2fa121===_0x1de433(0x1bd)+'token'){_0x3e3d4a['status']=_0x1de433(0x298),_0x3e3d4a[_0x1de433(0x253)+_0x1de433(0x18a)]=_0x1de433(0x269)+_0x1de433(0x152),_0x23a31f(_0x3e3d4a);return;}_0x3e3d4a['status']='error',_0x3e3d4a[_0x1de433(0x253)+'sage']=getTrimmedString(_0x5a634b[_0x1de433(0x20e)+_0x1de433(0x2b7)+'n'])||(_0x2fa121===_0x1de433(0x277)+_0x1de433(0x178)?_0x1de433(0x164)+'器人绑定':_0x1de433(0x1b7)+_0x2fa121),_0x23a31f(_0x3e3d4a);}catch(_0x120599){_0x3e3d4a[_0x1de433(0x20b)]=_0x1de433(0x294),_0x3e3d4a[_0x1de433(0x253)+_0x1de433(0x18a)]=_0x120599 instanceof Error?_0x120599['message']:_0x1de433(0x280),_0x23a31f(_0x3e3d4a);}}async function _0x118d1b(_0x37942a={}){const _0xd57d8a=_0x35ea73,_0x363cd0=_0x37942a[_0xd57d8a(0x29b)]===_0xd57d8a(0x2a2)+_0xd57d8a(0x1ef)?_0xd57d8a(0x2a2)+_0xd57d8a(0x1ef):_0xd57d8a(0x2a5),_0x8639bb=createFeishuRegistrationClient(),_0x57cf04=await initFeishuRegistration(_0x8639bb),_0x3172c3=Array['isArray'](_0x57cf04[_0xd57d8a(0x283)+_0xd57d8a(0x2c9)+'ethods'])?_0x57cf04[_0xd57d8a(0x283)+_0xd57d8a(0x2c9)+_0xd57d8a(0x127)]['map'](getTrimmedString)[_0xd57d8a(0x110)](Boolean):[];if(!_0x3172c3[_0xd57d8a(0x1ac)](_0xd57d8a(0x259)+_0xd57d8a(0x208)))throw new Error(_0xd57d8a(0x12f)+_0xd57d8a(0x171)+'ent\x20does'+_0xd57d8a(0x271)+_0xd57d8a(0x137)+_0xd57d8a(0x165)+_0xd57d8a(0x1aa));const _0x3a1c43=await beginFeishuRegistration(_0x8639bb),_0x1a357a=getTrimmedString(_0x3a1c43[_0xd57d8a(0x180)+_0xd57d8a(0x1e3)+_0xd57d8a(0xc3)+'e']),_0x4de81e=extractFeishuRegistrationAuthorizationUri(_0x3a1c43),_0x5a1498=getTrimmedString(_0x3a1c43[_0xd57d8a(0x184)+_0xd57d8a(0x201)]),_0x2b8f78=Number(_0x3a1c43[_0xd57d8a(0x112)+'n'])||0x258,_0x350fbd=Number(_0x3a1c43[_0xd57d8a(0x1d3)])||0x5;if(!_0x1a357a||!_0x5a1498)throw new Error('Missing\x20'+_0xd57d8a(0x180)+_0xd57d8a(0x1e3)+_0xd57d8a(0xc3)+_0xd57d8a(0x16a)+'ice_code'+_0xd57d8a(0x219)+_0xd57d8a(0x1c6)+_0xd57d8a(0x1d2));const _0x783913=randomUUID(),_0x4c1ece={'sessionId':_0x783913,'purpose':_0x363cd0,'client':_0x8639bb,'deviceCode':_0x5a1498,'verificationUriComplete':_0x1a357a,'authorizationUri':_0x4de81e,'expiresAt':Date['now']()+_0x2b8f78*0x3e8,'pollIntervalMs':Math[_0xd57d8a(0x10c)](_0x350fbd*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'status':'pending','errorMessage':null,'timer':null};return _0x931e4c['set'](_0x783913,_0x4c1ece),_0x3c2725(_0x783913),serializeFeishuRegistrationSession(_0x4c1ece);}function _0x5c9efe(_0x47f1f1={}){const _0x36849e=_0x35ea73,_0x3ae93d=safeString(_0x47f1f1['sessionI'+'d']);if(!_0x3ae93d)throw new Error('Feishu\x20r'+_0x36849e(0x26f)+_0x36849e(0xcb)+_0x36849e(0x18b)+'s\x20requir'+'ed');const _0x621eea=_0x931e4c[_0x36849e(0x2bf)](_0x3ae93d);if(!_0x621eea)throw new Error('Feishu\x20r'+_0x36849e(0x26f)+_0x36849e(0xcb)+_0x36849e(0x21d)+_0x36849e(0x16b));return serializeFeishuRegistrationSession(_0x621eea);}function _0x586312(_0x27461d={}){const _0x213544=_0x35ea73,_0x56cbf8=safeString(_0x27461d[_0x213544(0x174)+'d']);if(!_0x56cbf8)return{'ok':!![]};const _0x3d82cd=_0x931e4c[_0x213544(0x2bf)](_0x56cbf8);if(!_0x3d82cd)return{'ok':!![]};return _0x23a31f(_0x3d82cd),_0x931e4c[_0x213544(0x1da)](_0x56cbf8),{'ok':!![]};}async function _0x11824c(_0x5118f1,_0x130496){const _0x26fa3e=_0x35ea73,_0x3e2213=_0x326b6e(),{env:_0x160e8e,runtime:_0x512f98}=await _0x403451({'FORCE_COLOR':'0','HOME':homedir(),'LARK_CLI_NO_PROXY':'1','OPENCLAW_HOME':_0x3e2213,'OPENCLAW_CONFIG_PATH':_0x5118f1[_0x26fa3e(0x250)+_0x26fa3e(0x1f5)+'h']});await mkdir(_0x3e2213,{'recursive':!![]});const _0x47a7a5=await _0x3c9e36(_0x512f98);for(const _0x452168 of[_0x26fa3e(0xcc)+'XY',_0x26fa3e(0x200)+'OXY','ALL_PROX'+'Y','http_pro'+'xy',_0x26fa3e(0x246)+_0x26fa3e(0x28f),_0x26fa3e(0x11a)+'y']){delete _0x160e8e[_0x452168];}return new Promise((_0xc6ba6c,_0x98845b)=>{const _0x57f814=_0x26fa3e;_0x3868f8(_0x57f814(0xf3)+_0x57f814(0x22c),{'connector':_0x57f814(0x203)+'oc','phase':_0x57f814(0x1dc),'message':_0x57f814(0x27d)+'\x20'+_0x130496['join']('\x20')});const _0x413cac=spawn(_0x47a7a5[_0x57f814(0x23d)+_0x57f814(0x130)],[_0x47a7a5['scriptPa'+'th'],..._0x130496],{'cwd':_0x3e2213,'env':_0x160e8e});let _0x45542f=![];_0x413cac[_0x57f814(0xf6)](_0x57f814(0x1dc),()=>{_0x45542f=!![],_0xc6ba6c(_0x413cac);}),_0x413cac[_0x57f814(0xf6)](_0x57f814(0x294),_0x3f0418=>{if(_0x45542f)return;_0x98845b(_0x3f0418);});});}function _0x3ef61f(_0x2bf284,_0x17d2fb,_0x49831e){const _0xcfe691=_0x35ea73;_0x2bf284[_0xcfe691(0x157)]=_0x49831e['phase'],_0x2bf284['message']=_0x49831e[_0xcfe691(0xd8)];if(_0x49831e[_0xcfe691(0x157)]!==_0xcfe691(0x238))_0x2bf284[_0xcfe691(0x139)]=null;_0x2bf284[_0xcfe691(0x1a3)]='',void _0x11824c(_0x2bf284,_0x17d2fb)[_0xcfe691(0x21b)](_0x1ba732=>{const _0x18d66e=_0xcfe691;_0x2bf284[_0x18d66e(0x1e2)]=_0x1ba732;const _0x4ec918=setTimeout(()=>{const _0x14d399=_0x18d66e;if(_0x2bf284[_0x14d399(0x20b)]!==_0x14d399(0x13d))return;_0x1ba732[_0x14d399(0x2c2)](),_0x2bf284[_0x14d399(0x20b)]=_0x14d399(0x294),_0x2bf284[_0x14d399(0x253)+'sage']=_0x49831e[_0x14d399(0xd8)]+'超时',_0x2bf284[_0x14d399(0x1e2)]=null;},FEISHU_DOC_CLI_STEP_TIMEOUT_MS),_0x1bc754=_0x5c527d=>{const _0x1a8746=_0x18d66e,_0x579059=_0x5c527d[_0x1a8746(0x121)](_0x1a8746(0xd4));_0x2bf284[_0x1a8746(0x1a3)]+=_0x579059,_0x3868f8('connecto'+_0x1a8746(0x22c),{'connector':_0x1a8746(0x203)+'oc','phase':_0x49831e[_0x1a8746(0x157)],'message':_0x579059});};_0x1ba732[_0x18d66e(0x286)]['on'](_0x18d66e(0x202),_0x1bc754),_0x1ba732['stderr']['on'](_0x18d66e(0x202),_0x1bc754);if(typeof _0x49831e[_0x18d66e(0x135)]===_0x18d66e(0x21f))_0x1ba732[_0x18d66e(0x135)][_0x18d66e(0x146)](_0x49831e[_0x18d66e(0x135)]);else _0x1ba732[_0x18d66e(0x135)][_0x18d66e(0x146)]();_0x1ba732['on'](_0x18d66e(0x294),_0x4ff51d=>{const _0x5c6d05=_0x18d66e;clearTimeout(_0x4ec918),_0x2bf284[_0x5c6d05(0x20b)]=_0x5c6d05(0x294),_0x2bf284[_0x5c6d05(0x253)+_0x5c6d05(0x18a)]=_0x4ff51d instanceof Error?_0x4ff51d['message']:'飞书\x20CLI\x20执'+_0x5c6d05(0x2a6),_0x2bf284[_0x5c6d05(0x1e2)]=null,_0x3868f8('connecto'+'r-log',{'connector':_0x5c6d05(0x203)+'oc','phase':_0x5c6d05(0x294),'message':_0x2bf284['errorMes'+_0x5c6d05(0x18a)]});}),_0x1ba732['on'](_0x18d66e(0x2b0),_0x30d92e=>{const _0x160d4d=_0x18d66e;clearTimeout(_0x4ec918),_0x2bf284[_0x160d4d(0x1e2)]=null;if(_0x2bf284[_0x160d4d(0x20b)]!==_0x160d4d(0x13d))return;if(_0x30d92e!==0x0){if(_0x49831e[_0x160d4d(0x113)+'e']){void Promise['resolve'](_0x49831e[_0x160d4d(0x113)+'e'](_0x30d92e,_0x2bf284['output']))[_0x160d4d(0x25c)](_0x1d33f8=>{const _0x45d783=_0x160d4d;_0x2bf284[_0x45d783(0x20b)]=_0x45d783(0x294),_0x2bf284[_0x45d783(0x253)+'sage']=_0x1d33f8 instanceof Error?_0x1d33f8['message']:'飞书\x20CLI\x20连'+_0x45d783(0x15d);});return;}_0x2bf284[_0x160d4d(0x20b)]='error',_0x2bf284[_0x160d4d(0x253)+_0x160d4d(0x18a)]=getFeishuDocCliFailureMessage(_0x49831e[_0x160d4d(0x157)],extractFeishuDocCliError(_0x2bf284[_0x160d4d(0x1a3)],_0x160d4d(0x27d)+'\x20'+_0x17d2fb[_0x160d4d(0x2b8)]('\x20')+('\x20exited\x20'+_0x160d4d(0x27e)+'e\x20')+_0x30d92e),'lark-cli'+'\x20'+_0x17d2fb['join']('\x20')+(_0x160d4d(0x251)+_0x160d4d(0x27e)+'e\x20')+_0x30d92e),_0x3868f8(_0x160d4d(0xf3)+_0x160d4d(0x22c),{'connector':'feishu_d'+'oc','phase':_0x160d4d(0x294),'message':_0x2bf284[_0x160d4d(0x253)+'sage']});return;}void Promise['resolve'](_0x49831e['onSucces'+'s']())[_0x160d4d(0x25c)](_0x569a57=>{const _0x128b3e=_0x160d4d;_0x2bf284[_0x128b3e(0x20b)]=_0x128b3e(0x294),_0x2bf284[_0x128b3e(0x253)+_0x128b3e(0x18a)]=_0x569a57 instanceof Error?_0x569a57[_0x128b3e(0xd8)]:_0x128b3e(0x24d)+_0x128b3e(0x15d);});});})[_0xcfe691(0x25c)](_0x5783aa=>{const _0x29ad62=_0xcfe691;_0x2bf284['status']='error',_0x2bf284[_0x29ad62(0x253)+'sage']=_0x5783aa instanceof Error?_0x5783aa['message']:_0x29ad62(0x1a8)+'行失败',_0x2bf284[_0x29ad62(0x1e2)]=null,_0x3868f8(_0x29ad62(0xf3)+'r-log',{'connector':_0x29ad62(0x203)+'oc','phase':_0x29ad62(0x294),'message':_0x2bf284[_0x29ad62(0x253)+_0x29ad62(0x18a)]});});}function _0x210adf(_0x4dc044){const _0x190948=_0x35ea73;if(!_0x4dc044[_0x190948(0xeb)])return;clearTimeout(_0x4dc044[_0x190948(0xeb)]),_0x4dc044[_0x190948(0xeb)]=null;}function _0x38127b(_0x385d81){const _0xdcd6ef=_0x35ea73;if(!_0x385d81['authStat'+_0xdcd6ef(0x1ad)])return;clearTimeout(_0x385d81[_0xdcd6ef(0x132)+_0xdcd6ef(0x1ad)]),_0x385d81[_0xdcd6ef(0x132)+_0xdcd6ef(0x1ad)]=null;}function _0x24ee37(_0x5dbd23,_0x3fa5c8=0x7d0){const _0x3f8d0f=_0x35ea73;if(_0x5dbd23[_0x3f8d0f(0x20b)]!==_0x3f8d0f(0x13d))return;_0x38127b(_0x5dbd23),_0x5dbd23[_0x3f8d0f(0x132)+_0x3f8d0f(0x1ad)]=setTimeout(()=>{const _0xaa6353=_0x3f8d0f;_0x3ef61f(_0x5dbd23,[_0xaa6353(0x1a5),_0xaa6353(0x20b)],{'phase':_0xaa6353(0x238),'message':_0xaa6353(0x188)+'状态','onFailure':(_0x36b230,_0x1ba869)=>{const _0x5abc22=_0xaa6353;if(Date['now']()-_0x5dbd23[_0x5abc22(0x132)+'usStarte'+'dAt']>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x5dbd23[_0x5abc22(0x20b)]=_0x5abc22(0x294),_0x5dbd23[_0x5abc22(0x253)+_0x5abc22(0x18a)]=getFeishuDocCliFailureMessage(_0x5abc22(0x238),extractFeishuDocCliError(_0x1ba869,_0x5abc22(0xed)+_0x5abc22(0x1c3)),'飞书\x20CLI\x20授'+'权状态验证超时');return;}_0x24ee37(_0x5dbd23);},'onSuccess':()=>{const _0x4ac239=_0xaa6353;try{ensureFeishuDocCliUserStatus(_0x5dbd23['output']);}catch(_0x1a9e82){if(Date['now']()-_0x5dbd23[_0x4ac239(0x132)+_0x4ac239(0x1f0)+_0x4ac239(0x26c)]>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x5dbd23[_0x4ac239(0x20b)]='error',_0x5dbd23['errorMes'+_0x4ac239(0x18a)]=_0x1a9e82 instanceof Error?_0x1a9e82['message']:_0x4ac239(0xed)+_0x4ac239(0x103);return;}_0x24ee37(_0x5dbd23);return;}return _0x38127b(_0x5dbd23),_0x3c5607(_0x5dbd23);}});},_0x3fa5c8);}function _0x23247d(_0x46a7d2){const _0x43e98b=_0x35ea73;if(!_0x46a7d2[_0x43e98b(0x211)]||!_0x46a7d2[_0x43e98b(0x28d)+_0x43e98b(0x215)]){_0x46a7d2['status']='error',_0x46a7d2[_0x43e98b(0x253)+_0x43e98b(0x18a)]='飞书文档\x20CLI'+'\x20专用应用凭据缺'+_0x43e98b(0x221);return;}const _0x424315=_0x46a7d2['cliAppId'],_0x56f56e=_0x46a7d2[_0x43e98b(0x28d)+'cret'];_0x3ef61f(_0x46a7d2,[_0x43e98b(0xf4)+'n'],{'phase':_0x43e98b(0x1e4),'message':_0x43e98b(0x284)+'LI','onSuccess':()=>{const _0x4dfb4b=_0x43e98b;_0x3ef61f(_0x46a7d2,[_0x4dfb4b(0xe9),_0x4dfb4b(0xdb),_0x4dfb4b(0x142)+_0x4dfb4b(0xdb),'--app-id',_0x424315,_0x4dfb4b(0x1ab)+'cret-std'+'in',_0x4dfb4b(0x147),_0x4dfb4b(0x29c)],{'phase':_0x4dfb4b(0x1e4),'message':'正在初始化飞书\x20'+'CLI\x20用户身份'+'应用','stdin':_0x56f56e,'onSuccess':()=>{const _0x2aa65e=_0x4dfb4b;_0x3ef61f(_0x46a7d2,['auth',_0x2aa65e(0x1fc),_0x2aa65e(0x128),_0x2aa65e(0x225)+_0x2aa65e(0x148)+_0x2aa65e(0x159)+_0x2aa65e(0xfe)+_0x2aa65e(0x2ae)+_0x2aa65e(0x1ae),_0x2aa65e(0x2ac),_0x2aa65e(0x19c)+_0x2aa65e(0xe1),_0x2aa65e(0x288)+'t'],{'phase':_0x2aa65e(0x1a5),'message':_0x2aa65e(0x20d)+'授权页','onSuccess':()=>{const _0x4d3c4c=_0x2aa65e,_0x358c59=parseFeishuDocCliJson(_0x46a7d2[_0x4d3c4c(0x1a3)]),_0x7f7fd1=getTrimmedString(_0x358c59['verifica'+_0x4d3c4c(0x1e3)+_0x4d3c4c(0xc3)+'e'])||getTrimmedString(_0x358c59[_0x4d3c4c(0x180)+'tion_url'])||getTrimmedString(_0x358c59['verifica'+'tion_uri']),_0x2f3ef8=getTrimmedString(_0x358c59[_0x4d3c4c(0x184)+_0x4d3c4c(0x201)]);if(!_0x7f7fd1||!_0x2f3ef8){_0x46a7d2[_0x4d3c4c(0x20b)]=_0x4d3c4c(0x294),_0x46a7d2[_0x4d3c4c(0x253)+_0x4d3c4c(0x18a)]=_0x4d3c4c(0xd9)+_0x4d3c4c(0x1d6)+_0x4d3c4c(0x1a9)+_0x4d3c4c(0x120)+summarizeCliOutput(_0x46a7d2['output']);return;}_0x46a7d2[_0x4d3c4c(0x139)]=_0x7f7fd1,_0x46a7d2[_0x4d3c4c(0x204)+'de']=_0x2f3ef8,void _0x54639c['openExte'+_0x4d3c4c(0x2ab)](_0x7f7fd1)[_0x4d3c4c(0x25c)](()=>{}),_0x3ef61f(_0x46a7d2,[_0x4d3c4c(0x1a5),_0x4d3c4c(0x1fc),_0x4d3c4c(0x1cf)+'-code',_0x2f3ef8],{'phase':'verify','message':'等待飞书用户授权'+'完成','onSuccess':()=>{const _0x492926=_0x4d3c4c;_0x46a7d2['authStat'+_0x492926(0x1f0)+_0x492926(0x26c)]=Date['now'](),_0x24ee37(_0x46a7d2,0x1f4);}});}});}});}});}function _0xd4adee(_0x5bd528){const _0x276c01=_0x35ea73;if(_0x5bd528[_0x276c01(0x20b)]!==_0x276c01(0x13d))return;_0x210adf(_0x5bd528),_0x5bd528[_0x276c01(0xeb)]=setTimeout(()=>void _0x55e28f(_0x5bd528),_0x5bd528['appPollI'+'ntervalM'+'s']);}async function _0x55e28f(_0x2c09c2){const _0x476480=_0x35ea73;if(_0x2c09c2[_0x476480(0x20b)]!==_0x476480(0x13d)||_0x2c09c2[_0x476480(0x157)]!==_0x476480(0x230)||!_0x2c09c2[_0x476480(0x13c)+_0x476480(0x1b2)]||!_0x2c09c2['appDevic'+_0x476480(0x1b4)])return;if(Date[_0x476480(0x187)]()>=_0x2c09c2[_0x476480(0x212)+'esAt']){_0x2c09c2[_0x476480(0x20b)]=_0x476480(0x294),_0x2c09c2[_0x476480(0x253)+'sage']=_0x476480(0x20c)+_0x476480(0x260),_0x210adf(_0x2c09c2);return;}try{const _0x4c40a2=await pollFeishuRegistration(_0x2c09c2[_0x476480(0x13c)+_0x476480(0x1b2)],_0x2c09c2[_0x476480(0x217)+_0x476480(0x1b4)]),_0x26d6df=getTrimmedString(_0x4c40a2[_0x476480(0x2b6)+'d']),_0x2b8ce3=getTrimmedString(_0x4c40a2['client_s'+'ecret']),_0x3c4c3a=getTrimmedString(_0x4c40a2[_0x476480(0x294)]);if(_0x26d6df&&_0x2b8ce3){const _0x56c04a=asRecord(_0x4c40a2[_0x476480(0x11d)+'o']);await _0x4e5b4e({'appId':_0x26d6df,'appSecret':_0x2b8ce3,'userInfo':{'openId':getTrimmedString(_0x56c04a[_0x476480(0x151)])||null},'configPath':_0x2c09c2['cliHostC'+'onfigPat'+'h']}),_0x2c09c2[_0x476480(0x211)]=_0x26d6df,_0x2c09c2[_0x476480(0x28d)+_0x476480(0x215)]=_0x2b8ce3,_0x210adf(_0x2c09c2),_0x2c09c2['message']=_0x476480(0x270)+_0x476480(0xdc),_0x23247d(_0x2c09c2);return;}if(!_0x3c4c3a||_0x3c4c3a==='authoriz'+_0x476480(0x1fe)+_0x476480(0x293)){_0xd4adee(_0x2c09c2);return;}if(_0x3c4c3a===_0x476480(0x195)+'n'){_0x2c09c2[_0x476480(0xd1)+_0x476480(0x14d)+'s']+=0x1388,_0xd4adee(_0x2c09c2);return;}_0x2c09c2[_0x476480(0x20b)]=_0x476480(0x294),_0x2c09c2['errorMes'+_0x476480(0x18a)]=getTrimmedString(_0x4c40a2['error_de'+_0x476480(0x2b7)+'n'])||_0x476480(0x2ad)+':'+_0x3c4c3a,_0x210adf(_0x2c09c2);}catch(_0x20bed4){_0x2c09c2[_0x476480(0x20b)]='error',_0x2c09c2[_0x476480(0x253)+'sage']=_0x20bed4 instanceof Error?_0x20bed4['message']:_0x476480(0x2ad),_0x210adf(_0x2c09c2);}}async function _0x3c5607(_0x38e991){const _0xbe49ed=_0x35ea73;await _0x5994a2({'accountName':_0xbe49ed(0xfd)}),_0x38e991[_0xbe49ed(0x20b)]=_0xbe49ed(0x1b5)+'d',_0x38e991[_0xbe49ed(0x157)]=_0xbe49ed(0x1b5)+'d',_0x38e991[_0xbe49ed(0xd8)]=_0xbe49ed(0x12a)+'完成',_0x38e991[_0xbe49ed(0x253)+_0xbe49ed(0x18a)]=null;}async function _0x5598f8(){const _0x580292=_0x35ea73,_0x1b0922=createFeishuRegistrationClient(),_0x1ecb5=await initFeishuRegistration(_0x1b0922),_0x2feffa=Array[_0x580292(0x11e)](_0x1ecb5[_0x580292(0x283)+_0x580292(0x2c9)+'ethods'])?_0x1ecb5[_0x580292(0x283)+_0x580292(0x2c9)+'ethods'][_0x580292(0x21a)](getTrimmedString)['filter'](Boolean):[];if(!_0x2feffa[_0x580292(0x1ac)](_0x580292(0x259)+_0x580292(0x208)))throw new Error(_0x580292(0x1d5)+_0x580292(0x143)+_0x580292(0x259)+_0x580292(0x292));const _0x4fce5e=await beginFeishuRegistration(_0x1b0922),_0x20edce=getTrimmedString(_0x4fce5e[_0x580292(0x180)+_0x580292(0x1e3)+_0x580292(0xc3)+'e']),_0x33cff0=getTrimmedString(_0x4fce5e['device_c'+'ode']),_0x5ea9f3=Number(_0x4fce5e[_0x580292(0x112)+'n'])||0x258,_0x3e87ef=Number(_0x4fce5e['interval'])||0x5;if(!_0x20edce||!_0x33cff0)throw new Error('飞书开放平台未返'+_0x580292(0x12d)+_0x580292(0xda)+_0x580292(0x18c));const _0x3ce5d6=randomUUID(),_0x532d6f={'sessionId':_0x3ce5d6,'status':'pending','phase':_0x580292(0x230),'url':_0x20edce,'appDeviceCode':_0x33cff0,'appPollClient':_0x1b0922,'appPollIntervalMs':Math[_0x580292(0x10c)](_0x3e87ef*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'appExpiresAt':Date[_0x580292(0x187)]()+_0x5ea9f3*0x3e8,'appTimer':null,'authStatusTimer':null,'authStatusStartedAt':0x0,'deviceCode':null,'message':_0x580292(0x138)+_0x580292(0x2c1),'errorMessage':null,'process':null,'output':'','cliHostConfigPath':_0x12b48f(),'cliAppId':null,'cliAppSecret':null};return _0x3c1879['set'](_0x3ce5d6,_0x532d6f),_0xd4adee(_0x532d6f),createFeishuDocCliStatus(_0x532d6f);}function _0x3eba42(_0xf00660={}){const _0x104d5f=_0x35ea73,_0x47d763=safeString(_0xf00660['sessionI'+'d']);if(!_0x47d763)throw new Error(_0x104d5f(0x1ba)+_0x104d5f(0x1a2)+_0x104d5f(0x2d2)+_0x104d5f(0x156)+'uired');const _0x434d12=_0x3c1879['get'](_0x47d763);if(!_0x434d12)throw new Error(_0x104d5f(0x1ba)+_0x104d5f(0x1a2)+_0x104d5f(0x10b)+_0x104d5f(0x2b3));return createFeishuDocCliStatus(_0x434d12);}function _0xfef56c(_0x3053c4={}){const _0x129df7=_0x35ea73,_0x49e247=safeString(_0x3053c4[_0x129df7(0x174)+'d']);if(!_0x49e247)return{'ok':!![]};const _0x1ff9c5=_0x3c1879[_0x129df7(0x2bf)](_0x49e247);if(!_0x1ff9c5)return{'ok':!![]};return _0x210adf(_0x1ff9c5),_0x38127b(_0x1ff9c5),_0x1ff9c5[_0x129df7(0x1e2)]?.['kill'](),_0x3c1879['delete'](_0x49e247),{'ok':!![]};}function _0x717cf6(_0x43151b={}){const _0x1eb5cb=_0x35ea73,_0xfac975=safeString(_0x43151b[_0x1eb5cb(0x174)+'d']);if(!_0xfac975)throw new Error('Feishu\x20d'+_0x1eb5cb(0x1a2)+_0x1eb5cb(0x2d2)+_0x1eb5cb(0x156)+_0x1eb5cb(0x1d4));const _0x53e9fb=_0x3c1879[_0x1eb5cb(0x2bf)](_0xfac975);if(!_0x53e9fb)throw new Error(_0x1eb5cb(0x1ba)+_0x1eb5cb(0x1a2)+_0x1eb5cb(0x10b)+'ot\x20found');if(_0x53e9fb['status']===_0x1eb5cb(0x294))throw new Error(_0x53e9fb[_0x1eb5cb(0x253)+_0x1eb5cb(0x18a)]||_0x1eb5cb(0x24d)+_0x1eb5cb(0x15d));return{'ok':!![]};}async function _0x36b046(_0x170877){const _0xe63a78=_0x35ea73,_0x7f3a95=asRecord(_0x170877[_0xe63a78(0x1cd)]),_0x3f2914=asRecord(_0x7f3a95[_0xe63a78(0x281)]),_0x37b0f9=asStringArray(_0x7f3a95[_0xe63a78(0xff)]),_0xd6d044=asRecord(_0x3f2914[WECHAT_PLUGIN_ID]),_0x6646de=_0xd6d044[_0xe63a78(0x2b9)]===!![]||_0x37b0f9[_0xe63a78(0x1ac)](WECHAT_PLUGIN_ID),_0xd8a2da=join(_0x3aad17[_0xe63a78(0x21e)+_0xe63a78(0x17a)](),WECHAT_PLUGIN_ID),_0x122895=join(_0xd8a2da,_0xe63a78(0x28e)+_0xe63a78(0x25f));let _0x3ca592=![];try{const _0x32b4c4=(await readFile(_0x122895,_0xe63a78(0xd4)))[_0xe63a78(0x13f)]();if(_0x32b4c4){const _0x37d3c8=JSON[_0xe63a78(0x153)](_0x32b4c4);_0x3ca592=Array[_0xe63a78(0x11e)](_0x37d3c8)?_0x37d3c8[_0xe63a78(0x116)]>0x0:Object[_0xe63a78(0x1fa)](asRecord(_0x37d3c8))['length']>0x0;}}catch{}if(!_0x3ca592)try{_0x3ca592=(await readdir(join(_0xd8a2da,_0xe63a78(0x28e))))[_0xe63a78(0x116)]>0x0;}catch{}return{'exists':_0x6646de||_0x3ca592,'enabled':_0x6646de,'connected':_0x6646de&&_0x3ca592};}async function _0x130961(){const _0x1d8f76=_0x35ea73,_0x3ac3e9=await _0x2d7664(),_0x51de23=asRecord(_0x3ac3e9['channels']),_0x279524=[],_0x4a2f3d=await _0x36b046(_0x3ac3e9);_0x4a2f3d[_0x1d8f76(0x1cc)]&&_0x279524[_0x1d8f76(0x24b)]({'id':WECHAT_PLUGIN_ID,'type':_0x1d8f76(0x296),'name':'微信','enabled':_0x4a2f3d[_0x1d8f76(0x2b9)],'connected':_0x4a2f3d[_0x1d8f76(0x185)+'d']});const _0x2f9fc9=asRecord(_0x51de23[_0x1d8f76(0x134)]),_0xd20dd7=getTrimmedString(_0x2f9fc9[_0x1d8f76(0x20f)]),_0x14544e=getTrimmedString(_0x2f9fc9[_0x1d8f76(0x140)+_0x1d8f76(0x215)]);_0xd20dd7&&_0x14544e&&_0x279524[_0x1d8f76(0x24b)]({'id':_0x1d8f76(0x134),'type':'qqbot','name':_0x1d8f76(0xd6),'enabled':_0x2f9fc9[_0x1d8f76(0x2b9)]!==![],'appId':_0xd20dd7,'clientSecret':_0x14544e});const _0x361a47=asRecord(_0x51de23['wecom']),_0x1cae71=getTrimmedString(_0x361a47[_0x1d8f76(0x1f2)]),_0xb064a1=getTrimmedString(_0x361a47[_0x1d8f76(0x232)]);_0x1cae71&&_0xb064a1&&_0x279524[_0x1d8f76(0x24b)]({'id':_0x1d8f76(0x155),'type':_0x1d8f76(0x155),'name':_0x1d8f76(0x2a9),'enabled':_0x361a47['enabled']!==![],'botId':_0x1cae71,'secret':_0xb064a1});const _0x2023d8=asRecord(_0x51de23[_0x1d8f76(0x29c)]),_0x2a790d=getTrimmedString(_0x2023d8[_0x1d8f76(0x20f)]),_0x19612a=getTrimmedString(_0x2023d8[_0x1d8f76(0x1fb)+'t']);return _0x2a790d&&_0x19612a&&getTrimmedString(_0x2023d8['managedB'+'y'])!==FEISHU_DOC_CONNECTOR_PLUGIN_ID&&_0x279524['push']({'id':_0x1d8f76(0x29c),'type':_0x1d8f76(0x29c),'name':_0x1d8f76(0x19b),'enabled':_0x2023d8[_0x1d8f76(0x2b9)]!==![],'appId':_0x2a790d,'appSecret':_0x19612a}),_0x279524;}async function _0x2cbb9a(_0x2f0244){const _0x2f59a7=_0x35ea73;if(typeof openClawConfigHandlers[_0x2f59a7(0x102)+_0x2f59a7(0x263)]===_0x2f59a7(0x1a4))return openClawConfigHandlers[_0x2f59a7(0x102)+_0x2f59a7(0x263)]({'pluginId':WECHAT_PLUGIN_ID,'enabled':Boolean(_0x2f0244),'reason':WECHAT_PLUGIN_ID+_0x2f59a7(0x191)+(_0x2f0244?_0x2f59a7(0x2b9):_0x2f59a7(0x262))});const _0x47de9e=await _0x2d7664(),_0x585a35=asRecord(_0x47de9e[_0x2f59a7(0x1cd)]),_0x414b73=asRecord(_0x585a35[_0x2f59a7(0x281)]);return _0x414b73[WECHAT_PLUGIN_ID]={...asRecord(_0x414b73[WECHAT_PLUGIN_ID]),'enabled':Boolean(_0x2f0244)},_0x585a35[_0x2f59a7(0x281)]=_0x414b73,_0x585a35['allow']=_0x2f0244?dedupeStrings([...asStringArray(_0x585a35[_0x2f59a7(0xff)]),WECHAT_PLUGIN_ID]):asStringArray(_0x585a35[_0x2f59a7(0xff)])[_0x2f59a7(0x110)](_0x5a1b52=>_0x5a1b52!==WECHAT_PLUGIN_ID),_0x47de9e[_0x2f59a7(0x1cd)]=_0x585a35,await _0x17ccc5(_0x47de9e,WECHAT_PLUGIN_ID+'\x20plugin\x20'+(_0x2f0244?_0x2f59a7(0x2b9):'disabled')),{'ok':!![]};}async function _0x1a2fad(_0x3accb4={}){const _0x4f5306=_0x35ea73,_0x3565d0=safeString(_0x3accb4[_0x4f5306(0x290)+'d']||_0x3accb4['id']);if(!_0x3565d0)throw new Error('Channel\x20'+_0x4f5306(0x1cb)+_0x4f5306(0x213));const _0x54fa4f=await _0x2d7664(),_0x30632c=asRecord(_0x54fa4f['channels']),_0x3174fc=asRecord(_0x54fa4f[_0x4f5306(0x1cd)]),_0x24b58c=asRecord(_0x3174fc[_0x4f5306(0x281)]),_0x199d12=_0xc205a3=>{const _0x2bf77f=_0x4f5306;_0x24b58c[_0xc205a3]=createConnectorPluginEntry(_0xc205a3,_0x24b58c[_0xc205a3],![],{}),_0x3174fc[_0x2bf77f(0xff)]=asStringArray(_0x3174fc[_0x2bf77f(0xff)])[_0x2bf77f(0x110)](_0x6f87d0=>_0x6f87d0!==_0xc205a3),_0x3174fc['entries']=_0x24b58c,_0x54fa4f[_0x2bf77f(0x1cd)]=_0x3174fc;};if(_0x3565d0===_0x4f5306(0x203)+'oc')return _0x199d12(FEISHU_DOC_CONNECTOR_PLUGIN_ID),getTrimmedString(asRecord(_0x30632c['feishu'])['managedB'+'y'])===FEISHU_DOC_CONNECTOR_PLUGIN_ID&&(delete _0x30632c[_0x4f5306(0x29c)],_0x54fa4f['channels']=_0x30632c),await rm(_0x326b6e(),{'recursive':!![],'force':!![]})[_0x4f5306(0x25c)](()=>{}),_0x17ccc5(_0x54fa4f,_0x4f5306(0x268)+_0x4f5306(0x1ee)+_0x4f5306(0x109)+_0x4f5306(0x193)+_0x4f5306(0x1c2));if(_0x3565d0===_0x4f5306(0x1bf)){if(typeof openClawConfigHandlers[_0x4f5306(0x102)+_0x4f5306(0x263)]===_0x4f5306(0x1a4))return openClawConfigHandlers[_0x4f5306(0x102)+_0x4f5306(0x263)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x4f5306(0x141)+'connecto'+_0x4f5306(0x2bd)+'\x20deleted'});return _0x199d12(QQ_MAIL_CONNECTOR_PLUGIN_ID),_0x17ccc5(_0x54fa4f,_0x4f5306(0x141)+_0x4f5306(0xf3)+_0x4f5306(0x2bd)+_0x4f5306(0x150));}if(_0x3565d0===_0x4f5306(0xf9)+_0x4f5306(0x243)){if(typeof openClawConfigHandlers[_0x4f5306(0x102)+'nConfig']===_0x4f5306(0x1a4))return openClawConfigHandlers['setPlugi'+'nConfig']({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x4f5306(0x1e1)+_0x4f5306(0x117)+_0x4f5306(0x1f7)+_0x4f5306(0x1a7)+_0x4f5306(0x13b)});return _0x199d12(NETEASE_MAIL_CONNECTOR_PLUGIN_ID),_0x17ccc5(_0x54fa4f,_0x4f5306(0x1e1)+_0x4f5306(0x117)+'nector\x20p'+'lugin\x20de'+_0x4f5306(0x13b));}if(_0x3565d0===_0x4f5306(0xe0)+'exmail'){if(typeof openClawConfigHandlers['setPlugi'+_0x4f5306(0x263)]==='function')return openClawConfigHandlers['setPlugi'+_0x4f5306(0x263)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x4f5306(0x245)+_0x4f5306(0x170)+_0x4f5306(0xef)+_0x4f5306(0x191)+_0x4f5306(0x16e)});return _0x199d12(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID),_0x17ccc5(_0x54fa4f,'tencent\x20'+_0x4f5306(0x170)+'onnector'+_0x4f5306(0x191)+'deleted');}if(_0x3565d0===_0x4f5306(0xe0)+'docs'){if(typeof openClawConfigHandlers[_0x4f5306(0x1fd)+'illEntry']===_0x4f5306(0x1a4))return openClawConfigHandlers[_0x4f5306(0x1fd)+_0x4f5306(0x2b1)]({'skillId':TENCENT_DOCS_SKILL_ID,'reason':_0x4f5306(0x245)+_0x4f5306(0x1de)+_0x4f5306(0x210)+'ctor\x20del'+_0x4f5306(0x26d)});const _0x2864c5=asRecord(_0x54fa4f[_0x4f5306(0x2b5)]),_0xc6a21=asRecord(_0x2864c5[_0x4f5306(0x281)]);return delete _0xc6a21[TENCENT_DOCS_SKILL_ID],_0x2864c5[_0x4f5306(0x281)]=_0xc6a21,_0x54fa4f['skills']=_0x2864c5,_0x17ccc5(_0x54fa4f,_0x4f5306(0x245)+_0x4f5306(0x1de)+_0x4f5306(0x210)+_0x4f5306(0x196)+_0x4f5306(0x26d));}if(_0x3565d0===_0x4f5306(0x1df))return await _0x24f352([_0x4f5306(0x1a5),_0x4f5306(0x29f)])[_0x4f5306(0x25c)](()=>({'code':null,'output':''})),await _0x397015(),{'ok':!![]};if(_0x3565d0==='dingtalk'+_0x4f5306(0x2c8)){if(typeof openClawConfigHandlers[_0x4f5306(0x1a0)+_0x4f5306(0x17d)]===_0x4f5306(0x1a4))return openClawConfigHandlers['deleteMc'+_0x4f5306(0x17d)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'reason':_0x4f5306(0x26e)+'\x20doc\x20mcp'+'\x20deleted'});const _0x3e6ac8=readOpenClawMcpServersFromConfig(_0x54fa4f);return delete _0x3e6ac8[DINGTALK_DOC_MCP_SERVER_NAME],writeOpenClawMcpServersToConfig(_0x54fa4f,_0x3e6ac8),_0x17ccc5(_0x54fa4f,_0x4f5306(0x26e)+_0x4f5306(0xde)+_0x4f5306(0x150));}if(_0x3565d0===WECHAT_PLUGIN_ID||_0x3565d0===_0x4f5306(0x1ce)+_0x4f5306(0x15e)){_0x24b58c[WECHAT_PLUGIN_ID]={...asRecord(_0x24b58c[WECHAT_PLUGIN_ID]),'enabled':![]},_0x3174fc[_0x4f5306(0x281)]=_0x24b58c,_0x3174fc['allow']=asStringArray(_0x3174fc['allow'])[_0x4f5306(0x110)](_0x27ba0d=>_0x27ba0d!==WECHAT_PLUGIN_ID&&_0x27ba0d!=='openclaw'+'-weixin'),_0x54fa4f[_0x4f5306(0x1cd)]=_0x3174fc;const _0x20c9aa=join(_0x3aad17[_0x4f5306(0x21e)+_0x4f5306(0x17a)](),WECHAT_PLUGIN_ID);return await rm(join(_0x20c9aa,_0x4f5306(0x28e)+'.json'),{'force':!![]})['catch'](()=>{}),await rm(join(_0x20c9aa,_0x4f5306(0x28e)),{'recursive':!![],'force':!![]})[_0x4f5306(0x25c)](()=>{}),_0x17ccc5(_0x54fa4f,_0x3565d0+(_0x4f5306(0x23c)+_0x4f5306(0xe5)+_0x4f5306(0x16e)));}if(_0x3565d0===_0x4f5306(0x29c)){if(typeof openClawConfigHandlers[_0x4f5306(0xe7)+'annelCon'+'fig']===_0x4f5306(0x1a4))return openClawConfigHandlers['deleteCh'+_0x4f5306(0x107)+'fig']({'channelId':_0x4f5306(0x29c),'pluginId':_0x4f5306(0x29c),'reason':_0x4f5306(0x160)+_0x4f5306(0x1e9)+_0x4f5306(0x227)+_0x4f5306(0x13b)});return delete _0x30632c['feishu'],_0x54fa4f[_0x4f5306(0xc8)]=_0x30632c,_0x24b58c[_0x4f5306(0x29c)]={...asRecord(_0x24b58c[_0x4f5306(0x29c)]),'enabled':![]},_0x3174fc[_0x4f5306(0x281)]=_0x24b58c,_0x3174fc['allow']=asStringArray(_0x3174fc['allow'])[_0x4f5306(0x110)](_0x2328e=>_0x2328e!==_0x4f5306(0x29c)),_0x54fa4f[_0x4f5306(0x1cd)]=_0x3174fc,_0x17ccc5(_0x54fa4f,_0x4f5306(0x160)+_0x4f5306(0x1e9)+_0x4f5306(0x227)+_0x4f5306(0x13b));}if(_0x3565d0==='qqbot'){if(typeof openClawConfigHandlers[_0x4f5306(0xe7)+_0x4f5306(0x107)+'fig']===_0x4f5306(0x1a4))return openClawConfigHandlers['deleteCh'+'annelCon'+_0x4f5306(0x2b2)]({'channelId':'qqbot','pluginId':QQBOT_PLUGIN_ID,'reason':_0x4f5306(0x266)+'annel\x20co'+_0x4f5306(0x1ea)+_0x4f5306(0x26d)});delete _0x30632c[_0x4f5306(0x134)],_0x24b58c[QQBOT_PLUGIN_ID]={...asRecord(_0x24b58c[QQBOT_PLUGIN_ID]),'enabled':![]},_0x3174fc[_0x4f5306(0xff)]=asStringArray(_0x3174fc[_0x4f5306(0xff)])['filter'](_0x5725ac=>_0x5725ac!==QQBOT_PLUGIN_ID);}if(_0x3565d0===_0x4f5306(0x155)){if(typeof openClawConfigHandlers[_0x4f5306(0xe7)+_0x4f5306(0x107)+_0x4f5306(0x2b2)]===_0x4f5306(0x1a4))return openClawConfigHandlers[_0x4f5306(0xe7)+_0x4f5306(0x107)+'fig']({'channelId':'wecom','pluginId':WECOM_PLUGIN_ID,'reason':_0x4f5306(0x237)+_0x4f5306(0x2c4)+_0x4f5306(0x1ea)+_0x4f5306(0x26d)});delete _0x30632c['wecom'],_0x24b58c[WECOM_PLUGIN_ID]={...asRecord(_0x24b58c[WECOM_PLUGIN_ID]),'enabled':![]},_0x3174fc['allow']=asStringArray(_0x3174fc[_0x4f5306(0xff)])[_0x4f5306(0x110)](_0x2f4471=>_0x2f4471!==WECOM_PLUGIN_ID);}return _0x54fa4f[_0x4f5306(0xc8)]=_0x30632c,_0x3174fc[_0x4f5306(0x281)]=_0x24b58c,_0x54fa4f[_0x4f5306(0x1cd)]=_0x3174fc,_0x17ccc5(_0x54fa4f,_0x3565d0+(_0x4f5306(0x23c)+'\x20config\x20'+_0x4f5306(0x16e)));}async function _0x3e3003(_0x7bbf81={}){const _0x85d2af=_0x35ea73,_0x4de48e=safeString(_0x7bbf81[_0x85d2af(0x290)+'d']||_0x7bbf81['id']);if(!_0x4de48e)throw new Error(_0x85d2af(0x1e5)+_0x85d2af(0x1cb)+_0x85d2af(0x213));const _0x37aaf2=_0x7bbf81[_0x85d2af(0x2b9)]===!![],_0x4f1df6=await _0x2d7664(),_0x3b0f2a=asRecord(_0x4f1df6[_0x85d2af(0x1cd)]),_0x13fbd3=asRecord(_0x3b0f2a[_0x85d2af(0x281)]),_0x5bab0a=_0x49c149=>{const _0x1ad550=_0x85d2af;_0x13fbd3[_0x49c149]=createConnectorPluginEntry(_0x49c149,_0x13fbd3[_0x49c149],_0x37aaf2,{},{'preserveExistingConfig':!![]}),_0x3b0f2a['allow']=_0x37aaf2?dedupeStrings([...asStringArray(_0x3b0f2a[_0x1ad550(0xff)]),_0x49c149]):asStringArray(_0x3b0f2a[_0x1ad550(0xff)])[_0x1ad550(0x110)](_0x25042a=>_0x25042a!==_0x49c149),_0x3b0f2a[_0x1ad550(0x281)]=_0x13fbd3,_0x4f1df6[_0x1ad550(0x1cd)]=_0x3b0f2a;};if(_0x4de48e==='feishu_d'+'oc'){const _0x17d595=asRecord(_0x13fbd3[FEISHU_DOC_CONNECTOR_PLUGIN_ID]);if(Object[_0x85d2af(0x1fa)](_0x17d595)[_0x85d2af(0x116)]===0x0)throw new Error(_0x85d2af(0x189)+'r\x20\x22'+_0x4de48e+('\x22\x20not\x20fo'+_0x85d2af(0x169)));if(typeof openClawConfigHandlers['setPlugi'+_0x85d2af(0x263)]===_0x85d2af(0x1a4))return openClawConfigHandlers[_0x85d2af(0x102)+_0x85d2af(0x263)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':_0x37aaf2,'reason':_0x4de48e+(_0x85d2af(0x23c)+_0x85d2af(0xe5))+(_0x37aaf2?_0x85d2af(0x2b9):_0x85d2af(0x262))});_0x5bab0a(FEISHU_DOC_CONNECTOR_PLUGIN_ID);}else{if(_0x4de48e===_0x85d2af(0x1bf)){if(typeof openClawConfigHandlers[_0x85d2af(0x102)+_0x85d2af(0x263)]==='function')return openClawConfigHandlers['setPlugi'+_0x85d2af(0x263)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x37aaf2,'reason':_0x4de48e+(_0x85d2af(0x23c)+_0x85d2af(0xe5))+(_0x37aaf2?_0x85d2af(0x2b9):_0x85d2af(0x262))});_0x5bab0a(QQ_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x4de48e===_0x85d2af(0xf9)+'mail'){if(typeof openClawConfigHandlers[_0x85d2af(0x102)+'nConfig']===_0x85d2af(0x1a4))return openClawConfigHandlers['setPlugi'+_0x85d2af(0x263)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x37aaf2,'reason':_0x4de48e+(_0x85d2af(0x23c)+_0x85d2af(0xe5))+(_0x37aaf2?_0x85d2af(0x2b9):_0x85d2af(0x262))});_0x5bab0a(NETEASE_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x4de48e===_0x85d2af(0xe0)+'exmail'){if(typeof openClawConfigHandlers[_0x85d2af(0x102)+_0x85d2af(0x263)]===_0x85d2af(0x1a4))return openClawConfigHandlers[_0x85d2af(0x102)+_0x85d2af(0x263)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x37aaf2,'reason':_0x4de48e+(_0x85d2af(0x23c)+_0x85d2af(0xe5))+(_0x37aaf2?'enabled':_0x85d2af(0x262))});_0x5bab0a(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x4de48e===_0x85d2af(0xe0)+_0x85d2af(0x101)){const _0x5e4b5f=asRecord(_0x4f1df6['skills']),_0x48075d=asRecord(_0x5e4b5f[_0x85d2af(0x281)]),_0x33ab24=asRecord(_0x48075d[TENCENT_DOCS_SKILL_ID]);if(typeof openClawConfigHandlers[_0x85d2af(0x1f1)+'Entry']===_0x85d2af(0x1a4))return openClawConfigHandlers['setSkill'+_0x85d2af(0x1b9)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':{..._0x33ab24,'enabled':_0x37aaf2},'reason':_0x4de48e+(_0x85d2af(0x23c)+_0x85d2af(0xe5))+(_0x37aaf2?_0x85d2af(0x2b9):'disabled')});_0x48075d[TENCENT_DOCS_SKILL_ID]={..._0x33ab24,'enabled':_0x37aaf2},_0x5e4b5f[_0x85d2af(0x281)]=_0x48075d,_0x4f1df6[_0x85d2af(0x2b5)]=_0x5e4b5f;}else{if(_0x4de48e==='kdocs'){if(_0x37aaf2&&!await _0x5c6e4b())throw new Error(_0x85d2af(0x2cc)+',请先连接');return await _0x5a187c(_0x37aaf2),{'ok':!![]};}else{if(_0x4de48e===_0x85d2af(0x26e)+_0x85d2af(0x2c8)){const _0x55ef5c=readOpenClawMcpServersFromConfig(_0x4f1df6),_0x33ce1d=findDingtalkDocMcpServer(_0x55ef5c);if(!getTrimmedString(_0x33ce1d['url']))throw new Error(_0x85d2af(0x189)+_0x85d2af(0x173)+_0x4de48e+(_0x85d2af(0x2a4)+'und'));_0x55ef5c[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x33ce1d[_0x85d2af(0x139)],{'enabled':_0x37aaf2}),writeOpenClawMcpServersToConfig(_0x4f1df6,_0x55ef5c);}else{const _0x585504=asRecord(_0x4f1df6[_0x85d2af(0xc8)]),_0x21820e=asRecord(_0x585504[_0x4de48e]);if(Object[_0x85d2af(0x1fa)](_0x21820e)['length']===0x0)throw new Error('Channel\x20'+'\x22'+_0x4de48e+(_0x85d2af(0x2a4)+'und'));_0x21820e[_0x85d2af(0x2b9)]=_0x37aaf2;let _0x4e08cd=null;_0x4de48e===_0x85d2af(0x29c)&&(_0x4e08cd='feishu',_0x37aaf2&&(_0x21820e['streamin'+'g']=!![],delete _0x21820e[_0x85d2af(0x186)]));if(_0x4de48e===_0x85d2af(0x134))_0x4e08cd=QQBOT_PLUGIN_ID;if(_0x4de48e===_0x85d2af(0x155))_0x4e08cd=WECOM_PLUGIN_ID;if(_0x4e08cd&&typeof openClawConfigHandlers[_0x85d2af(0x236)+_0x85d2af(0x224)]==='function')return openClawConfigHandlers[_0x85d2af(0x236)+_0x85d2af(0x224)]({'channelId':_0x4de48e,'channel':_0x21820e,'pluginId':_0x4e08cd,'pluginEnabled':_0x37aaf2,'reason':_0x4de48e+(_0x85d2af(0x23c)+_0x85d2af(0xe5))+(_0x37aaf2?'enabled':_0x85d2af(0x262))});_0x585504[_0x4de48e]=_0x21820e,_0x4f1df6['channels']=_0x585504;if(_0x4de48e===_0x85d2af(0x29c))_0x5bab0a('feishu');if(_0x4de48e===_0x85d2af(0x134))_0x5bab0a(QQBOT_PLUGIN_ID);if(_0x4de48e===_0x85d2af(0x155))_0x5bab0a(WECOM_PLUGIN_ID);}}}}}}}return _0x17ccc5(_0x4f1df6,_0x4de48e+(_0x85d2af(0x23c)+_0x85d2af(0xe5))+(_0x37aaf2?_0x85d2af(0x2b9):_0x85d2af(0x262)));}async function _0x5ce5a8({gatewayPort:_0x52701b,gatewayToken:_0x1f26bd}={}){const _0x176550=_0x35ea73;_0x2ba560&&(_0x2ba560[_0x176550(0x2c2)](),_0x2ba560=null);const {cwd:_0xb9c786,env:_0x407151,runtime:_0x261de9}=await _0x403451({'FORCE_COLOR':'0',..._0x52701b?{'OPENCLAW_GATEWAY_PORT':String(_0x52701b)}:{},..._0x1f26bd?{'OPENCLAW_GATEWAY_TOKEN':_0x1f26bd}:{}}),_0x1b2fa3=_0x261de9['plugins'][_0x176550(0x2be)](_0x591603=>_0x591603[_0x176550(0x122)]===WECHAT_PLUGIN_ID);if(!_0x1b2fa3){const _0x2e69f9=_0x176550(0xc6)+_0x176550(0x252)+_0x176550(0x16f)+_0x176550(0x257);return _0x3868f8(_0x176550(0xfb)+'tatus',_0x176550(0x111)),_0x3868f8('wechat-l'+'og',_0x2e69f9),{'ok':![],'error':_0x2e69f9};}await _0x2cbb9a(!![]),_0x3868f8('wechat-l'+'og',_0x176550(0x244)+_0x176550(0x267)+'hannels\x20'+_0x176550(0x1e7)+'channel\x20'+_0x1b2fa3[_0x176550(0x122)]),_0x2ba560=spawn(_0x261de9[_0x176550(0x23d)+_0x176550(0x130)],[_0x261de9[_0x176550(0x1ce)+'Bin'],_0x176550(0xc8),'login',_0x176550(0x1ff)+'l',_0x1b2fa3[_0x176550(0x122)]],{'cwd':_0xb9c786,'env':_0x407151});let _0x12a37a='',_0x4d06ee=![],_0xc4d1e9=![];const _0x50942f=_0x5c1c7e=>{const _0xb0fb4e=_0x176550,_0x169de4=_0x5c1c7e[_0xb0fb4e(0x121)]();_0x12a37a+=_0x169de4;if(!_0x4d06ee){const _0x2af294=_0x12a37a['match'](/(https:\/\/(?:[a-zA-Z0-9-]+\.)*weixin\.qq\.com\S+)/i);_0x2af294?.[0x1]&&(_0x4d06ee=!![],_0x3868f8(_0xb0fb4e(0x14a)+_0xb0fb4e(0x1af),_0x2af294[0x1]),_0x3868f8('wechat-s'+_0xb0fb4e(0x1ed),_0xb0fb4e(0x258)));}if(_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0x12b))||_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0x100)+_0xb0fb4e(0x2cd))||_0x169de4['includes'](_0xb0fb4e(0x24e)))_0x3868f8(_0xb0fb4e(0xfb)+_0xb0fb4e(0x1ed),'SCANNED');else{if(_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0xd5))||_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0x206))||_0x169de4[_0xb0fb4e(0x1ac)]('扫码成功')||_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0x1dd)+'n')||_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0x241)+_0xb0fb4e(0x19f))||_0x169de4[_0xb0fb4e(0x1ac)]('启动成功')||_0x169de4['includes'](_0xb0fb4e(0x12c))||_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0x10f))||_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0x1f3)+_0xb0fb4e(0x185)+'d')||_0x169de4[_0xb0fb4e(0x1ac)](_0xb0fb4e(0xcd)+_0xb0fb4e(0x11c)+_0xb0fb4e(0x275)))_0xc4d1e9=!![],_0x3868f8('wechat-s'+_0xb0fb4e(0x1ed),_0xb0fb4e(0x209)),setTimeout(()=>{_0x2ba560&&(_0x2ba560['kill'](),_0x2ba560=null);},0xbb8);else{if(_0x169de4['includes']('过期')||_0x169de4['includes']('expired'))_0x3868f8(_0xb0fb4e(0xfb)+_0xb0fb4e(0x1ed),_0xb0fb4e(0x198));else(_0x169de4['includes']('失败')||_0x169de4['includes'](_0xb0fb4e(0x11f))||_0x169de4['includes'](_0xb0fb4e(0x12e)))&&_0x3868f8(_0xb0fb4e(0xfb)+_0xb0fb4e(0x1ed),_0xb0fb4e(0x111));}}_0x3868f8(_0xb0fb4e(0x1db)+'og',_0x169de4);};return _0x2ba560['stdout']?.['on']('data',_0x50942f),_0x2ba560[_0x176550(0x183)]?.['on'](_0x176550(0x202),_0x50942f),_0x2ba560['on'](_0x176550(0x294),_0xdcd8b9=>{const _0x2d54b7=_0x176550;_0x2ba560=null,_0x3868f8('wechat-s'+_0x2d54b7(0x1ed),_0x2d54b7(0x111)),_0x3868f8(_0x2d54b7(0x1db)+'og','Spawn\x20er'+'ror:\x20'+_0xdcd8b9[_0x2d54b7(0xd8)]);}),_0x2ba560['on'](_0x176550(0x2b0),_0x1abbb4=>{const _0x460ddc=_0x176550;_0x2ba560=null,_0xc4d1e9?_0x2cbb9a(!![])['catch'](()=>{}):(_0x2cbb9a(![])[_0x460ddc(0x25c)](()=>{}),_0x3868f8(_0x460ddc(0xfb)+'tatus',_0x1abbb4===0x0?'CLOSED':_0x460ddc(0x111)));}),{'ok':!![]};}function _0x2c64bf(){const _0x54545f=_0x35ea73;return _0x2ba560&&(_0x2ba560[_0x54545f(0x2c2)](),_0x2ba560=null),{'ok':!![]};}function _0x3999eb(){const _0x43a731=_0x35ea73;for(const _0x275729 of _0x7c6eef[_0x43a731(0x278)]()){_0x4538e9(_0x275729),_0x275729[_0x43a731(0x1e2)]?.[_0x43a731(0x2c2)]();}_0x7c6eef[_0x43a731(0x207)]();for(const _0x508c4e of _0x931e4c[_0x43a731(0x278)]()){_0x23a31f(_0x508c4e);}_0x931e4c['clear']();for(const _0xfbe566 of _0x3c1879[_0x43a731(0x278)]()){_0x210adf(_0xfbe566),_0x38127b(_0xfbe566),_0xfbe566[_0x43a731(0x1e2)]?.[_0x43a731(0x2c2)]();}_0x3c1879[_0x43a731(0x207)](),_0x2ba560&&(_0x2ba560['kill'](),_0x2ba560=null);}return{'saveFeishuChannelConfig':_0x3d6a66,'saveQqbotChannelConfig':_0x44013a,'saveWecomChannelConfig':_0x155db7,'saveQqMailConnectorConfig':_0x3f87f7,'saveNetEaseMailConnectorConfig':_0x3832f8,'saveTencentExmailConnectorConfig':_0x8ce02f,'saveFeishuDocConnectorConfig':_0x5994a2,'saveTencentDocsConnectorConfig':_0x241ec7,'saveKdocsConnectorConfig':_0x4bff87,'saveDingtalkDocConnectorConfig':_0x5c77bf,'readConfigSnapshot':_0x158514,'startKdocsCliConnectSession':_0x4fb3c5,'getKdocsCliConnectStatus':_0x3fa367,'cancelKdocsCliConnectSession':_0x2b223d,'startFeishuDocCliConnectSession':_0x5598f8,'getFeishuDocCliConnectStatus':_0x3eba42,'cancelFeishuDocCliConnectSession':_0xfef56c,'completeFeishuDocCliConnectSession':_0x717cf6,'startFeishuRegistrationSession':_0x118d1b,'getFeishuRegistrationStatus':_0x5c9efe,'cancelFeishuRegistrationSession':_0x586312,'listImChannelConfigs':_0x130961,'deleteImChannelConfig':_0x1a2fad,'setImChannelEnabled':_0x3e3003,'startWechatChannelSession':_0x5ce5a8,'cancelWechatChannelSession':_0x2c64bf,'dispose':_0x3999eb};}
|
|
1
|
+
(function(_0x40f152,_0x18a1c9){const _0x57c467=_0x4c90,_0x988072=_0x40f152();while(!![]){try{const _0x58d2f4=-parseInt(_0x57c467(0x2f4))/0x1*(parseInt(_0x57c467(0x339))/0x2)+-parseInt(_0x57c467(0x1cf))/0x3+-parseInt(_0x57c467(0x35b))/0x4*(parseInt(_0x57c467(0x332))/0x5)+-parseInt(_0x57c467(0x318))/0x6+parseInt(_0x57c467(0x2ac))/0x7+-parseInt(_0x57c467(0x291))/0x8+parseInt(_0x57c467(0x2e4))/0x9*(parseInt(_0x57c467(0x34f))/0xa);if(_0x58d2f4===_0x18a1c9)break;else _0x988072['push'](_0x988072['shift']());}catch(_0x31e590){_0x988072['push'](_0x988072['shift']());}}}(_0x5035,0x87f61));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';function _0x5035(){const _0x1d3ab9=['length','gin\x20upda','sage','deleteSk','769278vMmJTl','启动成功','cess','verify','Error','accounts','e_code:\x20','dated','setPlugi','cret-std','ERROR','icy','\x20is\x20requ','环境不支持创建\x20','output','1.0.0','netease_','data','enabled','onMode','search','Invalid\x20','scriptio','Login\x20su','ill\x20','port\x20cli','2687595oKLWsk','ion\x20sess','ill\x20conn','扫码成功','金山文档','ationUri','ted\x20Feis','1094QMYbyN','hannel\x20c','ion_flow','\x22\x20not\x20fo','client_s','accountN','SUCCESS','expired_','\x20doc\x20mcp','oc\x20conne','annel\x20co','import','重新生成','Data','wujie.ai','kdocs','login\x20--','\x20已安装','Failed','企微助手','stringif','baseUrl','24172600EZJtdi','own,wiki',',sheets,','ired','auth','feishu\x20d','set','ocs-cli\x20','--app-se','allowlis','find','pollInte','4OeSIVa','飞书应用创建失败','--device','errorMes','安装包含微信插件','wechat-l','botId','authoriz','plugins','exmail\x20c','illEntry','authStat','mail\x20con','executab','连接成功','ternally','cliAppSe','ll\x20conne','pID\x20is\x20r','正在启动金山文档','netease\x20','授权页','error_de','openId','hannels\x20','isArray','CLOSED','replace','channel','金山文档授权状态','ready','tencent_','elConfig','once','ocr','onfig\x20up','飞书\x20CLI\x20执','失,无法初始化','smtp.qq.','正在验证金山文档','ion\x20not\x20','请在浏览器完成金','Kdocs\x20CL','eCode','权状态验证超时','POST','用户已取消飞书机','飞书\x20CLI\x20授','match','user','resolveS','wechat-s','gin\x20save','identity','nConfig','appExpir','then','WujieAI','applicat','account','read','nfig\x20del','Current\x20',':user','expire_i','logout','stdout','boolean','availabl','toLowerC','d\x20is\x20req','rvalMs','ve,markd','secret','.com','now','rnal','json','allowFro','string','esAt','onFailur','飞书\x20CLI\x20未','parse','--scope','二维码已过期,请','igRaw','\x20in\x20begi','cliHostC','quired','verifica','Bin','entries','purpose','poll','ion_uri_','channels','\x20plugin\x20','onfig\x20de','init','search:d','login','connecto','\x20updated','\x20exited\x20','appSecre','n\x20respon','share','disabled','protocol','usStarte','ode','.json','appDevic','返回授权\x20URL','r\x20plugin','openclaw','2118906gQQqyB','supporte','function','doc_conn','keys','zationCo','scanned','飞书\x20CLI\x20连','正在进入用户授权','qqbot','appTimer','dAt','footer','feishu','n\x20update','nector\x20p','ror:\x20','imap.qq.','HTTPS_PR','nding','oc\x20CLI\x20s','openExte','led','ationCod','tateDir','trim','fresh','nfig\x20upd','push','omplete','found','Unsuppor','identiti','apiKey','金山文档登录启动','spawn','\x20not\x20sup','setMcpSe','_id','feishu-d','kdocs-cl','complete','toString','tion_url','ession\x20i','flow_id','ector\x20de','lugin\x20de','飞书用户身份','SCANNED','i:keycha','qq\x20mail\x20','飞书文档\x20CLI','nodeExec','-weixin','orizatio','ctor\x20del','egistrat','飞书\x20CLI\x20应','client_i','rver','smtp.exm','lePath','ector','飞书机器人\x20Ap','feishu\x20c','kdocs\x20sk','imap.exm','scope_au','docs\x20ski',',请重新连接','eamableH','飞书机器人','setSkill','d\x20auth','tatus','groupAll','回应用创建页面或','ame','export','streamab','--brand','企微助手\x20Sec','/oauth/v','red','und','请输入有效的钉钉','ion_uri','fig','wecom','includes','QQ\x20邮箱','rcode','skills','onnector','--force-','lastInde','clientSe','error',',请先连接','Local\x20lo','appPollC','all_prox','接失败','slice','process','Feishu\x20r','docs,dri','timer','的新版客户端','mail','ALL_PROX',',请先完成\x20kd','d_auth_m','slow_dow','expired','lark-cli','deleteCh','smtp.163','p\x20URL','当前客户端未内置','utf8','equired','用绑定失败','token','setChann','--no-wai','.opencla','end','open','tion_uri','\x20channel','cret','rlencode','onfigPat','close','code','create','Entry','ation_ur','ill\x20enab','assign','persistC','stderr','\x20deleted','connecti','leted','创建失败','文档\x20Strea','qqbot\x20ch','environm','xOf','or\x20plugi','QR_READY','ase','ent_secr','managedB','interval','begin','allow','gistrati','qq_mail','config','needs_re','required','latest','appId','ll\x20updat','e\x20or\x20dev','annelCon','et\x20auth.','spawn\x20op','full','resolve','uired','usTimer','失败,请确认\x20k','授权状态','feishu_d','valid','le-http','飞书应用创建超时','ecret\x20应用','operty','\x20或\x20devic','catch','markConf','com','verifyTi','pluginId','dmPolicy','entry','钉钉文档\x20Str','pSecret\x20','8367912bOzMog','wecom\x20ch','lient','tus','message','_complet','clear','腾讯文档\x20Key','dingding','open_id','docs-cli','已连接过','startedA','transpor','行失败','n\x20id\x20is\x20','max','tencent\x20','163\x20邮箱','身份要求:\x20','QQ助手','readConf','权状态不符合用户','prototyp','ope-auth','https_pr','\x20connect','5324179bKerxy','ing','sessionI','i_comple','飞书\x20CLI\x20用','ttp\x20URL\x20','utable','feishu_c','ent\x20does','deleted','url','ted','connecte','oc-cli','get','thorizat','deleteMc','正在初始化飞书\x20','_doc','请在飞书开放平台','ail.qq.c','stdin','ID\x20is\x20re','--app-id','device_c','权状态验证失败','Feishu\x20d','channel\x20','oot','bind','mcp','expiresA','map','gin\x20dele','无需重复连接','I\x20sessio','ecret','phase','http_pro','ice_code','Channel\x20','OXY','腾讯文档','\x20device_','call','test','delete','1/app/re','se.','name','skill','ntervalM','kill','r\x20\x22','ethods','docs','9qCJfhe','filter','eted','values','\x20config\x20','等待飞书用户授权','cliAppId','ession\x20n','hu\x20regis','ated','飞书绑定失败:','器人绑定','streamin','exmail','Scan\x20suc','join','371rjOYYa','check','status','onSucces','dingtalk','mer','正在检查飞书\x20C','onfig','tokenSta','is\x20requi','user_inf','Spawn\x20er','https:','code,请重试','pending','response','env:\x20','enclaw\x20c','EXPIRED','\x20专用应用凭据缺','id\x20is\x20re','当前飞书开放平台','update','...(','QQ机器人\x20Ap','<empty>','websocke','env','logged\x20i','Connecto','登录成功','r-log'];_0x5035=function(){return _0x1d3ab9;};return _0x5035();}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(_0x32de8d){const _0x1dfae9=_0x4c90;return typeof _0x32de8d===_0x1dfae9(0x3aa)?_0x32de8d[_0x1dfae9(0x1e8)]():'';}function findDingtalkDocMcpServer(_0x5e5f97){const _0xd0872b=_0x4c90,_0x77f475=asRecord(_0x5e5f97[DINGTALK_DOC_MCP_SERVER_NAME]);if(Object[_0xd0872b(0x1d3)](_0x77f475)[_0xd0872b(0x314)]>0x0)return _0x77f475;for(const [_0x54654e,_0x238432]of Object[_0xd0872b(0x3b7)](_0x5e5f97)){const _0x1d480e=asRecord(_0x238432),_0x582e8f=getTrimmedString(_0x54654e)[_0xd0872b(0x3a0)+'ase'](),_0x297194=getTrimmedString(_0x1d480e[_0xd0872b(0x2b6)])['toLowerC'+_0xd0872b(0x269)]();if(_0x582e8f[_0xd0872b(0x229)]('dingtalk')||_0x582e8f[_0xd0872b(0x229)]('dingding')||_0x582e8f[_0xd0872b(0x229)]('钉钉')||_0x297194[_0xd0872b(0x229)](_0xd0872b(0x2f8))||_0x297194[_0xd0872b(0x229)](_0xd0872b(0x299)))return _0x1d480e;}return{};}function createFeishuRegistrationClient(){const _0x18f835=_0x4c90,_0xec7808=FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV];if(!_0xec7808)throw new Error(_0x18f835(0x1ee)+_0x18f835(0x338)+_0x18f835(0x2ec)+'tration\x20'+_0x18f835(0x304)+DEFAULT_FEISHU_REGISTRATION_ENV);return{'baseUrl':_0xec7808,'headers':{'Content-Type':_0x18f835(0x395)+'ion/x-ww'+'w-form-u'+_0x18f835(0x254)+'d'},'timeoutMs':DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS};}function _0x4c90(_0x515011,_0x34e529){_0x515011=_0x515011-0x1ba;const _0x503553=_0x5035();let _0x4c90f5=_0x503553[_0x515011];return _0x4c90f5;}async function postFeishuRegistration(_0x23d895,_0x37483b){const _0x45f8fb=_0x4c90,_0x8ef064=await fetch(_0x23d895[_0x45f8fb(0x34e)]+(_0x45f8fb(0x222)+_0x45f8fb(0x2db)+_0x45f8fb(0x26f)+'on'),{'method':_0x45f8fb(0x388),'headers':_0x23d895['headers'],'body':new URLSearchParams(_0x37483b)[_0x45f8fb(0x1f9)](),'signal':AbortSignal['timeout'](_0x23d895['timeoutM'+'s'])}),_0x4af585=await _0x8ef064[_0x45f8fb(0x3a8)]()[_0x45f8fb(0x288)](()=>({}));if(!_0x8ef064['ok']){const _0x342e2d=new Error('HTTP\x20'+_0x8ef064[_0x45f8fb(0x2f6)]);_0x342e2d['response'+_0x45f8fb(0x346)]=_0x4af585;throw _0x342e2d;}return asRecord(_0x4af585);}async function initFeishuRegistration(_0x4a1205){const _0x35890b=_0x4c90;return postFeishuRegistration(_0x4a1205,{'action':_0x35890b(0x1bd)});}async function beginFeishuRegistration(_0x1115c8){const _0x863693=_0x4c90;return postFeishuRegistration(_0x1115c8,{'action':_0x863693(0x26d),'archetype':'Personal'+'Agent','auth_method':'client_s'+_0x863693(0x2d0),'request_user_info':_0x863693(0x29a)});}async function pollFeishuRegistration(_0x1abca5,_0x37f632){const _0x414d2f=_0x4c90;try{return await postFeishuRegistration(_0x1abca5,{'action':_0x414d2f(0x3b9),'device_code':_0x37f632});}catch(_0x2b7982){if(_0x2b7982?.[_0x414d2f(0x303)+_0x414d2f(0x346)]&&typeof _0x2b7982[_0x414d2f(0x303)+_0x414d2f(0x346)]==='object')return asRecord(_0x2b7982[_0x414d2f(0x303)+'Data']);throw _0x2b7982;}}function extractFeishuRegistrationAuthorizationUri(_0x3efb27){const _0x22e6a3=_0x4c90,_0x1fdb79=getTrimmedString(_0x3efb27[_0x22e6a3(0x362)+_0x22e6a3(0x25a)+_0x22e6a3(0x2af)+'te'])||getTrimmedString(_0x3efb27['authoriz'+_0x22e6a3(0x25a)+'i'])||getTrimmedString(_0x3efb27[_0x22e6a3(0x213)+_0x22e6a3(0x2bb)+_0x22e6a3(0x3ba)+_0x22e6a3(0x1f8)])||getTrimmedString(_0x3efb27[_0x22e6a3(0x213)+_0x22e6a3(0x2bb)+_0x22e6a3(0x226)])||getTrimmedString(_0x3efb27[_0x22e6a3(0x213)+'thorizat'+'ion_url'])||getTrimmedString(_0x3efb27[_0x22e6a3(0x362)+_0x22e6a3(0x25a)+'l']);if(_0x1fdb79)return _0x1fdb79;const _0x56d0be=getTrimmedString(_0x3efb27[_0x22e6a3(0x1fc)])||getTrimmedString(_0x3efb27[_0x22e6a3(0x213)+_0x22e6a3(0x2bb)+_0x22e6a3(0x33b)+_0x22e6a3(0x1f5)]);return _0x56d0be?FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV]+('/page/sc'+_0x22e6a3(0x2a9)+_0x22e6a3(0x206)+'n?flow_i'+'d=')+encodeURIComponent(_0x56d0be):null;}function serializeFeishuRegistrationSession(_0x5f3736){const _0x16b20e=_0x4c90;return{'sessionId':_0x5f3736['sessionI'+'d'],'verificationUriComplete':_0x5f3736[_0x16b20e(0x3b5)+'tionUriC'+_0x16b20e(0x1ec)],'expiresAt':new Date(_0x5f3736['expiresA'+'t'])['toISOStr'+_0x16b20e(0x2ad)](),'pollIntervalMs':_0x5f3736[_0x16b20e(0x35a)+'rvalMs'],'status':_0x5f3736['status'],'errorMessage':_0x5f3736[_0x16b20e(0x35e)+_0x16b20e(0x316)],'purpose':_0x5f3736['purpose'],'authorizationUri':_0x5f3736[_0x16b20e(0x362)+'ationUri']};}function extractFirstUrl(_0xbfd078){const _0x4d77aa=_0x4c90,_0x3f0ffa=_0xbfd078[_0x4d77aa(0x38b)](/https?:\/\/[^\s"'<>]+/i);return _0x3f0ffa?_0x3f0ffa[0x0]:null;}function isKdocsAuthStatusReady(_0x1c90df){const _0x3e7f7a=_0x4c90,_0x3717a0=_0x1c90df[_0x3e7f7a(0x3a0)+_0x3e7f7a(0x269)]();if(/not\s+login|not\s+logged|unauth|未登录|未认证|未授权|失败/[_0x3e7f7a(0x2d9)](_0x3717a0))return![];return/login|logged|auth|valid|success|已登录|已认证|已授权|有效|成功/[_0x3e7f7a(0x2d9)](_0x3717a0);}function parseFeishuDocCliJson(_0x3d6aca){const _0xc95431=_0x4c90,_0x16fb93=_0x3d6aca[_0xc95431(0x1e8)]();if(!_0x16fb93)return{};try{return asRecord(JSON['parse'](_0x16fb93));}catch{for(let _0x7c1774=_0x16fb93['indexOf']('{');_0x7c1774>=0x0;_0x7c1774=_0x16fb93['indexOf']('{',_0x7c1774+0x1)){for(let _0x587310=_0x16fb93[_0xc95431(0x22f)+'xOf']('}');_0x587310>_0x7c1774;_0x587310=_0x16fb93[_0xc95431(0x22f)+_0xc95431(0x266)]('}',_0x587310-0x1)){try{return asRecord(JSON[_0xc95431(0x3ae)](_0x16fb93[_0xc95431(0x237)](_0x7c1774,_0x587310+0x1)));}catch{}}}return{};}}function summarizeCliOutput(_0x13bec7){const _0x1d98c4=_0x4c90,_0x3f2b0d=_0x13bec7[_0x1d98c4(0x1e8)]();if(!_0x3f2b0d)return _0x1d98c4(0x30d);return _0x3f2b0d[_0x1d98c4(0x314)]>0x320?_0x3f2b0d['slice'](0x0,0x320)+_0x1d98c4(0x30b)+_0x3f2b0d[_0x1d98c4(0x314)]+'\x20chars)':_0x3f2b0d;}function extractFeishuDocCliError(_0x51dde2,_0x1784ef){const _0x300df8=_0x4c90,_0x20e326=parseFeishuDocCliJson(_0x51dde2),_0x51444d=asRecord(_0x20e326['error']),_0x4b6546=getTrimmedString(_0x51444d[_0x300df8(0x295)]),_0x5bbd44=getTrimmedString(_0x51444d['hint']);if(_0x4b6546&&_0x5bbd44)return _0x4b6546+'\x0a'+_0x5bbd44;if(_0x4b6546)return _0x4b6546;return _0x51dde2[_0x300df8(0x1e8)]()||_0x1784ef;}function getFeishuDocCliFailureMessage(_0x58bc28,_0x42f02a,_0x371845){const _0x1f4749=_0x4c90,_0x4672ff=_0x42f02a[_0x1f4749(0x1e8)]()['split']('\x0a')[_0x1f4749(0x237)](-0x8)[_0x1f4749(0x2f3)]('\x0a')[_0x1f4749(0x1e8)](),_0x1b8dfd=_0x58bc28==='create'?'飞书开放平台应用'+_0x1f4749(0x262):_0x58bc28===_0x1f4749(0x2c9)?_0x1f4749(0x209)+_0x1f4749(0x24a):_0x58bc28===_0x1f4749(0x353)?_0x1f4749(0x2b0)+'户授权失败':_0x1f4749(0x38a)+_0x1f4749(0x2c5);return _0x4672ff?_0x1b8dfd+':\x20'+_0x4672ff:_0x1b8dfd+':\x20'+_0x371845;}function ensureFeishuDocCliUserStatus(_0x38b9c0){const _0x2441bd=_0x4c90,_0x35519d=parseFeishuDocCliJson(_0x38b9c0),_0x1103ec=asRecord(_0x35519d[_0x2441bd(0x1ef)+'es']),_0xc8558b=asRecord(_0x1103ec[_0x2441bd(0x38c)]),_0x399cc8=getTrimmedString(_0x35519d[_0x2441bd(0x390)]),_0x5c7ad3=getTrimmedString(_0x35519d[_0x2441bd(0x2fc)+_0x2441bd(0x294)])||getTrimmedString(_0xc8558b[_0x2441bd(0x2fc)+'tus']),_0x486a89=getTrimmedString(_0xc8558b[_0x2441bd(0x2f6)]),_0x3b2b57=_0xc8558b[_0x2441bd(0x39f)+'e']===!![];if(_0x399cc8!==_0x2441bd(0x38c)||_0x486a89&&_0x486a89!==_0x2441bd(0x379)||Object[_0x2441bd(0x1d3)](_0xc8558b)[_0x2441bd(0x314)]>0x0&&!_0x3b2b57||_0x5c7ad3!==_0x2441bd(0x282)&&_0x5c7ad3!==_0x2441bd(0x272)+_0x2441bd(0x1e9))throw new Error('飞书\x20CLI\x20授'+_0x2441bd(0x2a7)+_0x2441bd(0x2a4)+_0x38b9c0['trim']());}function createKdocsCliStatus(_0x139e78){const _0x28429a=_0x4c90;return{'sessionId':_0x139e78[_0x28429a(0x2ae)+'d'],'status':_0x139e78[_0x28429a(0x2f6)],'phase':_0x139e78[_0x28429a(0x2d1)],'url':_0x139e78[_0x28429a(0x2b6)],'message':_0x139e78[_0x28429a(0x295)],'errorMessage':_0x139e78['errorMes'+_0x28429a(0x316)]};}function createFeishuDocCliStatus(_0x57ed26){const _0x4e50f1=_0x4c90;return{'sessionId':_0x57ed26[_0x4e50f1(0x2ae)+'d'],'status':_0x57ed26[_0x4e50f1(0x2f6)],'phase':_0x57ed26[_0x4e50f1(0x2d1)],'url':_0x57ed26[_0x4e50f1(0x2b6)],'message':_0x57ed26[_0x4e50f1(0x295)],'errorMessage':_0x57ed26[_0x4e50f1(0x35e)+_0x4e50f1(0x316)]};}export function createConnectorController({shellConfig:_0x5d899e,configController:_0x25c3a4,broadcast:_0x7e24ba,shell:_0x1e0c73,getRuntimeSpawnContext:_0x67223b,openClawConfigHandlers:openClawConfigHandlers={},resolveRuntimeKdocsCliCommand:_0x1d0d37,resolveRuntimeLarkCliCommand:_0xaf4cb4}){const _0x2ba947=_0x4c90,_0x19288f=new Map(),_0x318af2=new Map(),_0x57a428=new Map();let _0x44960c=null;const _0x2a0952=()=>_0x25c3a4[_0x2ba947(0x2a6)+_0x2ba947(0x3b1)]();async function _0x5a0c64(_0x317eaa,_0x3d4b8e){const _0x10772c=_0x2ba947;if(typeof openClawConfigHandlers[_0x10772c(0x30a)]===_0x10772c(0x1d1))return openClawConfigHandlers[_0x10772c(0x30a)](_0x339b24=>{const _0x562a95=_0x10772c;for(const _0x2ba9ad of Object['keys'](_0x339b24)){!Object[_0x562a95(0x2a8)+'e']['hasOwnPr'+_0x562a95(0x286)][_0x562a95(0x2d8)](_0x317eaa,_0x2ba9ad)&&delete _0x339b24[_0x2ba9ad];}Object[_0x562a95(0x25c)](_0x339b24,_0x317eaa);},_0x3d4b8e);return typeof _0x25c3a4[_0x10772c(0x25d)+_0x10772c(0x2fb)]===_0x10772c(0x1d1)?await _0x25c3a4[_0x10772c(0x25d)+_0x10772c(0x2fb)](_0x317eaa,_0x3d4b8e):(_0x25c3a4[_0x10772c(0x289)+'igWriteH'+'andledIn'+_0x10772c(0x36a)]?.(),await _0x25c3a4['writeCon'+_0x10772c(0x227)](_0x317eaa,_0x3d4b8e)),{'ok':!![]};}function _0xb2d7c(){const _0x31ed50=_0x2ba947;return join(_0x25c3a4[_0x31ed50(0x38d)+_0x31ed50(0x1e7)](),_0x31ed50(0x1f6)+_0x31ed50(0x2b9));}function _0x4d57ab(){const _0x65ab17=_0x2ba947;return join(_0xb2d7c(),_0x65ab17(0x24e)+'w',_0x65ab17(0x1ce)+_0x65ab17(0x1ca));}async function _0x5928f6(_0x2b860d={}){const _0xb528bc=_0x2ba947;return _0x67223b(_0x5d899e['projectR'+_0xb528bc(0x2c8)],_0x2b860d);}async function _0x711880(_0x1889c7,_0x46a192){const _0x5006c7=_0x2ba947,{env:_0x3c0c5c,runtime:_0x434fb8}=await _0x5928f6({'FORCE_COLOR':'0','HOME':homedir()}),_0x230703=await _0x1d0d37(_0x434fb8);return _0x7e24ba(_0x5006c7(0x1c0)+_0x5006c7(0x313),{'connector':_0x5006c7(0x348),'phase':_0x5006c7(0x1f2),'message':'kdocs-cl'+'i\x20'+_0x1889c7[_0x5006c7(0x2f3)]('\x20')}),new Promise((_0x1630df,_0x143733)=>{const _0x99a651=_0x5006c7,_0x1830d0=spawn(_0x230703['executab'+_0x99a651(0x20d)],_0x1889c7,{'cwd':homedir(),'env':_0x3c0c5c});let _0x386a5b='';const _0x4c8dcd=_0x1c7a10=>{const _0x658f39=_0x99a651,_0x5f4d73=_0x1c7a10[_0x658f39(0x1f9)]('utf8');_0x386a5b+=_0x5f4d73,_0x7e24ba('connecto'+_0x658f39(0x313),{'connector':_0x658f39(0x348),'phase':_0x658f39(0x326),'message':_0x5f4d73});};_0x1830d0[_0x99a651(0x39d)]['on'](_0x99a651(0x329),_0x4c8dcd),_0x1830d0[_0x99a651(0x25e)]['on'](_0x99a651(0x329),_0x4c8dcd),_0x1830d0[_0x99a651(0x37c)]('error',_0x143733),_0x1830d0[_0x99a651(0x37c)](_0x99a651(0x256),_0x10df25=>_0x1630df({'code':_0x10df25,'output':_0x386a5b}));if(typeof _0x46a192===_0x99a651(0x3aa))_0x1830d0['stdin'][_0x99a651(0x24f)](_0x46a192);else _0x1830d0['stdin'][_0x99a651(0x24f)]();});}async function _0x35d73f(){const _0x57b15a=_0x2ba947,_0x660429=await _0x2a0952(),_0x1496fa=asRecord(_0x660429[_0x57b15a(0x22c)]),_0x2b5d4d=asRecord(_0x1496fa[_0x57b15a(0x3b7)]),_0x4039a1={...asRecord(_0x2b5d4d[KDOCS_SKILL_ID]),'enabled':!![]};if(typeof openClawConfigHandlers['setSkill'+_0x57b15a(0x259)]==='function'){await openClawConfigHandlers[_0x57b15a(0x218)+_0x57b15a(0x259)]({'skillId':KDOCS_SKILL_ID,'entry':_0x4039a1,'reason':_0x57b15a(0x211)+_0x57b15a(0x25b)+_0x57b15a(0x1e5)});return;}_0x2b5d4d[KDOCS_SKILL_ID]=_0x4039a1,_0x1496fa[_0x57b15a(0x3b7)]=_0x2b5d4d,_0x660429[_0x57b15a(0x22c)]=_0x1496fa,await _0x5a0c64(_0x660429,_0x57b15a(0x211)+_0x57b15a(0x25b)+_0x57b15a(0x1e5));}async function _0x4676d3(_0x25efbb){const _0x40a05c=_0x2ba947,_0x40eb2f=await _0x2a0952(),_0x87ddb5=asRecord(_0x40eb2f[_0x40a05c(0x22c)]),_0x2cfcf5=asRecord(_0x87ddb5[_0x40a05c(0x3b7)]),_0x5d2057={...asRecord(_0x2cfcf5[KDOCS_SKILL_ID]),'enabled':Boolean(_0x25efbb)};if(typeof openClawConfigHandlers['setSkill'+_0x40a05c(0x259)]===_0x40a05c(0x1d1)){await openClawConfigHandlers[_0x40a05c(0x218)+_0x40a05c(0x259)]({'skillId':KDOCS_SKILL_ID,'entry':_0x5d2057,'reason':_0x40a05c(0x211)+'ill\x20'+(_0x25efbb?_0x40a05c(0x32a):_0x40a05c(0x1c6))});return;}_0x2cfcf5[KDOCS_SKILL_ID]=_0x5d2057,_0x87ddb5['entries']=_0x2cfcf5,_0x40eb2f[_0x40a05c(0x22c)]=_0x87ddb5,await _0x5a0c64(_0x40eb2f,'kdocs\x20sk'+_0x40a05c(0x330)+(_0x25efbb?_0x40a05c(0x32a):_0x40a05c(0x1c6)));}async function _0x3f524a(){const _0x887a45=_0x2ba947;if(typeof openClawConfigHandlers[_0x887a45(0x317)+'illEntry']===_0x887a45(0x1d1)){await openClawConfigHandlers['deleteSk'+_0x887a45(0x365)]({'skillId':KDOCS_SKILL_ID,'reason':'kdocs\x20sk'+_0x887a45(0x334)+_0x887a45(0x1fd)+_0x887a45(0x261)});return;}const _0x4778ef=await _0x2a0952(),_0x35615f=asRecord(_0x4778ef[_0x887a45(0x22c)]),_0x5da51d=asRecord(_0x35615f['entries']);delete _0x5da51d[KDOCS_SKILL_ID],_0x35615f[_0x887a45(0x3b7)]=_0x5da51d,_0x4778ef[_0x887a45(0x22c)]=_0x35615f,await _0x5a0c64(_0x4778ef,_0x887a45(0x211)+_0x887a45(0x334)+'ector\x20de'+_0x887a45(0x261));}async function _0x3e9665(){const _0x58d7b0=_0x2ba947;if(!await _0x2f480f())throw new Error('金山文档尚未授权'+_0x58d7b0(0x23f)+_0x58d7b0(0x356)+'连接');return await _0x35d73f(),{'ok':!![]};}async function _0x2f480f(){const _0x4a2810=_0x2ba947,_0x4af5d4=await _0x711880([_0x4a2810(0x353),'status'])['catch'](()=>({'code':null,'output':''}));return _0x4af5d4[_0x4a2810(0x257)]===0x0&&isKdocsAuthStatusReady(_0x4af5d4[_0x4a2810(0x326)]);}async function _0x2c6ba8({appId:_0x174292,appSecret:_0x4aca61,userInfo:userInfo=null}){const _0x4446a3=_0x2ba947,_0x31710c=await _0x2a0952();applyFeishuChannelConfig(_0x31710c,{'appId':_0x174292,'appSecret':_0x4aca61,'userInfo':userInfo});const _0x585587=asRecord(_0x31710c[_0x4446a3(0x1ba)]);if(typeof openClawConfigHandlers['setChann'+_0x4446a3(0x37b)]===_0x4446a3(0x1d1))return openClawConfigHandlers[_0x4446a3(0x24c)+_0x4446a3(0x37b)]({'channelId':_0x4446a3(0x1dc),'channel':asRecord(_0x585587[_0x4446a3(0x1dc)]),'pluginId':'feishu','pluginEnabled':!![],'reason':'feishu\x20c'+_0x4446a3(0x33a)+'onfig\x20up'+_0x4446a3(0x31f)});await _0x5a0c64(_0x31710c,_0x4446a3(0x210)+_0x4446a3(0x33a)+_0x4446a3(0x37e)+_0x4446a3(0x31f));}async function _0x57e12c({appId:_0x5665be,appSecret:_0x1418cf,userInfo:userInfo=null,configPath:_0x4f3175}){const _0x1a9ff3=_0x2ba947,_0x5d0a9b=getTrimmedString(userInfo?.[_0x1a9ff3(0x372)]),_0x828660={'channels':{'feishu':{'enabled':![],'appId':_0x5665be,'appSecret':_0x1418cf,'domain':_0x1a9ff3(0x1dc),'connectionMode':'websocke'+'t','requireMention':!![],'dmPolicy':_0x5d0a9b?_0x1a9ff3(0x358)+'t':_0x1a9ff3(0x1c6),'groupPolicy':_0x1a9ff3(0x1c6),'streaming':!![],'allowFrom':_0x5d0a9b?[_0x5d0a9b]:[],'groupAllowFrom':[]}},'plugins':{'entries':{},'allow':[]},'tools':{'profile':_0x1a9ff3(0x27b)}};await mkdir(dirname(_0x4f3175),{'recursive':!![]}),await writeFile(_0x4f3175,JSON[_0x1a9ff3(0x34d)+'y'](_0x828660,null,0x2)+'\x0a',_0x1a9ff3(0x248));}async function _0x321eab(_0xb3636={}){const _0x4421f8=_0x2ba947,_0x46180e=safeString(_0xb3636[_0x4421f8(0x275)]),_0x40c5a8=safeString(_0xb3636[_0x4421f8(0x1c3)+'t']);if(!_0x46180e)throw new Error('飞书机器人\x20Ap'+_0x4421f8(0x36d)+_0x4421f8(0x249));if(!_0x40c5a8)throw new Error(_0x4421f8(0x20f)+_0x4421f8(0x290)+_0x4421f8(0x2fd)+_0x4421f8(0x223));return await _0x2c6ba8({'appId':_0x46180e,'appSecret':_0x40c5a8,'userInfo':null}),{'ok':!![]};}async function _0x2bede5(_0x3f75f0={}){const _0x46212d=_0x2ba947,_0x271c91=safeString(_0x3f75f0['appId']),_0x5de6bc=safeString(_0x3f75f0['clientSe'+'cret']);if(!_0x271c91)throw new Error(_0x46212d(0x30c)+_0x46212d(0x36d)+_0x46212d(0x249));if(!_0x5de6bc)throw new Error(_0x46212d(0x30c)+_0x46212d(0x290)+_0x46212d(0x2fd)+_0x46212d(0x223));const _0x417a0e=await _0x2a0952(),_0x41dab1=asRecord(_0x417a0e['channels']),_0x1b3504=asRecord(_0x41dab1[_0x46212d(0x1d8)]),_0x1493ca={'enabled':typeof _0x1b3504[_0x46212d(0x32a)]===_0x46212d(0x39e)?_0x1b3504[_0x46212d(0x32a)]:!![],'allowFrom':['*'],'appId':_0x271c91,'clientSecret':_0x5de6bc};if(typeof openClawConfigHandlers[_0x46212d(0x24c)+_0x46212d(0x37b)]===_0x46212d(0x1d1))return openClawConfigHandlers[_0x46212d(0x24c)+_0x46212d(0x37b)]({'channelId':_0x46212d(0x1d8),'channel':_0x1493ca,'pluginId':QQBOT_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x46212d(0x264)+_0x46212d(0x343)+_0x46212d(0x1ea)+'ated'});_0x41dab1[_0x46212d(0x1d8)]=_0x1493ca,_0x417a0e[_0x46212d(0x1ba)]=_0x41dab1;const _0x2f9165=asRecord(_0x417a0e[_0x46212d(0x363)]),_0x2dbaa5=asRecord(_0x2f9165[_0x46212d(0x3b7)]);return _0x2dbaa5[QQBOT_PLUGIN_ID]={...asRecord(_0x2dbaa5[QQBOT_PLUGIN_ID]),'enabled':!![]},_0x2f9165[_0x46212d(0x3b7)]=_0x2dbaa5,_0x2f9165[_0x46212d(0x26e)]=dedupeStrings([...asStringArray(_0x2f9165[_0x46212d(0x26e)]),QQBOT_PLUGIN_ID]),_0x417a0e[_0x46212d(0x363)]=_0x2f9165,await _0x5a0c64(_0x417a0e,_0x46212d(0x264)+_0x46212d(0x343)+'nfig\x20upd'+_0x46212d(0x2ed)),{'ok':!![]};}async function _0x39068c(_0x305325={}){const _0x30e574=_0x2ba947,_0x58d4d7=safeString(_0x305325[_0x30e574(0x361)]),_0x551db9=safeString(_0x305325[_0x30e574(0x3a4)]);if(!_0x58d4d7)throw new Error('企微助手\x20Bot'+_0x30e574(0x2c2)+_0x30e574(0x3b4));if(!_0x551db9)throw new Error(_0x30e574(0x221)+'ret\x20is\x20r'+_0x30e574(0x249));const _0x3ba451=await _0x2a0952(),_0x4e210e=asRecord(_0x3ba451[_0x30e574(0x1ba)]),_0x4c74b5=asRecord(_0x4e210e['wecom']),_0x4ac672={..._0x4c74b5,'enabled':typeof _0x4c74b5[_0x30e574(0x32a)]===_0x30e574(0x39e)?_0x4c74b5[_0x30e574(0x32a)]:!![],'name':getTrimmedString(_0x4c74b5[_0x30e574(0x2dd)])||_0x30e574(0x34c),'connectionMode':getTrimmedString(_0x4c74b5[_0x30e574(0x260)+_0x30e574(0x32b)])||_0x30e574(0x30e)+'t','dmPolicy':normalizeFeishuDmPolicy(_0x4c74b5[_0x30e574(0x28d)])??_0x30e574(0x250),'groupPolicy':normalizeFeishuGroupPolicy(_0x4c74b5['groupPol'+_0x30e574(0x323)])??_0x30e574(0x250),'allowFrom':asStringArray(_0x4c74b5[_0x30e574(0x3a9)+'m']),'groupAllowFrom':asStringArray(_0x4c74b5[_0x30e574(0x21b)+'owFrom']),'botId':_0x58d4d7,'secret':_0x551db9};if(typeof openClawConfigHandlers[_0x30e574(0x24c)+'elConfig']==='function')return openClawConfigHandlers[_0x30e574(0x24c)+_0x30e574(0x37b)]({'channelId':_0x30e574(0x228),'channel':_0x4ac672,'pluginId':WECOM_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x30e574(0x292)+_0x30e574(0x343)+_0x30e574(0x1ea)+_0x30e574(0x2ed)});_0x4e210e[_0x30e574(0x228)]=_0x4ac672,_0x3ba451[_0x30e574(0x1ba)]=_0x4e210e;const _0x5b480d=asRecord(_0x3ba451[_0x30e574(0x363)]),_0x41ddf3=asRecord(_0x5b480d[_0x30e574(0x3b7)]);return _0x41ddf3[WECOM_PLUGIN_ID]={...asRecord(_0x41ddf3[WECOM_PLUGIN_ID]),'enabled':!![]},_0x5b480d[_0x30e574(0x3b7)]=_0x41ddf3,_0x5b480d[_0x30e574(0x26e)]=dedupeStrings([...asStringArray(_0x5b480d[_0x30e574(0x26e)]),WECOM_PLUGIN_ID]),_0x3ba451[_0x30e574(0x363)]=_0x5b480d,await _0x5a0c64(_0x3ba451,_0x30e574(0x292)+_0x30e574(0x343)+_0x30e574(0x1ea)+_0x30e574(0x2ed)),{'ok':!![]};}async function _0x1d0bef(_0x3701fc,_0x474381,_0x96b1c4,_0x113c10){const _0x3e2c04=_0x2ba947,_0xb3e0e3=safeString(_0x474381[_0x3e2c04(0x396)]),_0x30f638=String(_0x474381[_0x3e2c04(0x362)+_0x3e2c04(0x1e6)+'e']||'')[_0x3e2c04(0x376)](/\s+/g,'');if(!_0xb3e0e3)throw new Error(_0x113c10+('账号\x20is\x20re'+'quired'));if(!_0x30f638)throw new Error(_0x113c10+('授权码\x20is\x20r'+_0x3e2c04(0x249)));const _0x1b0d7c=await _0x2a0952(),_0x13d15f=asRecord(_0x1b0d7c['plugins']),_0x41772f=asRecord(_0x13d15f['entries']),_0x106b64=createConnectorPluginEntry(_0x3701fc,_0x41772f[_0x3701fc],!![],{'account':_0xb3e0e3,'authorizationCode':_0x30f638,..._0x96b1c4});if(typeof openClawConfigHandlers[_0x3e2c04(0x320)+_0x3e2c04(0x391)]==='function')return openClawConfigHandlers['setPlugi'+_0x3e2c04(0x391)]({'pluginId':_0x3701fc,'enabled':!![],'config':asRecord(_0x106b64['config']),'reason':_0x3701fc+(_0x3e2c04(0x2ab)+_0x3e2c04(0x267)+'n\x20update'+'d')});return _0x41772f[_0x3701fc]=_0x106b64,_0x13d15f[_0x3e2c04(0x3b7)]=_0x41772f,_0x13d15f[_0x3e2c04(0x26e)]=dedupeStrings([...asStringArray(_0x13d15f[_0x3e2c04(0x26e)]),_0x3701fc]),_0x1b0d7c['plugins']=_0x13d15f,await _0x5a0c64(_0x1b0d7c,_0x3701fc+(_0x3e2c04(0x2ab)+_0x3e2c04(0x267)+_0x3e2c04(0x1dd)+'d')),{'ok':!![]};}const _0xc41683=_0x15c21a=>_0x1d0bef(QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x15c21a,{'imapHost':_0x2ba947(0x1e0)+'com','imapPort':0x3e1,'smtpHost':_0x2ba947(0x381)+_0x2ba947(0x28a),'smtpPort':0x1d1,'secure':!![]},_0x2ba947(0x22a)),_0x1b3b15=_0x430018=>_0x1d0bef(NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x430018,{'imapHost':'imap.163'+'.com','imapPort':0x3e1,'smtpHost':_0x2ba947(0x245)+_0x2ba947(0x3a5),'smtpPort':0x1d1,'imapClientName':_0x2ba947(0x394),'imapClientVersion':_0x2ba947(0x327),'imapClientVendor':_0x2ba947(0x394),'imapClientSupportEmail':'support@'+_0x2ba947(0x347),'secure':!![]},_0x2ba947(0x2a3)),_0x59822a=_0x13386f=>_0x1d0bef(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x13386f,{'imapHost':_0x2ba947(0x212)+_0x2ba947(0x2c0)+'om','imapPort':0x3e1,'smtpHost':_0x2ba947(0x20c)+_0x2ba947(0x2c0)+'om','smtpPort':0x1d1,'secure':!![]},'腾讯企业邮箱');async function _0x32b0c2(_0x16f677={}){const _0x54e749=_0x2ba947,_0x5a4d52=safeString(_0x16f677[_0x54e749(0x33e)+_0x54e749(0x21d)])||'飞书用户身份',_0x122897=await _0x2a0952(),_0x37e5cb=asRecord(_0x122897[_0x54e749(0x363)]),_0x44fc3c=asRecord(_0x37e5cb[_0x54e749(0x3b7)]),_0x5b85fb=createConnectorPluginEntry(FEISHU_DOC_CONNECTOR_PLUGIN_ID,_0x44fc3c[FEISHU_DOC_CONNECTOR_PLUGIN_ID],!![],{'authMode':_0x54e749(0x38c),'accountName':_0x5a4d52});if(typeof openClawConfigHandlers[_0x54e749(0x320)+_0x54e749(0x391)]==='function')return openClawConfigHandlers['setPlugi'+_0x54e749(0x391)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':!![],'config':asRecord(_0x5b85fb['config']),'reason':_0x54e749(0x354)+_0x54e749(0x342)+'ctor\x20plu'+'gin\x20upda'+_0x54e749(0x2b7)});return _0x44fc3c[FEISHU_DOC_CONNECTOR_PLUGIN_ID]=_0x5b85fb,_0x37e5cb['entries']=_0x44fc3c,_0x37e5cb[_0x54e749(0x26e)]=dedupeStrings([...asStringArray(_0x37e5cb[_0x54e749(0x26e)]),FEISHU_DOC_CONNECTOR_PLUGIN_ID]),_0x122897[_0x54e749(0x363)]=_0x37e5cb,await _0x5a0c64(_0x122897,'feishu\x20d'+_0x54e749(0x342)+'ctor\x20plu'+_0x54e749(0x315)+'ted'),{'ok':!![]};}async function _0x23b930(_0xc8d739={}){const _0x6ee2c2=_0x2ba947,_0x2597a1=safeString(_0xc8d739[_0x6ee2c2(0x1f0)]);if(!_0x2597a1)throw new Error(_0x6ee2c2(0x298)+_0x6ee2c2(0x324)+_0x6ee2c2(0x352));const _0x10d162=await _0x2a0952(),_0x2683b4=asRecord(_0x10d162['skills']),_0x4a1ac9=asRecord(_0x2683b4[_0x6ee2c2(0x3b7)]),_0x3024f0=asRecord(_0x4a1ac9[TENCENT_DOCS_SKILL_ID]),_0x18306b={..._0x3024f0,'enabled':!![],'env':{...asRecord(_0x3024f0[_0x6ee2c2(0x30f)]),[TENCENT_DOCS_TOKEN_ENV]:_0x2597a1}};if(typeof openClawConfigHandlers[_0x6ee2c2(0x218)+'Entry']===_0x6ee2c2(0x1d1))return openClawConfigHandlers['setSkill'+'Entry']({'skillId':TENCENT_DOCS_SKILL_ID,'entry':_0x18306b,'reason':'tencent\x20'+'docs\x20ski'+'ll\x20updat'+'ed'});return _0x4a1ac9[TENCENT_DOCS_SKILL_ID]=_0x18306b,_0x2683b4[_0x6ee2c2(0x3b7)]=_0x4a1ac9,_0x10d162[_0x6ee2c2(0x22c)]=_0x2683b4,await _0x5a0c64(_0x10d162,_0x6ee2c2(0x2a2)+_0x6ee2c2(0x214)+_0x6ee2c2(0x276)+'ed'),{'ok':!![]};}async function _0x162d0c(_0x36cef6={}){const _0x4a6002=_0x2ba947,_0x576087=safeString(_0x36cef6[_0x4a6002(0x2b6)]);if(!_0x576087)throw new Error(_0x4a6002(0x28f)+_0x4a6002(0x216)+_0x4a6002(0x2b1)+'is\x20requi'+_0x4a6002(0x223));try{const _0x82cea8=new URL(_0x576087);if(!['http:',_0x4a6002(0x300)][_0x4a6002(0x229)](_0x82cea8[_0x4a6002(0x1c7)]))throw new Error(_0x4a6002(0x32d)+_0x4a6002(0x1c7));}catch{throw new Error(_0x4a6002(0x225)+_0x4a6002(0x263)+'mableHtt'+_0x4a6002(0x246));}if(typeof openClawConfigHandlers[_0x4a6002(0x1f4)+_0x4a6002(0x20b)]===_0x4a6002(0x1d1))return openClawConfigHandlers[_0x4a6002(0x1f4)+_0x4a6002(0x20b)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'server':createDingtalkDocMcpServerConfig(_0x576087),'reason':'dingtalk'+_0x4a6002(0x341)+_0x4a6002(0x1c1)});const _0x34a937=await _0x2a0952(),_0x5e20fe=readOpenClawMcpServersFromConfig(_0x34a937);return _0x5e20fe[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x576087),writeOpenClawMcpServersToConfig(_0x34a937,_0x5e20fe),await _0x5a0c64(_0x34a937,_0x4a6002(0x2f8)+_0x4a6002(0x341)+'\x20updated'),{'ok':!![]};}async function _0x129c98(){const _0x53c9fd=_0x2ba947,_0xe2ab8d=await _0x2a0952(),_0x20496e=asRecord(_0xe2ab8d['plugins']),_0x4b946d=asRecord(_0x20496e['entries']),_0x11ba42=asRecord(_0xe2ab8d[_0x53c9fd(0x22c)]),_0x1eb2c5=asRecord(_0x11ba42[_0x53c9fd(0x3b7)]),_0xafe52d={},_0x5ed216=_0x43f041=>{const _0x50b474=_0x53c9fd,_0x40c798=asRecord(_0x4b946d[_0x43f041]);return{'entry':_0x40c798,'config':asRecord(_0x40c798[_0x50b474(0x271)])};},_0x53558a=(_0x4f1497,_0x459863,_0x1da483)=>{const _0xcb63f3=_0x53c9fd,{entry:_0x35ff56,config:_0xfe3df4}=_0x5ed216(_0x459863),_0x521d90=getTrimmedString(_0xfe3df4[_0xcb63f3(0x396)]);if(!_0x521d90)return;_0xafe52d[_0x4f1497]={'provider':_0x4f1497,'sourceType':'plugin','adapter':_0x459863,'enabled':_0x35ff56['enabled']!==![]&&_0xfe3df4[_0xcb63f3(0x32a)]!==![],'account':_0x521d90,'credentialRef':_0x459863+(':authori'+_0xcb63f3(0x1d4)+'de'),'name':_0x1da483};};_0x53558a(_0x53c9fd(0x270),QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x53c9fd(0x22a)),_0x53558a(_0x53c9fd(0x328)+_0x53c9fd(0x23d),NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'163\x20邮箱'),_0x53558a(_0x53c9fd(0x37a)+_0x53c9fd(0x2f1),TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'腾讯企业邮箱');const _0x505d7b=_0x5ed216(FEISHU_DOC_CONNECTOR_PLUGIN_ID),_0x57b3c0=getTrimmedString(_0x505d7b['config'][_0x53c9fd(0x33e)+'ame']);_0x57b3c0&&(_0xafe52d['feishu']={'provider':_0x53c9fd(0x1dc),'sourceType':_0x53c9fd(0x243),'adapter':_0x53c9fd(0x2b3)+'li_user','enabled':_0x505d7b[_0x53c9fd(0x28e)]['enabled']!==![]&&_0x505d7b[_0x53c9fd(0x271)][_0x53c9fd(0x32a)]!==![],'authMode':_0x53c9fd(0x38c),'accountName':_0x57b3c0,'account':_0x57b3c0,'credentialRef':FEISHU_DOC_CONNECTOR_PLUGIN_ID+_0x53c9fd(0x39a),'capabilities':[_0x53c9fd(0x274),_0x53c9fd(0x32c),'create','read',_0x53c9fd(0x30a),_0x53c9fd(0x2da),_0x53c9fd(0x21e)]});const _0x52ad7f=asRecord(_0x1eb2c5[TENCENT_DOCS_SKILL_ID]),_0x32f981=asRecord(_0x52ad7f['env']),_0x34fd0a=getTrimmedString(_0x32f981[TENCENT_DOCS_TOKEN_ENV]);_0x34fd0a&&(_0xafe52d[_0x53c9fd(0x37a)+_0x53c9fd(0x2e3)]={'provider':_0x53c9fd(0x37a)+_0x53c9fd(0x2e3),'sourceType':_0x53c9fd(0x2de),'adapter':TENCENT_DOCS_SKILL_ID,'enabled':_0x52ad7f['enabled']!==![],'account':_0x53c9fd(0x2d6),'credentialRef':TENCENT_DOCS_SKILL_ID+':'+TENCENT_DOCS_TOKEN_ENV,'capabilities':[_0x53c9fd(0x258),_0x53c9fd(0x397),_0x53c9fd(0x30a),'delete',_0x53c9fd(0x344),_0x53c9fd(0x21e),_0x53c9fd(0x37d)]});const _0xb31dab=asRecord(_0x1eb2c5[KDOCS_SKILL_ID]);Object[_0x53c9fd(0x1d3)](_0xb31dab)[_0x53c9fd(0x314)]>0x0&&await _0x2f480f()&&(_0xafe52d[_0x53c9fd(0x348)]={'provider':_0x53c9fd(0x348),'sourceType':_0x53c9fd(0x2de),'adapter':KDOCS_SKILL_ID,'enabled':_0xb31dab[_0x53c9fd(0x32a)]!==![],'account':_0x53c9fd(0x336),'credentialRef':_0x53c9fd(0x1f7)+_0x53c9fd(0x201)+'in','capabilities':['create',_0x53c9fd(0x397),_0x53c9fd(0x30a),_0x53c9fd(0x32c),_0x53c9fd(0x1c5),'import','export']});const _0x380c0d=readOpenClawMcpServersFromConfig(_0xe2ab8d),_0x5c2402=findDingtalkDocMcpServer(_0x380c0d),_0x1ed046=getTrimmedString(_0x5c2402['url']);return _0x1ed046&&(_0xafe52d[_0x53c9fd(0x2f8)+_0x53c9fd(0x2be)]={'provider':_0x53c9fd(0x2f8)+_0x53c9fd(0x2be),'sourceType':_0x53c9fd(0x2ca),'adapter':DINGTALK_DOC_MCP_SERVER_NAME,'enabled':_0x5c2402[_0x53c9fd(0x32a)]!==![],'url':_0x1ed046,'transport':getTrimmedString(_0x5c2402[_0x53c9fd(0x29e)+'t'])||_0x53c9fd(0x21f)+_0x53c9fd(0x283)}),_0xafe52d;}async function _0xecac9d(){const _0x156f04=_0x2ba947,_0x1bff50=await _0x25c3a4[_0x156f04(0x2a6)+'igSnapsh'+'otRaw']();return{..._0x1bff50,'connectors':{...asRecord(_0x1bff50['connecto'+'rs']),...await _0x129c98()}};}function _0x318478(_0x4f6492){const _0x59ad7c=_0x2ba947;if(!_0x4f6492[_0x59ad7c(0x28b)+_0x59ad7c(0x2f9)])return;clearTimeout(_0x4f6492[_0x59ad7c(0x28b)+_0x59ad7c(0x2f9)]),_0x4f6492['verifyTi'+_0x59ad7c(0x2f9)]=null;}function _0x17d526(_0x4f7bff,_0x2124ba=KDOCS_CLI_AUTH_POLL_INTERVAL_MS){const _0x25e2e0=_0x2ba947;if(_0x4f7bff[_0x25e2e0(0x2f6)]!=='pending')return;_0x318478(_0x4f7bff),_0x4f7bff[_0x25e2e0(0x28b)+_0x25e2e0(0x2f9)]=setTimeout(()=>void _0x34fd83(_0x4f7bff),_0x2124ba);}async function _0x34fd83(_0x4f9ec0){const _0x48f029=_0x2ba947;if(_0x4f9ec0[_0x48f029(0x2f6)]!==_0x48f029(0x302))return;_0x4f9ec0[_0x48f029(0x2d1)]=_0x48f029(0x31b),_0x4f9ec0['message']=_0x48f029(0x382)+_0x48f029(0x280);try{const _0x4e3ad4=await _0x711880([_0x48f029(0x353),_0x48f029(0x2f6)]);_0x4f9ec0[_0x48f029(0x326)]=_0x4e3ad4[_0x48f029(0x326)];if(_0x4e3ad4[_0x48f029(0x257)]===0x0&&isKdocsAuthStatusReady(_0x4e3ad4[_0x48f029(0x326)])){_0x318478(_0x4f9ec0),await _0x35d73f(),_0x4f9ec0[_0x48f029(0x2d1)]=_0x48f029(0x1f8)+'d',_0x4f9ec0[_0x48f029(0x2f6)]=_0x48f029(0x1f8)+'d',_0x4f9ec0[_0x48f029(0x295)]='金山文档已连接';return;}if(Date[_0x48f029(0x3a6)]()-_0x4f9ec0[_0x48f029(0x29d)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4f9ec0[_0x48f029(0x2f6)]='error',_0x4f9ec0[_0x48f029(0x35e)+_0x48f029(0x316)]='金山文档授权状态'+'验证超时';return;}_0x17d526(_0x4f9ec0);}catch(_0x510869){if(Date[_0x48f029(0x3a6)]()-_0x4f9ec0[_0x48f029(0x29d)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4f9ec0[_0x48f029(0x2f6)]=_0x48f029(0x231),_0x4f9ec0[_0x48f029(0x35e)+_0x48f029(0x316)]=_0x510869 instanceof Error?_0x510869[_0x48f029(0x295)]:_0x48f029(0x378)+'验证失败';return;}_0x17d526(_0x4f9ec0);}}async function _0x4dea60(){const _0x551f81=_0x2ba947,_0x1b9cd4=randomUUID(),_0x3fc6d1={'sessionId':_0x1b9cd4,'status':'pending','phase':_0x551f81(0x2f5),'url':null,'message':_0x551f81(0x36e)+'登录','errorMessage':null,'output':'','process':null,'verifyTimer':null,'startedAt':Date[_0x551f81(0x3a6)]()};return _0x19288f['set'](_0x1b9cd4,_0x3fc6d1),void _0x5928f6({'FORCE_COLOR':'0','HOME':homedir()})[_0x551f81(0x393)](async({env:_0xb67b90,runtime:_0x51062d})=>{const _0x370e6f=_0x551f81,_0xfdba4e=await _0x1d0d37(_0x51062d);_0x7e24ba(_0x370e6f(0x1c0)+_0x370e6f(0x313),{'connector':_0x370e6f(0x348),'phase':'spawn','message':_0x370e6f(0x1f7)+'i\x20auth\x20l'+'ogin'});const _0x52f1e2=spawn(_0xfdba4e[_0x370e6f(0x368)+_0x370e6f(0x20d)],[_0x370e6f(0x353),_0x370e6f(0x1bf)],{'cwd':homedir(),'env':_0xb67b90});_0x3fc6d1[_0x370e6f(0x238)]=_0x52f1e2;const _0x2b1593=setTimeout(()=>{const _0x3f953f=_0x370e6f;if(_0x3fc6d1[_0x3f953f(0x2f6)]!==_0x3f953f(0x302))return;_0x52f1e2['kill'](),_0x3fc6d1[_0x3f953f(0x2f6)]=_0x3f953f(0x231),_0x3fc6d1[_0x3f953f(0x35e)+'sage']=_0x3f953f(0x1f1)+'超时',_0x3fc6d1[_0x3f953f(0x238)]=null;},KDOCS_CLI_STEP_TIMEOUT_MS),_0x34d7f1=_0x318d6a=>{const _0x208195=_0x370e6f,_0x4a0b44=_0x318d6a['toString'](_0x208195(0x248));_0x3fc6d1[_0x208195(0x326)]+=_0x4a0b44,_0x7e24ba(_0x208195(0x1c0)+_0x208195(0x313),{'connector':_0x208195(0x348),'phase':_0x208195(0x326),'message':_0x4a0b44});const _0x1c5a79=extractFirstUrl(_0x3fc6d1[_0x208195(0x326)]);_0x1c5a79&&!_0x3fc6d1[_0x208195(0x2b6)]&&(_0x3fc6d1[_0x208195(0x2b6)]=_0x1c5a79,_0x3fc6d1['phase']='auth',_0x3fc6d1[_0x208195(0x295)]=_0x208195(0x384)+'山文档授权',_0x17d526(_0x3fc6d1,0x1f4),void _0x1e0c73[_0x208195(0x1e4)+_0x208195(0x3a7)](_0x1c5a79)[_0x208195(0x288)](()=>{}));};_0x52f1e2[_0x370e6f(0x39d)]['on'](_0x370e6f(0x329),_0x34d7f1),_0x52f1e2[_0x370e6f(0x25e)]['on']('data',_0x34d7f1),_0x52f1e2[_0x370e6f(0x2c1)]['end'](),_0x52f1e2[_0x370e6f(0x37c)]('error',_0x5489a4=>{const _0x435649=_0x370e6f;clearTimeout(_0x2b1593),_0x3fc6d1['status']=_0x435649(0x231),_0x3fc6d1[_0x435649(0x35e)+_0x435649(0x316)]=_0x5489a4 instanceof Error?_0x5489a4[_0x435649(0x295)]:_0x435649(0x1f1)+_0x435649(0x27f)+_0x435649(0x29b)+_0x435649(0x34a),_0x3fc6d1[_0x435649(0x238)]=null,_0x7e24ba(_0x435649(0x1c0)+'r-log',{'connector':_0x435649(0x348),'phase':_0x435649(0x231),'message':_0x3fc6d1['errorMes'+_0x435649(0x316)]});}),_0x52f1e2[_0x370e6f(0x37c)](_0x370e6f(0x256),_0x267266=>{const _0x334633=_0x370e6f;clearTimeout(_0x2b1593),_0x3fc6d1[_0x334633(0x238)]=null;if(_0x3fc6d1[_0x334633(0x2f6)]!==_0x334633(0x302))return;const _0x1a7d52=extractFirstUrl(_0x3fc6d1[_0x334633(0x326)]);if(_0x1a7d52&&!_0x3fc6d1[_0x334633(0x2b6)]){_0x3fc6d1[_0x334633(0x2b6)]=_0x1a7d52,_0x3fc6d1['phase']=_0x334633(0x353),_0x3fc6d1[_0x334633(0x295)]='请在浏览器完成金'+'山文档授权',_0x17d526(_0x3fc6d1,0x1f4);return;}if(_0x267266!==0x0){_0x3fc6d1[_0x334633(0x2f6)]=_0x334633(0x231),_0x3fc6d1[_0x334633(0x35e)+_0x334633(0x316)]=_0x3fc6d1['output']['trim']()||_0x334633(0x1f1)+_0x334633(0x27f)+_0x334633(0x29b)+_0x334633(0x34a),_0x7e24ba('connecto'+_0x334633(0x313),{'connector':_0x334633(0x348),'phase':'error','message':_0x3fc6d1[_0x334633(0x35e)+_0x334633(0x316)]});return;}_0x3fc6d1[_0x334633(0x2d1)]=_0x334633(0x31b),_0x3fc6d1[_0x334633(0x295)]=_0x334633(0x382)+_0x334633(0x280),_0x17d526(_0x3fc6d1,0x1f4);});})['catch'](_0x36e983=>{const _0x5424dd=_0x551f81;_0x3fc6d1[_0x5424dd(0x2f6)]=_0x5424dd(0x231),_0x3fc6d1[_0x5424dd(0x35e)+_0x5424dd(0x316)]=_0x36e983 instanceof Error?_0x36e983['message']:'金山文档登录启动'+'失败,请确认\x20k'+_0x5424dd(0x29b)+_0x5424dd(0x34a),_0x7e24ba('connecto'+_0x5424dd(0x313),{'connector':_0x5424dd(0x348),'phase':'error','message':_0x3fc6d1[_0x5424dd(0x35e)+_0x5424dd(0x316)]});}),createKdocsCliStatus(_0x3fc6d1);}function _0x41b5d7(_0x4041d0={}){const _0xdc0145=_0x2ba947,_0x24fc55=safeString(_0x4041d0['sessionI'+'d']);if(!_0x24fc55)throw new Error(_0xdc0145(0x385)+_0xdc0145(0x2cf)+_0xdc0145(0x2a0)+_0xdc0145(0x273));const _0x2d79fc=_0x19288f['get'](_0x24fc55);if(!_0x2d79fc)throw new Error(_0xdc0145(0x385)+'I\x20sessio'+'n\x20not\x20fo'+_0xdc0145(0x224));return createKdocsCliStatus(_0x2d79fc);}function _0x5366bb(_0x111025={}){const _0x3204c6=_0x2ba947,_0x3c6a2e=safeString(_0x111025['sessionI'+'d']);if(!_0x3c6a2e)return{'ok':!![]};const _0x2cc8ea=_0x19288f[_0x3204c6(0x2ba)](_0x3c6a2e);if(!_0x2cc8ea)return{'ok':!![]};return _0x318478(_0x2cc8ea),_0x2cc8ea[_0x3204c6(0x238)]?.[_0x3204c6(0x2e0)](),_0x19288f[_0x3204c6(0x2da)](_0x3c6a2e),{'ok':!![]};}function _0x5bb6f5(_0x25a6fa){const _0x37ba00=_0x2ba947;if(!_0x25a6fa[_0x37ba00(0x23b)])return;clearTimeout(_0x25a6fa[_0x37ba00(0x23b)]),_0x25a6fa['timer']=null;}function _0x3c4af3(_0x26b6f4){const _0x1c4394=_0x2ba947,_0x5d3508=_0x318af2[_0x1c4394(0x2ba)](_0x26b6f4);if(!_0x5d3508||_0x5d3508[_0x1c4394(0x2f6)]!=='pending')return;_0x5bb6f5(_0x5d3508),_0x5d3508[_0x1c4394(0x23b)]=setTimeout(()=>void _0x41996d(_0x26b6f4),_0x5d3508[_0x1c4394(0x35a)+_0x1c4394(0x3a2)]);}async function _0x41996d(_0x32a834){const _0x42893c=_0x2ba947,_0x2acb30=_0x318af2['get'](_0x32a834);if(!_0x2acb30||_0x2acb30[_0x42893c(0x2f6)]!=='pending')return;if(Date[_0x42893c(0x3a6)]()>=_0x2acb30[_0x42893c(0x2cb)+'t']){_0x2acb30['status']='expired',_0x2acb30['errorMes'+_0x42893c(0x316)]=_0x42893c(0x3b0)+_0x42893c(0x345),_0x5bb6f5(_0x2acb30);return;}try{const _0x4261b2=await pollFeishuRegistration(_0x2acb30['client'],_0x2acb30['deviceCo'+'de']),_0x5d85fb=getTrimmedString(_0x4261b2[_0x42893c(0x20a)+'d']),_0xa30dab=getTrimmedString(_0x4261b2['client_s'+_0x42893c(0x2d0)]),_0x18efb8=getTrimmedString(_0x4261b2[_0x42893c(0x231)]),_0x21d201=extractFeishuRegistrationAuthorizationUri(_0x4261b2)||_0x2acb30['authoriz'+_0x42893c(0x337)];if(_0x21d201!==_0x2acb30[_0x42893c(0x362)+'ationUri'])_0x2acb30[_0x42893c(0x362)+'ationUri']=_0x21d201;if(_0x5d85fb&&_0xa30dab){const _0x2b8189=asRecord(_0x4261b2[_0x42893c(0x2fe)+'o']);await _0x2c6ba8({'appId':_0x5d85fb,'appSecret':_0xa30dab,'userInfo':{'openId':getTrimmedString(_0x2b8189['open_id'])||null}}),_0x2acb30[_0x42893c(0x2f6)]=_0x42893c(0x1f8)+'d',_0x2acb30['errorMes'+_0x42893c(0x316)]=null,_0x5bb6f5(_0x2acb30);return;}if(!_0x18efb8||_0x18efb8==='authoriz'+'ation_pe'+_0x42893c(0x1e2)){_0x3c4af3(_0x32a834);return;}if(_0x18efb8===_0x42893c(0x241)+'n'){_0x2acb30['pollInte'+_0x42893c(0x3a2)]+=0x1388,_0x3c4af3(_0x32a834);return;}if(_0x18efb8===_0x42893c(0x340)+_0x42893c(0x24b)){_0x2acb30[_0x42893c(0x2f6)]=_0x42893c(0x242),_0x2acb30[_0x42893c(0x35e)+_0x42893c(0x316)]=_0x42893c(0x3b0)+_0x42893c(0x345),_0x5bb6f5(_0x2acb30);return;}_0x2acb30[_0x42893c(0x2f6)]=_0x42893c(0x231),_0x2acb30['errorMes'+_0x42893c(0x316)]=getTrimmedString(_0x4261b2['error_de'+_0x42893c(0x32e)+'n'])||(_0x18efb8==='access_d'+'enied'?_0x42893c(0x389)+_0x42893c(0x2ef):_0x42893c(0x2ee)+_0x18efb8),_0x5bb6f5(_0x2acb30);}catch(_0x1b3ac1){_0x2acb30['status']='error',_0x2acb30[_0x42893c(0x35e)+_0x42893c(0x316)]=_0x1b3ac1 instanceof Error?_0x1b3ac1['message']:'飞书绑定失败',_0x5bb6f5(_0x2acb30);}}async function _0x59f7cf(_0x3d110d={}){const _0x4dea96=_0x2ba947,_0x11a469=_0x3d110d[_0x4dea96(0x3b8)]==='doc_conn'+_0x4dea96(0x20e)?_0x4dea96(0x1d2)+'ector':_0x4dea96(0x377),_0x1f3e4e=createFeishuRegistrationClient(),_0x477721=await initFeishuRegistration(_0x1f3e4e),_0x210110=Array['isArray'](_0x477721[_0x4dea96(0x1d0)+'d_auth_m'+'ethods'])?_0x477721[_0x4dea96(0x1d0)+_0x4dea96(0x240)+'ethods'][_0x4dea96(0x2cc)](getTrimmedString)['filter'](Boolean):[];if(!_0x210110[_0x4dea96(0x229)](_0x4dea96(0x33d)+_0x4dea96(0x2d0)))throw new Error(_0x4dea96(0x399)+_0x4dea96(0x265)+_0x4dea96(0x2b4)+_0x4dea96(0x1f3)+_0x4dea96(0x331)+_0x4dea96(0x26a)+_0x4dea96(0x279));const _0x1ccf62=await beginFeishuRegistration(_0x1f3e4e),_0x1b9dcd=getTrimmedString(_0x1ccf62[_0x4dea96(0x3b5)+_0x4dea96(0x251)+_0x4dea96(0x296)+'e']),_0x326ab4=extractFeishuRegistrationAuthorizationUri(_0x1ccf62),_0x31df81=getTrimmedString(_0x1ccf62[_0x4dea96(0x2c4)+'ode']),_0x303b1a=Number(_0x1ccf62['expire_i'+'n'])||0x258,_0x163756=Number(_0x1ccf62['interval'])||0x5;if(!_0x1b9dcd||!_0x31df81)throw new Error('Missing\x20'+'verifica'+_0x4dea96(0x251)+_0x4dea96(0x296)+_0x4dea96(0x277)+_0x4dea96(0x2d3)+_0x4dea96(0x3b2)+_0x4dea96(0x1c4)+_0x4dea96(0x2dc));const _0x209427=randomUUID(),_0x537a9e={'sessionId':_0x209427,'purpose':_0x11a469,'client':_0x1f3e4e,'deviceCode':_0x31df81,'verificationUriComplete':_0x1b9dcd,'authorizationUri':_0x326ab4,'expiresAt':Date[_0x4dea96(0x3a6)]()+_0x303b1a*0x3e8,'pollIntervalMs':Math[_0x4dea96(0x2a1)](_0x163756*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'status':'pending','errorMessage':null,'timer':null};return _0x318af2['set'](_0x209427,_0x537a9e),_0x3c4af3(_0x209427),serializeFeishuRegistrationSession(_0x537a9e);}function _0x27fdd2(_0x2753f3={}){const _0x5559da=_0x2ba947,_0x2602d2=safeString(_0x2753f3[_0x5559da(0x2ae)+'d']);if(!_0x2602d2)throw new Error(_0x5559da(0x239)+_0x5559da(0x208)+_0x5559da(0x333)+'ion\x20id\x20i'+'s\x20requir'+'ed');const _0x10b033=_0x318af2['get'](_0x2602d2);if(!_0x10b033)throw new Error(_0x5559da(0x239)+_0x5559da(0x208)+'ion\x20sess'+_0x5559da(0x383)+_0x5559da(0x1ed));return serializeFeishuRegistrationSession(_0x10b033);}function _0x4bcf14(_0x3f6f6e={}){const _0x3583a2=_0x2ba947,_0x4eae32=safeString(_0x3f6f6e[_0x3583a2(0x2ae)+'d']);if(!_0x4eae32)return{'ok':!![]};const _0x49cab5=_0x318af2[_0x3583a2(0x2ba)](_0x4eae32);if(!_0x49cab5)return{'ok':!![]};return _0x5bb6f5(_0x49cab5),_0x318af2['delete'](_0x4eae32),{'ok':!![]};}async function _0xc0eae1(_0x2aeeab,_0x449bad){const _0x22644d=_0x2ba947,_0xacee47=_0xb2d7c(),{env:_0x31d15a,runtime:_0x5cbd9d}=await _0x5928f6({'FORCE_COLOR':'0','HOME':homedir(),'LARK_CLI_NO_PROXY':'1','OPENCLAW_HOME':_0xacee47,'OPENCLAW_CONFIG_PATH':_0x2aeeab['cliHostC'+_0x22644d(0x255)+'h']});await mkdir(_0xacee47,{'recursive':!![]});const _0x28bcd0=await _0xaf4cb4(_0x5cbd9d);for(const _0xf62275 of['HTTP_PRO'+'XY',_0x22644d(0x1e1)+_0x22644d(0x2d5),_0x22644d(0x23e)+'Y',_0x22644d(0x2d2)+'xy',_0x22644d(0x2aa)+'oxy',_0x22644d(0x235)+'y']){delete _0x31d15a[_0xf62275];}return new Promise((_0x51cceb,_0x5ba305)=>{const _0x395904=_0x22644d;_0x7e24ba(_0x395904(0x1c0)+_0x395904(0x313),{'connector':_0x395904(0x281)+'oc','phase':'spawn','message':'lark-cli'+'\x20'+_0x449bad[_0x395904(0x2f3)]('\x20')});const _0x25dfc1=spawn(_0x28bcd0[_0x395904(0x204)+_0x395904(0x2b2)],[_0x28bcd0['scriptPa'+'th'],..._0x449bad],{'cwd':_0xacee47,'env':_0x31d15a});let _0x484949=![];_0x25dfc1[_0x395904(0x37c)](_0x395904(0x1f2),()=>{_0x484949=!![],_0x51cceb(_0x25dfc1);}),_0x25dfc1['once']('error',_0x1191d7=>{if(_0x484949)return;_0x5ba305(_0x1191d7);});});}function _0x42bf6b(_0x5cf445,_0x5ac67d,_0x457f7f){const _0x32b382=_0x2ba947;_0x5cf445[_0x32b382(0x2d1)]=_0x457f7f[_0x32b382(0x2d1)],_0x5cf445['message']=_0x457f7f[_0x32b382(0x295)];if(_0x457f7f[_0x32b382(0x2d1)]!==_0x32b382(0x31b))_0x5cf445['url']=null;_0x5cf445['output']='',void _0xc0eae1(_0x5cf445,_0x5ac67d)[_0x32b382(0x393)](_0x52524a=>{const _0x4f0d5b=_0x32b382;_0x5cf445[_0x4f0d5b(0x238)]=_0x52524a;const _0x5c20eb=setTimeout(()=>{const _0x3926e2=_0x4f0d5b;if(_0x5cf445[_0x3926e2(0x2f6)]!==_0x3926e2(0x302))return;_0x52524a['kill'](),_0x5cf445['status']='error',_0x5cf445['errorMes'+_0x3926e2(0x316)]=_0x457f7f[_0x3926e2(0x295)]+'超时',_0x5cf445['process']=null;},FEISHU_DOC_CLI_STEP_TIMEOUT_MS),_0x3d1a06=_0x6d2c1d=>{const _0x48d10a=_0x4f0d5b,_0x29febb=_0x6d2c1d['toString'](_0x48d10a(0x248));_0x5cf445[_0x48d10a(0x326)]+=_0x29febb,_0x7e24ba(_0x48d10a(0x1c0)+_0x48d10a(0x313),{'connector':_0x48d10a(0x281)+'oc','phase':_0x457f7f[_0x48d10a(0x2d1)],'message':_0x29febb});};_0x52524a[_0x4f0d5b(0x39d)]['on'](_0x4f0d5b(0x329),_0x3d1a06),_0x52524a['stderr']['on'](_0x4f0d5b(0x329),_0x3d1a06);if(typeof _0x457f7f[_0x4f0d5b(0x2c1)]===_0x4f0d5b(0x3aa))_0x52524a['stdin'][_0x4f0d5b(0x24f)](_0x457f7f['stdin']);else _0x52524a['stdin'][_0x4f0d5b(0x24f)]();_0x52524a['on'](_0x4f0d5b(0x231),_0x49c8df=>{const _0x5edfac=_0x4f0d5b;clearTimeout(_0x5c20eb),_0x5cf445[_0x5edfac(0x2f6)]=_0x5edfac(0x231),_0x5cf445[_0x5edfac(0x35e)+'sage']=_0x49c8df instanceof Error?_0x49c8df[_0x5edfac(0x295)]:_0x5edfac(0x37f)+_0x5edfac(0x29f),_0x5cf445[_0x5edfac(0x238)]=null,_0x7e24ba('connecto'+_0x5edfac(0x313),{'connector':'feishu_d'+'oc','phase':_0x5edfac(0x231),'message':_0x5cf445[_0x5edfac(0x35e)+_0x5edfac(0x316)]});}),_0x52524a['on'](_0x4f0d5b(0x256),_0xa4dad8=>{const _0x38d412=_0x4f0d5b;clearTimeout(_0x5c20eb),_0x5cf445['process']=null;if(_0x5cf445[_0x38d412(0x2f6)]!==_0x38d412(0x302))return;if(_0xa4dad8!==0x0){if(_0x457f7f['onFailur'+'e']){void Promise[_0x38d412(0x27c)](_0x457f7f[_0x38d412(0x3ac)+'e'](_0xa4dad8,_0x5cf445['output']))[_0x38d412(0x288)](_0x393bff=>{const _0x158d36=_0x38d412;_0x5cf445[_0x158d36(0x2f6)]=_0x158d36(0x231),_0x5cf445[_0x158d36(0x35e)+_0x158d36(0x316)]=_0x393bff instanceof Error?_0x393bff[_0x158d36(0x295)]:'飞书\x20CLI\x20连'+_0x158d36(0x236);});return;}_0x5cf445['status']=_0x38d412(0x231),_0x5cf445[_0x38d412(0x35e)+_0x38d412(0x316)]=getFeishuDocCliFailureMessage(_0x457f7f[_0x38d412(0x2d1)],extractFeishuDocCliError(_0x5cf445[_0x38d412(0x326)],_0x38d412(0x243)+'\x20'+_0x5ac67d['join']('\x20')+(_0x38d412(0x1c2)+'with\x20cod'+'e\x20')+_0xa4dad8),'lark-cli'+'\x20'+_0x5ac67d[_0x38d412(0x2f3)]('\x20')+(_0x38d412(0x1c2)+'with\x20cod'+'e\x20')+_0xa4dad8),_0x7e24ba(_0x38d412(0x1c0)+_0x38d412(0x313),{'connector':'feishu_d'+'oc','phase':_0x38d412(0x231),'message':_0x5cf445['errorMes'+_0x38d412(0x316)]});return;}void Promise[_0x38d412(0x27c)](_0x457f7f[_0x38d412(0x2f7)+'s']())[_0x38d412(0x288)](_0x34664c=>{const _0x344f7c=_0x38d412;_0x5cf445[_0x344f7c(0x2f6)]=_0x344f7c(0x231),_0x5cf445[_0x344f7c(0x35e)+_0x344f7c(0x316)]=_0x34664c instanceof Error?_0x34664c[_0x344f7c(0x295)]:_0x344f7c(0x1d6)+_0x344f7c(0x236);});});})[_0x32b382(0x288)](_0x172cc6=>{const _0x85aac4=_0x32b382;_0x5cf445[_0x85aac4(0x2f6)]=_0x85aac4(0x231),_0x5cf445[_0x85aac4(0x35e)+_0x85aac4(0x316)]=_0x172cc6 instanceof Error?_0x172cc6[_0x85aac4(0x295)]:'飞书\x20CLI\x20执'+_0x85aac4(0x29f),_0x5cf445[_0x85aac4(0x238)]=null,_0x7e24ba('connecto'+'r-log',{'connector':_0x85aac4(0x281)+'oc','phase':'error','message':_0x5cf445[_0x85aac4(0x35e)+'sage']});});}function _0x2b0d55(_0xb09f13){const _0x4fe913=_0x2ba947;if(!_0xb09f13[_0x4fe913(0x1d9)])return;clearTimeout(_0xb09f13[_0x4fe913(0x1d9)]),_0xb09f13[_0x4fe913(0x1d9)]=null;}function _0x2710ee(_0x517269){const _0x34b920=_0x2ba947;if(!_0x517269[_0x34b920(0x366)+'usTimer'])return;clearTimeout(_0x517269[_0x34b920(0x366)+_0x34b920(0x27e)]),_0x517269[_0x34b920(0x366)+_0x34b920(0x27e)]=null;}function _0x1ed969(_0x3f8866,_0x48ade7=0x7d0){const _0x360f7=_0x2ba947;if(_0x3f8866['status']!==_0x360f7(0x302))return;_0x2710ee(_0x3f8866),_0x3f8866[_0x360f7(0x366)+_0x360f7(0x27e)]=setTimeout(()=>{const _0x5f3af4=_0x360f7;_0x42bf6b(_0x3f8866,[_0x5f3af4(0x353),'status'],{'phase':_0x5f3af4(0x31b),'message':'正在验证飞书授权'+'状态','onFailure':(_0x296f25,_0x56ee0f)=>{const _0x2bca7d=_0x5f3af4;if(Date[_0x2bca7d(0x3a6)]()-_0x3f8866[_0x2bca7d(0x366)+'usStarte'+_0x2bca7d(0x1da)]>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x3f8866[_0x2bca7d(0x2f6)]='error',_0x3f8866['errorMes'+'sage']=getFeishuDocCliFailureMessage(_0x2bca7d(0x31b),extractFeishuDocCliError(_0x56ee0f,_0x2bca7d(0x38a)+_0x2bca7d(0x387)),_0x2bca7d(0x38a)+_0x2bca7d(0x387));return;}_0x1ed969(_0x3f8866);},'onSuccess':()=>{const _0x5d60c4=_0x5f3af4;try{ensureFeishuDocCliUserStatus(_0x3f8866['output']);}catch(_0x134b54){if(Date[_0x5d60c4(0x3a6)]()-_0x3f8866[_0x5d60c4(0x366)+_0x5d60c4(0x1c8)+'dAt']>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x3f8866['status']=_0x5d60c4(0x231),_0x3f8866[_0x5d60c4(0x35e)+_0x5d60c4(0x316)]=_0x134b54 instanceof Error?_0x134b54[_0x5d60c4(0x295)]:_0x5d60c4(0x38a)+'权状态验证失败';return;}_0x1ed969(_0x3f8866);return;}return _0x2710ee(_0x3f8866),_0x295e71(_0x3f8866);}});},_0x48ade7);}function _0x163c5e(_0x795cce){const _0x7345ca=_0x2ba947;if(!_0x795cce[_0x7345ca(0x2ea)]||!_0x795cce[_0x7345ca(0x36b)+'cret']){_0x795cce[_0x7345ca(0x2f6)]='error',_0x795cce[_0x7345ca(0x35e)+_0x7345ca(0x316)]=_0x7345ca(0x203)+_0x7345ca(0x307)+_0x7345ca(0x380);return;}const _0x44953a=_0x795cce['cliAppId'],_0xd4ec7f=_0x795cce[_0x7345ca(0x36b)+_0x7345ca(0x253)];_0x42bf6b(_0x795cce,['--versio'+'n'],{'phase':_0x7345ca(0x2c9),'message':_0x7345ca(0x2fa)+'LI','onSuccess':()=>{const _0x5e2b73=_0x7345ca;_0x42bf6b(_0x795cce,[_0x5e2b73(0x271),_0x5e2b73(0x1bd),_0x5e2b73(0x22e)+_0x5e2b73(0x1bd),_0x5e2b73(0x2c3),_0x44953a,_0x5e2b73(0x357)+_0x5e2b73(0x321)+'in',_0x5e2b73(0x220),'feishu'],{'phase':_0x5e2b73(0x2c9),'message':_0x5e2b73(0x2bd)+'CLI\x20用户身份'+'应用','stdin':_0xd4ec7f,'onSuccess':()=>{const _0x1fcf10=_0x5e2b73;_0x42bf6b(_0x795cce,['auth',_0x1fcf10(0x1bf),'--domain',_0x1fcf10(0x23a)+_0x1fcf10(0x3a3)+_0x1fcf10(0x350)+_0x1fcf10(0x351)+'slides,b'+_0x1fcf10(0x269),_0x1fcf10(0x3af),_0x1fcf10(0x1be)+'ocs:read',_0x1fcf10(0x24d)+'t'],{'phase':'auth','message':'正在打开飞书用户'+_0x1fcf10(0x370),'onSuccess':()=>{const _0x32c38f=_0x1fcf10,_0x2ac49d=parseFeishuDocCliJson(_0x795cce[_0x32c38f(0x326)]),_0x42a42a=getTrimmedString(_0x2ac49d[_0x32c38f(0x3b5)+_0x32c38f(0x251)+'_complet'+'e'])||getTrimmedString(_0x2ac49d['verifica'+_0x32c38f(0x1fa)])||getTrimmedString(_0x2ac49d[_0x32c38f(0x3b5)+_0x32c38f(0x251)]),_0x4c84ae=getTrimmedString(_0x2ac49d[_0x32c38f(0x2c4)+_0x32c38f(0x1c9)]);if(!_0x42a42a||!_0x4c84ae){_0x795cce[_0x32c38f(0x2f6)]=_0x32c38f(0x231),_0x795cce[_0x32c38f(0x35e)+_0x32c38f(0x316)]=_0x32c38f(0x3ad)+_0x32c38f(0x1cc)+_0x32c38f(0x287)+_0x32c38f(0x31e)+summarizeCliOutput(_0x795cce[_0x32c38f(0x326)]);return;}_0x795cce[_0x32c38f(0x2b6)]=_0x42a42a,_0x795cce['deviceCo'+'de']=_0x4c84ae,void _0x1e0c73['openExte'+_0x32c38f(0x3a7)](_0x42a42a)[_0x32c38f(0x288)](()=>{}),_0x42bf6b(_0x795cce,[_0x32c38f(0x353),_0x32c38f(0x1bf),_0x32c38f(0x35d)+'-code',_0x4c84ae],{'phase':_0x32c38f(0x31b),'message':_0x32c38f(0x2e9)+'完成','onSuccess':()=>{const _0x29e685=_0x32c38f;_0x795cce[_0x29e685(0x366)+'usStarte'+_0x29e685(0x1da)]=Date['now'](),_0x1ed969(_0x795cce,0x1f4);}});}});}});}});}function _0x787d60(_0x30ced0){const _0x4e4c76=_0x2ba947;if(_0x30ced0[_0x4e4c76(0x2f6)]!==_0x4e4c76(0x302))return;_0x2b0d55(_0x30ced0),_0x30ced0[_0x4e4c76(0x1d9)]=setTimeout(()=>void _0x6e2d09(_0x30ced0),_0x30ced0['appPollI'+'ntervalM'+'s']);}async function _0x6e2d09(_0x41691e){const _0x488e52=_0x2ba947;if(_0x41691e['status']!==_0x488e52(0x302)||_0x41691e[_0x488e52(0x2d1)]!=='create'||!_0x41691e[_0x488e52(0x234)+_0x488e52(0x293)]||!_0x41691e[_0x488e52(0x1cb)+_0x488e52(0x386)])return;if(Date[_0x488e52(0x3a6)]()>=_0x41691e[_0x488e52(0x392)+_0x488e52(0x3ab)]){_0x41691e[_0x488e52(0x2f6)]=_0x488e52(0x231),_0x41691e[_0x488e52(0x35e)+'sage']=_0x488e52(0x284)+_0x488e52(0x215),_0x2b0d55(_0x41691e);return;}try{const _0x30d893=await pollFeishuRegistration(_0x41691e[_0x488e52(0x234)+'lient'],_0x41691e[_0x488e52(0x1cb)+_0x488e52(0x386)]),_0x247324=getTrimmedString(_0x30d893[_0x488e52(0x20a)+'d']),_0x15ecac=getTrimmedString(_0x30d893[_0x488e52(0x33d)+'ecret']),_0xa62b2=getTrimmedString(_0x30d893[_0x488e52(0x231)]);if(_0x247324&&_0x15ecac){const _0x357d77=asRecord(_0x30d893['user_inf'+'o']);await _0x57e12c({'appId':_0x247324,'appSecret':_0x15ecac,'userInfo':{'openId':getTrimmedString(_0x357d77['open_id'])||null},'configPath':_0x41691e[_0x488e52(0x3b3)+_0x488e52(0x255)+'h']}),_0x41691e[_0x488e52(0x2ea)]=_0x247324,_0x41691e[_0x488e52(0x36b)+_0x488e52(0x253)]=_0x15ecac,_0x2b0d55(_0x41691e),_0x41691e['message']='飞书应用已创建,'+_0x488e52(0x1d7),_0x163c5e(_0x41691e);return;}if(!_0xa62b2||_0xa62b2===_0x488e52(0x362)+'ation_pe'+_0x488e52(0x1e2)){_0x787d60(_0x41691e);return;}if(_0xa62b2===_0x488e52(0x241)+'n'){_0x41691e['appPollI'+_0x488e52(0x2df)+'s']+=0x1388,_0x787d60(_0x41691e);return;}_0x41691e[_0x488e52(0x2f6)]=_0x488e52(0x231),_0x41691e[_0x488e52(0x35e)+_0x488e52(0x316)]=getTrimmedString(_0x30d893[_0x488e52(0x371)+_0x488e52(0x32e)+'n'])||'飞书应用创建失败'+':'+_0xa62b2,_0x2b0d55(_0x41691e);}catch(_0x3f7190){_0x41691e[_0x488e52(0x2f6)]='error',_0x41691e[_0x488e52(0x35e)+'sage']=_0x3f7190 instanceof Error?_0x3f7190['message']:_0x488e52(0x35c),_0x2b0d55(_0x41691e);}}async function _0x295e71(_0x326cd7){const _0x2395d2=_0x2ba947;await _0x32b0c2({'accountName':_0x2395d2(0x1ff)}),_0x326cd7[_0x2395d2(0x2f6)]=_0x2395d2(0x1f8)+'d',_0x326cd7[_0x2395d2(0x2d1)]=_0x2395d2(0x1f8)+'d',_0x326cd7[_0x2395d2(0x295)]='飞书用户身份授权'+'完成',_0x326cd7['errorMes'+'sage']=null;}async function _0x39f22b(){const _0x59e2e6=_0x2ba947,_0x3b22a0=createFeishuRegistrationClient(),_0x420868=await initFeishuRegistration(_0x3b22a0),_0x7a9bb8=Array[_0x59e2e6(0x374)](_0x420868['supporte'+'d_auth_m'+'ethods'])?_0x420868['supporte'+_0x59e2e6(0x240)+_0x59e2e6(0x2e2)][_0x59e2e6(0x2cc)](getTrimmedString)[_0x59e2e6(0x2e5)](Boolean):[];if(!_0x7a9bb8[_0x59e2e6(0x229)](_0x59e2e6(0x33d)+'ecret'))throw new Error(_0x59e2e6(0x309)+_0x59e2e6(0x325)+_0x59e2e6(0x33d)+_0x59e2e6(0x285));const _0x1d41f8=await beginFeishuRegistration(_0x3b22a0),_0x2e3c04=getTrimmedString(_0x1d41f8['verifica'+_0x59e2e6(0x251)+_0x59e2e6(0x296)+'e']),_0x3ac424=getTrimmedString(_0x1d41f8[_0x59e2e6(0x2c4)+_0x59e2e6(0x1c9)]),_0x57eeba=Number(_0x1d41f8[_0x59e2e6(0x39b)+'n'])||0x258,_0x200c57=Number(_0x1d41f8[_0x59e2e6(0x26c)])||0x5;if(!_0x2e3c04||!_0x3ac424)throw new Error('飞书开放平台未返'+_0x59e2e6(0x21c)+_0x59e2e6(0x2d7)+_0x59e2e6(0x301));const _0x317cb6=randomUUID(),_0x4ec1f8={'sessionId':_0x317cb6,'status':_0x59e2e6(0x302),'phase':_0x59e2e6(0x258),'url':_0x2e3c04,'appDeviceCode':_0x3ac424,'appPollClient':_0x3b22a0,'appPollIntervalMs':Math[_0x59e2e6(0x2a1)](_0x200c57*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'appExpiresAt':Date[_0x59e2e6(0x3a6)]()+_0x57eeba*0x3e8,'appTimer':null,'authStatusTimer':null,'authStatusStartedAt':0x0,'deviceCode':null,'message':_0x59e2e6(0x2bf)+'完成应用创建','errorMessage':null,'process':null,'output':'','cliHostConfigPath':_0x4d57ab(),'cliAppId':null,'cliAppSecret':null};return _0x57a428[_0x59e2e6(0x355)](_0x317cb6,_0x4ec1f8),_0x787d60(_0x4ec1f8),createFeishuDocCliStatus(_0x4ec1f8);}function _0x14bce8(_0x5f40b2={}){const _0x55d3e5=_0x2ba947,_0x4f12d9=safeString(_0x5f40b2[_0x55d3e5(0x2ae)+'d']);if(!_0x4f12d9)throw new Error(_0x55d3e5(0x2c6)+_0x55d3e5(0x1e3)+'ession\x20i'+_0x55d3e5(0x3a1)+_0x55d3e5(0x27d));const _0x2d319d=_0x57a428[_0x55d3e5(0x2ba)](_0x4f12d9);if(!_0x2d319d)throw new Error('Feishu\x20d'+_0x55d3e5(0x1e3)+_0x55d3e5(0x2eb)+'ot\x20found');return createFeishuDocCliStatus(_0x2d319d);}function _0x2ddcd3(_0x24c2b5={}){const _0x41e043=_0x2ba947,_0x45d403=safeString(_0x24c2b5['sessionI'+'d']);if(!_0x45d403)return{'ok':!![]};const _0x2744e7=_0x57a428[_0x41e043(0x2ba)](_0x45d403);if(!_0x2744e7)return{'ok':!![]};return _0x2b0d55(_0x2744e7),_0x2710ee(_0x2744e7),_0x2744e7[_0x41e043(0x238)]?.[_0x41e043(0x2e0)](),_0x57a428[_0x41e043(0x2da)](_0x45d403),{'ok':!![]};}function _0x27bb9b(_0x1b4849={}){const _0x22ea61=_0x2ba947,_0x305183=safeString(_0x1b4849[_0x22ea61(0x2ae)+'d']);if(!_0x305183)throw new Error(_0x22ea61(0x2c6)+_0x22ea61(0x1e3)+_0x22ea61(0x1fb)+_0x22ea61(0x3a1)+_0x22ea61(0x27d));const _0x3212c1=_0x57a428['get'](_0x305183);if(!_0x3212c1)throw new Error('Feishu\x20d'+'oc\x20CLI\x20s'+'ession\x20n'+'ot\x20found');if(_0x3212c1['status']===_0x22ea61(0x231))throw new Error(_0x3212c1[_0x22ea61(0x35e)+_0x22ea61(0x316)]||_0x22ea61(0x1d6)+_0x22ea61(0x236));return{'ok':!![]};}async function _0x5f4f6c(_0x586fca){const _0x540ad1=_0x2ba947,_0x134c2b=asRecord(_0x586fca[_0x540ad1(0x363)]),_0x5b24cd=asRecord(_0x134c2b[_0x540ad1(0x3b7)]),_0x5f3354=asStringArray(_0x134c2b[_0x540ad1(0x26e)]),_0x345dec=asRecord(_0x5b24cd[WECHAT_PLUGIN_ID]),_0x52b9b0=_0x345dec[_0x540ad1(0x32a)]===!![]||_0x5f3354[_0x540ad1(0x229)](WECHAT_PLUGIN_ID),_0x5b38f5=join(_0x25c3a4['resolveS'+_0x540ad1(0x1e7)](),WECHAT_PLUGIN_ID),_0xd6e69b=join(_0x5b38f5,_0x540ad1(0x31d)+_0x540ad1(0x1ca));let _0xc75771=![];try{const _0x2810f5=(await readFile(_0xd6e69b,_0x540ad1(0x248)))[_0x540ad1(0x1e8)]();if(_0x2810f5){const _0x1d888e=JSON[_0x540ad1(0x3ae)](_0x2810f5);_0xc75771=Array[_0x540ad1(0x374)](_0x1d888e)?_0x1d888e[_0x540ad1(0x314)]>0x0:Object['keys'](asRecord(_0x1d888e))[_0x540ad1(0x314)]>0x0;}}catch{}if(!_0xc75771)try{_0xc75771=(await readdir(join(_0x5b38f5,_0x540ad1(0x31d))))['length']>0x0;}catch{}return{'exists':_0x52b9b0||_0xc75771,'enabled':_0x52b9b0,'connected':_0x52b9b0&&_0xc75771};}async function _0x528ec3(){const _0x484abc=_0x2ba947,_0x4bee75=await _0x2a0952(),_0x2794a7=asRecord(_0x4bee75[_0x484abc(0x1ba)]),_0x3def57=[],_0x33f49b=await _0x5f4f6c(_0x4bee75);_0x33f49b['exists']&&_0x3def57[_0x484abc(0x1eb)]({'id':WECHAT_PLUGIN_ID,'type':'wechat','name':'微信','enabled':_0x33f49b[_0x484abc(0x32a)],'connected':_0x33f49b[_0x484abc(0x2b8)+'d']});const _0x10a7eb=asRecord(_0x2794a7['qqbot']),_0x28671b=getTrimmedString(_0x10a7eb['appId']),_0x571d0c=getTrimmedString(_0x10a7eb[_0x484abc(0x230)+_0x484abc(0x253)]);_0x28671b&&_0x571d0c&&_0x3def57['push']({'id':_0x484abc(0x1d8),'type':'qqbot','name':_0x484abc(0x2a5),'enabled':_0x10a7eb['enabled']!==![],'appId':_0x28671b,'clientSecret':_0x571d0c});const _0x8bc58a=asRecord(_0x2794a7[_0x484abc(0x228)]),_0x467dc0=getTrimmedString(_0x8bc58a[_0x484abc(0x361)]),_0x14ad59=getTrimmedString(_0x8bc58a[_0x484abc(0x3a4)]);_0x467dc0&&_0x14ad59&&_0x3def57['push']({'id':_0x484abc(0x228),'type':'wecom','name':_0x484abc(0x34c),'enabled':_0x8bc58a[_0x484abc(0x32a)]!==![],'botId':_0x467dc0,'secret':_0x14ad59});const _0x556ace=asRecord(_0x2794a7[_0x484abc(0x1dc)]),_0x5ec034=getTrimmedString(_0x556ace['appId']),_0x603a07=getTrimmedString(_0x556ace['appSecre'+'t']);return _0x5ec034&&_0x603a07&&getTrimmedString(_0x556ace[_0x484abc(0x26b)+'y'])!==FEISHU_DOC_CONNECTOR_PLUGIN_ID&&_0x3def57[_0x484abc(0x1eb)]({'id':_0x484abc(0x1dc),'type':'feishu','name':_0x484abc(0x217),'enabled':_0x556ace[_0x484abc(0x32a)]!==![],'appId':_0x5ec034,'appSecret':_0x603a07}),_0x3def57;}async function _0x583ce2(_0x37ec48){const _0x3ac763=_0x2ba947;if(typeof openClawConfigHandlers[_0x3ac763(0x320)+_0x3ac763(0x391)]===_0x3ac763(0x1d1))return openClawConfigHandlers[_0x3ac763(0x320)+'nConfig']({'pluginId':WECHAT_PLUGIN_ID,'enabled':Boolean(_0x37ec48),'reason':WECHAT_PLUGIN_ID+_0x3ac763(0x1bb)+(_0x37ec48?'enabled':'disabled')});const _0x3061e2=await _0x2a0952(),_0x3be5b5=asRecord(_0x3061e2[_0x3ac763(0x363)]),_0x1eb5a2=asRecord(_0x3be5b5[_0x3ac763(0x3b7)]);return _0x1eb5a2[WECHAT_PLUGIN_ID]={...asRecord(_0x1eb5a2[WECHAT_PLUGIN_ID]),'enabled':Boolean(_0x37ec48)},_0x3be5b5[_0x3ac763(0x3b7)]=_0x1eb5a2,_0x3be5b5[_0x3ac763(0x26e)]=_0x37ec48?dedupeStrings([...asStringArray(_0x3be5b5[_0x3ac763(0x26e)]),WECHAT_PLUGIN_ID]):asStringArray(_0x3be5b5[_0x3ac763(0x26e)])['filter'](_0x3a9bea=>_0x3a9bea!==WECHAT_PLUGIN_ID),_0x3061e2[_0x3ac763(0x363)]=_0x3be5b5,await _0x5a0c64(_0x3061e2,WECHAT_PLUGIN_ID+_0x3ac763(0x1bb)+(_0x37ec48?'enabled':_0x3ac763(0x1c6))),{'ok':!![]};}async function _0x400ef7(_0x337921={}){const _0x1ae131=_0x2ba947,_0x523fa4=safeString(_0x337921['channelI'+'d']||_0x337921['id']);if(!_0x523fa4)throw new Error(_0x1ae131(0x2d4)+_0x1ae131(0x308)+_0x1ae131(0x3b4));const _0x2f7bbb=await _0x2a0952(),_0xe6871a=asRecord(_0x2f7bbb[_0x1ae131(0x1ba)]),_0x24b385=asRecord(_0x2f7bbb[_0x1ae131(0x363)]),_0x2c1c7f=asRecord(_0x24b385[_0x1ae131(0x3b7)]),_0x5035f3=_0x4bda30=>{const _0x4e7f09=_0x1ae131;_0x2c1c7f[_0x4bda30]=createConnectorPluginEntry(_0x4bda30,_0x2c1c7f[_0x4bda30],![],{}),_0x24b385[_0x4e7f09(0x26e)]=asStringArray(_0x24b385[_0x4e7f09(0x26e)])['filter'](_0x3469bf=>_0x3469bf!==_0x4bda30),_0x24b385[_0x4e7f09(0x3b7)]=_0x2c1c7f,_0x2f7bbb['plugins']=_0x24b385;};if(_0x523fa4==='feishu_d'+'oc')return _0x5035f3(FEISHU_DOC_CONNECTOR_PLUGIN_ID),getTrimmedString(asRecord(_0xe6871a[_0x1ae131(0x1dc)])['managedB'+'y'])===FEISHU_DOC_CONNECTOR_PLUGIN_ID&&(delete _0xe6871a[_0x1ae131(0x1dc)],_0x2f7bbb[_0x1ae131(0x1ba)]=_0xe6871a),await rm(_0xb2d7c(),{'recursive':!![],'force':!![]})[_0x1ae131(0x288)](()=>{}),_0x5a0c64(_0x2f7bbb,_0x1ae131(0x354)+_0x1ae131(0x342)+'ctor\x20plu'+_0x1ae131(0x2cd)+_0x1ae131(0x2b7));if(_0x523fa4===_0x1ae131(0x270)){if(typeof openClawConfigHandlers[_0x1ae131(0x320)+_0x1ae131(0x391)]===_0x1ae131(0x1d1))return openClawConfigHandlers[_0x1ae131(0x320)+'nConfig']({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x1ae131(0x202)+_0x1ae131(0x1c0)+_0x1ae131(0x1cd)+_0x1ae131(0x25f)});return _0x5035f3(QQ_MAIL_CONNECTOR_PLUGIN_ID),_0x5a0c64(_0x2f7bbb,_0x1ae131(0x202)+'connecto'+'r\x20plugin'+_0x1ae131(0x25f));}if(_0x523fa4===_0x1ae131(0x328)+'mail'){if(typeof openClawConfigHandlers[_0x1ae131(0x320)+_0x1ae131(0x391)]===_0x1ae131(0x1d1))return openClawConfigHandlers[_0x1ae131(0x320)+_0x1ae131(0x391)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x1ae131(0x36f)+_0x1ae131(0x367)+_0x1ae131(0x1de)+_0x1ae131(0x1fe)+'leted'});return _0x5035f3(NETEASE_MAIL_CONNECTOR_PLUGIN_ID),_0x5a0c64(_0x2f7bbb,_0x1ae131(0x36f)+_0x1ae131(0x367)+_0x1ae131(0x1de)+_0x1ae131(0x1fe)+_0x1ae131(0x261));}if(_0x523fa4===_0x1ae131(0x37a)+_0x1ae131(0x2f1)){if(typeof openClawConfigHandlers[_0x1ae131(0x320)+_0x1ae131(0x391)]===_0x1ae131(0x1d1))return openClawConfigHandlers[_0x1ae131(0x320)+_0x1ae131(0x391)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x1ae131(0x2a2)+_0x1ae131(0x364)+'onnector'+_0x1ae131(0x1bb)+_0x1ae131(0x2b5)});return _0x5035f3(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID),_0x5a0c64(_0x2f7bbb,_0x1ae131(0x2a2)+_0x1ae131(0x364)+_0x1ae131(0x22d)+_0x1ae131(0x1bb)+_0x1ae131(0x2b5));}if(_0x523fa4===_0x1ae131(0x37a)+_0x1ae131(0x2e3)){if(typeof openClawConfigHandlers['deleteSk'+'illEntry']==='function')return openClawConfigHandlers['deleteSk'+_0x1ae131(0x365)]({'skillId':TENCENT_DOCS_SKILL_ID,'reason':_0x1ae131(0x2a2)+'docs\x20ski'+_0x1ae131(0x36c)+_0x1ae131(0x207)+_0x1ae131(0x2e6)});const _0x5151e4=asRecord(_0x2f7bbb[_0x1ae131(0x22c)]),_0x2eff44=asRecord(_0x5151e4[_0x1ae131(0x3b7)]);return delete _0x2eff44[TENCENT_DOCS_SKILL_ID],_0x5151e4[_0x1ae131(0x3b7)]=_0x2eff44,_0x2f7bbb[_0x1ae131(0x22c)]=_0x5151e4,_0x5a0c64(_0x2f7bbb,_0x1ae131(0x2a2)+_0x1ae131(0x214)+_0x1ae131(0x36c)+_0x1ae131(0x207)+'eted');}if(_0x523fa4===_0x1ae131(0x348))return await _0x711880([_0x1ae131(0x353),_0x1ae131(0x39c)])[_0x1ae131(0x288)](()=>({'code':null,'output':''})),await _0x3f524a(),{'ok':!![]};if(_0x523fa4===_0x1ae131(0x2f8)+_0x1ae131(0x2be)){if(typeof openClawConfigHandlers['deleteMc'+'pServer']===_0x1ae131(0x1d1))return openClawConfigHandlers[_0x1ae131(0x2bc)+'pServer']({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'reason':_0x1ae131(0x2f8)+'\x20doc\x20mcp'+_0x1ae131(0x25f)});const _0x15391b=readOpenClawMcpServersFromConfig(_0x2f7bbb);return delete _0x15391b[DINGTALK_DOC_MCP_SERVER_NAME],writeOpenClawMcpServersToConfig(_0x2f7bbb,_0x15391b),_0x5a0c64(_0x2f7bbb,_0x1ae131(0x2f8)+'\x20doc\x20mcp'+_0x1ae131(0x25f));}if(_0x523fa4===WECHAT_PLUGIN_ID||_0x523fa4===_0x1ae131(0x1ce)+_0x1ae131(0x205)){_0x2c1c7f[WECHAT_PLUGIN_ID]={...asRecord(_0x2c1c7f[WECHAT_PLUGIN_ID]),'enabled':![]},_0x24b385[_0x1ae131(0x3b7)]=_0x2c1c7f,_0x24b385[_0x1ae131(0x26e)]=asStringArray(_0x24b385[_0x1ae131(0x26e)])['filter'](_0x216fe9=>_0x216fe9!==WECHAT_PLUGIN_ID&&_0x216fe9!==_0x1ae131(0x1ce)+_0x1ae131(0x205)),_0x2f7bbb[_0x1ae131(0x363)]=_0x24b385;const _0xd5c1a1=join(_0x25c3a4[_0x1ae131(0x38d)+_0x1ae131(0x1e7)](),WECHAT_PLUGIN_ID);return await rm(join(_0xd5c1a1,_0x1ae131(0x31d)+'.json'),{'force':!![]})[_0x1ae131(0x288)](()=>{}),await rm(join(_0xd5c1a1,_0x1ae131(0x31d)),{'recursive':!![],'force':!![]})['catch'](()=>{}),_0x5a0c64(_0x2f7bbb,_0x523fa4+(_0x1ae131(0x252)+_0x1ae131(0x2e8)+'deleted'));}if(_0x523fa4===_0x1ae131(0x1dc)){if(typeof openClawConfigHandlers[_0x1ae131(0x244)+_0x1ae131(0x278)+_0x1ae131(0x227)]===_0x1ae131(0x1d1))return openClawConfigHandlers[_0x1ae131(0x244)+'annelCon'+_0x1ae131(0x227)]({'channelId':_0x1ae131(0x1dc),'pluginId':_0x1ae131(0x1dc),'reason':_0x1ae131(0x210)+'hannel\x20c'+'onfig\x20de'+_0x1ae131(0x261)});return delete _0xe6871a[_0x1ae131(0x1dc)],_0x2f7bbb[_0x1ae131(0x1ba)]=_0xe6871a,_0x2c1c7f['feishu']={...asRecord(_0x2c1c7f[_0x1ae131(0x1dc)]),'enabled':![]},_0x24b385[_0x1ae131(0x3b7)]=_0x2c1c7f,_0x24b385[_0x1ae131(0x26e)]=asStringArray(_0x24b385[_0x1ae131(0x26e)])['filter'](_0x48a137=>_0x48a137!==_0x1ae131(0x1dc)),_0x2f7bbb[_0x1ae131(0x363)]=_0x24b385,_0x5a0c64(_0x2f7bbb,'feishu\x20c'+_0x1ae131(0x33a)+_0x1ae131(0x1bc)+_0x1ae131(0x261));}if(_0x523fa4===_0x1ae131(0x1d8)){if(typeof openClawConfigHandlers[_0x1ae131(0x244)+'annelCon'+_0x1ae131(0x227)]===_0x1ae131(0x1d1))return openClawConfigHandlers['deleteCh'+_0x1ae131(0x278)+'fig']({'channelId':_0x1ae131(0x1d8),'pluginId':QQBOT_PLUGIN_ID,'reason':_0x1ae131(0x264)+'annel\x20co'+'nfig\x20del'+_0x1ae131(0x2e6)});delete _0xe6871a[_0x1ae131(0x1d8)],_0x2c1c7f[QQBOT_PLUGIN_ID]={...asRecord(_0x2c1c7f[QQBOT_PLUGIN_ID]),'enabled':![]},_0x24b385['allow']=asStringArray(_0x24b385[_0x1ae131(0x26e)])[_0x1ae131(0x2e5)](_0x333664=>_0x333664!==QQBOT_PLUGIN_ID);}if(_0x523fa4==='wecom'){if(typeof openClawConfigHandlers['deleteCh'+_0x1ae131(0x278)+_0x1ae131(0x227)]==='function')return openClawConfigHandlers[_0x1ae131(0x244)+_0x1ae131(0x278)+'fig']({'channelId':_0x1ae131(0x228),'pluginId':WECOM_PLUGIN_ID,'reason':_0x1ae131(0x292)+_0x1ae131(0x343)+_0x1ae131(0x398)+'eted'});delete _0xe6871a[_0x1ae131(0x228)],_0x2c1c7f[WECOM_PLUGIN_ID]={...asRecord(_0x2c1c7f[WECOM_PLUGIN_ID]),'enabled':![]},_0x24b385['allow']=asStringArray(_0x24b385[_0x1ae131(0x26e)])[_0x1ae131(0x2e5)](_0x3cd9fa=>_0x3cd9fa!==WECOM_PLUGIN_ID);}return _0x2f7bbb['channels']=_0xe6871a,_0x24b385[_0x1ae131(0x3b7)]=_0x2c1c7f,_0x2f7bbb[_0x1ae131(0x363)]=_0x24b385,_0x5a0c64(_0x2f7bbb,_0x523fa4+(_0x1ae131(0x252)+_0x1ae131(0x2e8)+'deleted'));}async function _0x126047(_0x13786f={}){const _0x567aa9=_0x2ba947,_0x5deb55=safeString(_0x13786f['channelI'+'d']||_0x13786f['id']);if(!_0x5deb55)throw new Error(_0x567aa9(0x2d4)+_0x567aa9(0x308)+_0x567aa9(0x3b4));const _0x1c5a52=_0x13786f[_0x567aa9(0x32a)]===!![],_0x4d9b85=await _0x2a0952(),_0x407f1f=asRecord(_0x4d9b85[_0x567aa9(0x363)]),_0x46f01f=asRecord(_0x407f1f[_0x567aa9(0x3b7)]),_0x17af59=_0x2302aa=>{const _0x18094d=_0x567aa9;_0x46f01f[_0x2302aa]=createConnectorPluginEntry(_0x2302aa,_0x46f01f[_0x2302aa],_0x1c5a52,{},{'preserveExistingConfig':!![]}),_0x407f1f[_0x18094d(0x26e)]=_0x1c5a52?dedupeStrings([...asStringArray(_0x407f1f[_0x18094d(0x26e)]),_0x2302aa]):asStringArray(_0x407f1f['allow'])[_0x18094d(0x2e5)](_0x57c07e=>_0x57c07e!==_0x2302aa),_0x407f1f[_0x18094d(0x3b7)]=_0x46f01f,_0x4d9b85[_0x18094d(0x363)]=_0x407f1f;};if(_0x5deb55==='feishu_d'+'oc'){const _0x1aca73=asRecord(_0x46f01f[FEISHU_DOC_CONNECTOR_PLUGIN_ID]);if(Object['keys'](_0x1aca73)[_0x567aa9(0x314)]===0x0)throw new Error(_0x567aa9(0x311)+'r\x20\x22'+_0x5deb55+(_0x567aa9(0x33c)+_0x567aa9(0x224)));if(typeof openClawConfigHandlers[_0x567aa9(0x320)+_0x567aa9(0x391)]==='function')return openClawConfigHandlers[_0x567aa9(0x320)+_0x567aa9(0x391)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':_0x1c5a52,'reason':_0x5deb55+(_0x567aa9(0x252)+'\x20config\x20')+(_0x1c5a52?_0x567aa9(0x32a):'disabled')});_0x17af59(FEISHU_DOC_CONNECTOR_PLUGIN_ID);}else{if(_0x5deb55===_0x567aa9(0x270)){if(typeof openClawConfigHandlers['setPlugi'+_0x567aa9(0x391)]==='function')return openClawConfigHandlers[_0x567aa9(0x320)+_0x567aa9(0x391)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x1c5a52,'reason':_0x5deb55+(_0x567aa9(0x252)+_0x567aa9(0x2e8))+(_0x1c5a52?_0x567aa9(0x32a):_0x567aa9(0x1c6))});_0x17af59(QQ_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5deb55===_0x567aa9(0x328)+_0x567aa9(0x23d)){if(typeof openClawConfigHandlers['setPlugi'+_0x567aa9(0x391)]===_0x567aa9(0x1d1))return openClawConfigHandlers[_0x567aa9(0x320)+_0x567aa9(0x391)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x1c5a52,'reason':_0x5deb55+(_0x567aa9(0x252)+_0x567aa9(0x2e8))+(_0x1c5a52?_0x567aa9(0x32a):'disabled')});_0x17af59(NETEASE_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5deb55===_0x567aa9(0x37a)+'exmail'){if(typeof openClawConfigHandlers[_0x567aa9(0x320)+'nConfig']===_0x567aa9(0x1d1))return openClawConfigHandlers[_0x567aa9(0x320)+_0x567aa9(0x391)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x1c5a52,'reason':_0x5deb55+(_0x567aa9(0x252)+'\x20config\x20')+(_0x1c5a52?'enabled':_0x567aa9(0x1c6))});_0x17af59(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5deb55===_0x567aa9(0x37a)+_0x567aa9(0x2e3)){const _0x119f54=asRecord(_0x4d9b85['skills']),_0x15a825=asRecord(_0x119f54['entries']),_0x5e7ad9=asRecord(_0x15a825[TENCENT_DOCS_SKILL_ID]);if(typeof openClawConfigHandlers[_0x567aa9(0x218)+_0x567aa9(0x259)]===_0x567aa9(0x1d1))return openClawConfigHandlers[_0x567aa9(0x218)+_0x567aa9(0x259)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':{..._0x5e7ad9,'enabled':_0x1c5a52},'reason':_0x5deb55+('\x20channel'+_0x567aa9(0x2e8))+(_0x1c5a52?_0x567aa9(0x32a):_0x567aa9(0x1c6))});_0x15a825[TENCENT_DOCS_SKILL_ID]={..._0x5e7ad9,'enabled':_0x1c5a52},_0x119f54['entries']=_0x15a825,_0x4d9b85[_0x567aa9(0x22c)]=_0x119f54;}else{if(_0x5deb55===_0x567aa9(0x348)){if(_0x1c5a52&&!await _0x2f480f())throw new Error('金山文档尚未授权'+_0x567aa9(0x232));return await _0x4676d3(_0x1c5a52),{'ok':!![]};}else{if(_0x5deb55==='dingtalk'+_0x567aa9(0x2be)){const _0x326424=readOpenClawMcpServersFromConfig(_0x4d9b85),_0x40c7d1=findDingtalkDocMcpServer(_0x326424);if(!getTrimmedString(_0x40c7d1[_0x567aa9(0x2b6)]))throw new Error(_0x567aa9(0x311)+_0x567aa9(0x2e1)+_0x5deb55+(_0x567aa9(0x33c)+_0x567aa9(0x224)));_0x326424[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x40c7d1[_0x567aa9(0x2b6)],{'enabled':_0x1c5a52}),writeOpenClawMcpServersToConfig(_0x4d9b85,_0x326424);}else{const _0x1e2379=asRecord(_0x4d9b85[_0x567aa9(0x1ba)]),_0x35467b=asRecord(_0x1e2379[_0x5deb55]);if(Object[_0x567aa9(0x1d3)](_0x35467b)[_0x567aa9(0x314)]===0x0)throw new Error(_0x567aa9(0x2d4)+'\x22'+_0x5deb55+(_0x567aa9(0x33c)+_0x567aa9(0x224)));_0x35467b['enabled']=_0x1c5a52;let _0x7caaa8=null;_0x5deb55===_0x567aa9(0x1dc)&&(_0x7caaa8=_0x567aa9(0x1dc),_0x1c5a52&&(_0x35467b[_0x567aa9(0x2f0)+'g']=!![],delete _0x35467b[_0x567aa9(0x1db)]));if(_0x5deb55===_0x567aa9(0x1d8))_0x7caaa8=QQBOT_PLUGIN_ID;if(_0x5deb55==='wecom')_0x7caaa8=WECOM_PLUGIN_ID;if(_0x7caaa8&&typeof openClawConfigHandlers[_0x567aa9(0x24c)+'elConfig']==='function')return openClawConfigHandlers[_0x567aa9(0x24c)+'elConfig']({'channelId':_0x5deb55,'channel':_0x35467b,'pluginId':_0x7caaa8,'pluginEnabled':_0x1c5a52,'reason':_0x5deb55+('\x20channel'+_0x567aa9(0x2e8))+(_0x1c5a52?_0x567aa9(0x32a):'disabled')});_0x1e2379[_0x5deb55]=_0x35467b,_0x4d9b85[_0x567aa9(0x1ba)]=_0x1e2379;if(_0x5deb55===_0x567aa9(0x1dc))_0x17af59('feishu');if(_0x5deb55==='qqbot')_0x17af59(QQBOT_PLUGIN_ID);if(_0x5deb55===_0x567aa9(0x228))_0x17af59(WECOM_PLUGIN_ID);}}}}}}}return _0x5a0c64(_0x4d9b85,_0x5deb55+(_0x567aa9(0x252)+'\x20config\x20')+(_0x1c5a52?_0x567aa9(0x32a):_0x567aa9(0x1c6)));}async function _0x3fe3d9({gatewayPort:_0x122235,gatewayToken:_0x1fc200}={}){const _0x515991=_0x2ba947;_0x44960c&&(_0x44960c['kill'](),_0x44960c=null);const {cwd:_0x559e07,env:_0x2a0d30,runtime:_0xe7fc30}=await _0x5928f6({'FORCE_COLOR':'0',..._0x122235?{'OPENCLAW_GATEWAY_PORT':String(_0x122235)}:{},..._0x1fc200?{'OPENCLAW_GATEWAY_TOKEN':_0x1fc200}:{}}),_0x476f7a=_0xe7fc30[_0x515991(0x363)][_0x515991(0x359)](_0xff55ff=>_0xff55ff[_0x515991(0x28c)]===WECHAT_PLUGIN_ID);if(!_0x476f7a){const _0x37ed11=_0x515991(0x247)+'微信连接插件,请'+_0x515991(0x35f)+_0x515991(0x23c);return _0x7e24ba(_0x515991(0x38e)+'tatus',_0x515991(0x322)),_0x7e24ba(_0x515991(0x360)+'og',_0x37ed11),{'ok':![],'error':_0x37ed11};}await _0x583ce2(!![]),_0x7e24ba(_0x515991(0x360)+'og',_0x515991(0x27a)+_0x515991(0x305)+_0x515991(0x373)+_0x515991(0x349)+_0x515991(0x2c7)+_0x476f7a[_0x515991(0x28c)]),_0x44960c=spawn(_0xe7fc30[_0x515991(0x204)+_0x515991(0x2b2)],[_0xe7fc30[_0x515991(0x1ce)+_0x515991(0x3b6)],_0x515991(0x1ba),_0x515991(0x1bf),'--channe'+'l',_0x476f7a[_0x515991(0x28c)]],{'cwd':_0x559e07,'env':_0x2a0d30});let _0x45bfe9='',_0x4792fc=![],_0x325d3b=![];const _0x3a3810=_0x207cb6=>{const _0x33fa95=_0x515991,_0x4f6940=_0x207cb6[_0x33fa95(0x1f9)]();_0x45bfe9+=_0x4f6940;if(!_0x4792fc){const _0x410a4d=_0x45bfe9['match'](/(https:\/\/(?:[a-zA-Z0-9-]+\.)*weixin\.qq\.com\S+)/i);_0x410a4d?.[0x1]&&(_0x4792fc=!![],_0x7e24ba('wechat-q'+_0x33fa95(0x22b),_0x410a4d[0x1]),_0x7e24ba(_0x33fa95(0x38e)+_0x33fa95(0x21a),_0x33fa95(0x268)));}if(_0x4f6940[_0x33fa95(0x229)]('已扫描')||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x2f2)+_0x33fa95(0x31a))||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x1d5)))_0x7e24ba(_0x33fa95(0x38e)+_0x33fa95(0x21a),_0x33fa95(0x200));else{if(_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x312))||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x369))||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x335))||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x310)+'n')||_0x4f6940['includes'](_0x33fa95(0x32f)+'ccess')||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x319))||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x29c))||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x2ce))||_0x4f6940['includes']('already\x20'+'connecte'+'d')||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x233)+_0x33fa95(0x38f)+_0x33fa95(0x219)))_0x325d3b=!![],_0x7e24ba(_0x33fa95(0x38e)+_0x33fa95(0x21a),_0x33fa95(0x33f)),setTimeout(()=>{_0x44960c&&(_0x44960c['kill'](),_0x44960c=null);},0xbb8);else{if(_0x4f6940[_0x33fa95(0x229)]('过期')||_0x4f6940['includes'](_0x33fa95(0x242)))_0x7e24ba(_0x33fa95(0x38e)+_0x33fa95(0x21a),_0x33fa95(0x306));else(_0x4f6940[_0x33fa95(0x229)]('失败')||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x34b))||_0x4f6940[_0x33fa95(0x229)](_0x33fa95(0x31c)))&&_0x7e24ba(_0x33fa95(0x38e)+_0x33fa95(0x21a),'ERROR');}}_0x7e24ba(_0x33fa95(0x360)+'og',_0x4f6940);};return _0x44960c[_0x515991(0x39d)]?.['on'](_0x515991(0x329),_0x3a3810),_0x44960c[_0x515991(0x25e)]?.['on'](_0x515991(0x329),_0x3a3810),_0x44960c['on'](_0x515991(0x231),_0x4e86a7=>{const _0x13457c=_0x515991;_0x44960c=null,_0x7e24ba(_0x13457c(0x38e)+_0x13457c(0x21a),_0x13457c(0x322)),_0x7e24ba(_0x13457c(0x360)+'og',_0x13457c(0x2ff)+_0x13457c(0x1df)+_0x4e86a7[_0x13457c(0x295)]);}),_0x44960c['on']('close',_0x2bf5f7=>{const _0x49292a=_0x515991;_0x44960c=null,_0x325d3b?_0x583ce2(!![])['catch'](()=>{}):(_0x583ce2(![])[_0x49292a(0x288)](()=>{}),_0x7e24ba(_0x49292a(0x38e)+'tatus',_0x2bf5f7===0x0?_0x49292a(0x375):'ERROR'));}),{'ok':!![]};}function _0x5943ec(){const _0x513bee=_0x2ba947;return _0x44960c&&(_0x44960c[_0x513bee(0x2e0)](),_0x44960c=null),{'ok':!![]};}function _0x4ba46d(){const _0x1acc30=_0x2ba947;for(const _0x237ce5 of _0x19288f['values']()){_0x318478(_0x237ce5),_0x237ce5[_0x1acc30(0x238)]?.[_0x1acc30(0x2e0)]();}_0x19288f[_0x1acc30(0x297)]();for(const _0x4299be of _0x318af2[_0x1acc30(0x2e7)]()){_0x5bb6f5(_0x4299be);}_0x318af2[_0x1acc30(0x297)]();for(const _0x25e9c9 of _0x57a428[_0x1acc30(0x2e7)]()){_0x2b0d55(_0x25e9c9),_0x2710ee(_0x25e9c9),_0x25e9c9[_0x1acc30(0x238)]?.[_0x1acc30(0x2e0)]();}_0x57a428[_0x1acc30(0x297)](),_0x44960c&&(_0x44960c[_0x1acc30(0x2e0)](),_0x44960c=null);}return{'saveFeishuChannelConfig':_0x321eab,'saveQqbotChannelConfig':_0x2bede5,'saveWecomChannelConfig':_0x39068c,'saveQqMailConnectorConfig':_0xc41683,'saveNetEaseMailConnectorConfig':_0x1b3b15,'saveTencentExmailConnectorConfig':_0x59822a,'saveFeishuDocConnectorConfig':_0x32b0c2,'saveTencentDocsConnectorConfig':_0x23b930,'saveKdocsConnectorConfig':_0x3e9665,'saveDingtalkDocConnectorConfig':_0x162d0c,'readConfigSnapshot':_0xecac9d,'startKdocsCliConnectSession':_0x4dea60,'getKdocsCliConnectStatus':_0x41b5d7,'cancelKdocsCliConnectSession':_0x5366bb,'startFeishuDocCliConnectSession':_0x39f22b,'getFeishuDocCliConnectStatus':_0x14bce8,'cancelFeishuDocCliConnectSession':_0x2ddcd3,'completeFeishuDocCliConnectSession':_0x27bb9b,'startFeishuRegistrationSession':_0x59f7cf,'getFeishuRegistrationStatus':_0x27fdd2,'cancelFeishuRegistrationSession':_0x4bcf14,'listImChannelConfigs':_0x528ec3,'deleteImChannelConfig':_0x400ef7,'setImChannelEnabled':_0x126047,'startWechatChannelSession':_0x3fe3d9,'cancelWechatChannelSession':_0x5943ec,'dispose':_0x4ba46d};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x27601c=_0xcf8c;(function(_0x3efa8c,_0x17c05a){const _0x49a0a5=_0xcf8c,_0x8e3e8c=_0x3efa8c();while(!![]){try{const _0x1dbb34=-parseInt(_0x49a0a5(0xbe))/0x1+-parseInt(_0x49a0a5(0xcf))/0x2+parseInt(_0x49a0a5(0xc7))/0x3+parseInt(_0x49a0a5(0xfc))/0x4+-parseInt(_0x49a0a5(0x10e))/0x5+-parseInt(_0x49a0a5(0xea))/0x6*(parseInt(_0x49a0a5(0xf0))/0x7)+parseInt(_0x49a0a5(0xc3))/0x8;if(_0x1dbb34===_0x17c05a)break;else _0x8e3e8c['push'](_0x8e3e8c['shift']());}catch(_0x303478){_0x8e3e8c['push'](_0x8e3e8c['shift']());}}}(_0x24c6,0x6d321));import{existsSync,readdirSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';function _0x24c6(){const _0x3af4e4=['windows','node:chi','om\x20','platform','runtimeL','tar','resume','6LfvKMq','i\x20binary','ct-','\x20failed\x20','match','li-extra','6129557jPuiGo','ogger','map','ignore','m\x20OpenCl','https://','kill','skill\x20ve','e\x20kdocs\x20','runtimeR','pid','openclaw','1668656MXbpUJ','info','SIGTERM','led','.zip','ll\x20prepa','statusCo','rsion\x20fr','label','.kdocs-c','stderr','pipe','sing\x20fro','.cache','oot','re\x22\x20to\x20r','ory','Unable\x20t','3379630muglSE','/pro','.source','env','version','ld_proce','toString','amd64','href','filter','timeoutM','isFile','wujie-sh','now','o\x20resolv','.\x20Run\x20\x22w','ujie-she','kdocs-cl','-xzf','ebuild\x20t','headers','isDirect','data','877155PVTHSl','i\x20alread','extract\x20','\x20timed\x20o','SKILL.md','20312560bhzmpe','.tar.gz','i.exe','stdout','617133HuLTch','time]\x20do','wpsai.wp','i\x20is\x20mis','arch','win32','/release','cwd','571896pVVxqj','\x20not\x20fou','i\x20versio','x64','ut\x20after','me.','ell-runt','download','close','catch','location','name','log','tools','skillhub','error','WorkingD','Bundled\x20','utf8','ime\x0a'];_0x24c6=function(){return _0x3af4e4;};return _0x24c6();}function _0xcf8c(_0x76a471,_0x3672d7){_0x76a471=_0x76a471-0xa9;const _0x24c6fc=_0x24c6();let _0xcf8c98=_0x24c6fc[_0x76a471];return _0xcf8c98;}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??_0x27601c(0xf5)+_0x27601c(0xc9)+'scdn.cn/'+_0x27601c(0xdd)+_0x27601c(0x10f))['replace'](/\/$/,''),DOWNLOAD_TIMEOUT_MS=0xf*0x3c*0x3e8;async function runProcess(_0x3d5f1b,_0x4fd802,_0x2ee40b={}){const _0x4e234e=_0x27601c,{spawn:_0x3dcb52}=await import(_0x4e234e(0xe4)+_0x4e234e(0xac)+'ss'),_0x38c0df=_0x2ee40b[_0x4e234e(0x104)]||[_0x3d5f1b,..._0x4fd802]['join']('\x20'),_0x3ddb8a=_0x2ee40b[_0x4e234e(0xb1)+'s']??DOWNLOAD_TIMEOUT_MS;return await new Promise((_0x2fba92,_0x4fdc1f)=>{const _0x565689=_0x4e234e,_0x4fd93=_0x3dcb52(_0x3d5f1b,_0x4fd802,{'cwd':_0x2ee40b[_0x565689(0xce)],'env':_0x2ee40b[_0x565689(0xaa)],'stdio':[_0x565689(0xf3),_0x565689(0x107),_0x565689(0x107)]});let _0x7c602a='',_0x1f0ef0='';const _0x3c0d37=setTimeout(()=>{const _0x24a35c=_0x565689;_0x4fd93[_0x24a35c(0xf6)](_0x24a35c(0xfe)),_0x4fdc1f(new Error(_0x38c0df+(_0x24a35c(0xc1)+_0x24a35c(0xd3)+'\x20')+_0x3ddb8a+'ms'));},_0x3ddb8a);_0x4fd93[_0x565689(0xc6)]['on'](_0x565689(0xbd),_0x18f5a6=>{const _0x591828=_0x565689;_0x7c602a+=_0x18f5a6[_0x591828(0xad)]();}),_0x4fd93[_0x565689(0x106)]['on']('data',_0x73c3ae=>{const _0x4bad9d=_0x565689;_0x1f0ef0+=_0x73c3ae[_0x4bad9d(0xad)]();}),_0x4fd93['on'](_0x565689(0xde),_0xbcc332=>{clearTimeout(_0x3c0d37),_0x4fdc1f(_0xbcc332);}),_0x4fd93['on'](_0x565689(0xd7),_0x37d320=>{clearTimeout(_0x3c0d37);if(_0x37d320===0x0)_0x2fba92({'stdout':_0x7c602a,'stderr':_0x1f0ef0,'code':_0x37d320});else _0x4fdc1f(new Error(_0x38c0df+('\x20failed\x20'+'with\x20cod'+'e\x20')+_0x37d320+':\x20'+(_0x1f0ef0||_0x7c602a)));});});}async function downloadFile(_0x7ccf3b,_0x4a44fc){await mkdir(dirname(_0x4a44fc),{'recursive':!![]});const _0x1641b2=await new Promise((_0x2b71c6,_0x3d51e6)=>{const _0x10522a=_0xcf8c,_0x12c078=get(_0x7ccf3b,_0x389ea3=>{const _0x3580ed=_0xcf8c;if([0x12d,0x12e,0x12f,0x133,0x134]['includes'](_0x389ea3['statusCo'+'de']||0x0)&&_0x389ea3[_0x3580ed(0xbb)]['location']){_0x389ea3[_0x3580ed(0xe9)](),downloadFile(new URL(_0x389ea3[_0x3580ed(0xbb)][_0x3580ed(0xd9)],_0x7ccf3b)[_0x3580ed(0xaf)],_0x4a44fc)['then'](()=>_0x2b71c6(null))[_0x3580ed(0xd8)](_0x3d51e6);return;}if((_0x389ea3[_0x3580ed(0x102)+'de']||0x0)>=0x190){_0x389ea3[_0x3580ed(0xe9)](),_0x3d51e6(new Error(_0x3580ed(0xd6)+_0x3580ed(0xed)+_0x389ea3[_0x3580ed(0x102)+'de']+':\x20'+_0x7ccf3b));return;}_0x2b71c6(_0x389ea3);});_0x12c078['on'](_0x10522a(0xde),_0x3d51e6);});if(!_0x1641b2)return;await pipeline(_0x1641b2,createWriteStream(_0x4a44fc));}async function findRuntimeKdocsCliBin(_0x52da33){const _0x4f7cf5=_0x27601c,_0x3d7976=join(_0x52da33['openclaw'+_0x4f7cf5(0xdf)+'ir'],_0x4f7cf5(0xdc),_0x4f7cf5(0xb8)+'i'),_0x47d914=join(_0x3d7976,process['platform']===_0x4f7cf5(0xcc)?_0x4f7cf5(0xb8)+_0x4f7cf5(0xc5):_0x4f7cf5(0xb8)+'i');return{'installDir':_0x3d7976,'binPath':existsSync(_0x47d914)?_0x47d914:null};}export async function resolveRuntimeKdocsCliCommand(_0x14110b){const _0x34da02=_0x27601c,{installDir:_0x5b9cba,binPath:_0x592cdf}=await findRuntimeKdocsCliBin(_0x14110b);if(!_0x592cdf||!existsSync(_0x592cdf))throw new Error(_0x34da02(0xe0)+_0x34da02(0xb8)+_0x34da02(0xca)+_0x34da02(0x108)+_0x34da02(0xf4)+'aw\x20runti'+'me:\x20'+_0x5b9cba+(_0x34da02(0xb6)+_0x34da02(0xb7)+_0x34da02(0x101)+_0x34da02(0x10b)+_0x34da02(0xba)+'he\x20runti'+_0x34da02(0xd4)));return{'executablePath':_0x592cdf,'installDir':_0x5b9cba};}function toKdocsCliPlatform(_0xd1cf26){const _0xea774c=_0x27601c;if(_0xd1cf26===_0xea774c(0xcc))return _0xea774c(0xe3);return _0xd1cf26;}function toKdocsCliArch(_0x266b3c){const _0x3202c2=_0x27601c;if(_0x266b3c===_0x3202c2(0xd2))return _0x3202c2(0xae);return _0x266b3c;}async function resolveKdocsSkillVersion(_0x373d63){const _0x549a93=_0x27601c,_0x405c5f=_0x373d63[_0x549a93(0xfb)]['skillsDi'+'r'],_0x1655bf=existsSync(_0x405c5f)?(await readdir(_0x405c5f,{'withFileTypes':!![]}))[_0x549a93(0xb0)](_0x439e9d=>_0x439e9d[_0x549a93(0xbc)+_0x549a93(0x10c)]())[_0x549a93(0xf2)](_0x17374a=>join(_0x405c5f,_0x17374a[_0x549a93(0xda)],_0x549a93(0xc2))):[];for(const _0x1dbe52 of _0x1655bf){if(!existsSync(_0x1dbe52))continue;const _0x22a5bc=await readFile(_0x1dbe52,_0x549a93(0xe1));if(!/^name:\s*kdocs\s*$/m['test'](_0x22a5bc))continue;const _0x125c49=_0x22a5bc[_0x549a93(0xee)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x125c49?.[0x1])return _0x125c49[0x1];}throw new Error(_0x549a93(0x10d)+_0x549a93(0xb5)+_0x549a93(0xf8)+_0x549a93(0xf7)+_0x549a93(0x103)+_0x549a93(0xe5)+_0x405c5f);}function findFileByName(_0x2298e4,_0x341b55){const _0x230472=_0x27601c;if(!existsSync(_0x2298e4))return null;for(const _0x4f8f29 of readdirSync(_0x2298e4,{'withFileTypes':!![]})){const _0x283430=join(_0x2298e4,_0x4f8f29[_0x230472(0xda)]);if(_0x4f8f29[_0x230472(0xbc)+_0x230472(0x10c)]()){const _0x395217=findFileByName(_0x283430,_0x341b55);if(_0x395217)return _0x395217;continue;}if(_0x4f8f29[_0x230472(0xb2)]()&&_0x4f8f29[_0x230472(0xda)]===_0x341b55)return _0x283430;}return null;}export async function installKdocsCliBinary(_0x46828b,_0x935845,_0xfba7e4={}){const _0x464590=_0x27601c,_0xc069ce=await resolveKdocsSkillVersion(_0x46828b),_0x43bff4=toKdocsCliPlatform(process[_0x464590(0xe6)]),_0x21b1d0=toKdocsCliArch(process[_0x464590(0xcb)]),_0x278c37=process[_0x464590(0xe6)]===_0x464590(0xcc)?_0x464590(0xb8)+_0x464590(0xc5):_0x464590(0xb8)+'i',_0x35454b=join(_0x935845[_0x464590(0xfb)+_0x464590(0xdf)+'ir'],_0x464590(0xdc),_0x464590(0xb8)+'i'),_0xc435e5=join(_0x35454b,_0x278c37);if(existsSync(_0xc435e5))try{const _0x6837a7=(await runProcess(_0xc435e5,[_0x464590(0xab)],{'label':_0x464590(0xb8)+_0x464590(0xd1)+'n','timeoutMs':0x7530}))[_0x464590(0xc6)]['trim']();if(_0x6837a7===_0xc069ce){_0xfba7e4[_0x464590(0xe7)+_0x464590(0xf1)]?.[_0x464590(0xfd)]('kdocs-cl'+_0x464590(0xbf)+'y\x20instal'+_0x464590(0xff),{'version':_0xc069ce,'installDir':_0x35454b});return;}}catch{}const _0x5220ba=_0x43bff4==='windows'?_0x464590(0x100):_0x464590(0xc4),_0x3e76df=_0x464590(0xb8)+'i-'+_0xc069ce+'-'+_0x43bff4+'-'+_0x21b1d0+_0x5220ba,_0x3e4523=join(_0x935845[_0x464590(0xf9)+_0x464590(0x10a)],_0x464590(0x109)),_0x5145b9=join(_0x3e4523,_0x3e76df),_0x58cfcc=join(_0x935845[_0x464590(0xf9)+_0x464590(0x10a)],_0x464590(0x105)+_0x464590(0xef)+_0x464590(0xec)+process[_0x464590(0xfa)]+'-'+Date[_0x464590(0xb4)]()),_0xec2dbc=KDOCS_CLI_CDN_BASE+'/v'+_0xc069ce+(_0x464590(0xcd)+'s/')+_0x3e76df;await mkdir(_0x3e4523,{'recursive':!![]});!existsSync(_0x5145b9)&&(console[_0x464590(0xdb)]('[wujie-s'+'hell:run'+_0x464590(0xc8)+'wnloadin'+'g\x20'+_0xec2dbc),await downloadFile(_0xec2dbc,_0x5145b9));await rm(_0x58cfcc,{'recursive':!![],'force':!![]}),await mkdir(_0x58cfcc,{'recursive':!![]});_0x5145b9['endsWith']('.zip')?await runProcess('unzip',['-q',_0x5145b9,'-d',_0x58cfcc],{'label':_0x464590(0xc0)+_0x3e76df}):await runProcess(_0x464590(0xe8),[_0x464590(0xb9),_0x5145b9,'-C',_0x58cfcc],{'label':_0x464590(0xc0)+_0x3e76df});const _0x5565c7=findFileByName(_0x58cfcc,_0x278c37);if(!_0x5565c7)throw new Error('kdocs-cl'+_0x464590(0xeb)+_0x464590(0xd0)+'nd\x20in\x20ar'+'chive:\x20'+_0x3e76df);await rm(_0x35454b,{'recursive':!![],'force':!![]}),await mkdir(_0x35454b,{'recursive':!![]}),await cp(_0x5565c7,_0xc435e5);if(process[_0x464590(0xe6)]!==_0x464590(0xcc))await chmod(_0xc435e5,0x1ed);await writeFile(join(_0x35454b,_0x464590(0xa9)),_0x464590(0xb3)+_0x464590(0xd5)+_0x464590(0xe2),_0x464590(0xe1)),await rm(_0x58cfcc,{'recursive':!![],'force':!![]}),_0xfba7e4[_0x464590(0xe7)+_0x464590(0xf1)]?.[_0x464590(0xfd)]('kdocs-cl'+'i\x20instal'+'led',{'version':_0xc069ce,'installDir':_0x35454b,'binPath':_0xc435e5});}
|
|
1
|
+
const _0xc2139b=_0x3fcc;(function(_0x1fe35a,_0x525990){const _0x24eb8a=_0x3fcc,_0x3852cc=_0x1fe35a();while(!![]){try{const _0x101422=-parseInt(_0x24eb8a(0x151))/0x1+-parseInt(_0x24eb8a(0x132))/0x2+-parseInt(_0x24eb8a(0x14b))/0x3+parseInt(_0x24eb8a(0x14c))/0x4+parseInt(_0x24eb8a(0x126))/0x5+parseInt(_0x24eb8a(0x16e))/0x6+parseInt(_0x24eb8a(0x129))/0x7*(parseInt(_0x24eb8a(0x182))/0x8);if(_0x101422===_0x525990)break;else _0x3852cc['push'](_0x3852cc['shift']());}catch(_0x2deb76){_0x3852cc['push'](_0x3852cc['shift']());}}}(_0x4b60,0xcf74b));import{existsSync,readdirSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';function _0x4b60(){const _0x2e621a=['ime\x0a','.source','win32','sing\x20fro','.kdocs-c','ld_proce','amd64','arch','i.exe','-xzf','skillhub','timeoutM','tar','led','stdout','with\x20cod','log','time]\x20do','cwd','10176ILHXAW','LocalSki','platform','endsWith','\x20failed\x20','ogger','trim','aw\x20runti','kill','then','[wujie-s','ebuild\x20t','\x20not\x20fou','.cache','6795630QaWqqd','toString','join','9198noOivg','SKILL.md','extract\x20','Bundled\x20','pid','.zip','location','runtimeL','close','764040hvnvhB','/release','li-extra','wujie-sh','pipe','ujie-she','download','.tar.gz','stderr','catch','x64','ct-','llPaths','data','oot','resume','i\x20instal','statusCo','runtimeR','filter','Unable\x20t','chive:\x20','e\x20kdocs\x20','i\x20alread','ell-runt','1601562NNMZhj','1070900VHuagZ','wpsai.wp','error','push','map','1626620unRycn','tools','m\x20OpenCl','version','headers','kdocs-cl','match','info','isFile','openclaw','re\x22\x20to\x20r','wnloadin','windows','now','i\x20binary','SIGTERM','replace','node:chi','nd\x20in\x20ar','ory','om\x20','name','me:\x20','/pro','rsion\x20fr','ll\x20prepa','test','utf8','i\x20is\x20mis','563844tmOkxh'];_0x4b60=function(){return _0x2e621a;};return _0x4b60();}import{dirname,join}from'node:path';function _0x3fcc(_0x14ace5,_0x4ac806){_0x14ace5=_0x14ace5-0x11e;const _0x4b60cb=_0x4b60();let _0x3fcce5=_0x4b60cb[_0x14ace5];return _0x3fcce5;}import{get}from'node:https';import{pipeline}from'node:stream/promises';const KDOCS_CLI_CDN_BASE=(process.env.KDOCS_CLI_CDN??'https://'+_0xc2139b(0x14d)+'scdn.cn/'+_0xc2139b(0x179)+_0xc2139b(0x168))[_0xc2139b(0x161)](/\/$/,''),DOWNLOAD_TIMEOUT_MS=0xf*0x3c*0x3e8;async function runProcess(_0x5023eb,_0x139bd1,_0x1c0d02={}){const _0x108982=_0xc2139b,{spawn:_0xdbe798}=await import(_0x108982(0x162)+_0x108982(0x174)+'ss'),_0x2485d8=_0x1c0d02['label']||[_0x5023eb,..._0x139bd1]['join']('\x20'),_0x123776=_0x1c0d02[_0x108982(0x17a)+'s']??DOWNLOAD_TIMEOUT_MS;return await new Promise((_0x5cbfba,_0x3090f4)=>{const _0x2bfc40=_0x108982,_0x38dabe=_0xdbe798(_0x5023eb,_0x139bd1,{'cwd':_0x1c0d02[_0x2bfc40(0x181)],'env':_0x1c0d02['env'],'stdio':['ignore',_0x2bfc40(0x136),'pipe']});let _0x3b86f7='',_0x1cebd7='';const _0x47fb81=setTimeout(()=>{const _0x208d7a=_0x2bfc40;_0x38dabe[_0x208d7a(0x120)](_0x208d7a(0x160)),_0x3090f4(new Error(_0x2485d8+('\x20timed\x20o'+'ut\x20after'+'\x20')+_0x123776+'ms'));},_0x123776);_0x38dabe[_0x2bfc40(0x17d)]['on']('data',_0x51fe3f=>{const _0x17475c=_0x2bfc40;_0x3b86f7+=_0x51fe3f[_0x17475c(0x127)]();}),_0x38dabe[_0x2bfc40(0x13a)]['on'](_0x2bfc40(0x13f),_0x437a75=>{_0x1cebd7+=_0x437a75['toString']();}),_0x38dabe['on'](_0x2bfc40(0x14e),_0x32bf02=>{clearTimeout(_0x47fb81),_0x3090f4(_0x32bf02);}),_0x38dabe['on'](_0x2bfc40(0x131),_0x105b79=>{const _0x1e265e=_0x2bfc40;clearTimeout(_0x47fb81);if(_0x105b79===0x0)_0x5cbfba({'stdout':_0x3b86f7,'stderr':_0x1cebd7,'code':_0x105b79});else _0x3090f4(new Error(_0x2485d8+(_0x1e265e(0x186)+_0x1e265e(0x17e)+'e\x20')+_0x105b79+':\x20'+(_0x1cebd7||_0x3b86f7)));});});}async function downloadFile(_0xebfdfc,_0x5e3e9e){await mkdir(dirname(_0x5e3e9e),{'recursive':!![]});const _0x2f32cf=await new Promise((_0x384e63,_0x3513a2)=>{const _0x4301ef=_0x3fcc,_0x29b382=get(_0xebfdfc,_0x3fb8a2=>{const _0xe0d08d=_0x3fcc;if([0x12d,0x12e,0x12f,0x133,0x134]['includes'](_0x3fb8a2[_0xe0d08d(0x143)+'de']||0x0)&&_0x3fb8a2[_0xe0d08d(0x155)][_0xe0d08d(0x12f)]){_0x3fb8a2[_0xe0d08d(0x141)](),downloadFile(new URL(_0x3fb8a2['headers'][_0xe0d08d(0x12f)],_0xebfdfc)['href'],_0x5e3e9e)[_0xe0d08d(0x121)](()=>_0x384e63(null))[_0xe0d08d(0x13b)](_0x3513a2);return;}if((_0x3fb8a2['statusCo'+'de']||0x0)>=0x190){_0x3fb8a2[_0xe0d08d(0x141)](),_0x3513a2(new Error(_0xe0d08d(0x138)+_0xe0d08d(0x186)+_0x3fb8a2[_0xe0d08d(0x143)+'de']+':\x20'+_0xebfdfc));return;}_0x384e63(_0x3fb8a2);});_0x29b382['on'](_0x4301ef(0x14e),_0x3513a2);});if(!_0x2f32cf)return;await pipeline(_0x2f32cf,createWriteStream(_0x5e3e9e));}async function findRuntimeKdocsCliBin(_0x57f674){const _0x596897=_0xc2139b,_0x110c4e=join(_0x57f674[_0x596897(0x15a)+'WorkingD'+'ir'],_0x596897(0x152),_0x596897(0x156)+'i'),_0x34aa08=join(_0x110c4e,process[_0x596897(0x184)]==='win32'?_0x596897(0x156)+_0x596897(0x177):'kdocs-cl'+'i');return{'installDir':_0x110c4e,'binPath':existsSync(_0x34aa08)?_0x34aa08:null};}export async function resolveRuntimeKdocsCliCommand(_0x3d433d){const _0x5d73e2=_0xc2139b,{installDir:_0x506cdd,binPath:_0x3cb49e}=await findRuntimeKdocsCliBin(_0x3d433d);if(!_0x3cb49e||!existsSync(_0x3cb49e))throw new Error(_0x5d73e2(0x12c)+_0x5d73e2(0x156)+_0x5d73e2(0x16d)+_0x5d73e2(0x172)+_0x5d73e2(0x153)+_0x5d73e2(0x11f)+_0x5d73e2(0x167)+_0x506cdd+('.\x20Run\x20\x22w'+_0x5d73e2(0x137)+_0x5d73e2(0x16a)+_0x5d73e2(0x15b)+_0x5d73e2(0x123)+'he\x20runti'+'me.'));return{'executablePath':_0x3cb49e,'installDir':_0x506cdd};}function toKdocsCliPlatform(_0x44719e){const _0x5aad17=_0xc2139b;if(_0x44719e===_0x5aad17(0x171))return _0x5aad17(0x15d);return _0x44719e;}function toKdocsCliArch(_0x2f8f9d){const _0x311902=_0xc2139b;if(_0x2f8f9d===_0x311902(0x13c))return _0x311902(0x175);return _0x2f8f9d;}async function resolveKdocsSkillVersion(_0x4064a5){const _0x9af194=_0xc2139b,_0x1c3162=_0x4064a5[_0x9af194(0x15a)]['resolved'+_0x9af194(0x183)+_0x9af194(0x13e)]??[],_0x3e275b=[];for(const _0x529a3b of _0x1c3162){if(!existsSync(_0x529a3b))continue;_0x3e275b[_0x9af194(0x14f)](join(_0x529a3b,_0x9af194(0x12a))),_0x3e275b[_0x9af194(0x14f)](...(await readdir(_0x529a3b,{'withFileTypes':!![]}))[_0x9af194(0x145)](_0xabd786=>_0xabd786['isDirect'+_0x9af194(0x164)]())[_0x9af194(0x150)](_0x20ec3f=>join(_0x529a3b,_0x20ec3f[_0x9af194(0x166)],_0x9af194(0x12a))));}for(const _0x15ff5a of _0x3e275b){if(!existsSync(_0x15ff5a))continue;const _0x720377=await readFile(_0x15ff5a,_0x9af194(0x16c));if(!/^name:\s*kdocs\s*$/m[_0x9af194(0x16b)](_0x720377))continue;const _0x27d47b=_0x720377[_0x9af194(0x157)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x27d47b?.[0x1])return _0x27d47b[0x1];}throw new Error(_0x9af194(0x146)+'o\x20resolv'+_0x9af194(0x148)+'skill\x20ve'+_0x9af194(0x169)+_0x9af194(0x165)+_0x1c3162[_0x9af194(0x128)](',\x20'));}export const __test__={'resolveKdocsSkillVersion':resolveKdocsSkillVersion};function findFileByName(_0x19d761,_0x1d8f76){const _0x329550=_0xc2139b;if(!existsSync(_0x19d761))return null;for(const _0x482e57 of readdirSync(_0x19d761,{'withFileTypes':!![]})){const _0x124aea=join(_0x19d761,_0x482e57['name']);if(_0x482e57['isDirect'+_0x329550(0x164)]()){const _0xb90095=findFileByName(_0x124aea,_0x1d8f76);if(_0xb90095)return _0xb90095;continue;}if(_0x482e57[_0x329550(0x159)]()&&_0x482e57[_0x329550(0x166)]===_0x1d8f76)return _0x124aea;}return null;}export async function installKdocsCliBinary(_0x5a9c31,_0x30289a,_0x3900f7={}){const _0x4afd7e=_0xc2139b,_0x56b148=await resolveKdocsSkillVersion(_0x5a9c31),_0x991ef5=toKdocsCliPlatform(process['platform']),_0x613d13=toKdocsCliArch(process[_0x4afd7e(0x176)]),_0x58df48=process[_0x4afd7e(0x184)]===_0x4afd7e(0x171)?_0x4afd7e(0x156)+_0x4afd7e(0x177):_0x4afd7e(0x156)+'i',_0x109e3e=join(_0x30289a[_0x4afd7e(0x15a)+'WorkingD'+'ir'],_0x4afd7e(0x152),'kdocs-cl'+'i'),_0x301d16=join(_0x109e3e,_0x58df48);if(existsSync(_0x301d16))try{const _0x5b9779=(await runProcess(_0x301d16,[_0x4afd7e(0x154)],{'label':'kdocs-cl'+'i\x20versio'+'n','timeoutMs':0x7530}))[_0x4afd7e(0x17d)][_0x4afd7e(0x11e)]();if(_0x5b9779===_0x56b148){_0x3900f7['runtimeL'+_0x4afd7e(0x187)]?.[_0x4afd7e(0x158)]('kdocs-cl'+_0x4afd7e(0x149)+'y\x20instal'+_0x4afd7e(0x17c),{'version':_0x56b148,'installDir':_0x109e3e});return;}}catch{}const _0x4b5b1a=_0x991ef5===_0x4afd7e(0x15d)?_0x4afd7e(0x12e):_0x4afd7e(0x139),_0x3ac0e8=_0x4afd7e(0x156)+'i-'+_0x56b148+'-'+_0x991ef5+'-'+_0x613d13+_0x4b5b1a,_0x2de17e=join(_0x30289a[_0x4afd7e(0x144)+'oot'],_0x4afd7e(0x125)),_0x51375d=join(_0x2de17e,_0x3ac0e8),_0x497c99=join(_0x30289a[_0x4afd7e(0x144)+_0x4afd7e(0x140)],_0x4afd7e(0x173)+_0x4afd7e(0x134)+_0x4afd7e(0x13d)+process[_0x4afd7e(0x12d)]+'-'+Date[_0x4afd7e(0x15e)]()),_0x2300f0=KDOCS_CLI_CDN_BASE+'/v'+_0x56b148+(_0x4afd7e(0x133)+'s/')+_0x3ac0e8;await mkdir(_0x2de17e,{'recursive':!![]});!existsSync(_0x51375d)&&(console[_0x4afd7e(0x17f)](_0x4afd7e(0x122)+'hell:run'+_0x4afd7e(0x180)+_0x4afd7e(0x15c)+'g\x20'+_0x2300f0),await downloadFile(_0x2300f0,_0x51375d));await rm(_0x497c99,{'recursive':!![],'force':!![]}),await mkdir(_0x497c99,{'recursive':!![]});_0x51375d[_0x4afd7e(0x185)]('.zip')?await runProcess('unzip',['-q',_0x51375d,'-d',_0x497c99],{'label':_0x4afd7e(0x12b)+_0x3ac0e8}):await runProcess(_0x4afd7e(0x17b),[_0x4afd7e(0x178),_0x51375d,'-C',_0x497c99],{'label':'extract\x20'+_0x3ac0e8});const _0x1e3ab2=findFileByName(_0x497c99,_0x58df48);if(!_0x1e3ab2)throw new Error(_0x4afd7e(0x156)+_0x4afd7e(0x15f)+_0x4afd7e(0x124)+_0x4afd7e(0x163)+_0x4afd7e(0x147)+_0x3ac0e8);await rm(_0x109e3e,{'recursive':!![],'force':!![]}),await mkdir(_0x109e3e,{'recursive':!![]}),await cp(_0x1e3ab2,_0x301d16);if(process[_0x4afd7e(0x184)]!==_0x4afd7e(0x171))await chmod(_0x301d16,0x1ed);await writeFile(join(_0x109e3e,_0x4afd7e(0x170)),_0x4afd7e(0x135)+_0x4afd7e(0x14a)+_0x4afd7e(0x16f),_0x4afd7e(0x16c)),await rm(_0x497c99,{'recursive':!![],'force':!![]}),_0x3900f7[_0x4afd7e(0x130)+_0x4afd7e(0x187)]?.[_0x4afd7e(0x158)]('kdocs-cl'+_0x4afd7e(0x142)+_0x4afd7e(0x17c),{'version':_0x56b148,'installDir':_0x109e3e,'binPath':_0x301d16});}
|