Skip to content

Commit 6d588a5

Browse files
committed
Merge branch 'main' into feat/cli-access-token
2 parents 84383f1 + cc23b4b commit 6d588a5

71 files changed

Lines changed: 3728 additions & 493 deletions

Some content is hidden

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

.vite-hooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env sh
22
set -eu
33

4-
# Regenerate skill reference + SKILL metadata (needs bailian-cli-core dist).
4+
# Regenerate skill reference + SKILL metadata from source (no package build).
55
pnpm run sync:skill-assets
66

77
# Stage generator output so it is included in this commit.

AGENTS.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
monorepo 现在按"纯逻辑 → 运行时框架 → 命令库 → 产品入口"分层:
88

99
- `packages/core``bailian-cli-core`,纯逻辑层:鉴权、配置、HTTP client、错误、类型、文件工具
10-
- `packages/runtime``bailian-cli-runtime`,通用 CLI 运行时:`createCli`、参数解析、registry/help、middleware、error handler、输出、pipeline
10+
- `packages/runtime``bailian-cli-runtime`,通用 CLI 运行时:`createCli`、参数解析、registry/help、middleware、error handler、输出、pipeline、Command Pack host
1111
- `packages/commands``bailian-cli-commands`,可复用命令实现库,只导出 command,不决定产品路径
1212
- `packages/cli``bailian-cli`,完整 `bl` 产品入口;`src/commands.ts` 组装 `bl` 暴露的命令路径
1313
- `packages/kscli``knowledge-studio-cli`,Knowledge Studio 专用入口;`src/main.ts` 复用 commands 并重映射为 `kscli` 路径
@@ -17,14 +17,16 @@ monorepo 现在按"纯逻辑 → 运行时框架 → 命令库 → 产品入口"
1717
```
1818
packages/cli/src/main.ts # bl 入口,注入 binName/version/clientName/npmPackage
1919
packages/cli/src/commands.ts # bl 产品命令 map,tools/generate-reference.ts 也读它
20+
packages/cli/src/command-pack-policy.ts # bl 的 Command Pack policy
2021
packages/kscli/src/main.ts # kscli 入口和命令 map
2122
2223
packages/commands/src/index.ts # re-export 单个命令实现
2324
packages/commands/src/commands/ # defineCommand({ auth, flags, usageArgs, exampleArgs, run })
2425
25-
packages/runtime/src/create-cli.ts # createCli(commands, identity)
26+
packages/runtime/src/create-cli.ts # createCli(commands, options)
2627
packages/runtime/src/registry.ts # 命令树解析 + 动态 help
2728
packages/runtime/src/middleware.ts # auth / telemetry / update / run command
29+
packages/runtime/src/command-packs/ # 通用 Command Pack 加载、校验、隔离安装目录和管理命令
2830
packages/runtime/src/urls.ts # 用户面控制台 URL
2931
3032
packages/core/src/types/command.ts # Command / flags / auth 类型
@@ -68,6 +70,7 @@ Skill / 命令手册随 `skills/bailian-cli/` 经 `npx skills add modelstudioai/
6870
| 发布 | channel / stable 发布到 npm(CI 驱动) | [docs/agents/publish.md](docs/agents/publish.md) |
6971
| Change Log | 发版说明 / 历史版本说明 | [docs/agents/changelog-write.md](docs/agents/changelog-write.md) |
7072
| 工具链调整 | 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) |
7174

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

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,42 @@ 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.8.1] - 2026-07-14
10+
11+
### Changed
12+
13+
- Expanded the Command Pack allowlist to accept an additional internal command extension.
14+
15+
## [1.8.0] - 2026-07-13
16+
17+
### Added
18+
19+
- **`bl model list`** — browse the Bailian model marketplace: list model families or show full details for a single family (`--model`), with filters for provider, capability, feature, and context-window, pagination (`--page` / `--page-size`), pricing, and `--enrich` for richer metadata.
20+
- **`bl usage summary`** — a unified usage view combining free-tier quota and a recent usage overview; `--days` sets the overview window (default 7).
21+
- **Command Pack host support** — added support for allowlisted internal command extensions.
22+
- **Audio & image fine-tuning**`bl finetune audio create` (CosyVoice TTS) and `bl finetune image create` (Wan image generation) join the existing text flow. `bl finetune image create` supports `--generation-type t2i|i2i` to select text-to-image or image-to-image training.
23+
- **Audio & image deployment**`bl deploy audio create` and `bl deploy image create` deploy fine-tuned TTS and image models as endpoints.
24+
- **Multimodal dataset validation**`bl dataset upload` and `bl dataset validate` now accept `.zip` archives with `tts` and `image` schemas, validate referenced media files, and allow image archives up to 1 GB.
25+
26+
### Changed
27+
28+
- **Fine-tune and deploy commands are now split by modality (BREAKING)**: `bl finetune create``bl finetune text create`, and `bl deploy create``bl deploy text create`. Update any scripts that use the old paths.
29+
- **Deployment option renamed (BREAKING)**: `--template-id``--deploy-spec` on deployment creation commands.
30+
- **Fine-tune status exit behavior changed (BREAKING)**: `bl finetune watch` no longer reserves exit code 3 for running jobs. Running and succeeded jobs return 0; failed and canceled jobs use normal CLI errors.
31+
- `bl deploy audio create` now defaults to `--plan mu` (model-unit billing, per the CosyVoice deployment contract); text and image continue to default to `lora`.
32+
- `bl finetune audio create` now validates CosyVoice training data: audio files must be `.wav`, each `wav_fn` must start with `train/`, and exactly one training file is accepted.
33+
- `bl quota list` and `bl quota check` now report real RPM/TPM usage against limits, adding `RPM Left` / `TPM Left` columns with remaining-quota progress bars sourced from monitoring data.
34+
- `bl usage free` output now shares its rendering with `bl usage summary` for consistent free-tier tables.
35+
- `bl advisor recommend` no longer depends on a dedicated intent-detection model to analyze your request.
36+
37+
### Removed
38+
39+
- **Removed the `tongyi-intent-detect-v3` integration (BREAKING)** used by `bl advisor recommend`, along with the `intent_detect_base_url` config field and the `DASHSCOPE_INTENT_DETECT_BASE_URL` environment variable.
40+
41+
### Fixed
42+
43+
- Skill command-reference generation now reads product command maps directly from source and produces stable formatting during release checks.
44+
945
## [1.7.0] - 2026-07-09
1046

