bailian-cli-core 2.7.1 → 2.8.0
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.d.mts +505 -42
- package/dist/index.mjs +104 -39
- package/package.json +17 -2
package/dist/index.d.mts
CHANGED
|
@@ -47,6 +47,14 @@ export declare class UsageError extends BailianError {
|
|
|
47
47
|
constructor(message: string, hint?: string);
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region src/errors/credential.d.ts
|
|
51
|
+
type CredentialFailure = "missing-api-key" | "missing-console-token" | "expired-console-session" | "missing-openapi-pair" | "incomplete-openapi-flag" | "incomplete-openapi-env" | "incomplete-openapi-config";
|
|
52
|
+
/** Local credential failure facts; CLI recovery instructions belong to the host. */
|
|
53
|
+
export declare class CredentialError extends BailianError {
|
|
54
|
+
readonly reason: CredentialFailure;
|
|
55
|
+
constructor(reason: CredentialFailure, message: string, hint?: string, options?: BailianErrorOptions);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
50
58
|
//#region src/errors/api.d.ts
|
|
51
59
|
interface ApiErrorBody {
|
|
52
60
|
error?: {
|
|
@@ -1342,6 +1350,11 @@ export declare function parseConfigFile(raw: unknown): ConfigFile;
|
|
|
1342
1350
|
interface Identity {
|
|
1343
1351
|
/** Product binary name, e.g. "bl", "rag". */
|
|
1344
1352
|
binName: string;
|
|
1353
|
+
/** Executable and fixed host subcommands; display text is derived from this structure. */
|
|
1354
|
+
commandInvocation?: {
|
|
1355
|
+
readonly bin: string;
|
|
1356
|
+
readonly path: readonly string[];
|
|
1357
|
+
};
|
|
1345
1358
|
version: string;
|
|
1346
1359
|
/** npm package name for self-update, e.g. "bailian-cli". */
|
|
1347
1360
|
npmPackage: string;
|
|
@@ -1481,6 +1494,8 @@ export declare function makeAuthStore(sources: ResolutionSources): AuthStore;
|
|
|
1481
1494
|
interface HttpDeps {
|
|
1482
1495
|
identity: Identity;
|
|
1483
1496
|
settings: Settings;
|
|
1497
|
+
/** Optional diagnostic sink; core never writes to terminal streams. */
|
|
1498
|
+
debug?: (diagnostic: OutputMessage) => void;
|
|
1484
1499
|
}
|
|
1485
1500
|
interface RequestOpts {
|
|
1486
1501
|
url: string;
|
|
@@ -1518,16 +1533,45 @@ export declare function signAcsRequest(cfg: AcsSignConfig): Record<string, strin
|
|
|
1518
1533
|
//#region src/client/mcp.d.ts
|
|
1519
1534
|
interface McpTool {
|
|
1520
1535
|
name: string;
|
|
1536
|
+
/** Human-readable tool title, when the server declares one. */
|
|
1537
|
+
title?: string;
|
|
1521
1538
|
description?: string;
|
|
1522
1539
|
inputSchema?: Record<string, unknown>;
|
|
1540
|
+
/** JSON Schema for the tool output, when the server declares one. */
|
|
1541
|
+
outputSchema?: Record<string, unknown>;
|
|
1542
|
+
/** Server-provided behavioral hints (readOnlyHint, destructiveHint, …). */
|
|
1543
|
+
annotations?: Record<string, unknown>;
|
|
1544
|
+
/** Reserved extension slot, carried verbatim. */
|
|
1545
|
+
_meta?: Record<string, unknown>;
|
|
1546
|
+
/** Further standard fields the SDK validation retains. */
|
|
1547
|
+
[key: string]: unknown;
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* One content block of an MCP tool result (text / image / audio / resource /
|
|
1551
|
+
* resource_link …). Mirrors the standard fields the SDK validation retains;
|
|
1552
|
+
* the index signature keeps further standard fields visible to consumers.
|
|
1553
|
+
*/
|
|
1554
|
+
interface McpToolResultContent {
|
|
1555
|
+
type: string;
|
|
1556
|
+
/** `text` content payload. */
|
|
1557
|
+
text?: string;
|
|
1558
|
+
/** base64 payload of `image` / `audio` content. */
|
|
1559
|
+
data?: string;
|
|
1560
|
+
mimeType?: string;
|
|
1561
|
+
/** `resource_link` / embedded-resource identifiers. */
|
|
1562
|
+
uri?: string;
|
|
1563
|
+
name?: string;
|
|
1564
|
+
title?: string;
|
|
1565
|
+
description?: string;
|
|
1566
|
+
/** Embedded resource payload of `resource` content. */
|
|
1567
|
+
resource?: Record<string, unknown>;
|
|
1568
|
+
annotations?: Record<string, unknown>;
|
|
1569
|
+
[key: string]: unknown;
|
|
1523
1570
|
}
|
|
1524
1571
|
interface McpToolResult {
|
|
1525
|
-
content:
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
data?: string;
|
|
1529
|
-
mimeType?: string;
|
|
1530
|
-
}>;
|
|
1572
|
+
content: McpToolResultContent[];
|
|
1573
|
+
/** Structured tool output carried alongside `content`; preserved verbatim. */
|
|
1574
|
+
structuredContent?: Record<string, unknown>;
|
|
1531
1575
|
isError?: boolean;
|
|
1532
1576
|
}
|
|
1533
1577
|
/**
|
|
@@ -1566,6 +1610,11 @@ type ConnectBailianMcpOptions = {
|
|
|
1566
1610
|
* on 405/404 fall back to classic SSE on the same URL.
|
|
1567
1611
|
*/
|
|
1568
1612
|
urlOverride?: string;
|
|
1613
|
+
/**
|
|
1614
|
+
* Overrides the `X-Dashscope-Service` attribution value on these connections
|
|
1615
|
+
* (default `bailian-cli`). AIGC "auto"-mode MCP calls pass `bailian-cli-call`.
|
|
1616
|
+
*/
|
|
1617
|
+
serviceSource?: string;
|
|
1569
1618
|
};
|
|
1570
1619
|
/**
|
|
1571
1620
|
* Connect via Streamable HTTP first; on 405 (except WebSearch), fall back to SSE.
|
|
@@ -1576,38 +1625,23 @@ export declare function connectBailianMcpWithFallback(options: ConnectBailianMcp
|
|
|
1576
1625
|
client: McpConnectedClient;
|
|
1577
1626
|
url: string;
|
|
1578
1627
|
}>;
|
|
1579
|
-
export declare class McpClient {
|
|
1580
|
-
private url;
|
|
1581
|
-
private sessionId;
|
|
1582
|
-
private nextId;
|
|
1583
|
-
private deps;
|
|
1584
|
-
private authToken;
|
|
1585
|
-
constructor(deps: HttpDeps, url: string, authToken?: string);
|
|
1586
|
-
/** Initialize the MCP session. Must be called before any other method. */
|
|
1587
|
-
initialize(): Promise<void>;
|
|
1588
|
-
listTools(): Promise<McpTool[]>;
|
|
1589
|
-
callTool(name: string, args: Record<string, unknown>): Promise<McpToolResult>;
|
|
1590
|
-
private rpc;
|
|
1591
|
-
private notify;
|
|
1592
|
-
/**
|
|
1593
|
-
* Read a JSON-RPC response by Content-Type: application/json or text/event-stream.
|
|
1594
|
-
*/
|
|
1595
|
-
private readJsonRpcResponse;
|
|
1596
|
-
private readJsonRpcFromSse;
|
|
1597
|
-
private send;
|
|
1598
|
-
}
|
|
1599
1628
|
//#endregion
|
|
1600
1629
|
//#region src/client/client.d.ts
|
|
1601
1630
|
/** Client 的结构化依赖:身份 + 有效配置 + 各域凭证(按命令的 auth 注入)。 */
|
|
1602
1631
|
interface ClientDeps {
|
|
1603
1632
|
identity: Identity;
|
|
1604
1633
|
settings: Settings;
|
|
1634
|
+
debug?: HttpDeps["debug"];
|
|
1605
1635
|
/** Model 域 base URL(凭证无关链解析,resolveModelBaseUrl;有 apiCred 时两者一致)。 */
|
|
1606
1636
|
baseUrl: string;
|
|
1607
1637
|
/** True only when the shared URL chain used its default; explicit origins win over service defaults. */
|
|
1608
1638
|
baseUrlIsDefault?: boolean;
|
|
1609
1639
|
apiCred?: ApiKeyCredential;
|
|
1610
1640
|
consoleCred?: ConsoleCredential;
|
|
1641
|
+
/** Lazily resolve AK/SK only when the Console token is missing or expired. */
|
|
1642
|
+
resolveConsoleOpenApiCredential?: () => OpenApiCredential;
|
|
1643
|
+
/** Optional host-provided recovery text; core does not construct CLI instructions. */
|
|
1644
|
+
consoleRecoveryHint?: string;
|
|
1611
1645
|
openApiCred?: OpenApiCredential;
|
|
1612
1646
|
}
|
|
1613
1647
|
/** Like {@link RequestOpts} but with a `path` (credential baseUrl prepended) or an absolute URL. */
|
|
@@ -1642,11 +1676,12 @@ interface OpenApiResponse {
|
|
|
1642
1676
|
* credential and base URL are already baked in, so commands never handle tokens
|
|
1643
1677
|
* or baseUrl. Model methods (`request`/`requestJson`/`mcp`) need an api key;
|
|
1644
1678
|
* `uploadFile` only needs one for local files, and passes URLs through without
|
|
1645
|
-
* credentials. `console`
|
|
1646
|
-
*
|
|
1679
|
+
* credentials. `console` uses a Console token, obtaining one lazily from
|
|
1680
|
+
* resolved AK/SK when needed. Concurrent calls share the exchange, not results.
|
|
1647
1681
|
*/
|
|
1648
1682
|
export declare class Client {
|
|
1649
1683
|
private readonly deps;
|
|
1684
|
+
private consoleSession;
|
|
1650
1685
|
constructor(deps: ClientDeps);
|
|
1651
1686
|
private get http();
|
|
1652
1687
|
private requireApi;
|
|
@@ -1690,13 +1725,23 @@ export declare class Client {
|
|
|
1690
1725
|
defaultBaseUrl?: () => string;
|
|
1691
1726
|
}): Promise<string>;
|
|
1692
1727
|
usesTokenPlanEndpoint(): boolean;
|
|
1728
|
+
/**
|
|
1729
|
+
* True when the effective model-domain connection is a Token Plan one: either
|
|
1730
|
+
* the token-plan endpoint or a plan key (`sk-sp-`). Both shapes are verified
|
|
1731
|
+
* unable to reach Bailian MCP (the plan gateway has no `/api/v1/mcps` route —
|
|
1732
|
+
* bare 404 — and plan keys get 401 InvalidApiKey on the standard MCP path),
|
|
1733
|
+
* so callers routing through MCP (AIGC `auto` mode) reject up front.
|
|
1734
|
+
*/
|
|
1735
|
+
usesTokenPlanConnection(): boolean;
|
|
1693
1736
|
/** Open an MCP client. Accepts a path (prepended with the model baseUrl) or an absolute URL. */
|
|
1694
|
-
mcp(pathOrUrl: string):
|
|
1737
|
+
mcp(pathOrUrl: string): McpConnectedClient;
|
|
1695
1738
|
/**
|
|
1696
1739
|
* Connect to a Bailian MCP: try Streamable HTTP, then SSE on 405 (except WebSearch).
|
|
1697
1740
|
* `urlOverride` maps to `--url`: Streamable first, then classic SSE on the same URL (405/404).
|
|
1741
|
+
* `serviceSource` overrides the `X-Dashscope-Service` attribution value (default
|
|
1742
|
+
* `bailian-cli`); AIGC "auto"-mode MCP calls pass `bailian-cli-call`.
|
|
1698
1743
|
*/
|
|
1699
|
-
connectBailianMcp(serverCode: string, urlOverride?: string): Promise<{
|
|
1744
|
+
connectBailianMcp(serverCode: string, urlOverride?: string, serviceSource?: string): Promise<{
|
|
1700
1745
|
client: McpConnectedClient;
|
|
1701
1746
|
url: string;
|
|
1702
1747
|
}>;
|
|
@@ -1951,6 +1996,7 @@ type SourceFlags = ParsedFlags<typeof GLOBAL_FLAGS & typeof MODEL_AUTH_FLAGS & t
|
|
|
1951
1996
|
/** 该命令可见的凭证域 flag 定义。 */
|
|
1952
1997
|
export declare function credentialFlagDefs(cmd: {
|
|
1953
1998
|
auth: AuthRequirement;
|
|
1999
|
+
optionalConsole?: boolean;
|
|
1954
2000
|
}): FlagsDef;
|
|
1955
2001
|
/**
|
|
1956
2002
|
* What a command's `run` receives: `client` for all network calls (its
|
|
@@ -1965,6 +2011,8 @@ interface CommandContext<F extends FlagsDef = FlagsDef, Prepared = undefined> {
|
|
|
1965
2011
|
prepared?: Prepared;
|
|
1966
2012
|
/** 静态产品身份(binName/version/npmPackage/clientName)。 */
|
|
1967
2013
|
identity: Identity;
|
|
2014
|
+
/** Unified per-invocation result and diagnostic output. */
|
|
2015
|
+
output: CommandOutput;
|
|
1968
2016
|
/**
|
|
1969
2017
|
* Locale selector for user-facing output: picks the `en-US` / `zh-CN` variant
|
|
1970
2018
|
* of a {@link LocalizedText} per the resolved language. Supplied by the runtime
|
|
@@ -2009,9 +2057,25 @@ interface CommandPreparation<Prepared> {
|
|
|
2009
2057
|
notices: readonly CommandNotice[];
|
|
2010
2058
|
}
|
|
2011
2059
|
interface Command<F extends FlagsDef = FlagsDef, Prepared = undefined> {
|
|
2060
|
+
/** Fallback when no output format is configured by flag, environment or Profile. */
|
|
2061
|
+
defaultOutput?: Settings["output"];
|
|
2062
|
+
/** Native terminal presentation when no flag, environment or Profile selects a format. */
|
|
2063
|
+
defaultInteractiveOutput?: Settings["output"];
|
|
2064
|
+
/** Existing command switches that explicitly request diagnostic output (for example --trace). */
|
|
2065
|
+
verboseFlags?: readonly (keyof F & string)[];
|
|
2066
|
+
/** Apply defaultOutput over a Profile preference; flag/env still take precedence. */
|
|
2067
|
+
defaultOutputOverridesProfile?: boolean;
|
|
2012
2068
|
description: LocalizedText;
|
|
2013
2069
|
/** Credential this command requires. See {@link AuthRequirement}. */
|
|
2014
2070
|
auth: AuthRequirement;
|
|
2071
|
+
/**
|
|
2072
|
+
* Best-effort secondary console credential for `auth: "apiKey"` commands.
|
|
2073
|
+
* When true, the runtime additionally resolves the console credential and
|
|
2074
|
+
* injects it when available; a missing/expired console session never blocks
|
|
2075
|
+
* the command. Console-domain flags become visible so the precheck target can
|
|
2076
|
+
* be selected explicitly.
|
|
2077
|
+
*/
|
|
2078
|
+
optionalConsole?: boolean;
|
|
2015
2079
|
/**
|
|
2016
2080
|
* Runtime-classified operation risk and its user-facing consequence message.
|
|
2017
2081
|
* Omit for normal commands.
|
|
@@ -2043,6 +2107,27 @@ type AnyCommand = Command<any, any>;
|
|
|
2043
2107
|
/** Identity wrapper whose only job is to infer `F` from `spec.flags`. */
|
|
2044
2108
|
export declare function defineCommand<F extends FlagsDef, Prepared = undefined>(spec: Command<F, Prepared>): Command<F, Prepared>;
|
|
2045
2109
|
//#endregion
|
|
2110
|
+
//#region src/types/output.d.ts
|
|
2111
|
+
/** Custom text presentation never replaces the primary JSON data. */
|
|
2112
|
+
interface OutputResultOptions {
|
|
2113
|
+
text?: string;
|
|
2114
|
+
}
|
|
2115
|
+
interface OutputDiagnostic {
|
|
2116
|
+
message: LocalizedText;
|
|
2117
|
+
code?: string;
|
|
2118
|
+
/** Structured diagnostic context; the runtime redacts credential keys. */
|
|
2119
|
+
details?: unknown;
|
|
2120
|
+
}
|
|
2121
|
+
type OutputMessage = LocalizedText | OutputDiagnostic;
|
|
2122
|
+
/** Per-invocation output surface. Throw terminal failures instead of printing them. */
|
|
2123
|
+
interface CommandOutput {
|
|
2124
|
+
result(data: unknown, options?: OutputResultOptions): void;
|
|
2125
|
+
progress(message: LocalizedText): void;
|
|
2126
|
+
info(message: LocalizedText): void;
|
|
2127
|
+
warning(warning: OutputMessage): void;
|
|
2128
|
+
debug(details: OutputMessage): void;
|
|
2129
|
+
}
|
|
2130
|
+
//#endregion
|
|
2046
2131
|
//#region src/config/loader.d.ts
|
|
2047
2132
|
/**
|
|
2048
2133
|
* 校验并规范化 `--config <name>`:`undefined`/""/"default" 都视为未指定(等价顶层默认配置)。
|
|
@@ -2098,7 +2183,11 @@ interface ApiKeyResolutionSourceSelection {
|
|
|
2098
2183
|
* environment API connection override bypasses it entirely.
|
|
2099
2184
|
*/
|
|
2100
2185
|
export declare function selectApiKeyResolutionSources(sources: ResolutionSources, capability: string): ApiKeyResolutionSourceSelection;
|
|
2101
|
-
export declare function buildSources(flags: Partial<SourceFlags
|
|
2186
|
+
export declare function buildSources(flags: Partial<SourceFlags>, onWarning?: (warning: OutputDiagnostic) => void): ResolutionSources;
|
|
2187
|
+
/** Presentation-only resolution, also safe before config loading or unrelated validation. */
|
|
2188
|
+
export declare function buildOutputSettings({ flags, env, file }: Pick<ResolutionSources, "flags" | "env"> & {
|
|
2189
|
+
file?: ConfigFile;
|
|
2190
|
+
}): Pick<Settings, "output" | "outputExplicit" | "outputSource" | "quiet" | "verbose">;
|
|
2102
2191
|
/**
|
|
2103
2192
|
* 纯解析 sources → Settings(命令唯一会读的配置面)。不含身份、baseUrl、鉴权。
|
|
2104
2193
|
* 各字段链序 flag > env > file > 默认;锁定表 tests/config-priority.test.ts。
|
|
@@ -2131,7 +2220,7 @@ export declare function resolveModelBaseUrl(s: ResolutionSources, fallback?: str
|
|
|
2131
2220
|
export declare function resolveApiKey(s: ResolutionSources): ApiKeyCredential;
|
|
2132
2221
|
/** Console-domain credential from sources — access token + 连接目标(flag > file > 默认)。 */
|
|
2133
2222
|
export declare function resolveConsole(s: ResolutionSources): ConsoleCredential;
|
|
2134
|
-
/**
|
|
2223
|
+
/** AK/SK priority: flags > Bailian env > selected config > Alibaba Cloud env. */
|
|
2135
2224
|
export declare function resolveOpenApi(s: ResolutionSources): OpenApiCredential;
|
|
2136
2225
|
/** Full auth snapshot from sources — what would resolve per domain (or undefined). */
|
|
2137
2226
|
export declare function describeAuthState(s: ResolutionSources): AuthState;
|
|
@@ -2158,7 +2247,9 @@ type ConsoleCall = (api: string, data: Record<string, unknown>) => Promise<unkno
|
|
|
2158
2247
|
* Build an anonymous (token-less) gateway caller for public catalog APIs such
|
|
2159
2248
|
* as `listFoundationModels` — no console login required.
|
|
2160
2249
|
*/
|
|
2161
|
-
export declare function anonymousConsoleCall(config: Pick<Settings, "consoleRegion" | "consoleSite" | "consoleSwitchAgent" | "timeout">
|
|
2250
|
+
export declare function anonymousConsoleCall(config: Pick<Settings, "consoleRegion" | "consoleSite" | "consoleSwitchAgent" | "timeout">, options?: Pick<HttpDeps, "debug"> & {
|
|
2251
|
+
recoveryHint?: string;
|
|
2252
|
+
}): ConsoleCall;
|
|
2162
2253
|
/**
|
|
2163
2254
|
* Invoke a Bailian **console** OpenAPI via the CLI gateway (`/cli/api.json`).
|
|
2164
2255
|
* 目标(region/site/switchAgent)与 token 均由调用方解析后传入:Client.console 传
|
|
@@ -2170,16 +2261,19 @@ interface ConsoleGatewayTarget {
|
|
|
2170
2261
|
switchAgent?: number;
|
|
2171
2262
|
token?: string;
|
|
2172
2263
|
}
|
|
2173
|
-
export declare function callConsoleGateway(target: ConsoleGatewayTarget, timeoutSec: number, { api, data }: ConsoleGatewayRequest,
|
|
2264
|
+
export declare function callConsoleGateway(target: ConsoleGatewayTarget, timeoutSec: number, { api, data }: ConsoleGatewayRequest, options?: Pick<HttpDeps, "debug"> & {
|
|
2265
|
+
recoveryHint?: string;
|
|
2266
|
+
}): Promise<unknown>;
|
|
2174
2267
|
//#endregion
|
|
2175
2268
|
//#region src/auth/refresh-token.d.ts
|
|
2176
2269
|
/** Console 目标优先;仅在地域缺省时从已知模型域名推导,不猜测未知站点。 */
|
|
2177
2270
|
export declare function resolveCLIAccessTokenTarget(settings: Pick<Settings, "consoleRegion" | "consoleSite" | "consoleSwitchAgent">, baseUrl: string): Omit<ConsoleGatewayTarget, "token">;
|
|
2178
2271
|
/** 首次登录只读验证;直接调用网关,避免错误触发递归刷新。 */
|
|
2179
|
-
export declare function validateConsoleAccessToken(target: ConsoleGatewayTarget, settings: Settings): Promise<void>;
|
|
2272
|
+
export declare function validateConsoleAccessToken(target: ConsoleGatewayTarget, settings: Settings, diagnostics?: Pick<HttpDeps, "debug">): Promise<void>;
|
|
2180
2273
|
export declare function generateCLIAccessToken(opts: {
|
|
2181
2274
|
identity: Identity;
|
|
2182
2275
|
settings: Settings;
|
|
2276
|
+
debug?: HttpDeps["debug"];
|
|
2183
2277
|
baseUrl: string;
|
|
2184
2278
|
accessKeyId: string;
|
|
2185
2279
|
accessKeySecret: string;
|
|
@@ -2189,15 +2283,20 @@ export declare function generateCLIAccessToken(opts: {
|
|
|
2189
2283
|
Success?: boolean;
|
|
2190
2284
|
}>;
|
|
2191
2285
|
/**
|
|
2192
|
-
*
|
|
2286
|
+
* Obtain a Console token using resolved AK/SK, or selected-config AK/SK for legacy callers.
|
|
2193
2287
|
* Returns the new token on success, or null if AK/SK are not available.
|
|
2194
2288
|
*/
|
|
2195
2289
|
export declare function refreshAccessToken(opts: {
|
|
2196
2290
|
identity: Identity;
|
|
2197
2291
|
settings: Settings;
|
|
2292
|
+
debug?: HttpDeps["debug"];
|
|
2198
2293
|
baseUrl: string;
|
|
2199
2294
|
/** 重试原请求作为验证;独立调用时默认通过只读 loginInfo 校验。 */
|
|
2200
2295
|
validateToken?: (token: string) => Promise<void>;
|
|
2296
|
+
/** Already selected by the shared credential chain; legacy callers use the selected config. */
|
|
2297
|
+
credential?: OpenApiCredential;
|
|
2298
|
+
/** Defaults to persistence only for local config credentials; temporary credentials stay in memory. */
|
|
2299
|
+
persist?: boolean;
|
|
2201
2300
|
}): Promise<string | null>;
|
|
2202
2301
|
//#endregion
|
|
2203
2302
|
//#region src/client/endpoints.d.ts
|
|
@@ -2471,14 +2570,25 @@ export declare function collectAsrTranscriptionItems(output: {
|
|
|
2471
2570
|
//#endregion
|
|
2472
2571
|
//#region src/client/headers.d.ts
|
|
2473
2572
|
export declare const CHANNEL = "bailian-cli";
|
|
2573
|
+
/**
|
|
2574
|
+
* `X-Dashscope-Service` attribution value for AIGC "auto"-mode MCP tool calls,
|
|
2575
|
+
* letting the gateway separate CLI-originated MCP generation traffic from the
|
|
2576
|
+
* default {@link CHANNEL}. Only the AIGC auto path opts in; every other request
|
|
2577
|
+
* (REST, upload, other MCP commands) keeps {@link CHANNEL}.
|
|
2578
|
+
*/
|
|
2579
|
+
export declare const MCP_CALL_SERVICE = "bailian-cli-call";
|
|
2474
2580
|
/** Static source identifier advertised to the DashScope/Bailian OpenAPI gateway. */
|
|
2475
2581
|
export declare const OPEN_API_SOURCE = "BailianCLI";
|
|
2476
2582
|
/** Marketplace / service attribution header (HTTP names are case-insensitive). */
|
|
2477
2583
|
export declare const DASHSCOPE_SERVICE_HEADER = "X-Dashscope-Service";
|
|
2478
2584
|
type TrackingIdentity = Pick<Identity, "binName" | "version">;
|
|
2479
2585
|
export declare function sourceConfig(identity: TrackingIdentity): string;
|
|
2480
|
-
/**
|
|
2481
|
-
|
|
2586
|
+
/**
|
|
2587
|
+
* Tracking headers for Bailian/DashScope API requests. `service` overrides the
|
|
2588
|
+
* `X-Dashscope-Service` attribution value (default {@link CHANNEL}); AIGC
|
|
2589
|
+
* "auto"-mode MCP calls pass {@link MCP_CALL_SERVICE}.
|
|
2590
|
+
*/
|
|
2591
|
+
export declare function trackingHeaders(identity: TrackingIdentity, service?: string): Record<string, string>;
|
|
2482
2592
|
//#endregion
|
|
2483
2593
|
//#region src/client/security.d.ts
|
|
2484
2594
|
/**
|
|
@@ -2542,6 +2652,7 @@ interface BailianControlAuth {
|
|
|
2542
2652
|
accessKeyId: string;
|
|
2543
2653
|
accessKeySecret: string;
|
|
2544
2654
|
securityToken?: string;
|
|
2655
|
+
debug?: HttpDeps["debug"];
|
|
2545
2656
|
}
|
|
2546
2657
|
interface CreateUserReqDTO {
|
|
2547
2658
|
outerKey: string;
|
|
@@ -2568,6 +2679,155 @@ export declare function resetBailianControlPolicies4Agent(opts: BailianControlAu
|
|
|
2568
2679
|
policyIndexList?: number[];
|
|
2569
2680
|
}): Promise<OpenApiResponse>;
|
|
2570
2681
|
//#endregion
|
|
2682
|
+
//#region src/client/mcp-sdk.d.ts
|
|
2683
|
+
/**
|
|
2684
|
+
* Low-level Streamable HTTP MCP client keeping the constructor and method
|
|
2685
|
+
* signatures published by earlier `bailian-cli-core` versions; delegates to
|
|
2686
|
+
* {@link SdkMcpAdapter}. It drives a single transport at a caller-supplied URL
|
|
2687
|
+
* and token — for the orchestrated entry (URL/credential resolution,
|
|
2688
|
+
* Streamable→SSE fallback, channel attribution) use `Client.connectBailianMcp`
|
|
2689
|
+
* / `connectBailianMcpWithFallback`.
|
|
2690
|
+
*/
|
|
2691
|
+
export declare class McpClient implements McpConnectedClient {
|
|
2692
|
+
private readonly adapter;
|
|
2693
|
+
constructor(deps: HttpDeps, url: string, authToken?: string);
|
|
2694
|
+
/** Initialize the MCP session. Must be called before any other method. */
|
|
2695
|
+
initialize(): Promise<void>;
|
|
2696
|
+
listTools(): Promise<McpTool[]>;
|
|
2697
|
+
callTool(name: string, args: Record<string, unknown>): Promise<McpToolResult>;
|
|
2698
|
+
close(): void;
|
|
2699
|
+
}
|
|
2700
|
+
//#endregion
|
|
2701
|
+
//#region src/client/aigc-mcp.d.ts
|
|
2702
|
+
/** Bailian AIGC MCP server codes, keyed by modality. */
|
|
2703
|
+
export declare const AIGC_MCP_SERVER: {
|
|
2704
|
+
readonly image: "TextGenerateImage";
|
|
2705
|
+
readonly video: "VideoGenerate";
|
|
2706
|
+
readonly speech: "TextGenerateSpeech";
|
|
2707
|
+
readonly asr: "SpeechGenerateText";
|
|
2708
|
+
};
|
|
2709
|
+
/** Bailian AIGC MCP tool names. Only the tools listed in the switch-interface
|
|
2710
|
+
* requirements doc are mapped here (no `bailian_image_fusion`, no multichannel
|
|
2711
|
+
* ASR): multi-image edit and other out-of-scope usages are rejected by the gate. */
|
|
2712
|
+
export declare const AIGC_MCP_TOOL: {
|
|
2713
|
+
readonly imageGen: "bailian_image_gen";
|
|
2714
|
+
readonly imageEdit: "bailian_image_edit";
|
|
2715
|
+
readonly textToVideoSubmit: "bailian_text_to_video_submit_task";
|
|
2716
|
+
readonly imageToVideoSubmit: "bailian_image_to_video_submit_task";
|
|
2717
|
+
readonly videoFetchResult: "bailian_text_to_video_fetch_result";
|
|
2718
|
+
readonly tts: "bailian_tts";
|
|
2719
|
+
readonly speechToText: "bailian_speech_to_text";
|
|
2720
|
+
};
|
|
2721
|
+
/**
|
|
2722
|
+
* Extract and JSON-parse the inner payload carried by an AIGC MCP tool result.
|
|
2723
|
+
*
|
|
2724
|
+
* A tool-level `isError` is a server-side failure: its text is passed through
|
|
2725
|
+
* verbatim (AGENTS.md §3 — the CLI does not translate server errors). A missing
|
|
2726
|
+
* or non-object payload is an unexpected shape and fails as GENERAL.
|
|
2727
|
+
*/
|
|
2728
|
+
export declare function parseAigcToolResult(result: McpToolResult): Record<string, unknown>;
|
|
2729
|
+
/** Input for `bailian_image_gen`. */
|
|
2730
|
+
interface AigcImageGenInput {
|
|
2731
|
+
prompt: string;
|
|
2732
|
+
size?: string;
|
|
2733
|
+
n?: number;
|
|
2734
|
+
negativePrompt?: string;
|
|
2735
|
+
promptExtend?: boolean;
|
|
2736
|
+
}
|
|
2737
|
+
/** Build `bailian_image_gen` arguments, omitting undefined optional params. */
|
|
2738
|
+
export declare function buildImageGenArgs(input: AigcImageGenInput): Record<string, unknown>;
|
|
2739
|
+
/** Input for `bailian_image_edit` (single source image only). */
|
|
2740
|
+
interface AigcImageEditInput {
|
|
2741
|
+
/** Public http(s) URL or inline base64 data URI; resolved by the command layer. */
|
|
2742
|
+
imageUrl: string;
|
|
2743
|
+
prompt: string;
|
|
2744
|
+
negativePrompt?: string;
|
|
2745
|
+
}
|
|
2746
|
+
/** Build `bailian_image_edit` arguments. */
|
|
2747
|
+
export declare function buildImageEditArgs(input: AigcImageEditInput): Record<string, unknown>;
|
|
2748
|
+
/** Input for the video submit tools (`bailian_text_to_video_submit_task` /
|
|
2749
|
+
* `bailian_image_to_video_submit_task`). */
|
|
2750
|
+
interface AigcVideoSubmitInput {
|
|
2751
|
+
prompt?: string;
|
|
2752
|
+
duration?: number;
|
|
2753
|
+
resolution?: string;
|
|
2754
|
+
/** Aspect ratio; text-to-video only. */
|
|
2755
|
+
ratio?: string;
|
|
2756
|
+
/** First-frame public URL or data URI; image-to-video only. */
|
|
2757
|
+
firstFrameUrl?: string;
|
|
2758
|
+
}
|
|
2759
|
+
/** Build `bailian_text_to_video_submit_task` arguments (text-to-video). */
|
|
2760
|
+
export declare function buildTextToVideoArgs(input: AigcVideoSubmitInput): Record<string, unknown>;
|
|
2761
|
+
/** Build `bailian_image_to_video_submit_task` arguments (image-to-video). */
|
|
2762
|
+
export declare function buildImageToVideoArgs(input: AigcVideoSubmitInput): Record<string, unknown>;
|
|
2763
|
+
/** Build `bailian_text_to_video_fetch_result` arguments. */
|
|
2764
|
+
export declare function buildVideoFetchArgs(taskId: string): Record<string, unknown>;
|
|
2765
|
+
/** Input for `bailian_tts`. */
|
|
2766
|
+
interface AigcTtsInput {
|
|
2767
|
+
text: string;
|
|
2768
|
+
/** Passed through verbatim; the MCP server validates the voice enum. */
|
|
2769
|
+
voice?: string;
|
|
2770
|
+
}
|
|
2771
|
+
/** Build `bailian_tts` arguments. */
|
|
2772
|
+
export declare function buildTtsArgs(input: AigcTtsInput): Record<string, unknown>;
|
|
2773
|
+
/** Build `bailian_speech_to_text` arguments (synchronous). */
|
|
2774
|
+
export declare function buildSpeechToTextArgs(fileUrls: string[]): Record<string, unknown>;
|
|
2775
|
+
/**
|
|
2776
|
+
* Aspect-ratio → pixel table for `bailian_image_gen`. The MCP tool only accepts
|
|
2777
|
+
* "width*height" strings (live inputSchema: 格式为宽*高, default 1328*1328), so
|
|
2778
|
+
* CLI ratios map onto the server's qwen-image preset resolutions; pixel input
|
|
2779
|
+
* passes through and anything else is rejected by the command layer before the
|
|
2780
|
+
* request goes out.
|
|
2781
|
+
*/
|
|
2782
|
+
export declare const MCP_IMAGE_GEN_RATIO_SIZES: Readonly<Record<string, string>>;
|
|
2783
|
+
/**
|
|
2784
|
+
* Resolve an `auto`-mode `--size` value for `bailian_image_gen`: pixel input
|
|
2785
|
+
* (`W*H`, with `x` normalized to `*`) passes through, ratios map via
|
|
2786
|
+
* {@link MCP_IMAGE_GEN_RATIO_SIZES}. Returns `undefined` for values MCP cannot
|
|
2787
|
+
* accept so the command layer can reject them up front.
|
|
2788
|
+
*/
|
|
2789
|
+
export declare function resolveMcpImageSize(size: string): string | undefined;
|
|
2790
|
+
/** `bailian_tts` voice enum, verbatim from the live tool inputSchema. */
|
|
2791
|
+
export declare const MCP_TTS_VOICES: readonly string[];
|
|
2792
|
+
/** True when `voice` is one of the MCP TTS enum values (REST voice IDs are not). */
|
|
2793
|
+
export declare function isMcpTtsVoice(voice: string): boolean;
|
|
2794
|
+
/**
|
|
2795
|
+
* Parse image generate/edit results into a URL list. The MCP shape is
|
|
2796
|
+
* `{ request_id, results: ["<signed url>", …] }` (bare strings, unlike REST's
|
|
2797
|
+
* `[{ url }]`); object entries are tolerated defensively. An empty list is
|
|
2798
|
+
* returned as-is so the caller can raise its own command-specific message.
|
|
2799
|
+
*/
|
|
2800
|
+
export declare function parseAigcImageResults(inner: Record<string, unknown>): string[];
|
|
2801
|
+
/** Parsed `bailian_tts` result. */
|
|
2802
|
+
interface AigcTtsResult {
|
|
2803
|
+
audioUrl: string;
|
|
2804
|
+
requestId?: string;
|
|
2805
|
+
}
|
|
2806
|
+
/** Parse the TTS result `{ result: "<wav url>", request_id }`. */
|
|
2807
|
+
export declare function parseAigcTtsResult(inner: Record<string, unknown>): AigcTtsResult;
|
|
2808
|
+
/** Parse a video submit result `{ task_id }` into the task id. */
|
|
2809
|
+
export declare function parseAigcVideoTaskId(inner: Record<string, unknown>): string;
|
|
2810
|
+
/** Parsed `bailian_text_to_video_fetch_result` result. */
|
|
2811
|
+
interface AigcVideoTaskResult {
|
|
2812
|
+
/** RUNNING / SUCCEEDED / FAILED / UNKNOWN (server-provided). */
|
|
2813
|
+
taskStatus: string;
|
|
2814
|
+
videoUrl?: string;
|
|
2815
|
+
taskId?: string;
|
|
2816
|
+
/** Server-provided failure reason, verbatim (present on FAILED tasks). */
|
|
2817
|
+
message?: string;
|
|
2818
|
+
/** Server-provided failure code, verbatim. */
|
|
2819
|
+
code?: string;
|
|
2820
|
+
}
|
|
2821
|
+
/** Parse the video fetch result `{ task_status, video_url, task_id }`, keeping
|
|
2822
|
+
* the server's failure reason (`message` / `code`) verbatim when present. */
|
|
2823
|
+
export declare function parseAigcVideoTaskResult(inner: Record<string, unknown>): AigcVideoTaskResult;
|
|
2824
|
+
/**
|
|
2825
|
+
* Parse ASR results `{ request_id, results: ["<text>", …] }` into transcription
|
|
2826
|
+
* text lines. `auto` mode intentionally returns this simplified text (the MCP
|
|
2827
|
+
* tool exposes none of REST's sentence/speaker/timestamp structure).
|
|
2828
|
+
*/
|
|
2829
|
+
export declare function parseAigcAsrTexts(inner: Record<string, unknown>): string[];
|
|
2830
|
+
//#endregion
|
|
2571
2831
|
//#region src/client/stream.d.ts
|
|
2572
2832
|
interface ServerSentEvent {
|
|
2573
2833
|
event?: string;
|
|
@@ -2752,6 +3012,27 @@ export declare function formatErrorJson(code: number, message: string, hint?: st
|
|
|
2752
3012
|
//#region src/output/text.d.ts
|
|
2753
3013
|
export declare function formatText(data: unknown): string;
|
|
2754
3014
|
//#endregion
|
|
3015
|
+
//#region src/output/diagnostics.d.ts
|
|
3016
|
+
/** Convert diagnostics to inert data; never invoke accessors or serialization hooks. */
|
|
3017
|
+
export declare function sanitizeDiagnosticDetails(value: unknown, ancestors?: Set<object>, depth?: number): unknown;
|
|
3018
|
+
//#endregion
|
|
3019
|
+
//#region src/output/command.d.ts
|
|
3020
|
+
type Invocation = Pick<Identity, "binName" | "commandInvocation"> | string;
|
|
3021
|
+
type CommandFormatter = (arguments_?: string) => string;
|
|
3022
|
+
interface ExecutableCommand {
|
|
3023
|
+
bin: string;
|
|
3024
|
+
path: string[];
|
|
3025
|
+
args: string[];
|
|
3026
|
+
}
|
|
3027
|
+
/** Build argv for shell:false consumers; never interpret a human-facing prefix. */
|
|
3028
|
+
export declare function buildCommandInvocation(identity: Pick<Identity, "binName" | "commandInvocation">, path?: readonly string[], args?: readonly string[]): ExecutableCommand;
|
|
3029
|
+
/** Format a complete instruction at the point where the invocation is known. */
|
|
3030
|
+
export declare function formatCommand(invocation: Invocation, arguments_?: string): string;
|
|
3031
|
+
/** Reference used only in fixed CLI metadata, before the invocation is known. */
|
|
3032
|
+
export declare function commandRef(arguments_?: string): string;
|
|
3033
|
+
/** Resolve fixed help/reference templates; never pass service or user-generated text. */
|
|
3034
|
+
export declare function renderCommandText(text: string, invocation: Invocation): string;
|
|
3035
|
+
//#endregion
|
|
2755
3036
|
//#region src/files/upload.d.ts
|
|
2756
3037
|
interface UploadOptions {
|
|
2757
3038
|
apiKey: string;
|
|
@@ -2765,6 +3046,8 @@ interface UploadOptions {
|
|
|
2765
3046
|
}
|
|
2766
3047
|
/** Encode a local image as a Data URI. */
|
|
2767
3048
|
export declare function imageFileToDataUri(filePath: string): string;
|
|
3049
|
+
/** Encode a local audio file as a Data URI (used by ASR `auto`/MCP input). */
|
|
3050
|
+
export declare function audioFileToDataUri(filePath: string): string;
|
|
2768
3051
|
/** Keep dry-run output readable and avoid echoing the complete inline image. */
|
|
2769
3052
|
export declare function redactDataUri(input: string): string;
|
|
2770
3053
|
/**
|
|
@@ -3931,7 +4214,7 @@ export declare function listSupportedTrainingTypes(model: ModelCapability | unde
|
|
|
3931
4214
|
* server's `name` filter is a substring match, so we additionally require an
|
|
3932
4215
|
* exact `model` equality to avoid e.g. `qwen3-8b` matching `qwen3-8b-v2`).
|
|
3933
4216
|
*/
|
|
3934
|
-
export declare function fetchModelCapability(settings: Settings, modelName: string): Promise<ModelCapability | null>;
|
|
4217
|
+
export declare function fetchModelCapability(settings: Settings, modelName: string, diagnostics?: Pick<HttpDeps, "debug">): Promise<ModelCapability | null>;
|
|
3935
4218
|
//#endregion
|
|
3936
4219
|
//#region src/finetune/preflight.d.ts
|
|
3937
4220
|
/** Stable issue code for "too few training samples for the batch size". */
|
|
@@ -4567,7 +4850,8 @@ export interface PlanContext {
|
|
|
4567
4850
|
/** True in --dry-run: strategies must skip side-effecting catalog lookups. */
|
|
4568
4851
|
dryRun: boolean;
|
|
4569
4852
|
/** CLI bin name, for usage hints in error messages. */
|
|
4570
|
-
|
|
4853
|
+
/** Optional recovery text supplied by the calling product. */
|
|
4854
|
+
modelUnavailableHint?: string;
|
|
4571
4855
|
flags: CreatePlanFlags;
|
|
4572
4856
|
/** Underlying model identifier (`--model`). */
|
|
4573
4857
|
model: string;
|
|
@@ -4632,6 +4916,145 @@ export declare function listIndependentDeployedModels(client: Client): Promise<M
|
|
|
4632
4916
|
*/
|
|
4633
4917
|
export declare function findDeploymentEntry(entries: ModelServiceEntry[], deployedModel: string): ModelServiceEntry | undefined;
|
|
4634
4918
|
//#endregion
|
|
4919
|
+
//#region src/model-import/types.d.ts
|
|
4920
|
+
/**
|
|
4921
|
+
* Custom model import API types.
|
|
4922
|
+
*
|
|
4923
|
+
* Maps DashScope `/api/v1/custom_models/import` request/response shapes
|
|
4924
|
+
* (snake_case preserved verbatim — callers decide how to surface fields).
|
|
4925
|
+
*/
|
|
4926
|
+
/** OSS storage location of the model files to import. */
|
|
4927
|
+
export interface CustomModelImportStorageInfo {
|
|
4928
|
+
bucket_name: string;
|
|
4929
|
+
/** Directory prefix; must end with `/` and cannot be the bucket root. */
|
|
4930
|
+
object_key: string;
|
|
4931
|
+
}
|
|
4932
|
+
/** POST /api/v1/custom_models/import request body. */
|
|
4933
|
+
export interface CreateCustomModelImportRequest {
|
|
4934
|
+
/** Base model ID (e.g. `qwen3-32b`). */
|
|
4935
|
+
model_name: string;
|
|
4936
|
+
/** Display name; server defaults to the base model name when omitted. */
|
|
4937
|
+
display_name?: string;
|
|
4938
|
+
/** Import source. Only `oss` is currently supported. */
|
|
4939
|
+
source: string;
|
|
4940
|
+
/** `lora` (LoRA-tuned) or `full` (fully-tuned). */
|
|
4941
|
+
weight_type: string;
|
|
4942
|
+
storage_info: CustomModelImportStorageInfo;
|
|
4943
|
+
}
|
|
4944
|
+
/** A custom model import job as returned by the platform. */
|
|
4945
|
+
export interface CustomModelImportJob {
|
|
4946
|
+
job_id?: string;
|
|
4947
|
+
/** Server-generated model identifier (base model name + timestamp suffix). */
|
|
4948
|
+
model_name?: string;
|
|
4949
|
+
display_name?: string;
|
|
4950
|
+
/** Uppercase `OSS` in responses. */
|
|
4951
|
+
source?: string;
|
|
4952
|
+
/** Present on create; omitted by get/list. */
|
|
4953
|
+
weight_type?: string;
|
|
4954
|
+
storage_info?: CustomModelImportStorageInfo;
|
|
4955
|
+
/** PENDING | RUNNING | SUCCESSED | FAILED (server values verbatim). */
|
|
4956
|
+
status?: string;
|
|
4957
|
+
/** Present when status is FAILED; server-provided reason text. */
|
|
4958
|
+
error_code?: string;
|
|
4959
|
+
gmt_create?: string;
|
|
4960
|
+
[key: string]: unknown;
|
|
4961
|
+
}
|
|
4962
|
+
export interface CreateCustomModelImportResponse {
|
|
4963
|
+
request_id?: string;
|
|
4964
|
+
output?: CustomModelImportJob;
|
|
4965
|
+
data?: CustomModelImportJob;
|
|
4966
|
+
}
|
|
4967
|
+
export interface GetCustomModelImportResponse {
|
|
4968
|
+
request_id?: string;
|
|
4969
|
+
output?: CustomModelImportJob;
|
|
4970
|
+
data?: CustomModelImportJob;
|
|
4971
|
+
}
|
|
4972
|
+
export interface DeleteCustomModelImportResponse {
|
|
4973
|
+
request_id?: string;
|
|
4974
|
+
output?: CustomModelImportJob;
|
|
4975
|
+
data?: CustomModelImportJob;
|
|
4976
|
+
}
|
|
4977
|
+
export interface ListCustomModelImportsResponse {
|
|
4978
|
+
request_id?: string;
|
|
4979
|
+
output?: {
|
|
4980
|
+
total?: number;
|
|
4981
|
+
page_no?: number;
|
|
4982
|
+
page_size?: number;
|
|
4983
|
+
list?: CustomModelImportJob[];
|
|
4984
|
+
[key: string]: unknown;
|
|
4985
|
+
};
|
|
4986
|
+
data?: {
|
|
4987
|
+
total?: number;
|
|
4988
|
+
page_no?: number;
|
|
4989
|
+
page_size?: number;
|
|
4990
|
+
list?: CustomModelImportJob[];
|
|
4991
|
+
[key: string]: unknown;
|
|
4992
|
+
};
|
|
4993
|
+
}
|
|
4994
|
+
/** Entry returned by the console `listSupportImportModels` catalog API. */
|
|
4995
|
+
export interface SupportImportModel {
|
|
4996
|
+
/** Display name (e.g. `Qwen3-32B`); may be absent. */
|
|
4997
|
+
name?: string;
|
|
4998
|
+
/** Model ID used to match `--base-model` (e.g. `qwen3-32b`). */
|
|
4999
|
+
model?: string;
|
|
5000
|
+
/** Training methods supported for import (e.g. `sft`, `efficient_sft`). */
|
|
5001
|
+
supportTrainTypes?: string[];
|
|
5002
|
+
postProcessCapabilities?: {
|
|
5003
|
+
quantizationSupported?: boolean;
|
|
5004
|
+
mtpSupported?: boolean;
|
|
5005
|
+
quantizationStrategyCodes?: string[];
|
|
5006
|
+
[key: string]: unknown;
|
|
5007
|
+
};
|
|
5008
|
+
[key: string]: unknown;
|
|
5009
|
+
}
|
|
5010
|
+
/** Parsed `listSupportImportModels` catalog result. */
|
|
5011
|
+
export interface SupportImportModelsResult {
|
|
5012
|
+
total?: number;
|
|
5013
|
+
pageNo?: number;
|
|
5014
|
+
pageSize?: number;
|
|
5015
|
+
list: SupportImportModel[];
|
|
5016
|
+
}
|
|
5017
|
+
//#endregion
|
|
5018
|
+
//#region src/model-import/api.d.ts
|
|
5019
|
+
/** POST /api/v1/custom_models/import */
|
|
5020
|
+
export declare function createCustomModelImport(client: Client, body: CreateCustomModelImportRequest, signal?: AbortSignal): Promise<CreateCustomModelImportResponse>;
|
|
5021
|
+
export interface ListCustomModelImportsParams {
|
|
5022
|
+
pageNo?: number;
|
|
5023
|
+
pageSize?: number;
|
|
5024
|
+
status?: string;
|
|
5025
|
+
/** Exact match against the server-generated `model_name`. */
|
|
5026
|
+
modelName?: string;
|
|
5027
|
+
signal?: AbortSignal;
|
|
5028
|
+
}
|
|
5029
|
+
/** GET /api/v1/custom_models/import */
|
|
5030
|
+
export declare function listCustomModelImports(client: Client, params?: ListCustomModelImportsParams): Promise<ListCustomModelImportsResponse>;
|
|
5031
|
+
/** GET /api/v1/custom_models/import/{job_id} */
|
|
5032
|
+
export declare function getCustomModelImport(client: Client, jobId: string, signal?: AbortSignal): Promise<GetCustomModelImportResponse>;
|
|
5033
|
+
/** DELETE /api/v1/custom_models/import/{job_id} */
|
|
5034
|
+
export declare function deleteCustomModelImport(client: Client, jobId: string, signal?: AbortSignal): Promise<DeleteCustomModelImportResponse>;
|
|
5035
|
+
//#endregion
|
|
5036
|
+
//#region src/model-import/console.d.ts
|
|
5037
|
+
export declare const LIST_SUPPORT_IMPORT_MODELS_API = "zeldaEasy.broadscope-platform.customModel.listSupportImportModels";
|
|
5038
|
+
/**
|
|
5039
|
+
* List base models that currently support custom-model import.
|
|
5040
|
+
*
|
|
5041
|
+
* Requires a console credential (`client.console` throws AUTH without one);
|
|
5042
|
+
* callers that treat this as an optional precheck must catch that error.
|
|
5043
|
+
*/
|
|
5044
|
+
export declare function listSupportImportModels(client: Client): Promise<SupportImportModelsResult>;
|
|
5045
|
+
/** Exact (case-insensitive) match on the catalog `model` ID. */
|
|
5046
|
+
export declare function findSupportImportModel(models: readonly SupportImportModel[], baseModel: string): SupportImportModel | undefined;
|
|
5047
|
+
/**
|
|
5048
|
+
* Console train type required by an import weight type.
|
|
5049
|
+
*
|
|
5050
|
+
* The catalog's `supportTrainTypes` uses the fine-tune vocabulary: `sft`
|
|
5051
|
+
* (full-parameter) and `efficient_sft` (LoRA). Mapping the import
|
|
5052
|
+
* `weight_type` onto that vocabulary lets callers reject unsupported
|
|
5053
|
+
* combinations before the service answers with its opaque
|
|
5054
|
+
* "No import access for base model" error.
|
|
5055
|
+
*/
|
|
5056
|
+
export declare function requiredTrainTypeForWeightType(weightType: string): "sft" | "efficient_sft";
|
|
5057
|
+
//#endregion
|
|
4635
5058
|
//#region src/speech/vocabulary.d.ts
|
|
4636
5059
|
/** Fixed model id for the hot-word customization endpoint. */
|
|
4637
5060
|
export declare const SPEECH_BIASING_MODEL = "speech-biasing";
|
|
@@ -5189,6 +5612,10 @@ interface RecommendDeps {
|
|
|
5189
5612
|
catalog: () => Promise<ModelProfile$1[]>;
|
|
5190
5613
|
families?: () => Promise<Map<string, FamilyProfile>>;
|
|
5191
5614
|
verbose?: boolean;
|
|
5615
|
+
/** Optional host-owned trace sink; the pure engine never writes standard streams. */
|
|
5616
|
+
onTrace?: (trace: RecommendTrace) => void;
|
|
5617
|
+
/** Optional host-owned agent diagnostic sink. */
|
|
5618
|
+
onDiagnostic?: (message: string) => void;
|
|
5192
5619
|
/** When provided, the engine appends decision-log lines here (--think). */
|
|
5193
5620
|
decisionLog?: string[];
|
|
5194
5621
|
/** When > 0, overrides the router's default slate size (`--top`). */
|
|
@@ -5232,6 +5659,40 @@ interface LLMClient {
|
|
|
5232
5659
|
chatJson<T>(messages: Message[], opts?: LLMCallOptions): Promise<T>;
|
|
5233
5660
|
chatWithTools(messages: Message[], tools: ToolDef[], opts?: LLMCallOptions): Promise<ToolResponse>;
|
|
5234
5661
|
}
|
|
5662
|
+
interface RecommendTrace {
|
|
5663
|
+
timestamp: string;
|
|
5664
|
+
input: string;
|
|
5665
|
+
routingReason?: string;
|
|
5666
|
+
matchedScenes?: string[];
|
|
5667
|
+
sceneConfidence?: number;
|
|
5668
|
+
performance: {
|
|
5669
|
+
intentMs?: number;
|
|
5670
|
+
recallMs?: number;
|
|
5671
|
+
scoreMs?: number;
|
|
5672
|
+
rankMs?: number;
|
|
5673
|
+
explainMs?: number;
|
|
5674
|
+
totalMs?: number;
|
|
5675
|
+
llmCalls: number;
|
|
5676
|
+
};
|
|
5677
|
+
/** Stage fallbacks that happened, each with its cause (formatted as "llm-generate→template-text (429 rate_limit)" in logs). */
|
|
5678
|
+
degradations: Degradation[];
|
|
5679
|
+
/** Set when the run aborted on an LLM failure (intent failure, or a fatal error in any stage). */
|
|
5680
|
+
failure?: TraceFailure;
|
|
5681
|
+
/** LLM reasoning content captured when --think is enabled. */
|
|
5682
|
+
thinking?: ThinkingEntry[];
|
|
5683
|
+
}
|
|
5684
|
+
interface ThinkingEntry {
|
|
5685
|
+
stage: string;
|
|
5686
|
+
content: string;
|
|
5687
|
+
}
|
|
5688
|
+
interface TraceFailure {
|
|
5689
|
+
stage: string;
|
|
5690
|
+
kind: string;
|
|
5691
|
+
status?: number;
|
|
5692
|
+
code?: string;
|
|
5693
|
+
requestId?: string;
|
|
5694
|
+
message: string;
|
|
5695
|
+
}
|
|
5235
5696
|
/** Structured degradation for JSON output / programmatic consumers. */
|
|
5236
5697
|
interface Degradation {
|
|
5237
5698
|
stage: string;
|
|
@@ -5364,6 +5825,8 @@ export declare const DEFAULT_LLM_MODEL = "qwen-flash-2025-07-28";
|
|
|
5364
5825
|
interface LLMClientOptions {
|
|
5365
5826
|
baseUrl: string;
|
|
5366
5827
|
apiKey: string;
|
|
5828
|
+
/** 宿主注入带渠道标识与诊断的传输;独立使用时保留原生 fetch。 */
|
|
5829
|
+
fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
5367
5830
|
/** Default model for chat/chatJson calls. */
|
|
5368
5831
|
defaultModel?: string;
|
|
5369
5832
|
timeoutMs?: number;
|
|
@@ -5387,7 +5850,7 @@ interface LLMClientOptions {
|
|
|
5387
5850
|
/**
|
|
5388
5851
|
* Self-contained OpenAI-compatible LLM client over fetch.
|
|
5389
5852
|
* Kept free of bailian-cli-core imports so the engine compiles standalone;
|
|
5390
|
-
*
|
|
5853
|
+
* 宿主通过选项注入连接凭证与传输,不改变引擎的超时、SSE 或错误语义。
|
|
5391
5854
|
*/
|
|
5392
5855
|
export declare function createLLMClient(options: LLMClientOptions): LLMClient;
|
|
5393
5856
|
//#endregion
|
|
@@ -6042,4 +6505,4 @@ export declare function installSkillWithFanout(name: string, entry: SkillIndexEn
|
|
|
6042
6505
|
export declare function listSkillDirsOnDisk(): string[];
|
|
6043
6506
|
export declare function computeSkillStatuses(index: SkillsIndex, lock: SkillLockFile, diskNames: string[]): SkillStatusRow[];
|
|
6044
6507
|
//#endregion
|
|
6045
|
-
export { type AcsQueryParams, type AcsSignConfig, type AgentResult, type AgentTarget, type AnyCommand, type ApiErrorBody, type ApiKeyCredential, type ApiKeyLoginKind, type ApiKeyResolutionSourceSelection, type AppCompletionRequest, type AppCompletionResponse, type AppStreamChunk, type AsrApiKind, type AsrApiRoute, type AsrContextMessage, type AsrFlashFamily, type AuthPersistPatch, type AuthRequirement, type AuthState, type AuthStore, type BailianControlAuth, type Budget, type BuildAsrFlashRequestOpts, type CallerAttribution, type Capability, type ChatChoice, type ChatMessage, type ChatMessageContent, type ChatRequest, type ChatResponse, type ChatResponseFormat, type ChatTool, type Clarification, type ClientOpenApiJsonOpts, type ClientOpenApiQueryOpts, type ClientRequestOpts, type Command, type CommandContext, type CommandNotice, type CommandPack, type CommandPackApiKeyContext, type CommandPackCommand, type CommandPackContext, type CommandPackCredentials, type CommandPackErrorOptions, type CommandPackErrors, type CommandPackManager, type CommandPackMeta, type CommandPackMutationResult, type CommandPackOutput, type CommandPackOutputOptions, type CommandPackReport, type CommandPreparation, type CommandRisk, type CommandRiskLevel, type Complexity, type ConfigFile, type ConfigProfiles, type ConfigStore, type ConnectBailianMcpOptions, type ConsoleCall, type ConsoleCredential, type ConsoleGatewayRequest, type ConsoleGatewayTarget, type ConsoleSite, type ContextNeed, type CreateUserReqDTO, type CredentialSource, type DashScopeASRRequest, type DashScopeASRTaskResult, type DashScopeASRTranscriptionItem, type DashScopeAsyncResponse, type DashScopeImageRequest, type DashScopeImageSyncResponse, type DashScopeTTSRequest, type DashScopeTTSResponse, type DashScopeTTSStreamChunk, type DashScopeTaskResponse, type DashScopeVideoEditRequest, type DashScopeVideoRefRequest, type DashScopeVideoRequest, type DataModality, type DatasetSchema, type Degradation, type IntentProfile as EngineIntentProfile, type RecommendResult as EngineRecommendResult, type RecommendSuccess as EngineRecommendSuccess, type RecommendSuccess, type Recommendation as EngineRecommendation, type StepRecommendation as EngineStepRecommendation, type ExecutionPlan, type FamilyProfile, type FanoutOutcome, type Feature, type FetchImplementation, type FlagDef, type FlagsDef, type HttpDeps, type Identity, type ImageApiKind, type ImageApiRoute, type ImageInputStyle, type ImageSizeProfile, type InstallMethod, type InstallMethodIdentity, type InstalledSkill, type IntentSegment, type Interaction, type KnowledgeChatContentPart, type KnowledgeChatMessage, type KnowledgeChatRequest, type KnowledgeChatStreamChunk, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type LLMClient, type LLMClientOptions, type LLMErrorKind, type LLMStage, type Language, type IntentProfile$1 as LegacyIntentProfile, type ModelProfile as LegacyModelProfile, type RecommendResult$1 as LegacyRecommendResult, type LinkResult, type LocalizedText, type McpConnectedClient, type McpTool, type McpToolResult, type MemoryAddAsyncResponse, type MemoryAddRequest, type MemoryContentPart, type MemoryEvent, type MemoryEventResourceType, type MemoryEventResponse, type MemoryEventResult, type MemoryEventStatus, type MemoryExtractScene, type MemoryMessage, type MemoryNode, type MemoryNodeDetailResponse, type MemoryNodeListResponse, type MemoryNodeUpdateRequest, type MemoryPlanVersion, type MemorySearchRequest, type MemorySearchResponse, type MemorySkillExportResponse, type MemoryToolCall, type MemoryType, type Modality, type ModelCategory, type ModelConnectionProvenance, type ModelGroup, type ModelGroupItem, type ModelGroupParams, type ModelGroupResult, type ModelListParams, type ModelListResult, type ModelOfflineInfo, type ModelOfflineNotice, type ModelPreference, type ModelPrice, type ModelPriceInfo, type ModelSampleCodeV2, type ModelSampleSnippet, type OpenApiCredential, type OutputFormat, type ParsedFlags, type PipelineResult, type PipelineStep, type PredictConfigEntry, type PreferenceMode, type ProfileAttribute, type ProfileSchemaAttribute, type ProfileSchemaAttributeOperation, type ProfileSchemaCreateRequest, type ProfileSchemaCreateResponse, type ProfileSchemaDetailResponse, type ProfileSchemaListResponse, type ProfileSchemaSummary, type ProfileSchemaUpdateRequest, type QpmLimit, type QualityPreference, type RagAddCategoryData, type RagAddCategoryResponse, type RagAddConnectorResponse, type RagAddFileData, type RagAddFileResponse, type RagAgentConfig, type RagAgentDetail, type RagAgentGetData, type RagAgentGetResponse, type RagAgentListData, type RagAgentListResponse, type RagAgentMutationData, type RagAgentMutationResponse, type RagAgentRow, type RagBatchUpdateTagResponse, type RagCategory, type RagChunkListData, type RagChunkListResponse, type RagChunkNode, type RagChunkNodeMetadata, type RagConnectorInfo, type RagConnectorResponse, type RagCreateIndexV2Data, type RagCreateIndexV2Response, type RagDataCenterFile, type RagDeleteFileData, type RagDeleteFileResponse, type RagDescribeFileResponse, type RagGetConnectorResponse, type RagIndexFileDetailRow, type RagIndexFileDetailsResponse, type RagIndexFileRow, type RagIndexFilesData, type RagIndexFilesResponse, type RagIndexJobDoc, type RagIndexJobStatusData, type RagIndexJobStatusResponse, type RagIndexListData, type RagIndexListResponse, type RagIndexRow, type RagJobCreateData, type RagJobCreateResponse, type RagListCategoryData, type RagListCategoryResponse, type RagListFileData, type RagListFileResponse, type RagMonitorData, type RagMonitorResponse, type RagMutationResponse, type RagOssImportData, type RagOssImportFileResult, type RagOssImportResponse, type RagQpsMonitorData, type RagResponse, type RagStorageMonitorData, type RagUploadLeaseData, type RagUploadLeaseParam, type RagUploadLeaseResponse, type RecommendDeps, type RecommendSession, type RecommendedModel, type Region, type RequestOpts, type ResolutionSources, type ResponsesOutputContent, type ResponsesOutputItem, type ResponsesRequest, type ResponsesResponse, type ResponsesStreamEvent, type SecurityAlert, type SecurityAlertList, type SecurityOverview, type SecurityRiskLevel, type SecurityScanStat, type SecurityToggle, type ServerSentEvent, type Settings, type SingleResult, type SkillIndexEntry, type SkillInstallRecord, type SkillLockEntry, type SkillLockFile, type SkillMeta, type SkillStatus, type SkillStatusRow, type SkillsIndex, type SourceFlags, type StreamChoice, type StreamChunk, type ToolDeps, type TrackingDeps, type TrackingEvent, type TrackingIdentity, type TrainingProfile, type TrajectoryEvent, type UserProfileAttribute, type UserProfileResponse, type UserProfileValueItem, type UserProfileValueUpdateRequest, type ValidateOpts, type ValidationIssue, type ValidationResult, type ValidationSeverity, type ValidationStats, type ValidatorSpec, type VocabularyEntry, type VocabularyEnvelope, type VocabularyListItem, type VocabularyRequest, analyzeIntent as analyzeEngineIntent, recommend as recommendEngine, route as routeEngine };
|
|
6508
|
+
export { type AcsQueryParams, type AcsSignConfig, type AgentResult, type AgentTarget, type AigcImageEditInput, type AigcImageGenInput, type AigcTtsInput, type AigcTtsResult, type AigcVideoSubmitInput, type AigcVideoTaskResult, type AnyCommand, type ApiErrorBody, type ApiKeyCredential, type ApiKeyLoginKind, type ApiKeyResolutionSourceSelection, type AppCompletionRequest, type AppCompletionResponse, type AppStreamChunk, type AsrApiKind, type AsrApiRoute, type AsrContextMessage, type AsrFlashFamily, type AuthPersistPatch, type AuthRequirement, type AuthState, type AuthStore, type BailianControlAuth, type Budget, type BuildAsrFlashRequestOpts, type CallerAttribution, type Capability, type ChatChoice, type ChatMessage, type ChatMessageContent, type ChatRequest, type ChatResponse, type ChatResponseFormat, type ChatTool, type Clarification, type ClientOpenApiJsonOpts, type ClientOpenApiQueryOpts, type ClientRequestOpts, type Command, type CommandContext, type CommandFormatter, type CommandNotice, type CommandOutput, type CommandPack, type CommandPackApiKeyContext, type CommandPackCommand, type CommandPackContext, type CommandPackCredentials, type CommandPackErrorOptions, type CommandPackErrors, type CommandPackManager, type CommandPackMeta, type CommandPackMutationResult, type CommandPackOutput, type CommandPackOutputOptions, type CommandPackReport, type CommandPreparation, type CommandRisk, type CommandRiskLevel, type Complexity, type ConfigFile, type ConfigProfiles, type ConfigStore, type ConnectBailianMcpOptions, type ConsoleCall, type ConsoleCredential, type ConsoleGatewayRequest, type ConsoleGatewayTarget, type ConsoleSite, type ContextNeed, type CreateUserReqDTO, type CredentialFailure, type CredentialSource, type DashScopeASRRequest, type DashScopeASRTaskResult, type DashScopeASRTranscriptionItem, type DashScopeAsyncResponse, type DashScopeImageRequest, type DashScopeImageSyncResponse, type DashScopeTTSRequest, type DashScopeTTSResponse, type DashScopeTTSStreamChunk, type DashScopeTaskResponse, type DashScopeVideoEditRequest, type DashScopeVideoRefRequest, type DashScopeVideoRequest, type DataModality, type DatasetSchema, type Degradation, type IntentProfile as EngineIntentProfile, type RecommendResult as EngineRecommendResult, type RecommendSuccess as EngineRecommendSuccess, type RecommendSuccess, type Recommendation as EngineRecommendation, type StepRecommendation as EngineStepRecommendation, type ExecutableCommand, type ExecutionPlan, type FamilyProfile, type FanoutOutcome, type Feature, type FetchImplementation, type FlagDef, type FlagsDef, type HttpDeps, type Identity, type ImageApiKind, type ImageApiRoute, type ImageInputStyle, type ImageSizeProfile, type InstallMethod, type InstallMethodIdentity, type InstalledSkill, type IntentSegment, type Interaction, type KnowledgeChatContentPart, type KnowledgeChatMessage, type KnowledgeChatRequest, type KnowledgeChatStreamChunk, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type LLMClient, type LLMClientOptions, type LLMErrorKind, type LLMStage, type Language, type IntentProfile$1 as LegacyIntentProfile, type ModelProfile as LegacyModelProfile, type RecommendResult$1 as LegacyRecommendResult, type LinkResult, type LocalizedText, type McpConnectedClient, type McpTool, type McpToolResult, type McpToolResultContent, type MemoryAddAsyncResponse, type MemoryAddRequest, type MemoryContentPart, type MemoryEvent, type MemoryEventResourceType, type MemoryEventResponse, type MemoryEventResult, type MemoryEventStatus, type MemoryExtractScene, type MemoryMessage, type MemoryNode, type MemoryNodeDetailResponse, type MemoryNodeListResponse, type MemoryNodeUpdateRequest, type MemoryPlanVersion, type MemorySearchRequest, type MemorySearchResponse, type MemorySkillExportResponse, type MemoryToolCall, type MemoryType, type Modality, type ModelCategory, type ModelConnectionProvenance, type ModelGroup, type ModelGroupItem, type ModelGroupParams, type ModelGroupResult, type ModelListParams, type ModelListResult, type ModelOfflineInfo, type ModelOfflineNotice, type ModelPreference, type ModelPrice, type ModelPriceInfo, type ModelSampleCodeV2, type ModelSampleSnippet, type OpenApiCredential, type OutputDiagnostic, type OutputFormat, type OutputMessage, type OutputResultOptions, type ParsedFlags, type PipelineResult, type PipelineStep, type PredictConfigEntry, type PreferenceMode, type ProfileAttribute, type ProfileSchemaAttribute, type ProfileSchemaAttributeOperation, type ProfileSchemaCreateRequest, type ProfileSchemaCreateResponse, type ProfileSchemaDetailResponse, type ProfileSchemaListResponse, type ProfileSchemaSummary, type ProfileSchemaUpdateRequest, type QpmLimit, type QualityPreference, type RagAddCategoryData, type RagAddCategoryResponse, type RagAddConnectorResponse, type RagAddFileData, type RagAddFileResponse, type RagAgentConfig, type RagAgentDetail, type RagAgentGetData, type RagAgentGetResponse, type RagAgentListData, type RagAgentListResponse, type RagAgentMutationData, type RagAgentMutationResponse, type RagAgentRow, type RagBatchUpdateTagResponse, type RagCategory, type RagChunkListData, type RagChunkListResponse, type RagChunkNode, type RagChunkNodeMetadata, type RagConnectorInfo, type RagConnectorResponse, type RagCreateIndexV2Data, type RagCreateIndexV2Response, type RagDataCenterFile, type RagDeleteFileData, type RagDeleteFileResponse, type RagDescribeFileResponse, type RagGetConnectorResponse, type RagIndexFileDetailRow, type RagIndexFileDetailsResponse, type RagIndexFileRow, type RagIndexFilesData, type RagIndexFilesResponse, type RagIndexJobDoc, type RagIndexJobStatusData, type RagIndexJobStatusResponse, type RagIndexListData, type RagIndexListResponse, type RagIndexRow, type RagJobCreateData, type RagJobCreateResponse, type RagListCategoryData, type RagListCategoryResponse, type RagListFileData, type RagListFileResponse, type RagMonitorData, type RagMonitorResponse, type RagMutationResponse, type RagOssImportData, type RagOssImportFileResult, type RagOssImportResponse, type RagQpsMonitorData, type RagResponse, type RagStorageMonitorData, type RagUploadLeaseData, type RagUploadLeaseParam, type RagUploadLeaseResponse, type RecommendDeps, type RecommendSession, type RecommendedModel, type Region, type RequestOpts, type ResolutionSources, type ResponsesOutputContent, type ResponsesOutputItem, type ResponsesRequest, type ResponsesResponse, type ResponsesStreamEvent, type SecurityAlert, type SecurityAlertList, type SecurityOverview, type SecurityRiskLevel, type SecurityScanStat, type SecurityToggle, type ServerSentEvent, type Settings, type SingleResult, type SkillIndexEntry, type SkillInstallRecord, type SkillLockEntry, type SkillLockFile, type SkillMeta, type SkillStatus, type SkillStatusRow, type SkillsIndex, type SourceFlags, type StreamChoice, type StreamChunk, type ToolDeps, type TrackingDeps, type TrackingEvent, type TrackingIdentity, type TrainingProfile, type TrajectoryEvent, type UserProfileAttribute, type UserProfileResponse, type UserProfileValueItem, type UserProfileValueUpdateRequest, type ValidateOpts, type ValidationIssue, type ValidationResult, type ValidationSeverity, type ValidationStats, type ValidatorSpec, type VocabularyEntry, type VocabularyEnvelope, type VocabularyListItem, type VocabularyRequest, analyzeIntent as analyzeEngineIntent, recommend as recommendEngine, route as routeEngine };
|