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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and

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

## [2.10.3] - 2026-11-18

### Fixed

- **Workspace list**: `bl workspace list` now returns every accessible workspace instead of only the gateway's default first page (10). Console workspace resolution used by telemetry, alert, log, dataset, file and deploy commands also covers workspaces beyond the first page.

## [2.10.2] - 2026-11-17

### Changed

- **Telemetry service-linked role**: `bl monitor delivery enable` and `bl log audit/inference enable` no longer create the service-linked role automatically. They check the role status and stop with bilingual guidance to the model-telemetry documentation when it is missing, so cross-service permissions are never granted silently.

## [2.10.1] - 2026-11-13

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

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

## [2.10.3] - 2026-11-18

### 修复

- **工作空间列表**:`bl workspace list` 现在返回全部可访问的业务空间,不再只返回网关默认的第一页(10 个)。遥测、告警、日志、数据集、文件与部署命令使用的控制台工作空间解析同样覆盖第一页之外的空间。

## [2.10.2] - 2026-11-17

### 变更

- **遥测服务关联角色**:`bl monitor delivery enable` 与 `bl log audit/inference enable` 不再自动创建服务关联角色,改为检查角色状态,缺失时以双语指引中止并指向模型可观测文档,避免静默授予跨服务权限。

## [2.10.1] - 2026-11-13