1147
### Added

CHANGELOG.zh.md

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

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

9+
## [1.8.1] - 2026-07-14
10+
11+
### 变更
12+
13+
- 扩展 Command Pack 白名单,允许加载额外的内部命令扩展。
14+
15+
## [1.8.0] - 2026-07-13
16+
17+
### 新增
18+
19+
- **`bl model list`** —— 浏览百炼模型市场:列出模型家族,或用 `--model` 查看单个家族的完整详情;支持按 provider、能力、特性、上下文窗口过滤,分页(`--page` / `--page-size`)、价格展示,以及 `--enrich` 获取更丰富的元数据。
20+
- **`bl usage summary`** —— 统一用量视图,一屏合并免费额度与近期用量概览;`--days` 设置概览时间窗口(默认 7 天)。
21+
- **Command Pack 宿主支持** —— 新增面向白名单内部命令扩展包的加载能力。
22+
- **音频与图像精调** —— 在原有文本流程之外新增 `bl finetune audio create`(CosyVoice 语音合成)与 `bl finetune image create`(万相图像生成)。`bl finetune image create` 支持 `--generation-type t2i|i2i` 显式选择文生图或图生图训练。
23+
- **音频与图像部署** —— `bl deploy audio create``bl deploy image create` 可将精调后的语音合成与图像模型部署为推理接入点。
24+
- **多模态数据集校验** —— `bl dataset upload``bl dataset validate` 现在支持使用 `tts``image` schema 的 `.zip` 压缩包,可校验包内引用的媒体文件,图像数据压缩包上限提升至 1 GB。
25+
26+
### 变更
27+
28+
- **精调与部署命令按模态拆分(BREAKING)**`bl finetune create``bl finetune text create``bl deploy create``bl deploy text create`。请更新使用旧路径的脚本。
29+
- **部署参数重命名(BREAKING)**:部署创建命令的 `--template-id` 更名为 `--deploy-spec`
30+
- **精调状态退出行为变更(BREAKING)**`bl finetune watch` 不再使用退出码 3 表示任务运行中;运行中与成功均返回 0,失败与取消使用 CLI 的常规错误流程。
31+
- `bl deploy audio create` 默认使用 `--plan mu`(按模型单元计费,符合 CosyVoice 部署契约);文本与图像仍默认 `lora`
32+
- `bl finetune audio create` 现在会校验 CosyVoice 训练数据:音频必须为 `.wav`,每条 `wav_fn` 必须以 `train/` 开头,且只接受一个训练文件。
33+
- `bl quota list``bl quota check` 现在会基于监控数据展示真实的 RPM/TPM 用量与限额,新增 `RPM Left` / `TPM Left` 列及剩余额度进度条。
34+
- `bl usage free` 的输出现在与 `bl usage summary` 共用渲染逻辑,免费额度表格更一致。
35+
- `bl advisor recommend` 不再依赖独立的意图识别模型来分析你的需求。
36+
37+
### 已移除
38+
39+
- **移除 `bl advisor recommend` 使用的 `tongyi-intent-detect-v3` 集成(BREAKING)**,同时移除 `intent_detect_base_url` 配置字段与 `DASHSCOPE_INTENT_DETECT_BASE_URL` 环境变量。
40+
41+
### 修复
42+
43+
- Skill 命令参考文档生成现在直接读取产品命令源码,并在发布检查中保持稳定格式。
44+
945
## [1.7.0] - 2026-07-09
1046

