@keruyun/agent-cli 1.4.12-beta.1 → 1.4.13-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,12 +17,12 @@ npm i @keruyun/agent-cli@latest -g --registry=https://registry.npmmirror.com
17
17
 
18
18
  | 平台 | 解压后体积 |
19
19
  | --- | --- |
20
- | darwin-arm64 | 65.8 MB |
21
- | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.22 MB |
22
- | linux-x64 | 95.46 MB |
20
+ | darwin-arm64 | 65.81 MB |
21
+ | darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.23 MB |
22
+ | linux-x64 | 95.47 MB |
23
23
  | linux-arm64 | 94.6 MB |
24
- | linux-x64-musl | 92.2 MB |
25
- | win32-x64 | 99.17 MB |
24
+ | linux-x64-musl | 92.21 MB |
25
+ | win32-x64 | 99.18 MB |
26
26
 
27
27
  ## 校验
28
28
 
package/bin/sdk.mjs CHANGED
@@ -1 +1,3 @@
1
- var q=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Y=q((Pe,ue)=>{ue.exports={name:"@keruyun/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:{"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 Q={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"}}},S={daily:"gld",pre:"pre",prod:"prod"};var ee="prod";function b(){if(process.env?.CLIENT_CLAW_ENV&&S[process.env.CLIENT_CLAW_ENV])return S[process.env.CLIENT_CLAW_ENV];let e=process.env.KRY_FORCE_ENV;return e&&Q[e]?e:ee}function v(...e){return X.join(process.env.AGENT_WORK_ROOT||Z.homedir(),...e)}var C=(...e)=>{let t=b();return t==="prod"?v(".kry-cli",...e):v(`.kry-cli-${t}`,...e)},m="-o /temp_path/file.json",k="-o /path/file.xlsx",te="-o /path/file.csv",ne={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> ${m} -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 ${te}`,meituan:`kry-cli comment meituan ${k} --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 ${m}`,company:`kry-cli comment blackcat --companyUrl 'https://zj.tousu.sina.com.cn/company/view/?couid=5652018762' ${m}`}},export:{star:`kry-cli export ecom star ${k}`,star30:`kry-cli export ecom star ${k} --start 2026-04-01 --end 2026-04-30`},viewDate:"kry-cli date"},re=process.env.AGENT_WORK_ROOT||"";function oe(e){return e?.match(/(?:^|[/\\])(user-[^/\\]+)[/\\]?$/)?.[1]||""}var x=oe(re),T=!!x,O=(process.env.REWIND_SESSION_ID||"").match(/^eval-sess-eval/);function I(){return process.env.CLIENT_CLAW_TYPE==="KRY_CLAW"}import*as s from"fs";import*as l from"path";import _ from"os";var ie="https://tnnm-alsc-saas-merchant-spider-fy21.cn-wulanchabu.log.aliyuncs.com/logstores/kry-cli/track?APIVersion=0.6.0",se=process.env.REWIND_SESSION_ID||"",be=process.env.ROBOT_UID||"",ce=crypto.randomUUID().replaceAll("-",""),E,N,A=0,D=0,j,L,R,P,$,z,U;function F(e){e?.brandId&&(E=e.brandId),e?.brandName&&(N=e.brandName),e?.brandCount!==void 0&&(A=e.brandCount),e?.shopCount!==void 0&&(D=e.shopCount),e?.version&&(j=e.version),e?.userId&&(L=e.userId),e?.source&&(R=e.source),e?.mobile&&(P=e.mobile),e?.pkg&&($=e.pkg)}function ae(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 J(){try{let e=ae(process.argv);return e.skill&&(U=e.skill),e.path&&(z=e.path),e}catch{}return null}function B(e){return e instanceof Error}function H(e){let t={};return Object.keys(e).forEach(n=>{t[n]=e[n]}),t.stack=e.stack,t}function le(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,typeof n=="string"?n:JSON.stringify(n,(o,r)=>B(r)?H(r):r)]))}function h(e,t,n){let o,r=b();if(r==="prod"&&e==="debug")return;let i={traceId:ce,level:e,message:t},c={env:r,brandId:E,brandName:N,brandCount:A.toString(),shopCount:D.toString(),version:j,sessionId:se,userId:L,hostname:_.hostname(),platform:_.platform(),arch:_.arch(),source:R,mobile:P,pkg:$,callPath:z,callSkill:U};O&&(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__:[le(a)],__tags__:c})}catch{o=JSON.stringify({__logs__:[JSON.stringify({...i,level:"error",message:t,data:"[Unserializable]"})],__tags__:c})}return fetch(ie,{method:"POST",headers:new Headers,body:o}).then(async d=>{}).catch(async d=>{})}function M(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,...B(n)?H(n):n}),debug:(t,n)=>h("debug",t,{...e,...n}),child:t=>M({...e,...t})}}var u=M();var f=C(),Ie=l.join(f,"credentials.json"),Ee=l.join(f,"token-cache.json"),K=l.join(f,"authorized-orgs.json"),Ne=3e3*1e3;var V=l.join(f,"token.json"),Ae=l.join(f,"discovery.json"),De=l.join(f,"login.pid");function de(){let e=u.child({tag:"loadOAuth2Token"});if(!s.existsSync(V))return null;try{let t=s.readFileSync(V,"utf-8");return JSON.parse(t)}catch(t){return e.error("\u8BFB\u53D6 OAuth2 Token \u5931\u8D25",t),null}}var Le=1440*60*1e3;function pe(){let e=u.child({tag:"loadAuthorizedOrgs"});if(!s.existsSync(K))return null;try{let t=s.readFileSync(K,"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 G(){let e={success:!1,brandId:"",brandName:"",brandCount:0,shopCount:0,brandMap:{},shopMap:{},brands:[],shops:[]},t=pe();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 y=p.shopList||[];y.length>a&&(a=y.length,d=String(p.id),g=p.name);for(let w of y)i[String(w.id)]=w}e.success=!0,e.brandMap=r,e.shopMap=i,e.brandCount=o,e.shopCount=a,e.brandId=d,e.brandName=g}return e}function W(){try{let o=(de()?.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=G(),n=W(),o=T?"wukong":"other";I()&&(o="kryclaw");let r=Y();F({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=J();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 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};
package/binaries.json CHANGED
@@ -1,47 +1,47 @@
1
1
  {
2
- "version": "1.4.12-beta.1",
2
+ "version": "1.4.13-beta.0",
3
3
  "targets": {
4
4
  "darwin-arm64": {
5
- "url": "https://s.koubei.com/P6xKjyrmdk57Dhh3cRHDT2p5tQRrJSib.br",
6
- "sha256": "75aab6350d14b5318f6a4d4d87637a06d2025d44035c82d7057ab1ee55a09249",
7
- "brSha256": "bc872a7cf81b767b1f783e7135128eef2ab50a5639c2fdc0105cc676fe3847a2",
8
- "brBytes": 19916389,
9
- "bytes": 68994146
5
+ "url": "https://s.koubei.com/diyK7Er4XDBcAbx5R8SFzbGmeAEekm7x.br",
6
+ "sha256": "af0e313d1d810630a9f292aca4f4ee8797c866f24ac89107c435b6d0f31ce57d",
7
+ "brSha256": "4df882514fc2b37175fe9b17708647fc3fce92a0284a33781c59afd7fe73d734",
8
+ "brBytes": 19916815,
9
+ "bytes": 69010658
10
10
  },
11
11
  "darwin-x64": {
12
- "url": "https://s.koubei.com/TAWrjx4xR556aPkQSz86RKN2PwDpyxMb.br",
13
- "sha256": "aca40490cb1e0ee99994f06d94d97887dfb732bcd7f04e5e4ac7bb69736031c1",
14
- "brSha256": "79b1fb2da93ca8b6c295178b7dee41712246fd596d5eb3d676c12a55d7893a34",
15
- "brBytes": 22345069,
16
- "bytes": 74678352
12
+ "url": "https://s.koubei.com/A5DhHB4deMCY26b6QbRyWJhkJbjTXWnS.br",
13
+ "sha256": "cc05aee56a8e27ba855b2d739f33f4692216826e63af58cdafab593613385586",
14
+ "brSha256": "b78451c2bc97a9885192e9892d770005886a1becf9748a87027182d84a0ebb67",
15
+ "brBytes": 22345836,
16
+ "bytes": 74694736
17
17
  },
18
18
  "linux-x64": {
19
- "url": "https://s.koubei.com/wHtGmaDwsetrshXjx5AJPMBPGa6z3d4Z.br",
20
- "sha256": "8e6d70fe198bd794be01f0a24dec1900e0d84f676c0dc0452b70543a7913675e",
21
- "brSha256": "17355b2b08d87f4403161535d2f84b78a48981f49d7867150c5892a9eb332087",
22
- "brBytes": 30770467,
23
- "bytes": 100096128
19
+ "url": "https://s.koubei.com/CBeySFhChcNbJcdCyJ8Es2dD8r6FwwPp.br",
20
+ "sha256": "6e2d8cf9223514c14636a4bfa7cc72cffc6dbadf62796ab084c53180e99ed563",
21
+ "brSha256": "e7292a0f5658ac60ee35f0709be6ff860b6acc1c76f7ff6f7414a788d1bd7cdc",
22
+ "brBytes": 30772346,
23
+ "bytes": 100104320
24
24
  },
25
25
  "linux-arm64": {
26
- "url": "https://s.koubei.com/8rDYYwJwmDzPMcJwPT6Fcit873XTTNcN.br",
27
- "sha256": "715a216316b6ac019d3c1557bf67e5ae18c1758658a47a102dc1c63c5cb6263b",
28
- "brSha256": "25e57bb0154086128f245433cf5fa66b5aa8b841f16212cfa91b5711352b3459",
29
- "brBytes": 30165425,
26
+ "url": "https://s.koubei.com/zD75P2A3DdFtrWt8B45pNJRZXrwB6ce7.br",
27
+ "sha256": "3de8939f4248d6caa92076b01f68cf813984d3513b0ff0d829450ea2c9cdac03",
28
+ "brSha256": "48c4afcfdcc2b6ad6f38f224677eecee57a494d3242b266ad271034eba9effad",
29
+ "brBytes": 30169369,
30
30
  "bytes": 99199120
31
31
  },
32
32
  "linux-x64-musl": {
33
- "url": "https://s.koubei.com/KecaQDBPw7EaBhXFeZaRip3Qm5G467Pe.br",
34
- "sha256": "e7c0c7ea28e36524a2a7a4152dfc81e788c7f3b1323c7e183116325d3f99cf85",
35
- "brSha256": "874954401e1623c1e8f2f492331ecc337bc099bfbeb97b6d894964835a416a46",
36
- "brBytes": 29963359,
37
- "bytes": 96676128
33
+ "url": "https://s.koubei.com/FNN7jyKRARwWXxkfEkEm3fwGGWDrcTxz.br",
34
+ "sha256": "0047ea9620cd1490b78ffd375d3cddaf29a4d6b47a42b16705316b7fd2ed6485",
35
+ "brSha256": "00c2f52d05889db76dd769b70f01dd43414a72e9ba740fb829ee772f01cc3209",
36
+ "brBytes": 29965381,
37
+ "bytes": 96684320
38
38
  },
39
39
  "win32-x64": {
40
- "url": "https://s.koubei.com/RN3GJwMEXQrCK2jhC2Kw8QMWnMNeRpyA.br",
41
- "sha256": "62bde2f8507aadfd0d22fd7f43d1b067692a87f45239dc009d2004bcefd1b948",
42
- "brSha256": "6a9623269cce895b38b6ea6cabccd5ad38aad5241d275a7fbc78188ce2406de7",
43
- "brBytes": 32635944,
44
- "bytes": 103987712
40
+ "url": "https://s.koubei.com/Q8hGBh8accNNxKMEHsT5hFXdMCpdY7AS.br",
41
+ "sha256": "4083660fb80d6c9462199c880e1fb1d0f915c56348be06a635e057c37b32065c",
42
+ "brSha256": "351ea23ef71bd506d1bf3cde172e4b1a5119142e40976b524f2eaf8190337eb2",
43
+ "brBytes": 32637535,
44
+ "bytes": 103995904
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.4.12-beta.1",
3
+ "version": "1.4.13-beta.0",
4
4
  "description": "客如云 CLI 工具",
5
5
  "author": "玄宫",
6
6
  "license": "MIT",