@qqbrowser/openclaw-qbot 0.0.147 → 0.0.148

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.
Files changed (54) hide show
  1. package/dist/build-info.json +3 -3
  2. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  3. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +2 -2
  4. package/node_modules/@aws-sdk/token-providers/package.json +1 -1
  5. package/node_modules/@mariozechner/clipboard/index.js +31 -312
  6. package/node_modules/@mariozechner/clipboard/package.json +12 -52
  7. package/node_modules/@snazzah/davey/index.js +39 -511
  8. package/node_modules/@snazzah/davey/package.json +11 -134
  9. package/node_modules/dotenv/package.json +1 -1
  10. package/node_modules/dotenv/skills/dotenv/SKILL.md +107 -665
  11. package/node_modules/dotenv/skills/dotenvx/SKILL.md +67 -76
  12. package/node_modules/follow-redirects/index.js +24 -1
  13. package/node_modules/follow-redirects/package.json +1 -1
  14. package/node_modules/koffi/package.json +9 -5
  15. package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.mts.map +1 -0
  16. package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
  17. package/node_modules/lru-cache/dist/esm/browser/index.js +1688 -0
  18. package/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
  19. package/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -1
  20. package/node_modules/lru-cache/dist/esm/diagnostics-channel.js +1 -1
  21. package/node_modules/lru-cache/package.json +15 -2
  22. package/node_modules/undici/lib/web/fetch/index.js +15 -2
  23. package/node_modules/undici/lib/web/fetch/util.js +4 -2
  24. package/node_modules/undici/package.json +1 -1
  25. package/noop-pkg/clipboard-noop/index.js +36 -0
  26. package/noop-pkg/clipboard-noop/package.json +16 -0
  27. package/noop-pkg/davey-noop/index.js +51 -0
  28. package/noop-pkg/davey-noop/package.json +17 -0
  29. package/noop-pkg/koffi-noop/index.js +1 -0
  30. package/noop-pkg/koffi-noop/package.json +16 -0
  31. package/package.json +11 -3
  32. package/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
  33. package/node_modules/@mariozechner/clipboard/Cargo.toml +0 -26
  34. package/node_modules/@mariozechner/clipboard/build.rs +0 -5
  35. package/node_modules/@mariozechner/clipboard/src/lib.rs +0 -191
  36. package/node_modules/@mariozechner/clipboard-darwin-arm64/clipboard.darwin-arm64.node +0 -0
  37. package/node_modules/@mariozechner/clipboard-darwin-arm64/package.json +0 -22
  38. package/node_modules/@mariozechner/clipboard-darwin-universal/clipboard.darwin-universal.node +0 -0
  39. package/node_modules/@mariozechner/clipboard-darwin-universal/package.json +0 -19
  40. package/node_modules/@mariozechner/clipboard-darwin-x64/clipboard.darwin-x64.node +0 -0
  41. package/node_modules/@mariozechner/clipboard-darwin-x64/package.json +0 -22
  42. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/clipboard.linux-x64-gnu.node +0 -0
  43. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/package.json +0 -25
  44. package/node_modules/@mariozechner/clipboard-linux-x64-musl/clipboard.linux-x64-musl.node +0 -0
  45. package/node_modules/@mariozechner/clipboard-linux-x64-musl/package.json +0 -25
  46. package/node_modules/@snazzah/davey/browser.js +0 -1
  47. package/node_modules/@snazzah/davey-darwin-arm64/davey.darwin-arm64.node +0 -0
  48. package/node_modules/@snazzah/davey-darwin-arm64/package.json +0 -40
  49. package/node_modules/@snazzah/davey-darwin-x64/davey.darwin-x64.node +0 -0
  50. package/node_modules/@snazzah/davey-darwin-x64/package.json +0 -40
  51. package/node_modules/@snazzah/davey-linux-x64-gnu/davey.linux-x64-gnu.node +0 -0
  52. package/node_modules/@snazzah/davey-linux-x64-gnu/package.json +0 -43
  53. package/node_modules/@snazzah/davey-linux-x64-musl/davey.linux-x64-musl.node +0 -0
  54. package/node_modules/@snazzah/davey-linux-x64-musl/package.json +0 -43
