bailian-cli-commands 1.8.0 → 1.8.2
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/dist/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -66,7 +66,7 @@ Hint: Add --diarization flag to enable speaker separation.`,a.USAGE);let c=r.mod
|
|
|
66
66
|
`)}function Li(e,t){let n=Mi(process.stdout),r=vt(process.stdout),i=[];i.push(` ${n.yellow.bold(`⚡ Pipeline`)} ${e}`);for(let[e,{step:a,recommendations:o,warnings:s}]of t.entries()){if(i.push(``),i.push(n.bold(` ━━━ Step ${e+1}: ${a} ━━━`)),s?.length)for(let e of s)i.push(` ${n.yellow(`⚠`)} ${n.yellow(e)}`);i.push(``),i.push(o.map((e,t)=>Fi(e,t,n,r)).join(`
|
|
67
67
|
`))}return i.join(`
|
|
68
68
|
`)}function Ri(e){return e.type===`pipeline`?Li(e.summary,e.steps):Ii(e.recommendations)}function zi(e){return e.type===`pipeline`?e.steps.length===0:e.recommendations.length===0}var Bi=T({description:`Recommend the best models for your use case (intent analysis → candidate recall → LLM ranking)`,auth:`apiKey`,usageArgs:`--message <text> [flags]`,flags:{message:{type:`string`,valueHint:`<text>`,description:`Describe your requirements`,required:!0}},exampleArgs:[`--message "I need a visual-understanding chatbot"`,`--message "Build an Agent that auto-generates animations"`,`--message "Legal contract review, high precision required"`,`--message "Low-cost high-concurrency online customer service" --output text`,`--message "Long document summarization" --dry-run`],async run(e){let{settings:t,flags:n}=e,r=n.message,i=t.outputExplicit?D(t.output):`json`,a=lt(`Agent: Loading model data & analyzing intent...`);a.start();let o={onPrepareStart:()=>{}},s=!1,c=!1,l=_e(t,o).then(e=>(s=!0,c||a.update(`Agent: Model data loaded, analyzing intent...`),e)),d=m(e.client,r).then(e=>(c=!0,s||a.update(`Agent: Intent analyzed, loading model data...`),e)),[f,p]=await Promise.all([l,d]);a.stop(),p.confidence===0&&process.stderr.write(`Intent analysis timed out, using defaults...
|
|
69
|
-
`),a.update(`Agent: Recalling candidates...`),a.start();let h=await Ue(e.client,f,r,u,p);if(a.stop(),t.dryRun){V({userInput:r,intent:{taskSummary:p.taskSummary,scenarioHints:p.scenarioHints,complexity:p.complexity,inputModality:p.inputModality,outputModality:p.outputModality,requiredCapabilities:p.requiredCapabilities,budget:p.budget,qualityPreference:p.qualityPreference,modelPreference:p.modelPreference?.mode===`unconstrained`?void 0:p.modelPreference,segments:p.segments,semanticQuery:p.semanticQuery},candidateCount:h.length,candidates:h.map(({model:e,score:t,hardScore:n,softScore:r})=>({model:e.model,score:t,hardScore:n,softScore:r})),top:3},i);return}a.update(`Agent: Ranking models...`),a.start();let g=await He(e.client,h,p,r,3);if(a.stop(),zi(g)){B(`No suitable models found for this request.`);return}if(i!==`text`){V({intent:{taskSummary:p.taskSummary,scenarioHints:p.scenarioHints,complexity:p.complexity,inputModality:p.inputModality,outputModality:p.outputModality,requiredCapabilities:p.requiredCapabilities,budget:p.budget,qualityPreference:p.qualityPreference,modelPreference:p.modelPreference?.mode===`unconstrained`?void 0:p.modelPreference,segments:p.segments,semanticQuery:p.semanticQuery},result:g,candidates:h.length},i);return}B(Ni(p)),B(``),B(Ri(g))}});const Vi=/-\d{4}-\d{2}-\d{2}$/,Hi={model:{type:`string`,valueHint:`<model>`,description:`Show full details of a specific model family (switches to detail mode)`},page:{type:`number`,valueHint:`<n>`,description:`Page number (default: 1)`},pageSize:{type:`number`,valueHint:`<n>`,description:`Results per page (default: 10)`},provider:{type:`array`,valueHint:`<p>`,description:`Filter by provider (repeatable, e.g. --provider alibaba --provider deepseek)`},capability:{type:`array`,valueHint:`<c>`,description:`Filter by capability code (TG, Reasoning, VU, IG, VG, TTS, ASR, …)`},feature:{type:`array`,valueHint:`<f>`,description:`Filter by feature (function-calling, web-search, structured-outputs, …)`},contextWindow:{type:`array`,valueHint:`<w>`,description:`Filter by context window range bucket`},enrich:{type:`switch`,description:`Also fetch input parameter schema (predictConfig) for trunk models (detail mode only)`}};function Ui(e){return(e.model??``).replace(/^group-/,``)||e.name||`unknown`}function Wi(e){if(!e?.length)return`-`;let t=e.find(e=>typeof e.type==`string`&&e.type.includes(`input`))??e[0];return`${t.type??``}:${String(t.price??`?`)}/${t.priceUnit??``}`}function Gi(e){let t=new Set,n=new Set,r=0,i=0,a,o=[];for(let s of e.items??[]){s.provider&&t.add(s.provider);for(let e of s.capabilities??[])n.add(e);r++,typeof s.contextWindow==`number`&&s.contextWindow>i&&(i=s.contextWindow),s.prices?.length&&(o.push(...s.prices),a||=s.prices.find(e=>typeof e.type==`string`&&e.type.includes(`input`))??s.prices[0])}return{providers:[...t].join(`,`),capabilities:[...n].join(`,`),modelCount:r,maxContext:i>0?i:void 0,price:a?Wi([a]):void 0,prices:o}}function Ki(e){if(e.length===0)return[];let t=e.filter(e=>!Vi.test(e.model??``));return t.length>0?t:[...e].sort((e,t)=>String(t.model).localeCompare(String(e.model))).slice(0,1)}function qi(e,t){if(e.length===0){B(`No model families found.`);return}let n=[`NAME`,`PROVIDER`,`CAPABILITIES`,`MODELS`,`MAX_CONTEXT`,`PRICE`],r=e.map(e=>{let t=Gi(e);return[e.name||Ui(e),t.providers||`-`,t.capabilities||`-`,String(t.modelCount),t.maxContext?String(t.maxContext):`-`,t.price??`-`]});for(let e of H(n,r))B(e);B(`\nTotal: ${t}`)}function Ji(e,t){return{items:e.map(e=>{let t=Gi(e),n=e.items?.[0];return{model:Ui(e),name:e.name,description:e.description,provider:t.providers,capabilities:[...new Set((e.items??[]).flatMap(e=>e.capabilities??[]))],modelCount:t.modelCount,maxContextWindow:t.maxContext,prices:t.prices.length>0?t.prices:void 0,qpmInfo:n?.qpmInfo}}),total:t}}function Yi(e,t){let n=e.items??[],r=Ki(n),i=n.length-r.length;B(e.name??e.model),e.description&&B(` ${e.description}`),e.updateAt&&B(` Updated: ${e.updateAt}`),B(``);let a=[`MODEL`,`PROVIDER`,`CAPABILITIES`,`CONTEXT`,`OUTPUT`,`CATEGORY`,`PRICE`],o=n.map(e=>[e.model??`-`,e.provider??`-`,(e.capabilities??[]).join(`,`)||`-`,e.contextWindow?String(e.contextWindow):`-`,e.maxOutputTokens?String(e.maxOutputTokens):`-`,e.category??`-`,Wi(e.prices)]);for(let e of H(a,o))B(e);B(`\nTotal: ${n.length} models (${r.length} trunk, ${i} snapshots)`);for(let e of r){if(!e.prices?.length)continue;B(`\n── Pricing: ${e.model} ──`);let t=[`TYPE`,`PRICE`,`UNIT`],n=e.prices.map(e=>[e.type??`-`,String(e.price??`-`),e.priceUnit??`-`]);for(let e of H(t,n))B(e)}for(let e of r){if(!e.qpmInfo||Object.keys(e.qpmInfo).length===0)continue;B(`\n── Rate Limits: ${e.model} ──`);let t=[`TIER`,`RPM`,`TPM`,`TPM_FIELD`],n=Object.entries(e.qpmInfo).map(([e,t])=>{let n=t.count_limit_period||60,r=n?Math.floor((t.count_limit||0)*60/n):0,i=t.usage_limit_period||60,a=i?Math.floor((t.usage_limit||0)*60/i):0;return[e,r>0?String(r):`-`,a>0?String(a):`-`,t.usage_limit_field??`-`]});for(let e of H(t,n))B(e)}if(t)for(let e of r)!e.predictConfig||e.predictConfig.length===0||(B(`\n── predictConfig: ${e.model} ──`),Zi(e.predictConfig))}function Xi(e,t){let n=e.items??[];return{model:e.model,name:e.name,description:e.description,updateAt:e.updateAt,items:n.map(e=>{let n={model:e.model,name:e.name,provider:e.provider,capabilities:e.capabilities,features:e.features,contextWindow:e.contextWindow,maxOutputTokens:e.maxOutputTokens,maxInputTokens:e.maxInputTokens,category:e.category,openSource:e.openSource,docUrl:e.docUrl,versionTag:e.versionTag};return e.prices&&(n.prices=e.prices),e.qpmInfo&&(n.qpmInfo=e.qpmInfo),t&&e.predictConfig&&(n.predictConfig=e.predictConfig),n})}}function Zi(e){let t=[`PARAM`,`KEY`,`DEFAULT`,`RANGE`],n=e.map(e=>[e.name??`-`,e.key??`-`,e.default===void 0?`-`:JSON.stringify(e.default),e.range===void 0?`-`:JSON.stringify(e.range)]);for(let e of H(t,n))B(e)}var Qi=T({description:`Browse model families or show detailed model info in the Bailian model marketplace`,auth:`console`,usageArgs:`[--model <model>] [--page <n>] [--page-size <n>] [--provider <p>] [--capability <c>] [--feature <f>] [--enrich]`,flags:Hi,exampleArgs:[``,`--provider alibaba`,`--capability TG --capability Reasoning`,`--model qwen-max`,`--model qwen-max --enrich --output json`,`--feature function-calling --output json`],async run(e){let{settings:t,flags:n}=e,r=D(t.output)
|
|
69
|
+
`),a.update(`Agent: Recalling candidates...`),a.start();let h=await Ue(e.client,f,r,u,p);if(a.stop(),t.dryRun){V({userInput:r,intent:{taskSummary:p.taskSummary,scenarioHints:p.scenarioHints,complexity:p.complexity,inputModality:p.inputModality,outputModality:p.outputModality,requiredCapabilities:p.requiredCapabilities,budget:p.budget,qualityPreference:p.qualityPreference,modelPreference:p.modelPreference?.mode===`unconstrained`?void 0:p.modelPreference,segments:p.segments,semanticQuery:p.semanticQuery},candidateCount:h.length,candidates:h.map(({model:e,score:t,hardScore:n,softScore:r})=>({model:e.model,score:t,hardScore:n,softScore:r})),top:3},i);return}a.update(`Agent: Ranking models...`),a.start();let g=await He(e.client,h,p,r,3);if(a.stop(),zi(g)){B(`No suitable models found for this request.`);return}if(i!==`text`){V({intent:{taskSummary:p.taskSummary,scenarioHints:p.scenarioHints,complexity:p.complexity,inputModality:p.inputModality,outputModality:p.outputModality,requiredCapabilities:p.requiredCapabilities,budget:p.budget,qualityPreference:p.qualityPreference,modelPreference:p.modelPreference?.mode===`unconstrained`?void 0:p.modelPreference,segments:p.segments,semanticQuery:p.semanticQuery},result:g,candidates:h.length},i);return}B(Ni(p)),B(``),B(Ri(g))}});const Vi=/-\d{4}-\d{2}-\d{2}$/,Hi={model:{type:`string`,valueHint:`<model>`,description:`Show full details of a specific model family (switches to detail mode)`},page:{type:`number`,valueHint:`<n>`,description:`Page number (default: 1)`},pageSize:{type:`number`,valueHint:`<n>`,description:`Results per page (default: 10)`},provider:{type:`array`,valueHint:`<p>`,description:`Filter by provider (repeatable, e.g. --provider alibaba --provider deepseek)`},capability:{type:`array`,valueHint:`<c>`,description:`Filter by capability code (TG, Reasoning, VU, IG, VG, TTS, ASR, …)`},feature:{type:`array`,valueHint:`<f>`,description:`Filter by feature (function-calling, web-search, structured-outputs, …)`},contextWindow:{type:`array`,valueHint:`<w>`,description:`Filter by context window range bucket`},enrich:{type:`switch`,description:`Also fetch input parameter schema (predictConfig) for trunk models (detail mode only)`}};function Ui(e){return(e.model??``).replace(/^group-/,``)||e.name||`unknown`}function Wi(e){if(!e?.length)return`-`;let t=e.find(e=>typeof e.type==`string`&&e.type.includes(`input`))??e[0];return`${t.type??``}:${String(t.price??`?`)}/${t.priceUnit??``}`}function Gi(e){let t=new Set,n=new Set,r=0,i=0,a,o=[];for(let s of e.items??[]){s.provider&&t.add(s.provider);for(let e of s.capabilities??[])n.add(e);r++,typeof s.contextWindow==`number`&&s.contextWindow>i&&(i=s.contextWindow),s.prices?.length&&(o.push(...s.prices),a||=s.prices.find(e=>typeof e.type==`string`&&e.type.includes(`input`))??s.prices[0])}return{providers:[...t].join(`,`),capabilities:[...n].join(`,`),modelCount:r,maxContext:i>0?i:void 0,price:a?Wi([a]):void 0,prices:o}}function Ki(e){if(e.length===0)return[];let t=e.filter(e=>!Vi.test(e.model??``));return t.length>0?t:[...e].sort((e,t)=>String(t.model).localeCompare(String(e.model))).slice(0,1)}function qi(e,t){if(e.length===0){B(`No model families found.`);return}let n=[`NAME`,`PROVIDER`,`CAPABILITIES`,`MODELS`,`MAX_CONTEXT`,`PRICE`],r=e.map(e=>{let t=Gi(e);return[e.name||Ui(e),t.providers||`-`,t.capabilities||`-`,String(t.modelCount),t.maxContext?String(t.maxContext):`-`,t.price??`-`]});for(let e of H(n,r))B(e);B(`\nTotal: ${t}`)}function Ji(e,t){return{items:e.map(e=>{let t=Gi(e),n=e.items?.[0];return{model:Ui(e),name:e.name,description:e.description,provider:t.providers,capabilities:[...new Set((e.items??[]).flatMap(e=>e.capabilities??[]))],modelCount:t.modelCount,maxContextWindow:t.maxContext,prices:t.prices.length>0?t.prices:void 0,qpmInfo:n?.qpmInfo}}),total:t}}function Yi(e,t){let n=e.items??[],r=Ki(n),i=n.length-r.length;B(e.name??e.model),e.description&&B(` ${e.description}`),e.updateAt&&B(` Updated: ${e.updateAt}`),B(``);let a=[`MODEL`,`PROVIDER`,`CAPABILITIES`,`CONTEXT`,`OUTPUT`,`CATEGORY`,`PRICE`],o=n.map(e=>[e.model??`-`,e.provider??`-`,(e.capabilities??[]).join(`,`)||`-`,e.contextWindow?String(e.contextWindow):`-`,e.maxOutputTokens?String(e.maxOutputTokens):`-`,e.category??`-`,Wi(e.prices)]);for(let e of H(a,o))B(e);B(`\nTotal: ${n.length} models (${r.length} trunk, ${i} snapshots)`);for(let e of r){if(!e.prices?.length)continue;B(`\n── Pricing: ${e.model} ──`);let t=[`TYPE`,`PRICE`,`UNIT`],n=e.prices.map(e=>[e.type??`-`,String(e.price??`-`),e.priceUnit??`-`]);for(let e of H(t,n))B(e)}for(let e of r){if(!e.qpmInfo||Object.keys(e.qpmInfo).length===0)continue;B(`\n── Rate Limits: ${e.model} ──`);let t=[`TIER`,`RPM`,`TPM`,`TPM_FIELD`],n=Object.entries(e.qpmInfo).map(([e,t])=>{let n=t.count_limit_period||60,r=n?Math.floor((t.count_limit||0)*60/n):0,i=t.usage_limit_period||60,a=i?Math.floor((t.usage_limit||0)*60/i):0;return[e,r>0?String(r):`-`,a>0?String(a):`-`,t.usage_limit_field??`-`]});for(let e of H(t,n))B(e)}if(t)for(let e of r)!e.predictConfig||e.predictConfig.length===0||(B(`\n── predictConfig: ${e.model} ──`),Zi(e.predictConfig))}function Xi(e,t){let n=e.items??[];return{model:e.model,name:e.name,description:e.description,updateAt:e.updateAt,items:n.map(e=>{let n={model:e.model,name:e.name,provider:e.provider,capabilities:e.capabilities,features:e.features,contextWindow:e.contextWindow,maxOutputTokens:e.maxOutputTokens,maxInputTokens:e.maxInputTokens,category:e.category,openSource:e.openSource,docUrl:e.docUrl,versionTag:e.versionTag};return e.prices&&(n.prices=e.prices),e.qpmInfo&&(n.qpmInfo=e.qpmInfo),t&&e.predictConfig&&(n.predictConfig=e.predictConfig),n})}}function Zi(e){let t=[`PARAM`,`KEY`,`DEFAULT`,`RANGE`],n=e.map(e=>[e.name??`-`,e.key??`-`,e.default===void 0?`-`:JSON.stringify(e.default),e.range===void 0?`-`:JSON.stringify(e.range)]);for(let e of H(t,n))B(e)}var Qi=T({description:`Browse model families or show detailed model info in the Bailian model marketplace`,auth:`console`,usageArgs:`[--model <model>] [--page <n>] [--page-size <n>] [--provider <p>] [--capability <c>] [--feature <f>] [--enrich]`,flags:Hi,exampleArgs:[``,`--provider alibaba`,`--capability TG --capability Reasoning`,`--model qwen-max`,`--model qwen-max --enrich --output json`,`--feature function-calling --output json`],async run(e){let{settings:t,flags:n}=e,r=t.outputExplicit?D(t.output):`json`,i=n.model;if(i){let a=!!n.enrich;if(t.dryRun){V({action:`model.detail`,model:i,enrich:a},r);return}let o=await oe(e.client.console.bind(e.client),i);if(!o){B(`Model "${i}" not found.`);return}if(a){let t=Ki(o.items??[]);await Promise.all(t.map(async t=>{if(!t.model)return;let n=await le(e.client.console.bind(e.client),t.model);n&&(t.predictConfig=n)}))}if(r===`json`){V(Xi(o,a),r);return}Yi(o,a);return}let a={pageNo:n.page,pageSize:n.pageSize??10,providers:n.provider?.length?n.provider:void 0,capabilities:n.capability?.length?n.capability:void 0,features:n.feature?.length?n.feature:void 0,contextWindows:n.contextWindow?.length?n.contextWindow:void 0};if(t.dryRun){V({action:`model.list`,...a},r);return}let{total:o,groups:s}=await se(e.client.console.bind(e.client),a);if(r===`json`){V(Ji(s,o),r);return}qi(s,o)}});const $i=`zeldaEasy.bailian-dash-workspace.space.listWorkspaces`;function ea(e,t){let n=e[t];if(n&&typeof n==`object`&&!Array.isArray(n))return n}function ta(e){let t=ea(e,`data`);if(!t)return e;let n=ea(t,`DataV2`);if(n){let e=ea(n,`data`);return(e?ea(e,`data`):void 0)??e??n}return ea(t,`data`)??t}function na(e){let t=L(process.stdout),n=[`Name`,`Workspace ID`,`Default`],r=e.map(e=>[e.agentName,e.workspaceId,e.defaultAgent?`Yes`:`-`]),i=n.map((e,t)=>Math.max(R(e),...r.map(e=>R(e[t])))),a=n.map((e,n)=>t.bold(W(e,i[n]))).join(` `),o=i.map(e=>t.dim(`─`.repeat(e))).join(`──`);process.stdout.write(a+`
|
|
70
70
|
`),process.stdout.write(o+`
|
|
71
71
|
`);for(let e of r){let n=e.map((e,n)=>n===2&&e===`Yes`?t.green(W(e,i[n])):W(e,i[n]));process.stdout.write(n.join(` `)+`
|
|
72
72
|
`)}process.stdout.write(t.dim(`\nTotal: ${e.length}`)+`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bailian-cli-commands",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Command library for bailian-cli products (knowledge, memory, media, …). See https://www.npmjs.com/package/bailian-cli for usage.",
|
|
5
5
|
"homepage": "https://bailian.console.aliyun.com/cli",
|
|
6
6
|
"bugs": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"boxen": "^8.0.1",
|
|
31
31
|
"chalk": "^5.6.2",
|
|
32
32
|
"yaml": "^2.8.3",
|
|
33
|
-
"bailian-cli-
|
|
34
|
-
"bailian-cli-
|
|
33
|
+
"bailian-cli-core": "1.8.2",
|
|
34
|
+
"bailian-cli-runtime": "1.8.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^24",
|