@keruyun/agent-cli 1.5.3-beta.1 → 1.5.3-beta.3

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 | 65.97 MB |
21
- | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.41 MB |
22
- | linux-x64 | 95.64 MB |
20
+ | darwin-arm64 | 66 MB |
21
+ | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.42 MB |
22
+ | linux-x64 | 95.65 MB |
23
23
  | linux-arm64 | 94.79 MB |
24
- | linux-x64-musl | 92.38 MB |
25
- | win32-x64 | 99.35 MB |
24
+ | linux-x64-musl | 92.39 MB |
25
+ | win32-x64 | 99.37 MB |
26
26
 
27
27
  ## 校验
28
28
 
package/bin/sdk.mjs CHANGED
@@ -1,3 +1,5 @@
1
- var Q=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Z=Q((Fe,me)=>{me.exports={name:"@keruyun/agent-cli",version:"1.4.12",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 ee from"path";import te from"os";var ne={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"}}},w={daily:"gld",pre:"pre",prod:"prod"};var re="prod";function b(){if(process.env?.CLIENT_CLAW_ENV&&w[process.env.CLIENT_CLAW_ENV])return w[process.env.CLIENT_CLAW_ENV];let e=process.env.KRY_FORCE_ENV;return e&&ne[e]?e:re}function S(...e){return ee.join(process.env.AGENT_WORK_ROOT||te.homedir(),...e)}var C=(...e)=>{let t=b();return t==="prod"?S(".kry-cli",...e):S(`.kry-cli-${t}`,...e)},m="-o /temp_path/file.json",k="-o /path/file.xlsx",oe="-o /path/file.csv",ie={viewBrand:"krycli brand",viewBrandJson:"krycli brand --format json",viewShop:"krycli shop",viewShopByKeyword:"krycli shop -k '\u5173\u952E\u8BCD1|\u5173\u952E\u8BCD2'",viewShopParams:e=>`krycli shop -b ${e?.brandId||"<brandId>"}`,viewShopJson:"krycli shop -b <brandId> --format json",callShop:"krycli call /open/xxx -s <shopId> -d '<JSON>'",callShopParams:e=>`krycli call ${e?.url||"/open/xxx"} -s ${e?.shopId||"<shopId>"} -d '<JSON>'`,callBrand:"krycli call /open/xxx -b <brandId> -d '<JSON>'",callBrandOutput:`krycli call /open/xxx -b <brandId> ${m} -d '<JSON>'`,callBrandParams:e=>`krycli 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:"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'",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 ${oe}`,meituan:`krycli comment meituan ${k} --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 ${m}`,company:`krycli comment blackcat --companyUrl 'https://zj.tousu.sina.com.cn/company/view/?couid=5652018762' ${m}`}},export:{star:`krycli export ecom star ${k}`,star30:`krycli export ecom star ${k} --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>"},se=process.env.AGENT_WORK_ROOT||"";function ce(e){return e?.match(/(?:^|[/\\])(user-[^/\\]+)[/\\]?$/)?.[1]||""}var x=ce(se),T=!!x,O=(process.env.REWIND_SESSION_ID||"").match(/^eval-sess-eval/);function E(){return process.env.CLIENT_CLAW_TYPE==="KRY_CLAW"}import*as a from"fs";import*as p 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",I="KRY_CLI_NO_TRACK",A="KRY_CLI_TRACK_DEBUG",le=process.env.REWIND_SESSION_ID||"",Se=process.env.ROBOT_UID||"",de=crypto.randomUUID().replaceAll("-",""),j,D,L=0,R=0,$,P,z,J,U,F,B;function H(e){e?.brandId&&(j=e.brandId),e?.brandName&&(D=e.brandName),e?.brandCount!==void 0&&(L=e.brandCount),e?.shopCount!==void 0&&(R=e.shopCount),e?.version&&($=e.version),e?.userId&&(P=e.userId),e?.source&&(z=e.source),e?.mobile&&(J=e.mobile),e?.pkg&&(U=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 K(){try{let e=pe(process.argv);return e.skill&&(B=e.skill),e.path&&(F=e.path),e}catch{}return null}function M(e){return e instanceof Error}function V(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)=>M(r)?V(r):r)]))}var ge=()=>process.env[I]==="1"||process.env[I]==="true",N=()=>process.env[A]==="1"||process.env[A]==="true";function fe(e){let t=e?.cause;return t?t.code?t.code:Array.isArray(t.errors)?t.errors.find(n=>n?.code)?.code||"":t.message?String(t.message).slice(0,100):"":""}function h(e,t,n){if(ge())return;let o,r=b();if(r==="prod"&&e==="debug")return;let i={traceId:de,level:e,message:t},d={env:r,brandId:j,brandName:D,brandCount:L.toString(),shopCount:R.toString(),version:$,sessionId:le,userId:P,hostname:_.hostname(),platform:_.platform(),arch:_.arch(),source:z,mobile:J,pkg:U,callPath:F,callSkill:B};O&&(d.test="TestRunner");try{let{tag:s,...l}=n||{},c={...i,tag:s,data:l};Object.keys(c.data||{}).length===0&&delete c.data,o=JSON.stringify({__logs__:[ue(c)],__tags__:d})}catch{o=JSON.stringify({__logs__:[JSON.stringify({...i,level:"error",message:t,data:"[Unserializable]"})],__tags__:d})}let f=Date.now();return fetch(ae,{method:"POST",headers:new Headers,body:o}).then(s=>{N()&&process.stderr.write(`[log] HTTP ${s.status}\uFF08${Date.now()-f} ms\uFF09${t}
2
- `)}).catch(s=>{if(N()){let l=fe(s);process.stderr.write(`[log] \u4E0A\u62A5\u5931\u8D25\uFF08${Date.now()-f} ms\uFF09\uFF1A${s?.name||""} ${s?.message||String(s)}${l?` cause=${l}`:""}
3
- `)}})}function G(e){return{info:(t,n)=>h("info",t,{...e,...n}),warn:(t,n)=>h("warn",t,{...e,...n}),error:(t,n)=>h("error",t,{...e,...M(n)?V(n):n}),debug:(t,n)=>h("debug",t,{...e,...n}),child:t=>G({...e,...t})}}var u=G();var g=C(),De=p.join(g,"credentials.json"),Le=p.join(g,"token-cache.json"),W=p.join(g,"authorized-orgs.json"),Re=3e3*1e3;var Y=p.join(g,"token.json"),$e=p.join(g,"discovery.json"),Pe=p.join(g,"login.pid");function he(){let e=u.child({tag:"loadOAuth2Token"});if(!a.existsSync(Y))return null;try{let t=a.readFileSync(Y,"utf-8");return JSON.parse(t)}catch(t){return e.error("\u8BFB\u53D6 OAuth2 Token \u5931\u8D25",t),null}}var Je=1440*60*1e3;function ye(){let e=u.child({tag:"loadAuthorizedOrgs"});if(!a.existsSync(W))return null;try{let t=a.readFileSync(W,"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 X(){let e={success:!1,brandId:"",brandName:"",brandCount:0,shopCount:0,brandMap:{},shopMap:{},brands:[],shops:[]},t=ye();if(t){let n=t.brandList||[],o=n.length,r={},i={},d=n[0]||{},f=String(d.id||"")||"",s=d.name||"",l=0;for(let c of n){r[String(c.id)]=c,e.brands.push(c);let y=c.shopList||[];y.length>l&&(l=y.length,f=String(c.id),s=c.name);for(let v of y)i[String(v.id)]=v}e.success=!0,e.brandMap=r,e.shopMap=i,e.brandCount=o,e.shopCount=l,e.brandId=f,e.brandName=s}return e}function q(){try{let o=(he()?.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=X(),n=q(),o=T?"wukong":"other";E()&&(o="kryclaw");let r=Z();H({version:r.version,brandId:t.brandId,brandName:t.brandName,brandCount:t.brandCount,shopCount:t.shopCount,userId:x,source:o,mobile:n?.sub,pkg:r.name});let i=K();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 Nt=Object.create;var Pe=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Pt=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 Rt=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Pt(e))!Lt.call(t,n)&&n!==r&&Pe(t,n,{get:()=>e[n],enumerable:!(s=Ft(e,n))||s.enumerable});return t};var ie=(t,e,r)=>(r=t!=null?Nt(Yt(t)):{},Rt(e||!t||!t.__esModule?Pe(r,"default",{value:t,enumerable:!0}):r,t));var Ue=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",D="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 o=["th","st","nd","rd"],i=f%100;return"["+f+(o[(i-20)%10]||o[i]||o[0])+"]"}},_=function(f,o,i){var u=String(f);return!u||u.length>=o?f:""+Array(o+1-u.length).join(i)+f},Y={s:_,z:function(f){var o=-f.utcOffset(),i=Math.abs(o),u=Math.floor(i/60),a=i%60;return(o<=0?"+":"-")+_(u,2,"0")+":"+_(a,2,"0")},m:function f(o,i){if(o.date()<i.date())return-f(i,o);var u=12*(i.year()-o.year())+(i.month()-o.month()),a=o.clone().add(u,T),h=i-a<0,p=o.clone().add(u+(h?-1:1),T);return+(-(u+(i-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:D}[f]||String(f||"").toLowerCase().replace(/s$/,"")},u:function(f){return f===void 0}},C="en",j={};j[C]=S;var L="$isDayjsObject",N=function(f){return f instanceof F||!(!f||!f[L])},E=function f(o,i,u){var a;if(!o)return C;if(typeof o=="string"){var h=o.toLowerCase();j[h]&&(a=h),i&&(j[h]=i,a=h);var p=o.split("-");if(!a&&p.length>1)return f(p[0])}else{var m=o.name;j[m]=o,a=m}return!u&&a&&(C=a),a||!u&&C},k=function(f,o){if(N(f))return f.clone();var i=typeof o=="object"?o:{};return i.date=f,i.args=arguments,new F(i)},b=Y;b.l=E,b.i=N,b.w=function(f,o){return k(f,{locale:o.$L,utc:o.$u,x:o.$x,$offset:o.$offset})};var F=(function(){function f(i){this.$L=E(i.locale,null,!0),this.parse(i),this.$x=this.$x||i.x||{},this[L]=!0}var o=f.prototype;return o.parse=function(i){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)})(i),this.init()},o.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},o.$utils=function(){return b},o.isValid=function(){return this.$d.toString()!==g},o.isSame=function(i,u){var a=k(i);return this.startOf(u)<=a&&a<=this.endOf(u)},o.isAfter=function(i,u){return k(i)<this.startOf(u)},o.isBefore=function(i,u){return this.endOf(u)<k(i)},o.$g=function(i,u,a){return b.u(i)?this[u]:this.set(a,i)},o.unix=function(){return Math.floor(this.valueOf()/1e3)},o.valueOf=function(){return this.$d.getTime()},o.startOf=function(i,u){var a=this,h=!!b.u(u)||u,p=b.p(i),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)},$=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 J=this.$locale().weekStart||0,G=($<J?$+7:$)-J;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()}},o.endOf=function(i){return this.startOf(i,!1)},o.$set=function(i,u){var a,h=b.p(i),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 $=this.clone().set(P,1);$.$d[m](O),$.init(),this.$d=$.set(P,Math.min(this.$D,$.daysInMonth())).$d}else m&&this.$d[m](O);return this.init(),this},o.set=function(i,u){return this.clone().$set(i,u)},o.get=function(i){return this[b.p(i)]()},o.add=function(i,u){var a,h=this;i=Number(i);var p=b.p(u),m=function(M){var H=k(h);return b.w(H.date(H.date()+Math.round(M*i)),h)};if(p===T)return this.set(T,this.$M+i);if(p===I)return this.set(I,this.$y+i);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,$=this.$d.getTime()+i*O;return b.w($,this)},o.subtract=function(i,u){return this.add(-1*i,u)},o.format=function(i){var u=this,a=this.$locale();if(!this.isValid())return a.invalidDate||g;var h=i||"YYYY-MM-DDTHH:mm:ssZ",p=b.z(this),m=this.$H,O=this.$m,$=this.$M,M=a.weekdays,H=a.months,V=a.meridiem,J=function(A,B,q,Z){return A&&(A[B]||A(u,h))||q[B].slice(0,Z)},G=function(A){return b.s(m%12||12,A,"0")},U=V||function(A,B,q){var Z=A<12?"AM":"PM";return q?Z.toLowerCase():Z};return h.replace(w,(function(A,B){return B||(function(q){switch(q){case"YY":return String(u.$y).slice(-2);case"YYYY":return b.s(u.$y,4,"0");case"M":return $+1;case"MM":return b.s($+1,2,"0");case"MMM":return J(a.monthsShort,$,H,3);case"MMMM":return J(H,$);case"D":return u.$D;case"DD":return b.s(u.$D,2,"0");case"d":return String(u.$W);case"dd":return J(a.weekdaysMin,u.$W,M,2);case"ddd":return J(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(":","")}))},o.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},o.diff=function(i,u,a){var h,p=this,m=b.p(u),O=k(i),$=(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 D:h=H()/3;break;case y:h=(M-$)/6048e5;break;case x:h=(M-$)/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)},o.daysInMonth=function(){return this.endOf(T).$D},o.$locale=function(){return j[this.$L]},o.locale=function(i,u){if(!i)return this.$L;var a=this.clone(),h=E(i,u,!0);return h&&(a.$L=h),a},o.clone=function(){return b.w(this.$d,this)},o.toDate=function(){return new Date(this.valueOf())},o.toJSON=function(){return this.isValid()?this.toISOString():null},o.toISOString=function(){return this.$d.toISOString()},o.toString=function(){return this.$d.toUTCString()},f})(),R=F.prototype;return k.prototype=R,[["$ms",s],["$s",n],["$m",c],["$H",d],["$W",x],["$M",T],["$y",I],["$D",P]].forEach((function(f){R[f[1]]=function(o){return this.$g(o,f[0],f[1])}})),k.extend=function(f,o){return f.$i||(f(o,F,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(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.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}`}};oe.FormatterOptions=Se});var Ge=z((Vr,Ze)=>{var Zt=1/0,Gt="[object Symbol]",Ve=/[\\^$.*+?()[\]{}|]/g,Kt=RegExp(Ve.source),Xt=typeof global=="object"&&global&&global.Object===Object&&global,Qt=typeof self=="object"&&self&&self.Object===Object&&self,er=Xt||Qt||Function("return this")(),tr=Object.prototype,rr=tr.toString,We=er.Symbol,Je=We?We.prototype:void 0,qe=Je?Je.toString:void 0;function nr(t){if(typeof t=="string")return t;if(ir(t))return qe?qe.call(t):"";var e=t+"";return e=="0"&&1/t==-Zt?"-0":e}function sr(t){return!!t&&typeof t=="object"}function ir(t){return typeof t=="symbol"||sr(t)&&rr.call(t)==Gt}function or(t){return t==null?"":nr(t)}function ar(t){return t=or(t),t&&Kt.test(t)?t.replace(Ve,"\\$&"):t}Ze.exports=ar});var Te=z(X=>{"use strict";var cr=X&&X.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(X,"__esModule",{value:!0});X.FieldFormatter=void 0;var ur=cr(Ge()),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,ur.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(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.isSyncTransform=void 0;var lr=t=>t.length===1;ae.isSyncTransform=lr});var Ke=z(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.RowFormatter=void 0;var dr=Te(),fr=Oe(),$e=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,fr.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 dr.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=$e});var Xe=z(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.FieldFormatter=Q.RowFormatter=void 0;var hr=Ke();Object.defineProperty(Q,"RowFormatter",{enumerable:!0,get:function(){return hr.RowFormatter}});var pr=Te();Object.defineProperty(Q,"FieldFormatter",{enumerable:!0,get:function(){return pr.FieldFormatter}})});var Ce=z(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.CsvFormatterStream=void 0;var gr=se("stream"),mr=Xe(),De=class extends gr.Transform{formatterOptions;rowFormatter;hasWrittenBOM=!1;constructor(e){super({writableObjectMode:e.objectMode}),this.formatterOptions=e,this.rowFormatter=new mr.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=De});var et=z(v=>{"use strict";var Qe=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]})),yr=v&&v.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),br=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"&&Qe(r,e,s[n]);return yr(r,e),r}})(),wr=v&&v.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qe(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 _r=se("util"),vr=se("stream"),Sr=br(se("fs")),kr=ke(),xr=Ce();wr(Oe(),v);var Tr=Ce();Object.defineProperty(v,"CsvFormatterStream",{enumerable:!0,get:function(){return Tr.CsvFormatterStream}});var Or=ke();Object.defineProperty(v,"FormatterOptions",{enumerable:!0,get:function(){return Or.FormatterOptions}});var $r=t=>new xr.CsvFormatterStream(new kr.FormatterOptions(t));v.format=$r;var Dr=(t,e)=>{let r=(0,v.format)(e),s=(0,_r.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=Dr;var Cr=(t,e,r)=>(0,v.write)(e,r).pipe(t);v.writeToStream=Cr;var Er=(t,e={})=>{let r=[],s=new vr.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=Er;var Mr=(t,e)=>(0,v.writeToBuffer)(t,e).then(r=>r.toString());v.writeToString=Mr;var Ir=(t,e,r)=>{let s=Sr.createWriteStream(t,{encoding:"utf8"});return(0,v.write)(e,r).pipe(s)};v.writeToPath=Ir});var tt=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)}],D=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 Y=1;Y<=24;Y+=1)if(l.indexOf(_(Y,0,w))>-1){S=Y>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=D("months"),S=(D("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=D("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,F){var R=F&&F.toUpperCase();return b||S[F]||t[F]||S[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(f,o,i){return o||i.slice(1)}))}))).match(e),Y=_.length,C=0;C<Y;C+=1){var j=_[C],L=P[j],N=L&&L[0],E=L&&L[1];_[C]=E?{regex:N,parser:E}:j.replace(/^\[|\]$/g,"")}return function(k){for(var b={},F=0,R=0;F<Y;F+=1){var f=_[F];if(typeof f=="string")R+=f.length;else{var o=f.regex,i=f.parser,u=k.slice(R),a=o.exec(u)[0];i.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,Y=_.parse;_.parse=function(C){var j=C.date,L=C.utc,N=C.args;this.$u=L;var E=N[1];if(typeof E=="string"){var k=N[2]===!0,b=N[3]===!0,F=k||b,R=N[2];b&&(R=N[2]),d=this.$locale(),!k&&R&&(d=S.Ls[R]),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,$=m.month,M=m.day,H=m.hours,V=m.minutes,J=m.seconds,G=m.milliseconds,U=m.zone,A=m.week,B=new Date,q=M||(O||$?1:B.getDate()),Z=O||B.getFullYear(),re=0;O&&!$||(re=$>0?$-1:B.getMonth());var ne,de=H||0,fe=V||0,he=J||0,pe=G||0;return U?new Date(Date.UTC(Z,re,q,de,fe,he,pe+60*U.offset*1e3)):h?new Date(Date.UTC(Z,re,q,de,fe,he,pe)):(ne=new Date(Z,re,q,de,fe,he,pe),A&&(ne=p(ne).week(A).toDate()),ne)}catch{return new Date("")}})(j,E,L,S),this.init(),R&&R!==!0&&(this.$L=this.locale(R).$L),F&&j!=this.format(E)&&(this.$d=new Date("")),d={}}else if(E instanceof Array)for(var f=E.length,o=1;o<=f;o+=1){N[1]=E[o-1];var i=S.apply(this,N);if(i.isValid()){this.$d=i.$d,this.$L=i.$L,this.init();break}o===f&&(this.$d=new Date(""))}else Y.call(this,C)}}}))});var rt=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 L=(""+j[0]).match(r)||["-",0,0],N=L[0],E=60*+L[1]+ +L[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 Y=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(_=this.local().add(S+Y,t)).$offset=S,_.$x.$localOffset=Y,_};var D=d.format;d.format=function(g){var l=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return D.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 jt=z(($n,Hr)=>{Hr.exports={name:"@keruyun/agent-cli",version:"1.5.0",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 Ht from"path";import Bt from"os";var zt={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"}}},Ye={daily:"gld",pre:"pre",prod:"prod"};var Ut="prod";function ye(){if(process.env?.CLIENT_CLAW_ENV&&Ye[process.env.CLIENT_CLAW_ENV])return Ye[process.env.CLIENT_CLAW_ENV];let t=process.env.KRY_FORCE_ENV;return t&&zt[t]?t:Ut}function Le(...t){return Ht.join(process.env.AGENT_WORK_ROOT||Bt.homedir(),...t)}var Re=(...t)=>{let e=ye();return e==="prod"?Le(".kry-cli",...t):Le(`.kry-cli-${e}`,...t)},ge="-o <tempFilePath>.json",me="-o <tempFilePath>.xlsx",Wt="-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",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 ${Wt}`,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>"},qt=process.env.AGENT_WORK_ROOT||"";function Vt(t){return t?.match(/(?:^|[/\\])(user-[^/\\]+)[/\\]?$/)?.[1]||""}var be=Vt(qt),He=!!be,Be=(process.env.REWIND_SESSION_ID||"").match(/^eval-sess-eval/);function we(){return process.env.CLIENT_CLAW_TYPE==="KRY_CLAW"}function ze(){if(!we())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 Fe from"os";var je=ie(Ue());var nt=ie(et()),st=ie(tt()),it=ie(rt());je.default.extend(st.default);je.default.extend(it.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 Ar="https://tnnm-alsc-saas-merchant-spider-fy21.cn-wulanchabu.log.aliyuncs.com/logstores/kry-cli/track?APIVersion=0.6.0",ot="KRY_CLI_NO_TRACK",at="KRY_CLI_TRACK_DEBUG",jr=process.env.REWIND_SESSION_ID||"",on=process.env.ROBOT_UID||"",Nr=crypto.randomUUID().replaceAll("-",""),ut,lt,dt=0,ft=0,ht,pt,gt,mt,yt,bt,wt,_t,vt,St,kt,xt;function Tt(t){t?.brandId&&(ut=t.brandId),t?.brandName&&(lt=t.brandName),t?.brandCount!==void 0&&(dt=t.brandCount),t?.shopCount!==void 0&&(ft=t.shopCount),t?.version&&(ht=t.version),t?.userId&&(pt=t.userId),t?.source&&(gt=t.source),t?.mobile&&(mt=t.mobile),t?.pkg&&(yt=t.pkg),t?.employeeId&&(_t=t.employeeId),t?.storeId&&(vt=t.storeId),t?.storeName&&(St=t.storeName),t?.clawVersion&&(kt=t.clawVersion),t?.clawBuildTime&&(xt=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 Ot(){try{let t=Fr(process.argv);return t.skill&&(wt=t.skill),t.path&&(bt=t.path),t}catch{}return null}function $t(t){return t instanceof Error}function Dt(t){let e={};return Object.keys(t).forEach(r=>{e[r]=t[r]}),e.stack=t.stack,e}function Pr(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,typeof r=="string"?r:JSON.stringify(r,(s,n)=>$t(n)?Dt(n):n)]))}var Yr=()=>process.env[ot]==="1"||process.env[ot]==="true",ct=()=>process.env[at]==="1"||process.env[at]==="true";function le(t,e,r){if(Yr())return;let s,n=ye();if(n==="prod"&&t==="debug")return;let c={traceId:Nr,level:t,message:e},d={env:n,brandId:ut,brandName:lt,brandCount:dt.toString(),shopCount:ft.toString(),version:ht,sessionId:jr,userId:pt,hostname:Fe.hostname(),platform:Fe.platform(),arch:Fe.arch(),source:gt,mobile:mt,pkg:yt,callPath:bt,callSkill:wt,employeeId:_t,storeId:vt,storeName:St,clawVersion:kt,clawBuildTime:xt};Be&&(d.test="TestRunner");try{let{tag:y,...T}=r||{},D={...c,tag:y,data:T};Object.keys(D.data||{}).length===0&&delete D.data,s=JSON.stringify({__logs__:[Pr(D)],__tags__:d})}catch{s=JSON.stringify({__logs__:[JSON.stringify({...c,level:"error",message:e,data:"[Unserializable]"})],__tags__:d})}let x=Date.now();return fetch(Ar,{method:"POST",headers:new Headers,body:s}).then(y=>{ct()&&process.stderr.write(`[log] HTTP ${y.status}\uFF08${Date.now()-x} ms\uFF09${e}
4
+ `)}).catch(y=>{if(ct()){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 Ct(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)?Dt(r):r}),debug:(e,r)=>le("debug",e,{...t,...r}),child:e=>Ct({...t,...e})}}var ee=Ct();var te=Re(),wn=K.join(te,"credentials.json"),_n=K.join(te,"token-cache.json"),Et=K.join(te,"authorized-orgs.json"),vn=3e3*1e3;var Mt=K.join(te,"token.json"),Sn=K.join(te,"discovery.json"),kn=K.join(te,"login.pid");function Lr(){let t=ee.child({tag:"loadOAuth2Token"});if(!W.existsSync(Mt))return null;try{let e=W.readFileSync(Mt,"utf-8");return JSON.parse(e)}catch(e){return t.error("\u8BFB\u53D6 OAuth2 Token \u5931\u8D25",e),null}}var Tn=1440*60*1e3;function Rr(){let t=ee.child({tag:"loadAuthorizedOrgs"});if(!W.existsSync(Et))return null;try{let e=W.readFileSync(Et,"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=Rr();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 D of r){n[String(D.id)]=D,t.brands.push(D);let I=D.shopList||[];I.length>T&&(T=I.length,x=String(D.id),y=D.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 At(){try{let s=(Lr()?.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=At(),s=ze(),n=He?"wukong":"other";we()&&(n="kryclaw");let c=jt();Tt({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=Ot();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.3-beta.1",
2
+ "version": "1.5.3-beta.3",
3
3
  "targets": {
4
4
  "darwin-arm64": {
5
- "url": "https://s.koubei.com/J22nD3FnPfYGy8FjQRnpmYh8zFzQJABB.br",
6
- "sha256": "3c34bd592fe9d18e174db6324d769df488618384afa281ef0aa68e827b7518f4",
7
- "brSha256": "4ad3d80945f6d59d03a70dbf3e4f0577e2f2c3d8fdd1ff65c7766f83c07efdf1",
8
- "brBytes": 19959506,
9
- "bytes": 69175778
5
+ "url": "https://s.koubei.com/6myeH8NP28d6FZMCfrAiA4DaNWkEi4d4.br",
6
+ "sha256": "c0e3bf484aadf90f1fe2c14c9ccc334c9552a2d4223c8b9e7c3a3050dcc0f7e0",
7
+ "brSha256": "c457fcabe4ebdb593b1eb17bafb29edf34197f8a050763588f79917256452068",
8
+ "brBytes": 20021408,
9
+ "bytes": 69208802
10
10
  },
11
11
  "darwin-x64": {
12
- "url": "https://s.koubei.com/dKHWBdkAN5HE2yWxyGpxJCAYHMwp2t3t.br",
13
- "sha256": "86f05a8a0e405adad30910af657dfdeb8af25a77f7558bb421ebf2e05875b889",
14
- "brSha256": "0a9cce8551e5a02f44ee06dc86a18cd6f0a13aa7fd38b83837a18a2bcee4b02c",
15
- "brBytes": 22435727,
16
- "bytes": 74874960
12
+ "url": "https://s.koubei.com/4xD2Cczbma3NGMfGRWQ2hNEYASzMkHyr.br",
13
+ "sha256": "7f7a635aad1ca01d60ee4d495a0b630d15010c8873160ed1599e4a8ca76c6be5",
14
+ "brSha256": "5fda34e027b4ccd9599d38342f9b925a89a5705a8df17460fd60288e8c24d118",
15
+ "brBytes": 22440560,
16
+ "bytes": 74891344
17
17
  },
18
18
  "linux-x64": {
19
- "url": "https://s.koubei.com/MfrBXHizSEfhZH8HaHTS4KN38jHXBrHH.br",
20
- "sha256": "f70e39cd678fe5f04b8b7bb0d26362a51727b850e6be30b1b3909e1875506237",
21
- "brSha256": "63f5bcdfc3ac476458aef13c00d599f5ae14ac3e8833a92218cff467a7d9a41c",
22
- "brBytes": 30814844,
23
- "bytes": 100284544
19
+ "url": "https://s.koubei.com/JdrdywtQNhEPa23hnBP57Tds738W6a8d.br",
20
+ "sha256": "d232f85eacb5c5747cd8505696ccedb07317d551e173a9759c0a86e4a57d1b09",
21
+ "brSha256": "340354eeeca25dfd92c12e9416a15a13f0532708e1d848e8716a4a16f95894d1",
22
+ "brBytes": 30821608,
23
+ "bytes": 100300928
24
24
  },
25
25
  "linux-arm64": {
26
- "url": "https://s.koubei.com/hcfwYBxtWNk7GbDJmyaYZbGMAa2cy4mk.br",
27
- "sha256": "6ff616a75de8f3375800133ddc16b1e2d899fafc8e1b9f7e40f175bb512da7d6",
28
- "brSha256": "c7ad2363694c18aadc4798c5fec71f04821d7ca1ccebafbfecd1a9b4a37ff3ad",
29
- "brBytes": 30201936,
26
+ "url": "https://s.koubei.com/wRaEWm5jDEEM4FjBdYFRxY5nyNncRStf.br",
27
+ "sha256": "46498c0e138128143c180deb3ea143a2e5462b439a9b29a34e433fe69efca3f9",
28
+ "brSha256": "8e597fbd7c452b582966aa0392b4873a3982e3f0dbba07fb24dd8226c021c984",
29
+ "brBytes": 30206979,
30
30
  "bytes": 99395728
31
31
  },
32
32
  "linux-x64-musl": {
33
- "url": "https://s.koubei.com/MwfS4eC3kn2fNXXD6Apidj2E78wBP8Ky.br",
34
- "sha256": "9a2fb19c7c30d56e72c031cb20d8f6ba83ec2d07c6d7d0a82e03cfd7a3324ca2",
35
- "brSha256": "bb0c372e1990fdc2cd9e661853979aac708f91f27890bbb5114407148af5f4a2",
36
- "brBytes": 30003542,
37
- "bytes": 96864544
33
+ "url": "https://s.koubei.com/FEB2KGYCm4CfbT55rihiQhhxC5jNzwDk.br",
34
+ "sha256": "fa940e25186de2be2296b0bb3b174e7fe319dcd9ce34f2d7ba20b005fc38dc0f",
35
+ "brSha256": "9be8c6cbf60c657c611e7f4370072d1f86a4fa225b2fa63436b0b67432cb34ab",
36
+ "brBytes": 30007927,
37
+ "bytes": 96880928
38
38
  },
39
39
  "win32-x64": {
40
- "url": "https://s.koubei.com/ReGKRW6rsXY3bRMxSJfSPpfeeETXrTYA.br",
41
- "sha256": "09977bf2350c50c956565e5daa4aba1050c5da42a03767eeaecebad50fa843cc",
42
- "brSha256": "c2633996a81cfa37eedd813e2cfe54a6e404c98be80d347fbce5e0c898624b42",
43
- "brBytes": 32676602,
44
- "bytes": 104174080
40
+ "url": "https://s.koubei.com/fPNPPw3iG54RCXKeMxprYHWhGeCeGadj.br",
41
+ "sha256": "7b05c2382601264a392eb2a58c2d62d478927e8cea03cb25c1cd57d2a053be67",
42
+ "brSha256": "e1b1dca3c2d360ba402cb2945f78c6e0a7bd3a0658f33f1aa3ee68c226e387b4",
43
+ "brBytes": 32681802,
44
+ "bytes": 104193536
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.3-beta.1",
3
+ "version": "1.5.3-beta.3",
4
4
  "description": "客如云 CLI 工具",
5
5
  "author": "玄宫",
6
6
  "license": "MIT",