@@ -0,0 +1,2 @@
1
+ var C={hasSubscribers:!1},S=C,W=C;var D=()=>S.hasSubscribers||W.hasSubscribers,I=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,U=new Set,L=typeof process=="object"&&process?process:{},G=(u,e,t,i)=>{typeof L.emitWarning=="function"?L.emitWarning(u,e,t,i):console.error(`[${t}] ${e}: ${u}`)},P=u=>!U.has(u),V=Symbol("type"),F=u=>!!u&&u===Math.floor(u)&&u>0&&isFinite(u),j=u=>F(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?O:null:null,O=class extends Array{constructor(e){super(e),this.fill(0)}},R=class u{heap;length;static#o=!1;static create(e){let t=j(e);if(!t)return[];u.#o=!0;let i=new u(e,t);return u.#o=!1,i}constructor(e,t){if(!u.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},M=class u{#o;#u;#w;#D;#S;#M;#U;#m;get perf(){return this.#m}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#b;#s;#i;#t;#a;#c;#l;#h;#y;#r;#_;#F;#d;#g;#T;#W;#f;#j;static unsafeExposeInternals(e){return{starts:e.#F,ttls:e.#d,autopurgeTimers:e.#g,sizes:e.#_,keyMap:e.#s,keyList:e.#i,valList:e.#t,next:e.#a,prev:e.#c,get head(){return e.#l},get tail(){return e.#h},free:e.#y,isBackgroundFetch:t=>e.#e(t),backgroundFetch:(t,i,s,n)=>e.#P(t,i,s,n),moveToTail:t=>e.#L(t),indexes:t=>e.#A(t),rindexes:t=>e.#z(t),isStale:t=>e.#p(t)}}get max(){return this.#o}get maxSize(){return this.#u}get calculatedSize(){return this.#b}get size(){return this.#n}get fetchMethod(){return this.#M}get memoMethod(){return this.#U}get dispose(){return this.#w}get onInsert(){return this.#D}get disposeAfter(){return this.#S}constructor(e){let{max:t=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:r,allowStale:h,dispose:l,onInsert:c,disposeAfter:f,noDisposeOnSet:g,noUpdateTTL:p,maxSize:T=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:m,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:A,ignoreFetchAbort:z,perf:x}=e;if(x!==void 0&&typeof x?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#m=x??I,t!==0&&!F(t))throw new TypeError("max option must be a nonnegative integer");let v=t?j(t):Array;if(!v)throw new Error("invalid max value: "+t);if(this.#o=t,this.#u=T,this.maxEntrySize=w||this.#u,this.sizeCalculation=y,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(m!==void 0&&typeof m!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#U=m,a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#M=a,this.#W=!!a,this.#s=new Map,this.#i=Array.from({length:t}).fill(void 0),this.#t=Array.from({length:t}).fill(void 0),this.#a=new v(t),this.#c=new v(t),this.#l=0,this.#h=0,this.#y=R.create(t),this.#n=0,this.#b=0,typeof l=="function"&&(this.#w=l),typeof c=="function"&&(this.#D=c),typeof f=="function"?(this.#S=f,this.#r=[]):(this.#S=void 0,this.#r=void 0),this.#T=!!this.#w,this.#j=!!this.#D,this.#f=!!this.#S,this.noDisposeOnSet=!!g,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!d,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.#u!==0&&!F(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!F(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#X()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!r,this.ttlResolution=F(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!F(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#H()}if(this.#o===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#u){let E="LRU_CACHE_UNBOUNDED";P(E)&&(U.add(E),G("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,u))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#H(){let e=new O(this.#o),t=new O(this.#o);this.#d=e,this.#F=t;let i=this.ttlAutopurge?Array.from({length:this.#o}):void 0;this.#g=i,this.#N=(r,h,l=this.#m.now())=>{t[r]=h!==0?l:0,e[r]=h,s(r,h)},this.#x=r=>{t[r]=e[r]!==0?this.#m.now():0,s(r,e[r])};let s=this.ttlAutopurge?(r,h)=>{if(i?.[r]&&(clearTimeout(i[r]),i[r]=void 0),h&&h!==0&&i){let l=setTimeout(()=>{this.#p(r)&&this.#v(this.#i[r],"expire")},h+1);l.unref&&l.unref(),i[r]=l}}:()=>{};this.#E=(r,h)=>{if(e[h]){let l=e[h],c=t[h];if(!l||!c)return;r.ttl=l,r.start=c,r.now=n||o();let f=r.now-c;r.remainingTTL=l-f}};let n=0,o=()=>{let r=this.#m.now();if(this.ttlResolution>0){n=r;let h=setTimeout(()=>n=0,this.ttlResolution);h.unref&&h.unref()}return r};this.getRemainingTTL=r=>{let h=this.#s.get(r);if(h===void 0)return 0;let l=e[h],c=t[h];if(!l||!c)return 1/0;let f=(n||o())-c;return l-f},this.#p=r=>{let h=t[r],l=e[r];return!!l&&!!h&&(n||o())-h>l}}#x=()=>{};#E=()=>{};#N=()=>{};#p=()=>!1;#X(){let e=new O(this.#o);this.#b=0,this.#_=e,this.#R=t=>{this.#b-=e[t],e[t]=0},this.#k=(t,i,s,n)=>{if(this.#e(i))return 0;if(!F(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,t),!F(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(t,i,s)=>{if(e[t]=i,this.#u){let n=this.#u-e[t];for(;this.#b>n;)this.#G(!0)}this.#b+=e[t],s&&(s.entrySize=i,s.totalCalculatedSize=this.#b)}}#R=e=>{};#I=(e,t,i)=>{};#k=(e,t,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#h;this.#V(t)&&((e||!this.#p(t))&&(yield t),t!==this.#l);)t=this.#c[t]}*#z({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#l;this.#V(t)&&((e||!this.#p(t))&&(yield t),t!==this.#h);)t=this.#a[t]}#V(e){return e!==void 0&&this.#s.get(this.#i[e])===e}*entries(){for(let e of this.#A())this.#t[e]!==void 0&&this.#i[e]!==void 0&&!this.#e(this.#t[e])&&(yield[this.#i[e],this.#t[e]])}*rentries(){for(let e of this.#z())this.#t[e]!==void 0&&this.#i[e]!==void 0&&!this.#e(this.#t[e])&&(yield[this.#i[e],this.#t[e]])}*keys(){for(let e of this.#A()){let t=this.#i[e];t!==void 0&&!this.#e(this.#t[e])&&(yield t)}}*rkeys(){for(let e of this.#z()){let t=this.#i[e];t!==void 0&&!this.#e(this.#t[e])&&(yield t)}}*values(){for(let e of this.#A())this.#t[e]!==void 0&&!this.#e(this.#t[e])&&(yield this.#t[e])}*rvalues(){for(let e of this.#z())this.#t[e]!==void 0&&!this.#e(this.#t[e])&&(yield this.#t[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&e(n,this.#i[i],this))return this.#C(this.#i[i],t)}}forEach(e,t=this){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#i[i],this)}}rforEach(e,t=this){for(let i of this.#z()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#i[i],this)}}purgeStale(){let e=!1;for(let t of this.#z({allowStale:!0}))this.#p(t)&&(this.#v(this.#i[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let i=this.#t[t],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#d&&this.#F){let o=this.#d[t],r=this.#F[t];if(o&&r){let h=o-(this.#m.now()-r);n.ttl=h,n.start=Date.now()}}return this.#_&&(n.size=this.#_[t]),n}dump(){let e=[];for(let t of this.#A({allowStale:!0})){let i=this.#i[t],s=this.#t[t],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let o={value:n};if(this.#d&&this.#F){o.ttl=this.#d[t];let r=this.#m.now()-this.#F[t];o.start=Math.floor(Date.now()-r)}this.#_&&(o.size=this.#_[t]),e.unshift([i,o])}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let s=Date.now()-i.start;i.start=this.#m.now()-s}this.#O(t,i.value,i)}}set(e,t,i={}){let{status:s=S.hasSubscribers?{}:void 0}=i;i.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t));let n=this.#O(e,t,i);return s&&S.hasSubscribers&&S.publish(s),n}#O(e,t,i={}){let{ttl:s=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:r=this.sizeCalculation,status:h}=i;if(t===void 0)return h&&(h.set="deleted"),this.delete(e),this;let{noUpdateTTL:l=this.noUpdateTTL}=i;h&&!this.#e(t)&&(h.value=t);let c=this.#k(e,t,i.size||0,r,h);if(this.maxEntrySize&&c>this.maxEntrySize)return this.#v(e,"set"),h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this;let f=this.#n===0?void 0:this.#s.get(e);if(f===void 0)f=this.#n===0?this.#h:this.#y.length!==0?this.#y.pop():this.#n===this.#o?this.#G(!1):this.#n,this.#i[f]=e,this.#t[f]=t,this.#s.set(e,f),this.#a[this.#h]=f,this.#c[f]=this.#h,this.#h=f,this.#n++,this.#I(f,c,h),h&&(h.set="add"),l=!1,this.#j&&this.#D?.(t,e,"add");else{this.#L(f);let g=this.#t[f];if(t!==g){if(this.#W&&this.#e(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=g;p!==void 0&&!o&&(this.#T&&this.#w?.(p,e,"set"),this.#f&&this.#r?.push([p,e,"set"]))}else o||(this.#T&&this.#w?.(g,e,"set"),this.#f&&this.#r?.push([g,e,"set"]));if(this.#R(f),this.#I(f,c,h),this.#t[f]=t,h){h.set="replace";let p=g&&this.#e(g)?g.__staleWhileFetching:g;p!==void 0&&(h.oldValue=p)}}else h&&(h.set="update");this.#j&&this.onInsert?.(t,e,t===g?"update":"replace")}if(s!==0&&!this.#d&&this.#H(),this.#d&&(l||this.#N(f,s,n),h&&this.#E(h,f)),!o&&this.#f&&this.#r){let g=this.#r,p;for(;p=g?.shift();)this.#S?.(...p)}return this}pop(){try{for(;this.#n;){let e=this.#t[this.#l];if(this.#G(!0),this.#e(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#r){let e=this.#r,t;for(;t=e?.shift();)this.#S?.(...t)}}}#G(e){let t=this.#l,i=this.#i[t],s=this.#t[t];return this.#W&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#T||this.#f)&&(this.#T&&this.#w?.(s,i,"evict"),this.#f&&this.#r?.push([s,i,"evict"])),this.#R(t),this.#g?.[t]&&(clearTimeout(this.#g[t]),this.#g[t]=void 0),e&&(this.#i[t]=void 0,this.#t[t]=void 0,this.#y.push(t)),this.#n===1?(this.#l=this.#h=0,this.#y.length=0):this.#l=this.#a[t],this.#s.delete(i),this.#n--,t}has(e,t={}){let{status:i=S.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="has",i.key=e);let s=this.#Y(e,t);return S.hasSubscribers&&S.publish(i),s}#Y(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=t,n=this.#s.get(e);if(n!==void 0){let o=this.#t[n];if(this.#e(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#p(n))s&&(s.has="stale",this.#E(s,n));else return i&&this.#x(n),s&&(s.has="hit",this.#E(s,n)),!0}else s&&(s.has="miss");return!1}peek(e,t={}){let{status:i=D()?{}:void 0}=t;i&&(i.op="peek",i.key=e),t.status=i;let s=this.#J(e,t);return S.hasSubscribers&&S.publish(i),s}#J(e,t){let{status:i,allowStale:s=this.allowStale}=t,n=this.#s.get(e);if(n===void 0||!s&&this.#p(n)){i&&(i.peek=n===void 0?"miss":"stale");return}let o=this.#t[n],r=this.#e(o)?o.__staleWhileFetching:o;return i&&(r!==void 0?(i.peek="hit",i.value=r):i.peek="miss"),r}#P(e,t,i,s){let n=t===void 0?void 0:this.#t[t];if(this.#e(n))return n;let o=new AbortController,{signal:r}=i;r?.addEventListener("abort",()=>o.abort(r.reason),{signal:o.signal});let h={signal:o.signal,options:i,context:s},l=(w,y=!1)=>{let{aborted:a}=o.signal,m=i.ignoreFetchAbort&&w!==void 0,_=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&w!==void 0);if(i.status&&(a&&!y?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,m&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),a&&!m&&!y)return f(o.signal.reason,_);let b=p,d=this.#t[t];return(d===p||d===void 0&&m&&y)&&(w===void 0?b.__staleWhileFetching!==void 0?this.#t[t]=b.__staleWhileFetching:this.#v(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#O(e,w,h.options))),w},c=w=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=w),f(w,!1)),f=(w,y)=>{let{aborted:a}=o.signal,m=a&&i.allowStaleOnFetchAbort,_=m||i.allowStaleOnFetchRejection,b=_||i.noDeleteOnFetchRejection,d=p;if(this.#t[t]===p&&(!b||!y&&d.__staleWhileFetching===void 0?this.#v(e,"fetch"):m||(this.#t[t]=d.__staleWhileFetching)),_)return i.status&&d.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw w},g=(w,y)=>{let a=this.#M?.(e,n,h);a&&a instanceof Promise&&a.then(m=>w(m===void 0?void 0:m),y),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(w(void 0),i.allowStaleOnFetchAbort&&(w=m=>l(m,!0)))})};i.status&&(i.status.fetchDispatched=!0);let p=new Promise(g).then(l,c),T=Object.assign(p,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return t===void 0?(this.#O(e,T,{...h.options,status:void 0}),t=this.#s.get(e)):this.#t[t]=T,T}#e(e){if(!this.#W)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let i=W.hasSubscribers,{status:s=D()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let n=this.#B(e,t);return s&&D()&&i&&(s.trace=!0,W.tracePromise(()=>n,s).catch(()=>{})),n}async#B(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:r=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=!1,status:a,signal:m}=t;if(a&&(a.op="fetch",a.key=e,y&&(a.forceRefresh=!0)),!this.#W)return a&&(a.fetch="get"),this.#C(e,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:a});let _={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:r,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:T,ignoreFetchAbort:p,status:a,signal:m},b=this.#s.get(e);if(b===void 0){a&&(a.fetch="miss");let d=this.#P(e,b,_,w);return d.__returned=d}else{let d=this.#t[b];if(this.#e(d)){let E=i&&d.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",E&&(a.returnedStale=!0)),E?d.__staleWhileFetching:d.__returned=d}let A=this.#p(b);if(!y&&!A)return a&&(a.fetch="hit"),this.#L(b),s&&this.#x(b),a&&this.#E(a,b),d;let z=this.#P(e,b,_,w),v=z.__staleWhileFetching!==void 0&&i;return a&&(a.fetch=A?"stale":"refresh",v&&A&&(a.returnedStale=!0)),v?z.__staleWhileFetching:z.__returned=z}}forceFetch(e,t={}){let i=W.hasSubscribers,{status:s=D()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let n=this.#K(e,t);return s&&D()&&i&&(s.trace=!0,W.tracePromise(()=>n,s).catch(()=>{})),n}async#K(e,t={}){let i=await this.#B(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let{status:i=S.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="memo",i.key=e,t.context&&(i.context=t.context));let s=this.#Q(e,t);return i&&(i.value=s),S.hasSubscribers&&S.publish(i),s}#Q(e,t={}){let i=this.#U;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,status:n,forceRefresh:o,...r}=t;n&&o&&(n.forceRefresh=!0);let h=this.#C(e,r),l=o||h===void 0;if(n&&(n.memo=l?"miss":"hit",l||(n.value=h)),!l)return h;let c=i(e,h,{options:r,context:s});return n&&(n.value=c),this.#O(e,c,r),c}get(e,t={}){let{status:i=S.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="get",i.key=e);let s=this.#C(e,t);return i&&(s!==void 0&&(i.value=s),S.hasSubscribers&&S.publish(i)),s}#C(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=t,r=this.#s.get(e);if(r===void 0){o&&(o.get="miss");return}let h=this.#t[r],l=this.#e(h);return o&&this.#E(o,r),this.#p(r)?l?(o&&(o.get="stale-fetching"),i&&h.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),h.__staleWhileFetching):void 0):(n||this.#v(e,"expire"),o&&(o.get="stale"),i?(o&&(o.returnedStale=!0),h):void 0):(o&&(o.get=l?"fetching":"hit"),this.#L(r),s&&this.#x(r),l?h.__staleWhileFetching:h)}#$(e,t){this.#c[t]=e,this.#a[e]=t}#L(e){e!==this.#h&&(e===this.#l?this.#l=this.#a[e]:this.#$(this.#c[e],this.#a[e]),this.#$(this.#h,e),this.#h=e)}delete(e){return this.#v(e,"delete")}#v(e,t){S.hasSubscribers&&S.publish({op:"delete",delete:t,key:e});let i=!1;if(this.#n!==0){let s=this.#s.get(e);if(s!==void 0)if(this.#g?.[s]&&(clearTimeout(this.#g?.[s]),this.#g[s]=void 0),i=!0,this.#n===1)this.#q(t);else{this.#R(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#T||this.#f)&&(this.#T&&this.#w?.(n,e,t),this.#f&&this.#r?.push([n,e,t])),this.#s.delete(e),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#h)this.#h=this.#c[s];else if(s===this.#l)this.#l=this.#a[s];else{let o=this.#c[s];this.#a[o]=this.#a[s];let r=this.#a[s];this.#c[r]=this.#c[s]}this.#n--,this.#y.push(s)}}if(this.#f&&this.#r?.length){let s=this.#r,n;for(;n=s?.shift();)this.#S?.(...n)}return i}clear(){return this.#q("delete")}#q(e){for(let t of this.#z({allowStale:!0})){let i=this.#t[t];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#i[t];this.#T&&this.#w?.(i,s,e),this.#f&&this.#r?.push([i,s,e])}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#d&&this.#F){this.#d.fill(0),this.#F.fill(0);for(let t of this.#g??[])t!==void 0&&clearTimeout(t);this.#g?.fill(void 0)}if(this.#_&&this.#_.fill(0),this.#l=0,this.#h=0,this.#y.length=0,this.#b=0,this.#n=0,this.#f&&this.#r){let t=this.#r,i;for(;i=t?.shift();)this.#S?.(...i)}}};export{M as LRUCache};
2
+ //# sourceMappingURL=index.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics-channel-esm.d.mts","sourceRoot":"","sources":["../../src/diagnostics-channel-esm.mts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,CAAA;AAavC,eAAO,IAAI,OAAO,EAAY,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9C,eAAO,IAAI,OAAO,EAAY,cAAc,CAAC,OAAO,CAAC,CAAA"}
1
+ {"version":3,"file":"diagnostics-channel-esm.d.mts","sourceRoot":"","sources":["../../src/diagnostics-channel-esm.mts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,CAAA;AAavC,eAAO,IAAI,OAAO,EAAY,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9C,eAAO,IAAI,OAAO,EAAY,cAAc,CAAC,OAAO,CAAC,CAAA"}
@@ -5,7 +5,7 @@
5
5
  * and tracing will be missed, but that probably doesn't matter much.
6
6
  */
7
7
  // conditionally import from diagnostic_channel, fall back to dummyfill
8
- // all we actually have to mock is the hasSubscribers, since we alwasy check
8
+ // all we actually have to mock is the hasSubscribers, since we always check
9
9
  /* v8 ignore next */
10
10
  const dummy = { hasSubscribers: false };
11
11
  export let metrics = dummy;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lru-cache",
3
3
  "description": "A cache object that deletes the least-recently-used items.",
4
- "version": "11.3.3",
4
+ "version": "11.3.5",
5
5
  "author": "Isaac Z. Schlueter <i@izs.me>",
6
6
  "keywords": [
7
7
  "mru",
@@ -34,7 +34,8 @@
34
34
  "types": "./dist/commonjs/index.d.ts",
35
35
  "tshy": {
36
36
  "esmDialects": [
37
- "node"
37
+ "node",
38
+ "browser"
38
39
  ],
39
40
  "exports": {
40
41
  "./raw": "./src/index.ts",
@@ -44,6 +45,10 @@
44
45
  "types": "./dist/esm/node/index.d.ts",
45
46
  "default": "./dist/esm/node/index.min.js"
46
47
  },
48
+ "browser": {
49
+ "types": "./dist/esm/browser/index.d.ts",
50
+ "default": "./dist/esm/browser/index.min.js"
51
+ },
47
52
  "types": "./dist/esm/index.d.ts",
48
53
  "default": "./dist/esm/index.min.js"
49
54
  },
@@ -85,6 +90,10 @@
85
90
  "types": "./dist/esm/node/index.d.ts",
86
91
  "default": "./dist/esm/node/index.js"
87
92
  },
93
+ "browser": {
94
+ "types": "./dist/esm/browser/index.d.ts",
95
+ "default": "./dist/esm/browser/index.js"
96
+ },
88
97
  "types": "./dist/esm/index.d.ts",
89
98
  "default": "./dist/esm/index.js"
90
99
  },
@@ -99,6 +108,10 @@
99
108
  "types": "./dist/esm/node/index.d.ts",
100
109
  "default": "./dist/esm/node/index.min.js"
101
110
  },
111
+ "browser": {
112
+ "types": "./dist/esm/browser/index.d.ts",
113
+ "default": "./dist/esm/browser/index.min.js"
114
+ },
102
115
  "types": "./dist/esm/index.d.ts",
103
116
  "default": "./dist/esm/index.min.js"
104
117
  },