1147
### 新增

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Equip your AI Agent out-of-the-box with these capabilities, composable across co
3939
- **Web search** — Real-time internet retrieval for up-to-date, accurate answers
4040
- **Model recommendation** — Describe your scenario and get best-fit model suggestions; supports scoped search, model comparison, and alternative discovery
4141
- **Fine-tuning & deployment** — Upload datasets, create text/audio/image fine-tune jobs (`finetune text|audio|image create`; text covers SFT/LoRA/DPO/CPT), probe job status non-blockingly (`finetune watch`), query per-model training capability (`finetune capability`), and deploy trained models as endpoints (`deploy text|audio|image create`)
42-
- **Console capabilities** — Browse Bailian apps (`app list`), check free-tier quota (`usage free`), view model usage statistics (`usage stats`), manage workspaces (`workspace list`), and manage rate limits (`quota list/request/check/history`)
42+
- **Console capabilities** — Browse the model marketplace (`model list`) and Bailian apps (`app list`), review a unified usage view (`usage summary`), check free-tier quota (`usage free`), view model usage statistics (`usage stats`), manage workspaces (`workspace list`), and manage rate limits (`quota list/request/check/history`)
4343
- **Local file auto-upload** — Every URL parameter accepts a local path; uploaded to free temp storage with 48-hour validity
4444

4545
## Showcase: One-Sentence Cinematic Video
@@ -115,12 +115,14 @@ bl auth login --console
115115
# Fine-tune & deploy — a one-shot train-to-serve workflow
116116
bl dataset upload --file ./train.jsonl # Upload a .jsonl dataset (validated first)
117117
bl finetune text create --model qwen3-8b --datasets ./train.jsonl --training-type sft-lora # Local paths auto-upload
118-
bl finetune watch --job-id ft-xxx --output json # Non-blocking status probe (exit 0/1/3 = done/failed/running)
118+
bl finetune watch --job-id ft-xxx --output json # Non-blocking probe (running/succeeded return 0; failed/canceled report an error)
119119
bl finetune capability --model qwen3-8b # Which training types a model supports
120120
bl deploy text create --model qwen3-8b --name my-svc --plan mu # Deploy the trained model as an endpoint
121121

122-
# Browse apps / free-tier quota / usage statistics / workspaces
122+
# Browse models / apps / free-tier quota / usage statistics / workspaces
123+
bl model list # Browse model families and pricing
123124
bl app list
125+
bl usage summary # Unified view: free-tier quota + recent usage overview
124126
bl usage free # Free-tier quota across models (add --model/--expiring/--sort)
125127
bl usage stats --workspace-id <id> # Model usage statistics (add --model for per-model)
126128
bl workspace list # List all workspaces
@@ -159,7 +161,7 @@ bl text chat --api-key sk-xxxxx --message "Hello"
159161

160162
### Console Login (OAuth)
161163

162-
Required for console capability commands (`app list`, `usage free`, `usage stats`, `workspace list`, `quota list/request/check/history`). Opens the Bailian console in your browser to sign in.
164+
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.
163165

