bailian-cli-runtime 2.5.0 → 2.6.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 CHANGED
@@ -1,4 +1,4 @@
1
- import { AnyCommand, ApiKeyCredential, AuthStore, Client, Command, CommandPackManager, ConfigStore, FlagDef, FlagsDef, Identity, ImageSizeProfile, Language, LocalizedText, OutputFormat, ParsedFlags, ResolutionSources, Settings, UsageError } from "bailian-cli-core";
1
+ import { AnyCommand, ApiKeyCredential, AuthRequirement, AuthStore, BailianError, Client, Command, CommandPackManager, CommandRisk, ConfigStore, ExitCode, FlagDef, FlagDef as FlagDef$1, FlagsDef, Identity, ImageSizeProfile, Language, LocalizedText, OutputFormat, ParsedFlags, ResolutionSources, Settings, UsageError } from "bailian-cli-core";
2
2
  //#region src/command-packs/types.d.ts
3
3
  interface CommandPackDefinition {
4
4
  commandPrefixes: readonly string[];
@@ -74,6 +74,13 @@ export declare class CommandRegistry {
74
74
  private localize;
75
75
  private register;
76
76
  getAllCommands(): AnyCommand[];
77
+ /** Read-only metadata traversal for command discovery and documentation. */
78
+ entries(path?: readonly string[]): readonly {
79
+ path: readonly string[];
80
+ command: AnyCommand;
81
+ }[];
82
+ /** No fallback when aliases make the intended product route ambiguous. */
83
+ commandPath(command: AnyCommand): string[] | undefined;
77
84
  /** First registered command path, for the "Getting Help" example (e.g. "knowledge search"). */
78
85
  private helpExample;
79
86
  /**
@@ -99,6 +106,36 @@ export declare class CommandRegistry {
99
106
  private printChildren;
100
107
  }
101
108
  //#endregion
109
+ //#region src/introspect.d.ts
110
+ interface CommandSchemaNode {
111
+ path: readonly string[];
112
+ description: LocalizedText;
113
+ auth: AuthRequirement;
114
+ usage: string;
115
+ flags: Record<string, FlagDef$1>;
116
+ notes: readonly LocalizedText[];
117
+ examples: readonly LocalizedText[];
118
+ risk?: CommandRisk;
119
+ preparation: "none" | "read-only";
120
+ constraints: {
121
+ crossFlagValidation: "not-exported";
122
+ };
123
+ }
124
+ interface CommandSchema {
125
+ schema_version: 1;
126
+ bin: string;
127
+ version: string;
128
+ scope: readonly string[];
129
+ exitCodes: typeof ExitCode;
130
+ globalFlags: Record<string, FlagDef$1>;
131
+ credentialFlags: Record<AuthRequirement, Record<string, FlagDef$1>>;
132
+ commands: readonly CommandSchemaNode[];
133
+ }
134
+ /** Only declarative metadata is exported. Never read settings, credentials, or execute callbacks. */
135
+ export declare function buildCommandSchema(registry: CommandRegistry, identity: Identity, path?: readonly string[]): CommandSchema;
136
+ /** Recursively sort object keys, preserving semantically ordered arrays. */
137
+ export declare function serializeCommandSchema(schema: CommandSchema): string;
138
+ //#endregion
102
139
  //#region src/resolve.d.ts
103
140
  /**
104
141
  * What an invocation resolves to — "what to do" expressed as data, not control
@@ -111,6 +148,9 @@ export declare class CommandRegistry {
111
148
  */
112
149
  type Resolution = {
113
150
  kind: "version";
151
+ } | {
152
+ kind: "introspect";
153
+ path: string[];
114
154
  } | {
115
155
  kind: "help";
116
156
  path: string[];
@@ -139,6 +179,8 @@ export declare function resolve(argv: string[], registry: CommandRegistry, local
139
179
  * {@link authStage}). A stage reads these and may augment them before `next()`.
140
180
  */
141
181
  interface RunContext {
182
+ commandPath?: (command: AnyCommand) => string[] | undefined;
183
+ prepared?: unknown;
142
184
  /** 静态产品身份(binName/version/npmPackage/clientName)。 */
143
185
  readonly identity: Identity;
144
186
  /** The matched command path, e.g. ["speech","recognize"]. */
@@ -179,6 +221,7 @@ interface ParsePathResult {
179
221
  rest: string[];
180
222
  hasHelpFlag: boolean;
181
223
  hasVersionFlag: boolean;
224
+ hasIntrospectFlag: boolean;
182
225
  }
183
226
  /**
184
227
  * First-pass routing parse.
@@ -200,6 +243,7 @@ export declare function parseFlags<F extends FlagsDef>(rest: string[], defs: F,
200
243
  export declare function setupProxyFromEnv(): void;
201
244
  //#endregion
202
245
  //#region src/error-handler.d.ts
246
+ export declare function normalizeError(err: unknown, cliName: string): BailianError;
203
247
  export declare function handleError(err: unknown, cliName: string): never;
204
248
  //#endregion
205
249
  //#region src/version.d.ts
@@ -219,6 +263,8 @@ export declare const BAILIAN_CONSOLE_ROOT = "https://bailian.console.aliyun.com"
219
263
  export declare const BAILIAN_CONSOLE = "https://bailian.console.aliyun.com/cn-beijing";
220
264
  /** Direct deep link to API key management page. */
221
265
  export declare const API_KEY_PAGE = "https://bailian.console.aliyun.com/cn-beijing/?tab=app#/api-key";
266
+ /** Running-time billing, shared trial allowance and model-call charges for RAG. */
267
+ export declare const KNOWLEDGE_BILLING_PAGE = "https://help.aliyun.com/zh/model-studio/billing-for-knowledge-base";
222
268
  /** Direct deep link to the Token Plan subscription overview and API key entry. */
223
269
  export declare const TOKEN_PLAN_PAGE = "https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview";
224
270
  /** MCP marketplace detail page for a server code (e.g. WebSearch, market-cmapi00073529). */
@@ -361,6 +407,8 @@ export declare function ansi(out: NodeJS.WriteStream): AnsiStyles;
361
407
  interface PollOptions {
362
408
  /** Absolute task URL (Client passes absolute URLs through as-is). */
363
409
  url: string;
410
+ /** Optional complete snapshot loader (for paginated task APIs). */
411
+ load?: () => Promise<unknown>;
364
412
  intervalSec: number;
365
413
  timeoutSec: number;
366
414
  isComplete: (data: unknown) => boolean;
@@ -814,4 +862,4 @@ export declare function collectPipelineHints(pipeline: PipelineDefinition, dispa
814
862
  export declare function executePipeline(pipeline: PipelineDefinition, runtimeInput?: Record<string, unknown>, options?: ExecutePipelineOptions): Promise<PipelineExecutionReport>;
815
863
  export declare function streamPipelineEvents(pipeline: PipelineDefinition, runtimeInput?: Record<string, unknown>, options?: Pick<ExecutePipelineOptions, "concurrency" | "basePath" | "dryRun" | "signal" | "timeoutSeconds" | "blRequestTimeoutSeconds" | "stepDispatcher">): AsyncGenerator<PipelineLifecycleEvent>;
816
864
  //#endregion
817
- export type { AnsiStyles, BarColumn, BoxTableOptions, Cli, CliOptions, Command, CommandPackCredentialAccess, CommandPackDefinition, CommandPackPolicy, FlagDef, GaugeCell, LocateResult, Middleware, ParsePathResult, PipelineDefinition, PipelineLifecycleEvent, Resolution, RunContext, TextStyle };
865
+ export type { AnsiStyles, BarColumn, BoxTableOptions, Cli, CliOptions, Command, CommandPackCredentialAccess, CommandPackDefinition, CommandPackPolicy, CommandSchema, CommandSchemaNode, FlagDef, GaugeCell, LocateResult, Middleware, ParsePathResult, PipelineDefinition, PipelineLifecycleEvent, Resolution, RunContext, TextStyle };