Skip to content

Commit 7cbd61d

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/cma
# Conflicts: # packages/commands/src/commands/auth/login.ts # packages/commands/src/commands/config/set.ts # packages/commands/src/index.ts # packages/core/src/client/index.ts # packages/core/src/config/schema.ts # skills/bailian-cli/reference/auth.md # skills/bailian-cli/reference/config.md # skills/bailian-cli/reference/index.md
2 parents 1c9dac2 + 678f60b commit 7cbd61d

111 files changed

Lines changed: 5893 additions & 719 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ body:
3939
attributes:
4040
label: Node version
4141
description: "Output of node --version"
42-
placeholder: "v22.12.0"
42+
placeholder: "v18.17.0"
4343
validations:
4444
required: true
4545

AGENTS.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,22 @@ Skill / 命令手册随 `skills/bailian-cli/` 经 `npx skills add modelstudioai/
5656

5757
按当前任务从下表挑一条进入对应文档:
5858

59-
| 场景 | 何时进入 | 详见 |
60-
| -------------- | -------------------------------------------- | ------------------------------------------------------------------------ |
61-
| 命令增删改 | 增加 / 删除 / 重命名 `bl xxx` 或入口命令路径 | [docs/agents/command-add-remove.md](docs/agents/command-add-remove.md) |
62-
| E2E 测试维护 | 新增/改命令或 e2e 用例、补 help/缺参/dry-run | [docs/agents/cli-e2e-tests.md](docs/agents/cli-e2e-tests.md) |
63-
| 批量压测 | 改/跑多能力并发压测、`test:stress`、fixtures | [docs/agents/stress-batch-tests.md](docs/agents/stress-batch-tests.md) |
64-
| 选项变更 | 给已有命令加 `--flag` 或改默认值 | [docs/agents/command-flag-change.md](docs/agents/command-flag-change.md) |
65-
| 模型上下架 | 增加新模型 / 改默认模型 / 废弃旧模型 | [docs/agents/model-add-remove.md](docs/agents/model-add-remove.md) |
66-
| 错误文案变更 |`BailianError` 的 message 或 hint | [docs/agents/error-hint-change.md](docs/agents/error-hint-change.md) |
67-
| URL / 渠道变更 | 控制台域名 / 文档站 / 追踪参数 | [docs/agents/url-change.md](docs/agents/url-change.md) |
68-
| 鉴权扩展 | 加 OAuth / SSO / 换 token 来源 | [docs/agents/auth-change.md](docs/agents/auth-change.md) |
69-
| 配置项扩展 | 新 env var 或 `~/.bailian/config.json` 字段 | [docs/agents/config-add.md](docs/agents/config-add.md) |
70-
| 发布 | channel / stable 发布到 npm(CI 驱动) | [docs/agents/publish.md](docs/agents/publish.md) |
71-
| Change Log | 发版说明 / 历史版本说明 | [docs/agents/changelog-write.md](docs/agents/changelog-write.md) |
72-
| 工具链调整 | lint 规则 / 构建配置 / 依赖升级 | [docs/agents/lint-toolchain.md](docs/agents/lint-toolchain.md) |
73-
| Command Pack | 扩展包 / 白名单 / plugin 管理命令 | [docs/agents/command-pack.md](docs/agents/command-pack.md) |
59+
| 场景 | 何时进入 | 详见 |
60+
| -------------- | -------------------------------------------- | ---------------------------------------------------------------------------- |
61+
| 命令增删改 | 增加 / 删除 / 重命名 `bl xxx` 或入口命令路径 | [docs/agents/command-add-remove.md](docs/agents/command-add-remove.md) |
62+
| E2E 测试维护 | 新增/改命令或 e2e 用例、补 help/缺参/dry-run | [docs/agents/cli-e2e-tests.md](docs/agents/cli-e2e-tests.md) |
63+
| 批量压测 | 改/跑多能力并发压测、`test:stress`、fixtures | [docs/agents/stress-batch-tests.md](docs/agents/stress-batch-tests.md) |
64+
| 选项变更 | 给已有命令加 `--flag` 或改默认值 | [docs/agents/command-flag-change.md](docs/agents/command-flag-change.md) |
65+
| 模型上下架 | 增加新模型 / 改默认模型 / 废弃旧模型 | [docs/agents/model-add-remove.md](docs/agents/model-add-remove.md) |
66+
| 错误文案变更 |`BailianError` 的 message 或 hint | [docs/agents/error-hint-change.md](docs/agents/error-hint-change.md) |
67+
| URL / 渠道变更 | 控制台域名 / 文档站 / 追踪参数 | [docs/agents/url-change.md](docs/agents/url-change.md) |
68+
| 鉴权扩展 | 加 OAuth / SSO / 换 token 来源 | [docs/agents/auth-change.md](docs/agents/auth-change.md) |
69+
| 配置项扩展 | 新 env var 或 `~/.bailian/config.json` 字段 | [docs/agents/config-add.md](docs/agents/config-add.md) |
70+
| Profile / 激活 | 改命名 Profile、预设或 `active_config` | [docs/agents/config-profile-change.md](docs/agents/config-profile-change.md) |
71+
| 发布 | channel / stable 发布到 npm(CI 驱动) | [docs/agents/publish.md](docs/agents/publish.md) |
72+
| Change Log | 发版说明 / 历史版本说明 | [docs/agents/changelog-write.md](docs/agents/changelog-write.md) |
73+
| 工具链调整 | lint 规则 / 构建配置 / 依赖升级 | [docs/agents/lint-toolchain.md](docs/agents/lint-toolchain.md) |
74+
| Command Pack | 扩展包 / 白名单 / plugin 管理命令 | [docs/agents/command-pack.md](docs/agents/command-pack.md) |
7475

7576
如果当前任务无法对应任何场景,先按经验完成,然后**回来评估这是不是一类新场景** —— 是就新增 `docs/agents/<scenario>.md`,把清单沉淀下来。
7677

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,45 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
66

77
[中文版](CHANGELOG.zh.md) · [README](README.md) · [Contributing](CONTRIBUTING.md)
88

9+
## [1.10.1] - 2026-07-22
10+
11+
### Changed
12+
13+
- Token Plan defaults now use the current text, image, and dedicated text-to-video, image-to-video, and reference-to-video models.
14+
- The Bailian CLI Skill now distinguishes Bailian-specific tasks from ordinary host-agent work more accurately and avoids repeated consent prompts within an approved workflow.
15+
- Published CLI packages now support Node.js 18.17 and later, lowering the previous minimum requirement from Node.js 22.12.
16+
17+
### Fixed
18+
19+
- Token Plan now handles local images correctly for image editing, image-to-video, reference-to-video, and vision understanding without requiring a separately hosted URL.
20+
21+
## [1.10.0] - 2026-07-19
22+
23+
### Added
24+
25+
- **`bl config agent`** — configure Claude Code, Qwen Code, OpenCode, OpenClaw, Hermes Agent, or Codex to use DashScope in one command.
26+
27+
### Changed
28+
29+
- The Bailian CLI Skill now routes only matching Bailian and multimodal tasks to `bl`, and asks for consent before provider-neutral remote or billable calls.
30+
31+
### Fixed
32+
33+
- Full `bl auth logout` now clears the model Base URL so later logins cannot inherit a stale custom or Token Plan endpoint.
34+
35+
## [1.9.0] - 2026-07-17
36+
37+
### Added
38+
39+
- **Token Plan support** — log in and call supported models directly without manually configuring the endpoint.
40+
- **Named Config Profiles** — create, switch, and manage isolated configurations; logging in to a named Profile activates it automatically.
41+
- **Console Access Token automation** — generate and automatically refresh Console Access Tokens.
42+
- **`bl workspace init`** — initialize a Bailian workspace and activate the required services in one workflow.
43+
44+
### Fixed
45+
46+
- Improved configuration safety and consistency, including secret masking and preservation of custom configuration fields.
47+
948
## [1.8.3] - 2026-07-16
1049

1150
### Fixed

CHANGELOG.zh.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,45 @@
66

77
[English](CHANGELOG.md) · [README](README.zh.md) · [参与贡献](CONTRIBUTING.zh.md)
88

9+
## [1.10.1] - 2026-07-22
10+
11+
### 变更
12+
13+
- Token Plan 默认模型已更新为当前文本、图片,以及文生视频、图生视频和参考生视频的专用模型。
14+
- 百炼 CLI Skill 现在能更准确地区分百炼专属任务与普通宿主 Agent 任务,并避免在已授权的工作流中重复征求同意。
15+
- 已发布的 CLI 包现在支持 Node.js 18.17 及以上版本,最低版本要求由 Node.js 22.12 下调至 18.17。
16+
17+
### 修复
18+
19+
- Token Plan 现在能在图片编辑、图生视频、参考生视频和视觉理解中正确处理本地图片,无需另行托管为 URL。
20+
21+
## [1.10.0] - 2026-07-19
22+
23+
### 新增
24+
25+
- **`bl config agent`** —— 一键配置 Claude Code、Qwen Code、OpenCode、OpenClaw、Hermes Agent 和 Codex 接入百炼模型服务。
26+
27+
### 变更
28+
29+
- 百炼 CLI Skill 现在只将匹配的百炼任务与多模态任务路由到 `bl`,并会在调用与平台无关的远程或计费能力前征求同意。
30+
31+
### 修复
32+
33+
- 完整执行 `bl auth logout` 时会同时清除模型 Base URL,避免后续登录继承失效的自定义或 Token Plan 接入地址。
34+
35+
## [1.9.0] - 2026-07-17
36+
37+
### 新增
38+
39+
- **支持 Token Plan** —— 登录后即可直接调用支持的模型,无需手动配置接入地址。
40+
- **命名 Config Profile** —— 支持创建、切换和管理相互隔离的配置,登录后会自动激活当前 Profile。
41+
- **Console Access Token 自动化** —— 支持生成并自动刷新 Console Access Token。
42+
- **`bl workspace init`** —— 一站式完成百炼工作空间初始化和所需服务开通。
43+
44+
### 修复
45+
46+
- 提升配置安全性与一致性,包括密钥脱敏和自定义配置字段保留。
47+
948
## [1.8.3] - 2026-07-16
1049

1150
### 修复

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Developer guide for `bailian-cli` — the official CLI for Aliyun Model Studio (
66

77
## Prerequisites
88

9-
- Node.js ≥ 22.12
9+
- Node.js ≥ 22.12 (required for developing this repo)
10+
- End users installing the published CLI only need Node.js >= 18.17
1011
- pnpm 10.33.2 (`npm i -g pnpm@10.33.2`)
1112
- A DashScope API key for running e2e tests
1213

CONTRIBUTING.zh.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
## 环境要求
88

9-
- Node.js ≥ 22.12
10-
- pnpm 10.33.2(`npm i -g pnpm@10.33.2`)
9+
- 参与本仓库开发:Node.js ≥ 22.12
10+
- 仅安装/使用已发布的 CLI:Node.js >= 18.17
11+
- pnpm 10.33.2(`npm i -g pnpm@10.33.2`
1112
- 跑 e2e 需要一个百炼 API Key
1213

1314
## 仓库结构

INSTALL.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
**原则**:先执行检查;若 **Node / 包管理器 / 网络** 任一不满足下文要求,Agent 应 **在本机终端内主动完成安装或配置**(例如升级 Node、切换镜像、配置 `npm` 代理等),再继续 `bailian-cli` 安装。仅在无权限或环境无法自动化时,再向用户说明原因并请其配合。
88

99
1. **Node.js**
10-
- 要求 **22.12.0**,执行 `node -v` 确认。
10+
- 要求 **18.17.0**,执行 `node -v` 确认。
1111
- 未安装或版本不足:由 Agent 自行安装或升级 Node。
1212

1313
2. **npm****唯一**允许的包管理器)
@@ -69,7 +69,7 @@ npx skills add modelstudioai/cli --all -g
6969

7070
> 此方式同时打通 `app list``usage free` 等控制台能力,并自动配置 API Key 调用所需的鉴权信息。
7171
72-
### 备选:由 Agent 引导用户输入 API Key 后登录
72+
### 备选一:由 Agent 引导用户输入普通 API Key 后登录
7373

7474
适用于无法拉起浏览器的对话式安装(远程 SSH、CI 调试、纯终端环境等):
7575

@@ -80,6 +80,15 @@ npx skills add modelstudioai/cli --all -g
8080
3. 用户提供了 Key 之后,在**用户本机终端**执行(Agent 用终端工具跑,勿把 Key 写进回复正文):`bl auth login --api-key <用户提供的_Key>`
8181
4. 登录成功后执行 `bl auth status --output json` 确认;汇报时只使用 masked 字段,**禁止**回显完整 Key。
8282

83+
### 备选二:使用 Token Plan API Key
84+
85+
- 获取入口:[Token Plan 订阅详情](https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview)
86+
87+
1. 请用户从订阅详情页获取或复制 Token Plan API Key,勿要求用户发到公开渠道。
88+
2. 在用户本机终端执行:`bl auth login --config token-plan --api-key <用户提供的_Key>`
89+
3. `token-plan` Profile 已内置默认 Base URL;登录命令会先测试 Key,通过后才保存并激活该 Profile,无需另行配置或重复测试。
90+
4. 执行 `bl auth status --config token-plan --output json` 确认;汇报时只使用 masked 字段。
91+
8392
### 其他方式
8493

8594
- **环境变量**(不落盘到配置文件):在 shell 中配置 API Key 环境变量;变量名见 `bl auth status --help`,勿在对话中向用户解释底层命名。
@@ -93,16 +102,15 @@ npx skills add modelstudioai/cli --all -g
93102

94103
---
95104

96-
## 4. 最小功能验证
105+
## 4. 配置验证
97106

98-
在鉴权配置完成后执行
107+
API Key 登录命令本身已经完成可用性测试,通过后只需确认配置状态
99108

100109
```bash
101110
bl auth status --output json
102-
bl text chat --message "ping" --non-interactive --output json
103111
```
104112

105-
若失败:根据 stderr / JSON 中的 `hint``message` 排查(网络、Key 无效、`base_url` 等)。DashScope 端点:使用 `--base-url` / `bl config set --key base_url` / `DASHSCOPE_BASE_URL`,默认中国大陆 `https://dashscope.aliyuncs.com`
113+
无需再执行重复的模型调用测试。若登录失败,根据 stderr / JSON 中的 `hint``message` 排查(网络、Key 无效、`base_url` 等)。DashScope 端点:使用 `--base-url` / `bl config set --key base_url` / `DASHSCOPE_BASE_URL`,默认中国大陆 `https://dashscope.aliyuncs.com`
106114

