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

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.07 MB |
21
- | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.48 MB |
22
- | linux-x64 | 95.73 MB |
23
- | linux-arm64 | 94.85 MB |
24
- | linux-x64-musl | 92.47 MB |
25
- | win32-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 98.75 MB |
20
+ | darwin-arm64 | 66.68 MB |
21
+ | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 73.12 MB |
22
+ | linux-x64 | 84.41 MB |
23
+ | linux-arm64 | 84.36 MB |
24
+ | linux-x64-musl | 78.45 MB |
25
+ | win32-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 90.4 MB |
26
26
 
27
27
  ## 校验
28
28
 
package/bin/sdk.mjs CHANGED
@@ -1 +1,5 @@
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};
1
+ var Pt=Object.create;var Pe=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Ht=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 Bt=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Yt(e))!Ht.call(t,n)&&n!==r&&Pe(t,n,{get:()=>e[n],enumerable:!(s=Ft(e,n))||s.enumerable});return t};var oe=(t,e,r)=>(r=t!=null?Pt(Lt(t)):{},Bt(e||!t||!t.__esModule?Pe(r,"default",{value:t,enumerable:!0}):r,t));var qe=z((_e,ve)=>{(function(t,e){typeof _e=="object"&&typeof ve<"u"?ve.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(_e,(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",I="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:I,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,A){var B=b.w(a.$u?Date.UTC(a.$y,A,U):new Date(a.$y,A,U),a);return h?B:B.endOf(x)},O=function(U,A){return b.w(a.toDate()[U].apply(a.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(A)),a)},D=this.$W,M=this.$M,H=this.$D,V="set"+(this.$u?"UTC":"");switch(p){case I: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[I]=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===I){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===I)return this.set(I,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(A,B,J,Z){return A&&(A[B]||A(u,h))||J[B].slice(0,Z)},G=function(A){return b.s(m%12||12,A,"0")},U=V||function(A,B,J){var Z=A<12?"AM":"PM";return J?Z.toLowerCase():Z};return h.replace(w,(function(A,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})(A)||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 I: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",I],["$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 ke=z(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.FormatterOptions=void 0;var Se=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}`}};ae.FormatterOptions=Se});var Xe=z((Kr,Ke)=>{var Xt=1/0,Qt="[object Symbol]",Ge=/[\\^$.*+?()[\]{}|]/g,er=RegExp(Ge.source),tr=typeof global=="object"&&global&&global.Object===Object&&global,rr=typeof self=="object"&&self&&self.Object===Object&&self,nr=tr||rr||Function("return this")(),sr=Object.prototype,or=sr.toString,Je=nr.Symbol,Ve=Je?Je.prototype:void 0,Ze=Ve?Ve.toString:void 0;function ir(t){if(typeof t=="string")return t;if(cr(t))return Ze?Ze.call(t):"";var e=t+"";return e=="0"&&1/t==-Xt?"-0":e}function ar(t){return!!t&&typeof t=="object"}function cr(t){return typeof t=="symbol"||ar(t)&&or.call(t)==Qt}function ur(t){return t==null?"":ir(t)}function lr(t){return t=ur(t),t&&er.test(t)?t.replace(Ge,"\\$&"):t}Ke.exports=lr});var Te=z(X=>{"use strict";var dr=X&&X.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(X,"__esModule",{value:!0});X.FieldFormatter=void 0;var fr=dr(Xe()),xe=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,fr.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=xe});var Oe=z(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.isSyncTransform=void 0;var hr=t=>t.length===1;ce.isSyncTransform=hr});var Qe=z(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.RowFormatter=void 0;var pr=Te(),gr=Oe(),De=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,gr.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 pr.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}};ue.RowFormatter=De});var et=z(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.FieldFormatter=Q.RowFormatter=void 0;var mr=Qe();Object.defineProperty(Q,"RowFormatter",{enumerable:!0,get:function(){return mr.RowFormatter}});var yr=Te();Object.defineProperty(Q,"FieldFormatter",{enumerable:!0,get:function(){return yr.FieldFormatter}})});var Ce=z(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CsvFormatterStream=void 0;var br=se("stream"),wr=et(),$e=class extends br.Transform{formatterOptions;rowFormatter;hasWrittenBOM=!1;constructor(e){super({writableObjectMode:e.objectMode}),this.formatterOptions=e,this.rowFormatter=new wr.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()))}};le.CsvFormatterStream=$e});var rt=z(v=>{"use strict";var tt=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]})),_r=v&&v.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),vr=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"&&tt(r,e,s[n]);return _r(r,e),r}})(),Sr=v&&v.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tt(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 kr=se("util"),xr=se("stream"),Tr=vr(se("fs")),Or=ke(),Dr=Ce();Sr(Oe(),v);var $r=Ce();Object.defineProperty(v,"CsvFormatterStream",{enumerable:!0,get:function(){return $r.CsvFormatterStream}});var Cr=ke();Object.defineProperty(v,"FormatterOptions",{enumerable:!0,get:function(){return Cr.FormatterOptions}});var Er=t=>new Dr.CsvFormatterStream(new Or.FormatterOptions(t));v.format=Er;var Mr=(t,e)=>{let r=(0,v.format)(e),s=(0,kr.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=Mr;var Ir=(t,e,r)=>(0,v.write)(e,r).pipe(t);v.writeToStream=Ir;var Ar=(t,e={})=>{let r=[],s=new xr.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 jr=(t,e)=>(0,v.writeToBuffer)(t,e).then(r=>r.toString());v.writeToString=jr;var Nr=(t,e,r)=>{let s=Tr.createWriteStream(t,{encoding:"utf8"});return(0,v.write)(e,r).pipe(s)};v.writeToPath=Nr});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_customParseFormat=e()})(Ee,(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))},I=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=I(l,!1)}],a:[c,function(l){this.afternoon=I(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,A=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,fe=H||0,he=V||0,pe=q||0,ge=G||0;return U?new Date(Date.UTC(Z,re,J,fe,he,pe,ge+60*U.offset*1e3)):h?new Date(Date.UTC(Z,re,J,fe,he,pe,ge)):(ne=new Date(Z,re,J,fe,he,pe,ge),A&&(ne=p(ne).week(A).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 st=z((Ie,Ae)=>{(function(t,e){typeof Ie=="object"&&typeof Ae<"u"?Ae.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_utc=e()})(Ie,(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 I=d.toDate;d.toDate=function(g){return g==="s"&&this.$offset?c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():I.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 Rt=z((Mn,Ur)=>{Ur.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 zt from"path";import Ut from"os";var Wt={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"}}},Fe={daily:"gld",pre:"pre",prod:"prod"};var qt="prod";function be(){if(process.env?.CLIENT_CLAW_ENV&&Fe[process.env.CLIENT_CLAW_ENV])return Fe[process.env.CLIENT_CLAW_ENV];let t=process.env.KRY_FORCE_ENV;return t&&Wt[t]?t:qt}function Ye(...t){return zt.join(process.env.AGENT_WORK_ROOT||Ut.homedir(),...t)}var Le=(...t)=>{let e=be();return e==="prod"?Ye(".kry-cli",...t):Ye(`.kry-cli-${e}`,...t)},me="-o <tempFilePath>.json",ye="-o <tempFilePath>.xlsx",Jt="-o <tempFilePath>.csv",Vt={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> ${me} -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 ${Jt}`,meituan:`krycli comment meituan ${ye} --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 ${me}`,company:`krycli comment blackcat --companyUrl 'https://zj.tousu.sina.com.cn/company/view/?couid=5652018762' ${me}`}},export:{star:`krycli export ecom star ${ye}`,star30:`krycli export ecom star ${ye} --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>"},Zt=process.env.AGENT_WORK_ROOT||"";function He(t){return t?.match(/(?:^|[/\\])(user-[^/\\]+)[/\\]?$/)?.[1]||""}var Be=He(Zt);function Gt(){return!!He(process.env.AGENT_WORK_ROOT||"")}var ze=(process.env.REWIND_SESSION_ID||"").match(/^eval-sess-eval/);function Ue(){return process.env.CLIENT_CLAW_TYPE==="KRY_CLAW"}function Kt(){return process.env.QODER_WORK_INTEGRATION_PRODUCT==="qwenworkcn"||process.env.DINGTALK_DWS_AGENTCODE==="qwenwork"||process.env.DWS_AGENT_PRODUCT==="qwenwork"}function we(){return Ue()?"kryclaw":Kt()?"qwenwork":Gt()?"wukong":"other"}function ie(){let t=we();return t!=="other"?{supported:!0,source:t,reason:"host"}:process.platform==="linux"?{supported:!0,source:t,reason:"linux"}:{supported:!1,source:t,reason:"unsupported"}}function We(){if(!Ue())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 Re from"os";var je=oe(qe());var ot=oe(rt()),it=oe(nt()),at=oe(st());je.default.extend(it.default);je.default.extend(at.default);function Ne(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 Rr="https://tnnm-alsc-saas-merchant-spider-fy21.cn-wulanchabu.log.aliyuncs.com/logstores/kry-cli/track?APIVersion=0.6.0",ct="KRY_CLI_NO_TRACK",ut="KRY_CLI_TRACK_DEBUG",Pr=process.env.REWIND_SESSION_ID||"",un=process.env.ROBOT_UID||"",Fr=crypto.randomUUID().replaceAll("-",""),dt,ft,ht=0,pt=0,gt,mt,yt,bt,wt,_t,vt,St,kt,xt,Tt,Ot;function Dt(t){t?.brandId&&(dt=t.brandId),t?.brandName&&(ft=t.brandName),t?.brandCount!==void 0&&(ht=t.brandCount),t?.shopCount!==void 0&&(pt=t.shopCount),t?.version&&(gt=t.version),t?.userId&&(mt=t.userId),t?.source&&(yt=t.source),t?.mobile&&(bt=t.mobile),t?.pkg&&(wt=t.pkg),t?.employeeId&&(St=t.employeeId),t?.storeId&&(kt=t.storeId),t?.storeName&&(xt=t.storeName),t?.clawVersion&&(Tt=t.clawVersion),t?.clawBuildTime&&(Ot=t.clawBuildTime)}function Yr(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 $t(){try{let t=Yr(process.argv);return t.skill&&(vt=t.skill),t.path&&(_t=t.path),t}catch{}return null}function Ct(t){return t instanceof Error}function Et(t){let e={};return Object.keys(t).forEach(r=>{e[r]=t[r]}),e.stack=t.stack,e}function Lr(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,typeof r=="string"?r:JSON.stringify(r,(s,n)=>Ct(n)?Et(n):n)]))}var Hr=()=>process.env[ct]==="1"||process.env[ct]==="true",lt=()=>process.env[ut]==="1"||process.env[ut]==="true";function de(t,e,r){if(Hr())return;let s,n=be();if(n==="prod"&&t==="debug")return;let c={traceId:Fr,level:t,message:e},d={env:n,brandId:dt,brandName:ft,brandCount:ht.toString(),shopCount:pt.toString(),version:gt,sessionId:Pr,userId:mt,hostname:Re.hostname(),platform:Re.platform(),arch:Re.arch(),source:yt,mobile:bt,pkg:wt,callPath:_t,callSkill:vt,employeeId:St,storeId:kt,storeName:xt,clawVersion:Tt,clawBuildTime:Ot};ze&&(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__:[Lr($)],__tags__:d})}catch{s=JSON.stringify({__logs__:[JSON.stringify({...c,level:"error",message:e,data:"[Unserializable]"})],__tags__:d})}let x=Date.now();return fetch(Rr,{method:"POST",headers:new Headers,body:s}).then(y=>{lt()&&process.stderr.write(`[log] HTTP ${y.status}\uFF08${Date.now()-x} ms\uFF09${e}
4
+ `)}).catch(y=>{if(lt()){let T=Ne(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 Mt(t){return{info:(e,r)=>de("info",e,{...t,...r}),warn:(e,r)=>de("warn",e,{...t,...r}),error:(e,r)=>de("error",e,{...t,...Ct(r)?Et(r):r}),debug:(e,r)=>de("debug",e,{...t,...r}),child:e=>Mt({...t,...e})}}var ee=Mt();var te=Le(),kn=K.join(te,"credentials.json"),xn=K.join(te,"token-cache.json"),It=K.join(te,"authorized-orgs.json"),Tn=3e3*1e3;var At=K.join(te,"token.json"),On=K.join(te,"discovery.json"),Dn=K.join(te,"login.pid");function Br(){if(!ie().supported)return null;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 Cn=1440*60*1e3;function zr(){if(!ie().supported)return null;let t=ee.child({tag:"loadAuthorizedOrgs"});if(!W.existsSync(It))return null;try{let e=W.readFileSync(It,"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 jt(){let t={success:!1,brandId:"",brandName:"",brandCount:0,shopCount:0,brandMap:{},shopMap:{},brands:[],shops:[]},e=zr();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 I=$.shopList||[];I.length>T&&(T=I.length,x=String($.id),y=$.name);for(let P of I)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 Nt(){try{let s=(Br()?.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=jt(),r=Nt(),s=We(),n=we(),c=Rt();Dt({version:c.version,brandId:s.brandId||e.brandId,brandName:s.brandName||e.brandName,brandCount:e.brandCount,shopCount:e.shopCount,userId:Be,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=$t();t.info("SDK \u542F\u52A8\uFF0C\u8BBE\u7F6E\u65E5\u5FD7\u53C2\u6570",{args:process.argv.join(" "),call:d})}catch{}export{ee as logger};
package/binaries.json CHANGED
@@ -1,47 +1,47 @@
1
1
  {
2
- "version": "1.5.9-beta.0",
2
+ "version": "1.5.9",
3
3
  "targets": {
4
4
  "darwin-arm64": {
5
- "url": "https://s.koubei.com/k7rJsawnW4erPrZb6J4BBNBDBcEYSRt5.br",
6
- "sha256": "199b22e863f74c44e1e527ee197ef4354456cee568c4db892844027ff8ec02bb",
7
- "brSha256": "63299df2cfbca5c2d2012539d92c232d0481d2fd2937ada16500577bf932a942",
8
- "brBytes": 20030215,
9
- "bytes": 69274850
5
+ "url": "https://s.koubei.com/jRZwD6F5RnE7EsJa7djyn8JQ3yARfN8m.br",
6
+ "sha256": "0dce0e644c00a54f19d871d6c73f828e24356b821fa94d8e081d4d31a845bfed",
7
+ "brSha256": "6e43257dbf6a66538f94b1dd3d0761a92aa9f4010dd8617b297000d0aa3e9e96",
8
+ "brBytes": 22391003,
9
+ "bytes": 69920882
10
10
  },
11
11
  "darwin-x64": {
12
- "url": "https://s.koubei.com/DBNHjnjchn8aEGdXyy8bKGWphRPzRDyr.br",
13
- "sha256": "36e2d15f2403c88e3064901bb987fcc847b6f698782acbfffd0d4757ad2bebe0",
14
- "brSha256": "d3b647119380b47ebf878030464dc1892796244f4764f35e5cc7b151e9f8ec75",
15
- "brBytes": 22447975,
16
- "bytes": 74956880
12
+ "url": "https://s.koubei.com/78EXzkHZGFweZahGNn3AAJZa6mD7PBk6.br",
13
+ "sha256": "e1cf868d3b535ce530b146d6a3b9fcd9c404a0dc62bc6b326768855bbed069f3",
14
+ "brSha256": "5eed91fb409e9139fccc3970477cd0f66a87cd419060a995afb13e9e9c110f90",
15
+ "brBytes": 24804310,
16
+ "bytes": 76668320
17
17
  },
18
18
  "linux-x64": {
19
- "url": "https://s.koubei.com/4bbR6YeSJNEcPDERcczE5nieShr2rnsp.br",
20
- "sha256": "e0aa242fd7731c1e37bb7ce7a819594e5700b533aeba2a7d6e1f6b428d7df0b5",
21
- "brSha256": "0b6a4eb3ccf534fca6aafe176f2db1f178deb9f6a2c6e170bdc1a4a4356a3e78",
22
- "brBytes": 30832591,
23
- "bytes": 100378752
19
+ "url": "https://s.koubei.com/h2Rkj2bs6JNeTKKB5XBp7B7zac4BYpJz.br",
20
+ "sha256": "1813f17d9e497abfafa01b452f00f859f16484e993893e0c58dbb8e3805b3f0c",
21
+ "brSha256": "f513f85e2460d9c79aa30dafbde89541371b0e8d2023d6c5862dc86e40ccbe8a",
22
+ "brBytes": 33023267,
23
+ "bytes": 88511688
24
24
  },
25
25
  "linux-arm64": {
26
- "url": "https://s.koubei.com/5htApDeXMxaiE3Px75d2G5sDGt42MQAW.br",
27
- "sha256": "5ea3392b4586c18fe9e8017a0b9456ca8cd9f91abe8c667306a97806e821778a",
28
- "brSha256": "7b43403e18eb44c3bbb3a88f417ead77c2c6f1385c3d497d90520590e430a97e",
29
- "brBytes": 30227190,
30
- "bytes": 99461264
26
+ "url": "https://s.koubei.com/bDmr8zaAYh6XKCtx5BfdPGZbKwKX2XzC.br",
27
+ "sha256": "3279dce4ce33eff261fed2c2dcb8bbfdf9652e6d135d64dd2a607909a9daf77c",
28
+ "brSha256": "4895b32d46cafff2658eeaeb1693d3d36e94c4a15f6ff2bba49d1f29d4c4a527",
29
+ "brBytes": 32685046,
30
+ "bytes": 88459256
31
31
  },
32
32
  "linux-x64-musl": {
33
- "url": "https://s.koubei.com/2G54k7AYNxeAHaiEYErWMhEM3dcJBAj3.br",
34
- "sha256": "802f76b717f55cc9ad44912895f226f929d8d037cad64b162bbf955e2c2504b5",
35
- "brSha256": "242c9e4c967ace816db0f7172cf42c4946220de7b536124012ddd3ac6ef81004",
36
- "brBytes": 30024424,
37
- "bytes": 96958752
33
+ "url": "https://s.koubei.com/yrmRaTMBWrEKipci8piaRAykGRx44DSy.br",
34
+ "sha256": "58fa2591489e632cdb0ee26e12cf5efc3901219dbcbd46a16a4738bc02dd6fe9",
35
+ "brSha256": "77a224c1c3c6e5085eb43855e61752f114a692c44125ef83f8b9c533830e37ed",
36
+ "brBytes": 30883287,
37
+ "bytes": 82257368
38
38
  },
39
39
  "win32-x64": {
40
- "url": "https://s.koubei.com/jMJPTZ6ibjK4YwTzb6BPj2xZWMfFQxJE.br",
41
- "sha256": "f3c68ea540ea5d0dad83027834f8cd65e06c76d2107a580bd7cff433ba483685",
42
- "brSha256": "4cd82b29508f85efd1f4262b3061afa4e194a8c9ecd614f94568de68600174d1",
43
- "brBytes": 32491724,
44
- "bytes": 103547392
40
+ "url": "https://s.koubei.com/et6Df7Xw8MDYMteRcwD25Wy3p6ifRMxJ.br",
41
+ "sha256": "fbf583dc07b3adf6f37c59d764dca160c7a51b1f27e81e770df0cd60f159a844",
42
+ "brSha256": "e810629e369fd6de9969da0e8bf5d323cde26a8c423cfc1e527d6e9ca39d551a",
43
+ "brBytes": 35942115,
44
+ "bytes": 94794240
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.9-beta.0",
3
+ "version": "1.5.9",
4
4
  "description": "客如云 CLI 工具",
5
5
  "author": "玄宫",
6
6
  "license": "MIT",