@dcrays/dcgchat-test 0.5.14 → 0.5.16
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/index.js +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -283,7 +283,7 @@ ${t.join(`
|
|
|
283
283
|
`)},t=function(){return new j.PromiseInspection(this._target())},r=function(R){return j.reject(new S(R))};function n(){}var i={},s=$e();s.setReflectHandler(t);var o=function(){var R=process.domain;return R===void 0?null:R},a=function(){return null},c=function(){return{domain:o(),async:null}},u=s.isNode&&s.nodeSupportsAsyncResource?H("async_hooks").AsyncResource:null,l=function(){return{domain:o(),async:new u("Bluebird::Promise")}},f=s.isNode?c:a;s.notEnumerableProp(j,"_getContext",f);var p=function(){f=l,s.notEnumerableProp(j,"_getContext",l)},d=function(){f=c,s.notEnumerableProp(j,"_getContext",c)},h=yi(),m=E6(),y=new m;h.defineProperty(j,"_async",{value:y});var E=Dn(),S=j.TypeError=E.TypeError;j.RangeError=E.RangeError;var b=j.CancellationError=E.CancellationError;j.TimeoutError=E.TimeoutError,j.OperationalError=E.OperationalError,j.RejectionError=E.OperationalError,j.AggregateError=E.AggregateError;var g=function(){},v={},k={},P=A6()(j,g),T=R6()(j,g,P,r,n),_=P6()(j),O=_.create,I=N6()(j,_,p,d),N=I.CapturedTrace,q=M6()(j,P,k),G=qb()(k),A=Pb(),K=s.errorObj,J=s.tryCatch;function te(R,B){if(R==null||R.constructor!==j)throw new S(`the promise constructor cannot be invoked directly
|
|
284
284
|
|
|
285
285
|
See http://goo.gl/MqrFmX
|
|
286
|
-
`);if(typeof B!="function")throw new S("expecting a function but got "+s.classString(B))}function j(R){R!==g&&te(this,R),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(R),this._promiseCreated(),this._fireEvent("promiseCreated",this)}j.prototype.toString=function(){return"[object Promise]"},j.prototype.caught=j.prototype.catch=function(R){var B=arguments.length;if(B>1){var W=new Array(B-1),Y=0,D;for(D=0;D<B-1;++D){var ce=arguments[D];if(s.isObject(ce))W[Y++]=ce;else return r("Catch statement predicate: expecting an object but got "+s.classString(ce))}if(W.length=Y,R=arguments[D],typeof R!="function")throw new S("The last argument to .catch() must be a function, got "+s.toString(R));return this.then(void 0,G(W,R,this))}return this.then(void 0,R)},j.prototype.reflect=function(){return this._then(t,t,void 0,this,void 0)},j.prototype.then=function(R,B){if(I.warnings()&&arguments.length>0&&typeof R!="function"&&typeof B!="function"){var W=".then() only accepts functions but was passed: "+s.classString(R);arguments.length>1&&(W+=", "+s.classString(B)),this._warn(W)}return this._then(R,B,void 0,void 0,void 0)},j.prototype.done=function(R,B){var W=this._then(R,B,void 0,void 0,void 0);W._setIsFinal()},j.prototype.spread=function(R){return typeof R!="function"?r("expecting a function but got "+s.classString(R)):this.all()._then(R,void 0,void 0,v,void 0)},j.prototype.toJSON=function(){var R={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(R.fulfillmentValue=this.value(),R.isFulfilled=!0):this.isRejected()&&(R.rejectionReason=this.reason(),R.isRejected=!0),R},j.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new T(this).promise()},j.prototype.error=function(R){return this.caught(s.originatesFromRejection,R)},j.getNewLibraryCopy=jb.exports,j.is=function(R){return R instanceof j},j.fromNode=j.fromCallback=function(R){var B=new j(g);B._captureStackTrace();var W=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,Y=J(R)(A(B,W));return Y===K&&B._rejectCallback(Y.e,!0),B._isFateSealed()||B._setAsyncGuaranteed(),B},j.all=function(R){return new T(R).promise()},j.cast=function(R){var B=P(R);return B instanceof j||(B=new j(g),B._captureStackTrace(),B._setFulfilled(),B._rejectionHandler0=R),B},j.resolve=j.fulfilled=j.cast,j.reject=j.rejected=function(R){var B=new j(g);return B._captureStackTrace(),B._rejectCallback(R,!0),B},j.setScheduler=function(R){if(typeof R!="function")throw new S("expecting a function but got "+s.classString(R));return y.setScheduler(R)},j.prototype._then=function(R,B,W,Y,D){var ce=D!==void 0,ae=ce?D:new j(g),de=this._target(),C=de._bitField;ce||(ae._propagateFrom(this,3),ae._captureStackTrace(),Y===void 0&&(this._bitField&2097152)!==0&&((C&50397184)!==0?Y=this._boundValue():Y=de===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,ae));var x=f();if((C&50397184)!==0){var V,F,Q=de._settlePromiseCtx;(C&33554432)!==0?(F=de._rejectionHandler0,V=R):(C&16777216)!==0?(F=de._fulfillmentHandler0,V=B,de._unsetRejectionIsUnhandled()):(Q=de._settlePromiseLateCancellationObserver,F=new b("late cancellation observer"),de._attachExtraTrace(F),V=B),y.invoke(Q,de,{handler:s.contextBind(x,V),promise:ae,receiver:Y,value:F})}else de._addCallbacks(R,B,ae,Y,x);return ae},j.prototype._length=function(){return this._bitField&65535},j.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},j.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},j.prototype._setLength=function(R){this._bitField=this._bitField&-65536|R&65535},j.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},j.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},j.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},j.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},j.prototype._isFinal=function(){return(this._bitField&4194304)>0},j.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},j.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},j.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},j.prototype._setAsyncGuaranteed=function(){if(!y.hasCustomScheduler()){var R=this._bitField;this._bitField=R|(R&536870912)>>2^134217728}},j.prototype._setNoAsyncGuarantee=function(){this._bitField=(this._bitField|536870912)&-134217729},j.prototype._receiverAt=function(R){var B=R===0?this._receiver0:this[R*4-4+3];if(B!==i)return B===void 0&&this._isBound()?this._boundValue():B},j.prototype._promiseAt=function(R){return this[R*4-4+2]},j.prototype._fulfillmentHandlerAt=function(R){return this[R*4-4+0]},j.prototype._rejectionHandlerAt=function(R){return this[R*4-4+1]},j.prototype._boundValue=function(){},j.prototype._migrateCallback0=function(R){var B=R._bitField,W=R._fulfillmentHandler0,Y=R._rejectionHandler0,D=R._promise0,ce=R._receiverAt(0);ce===void 0&&(ce=i),this._addCallbacks(W,Y,D,ce,null)},j.prototype._migrateCallbackAt=function(R,B){var W=R._fulfillmentHandlerAt(B),Y=R._rejectionHandlerAt(B),D=R._promiseAt(B),ce=R._receiverAt(B);ce===void 0&&(ce=i),this._addCallbacks(W,Y,D,ce,null)},j.prototype._addCallbacks=function(R,B,W,Y,D){var ce=this._length();if(ce>=65531&&(ce=0,this._setLength(0)),ce===0)this._promise0=W,this._receiver0=Y,typeof R=="function"&&(this._fulfillmentHandler0=s.contextBind(D,R)),typeof B=="function"&&(this._rejectionHandler0=s.contextBind(D,B));else{var ae=ce*4-4;this[ae+2]=W,this[ae+3]=Y,typeof R=="function"&&(this[ae+0]=s.contextBind(D,R)),typeof B=="function"&&(this[ae+1]=s.contextBind(D,B))}return this._setLength(ce+1),ce},j.prototype._proxy=function(R,B){this._addCallbacks(void 0,void 0,B,R,null)},j.prototype._resolveCallback=function(R,B){if((this._bitField&117506048)===0){if(R===this)return this._rejectCallback(e(),!1);var W=P(R,this);if(!(W instanceof j))return this._fulfill(R);B&&this._propagateFrom(W,2);var Y=W._target();if(Y===this){this._reject(e());return}var D=Y._bitField;if((D&50397184)===0){var ce=this._length();ce>0&&Y._migrateCallback0(this);for(var ae=1;ae<ce;++ae)Y._migrateCallbackAt(this,ae);this._setFollowing(),this._setLength(0),this._setFollowee(W)}else if((D&33554432)!==0)this._fulfill(Y._value());else if((D&16777216)!==0)this._reject(Y._reason());else{var de=new b("late cancellation observer");Y._attachExtraTrace(de),this._reject(de)}}},j.prototype._rejectCallback=function(R,B,W){var Y=s.ensureErrorObject(R),D=Y===R;if(!D&&!W&&I.warnings()){var ce="a promise was rejected with a non-error: "+s.classString(R);this._warn(ce,!0)}this._attachExtraTrace(Y,B?D:!1),this._reject(R)},j.prototype._resolveFromExecutor=function(R){if(R!==g){var B=this;this._captureStackTrace(),this._pushContext();var W=!0,Y=this._execute(R,function(D){B._resolveCallback(D)},function(D){B._rejectCallback(D,W)});W=!1,this._popContext(),Y!==void 0&&B._rejectCallback(Y,!0)}},j.prototype._settlePromiseFromHandler=function(R,B,W,Y){var D=Y._bitField;if((D&65536)===0){Y._pushContext();var ce;B===v?!W||typeof W.length!="number"?(ce=K,ce.e=new S("cannot .spread() a non-array: "+s.classString(W))):ce=J(R).apply(this._boundValue(),W):ce=J(R).call(B,W);var ae=Y._popContext();D=Y._bitField,(D&65536)===0&&(ce===k?Y._reject(W):ce===K?Y._rejectCallback(ce.e,!1):(I.checkForgottenReturns(ce,ae,"",Y,this),Y._resolveCallback(ce)))}},j.prototype._target=function(){for(var R=this;R._isFollowing();)R=R._followee();return R},j.prototype._followee=function(){return this._rejectionHandler0},j.prototype._setFollowee=function(R){this._rejectionHandler0=R},j.prototype._settlePromise=function(R,B,W,Y){var D=R instanceof j,ce=this._bitField,ae=(ce&134217728)!==0;(ce&65536)!==0?(D&&R._invokeInternalOnCancel(),W instanceof q&&W.isFinallyHandler()?(W.cancelPromise=R,J(B).call(W,Y)===K&&R._reject(K.e)):B===t?R._fulfill(t.call(W)):W instanceof n?W._promiseCancelled(R):D||R instanceof T?R._cancel():W.cancel()):typeof B=="function"?D?(ae&&R._setAsyncGuaranteed(),this._settlePromiseFromHandler(B,W,Y,R)):B.call(W,Y,R):W instanceof n?W._isResolved()||((ce&33554432)!==0?W._promiseFulfilled(Y,R):W._promiseRejected(Y,R)):D&&(ae&&R._setAsyncGuaranteed(),(ce&33554432)!==0?R._fulfill(Y):R._reject(Y))},j.prototype._settlePromiseLateCancellationObserver=function(R){var B=R.handler,W=R.promise,Y=R.receiver,D=R.value;typeof B=="function"?W instanceof j?this._settlePromiseFromHandler(B,Y,D,W):B.call(Y,D,W):W instanceof j&&W._reject(D)},j.prototype._settlePromiseCtx=function(R){this._settlePromise(R.promise,R.handler,R.receiver,R.value)},j.prototype._settlePromise0=function(R,B,W){var Y=this._promise0,D=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(Y,R,D,B)},j.prototype._clearCallbackDataAtIndex=function(R){var B=R*4-4;this[B+2]=this[B+3]=this[B+0]=this[B+1]=void 0},j.prototype._fulfill=function(R){var B=this._bitField;if(!((B&117506048)>>>16)){if(R===this){var W=e();return this._attachExtraTrace(W),this._reject(W)}this._setFulfilled(),this._rejectionHandler0=R,(B&65535)>0&&((B&134217728)!==0?this._settlePromises():y.settlePromises(this),this._dereferenceTrace())}},j.prototype._reject=function(R){var B=this._bitField;if(!((B&117506048)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=R,this._isFinal())return y.fatalError(R,s.isNode);(B&65535)>0?y.settlePromises(this):this._ensurePossibleRejectionHandled()}},j.prototype._fulfillPromises=function(R,B){for(var W=1;W<R;W++){var Y=this._fulfillmentHandlerAt(W),D=this._promiseAt(W),ce=this._receiverAt(W);this._clearCallbackDataAtIndex(W),this._settlePromise(D,Y,ce,B)}},j.prototype._rejectPromises=function(R,B){for(var W=1;W<R;W++){var Y=this._rejectionHandlerAt(W),D=this._promiseAt(W),ce=this._receiverAt(W);this._clearCallbackDataAtIndex(W),this._settlePromise(D,Y,ce,B)}},j.prototype._settlePromises=function(){var R=this._bitField,B=R&65535;if(B>0){if((R&16842752)!==0){var W=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,W,R),this._rejectPromises(B,W)}else{var Y=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,Y,R),this._fulfillPromises(B,Y)}this._setLength(0)}this._clearCancellationData()},j.prototype._settledValue=function(){var R=this._bitField;if((R&33554432)!==0)return this._rejectionHandler0;if((R&16777216)!==0)return this._fulfillmentHandler0},typeof Symbol<"u"&&Symbol.toStringTag&&h.defineProperty(j.prototype,Symbol.toStringTag,{get:function(){return"Object"}});function re(R){this.promise._resolveCallback(R)}function z(R){this.promise._rejectCallback(R,!1)}j.defer=j.pending=function(){I.deprecated("Promise.defer","new Promise");var R=new j(g);return{promise:R,resolve:re,reject:z}},s.notEnumerableProp(j,"_makeSelfResolutionError",e),z6()(j,g,P,r,I),W6()(j,g,P,I),G6()(j,T,r,I),X6()(j),Y6()(j),Z6()(j,T,P,g,y),j.Promise=j,j.version="3.7.2",tN()(j),nN()(j,r,g,P,n,I),sN()(j,T,r,P,g,I),aN()(j),uN()(j,g),pN()(j,T,P,r),dN()(j,g,P,r),mN()(j,T,r,P,g,I),yN()(j,T,I),bN()(j,T,r),wN()(j,g,I),SN()(j,r,P,O,g,I),kN()(j),CN()(j,g),AN()(j,g),s.toFastProperties(j),s.toFastProperties(j.prototype);function X(R){var B=new j(g);B._fulfillmentHandler0=R,B._rejectionHandler0=R,B._promise0=R,B._receiver0=R}return X({a:1}),X({b:2}),X({c:3}),X(1),X(function(){}),X(void 0),X(!1),X(new j(g)),I.setBounds(m.firstLineError,s.lastLineError),j}});var PN=w((lme,qN)=>{"use strict";var RN;typeof Promise<"u"&&(RN=Promise);function zee(){try{Promise===id&&(Promise=RN)}catch{}return id}var id=IN()();id.noConflict=zee;qN.exports=id});var FN=w((pme,NN)=>{var Pc=If(),Hee=s6(),Wee=Rf(),Kee=qf(),sd=H("path"),Mb=xb(),Gee=Pf(),Dc=dc(),od=PN(),DN=Buffer.alloc(4);DN.writeUInt32LE(101010256,0);function Vee(e){let t=e.stream(0).pipe(Pc());return t.pull(4).then(function(r){if(r.readUInt32LE(0)===875721283){let i;return t.pull(12).then(function(s){i=Dc.parse(s,[["version",4],["pubKeyLength",4],["signatureLength",4]])}).then(function(){return t.pull(i.pubKeyLength+i.signatureLength)}).then(function(s){return i.publicKey=s.slice(0,i.pubKeyLength),i.signature=s.slice(i.pubKeyLength),i.size=16+i.pubKeyLength+i.signatureLength,i})}})}function Xee(e,t){let r=Dc.parse(t,[["signature",4],["diskNumber",4],["offsetToStartOfCentralDirectory",8],["numberOfDisks",4]]);if(r.signature!=117853008)throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x"+r.signature.toString(16));let n=Pc();return e.stream(r.offsetToStartOfCentralDirectory).pipe(n),n.pull(56)}function Jee(e){let t=Dc.parse(e,[["signature",4],["sizeOfCentralDirectory",8],["version",2],["versionsNeededToExtract",2],["diskNumber",4],["diskStart",4],["numberOfRecordsOnDisk",8],["numberOfRecords",8],["sizeOfCentralDirectory",8],["offsetToStartOfCentralDirectory",8]]);if(t.signature!=101075792)throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0"+t.signature.toString(16));return t}NN.exports=function(t,r){let n=Pc(),i=Pc(),s=r&&r.tailSize||80,o,a,c,u;return r&&r.crx&&(a=Vee(t)),t.size().then(function(l){return o=l,t.stream(Math.max(0,l-s)).on("error",function(f){n.emit("error",f)}).pipe(n),n.pull(DN)}).then(function(){return od.props({directory:n.pull(22),crxHeader:a})}).then(function(l){let f=l.directory;if(c=l.crxHeader&&l.crxHeader.size||0,u=Dc.parse(f,[["signature",4],["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]),u.diskNumber==65535||u.numberOfRecords==65535||u.offsetToStartOfCentralDirectory==4294967295){let d=o-(s-n.match+20),h=Pc();return t.stream(d).pipe(h),h.pull(20).then(function(m){return Xee(t,m)}).then(function(m){u=Jee(m)})}else u.offsetToStartOfCentralDirectory+=c}).then(function(){if(u.commentLength)return n.pull(u.commentLength).then(function(l){u.comment=l.toString("utf8")})}).then(function(){return t.stream(u.offsetToStartOfCentralDirectory).pipe(i),u.extract=function(l){if(!l||!l.path)throw new Error("PATH_MISSING");return l.path=sd.resolve(sd.normalize(l.path)),u.files.then(function(f){return od.map(f,async function(p){let d=sd.join(l.path,p.path);if(d.indexOf(l.path)!=0)return;if(p.type=="Directory"){await Mb.ensureDir(d);return}await Mb.ensureDir(sd.dirname(d));let h=l.getWriter?l.getWriter({path:d}):Mb.createWriteStream(d);return new Promise(function(m,y){p.stream(l.password).on("error",y).pipe(h).on("close",m).on("error",y)})},{concurrency:l.concurrency>1?l.concurrency:1})})},u.files=od.mapSeries(Array(u.numberOfRecords),function(){return i.pull(46).then(function(l){let f=Dc.parse(l,[["signature",4],["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return f.offsetToLocalFileHeader+=c,f.lastModifiedDateTime=Gee(f.lastModifiedDate,f.lastModifiedTime),i.pull(f.fileNameLength).then(function(p){return f.pathBuffer=p,f.path=p.toString("utf8"),f.isUnicode=(f.flags&2048)!=0,i.pull(f.extraFieldLength)}).then(function(p){return f.extra=Kee(p,f),i.pull(f.fileCommentLength)}).then(function(p){f.comment=p,f.type=f.uncompressedSize===0&&/[/\\]$/.test(f.path)?"Directory":"File";let d=r&&r.padding||1e3;return f.stream=function(h){let m=30+d+(f.extraFieldLength||0)+(f.fileNameLength||0)+f.compressedSize;return Hee(t,f.offsetToLocalFileHeader,h,f,m)},f.buffer=function(h){return Wee(f.stream(h))},f})})}),od.props(u)})}});var jN={};$c(jN,{GetObjectCommand:()=>Lb,HeadObjectCommand:()=>Bb});var Lb,Bb,MN=oe(()=>{Lb=class{constructor(){}},Bb=class{constructor(){}}});var $N=w((fme,UN)=>{var LN=Bn(),Go=FN(),BN=H("stream");UN.exports={buffer:function(e,t){return Go({stream:function(n,i){let s=BN.PassThrough(),o=i?n+i:void 0;return s.end(e.slice(n,o)),s},size:function(){return Promise.resolve(e.length)}},t)},file:function(e,t){return Go({stream:function(n,i){let s=i?n+i:void 0;return LN.createReadStream(e,{start:n,end:s})},size:function(){return new Promise(function(n,i){LN.stat(e,function(s,o){s?i(s):n(o.size)})})}},t)},url:function(e,t,r){if(typeof t=="string"&&(t={url:t}),!t.url)throw"URL missing";return t.headers=t.headers||{},Go({stream:function(i,s){let o=Object.create(t),a=s?i+s:"";return o.headers=Object.create(t.headers),o.headers.range="bytes="+i+"-"+a,e(o)},size:function(){return new Promise(function(i,s){let o=e(t);o.on("response",function(a){o.abort(),a.headers["content-length"]?i(a.headers["content-length"]):s(new Error("Missing content length header"))}).on("error",s)})}},r)},s3:function(e,t,r){return Go({size:function(){return new Promise(function(i,s){e.headObject(t,function(o,a){o?s(o):i(a.ContentLength)})})},stream:function(i,s){let o={};for(let c in t)o[c]=t[c];let a=s?i+s:"";return o.Range="bytes="+i+"-"+a,e.getObject(o).createReadStream()}},r)},s3_v3:function(e,t,r){let{GetObjectCommand:n,HeadObjectCommand:i}=(MN(),nx(jN));return Go({size:async()=>{let o=await e.send(new i({Bucket:t.Bucket,Key:t.Key}));return o.ContentLength?o.ContentLength:0},stream:(o,a)=>{let c=BN.PassThrough(),u=a?o+a:"";return e.send(new n({Bucket:t.Bucket,Key:t.Key,Range:`bytes=${o}-${u}`})).then(l=>{l.Body.pipe(c)}).catch(l=>{c.emit("error",l)}),c}},r)},custom:function(e,t){return Go(e,t)}}});var Ub=w(Nc=>{"use strict";Nc.Parse=Df();Nc.ParseOne=uP();Nc.Extract=XD();Nc.Open=$N()});function ad(e,t,r){if((t&2048)!==0)return e?new TextDecoder("utf-8").decode(e):r;if(e&&e.length>0)try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return new TextDecoder("gbk").decode(e)}return r}var $b=oe(()=>{"use strict"});import Fc from"path";import zb from"fs";import{pipeline as Yee}from"stream/promises";function Qee(e){let t=e.map(s=>s.replace(/\\/g,"/").replace(/\/+$/,"")).filter(s=>s.length>0);if(t.length===0)return null;let r=new Set;for(let s of t){let o=s.split("/").filter(Boolean)[0];o&&r.add(o)}if(r.size!==1)return null;let n=[...r][0],i=`${n}/`;for(let s of t)if(s!==n&&!s.startsWith(i))return null;return n}function Zee(e,t){let r=Fc.resolve(e,t),n=Fc.resolve(e),i=Fc.relative(n,r);if(i.startsWith("..")||Fc.isAbsolute(i))throw new Error(`zip \u8DEF\u5F84\u8D8A\u754C: ${t}`);return r}async function HN(e,t){let n=await(await zN.default.Open.buffer(e)).files,i=n.map(o=>ad(o.pathBuffer,o.flags??0,o.path)),s=Qee(i);for(let o=0;o<n.length;o++){let a=n[o],c=i[o],u=c.replace(/\\/g,"/");if(s){if(u===s||u===`${s}/`)continue;u.startsWith(`${s}/`)&&(u=u.slice(s.length+1))}if(u=u.replace(/\/+$/,""),!u)continue;let l=Zee(t,u);if(a.type==="Directory"){zb.mkdirSync(l,{recursive:!0});continue}let f=Fc.dirname(l);zb.mkdirSync(f,{recursive:!0});let p=zb.createWriteStream(l);try{await Yee(a.stream(),p)}catch(d){let h=d instanceof Error?d.message:String(d);throw new Error(`\u89E3\u538B\u6587\u4EF6\u5931\u8D25 ${c}: ${h}`)}}}var zN,WN=oe(()=>{"use strict";zN=lr(Ub(),1);$b()});import ur from"fs";import cn from"path";function Wb(e){let t=vr();br()&&(t?.send(JSON.stringify({messageType:"openclaw_bot_event",source:"client",content:e})),$(`agent\u5B89\u88C5: ${JSON.stringify(e)}`))}function ete(e){let t=vt();if($(`copyAgentsFiles workspacePath ==> ${t}`),!t)return;let r=cn.join(t,"../",`workspace-${e}`),n=cn.join(t,"../",`agents/${e}`),i=cn.join(r,"agent");$(`copyAgentsFiles workspaceDir ==> ${r}`),$(`copyAgentsFiles agentDir ==> ${n}`),$(`copyAgentsFiles sourceAgent ==> ${i}`);try{if(!ur.existsSync(i)||!ur.statSync(i).isDirectory())return;$(`copyAgentsFiles agentDir 2 ==> ${n}`),ur.mkdirSync(n,{recursive:!0});let s=cn.join(n,"agent");ur.existsSync(s)&&ur.rmSync(s,{recursive:!0,force:!0}),$(`copyAgentsFiles dest ==> ${s}`),ur.cpSync(i,s,{recursive:!0})}catch(s){$(`copyAgentsFiles failed: ${String(s)}`,"error")}}function Vo(){try{let e=wn().config.current();Yp(structuredClone(e)),$("refreshCachedOpenClawConfigFromRuntime: ok")}catch(e){$(`refreshCachedOpenClawConfigFromRuntime failed: ${String(e)}`,"error")}}function KN(e,t){let r=t.trim().toLowerCase();return e?.agents?.list?.find(n=>(n?.id??"").trim().toLowerCase()===r)}function Hb(e,t){let r=t?.trim();return!!r&&cn.resolve(r)===e}async function GN(e){let t=typeof e=="string"?e.trim():"";if(!t||t==="main")return;Vo();let r=vt();if(!r)return;let n=cn.resolve(cn.join(r,"..",`workspace-${t}`));if(!ur.existsSync(n))return;let i=yt(),s=KN(i,t);if(!(s&&Hb(n,s.workspace))){if(s&&!Hb(n,s.workspace)){try{await bt({method:"agents.update",params:{agentId:t,workspace:n}}),Vo()}catch(o){$(`ensureExpertAgentWorkspaceBinding agents.update: ${String(o)}`,"error")}return}try{await bt({method:"agents.create",params:{name:t,workspace:n}}),Vo()}catch(o){let a=String(o);if(/already exists/i.test(a)){if(Vo(),i=yt(),s=KN(i,t),s&&!Hb(n,s.workspace))try{await bt({method:"agents.update",params:{agentId:t,workspace:n}}),Vo()}catch(c){$(`ensureExpertAgentWorkspaceBinding repair workspace: ${String(c)}`,"error")}}else $(`ensureExpertAgentWorkspaceBinding agents.create: ${a}`,"error")}}}async function tte(e){let{clone_code:t,name:r,description:n}=e,i=!1;try{let s=vt();if(!s)return;let o=cn.join(s,"../",`workspace-${t}`);$(`onCreateAgent workspaceDir ==> ${o}`),await bt({method:"agents.create",params:{name:t,workspace:o}}),i=!0}catch(s){$(`agents.create failed: ${String(s)}`,"error")}try{await bt({method:"agents.update",params:{name:r,agentId:t}})}catch(s){$(`agents.update failed: ${String(s)}`,"error")}i&&Vo(),ete(t),Wb({...e,status:"ok"})}function VN(e){let t=vt();if(!t)return!1;let r=cn.join(t,"../",`workspace-${e}`);return ur.existsSync(r)}async function XN(e){let{url:t,clone_code:r}=e;if($(`createAgent start: msgContent==> ${JSON.stringify(e)}`),!t||!r){$(`createAgent failed empty url&clone_code: ${JSON.stringify(e)}`,"error"),Wb({...e,status:"fail"});return}let n=vt();$(`createAgent workspacePath ==> ${n}`);let i=cn.join(n,"../",`workspace-${r}`);$(`createAgent workspaceDir ==> ${i}`),ur.existsSync(i)&&($(`createAgent removing existing dir: ${i}`),ur.rmSync(i,{recursive:!0,force:!0}));try{$(`createAgent downloading zip: ${t}`);let s=await ri({method:"get",url:t,responseType:"arraybuffer"});$(`createAgent download ok: ${s.data?.length??0} bytes`),ur.mkdirSync(i,{recursive:!0}),$(`createAgent mkdir ok: ${i}`),await HN(Buffer.from(s.data),i),await tte(e),$(`createAgent ok: ${r}`)}catch(s){let o=s instanceof Error?s.message:String(s);$(`createAgent error: ${o}`,"error"),ur.existsSync(i)&&(ur.rmSync(i,{recursive:!0,force:!0}),$(`createAgent cleaned dir after error: ${i}`)),Wb({...e,status:"fail"})}}var Kb=oe(()=>{"use strict";Gp();pt();it();Nr();fs();WN()});function rte(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function cd(e){let t=rte(e);return/context overflow/i.test(t)||/prompt too large/i.test(t)||/auto-compaction failed/i.test(t)||/\(precheck\)/i.test(t)}function ud(){return"\u5F53\u524D\u5BF9\u8BDD\u8FC7\u957F\uFF0C\u5DF2\u8D85\u8FC7\u6A21\u578B\u4E0A\u4E0B\u6587\u9650\u5236\uFF1B\u81EA\u52A8\u538B\u7F29\u672A\u5B8C\u5168\u751F\u6548\u65F6\u4F1A\u51FA\u73B0\u6B64\u60C5\u51B5\u3002\u8BF7\u5C1D\u8BD5\u65B0\u5F00\u5BF9\u8BDD\u3001\u7F29\u77ED\u4EFB\u52A1\uFF0C\u6216\u6362\u7528\u66F4\u5927\u4E0A\u4E0B\u6587\u7684\u6A21\u578B\u3002"}var JN=oe(()=>{"use strict"});function YN(e,t){ld.set(e,t)}function QN(e){ld.delete(e)}function Xo(e){return pd.has(e)}function Vb(e){pd.delete(e)}function nte(e){pd.add(e)}function ZN(e){let t=bi.get(e);t&&(t.abort(),bi.delete(e)),Gb.set(e,Promise.resolve()),Xb(e,"interrupt").catch(r=>$(`preempt: gateway abort: ${String(r)}`,"error")),$(`inbound queue: reset tail for /stop sessionKey=${e}`)}async function e3(e,t){let n=(Gb.get(e)??Promise.resolve()).catch(()=>{}).then(t);Gb.set(e,n.catch(()=>{})),await n}async function Xb(e,t){let r=t==="interrupt"?"interrupt":"supersede",i=[...eq(e)].reverse(),s=ld.get(e);i.length>0&&$(`${r}: chat.abort ${i.length} subagent session(s) (nested incl.)`);for(let o of i)try{await bt({method:"chat.abort",params:{sessionKey:o}})}catch(a){$(`${r}: chat.abort subagent ${o}: ${String(a)}`,"error")}try{await bt({method:"chat.abort",params:s?{sessionKey:e,runId:s}:{sessionKey:e}})}catch(o){$(`${r}: chat.abort main ${e}: ${String(o)}`,"error")}ld.delete(e),Of(e)}async function t3(e){bi.get(e)?.abort(),await Xb(e,"supersede"),pd.delete(e);let t=new AbortController;return bi.set(e,t),t}function r3(e,t){t&&bi.get(e)===t&&bi.delete(e)}async function n3(e,t){$(`interrupt command: sessionKey=${e}`);let r=bi.get(e);r&&($(`interrupt: AbortController.abort() in-process run sessionKey=${e}`),r.abort(),bi.delete(e));let n=t.messageId?.trim()?t:{...t,messageId:`${Date.now()}`};ar(n,"abort"),nte(e),await Xb(e,"interrupt")}var ld,bi,pd,Gb,fd=oe(()=>{"use strict";fs();Nr();it();Ro();ld=new Map,bi=new Map,pd=new Set,Gb=new Map});import i3 from"node:path";import{buildAgentMediaPayload as ite}from"openclaw/plugin-sdk/agent-media-payload";function s3(e,t){for(let r of t){let n=e[r];if(typeof n=="string"&&n.trim())return n.trim()}}function Jb(e){try{return i3.basename(new URL(e).pathname)||"file"}catch{let t=e.split(/[\\/]/).pop()??e;return i3.basename(t.split("?")[0]||t)||"file"}}function o3(e){if(e==null)return null;if(typeof e=="string"){let i=e.trim();return i?{url:i,name:Jb(i)}:null}if(typeof e!="object")return null;let t=e,r=s3(t,ote);if(!r)return null;let n=s3(t,ate)??"";return{url:r,name:n||Jb(r)}}function ute(e){if(Array.isArray(e))return e;if(typeof e=="string"){let t=e.trim();if(!t)return[];try{let r=JSON.parse(t);return Array.isArray(r)?r:[]}catch{return[]}}return[]}function a3(e){let t=new Set,r=[];for(let n of cte)for(let i of ute(e[n])){let s=o3(i);s&&!t.has(s.url)&&(t.add(s.url),r.push(s))}for(let n of["file","attachment","media"]){let i=o3(e[n]);i&&!t.has(i.url)&&(t.add(i.url),r.push(i))}return r}function lte(e){let t=(e||"").toLowerCase();return t.startsWith("image/")?"<media:image>":t.startsWith("video/")?"<media:video>":t.startsWith("audio/")?"<media:audio>":(t==="application/pdf"||t.includes("word")||t.includes("document")||t.includes("msword")||t.includes("officedocument")||t.includes("spreadsheet")||t.includes("presentation"),"<media:document>")}function c3(e){if(e.length===0)return{};let t=ite(e.map(n=>({path:n.path,contentType:n.contentType||null}))),r=e.map(n=>n.fileName).filter(Boolean);return r.length===0?{...t}:{...t,MediaFileName:r[0],MediaFileNames:r}}function u3(e,t){if(t.length===0)return e;let r=t.map((i,s)=>`${s+1}) ${i.fileName} [${i.contentType||"unknown"}]`).join("; "),n=t.map(i=>i.placeholder).join(`
|
|
286
|
+
`);if(typeof B!="function")throw new S("expecting a function but got "+s.classString(B))}function j(R){R!==g&&te(this,R),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(R),this._promiseCreated(),this._fireEvent("promiseCreated",this)}j.prototype.toString=function(){return"[object Promise]"},j.prototype.caught=j.prototype.catch=function(R){var B=arguments.length;if(B>1){var W=new Array(B-1),Y=0,D;for(D=0;D<B-1;++D){var ce=arguments[D];if(s.isObject(ce))W[Y++]=ce;else return r("Catch statement predicate: expecting an object but got "+s.classString(ce))}if(W.length=Y,R=arguments[D],typeof R!="function")throw new S("The last argument to .catch() must be a function, got "+s.toString(R));return this.then(void 0,G(W,R,this))}return this.then(void 0,R)},j.prototype.reflect=function(){return this._then(t,t,void 0,this,void 0)},j.prototype.then=function(R,B){if(I.warnings()&&arguments.length>0&&typeof R!="function"&&typeof B!="function"){var W=".then() only accepts functions but was passed: "+s.classString(R);arguments.length>1&&(W+=", "+s.classString(B)),this._warn(W)}return this._then(R,B,void 0,void 0,void 0)},j.prototype.done=function(R,B){var W=this._then(R,B,void 0,void 0,void 0);W._setIsFinal()},j.prototype.spread=function(R){return typeof R!="function"?r("expecting a function but got "+s.classString(R)):this.all()._then(R,void 0,void 0,v,void 0)},j.prototype.toJSON=function(){var R={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(R.fulfillmentValue=this.value(),R.isFulfilled=!0):this.isRejected()&&(R.rejectionReason=this.reason(),R.isRejected=!0),R},j.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new T(this).promise()},j.prototype.error=function(R){return this.caught(s.originatesFromRejection,R)},j.getNewLibraryCopy=jb.exports,j.is=function(R){return R instanceof j},j.fromNode=j.fromCallback=function(R){var B=new j(g);B._captureStackTrace();var W=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,Y=J(R)(A(B,W));return Y===K&&B._rejectCallback(Y.e,!0),B._isFateSealed()||B._setAsyncGuaranteed(),B},j.all=function(R){return new T(R).promise()},j.cast=function(R){var B=P(R);return B instanceof j||(B=new j(g),B._captureStackTrace(),B._setFulfilled(),B._rejectionHandler0=R),B},j.resolve=j.fulfilled=j.cast,j.reject=j.rejected=function(R){var B=new j(g);return B._captureStackTrace(),B._rejectCallback(R,!0),B},j.setScheduler=function(R){if(typeof R!="function")throw new S("expecting a function but got "+s.classString(R));return y.setScheduler(R)},j.prototype._then=function(R,B,W,Y,D){var ce=D!==void 0,ae=ce?D:new j(g),de=this._target(),C=de._bitField;ce||(ae._propagateFrom(this,3),ae._captureStackTrace(),Y===void 0&&(this._bitField&2097152)!==0&&((C&50397184)!==0?Y=this._boundValue():Y=de===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,ae));var x=f();if((C&50397184)!==0){var V,F,Q=de._settlePromiseCtx;(C&33554432)!==0?(F=de._rejectionHandler0,V=R):(C&16777216)!==0?(F=de._fulfillmentHandler0,V=B,de._unsetRejectionIsUnhandled()):(Q=de._settlePromiseLateCancellationObserver,F=new b("late cancellation observer"),de._attachExtraTrace(F),V=B),y.invoke(Q,de,{handler:s.contextBind(x,V),promise:ae,receiver:Y,value:F})}else de._addCallbacks(R,B,ae,Y,x);return ae},j.prototype._length=function(){return this._bitField&65535},j.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},j.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},j.prototype._setLength=function(R){this._bitField=this._bitField&-65536|R&65535},j.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},j.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},j.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},j.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},j.prototype._isFinal=function(){return(this._bitField&4194304)>0},j.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},j.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},j.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},j.prototype._setAsyncGuaranteed=function(){if(!y.hasCustomScheduler()){var R=this._bitField;this._bitField=R|(R&536870912)>>2^134217728}},j.prototype._setNoAsyncGuarantee=function(){this._bitField=(this._bitField|536870912)&-134217729},j.prototype._receiverAt=function(R){var B=R===0?this._receiver0:this[R*4-4+3];if(B!==i)return B===void 0&&this._isBound()?this._boundValue():B},j.prototype._promiseAt=function(R){return this[R*4-4+2]},j.prototype._fulfillmentHandlerAt=function(R){return this[R*4-4+0]},j.prototype._rejectionHandlerAt=function(R){return this[R*4-4+1]},j.prototype._boundValue=function(){},j.prototype._migrateCallback0=function(R){var B=R._bitField,W=R._fulfillmentHandler0,Y=R._rejectionHandler0,D=R._promise0,ce=R._receiverAt(0);ce===void 0&&(ce=i),this._addCallbacks(W,Y,D,ce,null)},j.prototype._migrateCallbackAt=function(R,B){var W=R._fulfillmentHandlerAt(B),Y=R._rejectionHandlerAt(B),D=R._promiseAt(B),ce=R._receiverAt(B);ce===void 0&&(ce=i),this._addCallbacks(W,Y,D,ce,null)},j.prototype._addCallbacks=function(R,B,W,Y,D){var ce=this._length();if(ce>=65531&&(ce=0,this._setLength(0)),ce===0)this._promise0=W,this._receiver0=Y,typeof R=="function"&&(this._fulfillmentHandler0=s.contextBind(D,R)),typeof B=="function"&&(this._rejectionHandler0=s.contextBind(D,B));else{var ae=ce*4-4;this[ae+2]=W,this[ae+3]=Y,typeof R=="function"&&(this[ae+0]=s.contextBind(D,R)),typeof B=="function"&&(this[ae+1]=s.contextBind(D,B))}return this._setLength(ce+1),ce},j.prototype._proxy=function(R,B){this._addCallbacks(void 0,void 0,B,R,null)},j.prototype._resolveCallback=function(R,B){if((this._bitField&117506048)===0){if(R===this)return this._rejectCallback(e(),!1);var W=P(R,this);if(!(W instanceof j))return this._fulfill(R);B&&this._propagateFrom(W,2);var Y=W._target();if(Y===this){this._reject(e());return}var D=Y._bitField;if((D&50397184)===0){var ce=this._length();ce>0&&Y._migrateCallback0(this);for(var ae=1;ae<ce;++ae)Y._migrateCallbackAt(this,ae);this._setFollowing(),this._setLength(0),this._setFollowee(W)}else if((D&33554432)!==0)this._fulfill(Y._value());else if((D&16777216)!==0)this._reject(Y._reason());else{var de=new b("late cancellation observer");Y._attachExtraTrace(de),this._reject(de)}}},j.prototype._rejectCallback=function(R,B,W){var Y=s.ensureErrorObject(R),D=Y===R;if(!D&&!W&&I.warnings()){var ce="a promise was rejected with a non-error: "+s.classString(R);this._warn(ce,!0)}this._attachExtraTrace(Y,B?D:!1),this._reject(R)},j.prototype._resolveFromExecutor=function(R){if(R!==g){var B=this;this._captureStackTrace(),this._pushContext();var W=!0,Y=this._execute(R,function(D){B._resolveCallback(D)},function(D){B._rejectCallback(D,W)});W=!1,this._popContext(),Y!==void 0&&B._rejectCallback(Y,!0)}},j.prototype._settlePromiseFromHandler=function(R,B,W,Y){var D=Y._bitField;if((D&65536)===0){Y._pushContext();var ce;B===v?!W||typeof W.length!="number"?(ce=K,ce.e=new S("cannot .spread() a non-array: "+s.classString(W))):ce=J(R).apply(this._boundValue(),W):ce=J(R).call(B,W);var ae=Y._popContext();D=Y._bitField,(D&65536)===0&&(ce===k?Y._reject(W):ce===K?Y._rejectCallback(ce.e,!1):(I.checkForgottenReturns(ce,ae,"",Y,this),Y._resolveCallback(ce)))}},j.prototype._target=function(){for(var R=this;R._isFollowing();)R=R._followee();return R},j.prototype._followee=function(){return this._rejectionHandler0},j.prototype._setFollowee=function(R){this._rejectionHandler0=R},j.prototype._settlePromise=function(R,B,W,Y){var D=R instanceof j,ce=this._bitField,ae=(ce&134217728)!==0;(ce&65536)!==0?(D&&R._invokeInternalOnCancel(),W instanceof q&&W.isFinallyHandler()?(W.cancelPromise=R,J(B).call(W,Y)===K&&R._reject(K.e)):B===t?R._fulfill(t.call(W)):W instanceof n?W._promiseCancelled(R):D||R instanceof T?R._cancel():W.cancel()):typeof B=="function"?D?(ae&&R._setAsyncGuaranteed(),this._settlePromiseFromHandler(B,W,Y,R)):B.call(W,Y,R):W instanceof n?W._isResolved()||((ce&33554432)!==0?W._promiseFulfilled(Y,R):W._promiseRejected(Y,R)):D&&(ae&&R._setAsyncGuaranteed(),(ce&33554432)!==0?R._fulfill(Y):R._reject(Y))},j.prototype._settlePromiseLateCancellationObserver=function(R){var B=R.handler,W=R.promise,Y=R.receiver,D=R.value;typeof B=="function"?W instanceof j?this._settlePromiseFromHandler(B,Y,D,W):B.call(Y,D,W):W instanceof j&&W._reject(D)},j.prototype._settlePromiseCtx=function(R){this._settlePromise(R.promise,R.handler,R.receiver,R.value)},j.prototype._settlePromise0=function(R,B,W){var Y=this._promise0,D=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(Y,R,D,B)},j.prototype._clearCallbackDataAtIndex=function(R){var B=R*4-4;this[B+2]=this[B+3]=this[B+0]=this[B+1]=void 0},j.prototype._fulfill=function(R){var B=this._bitField;if(!((B&117506048)>>>16)){if(R===this){var W=e();return this._attachExtraTrace(W),this._reject(W)}this._setFulfilled(),this._rejectionHandler0=R,(B&65535)>0&&((B&134217728)!==0?this._settlePromises():y.settlePromises(this),this._dereferenceTrace())}},j.prototype._reject=function(R){var B=this._bitField;if(!((B&117506048)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=R,this._isFinal())return y.fatalError(R,s.isNode);(B&65535)>0?y.settlePromises(this):this._ensurePossibleRejectionHandled()}},j.prototype._fulfillPromises=function(R,B){for(var W=1;W<R;W++){var Y=this._fulfillmentHandlerAt(W),D=this._promiseAt(W),ce=this._receiverAt(W);this._clearCallbackDataAtIndex(W),this._settlePromise(D,Y,ce,B)}},j.prototype._rejectPromises=function(R,B){for(var W=1;W<R;W++){var Y=this._rejectionHandlerAt(W),D=this._promiseAt(W),ce=this._receiverAt(W);this._clearCallbackDataAtIndex(W),this._settlePromise(D,Y,ce,B)}},j.prototype._settlePromises=function(){var R=this._bitField,B=R&65535;if(B>0){if((R&16842752)!==0){var W=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,W,R),this._rejectPromises(B,W)}else{var Y=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,Y,R),this._fulfillPromises(B,Y)}this._setLength(0)}this._clearCancellationData()},j.prototype._settledValue=function(){var R=this._bitField;if((R&33554432)!==0)return this._rejectionHandler0;if((R&16777216)!==0)return this._fulfillmentHandler0},typeof Symbol<"u"&&Symbol.toStringTag&&h.defineProperty(j.prototype,Symbol.toStringTag,{get:function(){return"Object"}});function re(R){this.promise._resolveCallback(R)}function z(R){this.promise._rejectCallback(R,!1)}j.defer=j.pending=function(){I.deprecated("Promise.defer","new Promise");var R=new j(g);return{promise:R,resolve:re,reject:z}},s.notEnumerableProp(j,"_makeSelfResolutionError",e),z6()(j,g,P,r,I),W6()(j,g,P,I),G6()(j,T,r,I),X6()(j),Y6()(j),Z6()(j,T,P,g,y),j.Promise=j,j.version="3.7.2",tN()(j),nN()(j,r,g,P,n,I),sN()(j,T,r,P,g,I),aN()(j),uN()(j,g),pN()(j,T,P,r),dN()(j,g,P,r),mN()(j,T,r,P,g,I),yN()(j,T,I),bN()(j,T,r),wN()(j,g,I),SN()(j,r,P,O,g,I),kN()(j),CN()(j,g),AN()(j,g),s.toFastProperties(j),s.toFastProperties(j.prototype);function X(R){var B=new j(g);B._fulfillmentHandler0=R,B._rejectionHandler0=R,B._promise0=R,B._receiver0=R}return X({a:1}),X({b:2}),X({c:3}),X(1),X(function(){}),X(void 0),X(!1),X(new j(g)),I.setBounds(m.firstLineError,s.lastLineError),j}});var PN=w((lme,qN)=>{"use strict";var RN;typeof Promise<"u"&&(RN=Promise);function zee(){try{Promise===id&&(Promise=RN)}catch{}return id}var id=IN()();id.noConflict=zee;qN.exports=id});var FN=w((pme,NN)=>{var Pc=If(),Hee=s6(),Wee=Rf(),Kee=qf(),sd=H("path"),Mb=xb(),Gee=Pf(),Dc=dc(),od=PN(),DN=Buffer.alloc(4);DN.writeUInt32LE(101010256,0);function Vee(e){let t=e.stream(0).pipe(Pc());return t.pull(4).then(function(r){if(r.readUInt32LE(0)===875721283){let i;return t.pull(12).then(function(s){i=Dc.parse(s,[["version",4],["pubKeyLength",4],["signatureLength",4]])}).then(function(){return t.pull(i.pubKeyLength+i.signatureLength)}).then(function(s){return i.publicKey=s.slice(0,i.pubKeyLength),i.signature=s.slice(i.pubKeyLength),i.size=16+i.pubKeyLength+i.signatureLength,i})}})}function Xee(e,t){let r=Dc.parse(t,[["signature",4],["diskNumber",4],["offsetToStartOfCentralDirectory",8],["numberOfDisks",4]]);if(r.signature!=117853008)throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x"+r.signature.toString(16));let n=Pc();return e.stream(r.offsetToStartOfCentralDirectory).pipe(n),n.pull(56)}function Jee(e){let t=Dc.parse(e,[["signature",4],["sizeOfCentralDirectory",8],["version",2],["versionsNeededToExtract",2],["diskNumber",4],["diskStart",4],["numberOfRecordsOnDisk",8],["numberOfRecords",8],["sizeOfCentralDirectory",8],["offsetToStartOfCentralDirectory",8]]);if(t.signature!=101075792)throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0"+t.signature.toString(16));return t}NN.exports=function(t,r){let n=Pc(),i=Pc(),s=r&&r.tailSize||80,o,a,c,u;return r&&r.crx&&(a=Vee(t)),t.size().then(function(l){return o=l,t.stream(Math.max(0,l-s)).on("error",function(f){n.emit("error",f)}).pipe(n),n.pull(DN)}).then(function(){return od.props({directory:n.pull(22),crxHeader:a})}).then(function(l){let f=l.directory;if(c=l.crxHeader&&l.crxHeader.size||0,u=Dc.parse(f,[["signature",4],["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]),u.diskNumber==65535||u.numberOfRecords==65535||u.offsetToStartOfCentralDirectory==4294967295){let d=o-(s-n.match+20),h=Pc();return t.stream(d).pipe(h),h.pull(20).then(function(m){return Xee(t,m)}).then(function(m){u=Jee(m)})}else u.offsetToStartOfCentralDirectory+=c}).then(function(){if(u.commentLength)return n.pull(u.commentLength).then(function(l){u.comment=l.toString("utf8")})}).then(function(){return t.stream(u.offsetToStartOfCentralDirectory).pipe(i),u.extract=function(l){if(!l||!l.path)throw new Error("PATH_MISSING");return l.path=sd.resolve(sd.normalize(l.path)),u.files.then(function(f){return od.map(f,async function(p){let d=sd.join(l.path,p.path);if(d.indexOf(l.path)!=0)return;if(p.type=="Directory"){await Mb.ensureDir(d);return}await Mb.ensureDir(sd.dirname(d));let h=l.getWriter?l.getWriter({path:d}):Mb.createWriteStream(d);return new Promise(function(m,y){p.stream(l.password).on("error",y).pipe(h).on("close",m).on("error",y)})},{concurrency:l.concurrency>1?l.concurrency:1})})},u.files=od.mapSeries(Array(u.numberOfRecords),function(){return i.pull(46).then(function(l){let f=Dc.parse(l,[["signature",4],["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return f.offsetToLocalFileHeader+=c,f.lastModifiedDateTime=Gee(f.lastModifiedDate,f.lastModifiedTime),i.pull(f.fileNameLength).then(function(p){return f.pathBuffer=p,f.path=p.toString("utf8"),f.isUnicode=(f.flags&2048)!=0,i.pull(f.extraFieldLength)}).then(function(p){return f.extra=Kee(p,f),i.pull(f.fileCommentLength)}).then(function(p){f.comment=p,f.type=f.uncompressedSize===0&&/[/\\]$/.test(f.path)?"Directory":"File";let d=r&&r.padding||1e3;return f.stream=function(h){let m=30+d+(f.extraFieldLength||0)+(f.fileNameLength||0)+f.compressedSize;return Hee(t,f.offsetToLocalFileHeader,h,f,m)},f.buffer=function(h){return Wee(f.stream(h))},f})})}),od.props(u)})}});var jN={};$c(jN,{GetObjectCommand:()=>Lb,HeadObjectCommand:()=>Bb});var Lb,Bb,MN=oe(()=>{Lb=class{constructor(){}},Bb=class{constructor(){}}});var $N=w((fme,UN)=>{var LN=Bn(),Go=FN(),BN=H("stream");UN.exports={buffer:function(e,t){return Go({stream:function(n,i){let s=BN.PassThrough(),o=i?n+i:void 0;return s.end(e.slice(n,o)),s},size:function(){return Promise.resolve(e.length)}},t)},file:function(e,t){return Go({stream:function(n,i){let s=i?n+i:void 0;return LN.createReadStream(e,{start:n,end:s})},size:function(){return new Promise(function(n,i){LN.stat(e,function(s,o){s?i(s):n(o.size)})})}},t)},url:function(e,t,r){if(typeof t=="string"&&(t={url:t}),!t.url)throw"URL missing";return t.headers=t.headers||{},Go({stream:function(i,s){let o=Object.create(t),a=s?i+s:"";return o.headers=Object.create(t.headers),o.headers.range="bytes="+i+"-"+a,e(o)},size:function(){return new Promise(function(i,s){let o=e(t);o.on("response",function(a){o.abort(),a.headers["content-length"]?i(a.headers["content-length"]):s(new Error("Missing content length header"))}).on("error",s)})}},r)},s3:function(e,t,r){return Go({size:function(){return new Promise(function(i,s){e.headObject(t,function(o,a){o?s(o):i(a.ContentLength)})})},stream:function(i,s){let o={};for(let c in t)o[c]=t[c];let a=s?i+s:"";return o.Range="bytes="+i+"-"+a,e.getObject(o).createReadStream()}},r)},s3_v3:function(e,t,r){let{GetObjectCommand:n,HeadObjectCommand:i}=(MN(),nx(jN));return Go({size:async()=>{let o=await e.send(new i({Bucket:t.Bucket,Key:t.Key}));return o.ContentLength?o.ContentLength:0},stream:(o,a)=>{let c=BN.PassThrough(),u=a?o+a:"";return e.send(new n({Bucket:t.Bucket,Key:t.Key,Range:`bytes=${o}-${u}`})).then(l=>{l.Body.pipe(c)}).catch(l=>{c.emit("error",l)}),c}},r)},custom:function(e,t){return Go(e,t)}}});var Ub=w(Nc=>{"use strict";Nc.Parse=Df();Nc.ParseOne=uP();Nc.Extract=XD();Nc.Open=$N()});function ad(e,t,r){if((t&2048)!==0)return e?new TextDecoder("utf-8").decode(e):r;if(e&&e.length>0)try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return new TextDecoder("gbk").decode(e)}return r}var $b=oe(()=>{"use strict"});import Fc from"path";import zb from"fs";import{pipeline as Yee}from"stream/promises";function Qee(e){let t=e.map(s=>s.replace(/\\/g,"/").replace(/\/+$/,"")).filter(s=>s.length>0);if(t.length===0)return null;let r=new Set;for(let s of t){let o=s.split("/").filter(Boolean)[0];o&&r.add(o)}if(r.size!==1)return null;let n=[...r][0],i=`${n}/`;for(let s of t)if(s!==n&&!s.startsWith(i))return null;return n}function Zee(e,t){let r=Fc.resolve(e,t),n=Fc.resolve(e),i=Fc.relative(n,r);if(i.startsWith("..")||Fc.isAbsolute(i))throw new Error(`zip \u8DEF\u5F84\u8D8A\u754C: ${t}`);return r}async function HN(e,t){let n=await(await zN.default.Open.buffer(e)).files,i=n.map(o=>ad(o.pathBuffer,o.flags??0,o.path)),s=Qee(i);for(let o=0;o<n.length;o++){let a=n[o],c=i[o],u=c.replace(/\\/g,"/");if(s){if(u===s||u===`${s}/`)continue;u.startsWith(`${s}/`)&&(u=u.slice(s.length+1))}if(u=u.replace(/\/+$/,""),!u)continue;let l=Zee(t,u);if(a.type==="Directory"){zb.mkdirSync(l,{recursive:!0});continue}let f=Fc.dirname(l);zb.mkdirSync(f,{recursive:!0});let p=zb.createWriteStream(l);try{await Yee(a.stream(),p)}catch(d){let h=d instanceof Error?d.message:String(d);throw new Error(`\u89E3\u538B\u6587\u4EF6\u5931\u8D25 ${c}: ${h}`)}}}var zN,WN=oe(()=>{"use strict";zN=lr(Ub(),1);$b()});import ur from"fs";import cn from"path";function Wb(e){let t=vr();br()&&(t?.send(JSON.stringify({messageType:"openclaw_bot_event",source:"client",content:e})),$(`agent\u5B89\u88C5: ${JSON.stringify(e)}`))}function ete(e){let t=vt();if($(`copyAgentsFiles workspacePath ==> ${t}`),!t)return;let r=cn.join(t,"../",`workspace-${e}`),n=cn.join(t,"../",`agents/${e}`),i=cn.join(r,"agent");$(`copyAgentsFiles workspaceDir ==> ${r}`),$(`copyAgentsFiles agentDir ==> ${n}`),$(`copyAgentsFiles sourceAgent ==> ${i}`);try{if(!ur.existsSync(i)||!ur.statSync(i).isDirectory())return;$(`copyAgentsFiles agentDir 2 ==> ${n}`),ur.mkdirSync(n,{recursive:!0});let s=cn.join(n,"agent");ur.existsSync(s)&&ur.rmSync(s,{recursive:!0,force:!0}),$(`copyAgentsFiles dest ==> ${s}`),ur.cpSync(i,s,{recursive:!0})}catch(s){$(`copyAgentsFiles failed: ${String(s)}`,"error")}}function Vo(){try{let e=wn().config.loadConfig();Yp(structuredClone(e)),$("refreshCachedOpenClawConfigFromRuntime: ok")}catch(e){$(`refreshCachedOpenClawConfigFromRuntime failed: ${String(e)}`,"error")}}function KN(e,t){let r=t.trim().toLowerCase();return e?.agents?.list?.find(n=>(n?.id??"").trim().toLowerCase()===r)}function Hb(e,t){let r=t?.trim();return r?cn.resolve(r)===e:!1}async function GN(e){let t=typeof e=="string"?e.trim():"";if(!t||t==="main")return;Vo();let r=vt();if(!r)return;let n=cn.resolve(cn.join(r,"..",`workspace-${t}`));if(!ur.existsSync(n))return;let i=yt(),s=KN(i,t);if(!(s&&Hb(n,s.workspace))){if(s&&!Hb(n,s.workspace)){try{await bt({method:"agents.update",params:{agentId:t,workspace:n}}),Vo()}catch(o){$(`ensureExpertAgentWorkspaceBinding agents.update: ${String(o)}`,"error")}return}try{await bt({method:"agents.create",params:{name:t,workspace:n}}),Vo()}catch(o){let a=String(o);if(/already exists/i.test(a)){if(Vo(),i=yt(),s=KN(i,t),s&&!Hb(n,s.workspace))try{await bt({method:"agents.update",params:{agentId:t,workspace:n}}),Vo()}catch(c){$(`ensureExpertAgentWorkspaceBinding repair workspace: ${String(c)}`,"error")}}else $(`ensureExpertAgentWorkspaceBinding agents.create: ${a}`,"error")}}}async function tte(e){let{clone_code:t,name:r,description:n}=e,i=!1;try{let s=vt();if(!s)return;let o=cn.join(s,"../",`workspace-${t}`);$(`onCreateAgent workspaceDir ==> ${o}`),await bt({method:"agents.create",params:{name:t,workspace:o}}),i=!0}catch(s){$(`agents.create failed: ${String(s)}`,"error")}try{await bt({method:"agents.update",params:{name:r,agentId:t}})}catch(s){$(`agents.update failed: ${String(s)}`,"error")}i&&Vo(),ete(t),Wb({...e,status:"ok"})}function VN(e){let t=vt();if(!t)return!1;let r=cn.join(t,"../",`workspace-${e}`);return ur.existsSync(r)}async function XN(e){let{url:t,clone_code:r}=e;if($(`createAgent start: msgContent==> ${JSON.stringify(e)}`),!t||!r){$(`createAgent failed empty url&clone_code: ${JSON.stringify(e)}`,"error"),Wb({...e,status:"fail"});return}let n=vt();$(`createAgent workspacePath ==> ${n}`);let i=cn.join(n,"../",`workspace-${r}`);$(`createAgent workspaceDir ==> ${i}`),ur.existsSync(i)&&($(`createAgent removing existing dir: ${i}`),ur.rmSync(i,{recursive:!0,force:!0}));try{$(`createAgent downloading zip: ${t}`);let s=await ri({method:"get",url:t,responseType:"arraybuffer"});$(`createAgent download ok: ${s.data?.length??0} bytes`),ur.mkdirSync(i,{recursive:!0}),$(`createAgent mkdir ok: ${i}`),await HN(Buffer.from(s.data),i),await tte(e),$(`createAgent ok: ${r}`)}catch(s){let o=s instanceof Error?s.message:String(s);$(`createAgent error: ${o}`,"error"),ur.existsSync(i)&&(ur.rmSync(i,{recursive:!0,force:!0}),$(`createAgent cleaned dir after error: ${i}`)),Wb({...e,status:"fail"})}}var Kb=oe(()=>{"use strict";Gp();pt();it();Nr();fs();WN()});function rte(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function cd(e){let t=rte(e);return/context overflow/i.test(t)||/prompt too large/i.test(t)||/auto-compaction failed/i.test(t)||/\(precheck\)/i.test(t)}function ud(){return"\u5F53\u524D\u5BF9\u8BDD\u8FC7\u957F\uFF0C\u5DF2\u8D85\u8FC7\u6A21\u578B\u4E0A\u4E0B\u6587\u9650\u5236\uFF1B\u81EA\u52A8\u538B\u7F29\u672A\u5B8C\u5168\u751F\u6548\u65F6\u4F1A\u51FA\u73B0\u6B64\u60C5\u51B5\u3002\u8BF7\u5C1D\u8BD5\u65B0\u5F00\u5BF9\u8BDD\u3001\u7F29\u77ED\u4EFB\u52A1\uFF0C\u6216\u6362\u7528\u66F4\u5927\u4E0A\u4E0B\u6587\u7684\u6A21\u578B\u3002"}var JN=oe(()=>{"use strict"});function YN(e,t){ld.set(e,t)}function QN(e){ld.delete(e)}function Xo(e){return pd.has(e)}function Vb(e){pd.delete(e)}function nte(e){pd.add(e)}function ZN(e){let t=bi.get(e);t&&(t.abort(),bi.delete(e)),Gb.set(e,Promise.resolve()),Xb(e,"interrupt").catch(r=>$(`preempt: gateway abort: ${String(r)}`,"error")),$(`inbound queue: reset tail for /stop sessionKey=${e}`)}async function e3(e,t){let n=(Gb.get(e)??Promise.resolve()).catch(()=>{}).then(t);Gb.set(e,n.catch(()=>{})),await n}async function Xb(e,t){let r=t==="interrupt"?"interrupt":"supersede",i=[...eq(e)].reverse(),s=ld.get(e);i.length>0&&$(`${r}: chat.abort ${i.length} subagent session(s) (nested incl.)`);for(let o of i)try{await bt({method:"chat.abort",params:{sessionKey:o}})}catch(a){$(`${r}: chat.abort subagent ${o}: ${String(a)}`,"error")}try{await bt({method:"chat.abort",params:s?{sessionKey:e,runId:s}:{sessionKey:e}})}catch(o){$(`${r}: chat.abort main ${e}: ${String(o)}`,"error")}ld.delete(e),Of(e)}async function t3(e){bi.get(e)?.abort(),await Xb(e,"supersede"),pd.delete(e);let t=new AbortController;return bi.set(e,t),t}function r3(e,t){t&&bi.get(e)===t&&bi.delete(e)}async function n3(e,t){$(`interrupt command: sessionKey=${e}`);let r=bi.get(e);r&&($(`interrupt: AbortController.abort() in-process run sessionKey=${e}`),r.abort(),bi.delete(e));let n=t.messageId?.trim()?t:{...t,messageId:`${Date.now()}`};ar(n,"abort"),nte(e),await Xb(e,"interrupt")}var ld,bi,pd,Gb,fd=oe(()=>{"use strict";fs();Nr();it();Ro();ld=new Map,bi=new Map,pd=new Set,Gb=new Map});import i3 from"node:path";import{buildAgentMediaPayload as ite}from"openclaw/plugin-sdk/agent-media-payload";function s3(e,t){for(let r of t){let n=e[r];if(typeof n=="string"&&n.trim())return n.trim()}}function Jb(e){try{return i3.basename(new URL(e).pathname)||"file"}catch{let t=e.split(/[\\/]/).pop()??e;return i3.basename(t.split("?")[0]||t)||"file"}}function o3(e){if(e==null)return null;if(typeof e=="string"){let i=e.trim();return i?{url:i,name:Jb(i)}:null}if(typeof e!="object")return null;let t=e,r=s3(t,ote);if(!r)return null;let n=s3(t,ate)??"";return{url:r,name:n||Jb(r)}}function ute(e){if(Array.isArray(e))return e;if(typeof e=="string"){let t=e.trim();if(!t)return[];try{let r=JSON.parse(t);return Array.isArray(r)?r:[]}catch{return[]}}return[]}function a3(e){let t=new Set,r=[];for(let n of cte)for(let i of ute(e[n])){let s=o3(i);s&&!t.has(s.url)&&(t.add(s.url),r.push(s))}for(let n of["file","attachment","media"]){let i=o3(e[n]);i&&!t.has(i.url)&&(t.add(i.url),r.push(i))}return r}function lte(e){let t=(e||"").toLowerCase();return t.startsWith("image/")?"<media:image>":t.startsWith("video/")?"<media:video>":t.startsWith("audio/")?"<media:audio>":(t==="application/pdf"||t.includes("word")||t.includes("document")||t.includes("msword")||t.includes("officedocument")||t.includes("spreadsheet")||t.includes("presentation"),"<media:document>")}function c3(e){if(e.length===0)return{};let t=ite(e.map(n=>({path:n.path,contentType:n.contentType||null}))),r=e.map(n=>n.fileName).filter(Boolean);return r.length===0?{...t}:{...t,MediaFileName:r[0],MediaFileNames:r}}function u3(e,t){if(t.length===0)return e;let r=t.map((i,s)=>`${s+1}) ${i.fileName} [${i.contentType||"unknown"}]`).join("; "),n=t.map(i=>i.placeholder).join(`
|
|
287
287
|
`);return`${e}
|
|
288
288
|
|
|
289
289
|
[\u7CFB\u7EDF: \u7528\u6237\u5DF2\u968F\u672C\u6D88\u606F\u4E0A\u4F20 ${t.length} \u4E2A\u9644\u4EF6: ${r}\u3002\u8BF7\u52FF\u8981\u6C42\u7528\u6237\u518D\u6B21\u4E0A\u4F20\uFF1B\u4E0B\u5217\u69FD\u4F4D\u4E0E MediaPaths/MediaTypes \u987A\u5E8F\u4E00\u81F4\u3002]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcrays/dcgchat-test",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "书灵墨宝Channel插件",
|
|
6
6
|
"main": "index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"ai"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"openclaw": ">=2026.4.
|
|
20
|
+
"openclaw": ">=2026.4.5"
|
|
21
21
|
},
|
|
22
22
|
"peerDependenciesMeta": {
|
|
23
23
|
"openclaw": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"npmSpec": "@dcrays/dcgchat-test",
|
|
42
42
|
"localPath": "extensions/dcgchat-test",
|
|
43
43
|
"defaultChoice": "npm",
|
|
44
|
-
"
|
|
44
|
+
"minHosssstVersion": ">=2026.4.5"
|
|
45
45
|
},
|
|
46
46
|
"compat": {
|
|
47
|
-
"pluginApi": ">=2026.4.
|
|
47
|
+
"pluginApi": ">=2026.4.5"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|