bailian-cli-core 1.0.1 → 1.0.2
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 +27 -11
- package/dist/index.mjs +920 -70
- package/package.json +1 -11
- package/dist/chunk-e9Ob2GDo.mjs +0 -26
- package/dist/index-node-C01JPicH.mjs +0 -38910
- package/dist/index-node-Ce966wQ9.mjs +0 -83
package/dist/index.d.mts
CHANGED
|
@@ -577,7 +577,7 @@ interface ConfigFile {
|
|
|
577
577
|
access_token?: string;
|
|
578
578
|
region?: Region;
|
|
579
579
|
base_url?: string;
|
|
580
|
-
output?: "text" | "json"
|
|
580
|
+
output?: "text" | "json";
|
|
581
581
|
output_dir?: string;
|
|
582
582
|
timeout?: number;
|
|
583
583
|
default_text_model?: string;
|
|
@@ -605,7 +605,7 @@ interface Config {
|
|
|
605
605
|
configPath?: string;
|
|
606
606
|
region: Region;
|
|
607
607
|
baseUrl: string;
|
|
608
|
-
output: "text" | "json"
|
|
608
|
+
output: "text" | "json";
|
|
609
609
|
outputDir?: string;
|
|
610
610
|
timeout: number;
|
|
611
611
|
defaultTextModel?: string;
|
|
@@ -637,6 +637,14 @@ interface ResolvedCredential {
|
|
|
637
637
|
//#endregion
|
|
638
638
|
//#region src/auth/resolver.d.ts
|
|
639
639
|
declare function resolveCredential(config: Config): Promise<ResolvedCredential>;
|
|
640
|
+
/**
|
|
641
|
+
* Credential for Bailian **console** CLI gateway only (`callConsoleGateway`).
|
|
642
|
+
* DashScope API keys are not valid Bearer tokens for this gateway — use env/file
|
|
643
|
+
* `access_token` even when `api_key` is also present in config.
|
|
644
|
+
*/
|
|
645
|
+
/** Thrown when `callConsoleGateway` has no usable console session token. */
|
|
646
|
+
declare const CONSOLE_GATEWAY_NO_TOKEN_MESSAGE = "No console access token found.";
|
|
647
|
+
declare function resolveConsoleGatewayCredential(config: Config): Promise<ResolvedCredential>;
|
|
640
648
|
//#endregion
|
|
641
649
|
//#region src/client/ak-sign.d.ts
|
|
642
650
|
/**
|
|
@@ -801,7 +809,7 @@ declare function getCredentialsPath(): string;
|
|
|
801
809
|
declare function ensureConfigDir(): Promise<void>;
|
|
802
810
|
//#endregion
|
|
803
811
|
//#region src/output/formatter.d.ts
|
|
804
|
-
type OutputFormat = "text" | "json"
|
|
812
|
+
type OutputFormat = "text" | "json";
|
|
805
813
|
declare function detectOutputFormat(flagValue?: string): OutputFormat;
|
|
806
814
|
declare function formatOutput(data: unknown, format: OutputFormat): string;
|
|
807
815
|
//#endregion
|
|
@@ -811,11 +819,6 @@ declare function formatErrorJson(code: number, message: string, hint?: string):
|
|
|
811
819
|
//#endregion
|
|
812
820
|
//#region src/output/text.d.ts
|
|
813
821
|
declare function formatText(data: unknown): string;
|
|
814
|
-
declare function formatKeyValue(obj: Record<string, unknown>, indent?: number): string;
|
|
815
|
-
declare function formatTable(rows: Record<string, unknown>[]): string;
|
|
816
|
-
//#endregion
|
|
817
|
-
//#region src/output/yaml.d.ts
|
|
818
|
-
declare function formatYaml(data: unknown): string;
|
|
819
822
|
//#endregion
|
|
820
823
|
//#region src/files/upload.d.ts
|
|
821
824
|
interface UploadOptions {
|
|
@@ -941,8 +944,9 @@ interface TrackingEvent {
|
|
|
941
944
|
timestamp: string;
|
|
942
945
|
durationMs: number;
|
|
943
946
|
success: boolean;
|
|
944
|
-
errorCode?: number;
|
|
945
947
|
errorMessage?: string;
|
|
948
|
+
httpStatus?: number;
|
|
949
|
+
requestId?: string;
|
|
946
950
|
cliVersion: string;
|
|
947
951
|
region: string;
|
|
948
952
|
nodeVersion: string;
|
|
@@ -955,8 +959,9 @@ declare function createTrackingEvent(opts: {
|
|
|
955
959
|
durationMs: number;
|
|
956
960
|
success: boolean;
|
|
957
961
|
error?: {
|
|
958
|
-
code?: number;
|
|
959
962
|
message?: string;
|
|
963
|
+
httpStatus?: number;
|
|
964
|
+
requestId?: string;
|
|
960
965
|
};
|
|
961
966
|
cliVersion: string;
|
|
962
967
|
region: string;
|
|
@@ -965,10 +970,21 @@ declare function createTrackingEvent(opts: {
|
|
|
965
970
|
}): TrackingEvent;
|
|
966
971
|
//#endregion
|
|
967
972
|
//#region src/telemetry/sink.d.ts
|
|
973
|
+
/**
|
|
974
|
+
* 尽力等待所有在途的埋点发送完成(best-effort)。
|
|
975
|
+
*
|
|
976
|
+
* 1. 先调用 `_sendAll` 排空 tracker 内部的去抖队列,把还卡在 500ms 合并窗口里
|
|
977
|
+
* 的事件立刻推上网络。
|
|
978
|
+
* 2. 然后用硬超时 race 所有已追踪的 fetch promise。
|
|
979
|
+
*
|
|
980
|
+
* 埋点永远不应阻塞 CLI:调用方应传入较短的超时(例如 1000ms),并始终与超时
|
|
981
|
+
* race。错误与超时一律静默吞掉。
|
|
982
|
+
*/
|
|
983
|
+
declare function flushTelemetry(timeoutMs?: number): Promise<void>;
|
|
968
984
|
declare function localSink(event: TrackingEvent): Promise<void>;
|
|
969
985
|
declare function remoteSink(event: TrackingEvent): Promise<void>;
|
|
970
986
|
//#endregion
|
|
971
987
|
//#region src/telemetry/tracker.d.ts
|
|
972
988
|
declare function trackCommandExecution(config: Config, commandPath: string[], flags: GlobalFlags, fn: () => Promise<void>): Promise<void>;
|
|
973
989
|
//#endregion
|
|
974
|
-
export { AkSignConfig, type ApiErrorBody, AppCompletionRequest, AppCompletionResponse, AppStreamChunk, AuthMethod, BAILIAN_HOST, BailianError, CHANNEL, ChatChoice, ChatMessage, ChatMessageContent, ChatRequest, ChatResponse, ChatTool, Command, CommandSpec, Config, ConfigFile, ConsoleGatewayRequest, DOCS_HOSTS, DashScopeASRRequest, DashScopeASRTaskResult, DashScopeAsyncResponse, DashScopeImageRequest, DashScopeImageSyncResponse, DashScopeTTSRequest, DashScopeTTSResponse, DashScopeTTSStreamChunk, DashScopeTaskResponse, DashScopeVideoEditRequest, DashScopeVideoRefRequest, DashScopeVideoRequest, ExitCode, GLOBAL_OPTIONS, GlobalFlags, KnowledgeRetrieveRequest, KnowledgeRetrieveResponse, McpClient, McpTool, McpToolResult, MemoryAddRequest, MemoryAddResponse, MemoryMessage, MemoryNode, MemoryNodeListResponse, MemoryNodeUpdateRequest, MemorySearchRequest, MemorySearchResponse, OptionDef, OutputFormat, ProfileAttribute, ProfileSchemaCreateRequest, ProfileSchemaCreateResponse, REGIONS, Region, RequestOpts, ResolvedCredential, SOURCE_CONFIG, ServerSentEvent, StreamChoice, StreamChunk, TAGS, TrackingEvent, UserProfileResponse, appCompletionEndpoint, callConsoleGateway, chatEndpoint, clearApiKey, createTrackingEvent, defineCommand, detectOutputFormat, ensureConfigDir, formatErrorJson, formatJson,
|
|
990
|
+
export { AkSignConfig, type ApiErrorBody, AppCompletionRequest, AppCompletionResponse, AppStreamChunk, AuthMethod, BAILIAN_HOST, BailianError, CHANNEL, CONSOLE_GATEWAY_NO_TOKEN_MESSAGE, ChatChoice, ChatMessage, ChatMessageContent, ChatRequest, ChatResponse, ChatTool, Command, CommandSpec, Config, ConfigFile, ConsoleGatewayRequest, DOCS_HOSTS, DashScopeASRRequest, DashScopeASRTaskResult, DashScopeAsyncResponse, DashScopeImageRequest, DashScopeImageSyncResponse, DashScopeTTSRequest, DashScopeTTSResponse, DashScopeTTSStreamChunk, DashScopeTaskResponse, DashScopeVideoEditRequest, DashScopeVideoRefRequest, DashScopeVideoRequest, ExitCode, GLOBAL_OPTIONS, GlobalFlags, KnowledgeRetrieveRequest, KnowledgeRetrieveResponse, McpClient, McpTool, McpToolResult, MemoryAddRequest, MemoryAddResponse, MemoryMessage, MemoryNode, MemoryNodeListResponse, MemoryNodeUpdateRequest, MemorySearchRequest, MemorySearchResponse, OptionDef, OutputFormat, ProfileAttribute, ProfileSchemaCreateRequest, ProfileSchemaCreateResponse, REGIONS, Region, RequestOpts, ResolvedCredential, SOURCE_CONFIG, ServerSentEvent, StreamChoice, StreamChunk, TAGS, TrackingEvent, UserProfileResponse, appCompletionEndpoint, callConsoleGateway, chatEndpoint, clearApiKey, createTrackingEvent, defineCommand, detectOutputFormat, ensureConfigDir, flushTelemetry, formatErrorJson, formatJson, formatOutput, formatText, generateFilename, generateToolSchema, getConfigDir, getConfigPath, getCredentialsPath, imageEndpoint, imageSyncEndpoint, isCI, isInteractive, isLocalFile, loadApiKeyFromConfig, loadConfig, localSink, mapApiError, maskToken, mcpWebSearchEndpoint, memoryAddEndpoint, memoryListEndpoint, memoryNodeEndpoint, memorySearchEndpoint, parseConfigFile, parseSSE, profileSchemaEndpoint, readConfigFile, remoteSink, request, requestJson, resolveConsoleGatewayCredential, resolveCredential, resolveFileUrl, resolveOutputDir, saveApiKeyToConfig, signRequest, speechRecognizeEndpoint, speechSynthesizeEndpoint, stripUndefined, taskEndpoint, trackCommandExecution, trackingHeaders, uploadFile, userProfileEndpoint, videoGenerateEndpoint, writeConfigFile };
|