bailian-cli-core 2.5.1 → 2.6.1

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
@@ -9,6 +9,7 @@ export declare const ExitCode: {
9
9
  readonly NETWORK: 6;
10
10
  readonly CONFIRMATION_REQUIRED: 7;
11
11
  readonly CONTENT_FILTER: 10;
12
+ readonly INTERRUPTED: 130;
12
13
  };
13
14
  export type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
14
15
  //#endregion
@@ -682,6 +683,10 @@ interface UserProfileValueUpdateRequest {
682
683
  memory_library_id?: string;
683
684
  }
684
685
  interface KnowledgeSearchRequest {
686
+ kb_search_configs?: Array<{
687
+ id: string;
688
+ search_filters?: unknown[];
689
+ }>;
685
690
  query: string;
686
691
  agent_id: string;
687
692
  /** "beta" targets the debug draft; a numeric version targets that published version; defaults to the latest published version */
@@ -706,8 +711,15 @@ interface KnowledgeSearchResponse {
706
711
  doc_url?: string;
707
712
  pipeline_id?: string;
708
713
  workspace_id?: string;
709
- page_number?: number;
710
- image_url?: string;
714
+ page_number?: number | number[];
715
+ image_url?: string | string[];
716
+ video_url?: string[];
717
+ audio_url?: string[];
718
+ clip_start_time?: number;
719
+ clip_end_time?: number;
720
+ clip_description?: string;
721
+ audio_segments?: Array<Record<string, unknown>>;
722
+ [key: string]: unknown;
711
723
  _knowledge_type?: string;
712
724
  _citation_index?: number;
713
725
  _score?: number;
@@ -725,16 +737,22 @@ type KnowledgeChatContentPart = {
725
737
  };
726
738
  };
727
739
  interface KnowledgeChatMessage {
728
- role: "user" | "assistant";
740
+ role: "user" | "assistant" | "tool";
741
+ tool_call_id?: string;
742
+ tool_calls?: unknown[];
743
+ [key: string]: unknown;
729
744
  content: string | KnowledgeChatContentPart[];
730
745
  }
731
746
  interface KnowledgeChatRequest {
732
747
  input: {
733
748
  messages: KnowledgeChatMessage[];
749
+ request_id?: string;
734
750
  };
735
751
  parameters: {
736
752
  agent_options: {
737
753
  agent_id: string;
754
+ session_files?: string[];
755
+ enable_cache_control?: boolean;
738
756
  /** "beta" targets the debug draft; a numeric version targets that published version; defaults to the latest published version */
739
757
  agent_version?: string;
740
758
  user?: {
@@ -746,24 +764,35 @@ interface KnowledgeChatRequest {
746
764
  stream: boolean;
747
765
  }
748
766
  interface KnowledgeChatStreamChunk {
749
- output: {
750
- choices: Array<{
751
- message: {
752
- role: string;
753
- content: string;
767
+ output?: {
768
+ request_id?: string;
769
+ choices?: Array<{
770
+ message?: {
771
+ role?: string;
772
+ content?: string | KnowledgeChatContentPart[];
754
773
  tool_calls?: unknown[];
774
+ additional_kwargs?: {
775
+ extra_json?: Record<string, unknown> | string;
776
+ [key: string]: unknown;
777
+ };
755
778
  extra?: {
756
779
  group?: string;
757
780
  step_change?: string;
758
781
  step?: string;
782
+ [key: string]: unknown;
759
783
  };
784
+ [key: string]: unknown;
760
785
  };
761
- finish_reason: string;
786
+ finish_reason?: string;
787
+ [key: string]: unknown;
762
788
  }>;
789
+ [key: string]: unknown;
763
790
  };
764
- code: string;
765
- message: string;
766
- request_id: string;
791
+ usage?: Record<string, unknown>;
792
+ code?: string | number;
793
+ message?: string;
794
+ request_id?: string;
795
+ [key: string]: unknown;
767
796
  }
768
797
  interface DashScopeTTSRequest {
769
798
  model: string;
@@ -918,6 +947,9 @@ interface RagIndexRow {
918
947
  name: string;
919
948
  description?: string;
920
949
  dataType?: string;
950
+ knowledgeType?: string | null;
951
+ knowledgeScene?: string | null;
952
+ multimodalEmbeddingModelName?: string | null;
921
953
  embeddingModelName?: string;
922
954
  embeddingDimension?: number;
923
955
  chunkSize?: number;
@@ -937,7 +969,7 @@ interface RagIndexRow {
937
969
  }
938
970
  interface RagIndexListData {
939
971
  rows?: RagIndexRow[];
940
- total?: number;
972
+ total_count?: number;
941
973
  [key: string]: unknown;
942
974
  }
943
975
  type RagIndexListResponse = RagResponse<RagIndexListData>;
@@ -957,6 +989,24 @@ interface RagIndexFilesData {
957
989
  [key: string]: unknown;
958
990
  }
959
991
  type RagIndexFilesResponse = RagResponse<RagIndexFilesData>;
992
+ /** POST list/index/file/details, preserving the server's mixed field casing. */
993
+ interface RagIndexFileDetailRow extends RagIndexFileRow {
994
+ chunkSize?: number;
995
+ overlapSize?: number;
996
+ separator?: string;
997
+ chunkMode?: string;
998
+ enableHeaders?: boolean;
999
+ categoryId?: string;
1000
+ categoryName?: string;
1001
+ tags?: string[];
1002
+ }
1003
+ type RagIndexFileDetailsResponse = RagResponse<{
1004
+ rows?: RagIndexFileDetailRow[];
1005
+ total_count?: number;
1006
+ page_number?: number;
1007
+ page_size?: number;
1008
+ [key: string]: unknown;
1009
+ }>;
960
1010
  /**
961
1011
  * GET index_job/status (verified against the live API)
962
1012
  * Gotcha: the overall job state lives in `ingestion_status` (PENDING/RUNNING/COMPLETED,
@@ -1615,9 +1665,10 @@ export declare class Client {
1615
1665
  private toOpts;
1616
1666
  request(opts: ClientRequestOpts): Promise<Response>;
1617
1667
  requestJson<T>(opts: ClientRequestOpts): Promise<T>;
1618
- /** Resolve a file arg: upload a local path to OSS (returns oss:// URL), or pass a URL through. */
1668
+ /** Resolve a file arg, honoring a lazy service default origin just like {@link url}. */
1619
1669
  uploadFile(source: string, model: string, opts?: {
1620
1670
  signal?: AbortSignal;
1671
+ defaultBaseUrl?: () => string;
1621
1672
  }): Promise<string>;
1622
1673
  /**
1623
1674
  * Resolve an image input while keeping Token Plan's upload limitation isolated.
@@ -1626,6 +1677,7 @@ export declare class Client {
1626
1677
  */
1627
1678
  resolveImageInput(source: string, model: string, opts?: {
1628
1679
  signal?: AbortSignal;
1680
+ defaultBaseUrl?: () => string;
1629
1681
  }): Promise<string>;
1630
1682
  usesTokenPlanEndpoint(): boolean;
1631
1683
  /** Open an MCP client. Accepts a path (prepended with the model baseUrl) or an absolute URL. */
@@ -1713,6 +1765,13 @@ type ParsedFlags<F extends FlagsDef> = { [K in keyof F as IsRequired<F[K]> exten
1713
1765
  type AuthRequirement = "apiKey" | "console" | "openapi" | "none";
1714
1766
  /** 所有命令都可用的全局 flag。 */
1715
1767
  export declare const GLOBAL_FLAGS: {
1768
+ introspect: {
1769
+ type: "switch";
1770
+ description: {
1771
+ "en-US": string;
1772
+ "zh-CN": string;
1773
+ };
1774
+ };
1716
1775
  output: {
1717
1776
  type: "string";
1718
1777
  valueHint: string;
@@ -1887,7 +1946,11 @@ export declare function credentialFlagDefs(cmd: {
1887
1946
  * resolved configuration surface, `identity` for product identity, and `flags`
1888
1947
  * for parsed arguments. Never handle tokens or baseUrl.
1889
1948
  */
1890
- interface CommandContext<F extends FlagsDef = FlagsDef> {
1949
+ interface CommandContext<F extends FlagsDef = FlagsDef, Prepared = undefined> {
1950
+ /** Resolve a unique registered product path; older hosts may omit this capability. */
1951
+ commandPath?: (command: AnyCommand) => string[] | undefined;
1952
+ /** Read-only preparation result, supplied only after the runtime confirmation gate. */
1953
+ prepared?: Prepared;
1891
1954
  /** 静态产品身份(binName/version/npmPackage/clientName)。 */
1892
1955
  identity: Identity;
1893
1956
  /**
@@ -1920,8 +1983,20 @@ type CommandRiskLevel = "high";
1920
1983
  interface CommandRisk {
1921
1984
  level: CommandRiskLevel;
1922
1985
  message: LocalizedText;
1986
+ reason?: "destructive" | "billing";
1923
1987
  }
1924
- interface Command<F extends FlagsDef = FlagsDef> {
1988
+ interface CommandNotice {
1989
+ code: string;
1990
+ message: LocalizedText;
1991
+ url?: string;
1992
+ }
1993
+ interface CommandPreparation<Prepared> {
1994
+ data: Prepared;
1995
+ preview: unknown;
1996
+ risk: CommandRisk | null;
1997
+ notices: readonly CommandNotice[];
1998
+ }
1999
+ interface Command<F extends FlagsDef = FlagsDef, Prepared = undefined> {
1925
2000
  description: LocalizedText;
1926
2001
  /** Credential this command requires. See {@link AuthRequirement}. */
1927
2002
  auth: AuthRequirement;
@@ -1932,6 +2007,8 @@ interface Command<F extends FlagsDef = FlagsDef> {
1932
2007
  * remote request or local write; runtime only owns the confirmation gate.
1933
2008
  */
1934
2009
  risk?: CommandRisk;
2010
+ /** Authenticated, read-only planning. Never write files, request leases, or mutate resources. */
2011
+ prepare?: (ctx: CommandContext<F>) => Promise<CommandPreparation<Prepared>>;
1935
2012
  /** Usage line arg portion, e.g. "--prompt <text> [flags]". Manually written. */
1936
2013
  usageArgs?: string;
1937
2014
  /** Example args (without the `<bin> <path>` prefix). */
@@ -1946,13 +2023,13 @@ interface Command<F extends FlagsDef = FlagsDef> {
1946
2023
  * May be async for read-only local preflight. Runtime awaits it before auth
1947
2024
  * and confirmation. Do not perform remote requests or local writes here.
1948
2025
  */
1949
- validate?: (flags: ParsedFlags<F>) => string | undefined | Promise<string | undefined>;
1950
- run: (ctx: CommandContext<F>) => Promise<void>;
2026
+ validate?: (flags: ParsedFlags<F>) => LocalizedText | undefined | Promise<LocalizedText | undefined>;
2027
+ run: (ctx: CommandContext<F, Prepared>) => Promise<void>;
1951
2028
  }
1952
2029
  /** Type-erased command for heterogeneous storage (registry / context). */
1953
- type AnyCommand = Command<any>;
2030
+ type AnyCommand = Command<any, any>;
1954
2031
  /** Identity wrapper whose only job is to infer `F` from `spec.flags`. */
1955
- export declare function defineCommand<F extends FlagsDef>(spec: Command<F>): Command<F>;
2032
+ export declare function defineCommand<F extends FlagsDef, Prepared = undefined>(spec: Command<F, Prepared>): Command<F, Prepared>;
1956
2033
  //#endregion
1957
2034
  //#region src/config/loader.d.ts
1958
2035
  /**
@@ -2184,6 +2261,7 @@ export declare const RAG_PATHS: {
2184
2261
  readonly indexUpdate: "/api/v1/indices/rag/index/update";
2185
2262
  readonly indexDelete: "/api/v1/indices/rag/index/delete";
2186
2263
  readonly indexMonitor: "/api/v1/indices/rag/index/monitor";
2264
+ readonly indexFileDetails: "/api/v1/indices/rag/list/index/file/details";
2187
2265
  readonly indexFiles: "/api/v1/indices/rag/index/files";
2188
2266
  readonly indexDeleteFile: "/api/v1/indices/rag/index/delete_file";
2189
2267
  readonly indexJobCreate: "/api/v1/indices/rag/index/job/create";
@@ -2472,6 +2550,11 @@ interface ServerSentEvent {
2472
2550
  }
2473
2551
  export declare function parseSSE(response: Response): AsyncGenerator<ServerSentEvent>;
2474
2552
  //#endregion
2553
+ //#region src/client/transport.d.ts
2554
+ export declare const httpTransport: {
2555
+ fetch(this: void, input: string | URL | Request, init?: RequestInit): Promise<Response>;
2556
+ };
2557
+ //#endregion
2475
2558
  //#region src/console/models.d.ts
2476
2559
  export declare const MODEL_LIST_API = "zeldaHttp.dashscopeModel./zelda/api/v1/modelCenter/listFoundationModels";
2477
2560
  export declare const PREDICT_CONFIG_API = "zeldaEasy.bmp.modelPredictRpcService.getPredictParamConfig";
@@ -2646,6 +2729,8 @@ export declare function formatText(data: unknown): string;
2646
2729
  //#region src/files/upload.d.ts
2647
2730
  interface UploadOptions {
2648
2731
  apiKey: string;
2732
+ /** Model origin used only to resolve the supported regional upload service. Defaults to CN. */
2733
+ baseUrl?: string;
2649
2734
  model: string;
2650
2735
  filePath: string;
2651
2736
  identity: TrackingIdentity;
@@ -2671,6 +2756,7 @@ export declare function isLocalFile(input: string): boolean;
2671
2756
  */
2672
2757
  export declare function resolveFileUrl(input: string, apiKey: string, model: string, opts: {
2673
2758
  identity: TrackingIdentity;
2759
+ baseUrl?: string;
2674
2760
  signal?: AbortSignal;
2675
2761
  timeout?: number;
2676
2762
  }): Promise<string>;
@@ -2774,18 +2860,15 @@ export interface DatasetUploadParams {
2774
2860
  * uploading evaluation or other dataset kinds.
2775
2861
  */
2776
2862
  purpose?: string;
2863
+ /** 已由调用方校验的不可变字节;提供时不再读取 filePath。 */
2864
+ fileBlob?: Blob;
2777
2865
  signal?: AbortSignal;
2778
2866
  }
2779
2867
  /**
2780
2868
  * POST /compatible-mode/v1/files (multipart/form-data)
2781
2869
  *
2782
- * Streams the file from disk so we don't buffer 300MB into memory. Node's
2783
- * `fetch` accepts a `Blob` produced from a Readable stream via `Response`'s
2784
- * body shim, but the simplest portable approach (and the one used in
2785
- * `files/upload.ts`) is to wrap the buffer in a Blob. Here we use `Blob`
2786
- * with a stream-backed lazy `arrayBuffer()` for >50MB files via
2787
- * `Response`'s helper to avoid the buffer doubling. Fall back to readFileSync
2788
- * for small files where streaming overhead isn't worth it.
2870
+ * 文件读取通过 Response.blob 聚合,multipart 上传复用 Blob。
2871
+ * 提供 fileBlob 时不再读取源路径,保证校验和上传的字节一致。
2789
2872
  */
2790
2873
  export declare function uploadDataset(client: Client, params: DatasetUploadParams): Promise<DatasetFile & {
2791
2874
  request_id?: string;
@@ -3013,6 +3096,178 @@ export declare function parseDatasetSchemaFlag(value: string | undefined): Datas
3013
3096
  */
3014
3097
  export declare function formatIssue(issue: ValidationIssue): string;
3015
3098
  //#endregion
3099
+ //#region src/batch/types.d.ts
3100
+ export declare const BATCH_ENDPOINTS: readonly ["/v1/chat/completions", "/v1/embeddings", "/v1/chat/ds-test"];
3101
+ export type BatchEndpoint = (typeof BATCH_ENDPOINTS)[number];
3102
+ export declare const BATCH_STATUSES: readonly ["validating", "in_progress", "finalizing", "completed", "failed", "expired", "cancelling", "cancelled"];
3103
+ export declare const BATCH_TERMINAL: Set<string>;
3104
+ export interface BatchRequest {
3105
+ custom_id: string;
3106
+ method: "POST";
3107
+ url: BatchEndpoint;
3108
+ body: Record<string, unknown> & {
3109
+ model: string;
3110
+ };
3111
+ }
3112
+ export interface BatchJob extends Record<string, unknown> {
3113
+ id: string;
3114
+ status: string;
3115
+ input_file_id?: string;
3116
+ output_file_id?: string | null;
3117
+ error_file_id?: string | null;
3118
+ created_at?: number;
3119
+ metadata?: Record<string, string>;
3120
+ request_counts?: {
3121
+ total: number;
3122
+ completed: number;
3123
+ failed: number;
3124
+ };
3125
+ errors?: {
3126
+ data?: Array<{
3127
+ message?: string;
3128
+ code?: string;
3129
+ }>;
3130
+ };
3131
+ }
3132
+ export interface BatchList extends Record<string, unknown> {
3133
+ data: BatchJob[];
3134
+ first_id?: string;
3135
+ last_id?: string;
3136
+ has_more: boolean;
3137
+ }
3138
+ export interface BatchCreateParams {
3139
+ input_file_id: string;
3140
+ endpoint: BatchEndpoint;
3141
+ completion_window: string;
3142
+ metadata?: Record<string, string>;
3143
+ }
3144
+ export interface BatchReport {
3145
+ records: number;
3146
+ bytes: number;
3147
+ model: string;
3148
+ endpoint: BatchEndpoint;
3149
+ warnings: string[];
3150
+ }
3151
+ //#endregion
3152
+ //#region src/batch/validate.d.ts
3153
+ export declare const MAX_BATCH_BYTES: number;
3154
+ export declare const MAX_BATCH_LINE_BYTES: number;
3155
+ export declare const MAX_BATCH_RECORDS = 50000;
3156
+ export type BatchSource = string | Blob | AsyncIterable<Uint8Array>;
3157
+ export declare function batchUsage(english: string, chinese: string): never;
3158
+ export declare function batchIoError(error: unknown): BailianError;
3159
+ export declare function batchObject(value: unknown): value is Record<string, unknown>;
3160
+ export declare function parseBatchEndpoint(value: string): BatchEndpoint;
3161
+ export declare function batchChunks(source: BatchSource): AsyncGenerator<Uint8Array>;
3162
+ export declare function batchLines(source: BatchSource, maxBytes?: number, maxLineBytes?: number): AsyncGenerator<{
3163
+ text: string;
3164
+ bytes: number;
3165
+ }>;
3166
+ export declare class BatchValidator {
3167
+ private ids;
3168
+ private thinking;
3169
+ private report;
3170
+ private warn;
3171
+ add(value: unknown, bytes: number): void;
3172
+ finish(): BatchReport;
3173
+ }
3174
+ export declare function validateBatch(source: BatchSource): Promise<BatchReport>;
3175
+ export declare function readBatchBlob(file: string): Promise<Blob>;
3176
+ //#endregion
3177
+ //#region src/batch/api.d.ts
3178
+ export declare function createBatch(client: Client, body: BatchCreateParams, signal?: AbortSignal): Promise<BatchJob>;
3179
+ export declare function getBatch(client: Client, batchId: string, signal?: AbortSignal): Promise<BatchJob>;
3180
+ export declare function cancelBatch(client: Client, batchId: string, signal?: AbortSignal): Promise<BatchJob>;
3181
+ export interface BatchListParams {
3182
+ limit?: number;
3183
+ after?: string;
3184
+ ds_name?: string;
3185
+ input_file_ids?: string[];
3186
+ status?: string[];
3187
+ create_after?: string;
3188
+ create_before?: string;
3189
+ }
3190
+ export declare function listBatches(client: Client, params?: BatchListParams, signal?: AbortSignal): Promise<BatchList>;
3191
+ export declare function getBatchFileContent(client: Client, fileId: string, signal?: AbortSignal): Promise<Response>;
3192
+ export declare function resolveBatchChatEndpoint(client: Client): string;
3193
+ //#endregion
3194
+ //#region src/batch/csv.d.ts
3195
+ export interface PrepareBatchParams {
3196
+ file: string;
3197
+ outputFile: string;
3198
+ model: string;
3199
+ endpoint?: BatchEndpoint;
3200
+ idColumn?: string;
3201
+ inputColumn?: string;
3202
+ system?: string;
3203
+ bodyFile?: string;
3204
+ force?: boolean;
3205
+ dryRun?: boolean;
3206
+ }
3207
+ export declare function prepareBatch(params: PrepareBatchParams): Promise<BatchReport & {
3208
+ output_file: string;
3209
+ ignored_columns: string[];
3210
+ samples?: BatchRequest[];
3211
+ }>;
3212
+ export declare const BATCH_CSV_COLUMNS: readonly ["custom_id", "model", "request_id", "status_code", "content", "embedding", "error_code", "error_message", "prompt_tokens", "completion_tokens", "total_tokens"];
3213
+ export declare function projectBatchCsv(value: unknown): {
3214
+ row: Record<string, string | number>;
3215
+ recognized: boolean;
3216
+ };
3217
+ export declare function exportBatchCsv(files: string[], outputFile: string, force?: boolean): Promise<{
3218
+ records: number;
3219
+ unknown_records: number;
3220
+ }>;
3221
+ //#endregion
3222
+ //#region src/batch/files.d.ts
3223
+ export declare function writeBatchFile(path: string, chunks: AsyncIterable<string | Uint8Array>, force?: boolean): Promise<void>;
3224
+ //#endregion
3225
+ //#region src/batch/examples.d.ts
3226
+ export declare function batchExamples(language: "en-US" | "zh-CN"): {
3227
+ csv: string;
3228
+ chat: BatchRequest;
3229
+ embedding: BatchRequest;
3230
+ vision: BatchRequest;
3231
+ defaults: {
3232
+ enable_thinking: boolean;
3233
+ max_tokens: number;
3234
+ };
3235
+ success: {
3236
+ custom_id: string;
3237
+ response: {
3238
+ request_id: string;
3239
+ status_code: number;
3240
+ body: {
3241
+ model: string;
3242
+ choices: {
3243
+ message: {
3244
+ role: string;
3245
+ content: string;
3246
+ };
3247
+ }[];
3248
+ usage: {
3249
+ prompt_tokens: number;
3250
+ completion_tokens: number;
3251
+ total_tokens: number;
3252
+ };
3253
+ };
3254
+ };
3255
+ error: null;
3256
+ };
3257
+ failure: {
3258
+ custom_id: string;
3259
+ response: null;
3260
+ error: {
3261
+ code: string;
3262
+ message: string;
3263
+ };
3264
+ };
3265
+ };
3266
+ export declare function batchDataNotes(kind: "prepare" | "convert" | "create" | "download"): {
3267
+ "en-US": string;
3268
+ "zh-CN": string;
3269
+ };
3270
+ //#endregion
3016
3271
  //#region src/decision/questions.d.ts
3017
3272
  /**
3018
3273
  * 决策模型(TypeSafe System One)问题定义与 state 的结构校验。
@@ -4623,6 +4878,511 @@ interface TrackingDeps {
4623
4878
  }
4624
4879
  export declare function trackCommandExecution(deps: TrackingDeps, commandPath: string[], flags: Record<string, unknown>, fn: () => Promise<void>): Promise<void>;
4625
4880
  //#endregion
4881
+ //#region src/advisor/engine/specs.d.ts
4882
+ /** Human-readable capability/pricing info surfaced alongside each recommendation. */
4883
+ interface ModelSpecs {
4884
+ /** Formatted price lines, e.g. "输入 12 / 每百万tokens". */
4885
+ pricing: string[];
4886
+ contextWindow?: number;
4887
+ maxInputTokens?: number;
4888
+ maxOutputTokens?: number;
4889
+ /** Capability features, e.g. function-calling, structured-outputs. */
4890
+ features: string[];
4891
+ }
4892
+ //#endregion
4893
+ //#region src/advisor/engine/types.d.ts
4894
+ type Modality$1 = "Text" | "Image" | "Video" | "Audio";
4895
+ type Complexity$1 = "single" | "pipeline";
4896
+ type Budget$1 = "low" | "medium" | "high";
4897
+ type ContextNeed$1 = "standard" | "large" | "extra-large";
4898
+ type QualityPreference$1 = "flagship" | "balanced" | "cost-optimized";
4899
+ type FamilyTier = "flagship" | "balanced" | "lightweight";
4900
+ type PreferenceMode$1 = "unconstrained" | "scoped" | "comparison" | "alternative";
4901
+ /** Dimension 3: how many results? → decides Rank truncation */
4902
+ type Cardinality = "one" | "few" | "many";
4903
+ type OptimizeDimension = "price" | "speed" | "context" | "quality";
4904
+ interface Clarify {
4905
+ question: string;
4906
+ options: string[];
4907
+ defaultIfSkip: string;
4908
+ impact: string;
4909
+ }
4910
+ type RecallStrategy = "template" | "structured" | "forced" | "holistic-pool";
4911
+ type ScoreStrategy = "none" | "formula" | "holistic";
4912
+ type RankStrategy = "template-order" | "score-sort" | "forced-order";
4913
+ type ExplainStrategy = "template-text" | "llm-generate" | "llm-compare" | "catalog";
4914
+ interface ExecutionPlan {
4915
+ recall: RecallStrategy;
4916
+ score: ScoreStrategy;
4917
+ rank: RankStrategy;
4918
+ explain: ExplainStrategy;
4919
+ fairness: boolean;
4920
+ topN: number;
4921
+ routingReason: string;
4922
+ /**
4923
+ * Multi-step task: run recall/score/rank once per intent segment and return
4924
+ * per-step recommendations instead of one flat slate (topN applies per step).
4925
+ */
4926
+ stepwise?: boolean;
4927
+ /** Set when Router detects high-impact ambiguity; pipeline short-circuits. */
4928
+ clarify?: Clarify;
4929
+ }
4930
+ interface ModelPrice$1 {
4931
+ type: string;
4932
+ unit: string;
4933
+ price: string;
4934
+ }
4935
+ interface PipelineRole {
4936
+ from: Modality$1;
4937
+ to: Modality$1;
4938
+ role: string;
4939
+ }
4940
+ /** LLM-compiled wiki profile embedded in models.jsonl records. */
4941
+ interface ModelWikiProfile {
4942
+ profileCompleteness: "full" | "partial" | "structured-only";
4943
+ oneLinePositioning?: string;
4944
+ scenes?: string[];
4945
+ notSuitableFor?: string[];
4946
+ styleKeywords?: string[];
4947
+ familyTier?: FamilyTier | null;
4948
+ familyComparison?: string | null;
4949
+ openSource?: boolean;
4950
+ callModes?: string[];
4951
+ pipelineRole?: PipelineRole[];
4952
+ }
4953
+ interface ModelProfile$1 {
4954
+ model: string;
4955
+ name: string;
4956
+ description: string;
4957
+ provider: string;
4958
+ capabilities: string[];
4959
+ features: string[];
4960
+ contextWindow?: number;
4961
+ maxOutputTokens?: number;
4962
+ maxInputTokens?: number;
4963
+ docUrl?: string;
4964
+ inferenceMetadata?: {
4965
+ request_modality?: Modality$1[];
4966
+ response_modality?: Modality$1[];
4967
+ };
4968
+ prices?: ModelPrice$1[];
4969
+ versionTag?: string;
4970
+ family?: string;
4971
+ familyName?: string;
4972
+ profile?: ModelWikiProfile;
4973
+ }
4974
+ /** Family-level data from families.jsonl (loaded on demand). */
4975
+ interface FamilyProfile {
4976
+ slug: string;
4977
+ name: string;
4978
+ description: string;
4979
+ primaryCapability: string;
4980
+ capabilities: string[];
4981
+ itemCount: number;
4982
+ items: {
4983
+ model: string;
4984
+ name: string;
4985
+ contextWindow?: number;
4986
+ capabilities: string[];
4987
+ }[];
4988
+ maxContextWindow?: number;
4989
+ }
4990
+ interface ModelPreference$1 {
4991
+ mode: PreferenceMode$1;
4992
+ targets?: string[];
4993
+ excludes?: string[];
4994
+ }
4995
+ interface IntentSegment$1 {
4996
+ step: string;
4997
+ /** Scene label (from the 33-scene enum) of this step, e.g. 创意写作 for a script step; optional. */
4998
+ scene?: string;
4999
+ inputModality: Modality$1[];
5000
+ outputModality: Modality$1[];
5001
+ requiredCapabilities: string[];
5002
+ }
5003
+ interface IntentProfile {
5004
+ /** Single model task or multi-step pipeline; feeds the router's `pipeline` flag and ambiguity short-circuits. */
5005
+ complexity: Complexity$1;
5006
+ /** Pipeline-only step decomposition; each segment's modalities must chain (output of one = input of next). */
5007
+ segments?: IntentSegment$1[];
5008
+ /** One-sentence English summary of the core need; injected into explain prompts as task context. */
5009
+ taskSummary: string;
5010
+ /** Unstructured hints (e.g. "low-latency", "consumer-facing"); merged with matchedScenes as hard-filter signals. */
5011
+ scenarioHints: string[];
5012
+ /** Input modalities; hard-filter matching and ambiguity detection (known output + missing input triggers clarify). */
5013
+ inputModality: Modality$1[];
5014
+ /** Output modalities; same consumers as inputModality. */
5015
+ outputModality: Modality$1[];
5016
+ /** Capability codes (TG, IG, VG, TTS, ASR...); hard-filter matching and cross-domain ambiguity detection. */
5017
+ requiredCapabilities: string[];
5018
+ /** Feature requirements (function-calling, web-search, structured-outputs, prefix-completion); hard-filter matching. */
5019
+ requiredFeatures: string[];
5020
+ /** Cost bound; defaults to "medium". Drives score budgetFit and recall tier sorting. */
5021
+ budget: Budget$1;
5022
+ /** Context window need; drives score contextFit thresholds (unknown model context = no penalty). */
5023
+ contextNeed: ContextNeed$1;
5024
+ /** Quality/price trade-off; defaults to "balanced". Drives score tierFit and recall sorting. */
5025
+ qualityPreference: QualityPreference$1;
5026
+ /** Scene labels from the 33-scene enum (exact Chinese labels, max 3 by relevance); drives routing sceneHit, hard-filter scene match, explain context. */
5027
+ matchedScenes: string[];
5028
+ /** Mapping confidence [0,1]; 1.0 exact, 0.5 inferred, 0 none. Drives sceneHit (>= 0.8) and fuzzy (< 0.5) in the router. */
5029
+ sceneConfidence: number;
5030
+ /** Models/families the user named: scoped range, comparison, alternative, or explicit excludes; drives anchor detection and forced recall. */
5031
+ modelPreference?: ModelPreference$1;
5032
+ /** Result count inferred from wording ("the cheapest" -> one, "list all" -> many); defaults to "few" in the router. */
5033
+ cardinalityHint?: Cardinality;
5034
+ /** Single-dimension extreme ("fastest" -> speed); switches the router to optimize intent and pure-dimension scoring weights. */
5035
+ optimizeDimension?: OptimizeDimension;
5036
+ /** 1 = intent LLM succeeded; 0 = LLM call failed and this profile is DEFAULT_INTENT (conservative defaults). */
5037
+ confidence: number;
5038
+ }
5039
+ /** primary/runner-up/exploration: single-task tier slots; primary/alternative: per-step slots of a multi-step plan. */
5040
+ type Slot = "primary" | "runner-up" | "exploration" | "alternative";
5041
+ type ConfidenceLevel = "high" | "medium" | "low";
5042
+ interface Recommendation {
5043
+ model: string;
5044
+ name: string;
5045
+ reason: string;
5046
+ highlights: string[];
5047
+ confidence: ConfidenceLevel;
5048
+ slot: Slot;
5049
+ docUrl?: string;
5050
+ /** 1-based step index when the recommendation belongs to a multi-step plan. */
5051
+ step?: number;
5052
+ /** Pricing and capability details surfaced to the user. */
5053
+ specs?: ModelSpecs;
5054
+ }
5055
+ /** Recommendations for one step of a multi-step task. */
5056
+ interface StepRecommendation {
5057
+ /** 1-based position in the chain. */
5058
+ index: number;
5059
+ /** Step label from intent analysis (e.g. "剧本创作"). */
5060
+ step: string;
5061
+ inputModality: Modality$1[];
5062
+ outputModality: Modality$1[];
5063
+ /** Capability codes the step was matched on. */
5064
+ capabilities: string[];
5065
+ /** Primary first, then the alternative. */
5066
+ recommendations: Recommendation[];
5067
+ /** Candidates that passed this step's gate. */
5068
+ candidatePool: number;
5069
+ confidence: ConfidenceLevel;
5070
+ /** How strictly candidates were gated: full modality match, relaxed input, or capability only. */
5071
+ gate: "strict" | "relaxed-input" | "capability-only";
5072
+ }
5073
+ interface RecommendSuccess {
5074
+ type: "result";
5075
+ recommendations: Recommendation[];
5076
+ confidence: ConfidenceLevel;
5077
+ routingReason: string;
5078
+ candidatePool: number;
5079
+ intent: IntentProfile;
5080
+ /** Non-fatal LLM fallbacks during this run; empty when every LLM stage succeeded. */
5081
+ degradations: Degradation[];
5082
+ /**
5083
+ * Multi-step tasks only: per-step recommendations in chain order.
5084
+ * `recommendations` then holds the same items flattened (each tagged with `step`).
5085
+ */
5086
+ steps?: StepRecommendation[];
5087
+ /** Hand-off problems between adjacent steps (e.g. a step's output modality the next model can't take). */
5088
+ warnings?: string[];
5089
+ }
5090
+ interface RecommendClarify {
5091
+ type: "need_clarify";
5092
+ question: string;
5093
+ options: string[];
5094
+ defaultIfSkip: string;
5095
+ impact: string;
5096
+ intent: IntentProfile;
5097
+ }
5098
+ type RecommendResult = RecommendSuccess | RecommendClarify;
5099
+ interface RecommendDeps {
5100
+ signal?: AbortSignal;
5101
+ llm: LLMClient;
5102
+ catalog: () => Promise<ModelProfile$1[]>;
5103
+ families?: () => Promise<Map<string, FamilyProfile>>;
5104
+ verbose?: boolean;
5105
+ /** When provided, the engine appends decision-log lines here (--think). */
5106
+ decisionLog?: string[];
5107
+ /** When > 0, overrides the router's default slate size (`--top`). */
5108
+ topN?: number;
5109
+ }
5110
+ interface Message {
5111
+ role: "system" | "user" | "assistant" | "tool";
5112
+ content: string;
5113
+ tool_call_id?: string;
5114
+ tool_calls?: ToolCall[];
5115
+ }
5116
+ interface ToolCall {
5117
+ id: string;
5118
+ type: "function";
5119
+ function: {
5120
+ name: string;
5121
+ arguments: string;
5122
+ };
5123
+ }
5124
+ interface ToolDef {
5125
+ type: "function";
5126
+ function: {
5127
+ name: string;
5128
+ description: string;
5129
+ parameters: Record<string, unknown>;
5130
+ };
5131
+ }
5132
+ interface ToolResponse {
5133
+ content: string;
5134
+ toolCalls: ToolCall[];
5135
+ }
5136
+ interface LLMCallOptions {
5137
+ model?: string;
5138
+ stage?: string;
5139
+ signal?: AbortSignal;
5140
+ temperature?: number;
5141
+ maxTokens?: number;
5142
+ }
5143
+ interface LLMClient {
5144
+ chat(messages: Message[], opts?: LLMCallOptions): Promise<string>;
5145
+ chatJson<T>(messages: Message[], opts?: LLMCallOptions): Promise<T>;
5146
+ chatWithTools(messages: Message[], tools: ToolDef[], opts?: LLMCallOptions): Promise<ToolResponse>;
5147
+ }
5148
+ /** Structured degradation for JSON output / programmatic consumers. */
5149
+ interface Degradation {
5150
+ stage: string;
5151
+ fallback: string;
5152
+ kind: string;
5153
+ status?: number;
5154
+ message: string;
5155
+ }
5156
+ //#endregion
5157
+ //#region src/advisor/engine/pipeline.d.ts
5158
+ /**
5159
+ * Deterministic recommendation pipeline:
5160
+ * intent → route (with ambiguity short-circuit) → recall → score →
5161
+ * rank (+fairness) → explain
5162
+ * Multi-step tasks (route "pipeline-steps") run recall/score/select per
5163
+ * intent segment instead and return `steps`.
5164
+ * Exactly the engine; no user interaction. The agent layer wraps this.
5165
+ */
5166
+ declare function recommend(input: string, deps: RecommendDeps, presetIntent?: IntentProfile): Promise<RecommendResult>;
5167
+ //#endregion
5168
+ //#region src/advisor/engine/interaction/index.d.ts
5169
+ interface AskOptions {
5170
+ signal?: AbortSignal;
5171
+ question: string;
5172
+ options: string[];
5173
+ defaultIfSkip: string;
5174
+ }
5175
+ interface Interaction {
5176
+ ask(opts: AskOptions): Promise<string>;
5177
+ }
5178
+ /**
5179
+ * TTY interaction: numbered choice prompt via readline.
5180
+ * The user can pick a number, press Enter for the default, or type a
5181
+ * free-text description of their need (fed verbatim into the engine input).
5182
+ */
5183
+ export declare function createReadlineInteraction(): Interaction;
5184
+ /** Non-TTY degradation: always answer with the default, note it on stderr. */
5185
+ export declare function createNonInteractive(): Interaction;
5186
+ //#endregion
5187
+ //#region src/advisor/engine/skills/loader.d.ts
5188
+ interface SkillMeta$1 {
5189
+ /** Skill identifier (directory name or frontmatter name). */
5190
+ name: string;
5191
+ /** What the skill does and when to use it — the trigger signal for the model. */
5192
+ description: string;
5193
+ /** Absolute path to the skill directory (basePath for relative file access). */
5194
+ basePath: string;
5195
+ }
5196
+ //#endregion
5197
+ //#region src/advisor/engine/tools.d.ts
5198
+ interface ToolDeps extends RecommendDeps {
5199
+ interaction: Interaction;
5200
+ /** Real-time progress events (skill matched/loaded, files read) surfaced to the user. */
5201
+ onProgress?: (event: string) => void;
5202
+ }
5203
+ /** One answered clarification question. */
5204
+ interface Clarification {
5205
+ question: string;
5206
+ answer: string;
5207
+ }
5208
+ /**
5209
+ * Per-run state owned by code, not by the LLM. The engine input is always
5210
+ * rebuilt from the user's original wording plus recorded clarification
5211
+ * answers, so the agent can never paraphrase away the user's constraints.
5212
+ */
5213
+ interface RecommendSession {
5214
+ /** The user's original request, verbatim. */
5215
+ originalInput: string;
5216
+ clarifications: Clarification[];
5217
+ /** Currently active skill (set by use_skill, used by read_file for path resolution). */
5218
+ activeSkill?: SkillMeta$1;
5219
+ }
5220
+ export declare function createSession(originalInput: string): RecommendSession;
5221
+ /** Deterministic engine input: original wording + clarification answers (if any). */
5222
+ export declare function buildEngineInput(session: RecommendSession): string;
5223
+ /**
5224
+ * Capability-level tools exposed to the agent loop.
5225
+ * Granularity rule: expose only points where the agent has genuinely
5226
+ * different next actions; internals (filters, formulas) stay hidden.
5227
+ */
5228
+ export declare const RECOMMEND_TOOLS: ToolDef[];
5229
+ interface ToolExecution {
5230
+ /** JSON payload fed back to the LLM. */
5231
+ result: string;
5232
+ /** Set when the recommend tool produced a final result (for output). */
5233
+ recommendResult?: RecommendResult;
5234
+ }
5235
+ /**
5236
+ * Execute one tool call. Unknown tools return an error payload (agent self-corrects).
5237
+ * ask_user answers are recorded on the session; recommend ignores any LLM-supplied
5238
+ * arguments and runs on buildEngineInput(session).
5239
+ */
5240
+ export declare function dispatchTool(call: ToolCall, deps: ToolDeps, session: RecommendSession): Promise<ToolExecution>;
5241
+ //#endregion
5242
+ //#region src/advisor/engine/agent/loop.d.ts
5243
+ /** One recorded agent action, used by the eval harness for trajectory assertions. */
5244
+ interface TrajectoryEvent {
5245
+ turn: number;
5246
+ type: "tool_call" | "tool_result" | "final_answer" | "fallback" | "cancelled" | "error";
5247
+ tool?: string;
5248
+ callId?: string;
5249
+ status?: "success" | "error" | "rejected" | "cancelled";
5250
+ reason?: string;
5251
+ result?: Record<string, unknown>;
5252
+ degradations?: Degradation[];
5253
+ /** Parsed tool arguments (verbatim from the model). */
5254
+ args?: Record<string, unknown>;
5255
+ /** The "type" field of the tool result JSON, when present. */
5256
+ resultType?: string;
5257
+ }
5258
+ interface AgentResult {
5259
+ finalText: string;
5260
+ recommendResult?: RecommendResult;
5261
+ turns: number;
5262
+ /** Agent-layer fallbacks (engine-stage fallbacks live on recommendResult.degradations). */
5263
+ degradations: Degradation[];
5264
+ /** Full action trace for evaluation (tool calls in order + terminal event). */
5265
+ trajectory: TrajectoryEvent[];
5266
+ }
5267
+ /**
5268
+ * Bounded tool-call loop (NOT an autonomous agent): the LLM may only call
5269
+ * pre-registered tools; all branching and termination is code-controlled.
5270
+ * Degrades to the bare engine when the tool-calling LLM fails.
5271
+ */
5272
+ export declare function agentLoop(input: string, deps: ToolDeps, onTrajectory?: (event: TrajectoryEvent) => void): Promise<AgentResult>;
5273
+ //#endregion
5274
+ //#region src/advisor/engine/llm/client.d.ts
5275
+ /** Model used by every LLM stage (agent, intent, holistic score, explain) unless --model overrides it. */
5276
+ export declare const DEFAULT_LLM_MODEL = "qwen-flash-2025-07-28";
5277
+ interface LLMClientOptions {
5278
+ baseUrl: string;
5279
+ apiKey: string;
5280
+ /** Default model for chat/chatJson calls. */
5281
+ defaultModel?: string;
5282
+ timeoutMs?: number;
5283
+ /** When true, requests include enable_thinking and reasoning_content is captured. */
5284
+ enableThinking?: boolean;
5285
+ /**
5286
+ * Stage names whose calls run in thinking mode (streamed, enable_thinking).
5287
+ * Defaults to none; set to ["intent"] to think only during intent analysis.
5288
+ */
5289
+ thinkingStages?: readonly string[];
5290
+ /** Mutable array; the client pushes { stage, content } after each call that returns reasoning. */
5291
+ thinkingLog?: {
5292
+ stage: string;
5293
+ content: string;
5294
+ }[];
5295
+ /** When set (with enableThinking), chat() streams and invokes this for every reasoning chunk as it arrives. */
5296
+ onThinking?: (stage: string, chunk: string) => void;
5297
+ /** 每次实际 HTTP 尝试均通知,包含 JSON 重试和引擎内部调用。 */
5298
+ onRequest?: (stage: string) => void;
5299
+ }
5300
+ /**
5301
+ * Self-contained OpenAI-compatible LLM client over fetch.
5302
+ * Kept free of bailian-cli-core imports so the engine compiles standalone;
5303
+ * the command layer wires it up from ctx.client.baseUrl + credentials.
5304
+ */
5305
+ export declare function createLLMClient(options: LLMClientOptions): LLMClient;
5306
+ //#endregion
5307
+ //#region src/advisor/engine/llm/errors.d.ts
5308
+ /**
5309
+ * Classified LLM failure. The engine stays free of bailian-cli-core, so the
5310
+ * command layer maps this onto host-native errors (ctx.errors).
5311
+ */
5312
+ type LLMErrorKind = "rate_limit" | "auth" | "http" | "timeout" | "cancelled" | "network" | "parse";
5313
+ /** Pipeline stage where the failure happened (set by the caller that caught it). */
5314
+ type LLMStage = "intent" | "holistic-score" | "explain" | "agent";
5315
+ interface LLMErrorInit {
5316
+ status?: number;
5317
+ code?: string;
5318
+ requestId?: string;
5319
+ stage?: LLMStage;
5320
+ cause?: unknown;
5321
+ }
5322
+ export declare class LLMError extends Error {
5323
+ readonly kind: LLMErrorKind;
5324
+ readonly status?: number;
5325
+ readonly code?: string;
5326
+ readonly requestId?: string;
5327
+ stage?: LLMStage;
5328
+ constructor(kind: LLMErrorKind, message: string, init?: LLMErrorInit);
5329
+ /**
5330
+ * Fatal = retrying the same request right away will fail the same way
5331
+ * (quota exhausted, bad credentials). Callers must not fall back to
5332
+ * re-running the engine on a fatal error — it only burns more quota.
5333
+ */
5334
+ get fatal(): boolean;
5335
+ /** Short tag for trace/degradation strings, e.g. "429 rate_limit". */
5336
+ get tag(): string;
5337
+ }
5338
+ /** Minimal structural view of a degradation entry (mirrors types.ts Degradation, avoids an import cycle). */
5339
+ interface DegradationEntry {
5340
+ stage: string;
5341
+ fallback: string;
5342
+ kind: string;
5343
+ status?: number;
5344
+ message: string;
5345
+ }
5346
+ /** One-line form used in the `[recommend] ... degraded=` log, e.g. "llm-generate→template-text (429 rate_limit)". */
5347
+ export declare function formatDegradation(entry: DegradationEntry): string;
5348
+ //#endregion
5349
+ //#region src/advisor/engine/data/catalog.d.ts
5350
+ /** Load models.jsonl (with embedded wiki profile). Process-lifetime cache. */
5351
+ export declare function loadCatalog(dir?: string): Promise<ModelProfile$1[]>;
5352
+ /** Load families.jsonl on demand (upgrade/compare/explain scenarios). */
5353
+ export declare function loadFamilies(dir?: string): Promise<Map<string, FamilyProfile>>;
5354
+ /** Test hook: reset process-lifetime caches. */
5355
+ export declare function resetCatalogCache(): void;
5356
+ //#endregion
5357
+ //#region src/advisor/engine/router/index.d.ts
5358
+ /**
5359
+ * Router: pure synchronous strategy selector.
5360
+ * Step 0: ambiguity short-circuit.
5361
+ * Step 1: evaluate 4 dimensions into a RouteContext.
5362
+ * Step 2: first-match routing table → ExecutionPlan.
5363
+ *
5364
+ * @param topNOverride When provided, overrides the per-rule default slate size
5365
+ * (`--top`). Clarification plans carry no slate, so they ignore the override.
5366
+ */
5367
+ declare function route(intent: IntentProfile, models: ModelProfile$1[], topNOverride?: number): ExecutionPlan;
5368
+ //#endregion
5369
+ //#region src/advisor/engine/intent/index.d.ts
5370
+ /**
5371
+ * Analyze user input into a structured IntentProfile via one LLM call.
5372
+ * Throws a classified LLMError (stage "intent") on failure. It no longer
5373
+ * degrades to DEFAULT_INTENT silently: every downstream stage depends on
5374
+ * the intent, and a default intent produced confident-looking but
5375
+ * unrelated recommendations (price-only ranking) that hid the real cause.
5376
+ */
5377
+ declare function analyzeIntent(llm: LLMClient, input: string, signal?: AbortSignal): Promise<IntentProfile>;
5378
+ //#endregion
5379
+ //#region src/advisor/sync.d.ts
5380
+ /**
5381
+ * Check and sync Wiki data. Runs silently; never throws.
5382
+ * @returns Whether data was actually updated (for testing/debugging)
5383
+ */
5384
+ export declare function maybeSyncWikiData(): Promise<boolean>;
5385
+ //#endregion
4626
5386
  //#region src/advisor/types.d.ts
4627
5387
  type Modality = "Text" | "Image" | "Video" | "Audio";
4628
5388
  type Complexity = "single" | "pipeline";
@@ -4696,7 +5456,7 @@ interface IntentSegment {
4696
5456
  outputModality: Modality[];
4697
5457
  requiredCapabilities: Capability[];
4698
5458
  }
4699
- interface IntentProfile {
5459
+ interface IntentProfile$1 {
4700
5460
  complexity: Complexity;
4701
5461
  segments?: IntentSegment[];
4702
5462
  taskSummary: string;
@@ -4779,66 +5539,7 @@ interface PipelineResult {
4779
5539
  summary: string;
4780
5540
  steps: PipelineStep[];
4781
5541
  }
4782
- type RecommendResult = SingleResult | PipelineResult;
4783
- //#endregion
4784
- //#region src/advisor/cache.d.ts
4785
- interface GetModelsOptions {
4786
- onPrepareStart?: () => void;
4787
- }
4788
- export declare function getModels(settings: Settings, options?: GetModelsOptions): Promise<ModelProfile[]>;
4789
- //#endregion
4790
- //#region src/advisor/constants/scoring.d.ts
4791
- export declare const SEMANTIC_TOP_K = 20;
4792
- //#endregion
4793
- //#region src/advisor/intent.d.ts
4794
- /**
4795
- * Analyze the user's input to produce an IntentProfile.
4796
- *
4797
- * Calls `qwen3.6-flash` via the OpenAI-compatible chat endpoint to extract
4798
- * structured intent fields: taskSummary, modalities, capabilities, budget,
4799
- * qualityPreference, modelPreference (mode/targets/excludes), and more.
4800
- *
4801
- * On failure, degrades gracefully to DEFAULT_INTENT with confidence 0.
4802
- */
4803
- export declare function analyzeIntent(client: Client, input: string): Promise<IntentProfile>;
4804
- //#endregion
4805
- //#region src/advisor/recall.d.ts
4806
- interface ScoredCandidate {
4807
- model: ModelProfile;
4808
- score: number;
4809
- /** Normalized [0,1] preference-satisfaction score (capability/feature/context/quality). */
4810
- hardScore?: number;
4811
- /** Cosine similarity [0,1] between the semantic query and the model embedding. */
4812
- softScore?: number;
4813
- }
4814
- export declare function recallCandidates(models: ModelProfile[], intent: IntentProfile): ScoredCandidate[];
4815
- //#endregion
4816
- //#region src/advisor/recall-semantic.d.ts
4817
- export declare function isSemanticAvailable(): boolean;
4818
- export declare function recallSemantic(client: Client, models: ModelProfile[], query: string, topK: number, intent?: IntentProfile): Promise<ScoredCandidate[]>;
4819
- //#endregion
4820
- //#region src/advisor/recommend.d.ts
4821
- interface RecommendOptions {
4822
- onThinking?: (text: string) => void;
4823
- onContentStart?: () => void;
4824
- enableThinking?: boolean;
4825
- }
4826
- export declare function buildDocLink(docUrl?: string): string | undefined;
4827
- export declare function rankModels(client: Client, candidates: ScoredCandidate[], intent: IntentProfile, userInput: string, top: number, options?: RecommendOptions): Promise<RecommendResult>;
4828
- //#endregion
4829
- //#region src/advisor/sync.d.ts
4830
- /**
4831
- * Check and sync Wiki data. Runs silently; never throws.
4832
- * @returns Whether data was actually updated (for testing/debugging)
4833
- */
4834
- export declare function maybeSyncWikiData(): Promise<boolean>;
4835
- //#endregion
4836
- //#region src/advisor/sources/types.d.ts
4837
- interface ModelSource {
4838
- name: string;
4839
- available(): boolean;
4840
- load(): Promise<ModelProfile[]>;
4841
- }
5542
+ type RecommendResult$1 = SingleResult | PipelineResult;
4842
5543
  //#endregion
4843
5544
  //#region src/install/method.d.ts
4844
5545
  /** How the CLI was installed on this machine. */
@@ -5254,4 +5955,4 @@ export declare function installSkillWithFanout(name: string, entry: SkillIndexEn
5254
5955
  export declare function listSkillDirsOnDisk(): string[];
5255
5956
  export declare function computeSkillStatuses(index: SkillsIndex, lock: SkillLockFile, diskNames: string[]): SkillStatusRow[];
5256
5957
  //#endregion
5257
- export type { AcsQueryParams, AcsSignConfig, AgentTarget, AnyCommand, ApiErrorBody, ApiKeyCredential, ApiKeyLoginKind, ApiKeyResolutionSourceSelection, AppCompletionRequest, AppCompletionResponse, AppStreamChunk, AsrApiKind, AsrApiRoute, AsrContextMessage, AsrFlashFamily, AuthPersistPatch, AuthRequirement, AuthState, AuthStore, BailianControlAuth, Budget, BuildAsrFlashRequestOpts, CallerAttribution, Capability, ChatChoice, ChatMessage, ChatMessageContent, ChatRequest, ChatResponse, ChatResponseFormat, ChatTool, ClientOpenApiJsonOpts, ClientOpenApiQueryOpts, ClientRequestOpts, Command, CommandContext, CommandPack, CommandPackApiKeyContext, CommandPackCommand, CommandPackContext, CommandPackCredentials, CommandPackErrorOptions, CommandPackErrors, CommandPackManager, CommandPackMeta, CommandPackMutationResult, CommandPackOutput, CommandPackOutputOptions, CommandPackReport, CommandRisk, CommandRiskLevel, Complexity, ConfigFile, ConfigProfiles, ConfigStore, ConnectBailianMcpOptions, ConsoleCall, ConsoleCredential, ConsoleGatewayRequest, ConsoleGatewayTarget, ConsoleSite, ContextNeed, CreateUserReqDTO, CredentialSource, DashScopeASRRequest, DashScopeASRTaskResult, DashScopeASRTranscriptionItem, DashScopeAsyncResponse, DashScopeImageRequest, DashScopeImageSyncResponse, DashScopeTTSRequest, DashScopeTTSResponse, DashScopeTTSStreamChunk, DashScopeTaskResponse, DashScopeVideoEditRequest, DashScopeVideoRefRequest, DashScopeVideoRequest, DataModality, DatasetSchema, FanoutOutcome, Feature, FetchImplementation, FlagDef, FlagsDef, GetModelsOptions, HttpDeps, Identity, ImageApiKind, ImageApiRoute, ImageInputStyle, ImageSizeProfile, InstallMethod, InstallMethodIdentity, InstalledSkill, IntentProfile, IntentSegment, KnowledgeChatContentPart, KnowledgeChatMessage, KnowledgeChatRequest, KnowledgeChatStreamChunk, KnowledgeSearchRequest, KnowledgeSearchResponse, Language, LinkResult, LocalizedText, McpConnectedClient, McpTool, McpToolResult, MemoryAddAsyncResponse, MemoryAddRequest, MemoryContentPart, MemoryEvent, MemoryEventResourceType, MemoryEventResponse, MemoryEventResult, MemoryEventStatus, MemoryExtractScene, MemoryMessage, MemoryNode, MemoryNodeDetailResponse, MemoryNodeListResponse, MemoryNodeUpdateRequest, MemoryPlanVersion, MemorySearchRequest, MemorySearchResponse, MemorySkillExportResponse, MemoryToolCall, MemoryType, Modality, ModelCategory, ModelGroup, ModelGroupItem, ModelGroupParams, ModelGroupResult, ModelListParams, ModelListResult, ModelOfflineInfo, ModelOfflineNotice, ModelPreference, ModelPrice, ModelPriceInfo, ModelProfile, ModelSampleCodeV2, ModelSampleSnippet, ModelSource, OpenApiCredential, OutputFormat, ParsedFlags, PipelineResult, PipelineStep, PredictConfigEntry, PreferenceMode, ProfileAttribute, ProfileSchemaAttribute, ProfileSchemaAttributeOperation, ProfileSchemaCreateRequest, ProfileSchemaCreateResponse, ProfileSchemaDetailResponse, ProfileSchemaListResponse, ProfileSchemaSummary, ProfileSchemaUpdateRequest, QpmLimit, QualityPreference, RagAddCategoryData, RagAddCategoryResponse, RagAddConnectorResponse, RagAddFileData, RagAddFileResponse, RagAgentConfig, RagAgentDetail, RagAgentGetData, RagAgentGetResponse, RagAgentListData, RagAgentListResponse, RagAgentMutationData, RagAgentMutationResponse, RagAgentRow, RagBatchUpdateTagResponse, RagCategory, RagChunkListData, RagChunkListResponse, RagChunkNode, RagChunkNodeMetadata, RagConnectorInfo, RagConnectorResponse, RagCreateIndexV2Data, RagCreateIndexV2Response, RagDataCenterFile, RagDeleteFileData, RagDeleteFileResponse, RagDescribeFileResponse, RagGetConnectorResponse, RagIndexFileRow, RagIndexFilesData, RagIndexFilesResponse, RagIndexJobDoc, RagIndexJobStatusData, RagIndexJobStatusResponse, RagIndexListData, RagIndexListResponse, RagIndexRow, RagJobCreateData, RagJobCreateResponse, RagListCategoryData, RagListCategoryResponse, RagListFileData, RagListFileResponse, RagMonitorData, RagMonitorResponse, RagMutationResponse, RagOssImportData, RagOssImportFileResult, RagOssImportResponse, RagQpsMonitorData, RagResponse, RagStorageMonitorData, RagUploadLeaseData, RagUploadLeaseParam, RagUploadLeaseResponse, RecommendOptions, RecommendResult, RecommendedModel, Region, RequestOpts, ResolutionSources, ResponsesOutputContent, ResponsesOutputItem, ResponsesRequest, ResponsesResponse, ResponsesStreamEvent, ScoredCandidate, SecurityAlert, SecurityAlertList, SecurityOverview, SecurityRiskLevel, SecurityScanStat, SecurityToggle, ServerSentEvent, Settings, SingleResult, SkillIndexEntry, SkillInstallRecord, SkillLockEntry, SkillLockFile, SkillMeta, SkillStatus, SkillStatusRow, SkillsIndex, SourceFlags, StreamChoice, StreamChunk, TrackingDeps, TrackingEvent, TrackingIdentity, TrainingProfile, UserProfileAttribute, UserProfileResponse, UserProfileValueItem, UserProfileValueUpdateRequest, ValidateOpts, ValidationIssue, ValidationResult, ValidationSeverity, ValidationStats, ValidatorSpec, VocabularyEntry, VocabularyEnvelope, VocabularyListItem, VocabularyRequest };
5958
+ 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 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 };