@keruyun/agent-cli 1.4.10 → 1.4.12-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 +2 -2
- package/bin/sdk.mjs +1 -1
- package/binaries.json +28 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,8 +21,8 @@ npm i @keruyun/agent-cli@latest -g --registry=https://registry.npmmirror.com
|
|
|
21
21
|
| darwin-x64(baseline 变体,兼容无 AVX2 的老 CPU) | 71.22 MB |
|
|
22
22
|
| linux-x64 | 95.46 MB |
|
|
23
23
|
| linux-arm64 | 94.6 MB |
|
|
24
|
-
| linux-x64-musl | 92.
|
|
25
|
-
| win32-x64 | 99.
|
|
24
|
+
| linux-x64-musl | 92.2 MB |
|
|
25
|
+
| win32-x64 | 99.17 MB |
|
|
26
26
|
|
|
27
27
|
## 校验
|
|
28
28
|
|
package/bin/sdk.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Y=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var G=Y((Pe,ue)=>{ue.exports={name:"@keruyun/agent-cli",version:"1.4.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:{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 X from"path";import q from"os";var Z={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 Q="prod";function k(){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&&Z[e]?e:Q}function S(...e){return X.join(process.env.AGENT_WORK_ROOT||q.homedir(),...e)}var w=(...e)=>{let t=k();return t==="prod"?S(".kry-cli",...e):S(`.kry-cli-${t}`,...e)},ee="-o /temp_path/file.json",m="-o /path/file.xlsx",te="-o /path/file.csv",ne={viewBrand:"krycli brand",viewShop:"krycli shop",viewShopByKeyword:"krycli shop -k '\u5173\u952E\u8BCD1|\u5173\u952E\u8BCD2'",viewShopParams:e=>`krycli shop -b ${e?.brandId||"<brandId>"}`,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> ${ee} -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",viewAllApi:"krycli view",viewSpcApi:"krycli view <\u63A5\u53E3\u8DEF\u5F84>",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 ${te}`,meituan:`krycli comment meituan ${m} --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"}},export:{star:`krycli export ecom star ${m}`,star30:`krycli export ecom star ${m} --start 2026-04-01 --end 2026-04-30`},viewDate:"krycli date",upgrade:"krycli upgrade",upgradeCheck:"krycli upgrade --check",upgradeForce:"krycli upgrade --force"},re=process.env.AGENT_WORK_ROOT||"";function oe(e){return e?.match(/(?:^|[/\\])(user-[^/\\]+)[/\\]?$/)?.[1]||""}var b=oe(re),C=!!b,T=(process.env.REWIND_SESSION_ID||"").match(/^eval-sess-eval/);function O(){return process.env.CLIENT_CLAW_TYPE==="KRY_CLAW"}import*as s from"fs";import*as l from"path";import x 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("-",""),I,E,N=0,A=0,j,D,L,R,P,$,z;function F(e){e?.brandId&&(I=e.brandId),e?.brandName&&(E=e.brandName),e?.brandCount!==void 0&&(N=e.brandCount),e?.shopCount!==void 0&&(A=e.shopCount),e?.version&&(j=e.version),e?.userId&&(D=e.userId),e?.source&&(L=e.source),e?.mobile&&(R=e.mobile),e?.pkg&&(P=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&&(z=e.skill),e.path&&($=e.path),e}catch{}return null}function U(e){return e instanceof Error}function B(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)=>U(r)?B(r):r)]))}function h(e,t,n){let o,r=k();if(r==="prod"&&e==="debug")return;let i={traceId:ce,level:e,message:t},c={env:r,brandId:I,brandName:E,brandCount:N.toString(),shopCount:A.toString(),version:j,sessionId:se,userId:D,hostname:x.hostname(),platform:x.platform(),arch:x.arch(),source:L,mobile:R,pkg:P,callPath:$,callSkill:z};T&&(c.test="TestRunner");try{let{tag:d,...f}=n||{},a={...i,tag:d,data:f};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 H(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,...U(n)?B(n):n}),debug:(t,n)=>h("debug",t,{...e,...n}),child:t=>H({...e,...t})}}var u=H();var g=w(),Ie=l.join(g,"credentials.json"),Ee=l.join(g,"token-cache.json"),M=l.join(g,"authorized-orgs.json"),Ne=3e3*1e3;var K=l.join(g,"token.json"),Ae=l.join(g,"discovery.json"),je=l.join(g,"login.pid");function de(){let e=u.child({tag:"loadOAuth2Token"});if(!s.existsSync(K))return null;try{let t=s.readFileSync(K,"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(M))return null;try{let t=s.readFileSync(M,"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 V(){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||"")||"",f=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),f=p.name);for(let _ of y)i[String(_.id)]=_}e.success=!0,e.brandMap=r,e.shopMap=i,e.brandCount=o,e.shopCount=a,e.brandId=d,e.brandName=f}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=V(),n=W(),o=C?"wukong":"other";O()&&(o="kryclaw");let r=G();F({version:r.version,brandId:t.brandId,brandName:t.brandName,brandCount:t.brandCount,shopCount:t.shopCount,userId:b,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 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};
|
package/binaries.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.
|
|
2
|
+
"version": "1.4.12-beta.0",
|
|
3
3
|
"targets": {
|
|
4
4
|
"darwin-arm64": {
|
|
5
|
-
"url": "https://s.koubei.com/
|
|
6
|
-
"sha256": "
|
|
7
|
-
"brSha256": "
|
|
8
|
-
"brBytes":
|
|
5
|
+
"url": "https://s.koubei.com/YaXdNwawSJADzaDeid5FZHrjr2rm8GER.br",
|
|
6
|
+
"sha256": "5842c89454f914cb0a38732c36c6ca0a78ebc07c7249b1fbd77e82110692f678",
|
|
7
|
+
"brSha256": "047e7dd2de232dd4ade3a8a890aef38bae895cb0180bffa26a6f8721d0b67c87",
|
|
8
|
+
"brBytes": 19916389,
|
|
9
9
|
"bytes": 68994146
|
|
10
10
|
},
|
|
11
11
|
"darwin-x64": {
|
|
12
|
-
"url": "https://s.koubei.com/
|
|
13
|
-
"sha256": "
|
|
14
|
-
"brSha256": "
|
|
15
|
-
"brBytes":
|
|
12
|
+
"url": "https://s.koubei.com/3MdXnp3B74wDHArsehCwSMTayNeDdCkk.br",
|
|
13
|
+
"sha256": "1cbfc6a95eb738e9b5ae43b038d9fb293910c682a0402a2ceb0d2177c66fbf6f",
|
|
14
|
+
"brSha256": "7af7460055c34736c8d3d5bdad81c31d716ec7e8c9302cf6a54890fb58459cff",
|
|
15
|
+
"brBytes": 22345069,
|
|
16
16
|
"bytes": 74678352
|
|
17
17
|
},
|
|
18
18
|
"linux-x64": {
|
|
19
|
-
"url": "https://s.koubei.com/
|
|
20
|
-
"sha256": "
|
|
21
|
-
"brSha256": "
|
|
22
|
-
"brBytes":
|
|
23
|
-
"bytes":
|
|
19
|
+
"url": "https://s.koubei.com/2CHGEJ3XYQCHNhKzAQC58s8Qw4K4ZMBM.br",
|
|
20
|
+
"sha256": "d0b4e7d420d2cc9135e0f0ecfde63de611783cca1e80b54fe7e40b352fb478ca",
|
|
21
|
+
"brSha256": "33483a785485350a0fb304337f3f8670174f3f38644b5ff0836d5701d11b23c7",
|
|
22
|
+
"brBytes": 30770467,
|
|
23
|
+
"bytes": 100096128
|
|
24
24
|
},
|
|
25
25
|
"linux-arm64": {
|
|
26
|
-
"url": "https://s.koubei.com/
|
|
27
|
-
"sha256": "
|
|
28
|
-
"brSha256": "
|
|
29
|
-
"brBytes":
|
|
26
|
+
"url": "https://s.koubei.com/GNDBPtTTJ7SS5ix5ntAbWsx5X8mHX5di.br",
|
|
27
|
+
"sha256": "bd3cf099b19d08a3c9e281f49ccfeb6886aa92849a2ff2ecdba9a859d0225681",
|
|
28
|
+
"brSha256": "17f78611b64bb0a1443a38b9c8f6f52a7740d6675ec0b0b66185c2dfa3aa0150",
|
|
29
|
+
"brBytes": 30165425,
|
|
30
30
|
"bytes": 99199120
|
|
31
31
|
},
|
|
32
32
|
"linux-x64-musl": {
|
|
33
|
-
"url": "https://s.koubei.com/
|
|
34
|
-
"sha256": "
|
|
35
|
-
"brSha256": "
|
|
36
|
-
"brBytes":
|
|
37
|
-
"bytes":
|
|
33
|
+
"url": "https://s.koubei.com/5WG5RDce7ebxipTeQKHSxbQpQ8jPjkta.br",
|
|
34
|
+
"sha256": "f522736f032ec0b561fe532a8e0c6c7a50ce5b806b100d7088b7198085a54a30",
|
|
35
|
+
"brSha256": "56237633120bceac42459da087e89300bbed34a2b9fcacc31ea8923cd3c0d9ca",
|
|
36
|
+
"brBytes": 29963359,
|
|
37
|
+
"bytes": 96676128
|
|
38
38
|
},
|
|
39
39
|
"win32-x64": {
|
|
40
|
-
"url": "https://s.koubei.com/
|
|
41
|
-
"sha256": "
|
|
42
|
-
"brSha256": "
|
|
43
|
-
"brBytes":
|
|
44
|
-
"bytes":
|
|
40
|
+
"url": "https://s.koubei.com/nYr5JAnN4THw3yjX2sT6b2FQ4zDyDcYe.br",
|
|
41
|
+
"sha256": "a5672da4b4f4f7437629e78b31a7ac4f06a04d2a70a480847b08d95583468767",
|
|
42
|
+
"brSha256": "09bd03fd8a7f6f0e1a4249d11c57ed69ceceb6ed3a30d90c57af0c04f10d9035",
|
|
43
|
+
"brBytes": 32635944,
|
|
44
|
+
"bytes": 103987712
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|