164166
```bash
165167
bl auth login --console

README.zh.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
3939
- **联网搜索** — 实时互联网信息检索,提升回答准确性及时效性
4040
- **模型推荐** — 描述你的场景,智能推荐最适合的模型;支持限定范围搜索、模型对比和替代发现
4141
- **微调与部署** — 上传数据集、创建文本/音频/图像调优任务(`finetune text|audio|image create`;文本涵盖 SFT/LoRA/DPO/CPT)、非阻塞探测任务状态(`finetune watch`)、按模型查训练能力(`finetune capability`),并把训练好的模型部署为推理服务(`deploy text|audio|image create`
42-
- **控制台能力**浏览百炼应用(`app list`),查询模型免费额度(`usage free`),查看模型用量统计(`usage stats`),管理业务空间(`workspace list`),管理限流与提额(`quota list/request/check/history`
42+
- **控制台能力**浏览模型市场(`model list`)和百炼应用(`app list`),查看统一用量视图(`usage summary`),查询模型免费额度(`usage free`),查看模型用量统计(`usage stats`),管理业务空间(`workspace list`),管理限流与提额(`quota list/request/check/history`
4343
- **本地文件自动上传** — 所有 URL 参数同时支持本地路径,免费临时存储 48 小时
4444

4545
## 示例:一句话生成一部电影短片
@@ -113,12 +113,14 @@ bl auth login --console
113113
# 微调与部署 — 从训练到服务的一站式流程
114114
bl dataset upload --file ./train.jsonl # 上传 .jsonl 数据集(先校验)
115115
bl finetune text create --model qwen3-8b --datasets ./train.jsonl --training-type sft-lora # 本地路径自动上传
116-
bl finetune watch --job-id ft-xxx --output json # 非阻塞状态探测(退出码 0/1/3 = 成功/失败/进行中
116+
bl finetune watch --job-id ft-xxx --output json # 非阻塞探测(运行中/成功返回 0;失败/取消报错
117117
bl finetune capability --model qwen3-8b # 查询模型支持哪些训练方式
118118
bl deploy text create --model qwen3-8b --name my-svc --plan mu # 把训练好的模型部署为推理服务
119119

120-
# 浏览应用 / 免费额度 / 用量统计 / 业务空间
120+
# 浏览模型 / 应用 / 免费额度 / 用量统计 / 业务空间
121+
bl model list # 浏览模型系列与价格信息
121122
bl app list
123+
bl usage summary # 统一视图:免费额度 + 近期用量概览
122124
bl usage free # 各模型免费额度(可加 --model/--expiring/--sort)
123125
bl usage stats --workspace-id <id> # 模型用量统计(加 --model 查单模型)
124126
bl workspace list # 列出所有业务空间
@@ -157,7 +159,7 @@ bl text chat --api-key sk-xxxxx --message "你好"
157159

158160
### 控制台登录(OAuth)
159161

160-
控制台能力命令(`app list``usage free``usage stats``workspace list``quota list/request/check/history`)需要使用此登录方式。打开浏览器跳转百炼控制台完成登录。
162+
控制台能力命令(`model list``app list``usage summary/free/stats``workspace list``quota list/request/check/history`)需要使用此登录方式。打开浏览器跳转百炼控制台完成登录。
161163

162164
```bash
163165
bl auth login --console

docs/agents/auth-change.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ defineCommand({ auth }) → runtime/authStage → ctx.client → command.run(ctx
4848
- `resolveOpenApi()``auth: "openapi"` 命令;优先级 `--access-key-id/--access-key-secret` > `ALIBABA_CLOUD_ACCESS_KEY_ID/ALIBABA_CLOUD_ACCESS_KEY_SECRET` > config `access_key_*`。兼容读取旧字段 `openapi_access_key_*`,新写入只写短字段
4949
- `describeAuthState()``auth status` / banner / telemetry 使用的只读快照
5050

51-
命令不要直接解析 token、env 或 config。业务请求统一走 `ctx.client`;登录/配置命令通过 `ctx.authStore()` / `ctx.configStore()` 的窄接口操作落盘。
51+
命令不要直接解析 token、env 或 config。业务请求统一走 `ctx.client`;登录/配置命令通过 `ctx.authStore` / `ctx.configStore` 的窄接口操作落盘。
5252

5353
## 必查清单
5454

@@ -87,7 +87,7 @@ defineCommand({ auth }) → runtime/authStage → ctx.client → command.run(ctx
8787

8888
- [ ] `packages/commands/src/commands/auth/login.ts`:
8989
- 新增/调整登录 flag 与流程
90-
- 持久化只走 `ctx.authStore().login(...)`
90+
- 持久化只走 `ctx.authStore.login(...)`
9191
- [ ] `packages/commands/src/commands/auth/status.ts`:
9292
- 分别显示 model / console / openapi 鉴权状态,并 mask token
9393
- [ ] `packages/commands/src/commands/auth/logout.ts`:

docs/agents/command-add-remove.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ packages/commands/src/index.ts
7272
- `exampleArgs`(不含 bin/path 前缀)
7373
- `validate`(跨 flag 校验)
7474
- 普通业务命令的 `run(ctx)` 只读 `ctx.flags` / `ctx.settings` / `ctx.client`
75-
- `commands/auth/**` 可用 `ctx.authStore()`,`commands/config/**` 可用 `ctx.configStore()`;不要把这些 store accessor 扩散到普通业务命令
75+
- `commands/auth/**` 可用 `ctx.authStore`,`commands/config/**` 可用 `ctx.configStore`;不要把这些持久化能力扩散到普通业务命令
76+
- `commands/plugin/**` 可用 `ctx.commandPacks`;产品 policy 由 runtime 绑定,命令不要自行 import 产品入口
7677
- [ ] `packages/commands/src/index.ts`:新增或移除对应 export
7778
- [ ] 如果命令调用 Console Gateway,设置 `auth: "console"`;不要重复声明 console 凭证域 flags
7879
- [ ] 如果命令不需要网络或自己管理配置/登录,设置 `auth: "none"`;不要绕过 runtime auth stage

0 commit comments

Comments
 (0)