Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and

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

## [2.15.0] - 2026-12-01

### Added

- Find workspace connector tools and authorized accounts with `bl connector tools --query`. Use `bl connector schema` to inspect the selected tool’s inputs and `bl connector call` to run it on the selected account.

## [2.14.1] - 2026-12-01

### Added
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

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

## [2.15.0] - 2026-12-01

### 新增

- 使用 `bl connector tools --query` 查找工作空间中的连接器工具和已授权账号。用 `bl connector schema` 查看所选工具的入参,再用 `bl connector call` 在所选账号上执行该工具。

## [2.14.1] - 2026-12-01

### 新增
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ _Built for AI Agents. Every command works as a structured tool call._
- **Model generation** — Full-modality generation across text, image, video, and speech, with editing and reference-based generation
- **Asset understanding** — Parse and ask questions about images, documents, audio, and long videos
- **App orchestration** — Call Managed Agents, agents, and workflows published on Aliyun Model Studio, wired to knowledge bases, memory, web search, and MCP tools; create, update, publish, copy, and delete agents/workflows, and edit workflow canvases from the CLI
- **Workspace connectors** — Discover tools with `bl connector tools --query`, inspect a selected account's schema with `bl connector schema`, and execute a tool with `bl connector call`.
- **Native MCP setup** — Register Bailian MCP servers in Codex, Claude Code, Cursor, Qoder, Qoder Work, QwenWork (千问办公), Qwen Code, Gemini CLI, or Pi
- **Training & deployment** — Prepare decision training data (local split, teacher-model generation, or fully async offline Batch), validate and upload datasets, fine-tune models (SFT/DPO/CPT), run reinforcement-learning jobs in an isolated sandbox (macOS/Linux), submit OPD distillation jobs via OpenAPI, deploy dedicated models as endpoints
- **Batch inference** — Prepare CSV/JSONL, create and follow asynchronous Chat/Embedding tasks, download original results/errors with optional CSV, or send one synchronous Batch Chat request
Expand Down
1 change: 1 addition & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
- **模型生成** — 文本、图像、视频、语音全模态生成,支持编辑与参考生成
- **素材理解** — 图像、文档、音频、长视频的解析与问答
- **应用编排** — 调用百炼已发布的 Managed Agent、智能体和工作流,接入知识库、记忆库、联网搜索与 MCP 工具;并可在命令行创建/更新/发布/复制/删除智能体与工作流、编辑工作流画布
- **工作空间连接器** — 用 `bl connector tools --query` 查找工具,用 `bl connector schema` 查看所选账号下的入参,再用 `bl connector call` 执行。
- **原生 MCP 接入** — 将百炼 MCP 服务注册到 Codex、Claude Code、Cursor、Qoder、Qoder Work、千问办公(QwenWork)、Qwen Code、Gemini CLI 或 Pi
- **模型训推** — 决策训练数据准备(本地切分 / teacher 模型生成 / 全异步离线 Batch)、数据集校验上传、模型精调(SFT/DPO/CPT)、在隔离沙箱内执行强化学习(RL)训练(macOS/Linux)、通过 OpenAPI 提交 OPD 蒸馏训练、专属模型部署上线
- **批量推理** — CSV/JSONL 构造、异步 Chat/Embedding 任务创建与跟踪、原始结果/错误下载及可选 CSV,或同步单请求 Batch Chat
Expand Down
2 changes: 1 addition & 1 deletion packages/bailian-kb-dsh/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bailian-kb-dsh",
"version": "2.14.1",
"version": "2.15.0",
"description": "Bailian knowledge-base tools for DeepSeek Harness: kb_search and kb_chat over the DashScope RAG API, plus the bl CLI management skill.",
"keywords": [
"alibaba-cloud",
Expand Down
2 changes: 1 addition & 1 deletion packages/bailian-memo-dsh/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bailian-memo-dsh",
"version": "2.14.1",
"version": "2.15.0",
"description": "Bailian personal memory for DeepSeek Harness: automatic recall, silent curation, and user-controlled remember/forget.",
"keywords": [
"alibaba-cloud",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ _Built for AI Agents. Every command works as a structured tool call._
- **Model generation** — Full-modality generation across text, image, video, and speech, with editing and reference-based generation
- **Asset understanding** — Parse and ask questions about images, documents, audio, and long videos
- **App orchestration** — Call Managed Agents, agents, and workflows published on Aliyun Model Studio, wired to knowledge bases, memory, web search, and MCP tools; create, update, publish, copy, and delete agents/workflows, and edit workflow canvases from the CLI
- **Workspace connectors** — Discover tools with `bl connector tools --query`, inspect a selected account's schema with `bl connector schema`, and execute a tool with `bl connector call`.
- **Native MCP setup** — Register Bailian MCP servers in Codex, Claude Code, Cursor, Qoder, Qoder Work, QwenWork (千问办公), Qwen Code, Gemini CLI, or Pi
- **Training & deployment** — Prepare decision training data (local split, teacher-model generation, or fully async offline Batch), validate and upload datasets, fine-tune models (SFT/DPO/CPT), run reinforcement-learning jobs in an isolated sandbox (macOS/Linux), submit OPD distillation jobs via OpenAPI, deploy dedicated models as endpoints
- **Batch inference** — Prepare CSV/JSONL, create and follow asynchronous Chat/Embedding tasks, download original results/errors with optional CSV, or send one synchronous Batch Chat request
Expand Down
1 change: 1 addition & 0 deletions packages/cli/README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
- **模型生成** — 文本、图像、视频、语音全模态生成,支持编辑与参考生成
- **素材理解** — 图像、文档、音频、长视频的解析与问答
- **应用编排** — 调用百炼已发布的 Managed Agent、智能体和工作流,接入知识库、记忆库、联网搜索与 MCP 工具;并可在命令行创建/更新/发布/复制/删除智能体与工作流、编辑工作流画布
- **工作空间连接器** — 用 `bl connector tools --query` 查找工具,用 `bl connector schema` 查看所选账号下的入参,再用 `bl connector call` 执行。
- **原生 MCP 接入** — 将百炼 MCP 服务注册到 Codex、Claude Code、Cursor、Qoder、Qoder Work、千问办公(QwenWork)、Qwen Code、Gemini CLI 或 Pi
- **模型训推** — 决策训练数据准备(本地切分 / teacher 模型生成 / 全异步离线 Batch)、数据集校验上传、模型精调(SFT/DPO/CPT)、在隔离沙箱内执行强化学习(RL)训练(macOS/Linux)、通过 OpenAPI 提交 OPD 蒸馏训练、专属模型部署上线
- **批量推理** — CSV/JSONL 构造、异步 Chat/Embedding 任务创建与跟踪、原始结果/错误下载及可选 CSV,或同步单请求 Batch Chat
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bailian-cli",
"version": "2.14.1",
"version": "2.15.0",
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
"keywords": [
"agent",
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ import {
mcpToolList,
mcpToolSearch,
mcpUpdate,
connectorTools,
connectorSchema,
connectorCall,
searchWeb,
speechSynthesize,
speechRecognize,
Expand Down Expand Up @@ -530,6 +533,9 @@ export const commands: Record<string, AnyCommand> = {
"mcp tool list": mcpToolList,
"mcp tool search": mcpToolSearch,
"mcp update": mcpUpdate,
"connector tools": connectorTools,
"connector schema": connectorSchema,
"connector call": connectorCall,
"search web": searchWeb,
"speech synthesize": speechSynthesize,
"speech recognize": speechRecognize,
Expand Down
3 changes: 2 additions & 1 deletion packages/commands/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bailian-cli-commands",
"version": "2.14.1",
"version": "2.15.0",
"description": "Command library for bailian-cli products (knowledge, memory, media, …). See https://www.npmjs.com/package/bailian-cli for usage.",
"homepage": "https://bailian.console.aliyun.com/cli",
"bugs": {
Expand Down Expand Up @@ -41,6 +41,7 @@
},
"dependencies": {
"@openagentpack/sdk": "0.9.0",
"ajv": "catalog:",
"bailian-cli-core": "workspace:*",
"bailian-cli-runtime": "workspace:*",
"boxen": "catalog:",
Expand Down
67 changes: 67 additions & 0 deletions packages/commands/src/commands/connector/call.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { Ajv } from "ajv";
import { Ajv2020 } from "ajv/dist/2020.js";
import { BailianError, defineCommand, UsageError } from "bailian-cli-core";
import { isObject, invoke, runConnector, schemaRequest, selectionFlags } from "./shared.ts";

export default defineCommand({
description: {
"en-US": "Validate arguments and execute one connector tool on the selected account",
"zh-CN": "校验入参并在所选账号执行一个连接器工具",
},
auth: "apiKey",
usageArgs: "--tool <toolRef> --instance <instanceId> --json '<object>' [--trace-id <id>]",
flags: {
...selectionFlags,
json: {
type: "string",
required: true,
valueHint: "<object>",
description: {
"en-US": "JSON object matching the selected tool schema",
"zh-CN": "与所选工具入参定义匹配的 JSON 对象",
},
},
},
exampleArgs: ["--tool <toolRef> --instance <instanceId> --json '{}' --dry-run"],
async run(ctx) {
const { tool, instance, traceId } = ctx.flags;
const lookup = schemaRequest(ctx.flags);
let args: unknown;
try {
args = JSON.parse(ctx.flags.json);
} catch {
throw new UsageError("--json must contain valid JSON.");
}
if (!isObject(args)) throw new UsageError("--json must be an object.");
const payload = {
executions: [{ toolRef: tool, instanceId: instance, arguments: args }],
...(traceId ? { traceId } : {}),
};
const name = "CONNECTOR_MULTI_EXECUTE_TOOL";
await runConnector(ctx, { tool: name, arguments: payload }, async (client) => {
const data = await invoke(client, "CONNECTOR_GET_TOOL_SCHEMAS", lookup);
const entries = Array.isArray(data.schemas)
? data.schemas.filter((row) => isObject(row) && row.toolRef === tool)
: [];
const schema = entries[0]?.inputSchema;
if (data.instanceId !== instance || entries.length !== 1 || !isObject(schema))
throw new BailianError(
"Missing matching input schema for the selected connector tool and instance.",
);
const options = { ownProperties: true, strict: false };
const validator =
schema.$schema === "https://json-schema.org/draft/2020-12/schema"
? new Ajv2020(options)
: new Ajv(options);
const validate = validator.compile(schema);
if ("$async" in validate) throw new BailianError("Unsupported async connector input schema.");
if (!validate(args)) throw new UsageError(validator.errorsText(validate.errors));
const result = await invoke(client, name, payload);
if (Array.isArray(result.errors) && result.errors.length)
throw new BailianError(JSON.stringify(result.errors));
if (!Array.isArray(result.results) || result.results.length !== 1)
throw new BailianError("Expected one connector execution result.");
return result;
});
},
});
20 changes: 20 additions & 0 deletions packages/commands/src/commands/connector/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineCommand } from "bailian-cli-core";
import { invoke, runConnector, schemaRequest, selectionFlags } from "./shared.ts";

export default defineCommand({
description: {
"en-US": "Inspect a connector tool's input schema for the selected account",
"zh-CN": "查看所选账号下连接器工具的入参定义",
},
auth: "apiKey",
usageArgs: "--tool <toolRef> --instance <instanceId> [--trace-id <id>]",
flags: selectionFlags,
exampleArgs: ["--tool <toolRef> --instance <instanceId> --output json"],
async run(ctx) {
const name = "CONNECTOR_GET_TOOL_SCHEMAS";
const args = schemaRequest(ctx.flags);
await runConnector(ctx, { tool: name, arguments: args }, (client) =>
invoke(client, name, args),
);
},
});
96 changes: 96 additions & 0 deletions packages/commands/src/commands/connector/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import {
BailianError,
UsageError,
ragEndpoint,
type CommandContext,
type FlagsDef,
type McpConnectedClient,
} from "bailian-cli-core";
import { resolveWorkspaceId, WORKSPACE_FLAG } from "../shared/workspace.ts";

export const selectionFlags = {
...WORKSPACE_FLAG,
tool: {
type: "string",
required: true,
valueHint: "<toolRef>",
description: {
"en-US": "Tool reference returned by discovery",
"zh-CN": "工具发现返回的 toolRef",
},
},
instance: {
type: "string",
required: true,
valueHint: "<instanceId>",
description: {
"en-US": "Selected authorized connector instance",
"zh-CN": "选定的已授权连接器实例 ID",
},
},
traceId: {
type: "string",
valueHint: "<id>",
description: {
"en-US": "Trace ID from connector discovery",
"zh-CN": "工具发现返回的 traceId",
},
},
} satisfies FlagsDef;

export function schemaRequest(flags: { tool: string; instance: string; traceId?: string }) {
if (!flags.tool.trim() || !flags.instance.trim())
throw new UsageError("--tool and --instance must be non-empty.");
return {
toolRefs: [flags.tool],
instanceId: flags.instance,
...(flags.traceId ? { traceId: flags.traceId } : {}),
};
}

export function isObject(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value);
}

export async function invoke(
client: McpConnectedClient,
name: string,
args: Record<string, unknown>,
) {
const result = await client.callTool(name, args);
const text = result.content
.filter((item) => item.type === "text")
.map((item) => item.text)
.join("\n");
if (result.isError) throw new BailianError(text || name + " failed");
let data: unknown = result.structuredContent;
if (data === undefined) {
try {
data = JSON.parse(text);
} catch {
throw new BailianError(name + " returned invalid JSON");
}
}
if (!isObject(data)) throw new BailianError(name + " returned an invalid result");
return data;
}

export async function runConnector(
ctx: Pick<CommandContext, "client" | "settings" | "identity" | "output"> & {
flags: { workspaceId?: string };
},
preview: Record<string, unknown>,
run: (client: McpConnectedClient) => Promise<Record<string, unknown>>,
) {
const url = ragEndpoint(resolveWorkspaceId(ctx), "/api/v2/connector/mcp");
if (ctx.settings.dryRun) {
ctx.output.result({ url, ...preview });
return;
}
const { client } = await ctx.client.connectBailianMcp("connector", url);
try {
ctx.output.result(await run(client));
} finally {
client.close?.();
}
}
35 changes: 35 additions & 0 deletions packages/commands/src/commands/connector/tools.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defineCommand, UsageError } from "bailian-cli-core";
import { WORKSPACE_FLAG } from "../shared/workspace.ts";
import { invoke, runConnector } from "./shared.ts";

export default defineCommand({
description: {
"en-US": "Discover connector tools and authorized accounts by intent",
"zh-CN": "按意图查找连接器工具与已授权账号",
},
auth: "apiKey",
usageArgs: "--query <text> [--workspace-id <id>]",
flags: {
...WORKSPACE_FLAG,
query: {
type: "string",
required: true,
valueHint: "<text>",
description: {
"en-US": "Describe the task and any preferred app or account",
"zh-CN": "描述任务和指定的应用或账号",
},
},
},
exampleArgs: [
{ "en-US": '--query "Find tomorrow\'s meetings"', "zh-CN": '--query "查明天的会议"' },
],
async run(ctx) {
const { query } = ctx.flags;
if (!query.trim()) throw new UsageError("--query must be non-empty.");
const name = "CONNECTOR_SEARCH_TOOL";
await runConnector(ctx, { tool: name, arguments: { query } }, (client) =>
invoke(client, name, { query }),
);
},
});
3 changes: 3 additions & 0 deletions packages/commands/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export { default as mcpToolCall } from "./commands/mcp/tool-call.ts";
export { default as mcpToolList } from "./commands/mcp/tool-list.ts";
export { default as mcpToolSearch } from "./commands/mcp/tool-search.ts";
export { default as mcpUpdate } from "./commands/mcp/update.ts";
export { default as connectorTools } from "./commands/connector/tools.ts";
export { default as connectorSchema } from "./commands/connector/schema.ts";
export { default as connectorCall } from "./commands/connector/call.ts";
export { default as searchWeb } from "./commands/search/web.ts";
export { default as speechSynthesize } from "./commands/speech/synthesize.ts";
export { default as speechRecognize } from "./commands/speech/recognize.ts";
Expand Down
Loading