@@ -1644,12 +1644,25 @@ async function httpNetworkOrCacheFetch (
1644
1644
  // 14. If response’s status is 401, httpRequest’s response tainting is not "cors",
1645
1645
  // includeCredentials is true, and request’s traversable for user prompts is
1646
1646
  // a traversable navigable:
1647
- if (response.status === 401 && httpRequest.responseTainting !== 'cors' && includeCredentials && isTraversableNavigable(request.traversableForUserPrompts)) {
1647
+ //
1648
+ // In Node.js there is no traversable navigable to prompt the user, but we
1649
+ // still need to handle URL-embedded credentials so authentication retries
1650
+ // for WebSocket handshakes continue to work.
1651
+ if (response.status === 401 && httpRequest.responseTainting !== 'cors' && includeCredentials && (
1652
+ request.useURLCredentials !== undefined ||
1653
+ isTraversableNavigable(request.traversableForUserPrompts)
1654
+ )) {
1648
1655
  // 2. If request’s body is non-null, then:
1649
1656
  if (request.body != null) {
1650
1657
  // 1. If request’s body’s source is null, then return a network error.
1651
1658
  if (request.body.source == null) {
1652
- return makeNetworkError('expected non-null body source')
1659
+ // Note: In Node.js, this code path should not be reached because
1660
+ // isTraversableNavigable() returns false for non-navigable contexts.
1661
+ // However, we handle it gracefully by returning the response instead of
1662
+ // a network error, as we won't actually retry the request.
1663
+ // This aligns with the Fetch spec discussion in whatwg/fetch#1132,
1664
+ // which allows implementations flexibility when credentials can't be obtained.
1665
+ return response
1653
1666
  }
1654
1667
 
1655
1668
  // 2. Set request’s body to the body of the result of safely extracting
@@ -1447,8 +1447,10 @@ function includesCredentials (url) {
1447
1447
  * @param {object|string} navigable
1448
1448
  */
1449
1449
  function isTraversableNavigable (navigable) {
1450
- // TODO
1451
- return true
1450
+ // Returns true only if we have an actual traversable navigable object
1451
+ // that can prompt the user for credentials. In Node.js, this will always
1452
+ // be false since there's no Window object or navigable.
1453
+ return navigable != null && navigable !== 'client' && navigable !== 'no-traversable'
1452
1454
  }
1453
1455
 
1454
1456
  class EnvironmentSettingsObjectBase {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "7.24.7",
3
+ "version": "7.24.8",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -0,0 +1,36 @@
1
+ // noop 替代 @mariozechner/clipboard — 原生剪贴板绑定的空实现
2
+ // pi-coding-agent 中通过 try/catch 动态加载此包,加载失败会降级为 null,不影响运行。
3
+
4
+ function noop() {
5
+ return null;
6
+ }
7
+ function noopBool() {
8
+ return false;
9
+ }
10
+ function noopString() {
11
+ return "";
12
+ }
13
+ function noopArray() {
14
+ return [];
15
+ }
16
+
17
+ module.exports = {
18
+ availableFormats: noopArray,
19
+ getText: noopString,
20
+ setText: noop,
21
+ hasText: noopBool,
22
+ getImageBinary: noop,
23
+ getImageBase64: noopString,
24
+ setImageBinary: noop,
25
+ setImageBase64: noop,
26
+ hasImage: noopBool,
27
+ getHtml: noopString,
28
+ setHtml: noop,
29
+ hasHtml: noopBool,
30
+ getRtf: noopString,
31
+ setRtf: noop,
32
+ hasRtf: noopBool,
33
+ clear: noop,
34
+ watch: noop,
35
+ callThreadsafeFunction: noop,
36
+ };
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@qqbrowser/clipboard-noop",
3
+ "version": "0.3.2",
4
+ "description": "Empty replacement for @mariozechner/clipboard to reduce install size. The native clipboard binding is only used for reading clipboard images in pi-coding-agent interactive mode.",
5
+ "keywords": [
6
+ "clipboard",
7
+ "noop",
8
+ "placeholder"
9
+ ],
10
+ "license": "MIT",
11
+ "main": "index.js",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org"
15
+ }
16
+ }
@@ -0,0 +1,51 @@
1
+ // noop 替代 @snazzah/davey — DAVE 协议原生绑定的空实现
2
+ // 当 daveEncryption 被禁用时,@discordjs/voice 不会实际创建 DAVESession,
3
+ // 但它仍然会在顶层 require("@snazzah/davey"),所以需要导出兼容的接口。
4
+
5
+ const Codec = Object.freeze({});
6
+ const MediaType = Object.freeze({});
7
+ const SessionStatus = Object.freeze({});
8
+ const ProposalsOperationType = Object.freeze({});
9
+
10
+ const DAVE_PROTOCOL_VERSION = 0;
11
+ const VERSION = "0.0.0-noop";
12
+ const DEBUG_BUILD = false;
13
+
14
+ function generateKeyFingerprint() {
15
+ return "";
16
+ }
17
+ function generatePairwiseFingerprint() {
18
+ return "";
19
+ }
20
+ function generateDisplayableCode() {
21
+ return "";
22
+ }
23
+ function generateP256Keypair() {
24
+ return { publicKey: Buffer.alloc(0), privateKey: Buffer.alloc(0) };
25
+ }
26
+
27
+ class DAVESession {
28
+ constructor() {
29
+ throw new Error(
30
+ "@snazzah/davey has been replaced by a noop package. Set daveEncryption: false in your config.",
31
+ );
32
+ }
33
+ }
34
+
35
+ const DaveSession = DAVESession;
36
+
37
+ module.exports = {
38
+ Codec,
39
+ MediaType,
40
+ SessionStatus,
41
+ ProposalsOperationType,
42
+ DAVE_PROTOCOL_VERSION,
43
+ VERSION,
44
+ DEBUG_BUILD,
45
+ generateKeyFingerprint,
46
+ generatePairwiseFingerprint,
47
+ generateDisplayableCode,
48
+ generateP256Keypair,
49
+ DAVESession,
50
+ DaveSession,
51
+ };
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@qqbrowser/davey-noop",
3
+ "version": "0.1.11",
4
+ "description": "Empty replacement for @snazzah/davey to reduce install size. The DAVE protocol native binary is not needed when daveEncryption is disabled.",
5
+ "keywords": [
6
+ "dave",
7
+ "davey",
8
+ "noop",
9
+ "placeholder"
10
+ ],
11
+ "license": "MIT",
12
+ "main": "index.js",
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "registry": "https://registry.npmjs.org"
16
+ }
17
+ }
@@ -0,0 +1 @@
1
+ module.exports = {};
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@qqbrowser/koffi-noop",
3
+ "version": "2.9.0",
4
+ "description": "Empty replacement for koffi to reduce install size. koffi is only needed on Windows for Shift+Tab detection in @mariozechner/pi-tui.",
5
+ "keywords": [
6
+ "koffi",
7
+ "noop",
8
+ "placeholder"
9
+ ],
10
+ "license": "MIT",
11
+ "main": "index.js",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org"
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qqbrowser/openclaw-qbot",
3
- "version": "0.0.147",
3
+ "version": "0.0.148",
4
4
  "description": "Multi-channel AI gateway with extensible messaging integrations",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/openclaw/openclaw#readme",
@@ -32,6 +32,7 @@
32
32
  "dist/",
33
33
  "docs/reference/",
34
34
  "extensions/",
35
+ "noop-pkg/",
35
36
  "skills/"
36
37
  ],
37
38
  "type": "module",
@@ -353,6 +354,7 @@
353
354
  "@grammyjs/runner": "^2.0.3",
354
355
  "@grammyjs/transformer-throttler": "^1.2.1",
355
356
  "@line/bot-sdk": "^10.6.0",
357
+ "@mariozechner/clipboard": "file:noop-pkg/clipboard-noop",
356
358
  "@mariozechner/pi-agent-core": "0.57.1",
357
359
  "@mariozechner/pi-ai": "0.57.1",
358
360
  "@mariozechner/pi-coding-agent": "0.57.1",
@@ -374,6 +376,7 @@
374
376
  "@sinclair/typebox": "0.34.48",
375
377
  "@slack/bolt": "^4.6.0",
376
378
  "@slack/web-api": "^7.14.1",
379
+ "@snazzah/davey": "file:noop-pkg/davey-noop",
377
380
  "@whiskeysockets/baileys": "npm:@qqbrowser/baileys-no-git@7.0.0-rc.9",
378
381
  "ajv": "^8.18.0",
379
382
  "chalk": "^5.6.2",
@@ -392,7 +395,7 @@
392
395
  "jiti": "^2.6.1",
393
396
  "json5": "^2.2.3",
394
397
  "jszip": "^3.10.1",
395
- "koffi": "npm:@qqbrowser/koffi-noop@^2.9.0",
398
+ "koffi": "file:noop-pkg/koffi-noop",
396
399
  "libsignal": "2.0.1",
397
400
  "linkedom": "^0.18.12",
398
401
  "long": "^5.3.2",
@@ -459,6 +462,7 @@
459
462
  "@grammyjs/runner",
460
463
  "@grammyjs/transformer-throttler",
461
464
  "@line/bot-sdk",
465
+ "@mariozechner/clipboard",
462
466
  "@mariozechner/pi-agent-core",
463
467
  "@mariozechner/pi-ai",
464
468
  "@mariozechner/pi-coding-agent",
@@ -480,6 +484,7 @@
480
484
  "@sinclair/typebox",
481
485
  "@slack/bolt",
482
486
  "@slack/web-api",
487
+ "@snazzah/davey",
483
488
  "@whiskeysockets/baileys",
484
489
  "ajv",
485
490
  "chalk",
@@ -533,7 +538,10 @@
533
538
  "node-domexception": "npm:@nolyfill/domexception@^1.0.28",
534
539
  "@sinclair/typebox": "0.34.48",
535
540
  "tar": "7.5.11",
536
- "tough-cookie": "4.1.3"
541
+ "tough-cookie": "4.1.3",
542
+ "@snazzah/davey": "file:noop-pkg/davey-noop",
543
+ "@mariozechner/clipboard": "file:noop-pkg/clipboard-noop",
544
+ "koffi": "file:noop-pkg/koffi-noop"
537
545
  },
