@keruyun/agent-cli 1.5.8-beta.0 → 1.5.9-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,12 +17,12 @@ npm i @keruyun/agent-cli@latest -g --registry=https://registry.npmmirror.com
17
17
 
18
18
  | 平台 | 解压后体积 |
19
19
  | --- | --- |
20
- | darwin-arm64 | 66.05 MB |
21
- | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.47 MB |
22
- | linux-x64 | 95.71 MB |
20
+ | darwin-arm64 | 66.07 MB |
21
+ | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.48 MB |
22
+ | linux-x64 | 95.73 MB |
23
23
  | linux-arm64 | 94.85 MB |
24
- | linux-x64-musl | 92.45 MB |
25
- | win32-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 98.73 MB |
24
+ | linux-x64-musl | 92.47 MB |
25
+ | win32-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 98.75 MB |
26
26
 
27
27
  ## 校验
28
28
 
package/bin/sdk.mjs CHANGED
@@ -1,5 +1 @@
1
- var Rt=Object.create;var Ne=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var se=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var Ht=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ft(e))!Lt.call(t,n)&&n!==r&&Ne(t,n,{get:()=>e[n],enumerable:!(s=Pt(e,n))||s.enumerable});return t};var oe=(t,e,r)=>(r=t!=null?Rt(Yt(t)):{},Ht(e||!t||!t.__esModule?Ne(r,"default",{value:t,enumerable:!0}):r,t));var We=z((be,we)=>{(function(t,e){typeof be=="object"&&typeof we<"u"?we.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(be,(function(){"use strict";var t=1e3,e=6e4,r=36e5,s="millisecond",n="second",c="minute",d="hour",x="day",y="week",T="month",$="quarter",A="year",P="date",g="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,S={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(f){var i=["th","st","nd","rd"],o=f%100;return"["+f+(i[(o-20)%10]||i[o]||i[0])+"]"}},_=function(f,i,o){var u=String(f);return!u||u.length>=i?f:""+Array(i+1-u.length).join(o)+f},F={s:_,z:function(f){var i=-f.utcOffset(),o=Math.abs(i),u=Math.floor(o/60),a=o%60;return(i<=0?"+":"-")+_(u,2,"0")+":"+_(a,2,"0")},m:function f(i,o){if(i.date()<o.date())return-f(o,i);var u=12*(o.year()-i.year())+(o.month()-i.month()),a=i.clone().add(u,T),h=o-a<0,p=i.clone().add(u+(h?-1:1),T);return+(-(u+(o-a)/(h?a-p:p-a))||0)},a:function(f){return f<0?Math.ceil(f)||0:Math.floor(f)},p:function(f){return{M:T,y:A,w:y,d:x,D:P,h:d,m:c,s:n,ms:s,Q:$}[f]||String(f||"").toLowerCase().replace(/s$/,"")},u:function(f){return f===void 0}},C="en",j={};j[C]=S;var Y="$isDayjsObject",N=function(f){return f instanceof R||!(!f||!f[Y])},E=function f(i,o,u){var a;if(!i)return C;if(typeof i=="string"){var h=i.toLowerCase();j[h]&&(a=h),o&&(j[h]=o,a=h);var p=i.split("-");if(!a&&p.length>1)return f(p[0])}else{var m=i.name;j[m]=i,a=m}return!u&&a&&(C=a),a||!u&&C},k=function(f,i){if(N(f))return f.clone();var o=typeof i=="object"?i:{};return o.date=f,o.args=arguments,new R(o)},b=F;b.l=E,b.i=N,b.w=function(f,i){return k(f,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var R=(function(){function f(o){this.$L=E(o.locale,null,!0),this.parse(o),this.$x=this.$x||o.x||{},this[Y]=!0}var i=f.prototype;return i.parse=function(o){this.$d=(function(u){var a=u.date,h=u.utc;if(a===null)return new Date(NaN);if(b.u(a))return new Date;if(a instanceof Date)return new Date(a);if(typeof a=="string"&&!/Z$/i.test(a)){var p=a.match(l);if(p){var m=p[2]-1||0,O=(p[7]||"0").substring(0,3);return h?new Date(Date.UTC(p[1],m,p[3]||1,p[4]||0,p[5]||0,p[6]||0,O)):new Date(p[1],m,p[3]||1,p[4]||0,p[5]||0,p[6]||0,O)}}return new Date(a)})(o),this.init()},i.init=function(){var o=this.$d;this.$y=o.getFullYear(),this.$M=o.getMonth(),this.$D=o.getDate(),this.$W=o.getDay(),this.$H=o.getHours(),this.$m=o.getMinutes(),this.$s=o.getSeconds(),this.$ms=o.getMilliseconds()},i.$utils=function(){return b},i.isValid=function(){return this.$d.toString()!==g},i.isSame=function(o,u){var a=k(o);return this.startOf(u)<=a&&a<=this.endOf(u)},i.isAfter=function(o,u){return k(o)<this.startOf(u)},i.isBefore=function(o,u){return this.endOf(u)<k(o)},i.$g=function(o,u,a){return b.u(o)?this[u]:this.set(a,o)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(o,u){var a=this,h=!!b.u(u)||u,p=b.p(o),m=function(U,I){var B=b.w(a.$u?Date.UTC(a.$y,I,U):new Date(a.$y,I,U),a);return h?B:B.endOf(x)},O=function(U,I){return b.w(a.toDate()[U].apply(a.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(I)),a)},D=this.$W,M=this.$M,H=this.$D,V="set"+(this.$u?"UTC":"");switch(p){case A:return h?m(1,0):m(31,11);case T:return h?m(1,M):m(0,M+1);case y:var q=this.$locale().weekStart||0,G=(D<q?D+7:D)-q;return m(h?H-G:H+(6-G),M);case x:case P:return O(V+"Hours",0);case d:return O(V+"Minutes",1);case c:return O(V+"Seconds",2);case n:return O(V+"Milliseconds",3);default:return this.clone()}},i.endOf=function(o){return this.startOf(o,!1)},i.$set=function(o,u){var a,h=b.p(o),p="set"+(this.$u?"UTC":""),m=(a={},a[x]=p+"Date",a[P]=p+"Date",a[T]=p+"Month",a[A]=p+"FullYear",a[d]=p+"Hours",a[c]=p+"Minutes",a[n]=p+"Seconds",a[s]=p+"Milliseconds",a)[h],O=h===x?this.$D+(u-this.$W):u;if(h===T||h===A){var D=this.clone().set(P,1);D.$d[m](O),D.init(),this.$d=D.set(P,Math.min(this.$D,D.daysInMonth())).$d}else m&&this.$d[m](O);return this.init(),this},i.set=function(o,u){return this.clone().$set(o,u)},i.get=function(o){return this[b.p(o)]()},i.add=function(o,u){var a,h=this;o=Number(o);var p=b.p(u),m=function(M){var H=k(h);return b.w(H.date(H.date()+Math.round(M*o)),h)};if(p===T)return this.set(T,this.$M+o);if(p===A)return this.set(A,this.$y+o);if(p===x)return m(1);if(p===y)return m(7);var O=(a={},a[c]=e,a[d]=r,a[n]=t,a)[p]||1,D=this.$d.getTime()+o*O;return b.w(D,this)},i.subtract=function(o,u){return this.add(-1*o,u)},i.format=function(o){var u=this,a=this.$locale();if(!this.isValid())return a.invalidDate||g;var h=o||"YYYY-MM-DDTHH:mm:ssZ",p=b.z(this),m=this.$H,O=this.$m,D=this.$M,M=a.weekdays,H=a.months,V=a.meridiem,q=function(I,B,J,Z){return I&&(I[B]||I(u,h))||J[B].slice(0,Z)},G=function(I){return b.s(m%12||12,I,"0")},U=V||function(I,B,J){var Z=I<12?"AM":"PM";return J?Z.toLowerCase():Z};return h.replace(w,(function(I,B){return B||(function(J){switch(J){case"YY":return String(u.$y).slice(-2);case"YYYY":return b.s(u.$y,4,"0");case"M":return D+1;case"MM":return b.s(D+1,2,"0");case"MMM":return q(a.monthsShort,D,H,3);case"MMMM":return q(H,D);case"D":return u.$D;case"DD":return b.s(u.$D,2,"0");case"d":return String(u.$W);case"dd":return q(a.weekdaysMin,u.$W,M,2);case"ddd":return q(a.weekdaysShort,u.$W,M,3);case"dddd":return M[u.$W];case"H":return String(m);case"HH":return b.s(m,2,"0");case"h":return G(1);case"hh":return G(2);case"a":return U(m,O,!0);case"A":return U(m,O,!1);case"m":return String(O);case"mm":return b.s(O,2,"0");case"s":return String(u.$s);case"ss":return b.s(u.$s,2,"0");case"SSS":return b.s(u.$ms,3,"0");case"Z":return p}return null})(I)||p.replace(":","")}))},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(o,u,a){var h,p=this,m=b.p(u),O=k(o),D=(O.utcOffset()-this.utcOffset())*e,M=this-O,H=function(){return b.m(p,O)};switch(m){case A:h=H()/12;break;case T:h=H();break;case $:h=H()/3;break;case y:h=(M-D)/6048e5;break;case x:h=(M-D)/864e5;break;case d:h=M/r;break;case c:h=M/e;break;case n:h=M/t;break;default:h=M}return a?h:b.a(h)},i.daysInMonth=function(){return this.endOf(T).$D},i.$locale=function(){return j[this.$L]},i.locale=function(o,u){if(!o)return this.$L;var a=this.clone(),h=E(o,u,!0);return h&&(a.$L=h),a},i.clone=function(){return b.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},f})(),L=R.prototype;return k.prototype=L,[["$ms",s],["$s",n],["$m",c],["$H",d],["$W",x],["$M",T],["$y",A],["$D",P]].forEach((function(f){L[f[1]]=function(i){return this.$g(i,f[0],f[1])}})),k.extend=function(f,i){return f.$i||(f(i,R,k),f.$i=!0),k},k.locale=E,k.isDayjs=N,k.unix=function(f){return k(1e3*f)},k.en=j[C],k.Ls=j,k.p={},k}))});var ve=z(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.FormatterOptions=void 0;var _e=class{objectMode=!0;delimiter=",";rowDelimiter=`
2
- `;quote='"';escape=this.quote;quoteColumns=!1;quoteHeaders=this.quoteColumns;headers=null;includeEndRowDelimiter=!1;transform;shouldWriteHeaders;writeBOM=!1;escapedQuote;BOM="\uFEFF";alwaysWriteHeaders=!1;constructor(e={}){Object.assign(this,e||{}),typeof e?.quoteHeaders>"u"&&(this.quoteHeaders=this.quoteColumns),e?.quote===!0?this.quote='"':e?.quote===!1&&(this.quote=""),typeof e?.escape!="string"&&(this.escape=this.quote),this.shouldWriteHeaders=!!this.headers&&(e.writeHeaders??!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}};ie.FormatterOptions=_e});var Ke=z((Gr,Ge)=>{var Kt=1/0,Xt="[object Symbol]",Ze=/[\\^$.*+?()[\]{}|]/g,Qt=RegExp(Ze.source),er=typeof global=="object"&&global&&global.Object===Object&&global,tr=typeof self=="object"&&self&&self.Object===Object&&self,rr=er||tr||Function("return this")(),nr=Object.prototype,sr=nr.toString,qe=rr.Symbol,Je=qe?qe.prototype:void 0,Ve=Je?Je.toString:void 0;function or(t){if(typeof t=="string")return t;if(ar(t))return Ve?Ve.call(t):"";var e=t+"";return e=="0"&&1/t==-Kt?"-0":e}function ir(t){return!!t&&typeof t=="object"}function ar(t){return typeof t=="symbol"||ir(t)&&sr.call(t)==Xt}function cr(t){return t==null?"":or(t)}function ur(t){return t=cr(t),t&&Qt.test(t)?t.replace(Ze,"\\$&"):t}Ge.exports=ur});var ke=z(X=>{"use strict";var lr=X&&X.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(X,"__esModule",{value:!0});X.FieldFormatter=void 0;var dr=lr(Ke()),Se=class{formatterOptions;_headers=null;REPLACE_REGEXP;ESCAPE_REGEXP;constructor(e){this.formatterOptions=e,e.headers!==null&&(this.headers=e.headers),this.REPLACE_REGEXP=new RegExp(e.quote,"g");let r=`[${e.delimiter}${(0,dr.default)(e.rowDelimiter)}|\r|
3
- ]`;this.ESCAPE_REGEXP=new RegExp(r)}set headers(e){this._headers=e}shouldQuote(e,r){let s=r?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;return typeof s=="boolean"?s:Array.isArray(s)?s[e]:this._headers!==null?s[this._headers[e]]:!1}format(e,r,s){let n=`${e??""}`.replace(/\0/g,""),{formatterOptions:c}=this;return c.quote!==""&&n.indexOf(c.quote)!==-1?this.quoteField(n.replace(this.REPLACE_REGEXP,c.escapedQuote)):n.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(r,s)?this.quoteField(n):n}quoteField(e){let{quote:r}=this.formatterOptions;return`${r}${e}${r}`}};X.FieldFormatter=Se});var xe=z(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.isSyncTransform=void 0;var fr=t=>t.length===1;ae.isSyncTransform=fr});var Xe=z(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.RowFormatter=void 0;var hr=ke(),pr=xe(),Te=class t{static isRowHashArray(e){return Array.isArray(e)?Array.isArray(e[0])&&e[0].length===2:!1}static isRowArray(e){return Array.isArray(e)&&!this.isRowHashArray(e)}static gatherHeaders(e){return t.isRowHashArray(e)?e.map(r=>r[0]):Array.isArray(e)?e:Object.keys(e)}static createTransform(e){return(0,pr.isSyncTransform)(e)?(r,s)=>{let n=null;try{n=e(r)}catch(c){return s(c)}return s(null,n)}:(r,s)=>{e(r,s)}}formatterOptions;fieldFormatter;shouldWriteHeaders;_rowTransform;headers;hasWrittenHeaders;rowCount=0;constructor(e){this.formatterOptions=e,this.fieldFormatter=new hr.FieldFormatter(e),this.headers=e.headers,this.shouldWriteHeaders=e.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null&&(this.fieldFormatter.headers=this.headers),e.transform&&(this.rowTransform=e.transform)}set rowTransform(e){if(typeof e!="function")throw new TypeError("The transform should be a function");this._rowTransform=t.createTransform(e)}format(e,r){this.callTransformer(e,(s,n)=>{if(s)return r(s);if(!e)return r(null);let c=[];if(n){let{shouldFormatColumns:d,headers:x}=this.checkHeaders(n);if(this.shouldWriteHeaders&&x&&!this.hasWrittenHeaders&&(c.push(this.formatColumns(x,!0)),this.hasWrittenHeaders=!0),d){let y=this.gatherColumns(n);c.push(this.formatColumns(y,!1))}}return r(null,c)})}finish(e){let r=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return e(new Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));r.push(this.formatColumns(this.headers,!0))}return this.formatterOptions.includeEndRowDelimiter&&r.push(this.formatterOptions.rowDelimiter),e(null,r)}checkHeaders(e){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let r=t.gatherHeaders(e);return this.headers=r,this.fieldFormatter.headers=r,this.shouldWriteHeaders?Array.isArray(e)&&r.every((s,n)=>s===e[n])?{shouldFormatColumns:!1,headers:r}:{shouldFormatColumns:!0,headers:r}:{shouldFormatColumns:!0,headers:null}}gatherColumns(e){if(this.headers===null)throw new Error("Headers is currently null");return Array.isArray(e)?t.isRowHashArray(e)?this.headers.map((r,s)=>{let n=e[s];return n?n[1]:""}):t.isRowArray(e)&&!this.shouldWriteHeaders?e:this.headers.map((r,s)=>e[s]):this.headers.map(r=>e[r])}callTransformer(e,r){return this._rowTransform?this._rowTransform(e,r):r(null,e)}formatColumns(e,r){let s=e.map((c,d)=>this.fieldFormatter.format(c,d,r)).join(this.formatterOptions.delimiter),{rowCount:n}=this;return this.rowCount+=1,n?[this.formatterOptions.rowDelimiter,s].join(""):s}};ce.RowFormatter=Te});var Qe=z(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.FieldFormatter=Q.RowFormatter=void 0;var gr=Xe();Object.defineProperty(Q,"RowFormatter",{enumerable:!0,get:function(){return gr.RowFormatter}});var mr=ke();Object.defineProperty(Q,"FieldFormatter",{enumerable:!0,get:function(){return mr.FieldFormatter}})});var De=z(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.CsvFormatterStream=void 0;var yr=se("stream"),br=Qe(),Oe=class extends yr.Transform{formatterOptions;rowFormatter;hasWrittenBOM=!1;constructor(e){super({writableObjectMode:e.objectMode}),this.formatterOptions=e,this.rowFormatter=new br.RowFormatter(e),this.hasWrittenBOM=!e.writeBOM}transform(e){return this.rowFormatter.rowTransform=e,this}_transform(e,r,s){let n=!1;try{this.hasWrittenBOM||(this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0),this.rowFormatter.format(e,(c,d)=>c?(n=!0,s(c)):(d&&d.forEach(x=>{this.push(Buffer.from(x,"utf8"))}),n=!0,s()))}catch(c){if(n)throw c;s(c)}}_flush(e){this.rowFormatter.finish((r,s)=>r?e(r):(s&&s.forEach(n=>{this.push(Buffer.from(n,"utf8"))}),e()))}};ue.CsvFormatterStream=Oe});var tt=z(v=>{"use strict";var et=v&&v.__createBinding||(Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]})),wr=v&&v.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),_r=v&&v.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[s.length]=n);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),n=0;n<s.length;n++)s[n]!=="default"&&et(r,e,s[n]);return wr(r,e),r}})(),vr=v&&v.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&et(e,t,r)};Object.defineProperty(v,"__esModule",{value:!0});v.writeToPath=v.writeToString=v.writeToBuffer=v.writeToStream=v.write=v.format=v.FormatterOptions=v.CsvFormatterStream=void 0;var Sr=se("util"),kr=se("stream"),xr=_r(se("fs")),Tr=ve(),Or=De();vr(xe(),v);var Dr=De();Object.defineProperty(v,"CsvFormatterStream",{enumerable:!0,get:function(){return Dr.CsvFormatterStream}});var $r=ve();Object.defineProperty(v,"FormatterOptions",{enumerable:!0,get:function(){return $r.FormatterOptions}});var Cr=t=>new Or.CsvFormatterStream(new Tr.FormatterOptions(t));v.format=Cr;var Er=(t,e)=>{let r=(0,v.format)(e),s=(0,Sr.promisify)((n,c)=>{r.write(n,c)});return t.reduce((n,c)=>n.then(()=>s(c)),Promise.resolve()).then(()=>{r.end()}).catch(n=>{r.emit("error",n)}),r};v.write=Er;var Mr=(t,e,r)=>(0,v.write)(e,r).pipe(t);v.writeToStream=Mr;var Ar=(t,e={})=>{let r=[],s=new kr.Writable({write(n,c,d){r.push(n),d()}});return new Promise((n,c)=>{s.on("error",c).on("finish",()=>n(Buffer.concat(r))),(0,v.write)(t,e).pipe(s)})};v.writeToBuffer=Ar;var Ir=(t,e)=>(0,v.writeToBuffer)(t,e).then(r=>r.toString());v.writeToString=Ir;var jr=(t,e,r)=>{let s=xr.createWriteStream(t,{encoding:"utf8"});return(0,v.write)(e,r).pipe(s)};v.writeToPath=jr});var rt=z(($e,Ce)=>{(function(t,e){typeof $e=="object"&&typeof Ce<"u"?Ce.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})($e,(function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,s=/\d\d/,n=/\d\d?/,c=/\d*[^-_:/,()\s\d]+/,d={},x=function(l){return(l=+l)+(l>68?1900:2e3)},y=function(l){return function(w){this[l]=+w}},T=[/[+-]\d\d:?(\d\d)?|Z/,function(l){(this.zone||(this.zone={})).offset=(function(w){if(!w||w==="Z")return 0;var S=w.match(/([+-]|\d\d)/g),_=60*S[1]+(+S[2]||0);return _===0?0:S[0]==="+"?-_:_})(l)}],$=function(l){var w=d[l];return w&&(w.indexOf?w:w.s.concat(w.f))},A=function(l,w){var S,_=d.meridiem;if(_){for(var F=1;F<=24;F+=1)if(l.indexOf(_(F,0,w))>-1){S=F>12;break}}else S=l===(w?"pm":"PM");return S},P={A:[c,function(l){this.afternoon=A(l,!1)}],a:[c,function(l){this.afternoon=A(l,!0)}],Q:[r,function(l){this.month=3*(l-1)+1}],S:[r,function(l){this.milliseconds=100*+l}],SS:[s,function(l){this.milliseconds=10*+l}],SSS:[/\d{3}/,function(l){this.milliseconds=+l}],s:[n,y("seconds")],ss:[n,y("seconds")],m:[n,y("minutes")],mm:[n,y("minutes")],H:[n,y("hours")],h:[n,y("hours")],HH:[n,y("hours")],hh:[n,y("hours")],D:[n,y("day")],DD:[s,y("day")],Do:[c,function(l){var w=d.ordinal,S=l.match(/\d+/);if(this.day=S[0],w)for(var _=1;_<=31;_+=1)w(_).replace(/\[|\]/g,"")===l&&(this.day=_)}],w:[n,y("week")],ww:[s,y("week")],M:[n,y("month")],MM:[s,y("month")],MMM:[c,function(l){var w=$("months"),S=($("monthsShort")||w.map((function(_){return _.slice(0,3)}))).indexOf(l)+1;if(S<1)throw new Error;this.month=S%12||S}],MMMM:[c,function(l){var w=$("months").indexOf(l)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,y("year")],YY:[s,function(l){this.year=x(l)}],YYYY:[/\d{4}/,y("year")],Z:T,ZZ:T};function g(l){var w,S;w=l,S=d&&d.formats;for(var _=(l=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(k,b,R){var L=R&&R.toUpperCase();return b||S[R]||t[R]||S[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(f,i,o){return i||o.slice(1)}))}))).match(e),F=_.length,C=0;C<F;C+=1){var j=_[C],Y=P[j],N=Y&&Y[0],E=Y&&Y[1];_[C]=E?{regex:N,parser:E}:j.replace(/^\[|\]$/g,"")}return function(k){for(var b={},R=0,L=0;R<F;R+=1){var f=_[R];if(typeof f=="string")L+=f.length;else{var i=f.regex,o=f.parser,u=k.slice(L),a=i.exec(u)[0];o.call(b,a),k=k.replace(a,"")}}return(function(h){var p=h.afternoon;if(p!==void 0){var m=h.hours;p?m<12&&(h.hours+=12):m===12&&(h.hours=0),delete h.afternoon}})(b),b}}return function(l,w,S){S.p.customParseFormat=!0,l&&l.parseTwoDigitYear&&(x=l.parseTwoDigitYear);var _=w.prototype,F=_.parse;_.parse=function(C){var j=C.date,Y=C.utc,N=C.args;this.$u=Y;var E=N[1];if(typeof E=="string"){var k=N[2]===!0,b=N[3]===!0,R=k||b,L=N[2];b&&(L=N[2]),d=this.$locale(),!k&&L&&(d=S.Ls[L]),this.$d=(function(u,a,h,p){try{if(["x","X"].indexOf(a)>-1)return new Date((a==="X"?1e3:1)*u);var m=g(a)(u),O=m.year,D=m.month,M=m.day,H=m.hours,V=m.minutes,q=m.seconds,G=m.milliseconds,U=m.zone,I=m.week,B=new Date,J=M||(O||D?1:B.getDate()),Z=O||B.getFullYear(),re=0;O&&!D||(re=D>0?D-1:B.getMonth());var ne,de=H||0,fe=V||0,he=q||0,pe=G||0;return U?new Date(Date.UTC(Z,re,J,de,fe,he,pe+60*U.offset*1e3)):h?new Date(Date.UTC(Z,re,J,de,fe,he,pe)):(ne=new Date(Z,re,J,de,fe,he,pe),I&&(ne=p(ne).week(I).toDate()),ne)}catch{return new Date("")}})(j,E,Y,S),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),R&&j!=this.format(E)&&(this.$d=new Date("")),d={}}else if(E instanceof Array)for(var f=E.length,i=1;i<=f;i+=1){N[1]=E[i-1];var o=S.apply(this,N);if(o.isValid()){this.$d=o.$d,this.$L=o.$L,this.init();break}i===f&&(this.$d=new Date(""))}else F.call(this,C)}}}))});var nt=z((Ee,Me)=>{(function(t,e){typeof Ee=="object"&&typeof Me<"u"?Me.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_utc=e()})(Ee,(function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(s,n,c){var d=n.prototype;c.utc=function(g){var l={date:g,utc:!0,args:arguments};return new n(l)},d.utc=function(g){var l=c(this.toDate(),{locale:this.$L,utc:!0});return g?l.add(this.utcOffset(),t):l},d.local=function(){return c(this.toDate(),{locale:this.$L,utc:!1})};var x=d.parse;d.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),x.call(this,g)};var y=d.init;d.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else y.call(this)};var T=d.utcOffset;d.utcOffset=function(g,l){var w=this.$utils().u;if(w(g))return this.$u?0:w(this.$offset)?T.call(this):this.$offset;if(typeof g=="string"&&(g=(function(C){C===void 0&&(C="");var j=C.match(e);if(!j)return null;var Y=(""+j[0]).match(r)||["-",0,0],N=Y[0],E=60*+Y[1]+ +Y[2];return E===0?0:N==="+"?E:-E})(g),g===null))return this;var S=Math.abs(g)<=16?60*g:g;if(S===0)return this.utc(l);var _=this.clone();if(l)return _.$offset=S,_.$u=!1,_;var F=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(_=this.local().add(S+F,t)).$offset=S,_.$x.$localOffset=F,_};var $=d.format;d.format=function(g){var l=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return $.call(this,l)},d.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},d.isUTC=function(){return!!this.$u},d.toISOString=function(){return this.toDate().toISOString()},d.toString=function(){return this.toDate().toUTCString()};var A=d.toDate;d.toDate=function(g){return g==="s"&&this.$offset?c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():A.call(this)};var P=d.diff;d.diff=function(g,l,w){if(g&&this.$u===g.$u)return P.call(this,g,l,w);var S=this.local(),_=c(g).local();return P.call(S,_,l,w)}}}))});var Nt=z((Cn,zr)=>{zr.exports={name:"@keruyun/agent-cli",version:"1.5.2",description:"\u5BA2\u5982\u4E91 CLI \u5DE5\u5177",keywords:[],license:"MIT",author:"\u7384\u5BAB",repository:{type:"git",url:"http://gitlab.alibaba-inc.com/alsc-kry-open/krycli.git"},bin:{krycli:"./bin/index.js"},files:["bin"],exports:{"/sdk":{types:"./bin/sdk.mjs",import:"./bin/sdk.mjs"}},scripts:{prepare:"husky install",postinstall:"node bin/where_is_kry_cli.js",prepublishOnly:"tnpm run build",dev:"node scripts/dev.mjs",check:"tsc --noEmit && vitest run",ci:"tnpm run lint && tnpm run verify",verify:"node scripts/verify-refactor.mjs","verify:baseline":"node scripts/verify-refactor.mjs --baseline",test:"vitest run",lint:"eslint . --ext js,jsx,ts,tsx","lint:fix":"eslint --fix . --ext js,jsx,ts,tsx",build:"tsc --noEmit && tnpm run prod && tnpm run sdk && cp -f ./py/log.py ./bin/log.py",prod:"esbuild src/index.ts --bundle --minify --format=cjs --outfile=./bin/index.js --platform=node --legal-comments=none $ESBUILD_DEFINE",sdk:"esbuild src/sdk.ts --bundle --minify --format=esm --outfile=./bin/sdk.mjs --platform=node --legal-comments=none $ESBUILD_DEFINE","build:bin":"node scripts/build-binaries.mjs","release:pack":"node scripts/pack-release.mjs --tarball","release:verify":"node scripts/pack-release.mjs --verify","release:outer:beta":"node scripts/publish-binary.mjs --target=outer --tag=beta --prerelease","release:outer":"node scripts/publish-binary.mjs --target=outer --tag=latest","release:inner:beta":"node scripts/publish-binary.mjs --target=inner --tag=beta --prerelease","release:inner":"node scripts/publish-binary.mjs --target=inner --tag=latest","regr:base":'node regression/snapshot.mjs --target "node bin/index.js" --label node --layer L0,L1,L2',"regr:bun":'node regression/snapshot.mjs --target "./dist-bun/kry-cli" --label bun --layer L0,L1,L2',"regr:diff":"node regression/compare.mjs --base node --target bun",doc:"node dist/schema/gen.js",pack:"node dist/pack/index.js",wasm:"node scripts/gen-sql-wasm.mjs","legacy:release:outer":"node scripts/publish-release.mjs","legacy:release:inner":"node scripts/publish-beta.mjs --pre"},dependencies:{xlsx:"^0.18.5"},devDependencies:{"@ali/eslint-config-att":"^1.0.6","@ali/stylelint-config-xy":"^1.0.14","@commitlint/cli":"^17.7.1","@commitlint/config-conventional":"^17.7.0","@commitlint/cz-commitlint":"^17.7.1","@commitlint/format":"^17.4.4","@fast-csv/format":"^5.0.7","@puppeteer/browsers":"^3.0.3","@types/fs-extra":"^11.0.4","@types/node":"^25.6.0","@types/sql.js":"^1.4.11","@typescript-eslint/eslint-plugin":"^6.4.0","@typescript-eslint/parser":"^6.4.0",commander:"^15.0.0","cz-conventional-changelog":"^3.3.0",dayjs:"^1.11.20",esbuild:"^0.28.0",eslint:"^8.47.0","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0",exceljs:"^4.4.0","fs-extra":"^11.3.5",husky:"^8.0.3",jsonrepair:"^3.14.0",jszip:"^3.10.1","lint-staged":"^14.0.0","puppeteer-core":"^25.0.4","sql.js":"^1.14.1",stylelint:"^15.10.3","ts-node":"^10.9.2",tslib:"^2.4.0",typescript:"^5.0.0",vitest:"^4.1.6",zod:"^4.4.3"},"lint-staged":{"**/*.{ts,tsx,js,jsx}":"eslint","**/*.less":"stylelint"},config:{commitizen:{path:"@commitlint/cz-commitlint"}}}});import Bt from"path";import zt from"os";var Ut={prod:{api:"https://openapi.keruyun.com",auth:"https://open.keruyun.com",clientId:"kry-cli"},pre:{api:"https://preopenapi.tongyun0815.com",auth:"https://preopen.tongyun0815.com",clientId:"kry-cli"},gld:{api:"https://gldopenapi.keruyun.com",auth:"https://gldopen.keruyun.com",clientId:"kry-cli"},safety:{api:"https://openapi.keruyun.com",auth:"https://open.keruyun.com",clientId:"kry-cli",extraHeaders:{"kry-api-brand-id":"32296"}}},Re={daily:"gld",pre:"pre",prod:"prod"};var Wt="prod";function ye(){if(process.env?.CLIENT_CLAW_ENV&&Re[process.env.CLIENT_CLAW_ENV])return Re[process.env.CLIENT_CLAW_ENV];let t=process.env.KRY_FORCE_ENV;return t&&Ut[t]?t:Wt}function Pe(...t){return Bt.join(process.env.AGENT_WORK_ROOT||zt.homedir(),...t)}var Fe=(...t)=>{let e=ye();return e==="prod"?Pe(".kry-cli",...t):Pe(`.kry-cli-${e}`,...t)},ge="-o <tempFilePath>.json",me="-o <tempFilePath>.xlsx",qt="-o <tempFilePath>.csv",Jt={viewBrand:"krycli brand",viewBrandJson:"krycli brand --format json",viewShop:"krycli shop",viewShopByKeyword:"krycli shop -k '\u5173\u952E\u8BCD1|\u5173\u952E\u8BCD2'",viewShopParams:t=>`krycli shop -b ${t?.brandId||"<brandId>"}`,viewShopJson:"krycli shop -b <brandId> --format json",callShop:"krycli call open/xxx -s <shopId> -d '<JSON>'",callShopParams:t=>`krycli call ${(t?.url||"open/xxx").replace(/^\//,"")} -s ${t?.shopId||"<shopId>"} -d '<JSON>'`,callBrand:"krycli call open/xxx -b <brandId> -d '<JSON>'",callBrandOutput:`krycli call open/xxx -b <brandId> ${ge} -d '<JSON>'`,callBrandFile:"krycli call open/xxx -b <brandId> -d @params.json",callDryRun:"krycli call open/xxx -b <brandId> -d '<JSON>' --dry-run",callBrandParams:t=>`krycli call ${(t?.url||"open/xxx").replace(/^\//,"")} -b ${t?.brandId||"<brandId>"} -d '<JSON>'`,callOutput:"\u5982\u679C\u6570\u636E\u91CF\u8FC7\u5927\u6216\u8005\u95E8\u5E97\u8D85\u8FC7 10 \u5BB6\uFF0C\u4F7F\u7528\u53C2\u6570 `-o <tempFilePath>` \u5C06\u6570\u636E\u4FDD\u5B58\u5230\u6587\u4EF6\uFF08<tempFilePath> \u9700\u4E3A\u5F53\u524D\u7CFB\u7EDF\u5408\u6CD5\u8DEF\u5F84\uFF0C\u5982\u76F8\u5BF9\u6587\u4EF6\u540D\u6216\u7CFB\u7EDF\u4E34\u65F6\u76EE\u5F55\u4E0B\u7684\u8DEF\u5F84\uFF0C\u4E0D\u8981\u7167\u6284\u5176\u5B83\u5E73\u53F0\u7684\u793A\u4F8B\uFF09",login:"krycli login",logout:"krycli logout",logoutJson:"krycli logout --format json",viewAllApi:"krycli view",viewSpcApi:"krycli view <\u63A5\u53E3\u8DEF\u5F84>",viewSpcApiJson:"krycli view <\u63A5\u53E3\u8DEF\u5F84> --format json",searchApi:"krycli view '\u5173\u952E\u8BCD1|\u5173\u952E\u8BCD2'",viewPathNote:"\uFF08\u63A5\u53E3\u8DEF\u5F84\u4F20\u53C2\u65F6\u5E26\u4E0D\u5E26\u524D\u5BFC / \u5747\u53EF\uFF1BGit Bash \u4E0B\u63A8\u8350\u4E0D\u5E26\uFF0C\u53EF\u907F\u514D\u8DEF\u5F84\u88AB\u81EA\u52A8\u8F6C\u6362\uFF09",comment:{kry:"krycli comment keruyun -b 123 --shopIds 456,789 --start 2026-04-01 --end 2026-04-30",kryAll:"krycli comment keruyun -b 123 --start 2026-04-01 --end 2026-04-30",kryOutput:`krycli comment keruyun -b 123 ${qt}`,meituan:`krycli comment meituan ${me} --start 2026-04-01 --end 2026-04-30`,brandKey:"krycli comment brandKey -b 123",weibo:{brand:"krycli comment weibo -b 123",key:"krycli comment weibo -k \u54C1\u724C\u5173\u952E\u8BCD"},xiaohongshu:{brand:"krycli comment xiaohongshu -b 123",key:"krycli comment xiaohongshu -k \u54C1\u724C\u5173\u952E\u8BCD"},blackcat:{key:`krycli comment blackcat -k \u9738\u738B\u8336\u59EC ${ge}`,company:`krycli comment blackcat --companyUrl 'https://zj.tousu.sina.com.cn/company/view/?couid=5652018762' ${ge}`}},export:{star:`krycli export ecom star ${me}`,star30:`krycli export ecom star ${me} --start 2026-04-01 --end 2026-04-30`},viewDate:"krycli date",viewDateJson:"krycli date --format json",upgrade:"krycli upgrade",upgradeCheck:"krycli upgrade --check",upgradeForce:"krycli upgrade --force",upgradeMin:"krycli upgrade --min <version>"},Vt=process.env.AGENT_WORK_ROOT||"";function Ye(t){return t?.match(/(?:^|[/\\])(user-[^/\\]+)[/\\]?$/)?.[1]||""}var Le=Ye(Vt);function Zt(){return!!Ye(process.env.AGENT_WORK_ROOT||"")}var He=(process.env.REWIND_SESSION_ID||"").match(/^eval-sess-eval/);function Be(){return process.env.CLIENT_CLAW_TYPE==="KRY_CLAW"}function Gt(){return process.env.QODER_WORK_INTEGRATION_PRODUCT==="qwenworkcn"||process.env.DINGTALK_DWS_AGENTCODE==="qwenwork"||process.env.DWS_AGENT_PRODUCT==="qwenwork"}function ze(){return Be()?"kryclaw":Gt()?"qwenwork":Zt()?"wukong":"other"}function Ue(){if(!Be())return{};let t=e=>(e||"").trim()||void 0;return{brandId:t(process.env.CLAW_BRAND_ID),brandName:t(process.env.CLAW_BRAND_NAME),employeeId:t(process.env.CLAW_EMPLOYEE_ID),storeId:t(process.env.CLAW_STORE_ID),storeName:t(process.env.CLAW_STORE_NAME),clawVersion:t(process.env.CLAW_PKG_VERSION),clawBuildTime:t(process.env.CLAW_PKG_TIME)}}import*as W from"fs";import*as K from"path";import je from"os";var Ae=oe(We());var st=oe(tt()),ot=oe(rt()),it=oe(nt());Ae.default.extend(ot.default);Ae.default.extend(it.default);function Ie(t){let e=t?.cause;return e?e.code?e.code:Array.isArray(e.errors)?e.errors.find(r=>r?.code)?.code||"":e.message?String(e.message).slice(0,100):"":""}var Nr="https://tnnm-alsc-saas-merchant-spider-fy21.cn-wulanchabu.log.aliyuncs.com/logstores/kry-cli/track?APIVersion=0.6.0",at="KRY_CLI_NO_TRACK",ct="KRY_CLI_TRACK_DEBUG",Rr=process.env.REWIND_SESSION_ID||"",cn=process.env.ROBOT_UID||"",Pr=crypto.randomUUID().replaceAll("-",""),lt,dt,ft=0,ht=0,pt,gt,mt,yt,bt,wt,_t,vt,St,kt,xt,Tt;function Ot(t){t?.brandId&&(lt=t.brandId),t?.brandName&&(dt=t.brandName),t?.brandCount!==void 0&&(ft=t.brandCount),t?.shopCount!==void 0&&(ht=t.shopCount),t?.version&&(pt=t.version),t?.userId&&(gt=t.userId),t?.source&&(mt=t.source),t?.mobile&&(yt=t.mobile),t?.pkg&&(bt=t.pkg),t?.employeeId&&(vt=t.employeeId),t?.storeId&&(St=t.storeId),t?.storeName&&(kt=t.storeName),t?.clawVersion&&(xt=t.clawVersion),t?.clawBuildTime&&(Tt=t.clawBuildTime)}function Fr(t){let e={path:"",skill:""},s=((t||[]).find(c=>c.includes("kry-"))||"").split(/[/\\]+/),n=s.findIndex(c=>c.includes("kry-")&&c!=="kry-claw-skills");return n===-1||(e.skill=s[n],e.path=s.slice(n+1).join("/")),e}function Dt(){try{let t=Fr(process.argv);return t.skill&&(_t=t.skill),t.path&&(wt=t.path),t}catch{}return null}function $t(t){return t instanceof Error}function Ct(t){let e={};return Object.keys(t).forEach(r=>{e[r]=t[r]}),e.stack=t.stack,e}function Yr(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,typeof r=="string"?r:JSON.stringify(r,(s,n)=>$t(n)?Ct(n):n)]))}var Lr=()=>process.env[at]==="1"||process.env[at]==="true",ut=()=>process.env[ct]==="1"||process.env[ct]==="true";function le(t,e,r){if(Lr())return;let s,n=ye();if(n==="prod"&&t==="debug")return;let c={traceId:Pr,level:t,message:e},d={env:n,brandId:lt,brandName:dt,brandCount:ft.toString(),shopCount:ht.toString(),version:pt,sessionId:Rr,userId:gt,hostname:je.hostname(),platform:je.platform(),arch:je.arch(),source:mt,mobile:yt,pkg:bt,callPath:wt,callSkill:_t,employeeId:vt,storeId:St,storeName:kt,clawVersion:xt,clawBuildTime:Tt};He&&(d.test="TestRunner");try{let{tag:y,...T}=r||{},$={...c,tag:y,data:T};Object.keys($.data||{}).length===0&&delete $.data,s=JSON.stringify({__logs__:[Yr($)],__tags__:d})}catch{s=JSON.stringify({__logs__:[JSON.stringify({...c,level:"error",message:e,data:"[Unserializable]"})],__tags__:d})}let x=Date.now();return fetch(Nr,{method:"POST",headers:new Headers,body:s}).then(y=>{ut()&&process.stderr.write(`[log] HTTP ${y.status}\uFF08${Date.now()-x} ms\uFF09${e}
4
- `)}).catch(y=>{if(ut()){let T=Ie(y);process.stderr.write(`[log] \u4E0A\u62A5\u5931\u8D25\uFF08${Date.now()-x} ms\uFF09\uFF1A${y?.name||""} ${y?.message||String(y)}${T?` cause=${T}`:""}
5
- `)}})}function Et(t){return{info:(e,r)=>le("info",e,{...t,...r}),warn:(e,r)=>le("warn",e,{...t,...r}),error:(e,r)=>le("error",e,{...t,...$t(r)?Ct(r):r}),debug:(e,r)=>le("debug",e,{...t,...r}),child:e=>Et({...t,...e})}}var ee=Et();var te=Fe(),vn=K.join(te,"credentials.json"),Sn=K.join(te,"token-cache.json"),Mt=K.join(te,"authorized-orgs.json"),kn=3e3*1e3;var At=K.join(te,"token.json"),xn=K.join(te,"discovery.json"),Tn=K.join(te,"login.pid");function Hr(){let t=ee.child({tag:"loadOAuth2Token"});if(!W.existsSync(At))return null;try{let e=W.readFileSync(At,"utf-8");return JSON.parse(e)}catch(e){return t.error("\u8BFB\u53D6 OAuth2 Token \u5931\u8D25",e),null}}var Dn=1440*60*1e3;function Br(){let t=ee.child({tag:"loadAuthorizedOrgs"});if(!W.existsSync(Mt))return null;try{let e=W.readFileSync(Mt,"utf-8");return JSON.parse(e)}catch(e){return t.error("\u672C\u5730\u8BFB\u53D6\u5DF2\u6388\u6743\u54C1\u724C/\u95E8\u5E97\u5217\u8868\u5931\u8D25",e),null}}function It(){let t={success:!1,brandId:"",brandName:"",brandCount:0,shopCount:0,brandMap:{},shopMap:{},brands:[],shops:[]},e=Br();if(e){let r=e.brandList||[],s=r.length,n={},c={},d=r[0]||{},x=String(d.id||"")||"",y=d.name||"",T=0;for(let $ of r){n[String($.id)]=$,t.brands.push($);let A=$.shopList||[];A.length>T&&(T=A.length,x=String($.id),y=$.name);for(let P of A)c[String(P.id)]=P}t.success=!0,t.brandMap=n,t.shopMap=c,t.brandCount=s,t.shopCount=T,t.brandId=x,t.brandName=y}return t}function jt(){try{let s=(Hr()?.access_token||"").split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=s.padEnd(s.length+(4-s.length%4)%4,"="),c=Buffer.from(n,"base64").toString("utf8");return JSON.parse(c)}catch{return{}}}try{let t=ee.child({tag:"sdk:init"}),e=It(),r=jt(),s=Ue(),n=ze(),c=Nt();Ot({version:c.version,brandId:s.brandId||e.brandId,brandName:s.brandName||e.brandName,brandCount:e.brandCount,shopCount:e.shopCount,userId:Le,source:n,mobile:r?.sub,pkg:c.name,employeeId:s.employeeId,storeId:s.storeId,storeName:s.storeName,clawVersion:s.clawVersion,clawBuildTime:s.clawBuildTime});let d=Dt();t.info("SDK \u542F\u52A8\uFF0C\u8BBE\u7F6E\u65E5\u5FD7\u53C2\u6570",{args:process.argv.join(" "),call:d})}catch{}export{ee as logger};
1
+ var Q=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Y=Q((Fe,he)=>{he.exports={name:"@keruyun/cli",version:"1.5.3",description:"\u5BA2\u5982\u4E91 CLI \u5DE5\u5177",keywords:[],license:"MIT",author:"\u7384\u5BAB",repository:{type:"git",url:"http://gitlab.alibaba-inc.com/alsc-kry-open/krycli.git"},bin:{"kry-cli":"./bin/index.js"},files:["bin"],exports:{"/sdk":{types:"./bin/sdk.mjs",import:"./bin/sdk.mjs"}},scripts:{precommit:"lint-staged",prepublishOnly:"tnpm run build",postinstall:"node bin/where_is_kry_cli.js",build:"tsc --noEmit && tnpm run prod && tnpm run sdk && tnpm run py",local:"sh scripts/install-global.sh",dev:"KRY_FORCE_ENV=pre && tsc --watch",release:"yarn build && tnpm publish","release:npm":"node scripts/publish-release.mjs",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",prepare:"husky install","lint:fix-script":"eslint --fix . --ext js,jsx,ts,tsx","lint:fix-style":'stylelint "**/*.less" --fix',"lint:script":"eslint . --ext js,jsx,ts,tsx","lint:style":'stylelint "**/*.less"',commit:"git-cz",prod:"esbuild src/index.ts --bundle --minify --format=cjs --outfile=./bin/index.js --platform=node --legal-comments=none $ESBUILD_DEFINE && cp node_modules/sql.js/dist/sql-wasm.wasm ./bin/sql-wasm.wasm",sdk:"esbuild src/sdk.ts --bundle --minify --format=esm --outfile=./bin/sdk.mjs --platform=node --legal-comments=none $ESBUILD_DEFINE",py:"cp -f ./py/log.py ./bin/log.py",test:"vitest run",cp:"cp -f ./src/run/kry-cli /Users/lh/.real/.bin/node/bin/kry-cli",rm:"rm -f /Users/lh/.real/.bin/node/bin/kry-cli",doc:"node dist/schema/gen.js",pack:"node dist/pack/index.js",beta:"node scripts/publish-beta.mjs --pre","beta:publish":"tnpm publish --tag beta --force-publish-registry --ignore-scripts",wb:"cp -f /Users/lh/.kry-cli/comment-v1.json /Users/lh/.real/users/user-048911581b50b8719511c585c3a6f77f/.kry-cli/comment-v1.json"},dependencies:{xlsx:"^0.18.5"},devDependencies:{"@ali/eslint-config-att":"^1.0.6","@ali/stylelint-config-xy":"^1.0.14","@commitlint/cli":"^17.7.1","@commitlint/config-conventional":"^17.7.0","@commitlint/cz-commitlint":"^17.7.1","@commitlint/format":"^17.4.4","@fast-csv/format":"^5.0.7","@puppeteer/browsers":"^3.0.3","@types/fs-extra":"^11.0.4","@types/node":"^25.6.0","@types/sql.js":"^1.4.11","@typescript-eslint/eslint-plugin":"^6.4.0","@typescript-eslint/parser":"^6.4.0",commander:"^15.0.0","cz-conventional-changelog":"^3.3.0",dayjs:"^1.11.20",esbuild:"^0.28.0",eslint:"^8.47.0","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0",exceljs:"^4.4.0","fs-extra":"^11.3.5",husky:"^8.0.3",jsonrepair:"^3.14.0","lint-staged":"^14.0.0","puppeteer-core":"^25.0.4","sql.js":"^1.14.1",stylelint:"^15.10.3","ts-node":"^10.9.2",tslib:"^2.4.0",typescript:"^5.0.0",vitest:"^4.1.6",zod:"^4.4.3"},"lint-staged":{"**/*.{ts,tsx,js,jsx}":"eslint","**/*.less":"stylelint"},config:{commitizen:{path:"@commitlint/cz-commitlint"}}}});import X from"path";import Z from"os";var ee={prod:{api:"https://openapi.keruyun.com",auth:"https://open.keruyun.com",clientId:"kry-cli"},pre:{api:"https://preopenapi.tongyun0815.com",auth:"https://preopen.tongyun0815.com",clientId:"kry-cli"},gld:{api:"https://gldopenapi.keruyun.com",auth:"https://gldopen.keruyun.com",clientId:"kry-cli"},safety:{api:"https://openapi.keruyun.com",auth:"https://open.keruyun.com",clientId:"kry-cli",extraHeaders:{"kry-api-brand-id":"32296"}}},v={daily:"gld",pre:"pre",prod:"prod"};var te="prod";function x(){if(process.env?.CLIENT_CLAW_ENV&&v[process.env.CLIENT_CLAW_ENV])return v[process.env.CLIENT_CLAW_ENV];let e=process.env.KRY_FORCE_ENV;return e&&ee[e]?e:te}function C(...e){return X.join(process.env.AGENT_WORK_ROOT||Z.homedir(),...e)}var T=(...e)=>{let t=x();return t==="prod"?C(".kry-cli",...e):C(`.kry-cli-${t}`,...e)},k="-o /temp_path/file.json",b="-o /path/file.xlsx",ne="-o /path/file.csv",re={viewBrand:"kry-cli brand",viewShop:"kry-cli shop",viewShopByKeyword:"kry-cli shop -k '\u5173\u952E\u8BCD1|\u5173\u952E\u8BCD2'",viewShopParams:e=>`kry-cli shop -b ${e?.brandId||"<brandId>"}`,callShop:"kry-cli call /open/xxx -s <shopId> -d '<JSON>'",callShopParams:e=>`kry-cli call ${e?.url||"/open/xxx"} -s ${e?.shopId||"<shopId>"} -d '<JSON>'`,callBrand:"kry-cli call /open/xxx -b <brandId> -d '<JSON>'",callBrandOutput:`kry-cli call /open/xxx -b <brandId> ${k} -d '<JSON>'`,callBrandParams:e=>`kry-cli call ${e?.url||"/open/xxx"} -b ${e?.brandId||"<brandId>"} -d '<JSON>'`,callOutput:"\u5982\u679C\u6570\u636E\u91CF\u8FC7\u5927\u6216\u8005\u95E8\u5E97\u8D85\u8FC7 10 \u5BB6\uFF0C\u4F7F\u7528\u53C2\u6570 `-o <tempFilePath>` \u5C06\u6570\u636E\u4FDD\u5B58\u5230\u4E34\u65F6\u6587\u4EF6",login:"kry-cli login",logout:"kry-cli logout",viewAllApi:"kry-cli view",viewSpcApi:"kry-cli view <\u63A5\u53E3\u8DEF\u5F84>",searchApi:"kry-cli view '\u5173\u952E\u8BCD1|\u5173\u952E\u8BCD2'",comment:{kry:"kry-cli comment keruyun -b 123 --shopIds 456,789 --start 2026-04-01 --end 2026-04-30",kryAll:"kry-cli comment keruyun -b 123 --start 2026-04-01 --end 2026-04-30",kryOutput:`kry-cli comment keruyun -b 123 ${ne}`,meituan:`kry-cli comment meituan ${b} --start 2026-04-01 --end 2026-04-30`,brandKey:"kry-cli comment brandKey -b 123",weibo:{brand:"kry-cli comment weibo -b 123",key:"kry-cli comment weibo -k \u54C1\u724C\u5173\u952E\u8BCD"},xiaohongshu:{brand:"kry-cli comment xiaohongshu -b 123",key:"kry-cli comment xiaohongshu -k \u54C1\u724C\u5173\u952E\u8BCD"},blackcat:{key:`kry-cli comment blackcat -k \u9738\u738B\u8336\u59EC ${k}`,company:`kry-cli comment blackcat --companyUrl 'https://zj.tousu.sina.com.cn/company/view/?couid=5652018762' ${k}`}},export:{star:`kry-cli export ecom star ${b}`,star30:`kry-cli export ecom star ${b} --start 2026-04-01 --end 2026-04-30`},viewDate:"kry-cli date"},oe=process.env.AGENT_WORK_ROOT||"";function O(e){return e?.match(/(?:^|[/\\])(user-[^/\\]+)[/\\]?$/)?.[1]||""}var E=O(oe);function ie(){return!!O(process.env.AGENT_WORK_ROOT||"")}var I=(process.env.REWIND_SESSION_ID||"").match(/^eval-sess-eval/);function se(){return process.env.CLIENT_CLAW_TYPE==="KRY_CLAW"}function ce(){return process.env.QODER_WORK_INTEGRATION_PRODUCT==="qwenworkcn"||process.env.DINGTALK_DWS_AGENTCODE==="qwenwork"||process.env.DWS_AGENT_PRODUCT==="qwenwork"}function w(){return se()?"kryclaw":ce()?"qwenwork":ie()?"wukong":"other"}function h(){let e=w();return{supported:e!=="other",source:e}}import*as s from"fs";import*as l from"path";import _ from"os";var ae="https://tnnm-alsc-saas-merchant-spider-fy21.cn-wulanchabu.log.aliyuncs.com/logstores/kry-cli/track?APIVersion=0.6.0",le=process.env.REWIND_SESSION_ID||"",_e=process.env.ROBOT_UID||"",de=crypto.randomUUID().replaceAll("-",""),N,A,D=0,R=0,j,L,P,$,z,U,F;function J(e){e?.brandId&&(N=e.brandId),e?.brandName&&(A=e.brandName),e?.brandCount!==void 0&&(D=e.brandCount),e?.shopCount!==void 0&&(R=e.shopCount),e?.version&&(j=e.version),e?.userId&&(L=e.userId),e?.source&&(P=e.source),e?.mobile&&($=e.mobile),e?.pkg&&(z=e.pkg)}function pe(e){let t={path:"",skill:""},o=((e||[]).find(i=>i.includes("kry-"))||"").split(/[/\\]+/),r=o.findIndex(i=>i.includes("kry-")&&i!=="kry-claw-skills");return r===-1||(t.skill=o[r],t.path=o.slice(r+1).join("/")),t}function B(){try{let e=pe(process.argv);return e.skill&&(F=e.skill),e.path&&(U=e.path),e}catch{}return null}function H(e){return e instanceof Error}function K(e){let t={};return Object.keys(e).forEach(n=>{t[n]=e[n]}),t.stack=e.stack,t}function ue(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,typeof n=="string"?n:JSON.stringify(n,(o,r)=>H(r)?K(r):r)]))}function y(e,t,n){let o,r=x();if(r==="prod"&&e==="debug")return;let i={traceId:de,level:e,message:t},c={env:r,brandId:N,brandName:A,brandCount:D.toString(),shopCount:R.toString(),version:j,sessionId:le,userId:L,hostname:_.hostname(),platform:_.platform(),arch:_.arch(),source:P,mobile:$,pkg:z,callPath:U,callSkill:F};I&&(c.test="TestRunner");try{let{tag:d,...g}=n||{},a={...i,tag:d,data:g};Object.keys(a.data||{}).length===0&&delete a.data,o=JSON.stringify({__logs__:[ue(a)],__tags__:c})}catch{o=JSON.stringify({__logs__:[JSON.stringify({...i,level:"error",message:t,data:"[Unserializable]"})],__tags__:c})}return fetch(ae,{method:"POST",headers:new Headers,body:o}).then(async d=>{}).catch(async d=>{})}function M(e){return{info:(t,n)=>y("info",t,{...e,...n}),warn:(t,n)=>y("warn",t,{...e,...n}),error:(t,n)=>y("error",t,{...e,...H(n)?K(n):n}),debug:(t,n)=>y("debug",t,{...e,...n}),child:t=>M({...e,...t})}}var u=M();var f=T(),De=l.join(f,"credentials.json"),Re=l.join(f,"token-cache.json"),V=l.join(f,"authorized-orgs.json"),je=3e3*1e3;var G=l.join(f,"token.json"),Le=l.join(f,"discovery.json"),Pe=l.join(f,"login.pid");function fe(){if(!h().supported)return null;let e=u.child({tag:"loadOAuth2Token"});if(!s.existsSync(G))return null;try{let t=s.readFileSync(G,"utf-8");return JSON.parse(t)}catch(t){return e.error("\u8BFB\u53D6 OAuth2 Token \u5931\u8D25",t),null}}var ze=1440*60*1e3;function ge(){if(!h().supported)return null;let e=u.child({tag:"loadAuthorizedOrgs"});if(!s.existsSync(V))return null;try{let t=s.readFileSync(V,"utf-8");return JSON.parse(t)}catch(t){return e.error("\u672C\u5730\u8BFB\u53D6\u5DF2\u6388\u6743\u54C1\u724C/\u95E8\u5E97\u5217\u8868\u5931\u8D25",t),null}}function W(){let e={success:!1,brandId:"",brandName:"",brandCount:0,shopCount:0,brandMap:{},shopMap:{},brands:[],shops:[]},t=ge();if(t){let n=t.brandList||[],o=n.length,r={},i={},c=n[0]||{},d=String(c.id||"")||"",g=c.name||"",a=0;for(let p of n){r[String(p.id)]=p,e.brands.push(p);let m=p.shopList||[];m.length>a&&(a=m.length,d=String(p.id),g=p.name);for(let S of m)i[String(S.id)]=S}e.success=!0,e.brandMap=r,e.shopMap=i,e.brandCount=o,e.shopCount=a,e.brandId=d,e.brandName=g}return e}function q(){try{let o=(fe()?.access_token||"").split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=o.padEnd(o.length+(4-o.length%4)%4,"="),i=Buffer.from(r,"base64").toString("utf8");return JSON.parse(i)}catch{return{}}}try{let e=u.child({tag:"sdk:init"}),t=W(),n=q(),o=w(),r=Y();J({version:r.version,brandId:t.brandId,brandName:t.brandName,brandCount:t.brandCount,shopCount:t.shopCount,userId:E,source:o,mobile:n?.sub,pkg:r.name});let i=B();e.info("SDK \u542F\u52A8\uFF0C\u8BBE\u7F6E\u65E5\u5FD7\u53C2\u6570",{args:process.argv.join(" "),call:i})}catch{}export{u as logger};
package/binaries.json CHANGED
@@ -1,47 +1,47 @@
1
1
  {
2
- "version": "1.5.8-beta.0",
2
+ "version": "1.5.9-beta.0",
3
3
  "targets": {
4
4
  "darwin-arm64": {
5
- "url": "https://s.koubei.com/wAAAYRRFDsfzPiZy3K8QF4FTDhYeRBEP.br",
6
- "sha256": "5093cdd519493c76bcca088ec44fed5eb6917d35b843eca89c991276b0cdb2a9",
7
- "brSha256": "992a3a97c0c1865ae7378f3353e54f36ed054fb33776aa6038e3277eae46622c",
8
- "brBytes": 20030242,
9
- "bytes": 69258338
5
+ "url": "https://s.koubei.com/k7rJsawnW4erPrZb6J4BBNBDBcEYSRt5.br",
6
+ "sha256": "199b22e863f74c44e1e527ee197ef4354456cee568c4db892844027ff8ec02bb",
7
+ "brSha256": "63299df2cfbca5c2d2012539d92c232d0481d2fd2937ada16500577bf932a942",
8
+ "brBytes": 20030215,
9
+ "bytes": 69274850
10
10
  },
11
11
  "darwin-x64": {
12
- "url": "https://s.koubei.com/wZBi5G7hbxNPht57ajhhjiDX2azS42fX.br",
13
- "sha256": "eaf1f026e2e876ee1c07452a54aaada1eeef43ca25d80bdfcb982fff7bf967e1",
14
- "brSha256": "65227cb28ecb1424b909f5ba5a2e628f083e23c755afe338a65c8bcab8eb6da8",
15
- "brBytes": 22449405,
16
- "bytes": 74940496
12
+ "url": "https://s.koubei.com/DBNHjnjchn8aEGdXyy8bKGWphRPzRDyr.br",
13
+ "sha256": "36e2d15f2403c88e3064901bb987fcc847b6f698782acbfffd0d4757ad2bebe0",
14
+ "brSha256": "d3b647119380b47ebf878030464dc1892796244f4764f35e5cc7b151e9f8ec75",
15
+ "brBytes": 22447975,
16
+ "bytes": 74956880
17
17
  },
18
18
  "linux-x64": {
19
- "url": "https://s.koubei.com/3hkzeRBG2YpadwYTaK4DypwJxbrc87PD.br",
20
- "sha256": "0f016ea243f3b4510216741443915617c70aa7e9a175a7c21b8a89ed426f203a",
21
- "brSha256": "8c9f28474a93b9663ff655355a022445997dd843541916caf2364d39f5001c95",
22
- "brBytes": 30834946,
23
- "bytes": 100358272
19
+ "url": "https://s.koubei.com/4bbR6YeSJNEcPDERcczE5nieShr2rnsp.br",
20
+ "sha256": "e0aa242fd7731c1e37bb7ce7a819594e5700b533aeba2a7d6e1f6b428d7df0b5",
21
+ "brSha256": "0b6a4eb3ccf534fca6aafe176f2db1f178deb9f6a2c6e170bdc1a4a4356a3e78",
22
+ "brBytes": 30832591,
23
+ "bytes": 100378752
24
24
  },
25
25
  "linux-arm64": {
26
- "url": "https://s.koubei.com/p8YZCS326NRSFW86zfEsG8SQWWn7Pz6m.br",
27
- "sha256": "65b2c511ab7d39dc92de322712e47cd166bb9317bf2e4982d8990d46e7a11867",
28
- "brSha256": "303a187a5d7e3abc53a9613057c7919a84461044bbafd1692c982fac774def93",
29
- "brBytes": 30220692,
26
+ "url": "https://s.koubei.com/5htApDeXMxaiE3Px75d2G5sDGt42MQAW.br",
27
+ "sha256": "5ea3392b4586c18fe9e8017a0b9456ca8cd9f91abe8c667306a97806e821778a",
28
+ "brSha256": "7b43403e18eb44c3bbb3a88f417ead77c2c6f1385c3d497d90520590e430a97e",
29
+ "brBytes": 30227190,
30
30
  "bytes": 99461264
31
31
  },
32
32
  "linux-x64-musl": {
33
- "url": "https://s.koubei.com/ZdQnDx8rxwrW4Myh67h63sFdpS8rx86A.br",
34
- "sha256": "f1f507084b0bc8fa9d9c55a5b5270bf1fef1bedac0efaa33ad134fb8383d4c32",
35
- "brSha256": "720eb3db4c09e813ef0da31255bc7caa41b13801a0a54d8a61d7b1a401f72d8c",
36
- "brBytes": 30019627,
37
- "bytes": 96938272
33
+ "url": "https://s.koubei.com/2G54k7AYNxeAHaiEYErWMhEM3dcJBAj3.br",
34
+ "sha256": "802f76b717f55cc9ad44912895f226f929d8d037cad64b162bbf955e2c2504b5",
35
+ "brSha256": "242c9e4c967ace816db0f7172cf42c4946220de7b536124012ddd3ac6ef81004",
36
+ "brBytes": 30024424,
37
+ "bytes": 96958752
38
38
  },
39
39
  "win32-x64": {
40
- "url": "https://s.koubei.com/kaSWkQWT3GPdi5n8i4XbNncaBs6jPhNB.br",
41
- "sha256": "b727be070751cb93ddfa410ccb5d99228085c0e7416fce5b8e5f1bb57fb9d3be",
42
- "brSha256": "e676b9245959f6be21cc210dafb91874da01b908cdeec9f6b1ea08d6af90af64",
43
- "brBytes": 32484365,
44
- "bytes": 103526400
40
+ "url": "https://s.koubei.com/jMJPTZ6ibjK4YwTzb6BPj2xZWMfFQxJE.br",
41
+ "sha256": "f3c68ea540ea5d0dad83027834f8cd65e06c76d2107a580bd7cff433ba483685",
42
+ "brSha256": "4cd82b29508f85efd1f4262b3061afa4e194a8c9ecd614f94568de68600174d1",
43
+ "brBytes": 32491724,
44
+ "bytes": 103547392
45
45
  }
46
46
  }
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keruyun/agent-cli",
3
- "version": "1.5.8-beta.0",
3
+ "version": "1.5.9-beta.0",
4
4
  "description": "客如云 CLI 工具",
5
5
  "author": "玄宫",
6
6
  "license": "MIT",