bailian-cli-core 2.6.0 → 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 +696 -70
- package/dist/index.mjs +201 -184
- package/package.json +3 -1
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
|
|
@@ -1664,9 +1665,10 @@ export declare class Client {
|
|
|
1664
1665
|
private toOpts;
|
|
1665
1666
|
request(opts: ClientRequestOpts): Promise<Response>;
|
|
1666
1667
|
requestJson<T>(opts: ClientRequestOpts): Promise<T>;
|
|
1667
|
-
/** Resolve a file arg
|
|
1668
|
+
/** Resolve a file arg, honoring a lazy service default origin just like {@link url}. */
|
|
1668
1669
|
uploadFile(source: string, model: string, opts?: {
|
|
1669
1670
|
signal?: AbortSignal;
|
|
1671
|
+
defaultBaseUrl?: () => string;
|
|
1670
1672
|
}): Promise<string>;
|
|
1671
1673
|
/**
|
|
1672
1674
|
* Resolve an image input while keeping Token Plan's upload limitation isolated.
|
|
@@ -1675,6 +1677,7 @@ export declare class Client {
|
|
|
1675
1677
|
*/
|
|
1676
1678
|
resolveImageInput(source: string, model: string, opts?: {
|
|
1677
1679
|
signal?: AbortSignal;
|
|
1680
|
+
defaultBaseUrl?: () => string;
|
|
1678
1681
|
}): Promise<string>;
|
|
1679
1682
|
usesTokenPlanEndpoint(): boolean;
|
|
1680
1683
|
/** Open an MCP client. Accepts a path (prepended with the model baseUrl) or an absolute URL. */
|
|
@@ -2547,6 +2550,11 @@ interface ServerSentEvent {
|
|
|
2547
2550
|
}
|
|
2548
2551
|
export declare function parseSSE(response: Response): AsyncGenerator<ServerSentEvent>;
|
|
2549
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
|
|
2550
2558
|
//#region src/console/models.d.ts
|
|
2551
2559
|
export declare const MODEL_LIST_API = "zeldaHttp.dashscopeModel./zelda/api/v1/modelCenter/listFoundationModels";
|
|
2552
2560
|
export declare const PREDICT_CONFIG_API = "zeldaEasy.bmp.modelPredictRpcService.getPredictParamConfig";
|
|
@@ -2721,6 +2729,8 @@ export declare function formatText(data: unknown): string;
|
|
|
2721
2729
|
//#region src/files/upload.d.ts
|
|
2722
2730
|
interface UploadOptions {
|
|
2723
2731
|
apiKey: string;
|
|
2732
|
+
/** Model origin used only to resolve the supported regional upload service. Defaults to CN. */
|
|
2733
|
+
baseUrl?: string;
|
|
2724
2734
|
model: string;
|
|
2725
2735
|
filePath: string;
|
|
2726
2736
|
identity: TrackingIdentity;
|
|
@@ -2746,6 +2756,7 @@ export declare function isLocalFile(input: string): boolean;
|
|
|
2746
2756
|
*/
|
|
2747
2757
|
export declare function resolveFileUrl(input: string, apiKey: string, model: string, opts: {
|
|
2748
2758
|
identity: TrackingIdentity;
|
|
2759
|
+
baseUrl?: string;
|
|
2749
2760
|
signal?: AbortSignal;
|
|
2750
2761
|
timeout?: number;
|
|
2751
2762
|
}): Promise<string>;
|
|
@@ -2849,18 +2860,15 @@ export interface DatasetUploadParams {
|
|
|
2849
2860
|
* uploading evaluation or other dataset kinds.
|
|
2850
2861
|
*/
|
|
2851
2862
|
purpose?: string;
|
|
2863
|
+
/** 已由调用方校验的不可变字节;提供时不再读取 filePath。 */
|
|
2864
|
+
fileBlob?: Blob;
|
|
2852
2865
|
signal?: AbortSignal;
|
|
2853
2866
|
}
|
|
2854
2867
|
/**
|
|
2855
2868
|
* POST /compatible-mode/v1/files (multipart/form-data)
|
|
2856
2869
|
*
|
|
2857
|
-
*
|
|
2858
|
-
*
|
|
2859
|
-
* body shim, but the simplest portable approach (and the one used in
|
|
2860
|
-
* `files/upload.ts`) is to wrap the buffer in a Blob. Here we use `Blob`
|
|
2861
|
-
* with a stream-backed lazy `arrayBuffer()` for >50MB files via
|
|
2862
|
-
* `Response`'s helper to avoid the buffer doubling. Fall back to readFileSync
|
|
2863
|
-
* for small files where streaming overhead isn't worth it.
|
|
2870
|
+
* 文件读取通过 Response.blob 聚合,multipart 上传复用 Blob。
|
|
2871
|
+
* 提供 fileBlob 时不再读取源路径,保证校验和上传的字节一致。
|
|
2864
2872
|
*/
|
|
2865
2873
|
export declare function uploadDataset(client: Client, params: DatasetUploadParams): Promise<DatasetFile & {
|
|
2866
2874
|
request_id?: string;
|
|
@@ -3088,6 +3096,178 @@ export declare function parseDatasetSchemaFlag(value: string | undefined): Datas
|
|
|
3088
3096
|
*/
|
|
3089
3097
|
export declare function formatIssue(issue: ValidationIssue): string;
|
|
3090
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
|
|
3091
3271
|
//#region src/decision/questions.d.ts
|
|
3092
3272
|
/**
|
|
3093
3273
|
* 决策模型(TypeSafe System One)问题定义与 state 的结构校验。
|
|
@@ -4698,6 +4878,511 @@ interface TrackingDeps {
|
|
|
4698
4878
|
}
|
|
4699
4879
|
export declare function trackCommandExecution(deps: TrackingDeps, commandPath: string[], flags: Record<string, unknown>, fn: () => Promise<void>): Promise<void>;
|
|
4700
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
|
|
4701
5386
|
//#region src/advisor/types.d.ts
|
|
4702
5387
|
type Modality = "Text" | "Image" | "Video" | "Audio";
|
|
4703
5388
|
type Complexity = "single" | "pipeline";
|
|
@@ -4771,7 +5456,7 @@ interface IntentSegment {
|
|
|
4771
5456
|
outputModality: Modality[];
|
|
4772
5457
|
requiredCapabilities: Capability[];
|
|
4773
5458
|
}
|
|
4774
|
-
interface IntentProfile {
|
|
5459
|
+
interface IntentProfile$1 {
|
|
4775
5460
|
complexity: Complexity;
|
|
4776
5461
|
segments?: IntentSegment[];
|
|
4777
5462
|
taskSummary: string;
|
|
@@ -4854,66 +5539,7 @@ interface PipelineResult {
|
|
|
4854
5539
|
summary: string;
|
|
4855
5540
|
steps: PipelineStep[];
|
|
4856
5541
|
}
|
|
4857
|
-
type RecommendResult = SingleResult | PipelineResult;
|
|
4858
|
-
//#endregion
|
|
4859
|
-
//#region src/advisor/cache.d.ts
|
|
4860
|
-
interface GetModelsOptions {
|
|
4861
|
-
onPrepareStart?: () => void;
|
|
4862
|
-
}
|
|
4863
|
-
export declare function getModels(settings: Settings, options?: GetModelsOptions): Promise<ModelProfile[]>;
|
|
4864
|
-
//#endregion
|
|
4865
|
-
//#region src/advisor/constants/scoring.d.ts
|
|
4866
|
-
export declare const SEMANTIC_TOP_K = 20;
|
|
4867
|
-
//#endregion
|
|
4868
|
-
//#region src/advisor/intent.d.ts
|
|
4869
|
-
/**
|
|
4870
|
-
* Analyze the user's input to produce an IntentProfile.
|
|
4871
|
-
*
|
|
4872
|
-
* Calls `qwen3.6-flash` via the OpenAI-compatible chat endpoint to extract
|
|
4873
|
-
* structured intent fields: taskSummary, modalities, capabilities, budget,
|
|
4874
|
-
* qualityPreference, modelPreference (mode/targets/excludes), and more.
|
|
4875
|
-
*
|
|
4876
|
-
* On failure, degrades gracefully to DEFAULT_INTENT with confidence 0.
|
|
4877
|
-
*/
|
|
4878
|
-
export declare function analyzeIntent(client: Client, input: string): Promise<IntentProfile>;
|
|
4879
|
-
//#endregion
|
|
4880
|
-
//#region src/advisor/recall.d.ts
|
|
4881
|
-
interface ScoredCandidate {
|
|
4882
|
-
model: ModelProfile;
|
|
4883
|
-
score: number;
|
|
4884
|
-
/** Normalized [0,1] preference-satisfaction score (capability/feature/context/quality). */
|
|
4885
|
-
hardScore?: number;
|
|
4886
|
-
/** Cosine similarity [0,1] between the semantic query and the model embedding. */
|
|
4887
|
-
softScore?: number;
|
|
4888
|
-
}
|
|
4889
|
-
export declare function recallCandidates(models: ModelProfile[], intent: IntentProfile): ScoredCandidate[];
|
|
4890
|
-
//#endregion
|
|
4891
|
-
//#region src/advisor/recall-semantic.d.ts
|
|
4892
|
-
export declare function isSemanticAvailable(): boolean;
|
|
4893
|
-
export declare function recallSemantic(client: Client, models: ModelProfile[], query: string, topK: number, intent?: IntentProfile): Promise<ScoredCandidate[]>;
|
|
4894
|
-
//#endregion
|
|
4895
|
-
//#region src/advisor/recommend.d.ts
|
|
4896
|
-
interface RecommendOptions {
|
|
4897
|
-
onThinking?: (text: string) => void;
|
|
4898
|
-
onContentStart?: () => void;
|
|
4899
|
-
enableThinking?: boolean;
|
|
4900
|
-
}
|
|
4901
|
-
export declare function buildDocLink(docUrl?: string): string | undefined;
|
|
4902
|
-
export declare function rankModels(client: Client, candidates: ScoredCandidate[], intent: IntentProfile, userInput: string, top: number, options?: RecommendOptions): Promise<RecommendResult>;
|
|
4903
|
-
//#endregion
|
|
4904
|
-
//#region src/advisor/sync.d.ts
|
|
4905
|
-
/**
|
|
4906
|
-
* Check and sync Wiki data. Runs silently; never throws.
|
|
4907
|
-
* @returns Whether data was actually updated (for testing/debugging)
|
|
4908
|
-
*/
|
|
4909
|
-
export declare function maybeSyncWikiData(): Promise<boolean>;
|
|
4910
|
-
//#endregion
|
|
4911
|
-
//#region src/advisor/sources/types.d.ts
|
|
4912
|
-
interface ModelSource {
|
|
4913
|
-
name: string;
|
|
4914
|
-
available(): boolean;
|
|
4915
|
-
load(): Promise<ModelProfile[]>;
|
|
4916
|
-
}
|
|
5542
|
+
type RecommendResult$1 = SingleResult | PipelineResult;
|
|
4917
5543
|
//#endregion
|
|
4918
5544
|
//#region src/install/method.d.ts
|
|
4919
5545
|
/** How the CLI was installed on this machine. */
|
|
@@ -5329,4 +5955,4 @@ export declare function installSkillWithFanout(name: string, entry: SkillIndexEn
|
|
|
5329
5955
|
export declare function listSkillDirsOnDisk(): string[];
|
|
5330
5956
|
export declare function computeSkillStatuses(index: SkillsIndex, lock: SkillLockFile, diskNames: string[]): SkillStatusRow[];
|
|
5331
5957
|
//#endregion
|
|
5332
|
-
export type
|
|
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 };
|