### 修复
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.10.2",
"version": "2.10.3",
"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.10.2",
"version": "2.10.3",
"description": "Bailian personal memory for DeepSeek Harness: automatic recall, silent curation, and user-controlled remember/forget.",
"keywords": [
"alibaba-cloud",
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.10.2",
"version": "2.10.3",
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
"keywords": [
"agent",
Expand Down
2 changes: 1 addition & 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.10.2",
"version": "2.10.3",
"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
76 changes: 69 additions & 7 deletions packages/commands/src/commands/shared/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,87 @@ export function resolveWorkspaceId(ctx: {

export const LIST_WORKSPACES_API = "zeldaEasy.bailian-dash-workspace.space.listWorkspaces";

/**
* Paginated workspace list. The plain listWorkspaces zelda service has no
* pagination inputs (the console frontend pages via the BailianControl POP
* layer, which the CLI gateway does not expose), while listMyWorkSpaces
* accepts reqDTO.pageNo/pageSize and returns { list, total }.
*/
export const LIST_MY_WORKSPACES_API = "zeldaEasy.bailian-dash-workspace.space.listMyWorkSpaces";

export const WORKSPACE_LIST_PAGE_SIZE = 100;
/** Hard stop so a server that ignores pageNo/total cannot loop forever. */
export const MAX_WORKSPACE_LIST_PAGES = 100;

/** listMyWorkSpaces contract: pagination lives inside reqDTO. */
export function workspaceListRequest(pageNo: number): Record<string, unknown> {
return { reqDTO: { pageNo, pageSize: WORKSPACE_LIST_PAGE_SIZE } };
}

export interface ConsoleWorkspaceInfo {
workspaceId: string;
agentName: string;
defaultAgent: boolean;
tenantId?: unknown;
}

/** 复用 workspace list 的只读接口;保留用于查询身份映射的 tenantId。 */
export async function listConsoleWorkspaces(client: Client): Promise<ConsoleWorkspaceInfo[]> {
function workspaceTotalCount(value: unknown): number | undefined {
const total = typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
return typeof total === "number" && Number.isSafeInteger(total) && total >= 0 ? total : undefined;
}

function workspaceRows(value: unknown): ConsoleWorkspaceInfo[] {
return Array.isArray(value)
? value.filter((workspace) => workspace && typeof workspace === "object")
: [];
}

/** Legacy single-page read; kept as a fallback when listMyWorkSpaces is unavailable. */
async function listConsoleWorkspacesLegacy(client: Client): Promise<ConsoleWorkspaceInfo[]> {
const result = await client.console<Record<string, unknown>>(LIST_WORKSPACES_API, {});
const response = unwrapConsoleResponse(result);
const workspaces = Array.isArray(response)
const pageItems = Array.isArray(response)
? response
: response && typeof response === "object" && "data" in response
? response.data
: undefined;
return Array.isArray(workspaces)
? workspaces.filter((workspace) => workspace && typeof workspace === "object")
: [];
return workspaceRows(pageItems);
}

/** 复用 workspace list 的只读接口;按 total 翻页取全量,保留用于查询身份映射的 tenantId。 */
export async function listConsoleWorkspaces(client: Client): Promise<ConsoleWorkspaceInfo[]> {
const collected: ConsoleWorkspaceInfo[] = [];
let pageNo = 1;
for (let page = 0; page < MAX_WORKSPACE_LIST_PAGES; page++) {
const result = await client.console<Record<string, unknown>>(
LIST_MY_WORKSPACES_API,
workspaceListRequest(pageNo),
);
const response = unwrapConsoleResponse(result);
const record =
response && typeof response === "object" && !Array.isArray(response)
? (response as Record<string, unknown>)
: undefined;
if (!Array.isArray(record?.list)) {
// Unrecognized shape (e.g. an older gateway): fall back to the legacy
// single-page read rather than guessing. Server errors still propagate.
return await listConsoleWorkspacesLegacy(client);
}
const workspaces = workspaceRows(record.list);
// Keep duplicates: identity resolution must still reject ambiguous mappings.
collected.push(...workspaces);
const total = workspaceTotalCount(record.total);
// An empty page stops early even if total claims more rows.
if (workspaces.length === 0) return collected;
if (total === undefined) return await listConsoleWorkspacesLegacy(client);
if (collected.length >= total) return collected;
pageNo += 1;
}
throw new BailianError(
"Workspace list pagination did not reach total. / 工作空间列表分页未达到 total。",
ExitCode.GENERAL,
"Retry the command; use --verbose to inspect the workspace list responses.",
);
}

/** workspaceId 是资源标识,tenantId 是同一空间的 Console switchAgent;只覆盖本次请求。 */
Expand Down Expand Up @@ -116,7 +178,7 @@ export function consoleWorkspaceIdentityPreview(settings: Pick<Settings, "worksp
return settings.workspaceId
? {
workspaceIdentity: {
api: LIST_WORKSPACES_API,
api: LIST_MY_WORKSPACES_API,
workspaceId: settings.workspaceId,
switchAgentFrom: "tenantId",
},
Expand Down
9 changes: 7 additions & 2 deletions packages/commands/src/commands/workspace/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { ansi } from "bailian-cli-runtime";
import { displayWidth, padEnd } from "bailian-cli-runtime";

import {
LIST_WORKSPACES_API,
LIST_MY_WORKSPACES_API,
listConsoleWorkspaces,
workspaceListRequest,
type ConsoleWorkspaceInfo,
} from "../shared/workspace.ts";

Expand Down Expand Up @@ -73,7 +74,11 @@ export default defineCommand({
const format = settings.output;

if (settings.dryRun) {
ctx.output.result({ api: LIST_WORKSPACES_API, data: {} });
ctx.output.result({
api: LIST_MY_WORKSPACES_API,
data: workspaceListRequest(1),
pagination: "Follows total until all workspaces are collected.",
});
return;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/commands/tests/e2e/console-read.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const versionsApi = "zeldaEasy.broadscope-platform.dataset.query.m_efm";
const fileApi = "zeldaEasy.bmp.ossRpcService.download";
const instancesApi =
"zeldaEasy.broadscope-platform.modelInstance.listIndependentDeployedModel.m_efm";
const workspaceApi = "zeldaEasy.bailian-dash-workspace.space.listWorkspaces";
const workspaceApi = "zeldaEasy.bailian-dash-workspace.space.listMyWorkSpaces";
const leaves = [
{
path: "dataset version",
Expand Down
Loading
Loading