beeos-claw 0.5.38 → 0.5.40

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.
@@ -1 +1 @@
1
- export function isAgentSyncWaitForGateway(t){return!(!t||t instanceof Map||"wait_gateway"!==t.status)}export async function syncAgentsToPlatform(t){const{gateway:e,agentGatewayUrl:n,capabilities:a,agentFetch:s,logger:i}=t;if(!s)return i?.debug?.("[agent-sync] no agentFetch — skipping sync (no key pair)"),null;if(!n)return i?.debug?.("[agent-sync] no agentGatewayUrl — skipping sync"),null;try{const t=await e.request("agents.list",{}),r=t?.agents??[];if(0===r.length)return i?.debug?.("[agent-sync] no agents from Gateway — skipping sync"),null;const o=[];for(const t of r){let n=[];try{const a=await e.request("skills.status",{agentId:t.id});n=(a?.skills??[]).filter(t=>t.eligible&&!t.disabled).map(t=>({name:t.name,description:t.description,...t.emoji?{emoji:t.emoji}:{}}))}catch{i?.debug?.(`[agent-sync] skills.status failed for agent ${t.id} — continuing without skills`)}const s={};if(a)for(const[t,e]of Object.entries(a))e&&(s[t]=!0);const r=t.identity?.name||t.name||t.id;o.push({name:t.id,displayName:r,description:t.name||t.identity?.name||t.id,version:"0.1.0",capabilities:s,skills:n,avatarUrl:t.identity?.avatarUrl||"",homepage:""})}const c=new URL("/api/v1/agents/sync",n),d=await s(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:o})});if(d.ok){const t=await d.json();i?.info?.(`[agent-sync] synced ${o.length} agent(s) — created=${t.created??0} updated=${t.updated??0} deactivated=${t.deactivated??0}`);const e=new Map,n=Array.isArray(t.data)?t.data:[];for(const t of n)t&&"string"==typeof t.name&&"string"==typeof t.id&&e.set(t.name,{id:t.id,instanceId:t.instanceId??"",name:t.name,displayName:t.displayName??t.name,description:t.description??"",version:t.version??"",avatarUrl:t.avatarUrl??"",status:t.status??"active"});return e.size>0?e:null}{const t=await d.text().catch(()=>"");return i?.warn?.(`[agent-sync] sync failed: HTTP ${d.status} — ${t.slice(0,200)}`),null}}catch(t){const e=t instanceof Error?t.message:String(t);return i?.warn?.(`[agent-sync] sync error: ${e}`),"Not connected to Gateway"===e?{status:"wait_gateway",reason:e}:null}}
1
+ export function isAgentSyncWaitForGateway(t){return!(!t||t instanceof Map||"wait_gateway"!==t.status)}export async function syncAgentsToPlatform(t){const{gateway:e,agentGatewayUrl:n,capabilities:a,agentFetch:s,logger:i}=t;if(!s)return i?.debug?.("[agent-sync] no agentFetch — skipping sync (no key pair)"),null;if(!n)return i?.debug?.("[agent-sync] no agentGatewayUrl — skipping sync"),null;try{const t=await e.request("agents.list",{}),r=t?.agents??[];if(0===r.length)return i?.debug?.("[agent-sync] no agents from Gateway — skipping sync"),null;const o=[];for(const t of r){let n=[];try{const a=await e.request("skills.status",{agentId:t.id});n=(a?.skills??[]).filter(t=>t.eligible&&!t.disabled).map(t=>({name:t.name,description:t.description,...t.emoji?{emoji:t.emoji}:{},...t.skillKey?{skillKey:t.skillKey}:{}}))}catch{i?.debug?.(`[agent-sync] skills.status failed for agent ${t.id} — continuing without skills`)}const s={};if(a)for(const[t,e]of Object.entries(a))e&&(s[t]=!0);const r=t.identity?.name||t.name||t.id;o.push({name:t.id,displayName:r,description:t.name||t.identity?.name||t.id,version:"0.1.0",capabilities:s,skills:n,avatarUrl:t.identity?.avatarUrl||"",homepage:""})}const c=new URL("/api/v1/agents/sync",n),l=await s(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:o})});if(l.ok){const t=await l.json();i?.info?.(`[agent-sync] synced ${o.length} agent(s) — created=${t.created??0} updated=${t.updated??0} deactivated=${t.deactivated??0}`);const e=new Map,n=Array.isArray(t.data)?t.data:[];for(const t of n)t&&"string"==typeof t.name&&"string"==typeof t.id&&e.set(t.name,{id:t.id,instanceId:t.instanceId??"",name:t.name,displayName:t.displayName??t.name,description:t.description??"",version:t.version??"",avatarUrl:t.avatarUrl??"",status:t.status??"active"});return e.size>0?e:null}{const t=await l.text().catch(()=>"");return i?.warn?.(`[agent-sync] sync failed: HTTP ${l.status} — ${t.slice(0,200)}`),null}}catch(t){const e=t instanceof Error?t.message:String(t);return i?.warn?.(`[agent-sync] sync error: ${e}`),"Not connected to Gateway"===e?{status:"wait_gateway",reason:e}:null}}
@@ -1 +1 @@
1
- import{access,constants,readFile,stat}from"node:fs/promises";import{basename,extname}from"node:path";import{agentFetch}from"../agent-auth.js";const DEFAULT_TIMEOUT_MS=3e4;let _deps=null;export function setUploadDeps(e){_deps=e}export function getUploadDeps(){return _deps}export async function uploadLocalFile(e,t,a,s){await access(e,constants.R_OK);if(!(await stat(e)).isFile())throw new Error("not a regular file");const n=basename(e),i=s?.fileNameOverride??n,r=inferMimeType(i),o=await readFile(e),c=AbortSignal.timeout(s?.timeoutMs??3e4),p=s?.signal?AbortSignal.any([s.signal,c]):c,l=`${t}/api/v1/agent/files`,m=await agentFetch(l+"/presign",a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:i,mimeType:r}),signal:p});if(!m.ok){const e=await m.text().catch(()=>m.statusText);throw new Error(`presign ${m.status}: ${e}`)}const u=await m.json(),f=await fetch(u.uploadUrl,{method:"PUT",headers:{"Content-Type":r},body:new Blob([o],{type:r}),signal:p});if(!f.ok)throw new Error(`S3 PUT failed: ${f.status}`);const g=await agentFetch(l+"/confirm",a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileId:u.fileId}),signal:p});if(!g.ok){const e=await g.text().catch(()=>g.statusText);throw new Error(`confirm ${g.status}: ${e}`)}const d=await g.json();return{fileId:d.fileId,uri:`beeos-file://${d.fileId}`,name:d.fileName||i,mimeType:d.mimeType||r,size:d.size||o.byteLength}}function inferMimeType(e){switch(extname(e).toLowerCase()){case".txt":return"text/plain";case".md":return"text/markdown";case".json":return"application/json";case".html":return"text/html";case".css":return"text/css";case".js":case".mjs":case".cjs":return"text/javascript";case".ts":return"text/x.typescript";case".tsx":case".jsx":return"text/jsx";case".xml":return"application/xml";case".yaml":case".yml":return"application/yaml";case".toml":return"application/toml";case".pdf":return"application/pdf";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".svg":return"image/svg+xml";case".csv":return"text/csv";case".zip":return"application/zip";case".tar":return"application/x-tar";case".gz":case".tgz":return"application/gzip";default:return"application/octet-stream"}}
1
+ import{access,constants,readFile,stat}from"node:fs/promises";import{basename,extname}from"node:path";import{agentFetch}from"../agent-auth.js";const DEFAULT_TIMEOUT_MS=3e4;let _deps=null;export function setUploadDeps(e){_deps=e}export function getUploadDeps(){return _deps}export async function uploadLocalFile(e,t,a,n){await access(e,constants.R_OK);if(!(await stat(e)).isFile())throw new Error("not a regular file");const r=basename(e),s=n?.fileNameOverride??r,i=inferMimeType(s),o=await readFile(e),c=AbortSignal.timeout(n?.timeoutMs??3e4),p=n?.signal?AbortSignal.any([n.signal,c]):c,m=`${t}/api/v1/agent/files`,l=await agentFetch(m+"/presign",a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:s,mimeType:i}),signal:p});if(!l.ok){const e=await l.text().catch(()=>l.statusText);throw new Error(`presign ${l.status}: ${e}`)}const u=await l.json(),d=await fetch(u.uploadUrl,{method:"PUT",headers:{"Content-Type":i},body:new Blob([o],{type:i}),signal:p});if(!d.ok)throw new Error(`S3 PUT failed: ${d.status}`);const f=await agentFetch(m+"/confirm",a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileId:u.fileId}),signal:p});if(!f.ok){const e=await f.text().catch(()=>f.statusText);throw new Error(`confirm ${f.status}: ${e}`)}const g=await f.json();return{fileId:g.fileId,uri:`beeos-file://${g.fileId}`,name:g.fileName||s,mimeType:g.mimeType||i,size:g.size||o.byteLength}}function inferMimeType(e){switch(extname(e).toLowerCase()){case".txt":return"text/plain";case".md":return"text/markdown";case".json":return"application/json";case".html":return"text/html";case".css":return"text/css";case".js":case".mjs":case".cjs":return"text/javascript";case".ts":return"text/x.typescript";case".tsx":case".jsx":return"text/jsx";case".xml":return"application/xml";case".yaml":case".yml":return"application/yaml";case".toml":return"application/toml";case".pdf":return"application/pdf";case".doc":return"application/msword";case".docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case".xls":return"application/vnd.ms-excel";case".xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case".ppt":return"application/vnd.ms-powerpoint";case".pptx":return"application/vnd.openxmlformats-officedocument.presentationml.presentation";case".rtf":return"application/rtf";case".odt":return"application/vnd.oasis.opendocument.text";case".ods":return"application/vnd.oasis.opendocument.spreadsheet";case".odp":return"application/vnd.oasis.opendocument.presentation";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".svg":return"image/svg+xml";case".mp4":return"video/mp4";case".mov":return"video/quicktime";case".webm":return"video/webm";case".mkv":return"video/x-matroska";case".avi":return"video/x-msvideo";case".m4v":return"video/x-m4v";case".mp3":return"audio/mpeg";case".wav":return"audio/wav";case".flac":return"audio/flac";case".aac":return"audio/aac";case".ogg":return"audio/ogg";case".m4a":return"audio/mp4";case".csv":return"text/csv";case".zip":return"application/zip";case".tar":return"application/x-tar";case".gz":case".tgz":return"application/gzip";default:return"application/octet-stream"}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beeos-claw",
3
- "version": "0.5.38",
3
+ "version": "0.5.40",
4
4
  "description": "OpenClaw plugin that bridges the BeeOS platform with the local OpenClaw Gateway, providing file transfer, ACP bridge, and observability.",
5
5
  "license": "MIT",
6
6
  "author": "BeeOS <dev@beeos.ai>",