538
546
  "onlyBuiltDependencies": [
539
547
  "@lydell/node-pty",
@@ -1 +0,0 @@
1
- nodeLinker: node-modules
@@ -1,26 +0,0 @@
1
- [package]
2
- edition = "2021"
3
- name = "crosscopy_clipboard"
4
- version = "0.0.0"
5
-
6
- [lib]
7
- crate-type = ["cdylib"]
8
-
9
- [dependencies]
10
- base64 = "0.22.0"
11
- clipboard-rs = "0.2.4"
12
- futures = "0.3.30"
13
- # Pin image to version compatible with older Rust in CI Docker images
14
- image = "=0.25.5"
15
- # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
16
- napi = { version = "2.12.2", default-features = false, features = ["napi4", "tokio_rt"] }
17
- napi-derive = "2.12.2"
18
- tokio = "1.36.0"
19
-
20
- [build-dependencies]
21
- # Pin to version that works with older Rust in Docker images
22
- napi-build = "=2.1.3"
23
-
24
- [profile.release]
25
- lto = true
26
- strip = "symbols"
@@ -1,5 +0,0 @@
1
- extern crate napi_build;
2
-
3
- fn main() {
4
- napi_build::setup();
5
- }
@@ -1,191 +0,0 @@
1
- #![deny(clippy::all)]
2
- use base64::{engine::general_purpose, Engine as _};
3
- use clipboard_rs::{
4
- common::RustImage, Clipboard, ClipboardContext, ClipboardHandler, ClipboardWatcher,
5
- ClipboardWatcherContext, ContentFormat, RustImageData,
6
- };
7
- use napi::{
8
- bindgen_prelude::*,
9
- threadsafe_function::{ErrorStrategy, ThreadsafeFunction, ThreadsafeFunctionCallMode},
10
- JsFunction,
11
- };
12
- use std::{thread, time::Duration};
13
-
14
- #[macro_use]
15
- extern crate napi_derive;
16
-
17
- #[napi]
18
- pub fn available_formats() -> Vec<String> {
19
- let ctx = ClipboardContext::new().unwrap();
20
- let types = ctx.available_formats().unwrap();
21
- types
22
- }
23
-
24
- #[napi]
25
- pub async fn get_text() -> String {
26
- let ctx = ClipboardContext::new().unwrap();
27
- ctx.get_text().unwrap()
28
- }
29
-
30
- #[napi]
31
- pub async fn set_text(text: String) {
32
- let ctx = ClipboardContext::new().unwrap();
33
- ctx.set_text(text).unwrap()
34
- }
35
-
36
- #[napi]
37
- pub fn has_text() -> bool {
38
- let ctx = ClipboardContext::new().unwrap();
39
- ctx.has(ContentFormat::Text)
40
- }
41
-
42
- #[napi]
43
- pub async fn get_image_binary() -> Vec<u8> {
44
- let ctx = ClipboardContext::new().unwrap();
45
- let image = ctx.get_image().unwrap();
46
- let image_bytes = image.to_png().unwrap().get_bytes().to_vec();
47
- image_bytes
48
- }
49
-
50
- #[napi]
51
- pub async fn get_image_base64() -> String {
52
- let image_bytes = get_image_binary().await;
53
- let base64_str = general_purpose::STANDARD_NO_PAD.encode(&image_bytes);
54
- base64_str
55
- }
56
-
57
- #[napi]
58
- pub async fn set_image_binary(image_bytes: Vec<u8>) {
59
- let ctx = ClipboardContext::new().unwrap();
60
- let img = RustImageData::from_bytes(&image_bytes).unwrap();
61
- ctx.set_image(img).unwrap()
62
- }
63
-
64
- #[napi]
65
- pub async fn set_image_base64(base64_str: String) {
66
- let decoded: Vec<u8> = general_purpose::STANDARD_NO_PAD.decode(base64_str).unwrap();
67
- set_image_binary(decoded).await;
68
- }
69
-
70
- #[napi]
71
- pub fn has_image() -> bool {
72
- let ctx = ClipboardContext::new().unwrap();
73
- ctx.has(ContentFormat::Image)
74
- }
75
-
76
- #[napi]
77
- pub async fn get_html() -> String {
78
- let ctx = ClipboardContext::new().unwrap();
79
- ctx.get_html().unwrap()
80
- }
81
-
82
- #[napi]
83
- pub async fn set_html(html: String) {
84
- let ctx = ClipboardContext::new().unwrap();
85
- ctx.set_html(html).unwrap()
86
- }
87
-
88
- #[napi]
89
- fn has_html() -> bool {
90
- let ctx = ClipboardContext::new().unwrap();
91
- ctx.has(ContentFormat::Html)
92
- }
93
-
94
- #[napi]
95
- pub async fn get_rtf() -> String {
96
- let ctx = ClipboardContext::new().unwrap();
97
- ctx.get_rich_text().unwrap()
98
- }
99
-
100
- #[napi]
101
- pub async fn set_rtf(rtf: String) {
102
- let ctx = ClipboardContext::new().unwrap();
103
- ctx.set_rich_text(rtf).unwrap()
104
- }
105
-
106
- #[napi]
107
- pub fn has_rtf() -> bool {
108
- let ctx = ClipboardContext::new().unwrap();
109
- ctx.has(ContentFormat::Rtf)
110
- }
111
-
112
- #[napi]
113
- pub async fn clear() {
114
- let ctx = ClipboardContext::new().unwrap();
115
- ctx.clear().unwrap()
116
- }
117
-
118
- struct Manager {
119
- ctx: ClipboardContext,
120
- }
121
-
122
- impl Manager {
123
- pub fn new() -> Self {
124
- let ctx = ClipboardContext::new().unwrap();
125
- Manager { ctx }
126
- }
127
- }
128
-
129
- impl ClipboardHandler for Manager {
130
- fn on_clipboard_change(&mut self) {
131
- println!(
132
- "on_clipboard_change, txt = {}",
133
- self.ctx.get_text().unwrap()
134
- );
135
- }
136
- }
137
-
138
- #[napi]
139
- pub fn watch() {
140
- let manager = Manager::new();
141
-
142
- let mut watcher = ClipboardWatcherContext::new().unwrap();
143
-
144
- let watcher_shutdown = watcher.add_handler(manager).get_shutdown_channel();
145
-
146
- thread::spawn(move || {
147
- thread::sleep(Duration::from_secs(5));
148
- println!("stop watch!");
149
- watcher_shutdown.stop();
150
- });
151
-
152
- println!("start watch!");
153
- watcher.start_watch();
154
- }
155
-
156
- #[napi]
157
- pub fn call_threadsafe_function(callback: JsFunction) -> Result<()> {
158
- let tsfn: ThreadsafeFunction<u32, ErrorStrategy::CalleeHandled> = callback
159
- .create_threadsafe_function(0, |ctx| {
160
- ctx.env.create_uint32(ctx.value + 1).map(|v| vec![v])
161
- })?;
162
- for n in 0..10 {
163
- let tsfn = tsfn.clone();
164
- thread::spawn(move || {
165
- tsfn.call(Ok(n), ThreadsafeFunctionCallMode::Blocking);
166
- });
167
- }
168
- Ok(())
169
- }
170
-
171
- // #[js_function(1)]
172
- // fn hello(ctx: CallContext) -> Result<JsString, String> {
173
- // let argument_one = ctx
174
- // .get::<JsString>(0)
175
- // .map_err(|err| err.to_string())?
176
- // .into_utf8()
177
- // .map_err(|err| err.to_string())?;
178
- // ctx
179
- // .env
180
- // .create_string_from_std(format!("{} world!", argument_one.as_str()?))
181
- // }
182
-
183
- #[cfg(test)]
184
- mod tests {
185
- use super::*;
186
-
187
- #[test]
188
- fn it_works() {
189
- watch();
190
- }
191
- }
@@ -1,22 +0,0 @@
1
- {
2
- "name": "@mariozechner/clipboard-darwin-arm64",
3
- "version": "0.3.2",
4
- "os": [
5
- "darwin"
6
- ],
7
- "cpu": [
8
- "arm64"
9
- ],
10
- "main": "clipboard.darwin-arm64.node",
11
- "files": [
12
- "clipboard.darwin-arm64.node"
13
- ],
14
- "license": "MIT",
15
- "engines": {
16
- "node": ">= 10"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "https://github.com/badlogic/clipboard.git"
21
- }
22
- }
@@ -1,19 +0,0 @@
1
- {
2
- "name": "@mariozechner/clipboard-darwin-universal",
3
- "version": "0.3.2",
4
- "os": [
5
- "darwin"
6
- ],
7
- "main": "clipboard.darwin-universal.node",
8
- "files": [
9
- "clipboard.darwin-universal.node"
10
- ],
11
- "license": "MIT",
12
- "engines": {
13
- "node": ">= 10"
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/badlogic/clipboard.git"
18
- }
19
- }