limixbot 0.3.114 → 0.3.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActivityPanel-DiLMgzph.js → ActivityPanel-BKVVoPVs.js} +1 -1
- package/dist/assets/{App-Ddh_DeKL.js → App-Bs3xsnrc.js} +8 -8
- package/dist/assets/{AppEventEditor-DxveH-cr.js → AppEventEditor-OAf9a0tt.js} +1 -1
- package/dist/assets/{BotSettingsDialog-DMl_BpJ5.js → BotSettingsDialog-BjXot86a.js} +1 -1
- package/dist/assets/{BrowserPanel-epB3EK-g.js → BrowserPanel-hL-eDB2c.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-BCHI-qVi.js → BrowserProfilesManager-C6T0zWzY.js} +1 -1
- package/dist/assets/{CloudAddDialog-C6MFVLlA.js → CloudAddDialog-DRM9yXbC.js} +1 -1
- package/dist/assets/{ComputerFilesPane--Bw2H6YF.js → ComputerFilesPane-BNu7R0f8.js} +1 -1
- package/dist/assets/{ComputerPanel-C4Q3wifa.js → ComputerPanel-DxKmRVYu.js} +2 -2
- package/dist/assets/{DataPanel-D6IvdVhd.js → DataPanel-DfN9iz0h.js} +1 -1
- package/dist/assets/{GrokMoveDialog-0QYeBKvp.js → GrokMoveDialog-BjiqGVnQ.js} +1 -1
- package/dist/assets/{InspectorPanel-DUqPg7KZ.js → InspectorPanel-DwuollBI.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-BaPZ9Yfj.js → KeyboardShortcutsModal-Cqyls2vU.js} +1 -1
- package/dist/assets/{LimixResizeHandles-Cgoym0Xl.js → LimixResizeHandles-Cdd3ZWsF.js} +1 -1
- package/dist/assets/{LiveDesktop-BGy8nqFB.js → LiveDesktop-BqYFy0dM.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-BUhMJYrY.js → LocalVmWorkspace-fc7eYhrx.js} +1 -1
- package/dist/assets/{MacLocalControl-DDgUk1AE.js → MacLocalControl-DZ-mA_P5.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-0simEJp-.js → MarkdownFilePreview-Db67LyUo.js} +1 -1
- package/dist/assets/{NewBotDialog-DHQujvPN.js → NewBotDialog-1eCNcdXB.js} +1 -1
- package/dist/assets/{PhoneAppDialog-Cq-1ZBsB.js → PhoneAppDialog-FAjmm1JH.js} +1 -1
- package/dist/assets/{PluginsPanel-D0mOM94r.js → PluginsPanel-Ch6zuNsG.js} +1 -1
- package/dist/assets/{ProIntroduction-CutUiKNu.js → ProIntroduction-B2GdPHit.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-DZzqIhvL.js → RemoteAgentSettingsPanel-LNFAibT2.js} +1 -1
- package/dist/assets/{RoomPanel-DVkmk2hl.js → RoomPanel-Cx3DTlAR.js} +1 -1
- package/dist/assets/{RoutinesPage-C3w9qdbF.js → RoutinesPage-Cxwi6eIR.js} +1 -1
- package/dist/assets/SettingsModal-Dyw-u2wY.js +19 -0
- package/dist/assets/{ShareTeamDialog-CIvnf9Ql.js → ShareTeamDialog-DCdKihAm.js} +1 -1
- package/dist/assets/{SignedInSites-BE6eaSJq.js → SignedInSites-DH7N9tUA.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-BIcy8Iyf.js → TeamLibraryPanel-CbQaWAWx.js} +1 -1
- package/dist/assets/{TeamMapPage-DnXg1zmn.js → TeamMapPage-DoYg4ueL.js} +1 -1
- package/dist/assets/{TriggersPage-D9sr9f5M.js → TriggersPage-CtDhsC18.js} +1 -1
- package/dist/assets/{VisibilitySection-j0PdMnH3.js → VisibilitySection-DmAqf_a9.js} +1 -1
- package/dist/assets/{WebhookTrigger-ByvIgnn0.js → WebhookTrigger-DIkM9UMJ.js} +1 -1
- package/dist/assets/{WorksOnGrid-D__HSyhm.js → WorksOnGrid-BXPjyVfb.js} +1 -1
- package/dist/assets/{core-DnKXzdi1.js → core-CLmWJmRN.js} +1 -1
- package/dist/assets/{import-name-DEPg2ht3.js → import-name-CuQ-o1MN.js} +1 -1
- package/dist/assets/{index-B48L2b4D.js → index-B4GUPRYB.js} +1 -1
- package/dist/assets/{index-BIFgmFd6.js → index-CLQ_hYWY.js} +2 -2
- package/dist/assets/{mcp-servers-CIoA0Z8X.js → mcp-servers-CE2IPhL7.js} +1 -1
- package/dist/assets/{new-bot-DB8EcyfW.js → new-bot-biSOJm6z.js} +1 -1
- package/dist/assets/{org-library-C-mDWISC.js → org-library-4LsB5uzZ.js} +1 -1
- package/dist/assets/{package-format-CYXsEP2B.js → package-format-CBEJWXeV.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BTKO8ICQ.js → remote-desktop-panel-BUZzS8Qz.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/index.js +26 -25
- package/dist-server/package.json +1 -1
- package/dist-server/server/bot-channels/zalo-media.js +4 -4
- package/dist-server/server/limix-skill-hub.js +27 -3
- package/package.json +1 -1
- package/dist/assets/SettingsModal-Dokjrp1d.js +0 -19
package/dist-server/index.js
CHANGED
|
@@ -18847,9 +18847,9 @@ chat.type==="private",raw=typeof message8.text=="string"?message8.text:typeof me
|
|
|
18847
18847
|
direct,from:{id:String(from.id),name:[from.first_name,from.last_name].filter(Boolean).join(" ")||from.username||String(from.id)},text:raw.replace(mention,"").trim(),...file2?{media:!0}:{},...typeof file2?.file_id=="string"?{loadMedia:async()=>{let signal=AbortSignal.any([io2.signal,AbortSignal.timeout(3e4)]),path8=(await api(token3,"getFile",{file_id:file2.file_id},signal))?.file_path;if(typeof path8!="string"||!path8.split("/").every(part2=>/^[\w.-]+$/.test(part2)&&part2!=="."&&part2!==".."))throw Error(
|
|
18848
18848
|
"Attachment unavailable");let response=await call2(`${base2}/file/bot${token3}/${path8}`,{signal,redirect:"error"});return storeChannelMedia(await readChannelDownload(response),file2.file_name??path8.split("/").at(-1))}}:{}}};return{done:(async()=>{let offset4=io2.offset;for(;!io2.signal.aborted;){let updates=await api(token3,"getUpdates",{offset:offset4,timeout:POLL_S,allowed_updates:["message"]},io2.signal).catch(error66=>{if(io2.signal.aborted)return[];throw error66});if(io2.healthy(),!(!Array.
|
|
18849
18849
|
isArray(updates)||!updates.length)){offset4=Math.max(...updates.map(update4=>Number(update4?.update_id)||0))+1;for(let update4 of updates){let message8=toMessage(update4?.message);message8&&io2.deliver(message8)}io2.saveOffset(offset4)}}})(),send:async(chatId,text33)=>{await api(token3,"sendMessage",{chat_id:Number(chatId),text:text33})},sendMedia:async(chatId,attachment)=>{let file2=await readChannelMedia(attachment),image4=attachment.kind==="image"&&attachment.mime!=="image/webp",form2=new FormData;
|
|
18850
|
-
form2.set("chat_id",chatId),form2.set(image4?"photo":"document",channelFileBlob(file2),file2.filename),await api(token3,image4?"sendPhoto":"sendDocument",form2,AbortSignal.timeout(6e4))},typing:async chatId=>{await api(token3,"sendChatAction",{chat_id:Number(chatId),action:"typing"})}}}}}init_provider_icon();import{Readable as Readable2}from"node:stream";var
|
|
18851
|
-
1,timeoutMs:3e4,maxRedirects:0});if(!page.ok||!page.body.length||page.body.length>limit2)throw Error("Zalo media unavailable");if(photo){let mime=["image/jpeg","image/png","image/webp"].find(type4=>imageDimensions(page.body,type4));if(!mime)throw Error("Unsupported image");let{path:path8}=saveImage(page.body,mime);return{kind:"image",path:path8,mime}}if(page.body.toString("ascii",4,8)!=="ftyp")throw Error("Unsupported video");let file2=await saveFile(Readable2.from([page.body]),
|
|
18852
|
-
|
|
18850
|
+
form2.set("chat_id",chatId),form2.set(image4?"photo":"document",channelFileBlob(file2),file2.filename),await api(token3,image4?"sendPhoto":"sendDocument",form2,AbortSignal.timeout(6e4))},typing:async chatId=>{await api(token3,"sendChatAction",{chat_id:Number(chatId),action:"typing"})}}}}}init_provider_icon();import{Readable as Readable2}from"node:stream";var ZALO_FILE_LIMIT=32*1024*1024,ZALO_CDN=["zaloapp.com","zalo.me","zdn.vn","zadn.vn","zalo.vn"];function receiveZaloFile(url3,name6){return fetchChannelMedia(url3,ZALO_CDN,name6,ZALO_FILE_LIMIT)}async function receiveZaloMedia(url3,photo){let limit2=photo?IMAGE_MAX_BYTES:ZALO_FILE_LIMIT,target4=new URL(url3);if(target4.protocol!=="https:"||!/(^|\.)(zaloapp\.com|zalo\.me|zdn\.vn|zadn\.vn|zalo\.vn)$/.test(target4.hostname))throw Error("Unsupported Zalo media address");let page=await fetchPublicPage(
|
|
18851
|
+
url3,{maxBytes:limit2+1,timeoutMs:3e4,maxRedirects:0});if(!page.ok||!page.body.length||page.body.length>limit2)throw Error("Zalo media unavailable");if(photo){let mime=["image/jpeg","image/png","image/webp"].find(type4=>imageDimensions(page.body,type4));if(!mime)throw Error("Unsupported image");let{path:path8}=saveImage(page.body,mime);return{kind:"image",path:path8,mime}}if(page.body.toString("ascii",4,8)!=="ftyp")throw Error("Unsupported video");let file2=await saveFile(Readable2.from([page.body]),
|
|
18852
|
+
"video.mp4","video/mp4",{expectedBytes:page.body.length});return{kind:"file",path:file2.path,name:file2.name,mime:file2.mime}}async function zaloUpload(file2){let{data:data4,filename}=await readChannelMedia(file2,file2.kind==="image"?IMAGE_MAX_BYTES:ZALO_FILE_LIMIT),dimensions=file2.kind==="image"?imageDimensions(data4,file2.mime):void 0;if(file2.kind==="image"&&!dimensions)throw Error("Unsupported image");return{data:data4,filename,metadata:{...dimensions,totalSize:data4.length}}}var USER=0,GROUP=1,loadZcaJs=async()=>{let{Zalo:Zalo2}=await Promise.resolve().then(()=>(init_dist(),dist_exports2));return new Zalo2({selfListen:!1,checkUpdate:!1,logging:!1})},thread=chatId=>({type:chatId.startsWith("g:")?GROUP:USER,id:chatId.slice(2)});function zaloAdapter(load9=loadZcaJs){async function signIn2(secret){let credentials;try{credentials=JSON.parse(secret)}catch{throw new ChannelError("auth","Phi\xEAn Zalo h\u1ECFng. Qu\xE9t m\xE3 QR l\u1EA1i.")}return(await load9()).login(credentials).
|
|
18853
18853
|
catch(error66=>{throw new ChannelError("auth",`Phi\xEAn Zalo \u0111\xE3 h\u1EBFt h\u1EA1n ho\u1EB7c b\u1ECB \u0111\u0103ng xu\u1EA5t. Qu\xE9t m\xE3 QR l\u1EA1i. (${error66 instanceof Error?error66.message:String(error66)})`)})}async function account2(api){let info2=await api.fetchAccountInfo().catch(()=>null),name6=info2?.profile?.displayName??info2?.profile?.zaloName??"";return{username:api.getOwnId(),name:name6}}return{kind:"zalo",label:"Zalo",textMax:2e3,quietToStrangers:!0,paceMs:[400,1200],
|
|
18854
18854
|
async check(secret){return account2(await signIn2(secret))},async open(secret,io2){let api=await signIn2(secret),self2=api.getOwnId();return{done:new Promise((resolve59,reject)=>{let stop2=()=>{try{api.listener.stop()}catch{}};io2.signal.addEventListener("abort",()=>{stop2(),resolve59()},{once:!0}),api.listener.on("connected",()=>io2.healthy()),api.listener.on("error",()=>{}),api.listener.on("closed",code=>{if(io2.signal.aborted)return resolve59();if(code===3e3||code===3003)return reject(new ChannelError(
|
|
18855
18855
|
"auth","T\xE0i kho\u1EA3n Zalo c\u1EE7a bot v\u1EEBa m\u1EDF \u1EDF n\u01A1i kh\xE1c (Zalo Web ho\u1EB7c m\xE1y kh\xE1c) n\xEAn bot \u0111\xE3 d\u1EEBng. \u0110\xF3ng n\u01A1i \u0111\xF3 r\u1ED3i t\u1EAFt v\xE0 b\u1EADt l\u1EA1i Zalo \u1EDF \u0111\xE2y."));reject(new ChannelError("retry",`Zalo ng\u1EAFt k\u1EBFt n\u1ED1i (${code}).`))}),api.listener.on("message",event2=>{if(event2.isSelf||String(event2.data.uidFrom)===self2||event2.type!==USER&&event2.type!==GROUP)return;let direct=event2.type===
|
|
@@ -31935,28 +31935,29 @@ out={}
|
|
|
31935
31935
|
for n in sys.argv[1:]:
|
|
31936
31936
|
try: out[n]=m.version(n)
|
|
31937
31937
|
except m.PackageNotFoundError: pass
|
|
31938
|
-
print(json.dumps(out))`,{stdout}=await run10(python,["-c",code,...names5],{timeout:1e4,windowsHide:!0,maxBuffer:1024*1024}),versions=JSON.parse(stdout);for(let row of pythonRows)row.version=versions[row.name],row.where=python,row.status=row.version?row.required?"review":"found":"missing"}catch{warnings.push("Could not inspect Python package metadata")}return{scope:"host",scannedAt:new Date().toISOString(),skillCount:sources2.size,requirements,warnings}}async function fetchHubFile(root3,area5,id12,path8,fetcher){let first2=area5==="quarantine"?"quarantine":"skills",response=await fetcher(`${root3}/${first2}/${id12}/${path8}`);return response.status!==404?response:fetcher(`${root3}/${first2==="skills"?"quarantine":"skills"}/${id12}/${path8}`)}import{createHash as createHash120}from"node:crypto";import{existsSync as existsSync102,mkdirSync as mkdirSync124,readFileSync as readFileSync190}from"node:fs";import{join as join266}from"node:path";init_atomic();init_config3();var HUB_REPO="leomieo/limix-skill-hub",HUB_BRANCH="main",SYNC_MIN_GAP_MS=1200*60*1e3,
|
|
31939
|
-
...readJson7(settingsFile(),{})}}function saveSettings(next){mkdirSync124(hubDir(),{recursive:!0,mode:448}),writeFileAtomic(settingsFile(),JSON.stringify(next,null,2),{mode:384})}function hubCatalog(){let body3=readJson7(catalogFile(),{});return Array.isArray(body3.skills)?body3.skills:[]}var rawUrl=path8=>`https://raw.githubusercontent.com/${HUB_REPO}/${HUB_BRANCH}/${path8}`;async function fetchText2(url3,headers={}){return fetch(url3,{signal:AbortSignal.timeout(3e4),headers:{
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
{
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31951
|
-
|
|
31952
|
-
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
|
|
31938
|
+
print(json.dumps(out))`,{stdout}=await run10(python,["-c",code,...names5],{timeout:1e4,windowsHide:!0,maxBuffer:1024*1024}),versions=JSON.parse(stdout);for(let row of pythonRows)row.version=versions[row.name],row.where=python,row.status=row.version?row.required?"review":"found":"missing"}catch{warnings.push("Could not inspect Python package metadata")}return{scope:"host",scannedAt:new Date().toISOString(),skillCount:sources2.size,requirements,warnings}}async function fetchHubFile(root3,area5,id12,path8,fetcher){let first2=area5==="quarantine"?"quarantine":"skills",response=await fetcher(`${root3}/${first2}/${id12}/${path8}`);return response.status!==404?response:fetcher(`${root3}/${first2==="skills"?"quarantine":"skills"}/${id12}/${path8}`)}import{createHash as createHash120}from"node:crypto";import{existsSync as existsSync102,mkdirSync as mkdirSync124,readFileSync as readFileSync190}from"node:fs";import{join as join266}from"node:path";init_atomic();init_config3();var HUB_REPO="leomieo/limix-skill-hub",FILE_MAX_BYTES3=SKILL_FOLDER_LIMITS.fileBytes,HUB_BRANCH="main",SYNC_MIN_GAP_MS=1200*60*1e3,DEFAULT_SETTINGS={autoSync:!0,autoInstall:!1,lastSync:null,lastError:null,etag:null},hubDir=()=>join266(DATA_DIR,"skill-hub"),settingsFile=()=>join266(hubDir(),"settings.json"),catalogFile=()=>join266(hubDir(),"catalog.json");function readJson7(file2,fallback2){try{return JSON.parse(readFileSync190(file2,"utf8"))}catch{return fallback2}}function hubSettings(){return{
|
|
31939
|
+
...DEFAULT_SETTINGS,...readJson7(settingsFile(),{})}}function saveSettings(next){mkdirSync124(hubDir(),{recursive:!0,mode:448}),writeFileAtomic(settingsFile(),JSON.stringify(next,null,2),{mode:384})}function hubCatalog(){let body3=readJson7(catalogFile(),{});return Array.isArray(body3.skills)?body3.skills:[]}var rawUrl=path8=>`https://raw.githubusercontent.com/${HUB_REPO}/${HUB_BRANCH}/${path8}`;async function fetchText2(url3,headers={}){return fetch(url3,{signal:AbortSignal.timeout(3e4),headers:{
|
|
31940
|
+
"User-Agent":"limix-bot",...headers}})}async function withCatalogDates(entries4){let cached6=new Map(hubCatalog().map(skill=>[skill.id,skill.added_at])),dated=entries4.map(skill=>({...skill,added_at:skill.added_at||cached6.get(skill.id)||null}));if(dated.every(skill=>skill.added_at))return dated;try{let response=await fetchText2(rawUrl("registry/versions.json"));if(!response.ok)return dated;let history=await response.json();for(let skill of dated){if(skill.added_at||!Array.isArray(history[skill.
|
|
31941
|
+
id]))continue;let dates=history[skill.id].flatMap(({at:at8})=>at8&&Number.isFinite(Date.parse(at8))?[Date.parse(at8)]:[]);dates.length&&(skill.added_at=new Date(Math.min(...dates)).toISOString())}}catch{}return dated}var syncing=null;function syncHub(){return syncing||(syncing=(async()=>{let settings=hubSettings();try{let response=await fetchText2(rawUrl("registry/catalog.json"),settings.etag&&existsSync102(catalogFile())&&hubCatalog().every(skill=>skill.added_at)?{"If-None-Match":settings.etag}:
|
|
31942
|
+
{});if(response.status===304)return saveSettings({...settings,lastSync:new Date().toISOString(),lastError:null}),{changed:!1,count:hubCatalog().length};if(!response.ok)throw new Error(lxs(`Hub tr\u1EA3 v\u1EC1 ${response.status}`,`The hub returned ${response.status}`));let text33=await response.text(),parsed3=JSON.parse(text33);if(!Array.isArray(parsed3.skills))throw new Error(lxs("Danh m\u1EE5c Hub kh\xF4ng \u0111\xFAng \u0111\u1ECBnh d\u1EA1ng","The hub catalog has the wrong format"));return mkdirSync124(
|
|
31943
|
+
hubDir(),{recursive:!0,mode:448}),writeFileAtomic(catalogFile(),JSON.stringify({...parsed3,skills:await withCatalogDates(parsed3.skills)}),{mode:384}),saveSettings({...settings,etag:response.headers.get("etag"),lastSync:new Date().toISOString(),lastError:null}),settings.autoInstall&&await autoInstallEligible(),{changed:!0,count:parsed3.skills.length}}catch(cause){let message8=cause instanceof Error?cause.message:String(cause);return saveSettings({...settings,lastError:message8}),{error:message8}}finally{
|
|
31944
|
+
syncing=null}})(),syncing)}var SCRIPT4=/\.(py|js|mjs|cjs|ts|sh|bash|zsh|ps1|bat|cmd|rb|pl|php|go|rs|exe|dll|so|dylib|bin|jar|class|scr|msi|com|apk|dex|node|wasm)$/i,MCP_FILE=/(^|\/)(\.mcp\.json|mcp\.json|mcp-servers?\.json|claude_desktop_config\.json)$/i,isToolFile=path8=>SCRIPT4.test(path8)||MCP_FILE.test(path8),sha=data4=>createHash120("sha256").update(data4).digest("hex");function hubSkillBlocked(entry2){return entry2.area==="quarantine"||entry2.security_status==="quarantined"?lxs("B\u1ED9 qu\xE9t \u0111\xE1\
|
|
31945
|
+
nh d\u1EA5u r\u1EE7i ro v\xE0 c\xE1ch ly skill; c\u1EA7n xem c\xE1c ph\xE1t hi\u1EC7n tr\u01B0\u1EDBc khi d\xF9ng.","The scanner flagged risks and quarantined this skill; review the findings before use."):entry2.approval_status==="quarantined"||entry2.approval_status==="rejected"?lxs("Skill b\u1ECB t\u1EEB ch\u1ED1i.","This skill was rejected."):null}function installedFromHub(){let out=new Map;for(let entry2 of Object.values(readSkillLibraryIndex())){let match5=/^limix-hub:([a-z0-9-]+)@([0-9a-f]{64})/.
|
|
31946
|
+
exec(entry2.source);match5&&out.set(match5[1],{checksum:match5[2],sha256:entry2.sha256,reviewState:entry2.reviewState})}return out}function hubSkills(){let installed2=installedFromHub(),library=readSkillLibraryIndex();return hubCatalog().map(entry2=>{let have=installed2.get(entry2.id);return{...entry2,installed:!!have,enabled:have?.reviewState==="approved",updateAvailable:!!(have&&have.checksum!==entry2.checksum),blocked:!have&&library[entry2.id]?lxs("Th\u01B0 vi\u1EC7n \u0111\xE3 c\xF3 k\u1EF9 n\u0103ng c\xF9ng t\xEAn kh\xF4ng \u0111\u1EBFn t\u1EEB\
|
|
31947
|
+
Hub.","The library already has a skill with this name that did not come from the hub."):null,risky:hubSkillBlocked(entry2)}})}async function installHubSkill(id12,options2={}){if(!isSkillName(id12))return{error:lxs("T\xEAn k\u1EF9 n\u0103ng kh\xF4ng h\u1EE3p l\u1EC7","Invalid skill name")};let entry2=hubCatalog().find(e=>e.id===id12);if(!entry2)return{error:lxs("Kh\xF4ng th\u1EA5y k\u1EF9 n\u0103ng n\xE0y trong danh m\u1EE5c Hub. H\xE3y \u0111\u1ED3ng b\u1ED9 l\u1EA1i.","This skill is not in the\
|
|
31948
|
+
hub catalog. Sync again.")};let blocked=hubSkillBlocked(entry2);if(blocked&&!options2.allowRisky)return{error:blocked};let installed2=installedFromHub().get(id12);if(readSkillLibraryIndex()[id12]&&!installed2)return{error:lxs("Th\u01B0 vi\u1EC7n \u0111\xE3 c\xF3 k\u1EF9 n\u0103ng c\xF9ng t\xEAn kh\xF4ng \u0111\u1EBFn t\u1EEB Hub.","The library already has a skill with this name that did not come from the hub.")};let wanted=Object.keys(entry2.file_hashes).filter(path8=>path8!=="SKILL.md"&&(options2.
|
|
31949
|
+
allowTools||!isToolFile(path8))),skipped2=Object.keys(entry2.file_hashes).filter(path8=>path8!=="SKILL.md"&&!wanted.includes(path8)),files2=[],skillMd="";for(let path8 of["SKILL.md",...wanted]){let expected=entry2.file_hashes[path8];if(!expected)return{error:lxs(`Danh m\u1EE5c thi\u1EBFu m\xE3 ki\u1EC3m tra cho ${path8}`,`The catalog has no checksum for ${path8}`)};let response;try{response=await fetchHubFile(rawUrl("").replace(/\/$/,""),entry2.area,id12,path8,fetchText2)}catch(cause){return{error:lxs(
|
|
31950
|
+
`Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c ${path8}: `,`Couldn't download ${path8}: `)+(cause instanceof Error?cause.message:String(cause))}}if(!response.ok)return{error:lxs(`Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c ${path8} (${response.status})`,`Couldn't download ${path8} (${response.status})`),...response.status===404?{missingFile:path8}:{}};let bytes4=new Uint8Array(await response.arrayBuffer());if(bytes4.byteLength>FILE_MAX_BYTES3)return{error:lxs(`${path8} qu\xE1 l\u1EDBn`,`${path8} is too large`)};
|
|
31951
|
+
if(sha(bytes4)!==expected)return{error:lxs(`${path8} kh\xF4ng kh\u1EDBp m\xE3 SHA-256 trong danh m\u1EE5c \u2014 \u0111\xE3 d\u1EEBng c\xE0i`,`${path8} does not match the SHA-256 in the catalog \u2014 install stopped`)};path8==="SKILL.md"?skillMd=new TextDecoder().decode(bytes4):files2.push({path:path8,content:bytes4})}if(installed2){let retired=retireLibrarySkill(id12,installed2.sha256);if("error"in retired)return{error:retired.error};if("stale"in retired)return{error:lxs("K\u1EF9 n\u0103ng \u0111\xE3 b\u1ECB s\u1EEDa tay\
|
|
31952
|
+
sau khi c\xE0i, kh\xF4ng c\u1EADp nh\u1EADt \u0111\xE8.","This skill was edited by hand after installing, so it is not overwritten.")}}let result2=installLibrarySkill({name:id12,instructions:skillMd,source:`limix-hub:${id12}@${entry2.checksum} (${entry2.source.repository??"?"}@${(entry2.source.commit??"").slice(0,7)})`,...entry2.license?{license:entry2.license}:{},...entry2.compatibility.text?{compatibility:entry2.compatibility.text}:{},...entry2.tags.length?{tags:entry2.tags}:{},warnings:entry2.
|
|
31953
|
+
notes,skippedFiles:skipped2,reviewState:blocked?"disabled":"approved",...files2.length?{files:files2}:{}});return"error"in result2?{error:result2.error}:{ok:!0,skipped:skipped2}}function setHubSkillEnabled(id12,enabled){if(!installedFromHub().has(id12))return{error:lxs("K\u1EF9 n\u0103ng n\xE0y ch\u01B0a c\xE0i t\u1EEB Hub","This skill was not installed from the hub")};let result2=setLibrarySkillReviewState(id12,enabled?"approved":"disabled");return"error"in result2?{error:result2.error}:{ok:!0}}
|
|
31954
|
+
function removeHubSkill(id12){let installed2=installedFromHub().get(id12);if(!installed2)return{error:lxs("K\u1EF9 n\u0103ng n\xE0y ch\u01B0a c\xE0i t\u1EEB Hub","This skill was not installed from the hub")};let result2=retireLibrarySkill(id12,installed2.sha256);return"error"in result2?{error:result2.error}:"stale"in result2?{error:lxs("K\u1EF9 n\u0103ng \u0111\xE3 b\u1ECB s\u1EEDa tay sau khi c\xE0i, kh\xF4ng g\u1EE1 t\u1EF1 \u0111\u1ED9ng.","This skill was edited by hand after installing, so i\
|
|
31955
|
+
t is not removed automatically.")}:{ok:!0}}async function autoInstallEligible(){let budget=5;for(let skill of hubSkills()){if(budget<=0)return;if(!(!skill.blocked&&!skill.risky&&skill.kind==="instructions-only"&&skill.approval_status==="approved"&&(skill.grade==="excellent"||skill.grade==="recommended"))||skill.installed&&!skill.updateAvailable)continue;budget-=1,"ok"in await installHubSkill(skill.id)&&skill.updateAvailable&&skill.enabled&&setHubSkillEnabled(skill.id,!0)}}async function handleLimixHub(method2,path8,body3){
|
|
31956
|
+
let record31=body3&&typeof body3=="object"?body3:{};if(method2==="GET"&&path8==="/api/limix/hub")return{status:200,body:{repo:HUB_REPO,settings:hubSettings(),skills:hubSkills()}};if(method2==="POST"&&path8==="/api/limix/hub/sync"){let result2=await syncHub();return"error"in result2?{status:502,body:result2}:{status:200,body:result2}}if(method2==="POST"&&path8==="/api/limix/hub/settings"){let current3=hubSettings();return saveSettings({...current3,autoSync:typeof record31.autoSync=="boolean"?record31.
|
|
31957
|
+
autoSync:current3.autoSync,autoInstall:typeof record31.autoInstall=="boolean"?record31.autoInstall:current3.autoInstall}),{status:200,body:{settings:hubSettings()}}}let id12=typeof record31.id=="string"?record31.id:"";if(method2==="POST"&&(path8==="/api/limix/hub/install"||path8==="/api/limix/hub/update")){let expected=hubCatalog().find(entry2=>entry2.id===id12)?.checksum,result2=await installHubSkill(id12,{allowTools:record31.allowTools===!0,allowRisky:record31.allowRisky===!0});return"error"in
|
|
31958
|
+
result2&&result2.missingFile?!("error"in await syncHub())&&hubCatalog().find(entry2=>entry2.id===id12)?.checksum!==expected?{status:409,body:{error:lxs("Kho k\u1EF9 n\u0103ng v\u1EEBa c\u1EADp nh\u1EADt. H\xE3y xem l\u1EA1i m\u1EE5c n\xE0y tr\u01B0\u1EDBc khi c\xE0i.","The skill catalog has changed. Review this skill before installing.")}}:{status:422,body:{error:lxs(`G\xF3i k\u1EF9 n\u0103ng \u0111ang thi\u1EBFu t\u1EC7p ${result2.missingFile}. Ch\u01B0a c\xE0i \u0111\u1EB7t k\u1EF9 n\u0103ng.`,
|
|
31959
|
+
`The skill package is missing ${result2.missingFile}. The skill was not installed.`)}}:"error"in result2?{status:422,body:result2}:{status:200,body:result2}}if(method2==="POST"&&path8==="/api/limix/hub/enable"){let result2=setHubSkillEnabled(id12,record31.enabled===!0);return"error"in result2?{status:422,body:result2}:{status:200,body:result2}}if(method2==="POST"&&path8==="/api/limix/hub/remove"){let result2=removeHubSkill(id12);return"error"in result2?{status:422,body:result2}:{status:200,body:result2}}
|
|
31960
|
+
return null}var started2=!1;function startHubAutoSync(){if(started2)return;started2=!0;let tick2=()=>{let settings=hubSettings();settings.autoSync&&(settings.lastSync&&Date.now()-Date.parse(settings.lastSync)<SYNC_MIN_GAP_MS||syncHub())};setTimeout(tick2,6e4).unref(),setInterval(tick2,1800*1e3).unref()}function createBotSkillsRoutes(deps){let{store:store5,cfg:cfg2,listBotSkills:listBotSkills2,readBotSkillFile:readBotSkillFile2,stagedSkillListing:stagedSkillListing2}=deps;return async({req,res,url:url3,path:path8,method:method2,json:json7,readBody:readBody2})=>{let m3=null;if(method2==="GET"&&path8==="/api/limix/skill-requirements")return json7(res,200,await scanSkillRequirements(store5.bots,cfg2.mcpServers));if(method2==="POST"&&path8==="/api/limix/skill-requirements/scan"){let input2=external_exports.
|
|
31960
31961
|
object({projects:external_exports.array(external_exports.string().max(4096).refine(isAbsolute44)).max(200)}).safeParse(await readBody2(req));return input2.success?json7(res,200,await scanSkillRequirements(store5.bots,cfg2.mcpServers,input2.data.projects)):json7(res,400,{error:"Choose valid project folders"})}if(path8.startsWith("/api/limix/bots")){let library=await handleLimixBotLibrary(method2,path8);if(library)return json7(res,library.status,library.body)}if(path8.startsWith("/api/limix/hub")){
|
|
31961
31962
|
let hub=await handleLimixHub(method2,path8,method2==="POST"?await readBody2(req):void 0);if(hub)return json7(res,hub.status,hub.body)}if(path8.startsWith("/api/limix/skill-store/")){let skillStore=handleLimixSkillStore(store5,method2,path8,method2==="POST"?await readBody2(req):void 0);if(skillStore)return json7(res,skillStore.status,skillStore.body)}if(method2==="GET"&&path8==="/api/limix/bundled-skills"){let skills=loadBundledSkills().map(({manifest})=>({id:manifest.id,name:manifest.name,description:limixSkillText(
|
|
31962
31963
|
manifest.id,manifest.description),defaultEnabled:manifest.defaultEnabled,triggerTerms:manifest.triggerTerms,core:LIMIX_CORE_SKILLS.has(manifest.id)}));return json7(res,200,{skills})}if(m3=path8.match(/^\/api\/bots\/([\w-]+)\/skill-template$/),m3&&method2==="POST"){if(!store5.bot(m3[1]))return json7(res,404,{error:"no such bot"});let checked=botSkillTemplateSchema.safeParse(await readBody2(req));if(!checked.success)return json7(res,400,{error:checked.error.message});let input2=checked.data,parsed3=parseSkillMd(
|
package/dist-server/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"0.3.
|
|
1
|
+
{"type":"module","version":"0.3.115"}
|
|
@@ -3,13 +3,13 @@ import { imageDimensions } from "../../shared/provider-icon.js";
|
|
|
3
3
|
import { IMAGE_MAX_BYTES, saveFile, saveImage } from "../attachments.js";
|
|
4
4
|
import { fetchPublicPage } from "../wait-probes.js";
|
|
5
5
|
import { fetchChannelMedia, readChannelMedia } from "./channel-media.js";
|
|
6
|
-
const
|
|
6
|
+
const ZALO_FILE_LIMIT = 32 * 1024 * 1024;
|
|
7
7
|
const ZALO_CDN = ["zaloapp.com", "zalo.me", "zdn.vn", "zadn.vn", "zalo.vn"];
|
|
8
8
|
export function receiveZaloFile(url, name) {
|
|
9
|
-
return fetchChannelMedia(url, ZALO_CDN, name);
|
|
9
|
+
return fetchChannelMedia(url, ZALO_CDN, name, ZALO_FILE_LIMIT);
|
|
10
10
|
}
|
|
11
11
|
export async function receiveZaloMedia(url, photo) {
|
|
12
|
-
const limit = photo ? IMAGE_MAX_BYTES :
|
|
12
|
+
const limit = photo ? IMAGE_MAX_BYTES : ZALO_FILE_LIMIT;
|
|
13
13
|
const target = new URL(url);
|
|
14
14
|
if (target.protocol !== "https:" || !/(^|\.)(zaloapp\.com|zalo\.me|zdn\.vn|zadn\.vn|zalo\.vn)$/.test(target.hostname))
|
|
15
15
|
throw Error("Unsupported Zalo media address");
|
|
@@ -29,7 +29,7 @@ export async function receiveZaloMedia(url, photo) {
|
|
|
29
29
|
return { kind: "file", path: file.path, name: file.name, mime: file.mime };
|
|
30
30
|
}
|
|
31
31
|
export async function zaloUpload(file) {
|
|
32
|
-
const { data, filename } = await readChannelMedia(file, file.
|
|
32
|
+
const { data, filename } = await readChannelMedia(file, file.kind === "image" ? IMAGE_MAX_BYTES : ZALO_FILE_LIMIT);
|
|
33
33
|
const dimensions = file.kind === "image" ? imageDimensions(data, file.mime) : undefined;
|
|
34
34
|
if (file.kind === "image" && !dimensions)
|
|
35
35
|
throw Error("Unsupported image");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SKILL_FOLDER_LIMITS } from "./skill-folder.js";
|
|
1
2
|
import { fetchHubFile } from "./limix-hub-download.js";
|
|
2
3
|
// Limix Skill Hub client: keeps a cached copy of the hub catalog, installs a skill only after every file matches the
|
|
3
4
|
// SHA-256 the catalog pins, and never installs scripts, binaries or MCP files unless the owner allows tools for that
|
|
@@ -12,9 +13,9 @@ import { DATA_DIR } from "./config.js";
|
|
|
12
13
|
import { installLibrarySkill, readSkillLibraryIndex, retireLibrarySkill, setLibrarySkillReviewState } from "./skill-library.js";
|
|
13
14
|
import { lxs } from "./limix-lang.js";
|
|
14
15
|
export const HUB_REPO = "leomieo/limix-skill-hub";
|
|
16
|
+
const FILE_MAX_BYTES = SKILL_FOLDER_LIMITS.fileBytes;
|
|
15
17
|
const HUB_BRANCH = "main";
|
|
16
18
|
const SYNC_MIN_GAP_MS = 20 * 60 * 60 * 1000;
|
|
17
|
-
const FILE_MAX_BYTES = 1024 * 1024;
|
|
18
19
|
const DEFAULT_SETTINGS = { autoSync: true, autoInstall: false, lastSync: null, lastError: null, etag: null };
|
|
19
20
|
const hubDir = () => join(DATA_DIR, "skill-hub");
|
|
20
21
|
const settingsFile = () => join(hubDir(), "settings.json");
|
|
@@ -42,6 +43,29 @@ const rawUrl = (path) => `https://raw.githubusercontent.com/${HUB_REPO}/${HUB_BR
|
|
|
42
43
|
async function fetchText(url, headers = {}) {
|
|
43
44
|
return fetch(url, { signal: AbortSignal.timeout(30_000), headers: { "User-Agent": "limix-bot", ...headers } });
|
|
44
45
|
}
|
|
46
|
+
async function withCatalogDates(entries) {
|
|
47
|
+
const cached = new Map(hubCatalog().map((skill) => [skill.id, skill.added_at]));
|
|
48
|
+
const dated = entries.map((skill) => ({ ...skill, added_at: skill.added_at || cached.get(skill.id) || null }));
|
|
49
|
+
if (dated.every((skill) => skill.added_at))
|
|
50
|
+
return dated;
|
|
51
|
+
try {
|
|
52
|
+
const response = await fetchText(rawUrl("registry/versions.json"));
|
|
53
|
+
if (!response.ok)
|
|
54
|
+
return dated;
|
|
55
|
+
const history = await response.json();
|
|
56
|
+
for (const skill of dated) {
|
|
57
|
+
if (skill.added_at || !Array.isArray(history[skill.id]))
|
|
58
|
+
continue;
|
|
59
|
+
const dates = history[skill.id].flatMap(({ at }) => at && Number.isFinite(Date.parse(at)) ? [Date.parse(at)] : []);
|
|
60
|
+
if (dates.length)
|
|
61
|
+
skill.added_at = new Date(Math.min(...dates)).toISOString();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Older hubs may publish a catalog without version history.
|
|
66
|
+
}
|
|
67
|
+
return dated;
|
|
68
|
+
}
|
|
45
69
|
let syncing = null;
|
|
46
70
|
/** Refreshes the cached catalog (ETag, so an unchanged hub costs one tiny request). */
|
|
47
71
|
export function syncHub() {
|
|
@@ -50,7 +74,7 @@ export function syncHub() {
|
|
|
50
74
|
syncing = (async () => {
|
|
51
75
|
const settings = hubSettings();
|
|
52
76
|
try {
|
|
53
|
-
const response = await fetchText(rawUrl("registry/catalog.json"), settings.etag && existsSync(catalogFile()) ? { "If-None-Match": settings.etag } : {});
|
|
77
|
+
const response = await fetchText(rawUrl("registry/catalog.json"), settings.etag && existsSync(catalogFile()) && hubCatalog().every((skill) => skill.added_at) ? { "If-None-Match": settings.etag } : {});
|
|
54
78
|
if (response.status === 304) {
|
|
55
79
|
saveSettings({ ...settings, lastSync: new Date().toISOString(), lastError: null });
|
|
56
80
|
return { changed: false, count: hubCatalog().length };
|
|
@@ -62,7 +86,7 @@ export function syncHub() {
|
|
|
62
86
|
if (!Array.isArray(parsed.skills))
|
|
63
87
|
throw new Error(lxs("Danh mục Hub không đúng định dạng", "The hub catalog has the wrong format"));
|
|
64
88
|
mkdirSync(hubDir(), { recursive: true, mode: 0o700 });
|
|
65
|
-
writeFileAtomic(catalogFile(),
|
|
89
|
+
writeFileAtomic(catalogFile(), JSON.stringify({ ...parsed, skills: await withCatalogDates(parsed.skills) }), { mode: 0o600 });
|
|
66
90
|
saveSettings({ ...settings, etag: response.headers.get("etag"), lastSync: new Date().toISOString(), lastError: null });
|
|
67
91
|
if (settings.autoInstall)
|
|
68
92
|
await autoInstallEligible();
|