107115
---
108116

@@ -111,7 +119,7 @@ bl text chat --message "ping" --non-interactive --output json
111119
| 现象 | 可能原因 | 建议动作 |
112120
| ----------------------- | -------------------- | --------------------------------------------------------------- |
113121
| `bl: command not found` | 全局 bin 不在 PATH | 检查 `npm prefix -g` 与 PATH |
114-
| 安装报错 engines | Node 版本过低 | 升级到 ≥ 22.12 |
115-
| 401 / 鉴权失败 | 未 login 或 Key 无效 | 引导用户更新 Key `bl auth login --api-key` |
122+
| 安装报错 engines | Node 版本过低 | 升级到 ≥ 18.17 |
123+
| 401 / 鉴权失败 | 未 login 或 Key 无效 | Key 类型重新执行普通或 Token Plan 登录命令 |
116124
| 企业网络无法访问 npm | 代理 / 镜像 | 配置 registry 或代理后再装 |
117125
| 本机只有 pnpm、没有 npm | Agent 误用 pnpm 安装 | 先装/修好 **npm**,再用 `npm install -g bailian-cli`;勿用 pnpm |

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**The official command-line interface for Aliyun Model Studio (DashScope) AI Platform**
66

77
[![npm version](https://img.shields.io/npm/v/bailian-cli?color=0969da&label=npm)](https://www.npmjs.com/package/bailian-cli)
8-
[![Node.js](https://img.shields.io/badge/node-%3E%3D22.12-brightgreen)](https://nodejs.org)
8+
[![Node.js](https://img.shields.io/badge/node-%3E%3D18.17-brightgreen)](https://nodejs.org)
99
[![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6)](https://www.typescriptlang.org)
1010
[![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
1111

@@ -30,6 +30,7 @@ Equip your AI Agent out-of-the-box with these capabilities, composable across co
3030
- **Video generation & editing** — happyhorse-1.1 series: text-/image-/reference-to-video and natural-language video editing (up to 9-image reference)
3131
- **Speech synthesis & recognition** — CosyVoice streaming TTS, voice cloning from 5–20s samples; FunAudio-ASR covers 30 languages including 7 Chinese dialects and 20+ Mandarin accents
3232
- **Image & video understanding** — Qwen-VL: long-form video analysis, chart/document parsing, visual reasoning, multilingual OCR
33+
- **Coding agent setup** — Configure Claude Code, Qwen Code, OpenCode, OpenClaw, Hermes Agent, or Codex to use DashScope with `bl config agent`
3334

3435
> **Note:** The features below are currently available only to China site (aliyun.com) account holders and are not yet supported for international / global site accounts.
3536
@@ -80,7 +81,7 @@ npm install -g bailian-cli
8081
npx skills add modelstudioai/cli --all -g
8182
```
8283

83-
> Requires Node.js >= 22.12.
84+
> Requires Node.js >= 18.17.
8485
8586
## Quick Start
8687

@@ -91,6 +92,12 @@ bl auth login --console
9192
# Or authenticate with an API key
9293
bl auth login --api-key sk-xxxxx
9394

95+
# Or use Token Plan (Base URL built in; the key is tested during login)
96+
bl auth login --config token-plan --api-key sk-sp-xxxxx
97+
98+
# Configure a coding agent to use DashScope
99+
bl config agent --agent codex --base-url https://dashscope.aliyuncs.com/compatible-mode/v1 --api-key sk-xxxxx --model qwen3-coder-plus
100+
94101
# Chat with Qwen
95102
bl text chat --message "What is DashScope?"
96103

@@ -159,6 +166,15 @@ bl auth login --api-key sk-xxxxx
159166
bl text chat --api-key sk-xxxxx --message "Hello"
160167
```
161168

169+
### Token Plan API Key
170+
171+
Get or copy the API key from the [Token Plan subscription overview](https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview).
172+
The CLI has the default Token Plan Base URL built in. Login tests the key first, then saves and activates the `token-plan` config only when validation succeeds.
173+
174+
```bash
175+
bl auth login --config token-plan --api-key sk-sp-xxxxx
176+
```
177+
162178
### Console Login (OAuth)
163179

164180
Required for console capability commands (`model list`, `app list`, `usage summary/free/stats`, `workspace list`, `quota list/request/check/history`). Opens the Bailian console in your browser to sign in.
@@ -209,6 +225,7 @@ Config file location: `~/.bailian/config.json`
209225
| Qwen Model List | https://help.aliyun.com/zh/model-studio/getting-started/models |
210226
| Aliyun Model Studio Console | https://bailian.console.aliyun.com/?source_channel=cli_github |
211227
| Get API Key | https://bailian.console.aliyun.com/cn-beijing/?source_channel=key_github&tab=app#/api-key |
228+
| Get Token Plan API Key | https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview |
212229
| Get AccessKey | https://ram.console.aliyun.com/manage/ak |
213230

214231
## Changelog

0 commit comments

Comments
 (0)