@klarkxy/dsh-git-commit 0.3.3 → 0.3.4
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/README.md +2 -1
- package/docs/README.zh-CN.md +2 -1
- package/lib/client.inner.cjs +574 -93
- package/lib/client.inner.cjs.map +1 -1
- package/lib/client.js +574 -93
- package/lib/contracts.d.ts +76 -28
- package/lib/contracts.js +2 -2
- package/lib/contracts2.d.ts +2 -2
- package/lib/contracts2.js +1 -2
- package/lib/contracts2.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +17 -12
- package/lib/index.js.map +1 -1
- package/package.json +10 -9
package/lib/contracts.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare function defaultModelRoute(): ModelRoute;
|
|
|
22
22
|
*/
|
|
23
23
|
declare function normalizeModelRoute(value: unknown): ModelRoute;
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region ../../node_modules
|
|
25
|
+
//#region ../../node_modules/@deepseek-ai/dsh-brand/lib/types/index.d.ts
|
|
26
26
|
/**
|
|
27
27
|
* Duplicate-install-safe nominal primitive helpers.
|
|
28
28
|
*
|
|
@@ -42,7 +42,7 @@ type Branded<B extends string> = string & {
|
|
|
42
42
|
readonly [BRAND]: B;
|
|
43
43
|
};
|
|
44
44
|
//#endregion
|
|
45
|
-
//#region ../../node_modules
|
|
45
|
+
//#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/error.d.ts
|
|
46
46
|
declare const ATTACHMENT_ERROR_CODES: readonly ["TOO_MANY_IMAGES", "IMAGES_TOO_LARGE", "UNSUPPORTED_IMAGE_TYPE", "INVALID_IMAGE_BASE64", "INVALID_IMAGE", "IMAGE_TYPE_MISMATCH", "IMAGE_TOO_LARGE", "IMAGE_TOO_MANY_PIXELS", "IMAGE_DIMENSION_TOO_LARGE", "INVALID_FILE_BASE64", "INVALID_ATTACHMENT_REF", "ATTACHMENT_CORRUPT", "ATTACHMENT_WRITE_FAILED", "ATTACHMENT_NOT_FOUND", "ATTACHMENT_READ_FAILED", "ATTACHMENT_PROJECTION_UNSUPPORTED", "ATTACHMENT_FILES_UNSUPPORTED"];
|
|
47
47
|
/** Stable attachment failure codes used for protocol error routing. */
|
|
48
48
|
type AttachmentErrorCode = typeof ATTACHMENT_ERROR_CODES[number];
|
|
@@ -66,7 +66,7 @@ declare class AttachmentError extends Error {
|
|
|
66
66
|
constructor(message: string, code: AttachmentErrorCode, options?: ErrorOptions);
|
|
67
67
|
}
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region ../../node_modules
|
|
69
|
+
//#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/brand.d.ts
|
|
70
70
|
/** Opaque content-addressed identifier for one immutable attachment object. */
|
|
71
71
|
type AttachmentId = Branded<'AttachmentId'>;
|
|
72
72
|
/**
|
|
@@ -84,7 +84,7 @@ type ImageVariantId = Branded<'ImageVariantId'>;
|
|
|
84
84
|
*/
|
|
85
85
|
declare function ImageVariantId(value: string): ImageVariantId;
|
|
86
86
|
//#endregion
|
|
87
|
-
//#region ../../node_modules
|
|
87
|
+
//#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/types.d.ts
|
|
88
88
|
/** Raster image formats accepted by the version-one attachment path. */
|
|
89
89
|
type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
|
|
90
90
|
/** Durable, serializable reference to one immutable normalized image. */
|
|
@@ -170,10 +170,19 @@ type PromptContentPart = {
|
|
|
170
170
|
readonly data: string;
|
|
171
171
|
readonly name?: string;
|
|
172
172
|
};
|
|
173
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* Host prompt content whose upload receipts are resolved. An image part
|
|
175
|
+
* carries encoded bytes awaiting admission, or references an image this
|
|
176
|
+
* service already stored for an upload the same Session staged, with
|
|
177
|
+
* `encodedBytes` holding the byte length of that upload.
|
|
178
|
+
*/
|
|
174
179
|
type AttachmentAdmissionPart = PromptContentPart | {
|
|
175
180
|
readonly type: 'file';
|
|
176
181
|
readonly attachment: FileAttachmentRef;
|
|
182
|
+
} | {
|
|
183
|
+
readonly type: 'image';
|
|
184
|
+
readonly attachment: ImageAttachmentRef;
|
|
185
|
+
readonly encodedBytes: number;
|
|
177
186
|
};
|
|
178
187
|
/** Host-admitted prompt content with every attachment represented by its durable reference. */
|
|
179
188
|
type AdmittedPromptContentPart = {
|
|
@@ -228,7 +237,7 @@ interface RequestImageAttachment {
|
|
|
228
237
|
hasAlpha: boolean;
|
|
229
238
|
}
|
|
230
239
|
//#endregion
|
|
231
|
-
//#region ../../node_modules
|
|
240
|
+
//#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/index.d.ts
|
|
232
241
|
declare module '@deepseek-ai/cordis' {
|
|
233
242
|
interface Context {
|
|
234
243
|
attachments: AttachmentStore;
|
|
@@ -262,9 +271,12 @@ declare abstract class AttachmentStore extends Service {
|
|
|
262
271
|
*/
|
|
263
272
|
saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>;
|
|
264
273
|
/**
|
|
265
|
-
* Admit one Host prompt and replace each
|
|
266
|
-
* Text
|
|
267
|
-
*
|
|
274
|
+
* Admit one Host prompt and replace each encoded image with its durable reference.
|
|
275
|
+
* Text, durable file references, and already stored images pass through unchanged.
|
|
276
|
+
* Every image part counts toward `maxImagesPerMessage` and `maxMessageImageBytes`;
|
|
277
|
+
* a stored image counts the bytes of the upload that stored it. Refused content
|
|
278
|
+
* starts no writes. A prompt without encoded images performs no storage operation.
|
|
279
|
+
* @param content - prompt parts in message order after upload receipt resolution.
|
|
268
280
|
* @returns admitted prompt parts in the same order as `content`.
|
|
269
281
|
* @throws AttachmentError when the image batch is refused.
|
|
270
282
|
*/
|
|
@@ -292,8 +304,8 @@ declare abstract class AttachmentStore extends Service {
|
|
|
292
304
|
*/
|
|
293
305
|
abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>;
|
|
294
306
|
/**
|
|
295
|
-
* Read one image and verify
|
|
296
|
-
* @param ref -
|
|
307
|
+
* Read one image and verify its ID, format, byte length, and dimensions against the supplied reference.
|
|
308
|
+
* @param ref - supplied image reference; name and originalDimensions are preserved without file verification.
|
|
297
309
|
* @param signal - optional cancellation for backend read and verification work.
|
|
298
310
|
* @returns the verified bytes and normalized attachment reference.
|
|
299
311
|
* @throws the signal reason when aborted, or a storage error when verification fails.
|
|
@@ -327,7 +339,7 @@ declare abstract class AttachmentStore extends Service {
|
|
|
327
339
|
* Read and verify one verbatim stored file as bounded chunks. Providers must
|
|
328
340
|
* not collect the complete file in memory. Backends without verbatim file
|
|
329
341
|
* reads keep this default rejection.
|
|
330
|
-
* @param ref - durable reference from the session log.
|
|
342
|
+
* @param ref - durable file reference from the session log.
|
|
331
343
|
* @param signal - optional cancellation for backend reads and verification work.
|
|
332
344
|
* @returns exact file bytes in order; integrity failures reject the iteration.
|
|
333
345
|
*/
|
|
@@ -349,7 +361,14 @@ declare abstract class AttachmentStore extends Service {
|
|
|
349
361
|
readImageRequest(ref: ImageAttachmentRef, target: ImageRequestTarget, signal?: AbortSignal): Promise<RequestImageAttachment>;
|
|
350
362
|
}
|
|
351
363
|
//#endregion
|
|
352
|
-
//#region ../../node_modules
|
|
364
|
+
//#region ../../node_modules/@deepseek-ai/dsh-package-manifest/lib/types/types.d.ts
|
|
365
|
+
/** Literal text or translations indexed by lowercase language id, with a required English fallback. */
|
|
366
|
+
type LocalizedText = string | {
|
|
367
|
+
readonly en: string;
|
|
368
|
+
readonly [locale: string]: string;
|
|
369
|
+
};
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region ../../node_modules/@deepseek-ai/dsh-llm/lib/types/brand.d.ts
|
|
353
372
|
/** Stable identity carried by one message across inbox, log, and model-request boundaries. */
|
|
354
373
|
type MessageId = Branded<'MessageId'>;
|
|
355
374
|
/**
|
|
@@ -386,7 +405,7 @@ type ReasoningEffortId = Branded<'ReasoningEffortId'>;
|
|
|
386
405
|
*/
|
|
387
406
|
declare function ReasoningEffortId(id: string): ReasoningEffortId;
|
|
388
407
|
//#endregion
|
|
389
|
-
//#region ../../node_modules
|
|
408
|
+
//#region ../../node_modules/@deepseek-ai/dsh-llm/lib/types/message.d.ts
|
|
390
409
|
/** Provider/model identity and adapter-private replay data for an assistant message. */
|
|
391
410
|
interface AssistantProviderMetadata {
|
|
392
411
|
/** Provider route that produced the message. */
|
|
@@ -518,7 +537,7 @@ interface MessageRoleMap {
|
|
|
518
537
|
/** Any persisted conversation message, discriminated by its `role`. */
|
|
519
538
|
type Message = MessageRoleMap[keyof MessageRoleMap];
|
|
520
539
|
//#endregion
|
|
521
|
-
//#region ../../node_modules
|
|
540
|
+
//#region ../../node_modules/@deepseek-ai/dsh-llm/lib/types/types.d.ts
|
|
522
541
|
declare module '@deepseek-ai/cordis' {
|
|
523
542
|
interface Events {
|
|
524
543
|
/**
|
|
@@ -531,6 +550,12 @@ declare module '@deepseek-ai/cordis' {
|
|
|
531
550
|
* @mode emit
|
|
532
551
|
*/
|
|
533
552
|
'llm/adapters-updated'(): void;
|
|
553
|
+
/**
|
|
554
|
+
* A provider's advertised models or display metadata changed; consumers reload `listModels()`.
|
|
555
|
+
* @mode emit
|
|
556
|
+
* @param provider - route whose model catalog changed.
|
|
557
|
+
*/
|
|
558
|
+
'llm/models-updated'(provider: string): void;
|
|
534
559
|
}
|
|
535
560
|
}
|
|
536
561
|
/** Serializable provider or transport failure facts; policy decides whether they are retryable. */
|
|
@@ -823,6 +848,18 @@ interface LlmDiscoveredModel {
|
|
|
823
848
|
/** Accepted input types when disclosed by the catalog or endpoint; absent means unknown. */
|
|
824
849
|
inputModalities?: readonly ModelModality[];
|
|
825
850
|
}
|
|
851
|
+
/**
|
|
852
|
+
* Emphasis of a model badge: `neutral` states a plain fact, `info` highlights
|
|
853
|
+
* the model, `success` marks a benefit, and `warning` asks for attention.
|
|
854
|
+
*/
|
|
855
|
+
type LlmModelBadgeTone = 'neutral' | 'info' | 'success' | 'warning';
|
|
856
|
+
/** Short provider-authored label a selector shows beside one advertised model name. */
|
|
857
|
+
interface LlmModelBadge {
|
|
858
|
+
/** One literal, or translations keyed by lowercase language id with a required English entry. */
|
|
859
|
+
text: LocalizedText;
|
|
860
|
+
/** Emphasis of the label. */
|
|
861
|
+
tone: LlmModelBadgeTone;
|
|
862
|
+
}
|
|
826
863
|
/** One adapter-discovered model; catalog membership is advisory, not request validation. */
|
|
827
864
|
interface LlmModelInfo {
|
|
828
865
|
/** Provider route that owns this model entry. */
|
|
@@ -835,6 +872,11 @@ interface LlmModelInfo {
|
|
|
835
872
|
description?: string;
|
|
836
873
|
/** Accepted request modalities; absent means unknown, while an explicit omission is negative capability. */
|
|
837
874
|
inputModalities?: readonly ModelModality[];
|
|
875
|
+
/**
|
|
876
|
+
* Selector label advertised by catalog discovery; exact-route resolution
|
|
877
|
+
* omits it, and no model request or Session event carries it.
|
|
878
|
+
*/
|
|
879
|
+
badge?: LlmModelBadge;
|
|
838
880
|
}
|
|
839
881
|
/** Provider-owned context capacity for one exact provider/model route. */
|
|
840
882
|
interface LlmModelContext {
|
|
@@ -989,8 +1031,15 @@ interface ToolHistory {
|
|
|
989
1031
|
readonly additions: readonly ToolSchema[];
|
|
990
1032
|
}[];
|
|
991
1033
|
}
|
|
992
|
-
/**
|
|
993
|
-
interface
|
|
1034
|
+
/** Auxiliary request purposes declared by their producer packages. */
|
|
1035
|
+
interface LlmRequestPurposeMap {}
|
|
1036
|
+
/** Declared auxiliary request purpose; ordinary conversation requests leave it absent. */
|
|
1037
|
+
type LlmRequestPurpose = Extract<keyof LlmRequestPurposeMap, string>;
|
|
1038
|
+
/**
|
|
1039
|
+
* A single model request, fully assembled.
|
|
1040
|
+
* @typeParam Purpose - declared purpose keys for callers; forwarding adapters may accept `string`.
|
|
1041
|
+
*/
|
|
1042
|
+
interface GenerateOptions<Purpose extends string = LlmRequestPurpose> {
|
|
994
1043
|
/** Registered provider route selecting the adapter instance. */
|
|
995
1044
|
provider: string;
|
|
996
1045
|
model: string;
|
|
@@ -1031,10 +1080,10 @@ interface GenerateOptions {
|
|
|
1031
1080
|
* map the purpose to model-hidden transport metadata. Ordinary conversation
|
|
1032
1081
|
* requests leave it unset.
|
|
1033
1082
|
*/
|
|
1034
|
-
purpose?:
|
|
1083
|
+
purpose?: Purpose;
|
|
1035
1084
|
}
|
|
1036
1085
|
//#endregion
|
|
1037
|
-
//#region ../../node_modules
|
|
1086
|
+
//#region ../../node_modules/@deepseek-ai/cosmokit/lib/types/types.d.ts
|
|
1038
1087
|
declare function isArrayBufferLike(value: any): value is ArrayBufferLike;
|
|
1039
1088
|
declare function isArrayBufferSource(value: any): value is Binary.Source;
|
|
1040
1089
|
/** Binary source detection and base64/hex conversion helpers. */
|
|
@@ -1049,11 +1098,11 @@ declare namespace Binary {
|
|
|
1049
1098
|
function fromHex(source: string): ArrayBuffer;
|
|
1050
1099
|
}
|
|
1051
1100
|
//#endregion
|
|
1052
|
-
//#region ../../node_modules
|
|
1101
|
+
//#region ../../node_modules/@deepseek-ai/cosmokit/lib/types/misc.d.ts
|
|
1053
1102
|
/** String/symbol keyed dictionary type. */
|
|
1054
1103
|
type Dict<T = any, K extends string | symbol = string> = { [key in K]: T; };
|
|
1055
1104
|
//#endregion
|
|
1056
|
-
//#region ../../node_modules
|
|
1105
|
+
//#region ../../node_modules/@deepseek-ai/cosmokit/lib/types/volatile.d.ts
|
|
1057
1106
|
/** Shared config references used by schema validators and plugin runtimes. */
|
|
1058
1107
|
/** Recursively readonly data returned by a volatile config reference. */
|
|
1059
1108
|
type VolatileSnapshot<T> = T extends object ? { readonly [K in keyof T]: VolatileSnapshot<T[K]>; } : T;
|
|
@@ -1063,7 +1112,7 @@ interface Volatile<T> {
|
|
|
1063
1112
|
get(): VolatileSnapshot<T>;
|
|
1064
1113
|
}
|
|
1065
1114
|
//#endregion
|
|
1066
|
-
//#region ../../node_modules
|
|
1115
|
+
//#region ../../node_modules/@standard-schema/spec/dist/index.d.ts
|
|
1067
1116
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
1068
1117
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
1069
1118
|
/** The Standard properties. */
|
|
@@ -1140,7 +1189,7 @@ declare namespace StandardSchemaV1 {
|
|
|
1140
1189
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
1141
1190
|
}
|
|
1142
1191
|
//#endregion
|
|
1143
|
-
//#region ../../node_modules
|
|
1192
|
+
//#region ../../node_modules/@deepseek-ai/schemastery/lib/types/index.d.ts
|
|
1144
1193
|
declare const kSchema: unique symbol;
|
|
1145
1194
|
declare global {
|
|
1146
1195
|
namespace Schemastery {
|
|
@@ -1344,7 +1393,7 @@ type SetRequired<M extends SchemaMode, R extends boolean> = M extends 'volatile'
|
|
|
1344
1393
|
type Schema<S = any, T = S, Mode extends SchemaMode = 'plain'> = Schemastery<S, T, Mode>;
|
|
1345
1394
|
declare const Schema: Schemastery.Static;
|
|
1346
1395
|
//#endregion
|
|
1347
|
-
//#region ../../node_modules
|
|
1396
|
+
//#region ../../node_modules/@deepseek-ai/dsh-llm/lib/types/retry-policy.d.ts
|
|
1348
1397
|
/** Fully resolved backoff shared by both retry modes. */
|
|
1349
1398
|
interface ResolvedRetryBackoff {
|
|
1350
1399
|
readonly initialDelayMs: number;
|
|
@@ -1364,7 +1413,7 @@ interface ResolvedAlwaysRetryPolicy extends ResolvedRetryBackoff {
|
|
|
1364
1413
|
/** Immutable provider policy captured when its adapter route is registered. */
|
|
1365
1414
|
type ResolvedRetryPolicy = ResolvedNormalRetryPolicy | ResolvedAlwaysRetryPolicy;
|
|
1366
1415
|
//#endregion
|
|
1367
|
-
//#region ../../node_modules
|
|
1416
|
+
//#region ../../node_modules/@deepseek-ai/dsh-llm/lib/types/call-config.d.ts
|
|
1368
1417
|
/** Concrete generation settings; omitted controls use the selected route's defaults. */
|
|
1369
1418
|
interface LlmCallControls {
|
|
1370
1419
|
reasoningEffort?: ReasoningEffortId;
|
|
@@ -1401,7 +1450,7 @@ interface LlmCallConfigAdapterDefaults {
|
|
|
1401
1450
|
maxTokens?: true;
|
|
1402
1451
|
}
|
|
1403
1452
|
//#endregion
|
|
1404
|
-
//#region ../../node_modules
|
|
1453
|
+
//#region ../../node_modules/@deepseek-ai/dsh-llm/lib/types/index.d.ts
|
|
1405
1454
|
declare module '@deepseek-ai/cordis' {
|
|
1406
1455
|
interface Context {
|
|
1407
1456
|
llm: LlmRuntime;
|
|
@@ -1815,7 +1864,6 @@ declare const PROMPT_VERSION = "git-commit.v1";
|
|
|
1815
1864
|
declare const COMMIT_PLAN_FEATURE = "git-commit-plan";
|
|
1816
1865
|
declare const SCHEMA_VERSION = "commit-plan-json.v1";
|
|
1817
1866
|
declare const CONTRACT_VERSION = 1;
|
|
1818
|
-
declare const DEFAULT_MAX_OUTPUT_TOKENS = 2048;
|
|
1819
1867
|
/** Total character budget for the change manifest sent to the model. */
|
|
1820
1868
|
declare const MAX_MANIFEST_CHARS = 48000;
|
|
1821
1869
|
/** Per-file preview cap for untracked files. */
|
|
@@ -1902,5 +1950,5 @@ interface PartialCommitResult {
|
|
|
1902
1950
|
}[];
|
|
1903
1951
|
}
|
|
1904
1952
|
//#endregion
|
|
1905
|
-
export {
|
|
1953
|
+
export { SETTINGS_KEY as C, defaultModelRoute as D, LlmRuntime as E, normalizeModelRoute as O, SCHEMA_VERSION as S, normalizeFallback as T, PURPOSE_ID as _, CommitModelRoute as a, RPC_CHANNEL as b, GIT_COMMIT_CLIENT_SERVICE as c, GitCommitStatus as d, MAX_MANIFEST_CHARS as f, PROMPT_VERSION as g, PLUGIN_NAME as h, CommitModelInfo as i, GIT_TIMEOUT_MS as l, MAX_UNTRACKED_PREVIEW_CHARS as m, CONTRACT_VERSION as n, CommitRunResult as o, MAX_MESSAGE_CHARS as p, CommitGroupResult as r, FEATURE_ID as s, COMMIT_PLAN_FEATURE as t, GitCommitSettings as u, PartialCommitResult as v, defaultSettings as w, RpcResult as x, RECENT_LOG_COUNT as y };
|
|
1906
1954
|
//# sourceMappingURL=contracts.d.ts.map
|
package/lib/contracts.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { COMMIT_PLAN_FEATURE, CONTRACT_VERSION,
|
|
1
|
+
import { _ as normalizeFallback, a as GIT_TIMEOUT_MS, b as normalizeModelRoute, c as MAX_UNTRACKED_PREVIEW_CHARS, d as PURPOSE_ID, f as RECENT_LOG_COUNT, g as defaultSettings, h as SETTINGS_KEY, i as GIT_COMMIT_CLIENT_SERVICE, l as PLUGIN_NAME, m as SCHEMA_VERSION, n as CONTRACT_VERSION, o as MAX_MANIFEST_CHARS, p as RPC_CHANNEL, r as FEATURE_ID, s as MAX_MESSAGE_CHARS, t as COMMIT_PLAN_FEATURE, u as PROMPT_VERSION, v as defaultModelRoute } from "./contracts2.js";
|
|
2
|
+
export { COMMIT_PLAN_FEATURE, CONTRACT_VERSION, FEATURE_ID, GIT_COMMIT_CLIENT_SERVICE, GIT_TIMEOUT_MS, MAX_MANIFEST_CHARS, MAX_MESSAGE_CHARS, MAX_UNTRACKED_PREVIEW_CHARS, PLUGIN_NAME, PROMPT_VERSION, PURPOSE_ID, RECENT_LOG_COUNT, RPC_CHANNEL, SCHEMA_VERSION, SETTINGS_KEY, defaultModelRoute, defaultSettings, normalizeFallback, normalizeModelRoute };
|
package/lib/contracts2.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { COMMIT_PLAN_FEATURE, CONTRACT_VERSION, CommitGroupResult, CommitModelInfo, CommitModelRoute, CommitRunResult,
|
|
1
|
+
import { C as SETTINGS_KEY, D as defaultModelRoute, O as normalizeModelRoute, S as SCHEMA_VERSION, T as normalizeFallback, _ as PURPOSE_ID, a as CommitModelRoute, b as RPC_CHANNEL, c as GIT_COMMIT_CLIENT_SERVICE, d as GitCommitStatus, f as MAX_MANIFEST_CHARS, g as PROMPT_VERSION, h as PLUGIN_NAME, i as CommitModelInfo, l as GIT_TIMEOUT_MS, m as MAX_UNTRACKED_PREVIEW_CHARS, n as CONTRACT_VERSION, o as CommitRunResult, p as MAX_MESSAGE_CHARS, r as CommitGroupResult, s as FEATURE_ID, t as COMMIT_PLAN_FEATURE, u as GitCommitSettings, v as PartialCommitResult, w as defaultSettings, x as RpcResult, y as RECENT_LOG_COUNT } from "./contracts.js";
|
|
2
|
+
export { COMMIT_PLAN_FEATURE, CONTRACT_VERSION, CommitGroupResult, CommitModelInfo, CommitModelRoute, CommitRunResult, FEATURE_ID, GIT_COMMIT_CLIENT_SERVICE, GIT_TIMEOUT_MS, GitCommitSettings, GitCommitStatus, MAX_MANIFEST_CHARS, MAX_MESSAGE_CHARS, MAX_UNTRACKED_PREVIEW_CHARS, PLUGIN_NAME, PROMPT_VERSION, PURPOSE_ID, PartialCommitResult, RECENT_LOG_COUNT, RPC_CHANNEL, RpcResult, SCHEMA_VERSION, SETTINGS_KEY, defaultModelRoute, defaultSettings, normalizeFallback, normalizeModelRoute };
|
package/lib/contracts2.js
CHANGED
|
@@ -58,7 +58,6 @@ const PROMPT_VERSION = "git-commit.v1";
|
|
|
58
58
|
const COMMIT_PLAN_FEATURE = "git-commit-plan";
|
|
59
59
|
const SCHEMA_VERSION = "commit-plan-json.v1";
|
|
60
60
|
const CONTRACT_VERSION = 1;
|
|
61
|
-
const DEFAULT_MAX_OUTPUT_TOKENS = 2048;
|
|
62
61
|
/** Total character budget for the change manifest sent to the model. */
|
|
63
62
|
const MAX_MANIFEST_CHARS = 48e3;
|
|
64
63
|
/** Per-file preview cap for untracked files. */
|
|
@@ -80,6 +79,6 @@ function normalizeFallback(value) {
|
|
|
80
79
|
return value === true;
|
|
81
80
|
}
|
|
82
81
|
//#endregion
|
|
83
|
-
export {
|
|
82
|
+
export { normalizeFallback as _, GIT_TIMEOUT_MS as a, normalizeModelRoute as b, MAX_UNTRACKED_PREVIEW_CHARS as c, PURPOSE_ID as d, RECENT_LOG_COUNT as f, defaultSettings as g, SETTINGS_KEY as h, GIT_COMMIT_CLIENT_SERVICE as i, PLUGIN_NAME as l, SCHEMA_VERSION as m, CONTRACT_VERSION as n, MAX_MANIFEST_CHARS as o, RPC_CHANNEL as p, FEATURE_ID as r, MAX_MESSAGE_CHARS as s, COMMIT_PLAN_FEATURE as t, PROMPT_VERSION as u, defaultModelRoute as v, modelRouteOverride as y };
|
|
84
83
|
|
|
85
84
|
//# sourceMappingURL=contracts2.js.map
|
package/lib/contracts2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts2.js","names":[],"sources":["../../dsh-model-route/src/route.ts","../src/contracts.ts"],"sourcesContent":["/**\n * Shared model-route value contract.\n *\n * A feature plugin stores its model override as a ModelRoute on its own\n * settings page. Empty provider/model means \"follow the host default model\".\n * Pure and browser-safe: no cordis, no React, no schema library.\n */\n\n/** A concrete provider model a feature call should use. */\nexport interface ModelRoute {\n provider: string\n model: string\n reasoningEffort?: string\n}\n\n/** Empty route: no explicit model, the feature follows the host default. */\nexport function defaultModelRoute(): ModelRoute {\n return { provider: '', model: '' }\n}\n\n/** Structural check: both id fields are strings (either may be empty). */\nexport function isModelRouteValue(value: unknown): value is ModelRoute {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false\n const row = value as Record<string, unknown>\n return typeof row.provider === 'string' && typeof row.model === 'string'\n}\n\nconst MAX_ID_CHARS = 250\nconst MAX_EFFORT_CHARS = 80\n\nfunction asText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\n/**\n * Coerce a stored value into a ModelRoute. Anything malformed collapses to the\n * empty route, matching the per-plugin normalizers this contract replaces.\n */\nexport function normalizeModelRoute(value: unknown): ModelRoute {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return defaultModelRoute()\n const row = value as Record<string, unknown>\n const provider = asText(row.provider) ?? ''\n const model = asText(row.model) ?? ''\n const effort = asText(row.reasoningEffort)\n if (!provider || !model || provider.length > MAX_ID_CHARS || model.length > MAX_ID_CHARS) return defaultModelRoute()\n return effort && effort.length <= MAX_EFFORT_CHARS ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\n/** The override to actually call with: undefined when the route is empty. */\nexport function modelRouteOverride(route: ModelRoute | undefined): ModelRoute | undefined {\n const provider = route?.provider?.trim()\n const model = route?.model?.trim()\n if (!provider || !model) return undefined\n const effort = route?.reasoningEffort?.trim()\n return effort ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\nconst KEY_SEPARATOR = '\\u001f'\n\n/** Stable key for one route, safe to use as a select-option value. */\nexport function modelRouteKey(provider: string, model: string): string {\n return provider && model ? `${provider}${KEY_SEPARATOR}${model}` : ''\n}\n\n/** Inverse of modelRouteKey; undefined for malformed keys. */\nexport function parseModelRouteKey(value: string): { provider: string; model: string } | undefined {\n const index = value.indexOf(KEY_SEPARATOR)\n if (index <= 0) return undefined\n const provider = value.slice(0, index)\n const model = value.slice(index + KEY_SEPARATOR.length)\n if (!provider || !model) return undefined\n return { provider, model }\n}\n\n/** True when both routes name the same target; two empty routes are equal. */\nexport function sameModelRoute(a: ModelRoute | undefined, b: ModelRoute | undefined): boolean {\n const left = modelRouteOverride(a)\n const right = modelRouteOverride(b)\n if (!left || !right) return !left === !right\n return left.provider === right.provider && left.model === right.model\n && (left.reasoningEffort ?? '') === (right.reasoningEffort ?? '')\n}\n","import { defaultModelRoute, normalizeModelRoute, type ModelRoute } from '@klarkxy/dsh-model-route'\nexport { defaultModelRoute, normalizeModelRoute }\n\n/** Browser-safe contracts. Shared RPC/result types stay on @klarkxy/dsh-plugin-kit. */\nimport type { RpcResult as SharedRpcResult } from '@klarkxy/dsh-plugin-kit/contracts'\nexport type RpcResult<T = unknown> = Extract<SharedRpcResult<T>, { ok: true }> | {\n ok: false\n error: { code: string; message: string; partial?: PartialCommitResult }\n}\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-git-commit'\nexport const FEATURE_ID = 'git-commit'\nexport const PURPOSE_ID = 'git-commit.plan'\nexport const RPC_CHANNEL = '/dsh-git-commit'\nexport const GIT_COMMIT_CLIENT_SERVICE = 'dshGitCommitClient'\nexport const PROMPT_VERSION = 'git-commit.v1'\n/** Feature id stamped on the auxiliary-context envelope for this call. */\nexport const COMMIT_PLAN_FEATURE = 'git-commit-plan'\nexport const SCHEMA_VERSION = 'commit-plan-json.v1'\nexport const CONTRACT_VERSION = 1\n\
|
|
1
|
+
{"version":3,"file":"contracts2.js","names":[],"sources":["../../dsh-model-route/src/route.ts","../src/contracts.ts"],"sourcesContent":["/**\n * Shared model-route value contract.\n *\n * A feature plugin stores its model override as a ModelRoute on its own\n * settings page. Empty provider/model means \"follow the host default model\".\n * Pure and browser-safe: no cordis, no React, no schema library.\n */\n\n/** A concrete provider model a feature call should use. */\nexport interface ModelRoute {\n provider: string\n model: string\n reasoningEffort?: string\n}\n\n/** Empty route: no explicit model, the feature follows the host default. */\nexport function defaultModelRoute(): ModelRoute {\n return { provider: '', model: '' }\n}\n\n/** Structural check: both id fields are strings (either may be empty). */\nexport function isModelRouteValue(value: unknown): value is ModelRoute {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false\n const row = value as Record<string, unknown>\n return typeof row.provider === 'string' && typeof row.model === 'string'\n}\n\nconst MAX_ID_CHARS = 250\nconst MAX_EFFORT_CHARS = 80\n\nfunction asText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\n/**\n * Coerce a stored value into a ModelRoute. Anything malformed collapses to the\n * empty route, matching the per-plugin normalizers this contract replaces.\n */\nexport function normalizeModelRoute(value: unknown): ModelRoute {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return defaultModelRoute()\n const row = value as Record<string, unknown>\n const provider = asText(row.provider) ?? ''\n const model = asText(row.model) ?? ''\n const effort = asText(row.reasoningEffort)\n if (!provider || !model || provider.length > MAX_ID_CHARS || model.length > MAX_ID_CHARS) return defaultModelRoute()\n return effort && effort.length <= MAX_EFFORT_CHARS ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\n/** The override to actually call with: undefined when the route is empty. */\nexport function modelRouteOverride(route: ModelRoute | undefined): ModelRoute | undefined {\n const provider = route?.provider?.trim()\n const model = route?.model?.trim()\n if (!provider || !model) return undefined\n const effort = route?.reasoningEffort?.trim()\n return effort ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\nconst KEY_SEPARATOR = '\\u001f'\n\n/** Stable key for one route, safe to use as a select-option value. */\nexport function modelRouteKey(provider: string, model: string): string {\n return provider && model ? `${provider}${KEY_SEPARATOR}${model}` : ''\n}\n\n/** Inverse of modelRouteKey; undefined for malformed keys. */\nexport function parseModelRouteKey(value: string): { provider: string; model: string } | undefined {\n const index = value.indexOf(KEY_SEPARATOR)\n if (index <= 0) return undefined\n const provider = value.slice(0, index)\n const model = value.slice(index + KEY_SEPARATOR.length)\n if (!provider || !model) return undefined\n return { provider, model }\n}\n\n/** True when both routes name the same target; two empty routes are equal. */\nexport function sameModelRoute(a: ModelRoute | undefined, b: ModelRoute | undefined): boolean {\n const left = modelRouteOverride(a)\n const right = modelRouteOverride(b)\n if (!left || !right) return !left === !right\n return left.provider === right.provider && left.model === right.model\n && (left.reasoningEffort ?? '') === (right.reasoningEffort ?? '')\n}\n","import { defaultModelRoute, normalizeModelRoute, type ModelRoute } from '@klarkxy/dsh-model-route'\nexport { defaultModelRoute, normalizeModelRoute }\n\n/** Browser-safe contracts. Shared RPC/result types stay on @klarkxy/dsh-plugin-kit. */\nimport type { RpcResult as SharedRpcResult } from '@klarkxy/dsh-plugin-kit/contracts'\nexport type RpcResult<T = unknown> = Extract<SharedRpcResult<T>, { ok: true }> | {\n ok: false\n error: { code: string; message: string; partial?: PartialCommitResult }\n}\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-git-commit'\nexport const FEATURE_ID = 'git-commit'\nexport const PURPOSE_ID = 'git-commit.plan'\nexport const RPC_CHANNEL = '/dsh-git-commit'\nexport const GIT_COMMIT_CLIENT_SERVICE = 'dshGitCommitClient'\nexport const PROMPT_VERSION = 'git-commit.v1'\n/** Feature id stamped on the auxiliary-context envelope for this call. */\nexport const COMMIT_PLAN_FEATURE = 'git-commit-plan'\nexport const SCHEMA_VERSION = 'commit-plan-json.v1'\nexport const CONTRACT_VERSION = 1\n\n/** Total character budget for the change manifest sent to the model. */\nexport const MAX_MANIFEST_CHARS = 48_000\n/** Per-file preview cap for untracked files. */\nexport const MAX_UNTRACKED_PREVIEW_CHARS = 2_000\n/** Recent commit subjects supplied as style reference. */\nexport const RECENT_LOG_COUNT = 10\n/** Hard cap for one generated commit message line. */\nexport const MAX_MESSAGE_CHARS = 120\n/** git subprocess timeout. */\nexport const GIT_TIMEOUT_MS = 30_000\nexport const SETTINGS_KEY = 'current'\n\n/**\n * Plugin-page model selection. Empty provider/model means \"follow the default\".\n * The value shape, empty default, and 250/80 normalizer live in\n * @klarkxy/dsh-model-route; this alias keeps the commit-specific name.\n */\nexport type CommitModelRoute = ModelRoute\n\nexport interface GitCommitSettings {\n readonly revision: number\n readonly model: CommitModelRoute\n /**\n * Opt-in single commit when the model produced no usable plan. Off by\n * default: an unplanned commit is one the user never reviewed, so a failed\n * or unusable model call rejects the run instead of writing to the index.\n */\n readonly allowFallback: boolean\n}\n\nexport const defaultSettings = (): GitCommitSettings => ({\n revision: 0, model: defaultModelRoute(), allowFallback: false,\n})\n\n/** Untrusted stored flags stay opt-in: anything but a literal true is false. */\nexport function normalizeFallback(value: unknown): boolean {\n return value === true\n}\n\nexport interface CommitModelInfo {\n readonly provider: string\n readonly model: string\n /** 'page' is the plugin-page selection; 'aux' the shared default auxiliary model; 'default' follows the session or host chat model. */\n readonly source: 'page' | 'aux' | 'default'\n}\n\nexport interface GitCommitStatus {\n readonly available: boolean\n /** Machine-readable reason when unavailable: 'no-session' | 'no-cwd' | 'not-a-repo' | 'no-git'. */\n readonly reason?: string\n readonly detail?: string\n readonly root?: string\n readonly branch?: string\n readonly workspace: { readonly files: number }\n readonly model?: CommitModelInfo\n}\n\nexport interface CommitGroupResult {\n /** Empty only when a created commit's hash could not be read. */\n readonly hash: string\n readonly message: string\n readonly files: readonly string[]\n}\n\nexport interface CommitRunResult {\n readonly branch: string\n readonly commits: readonly CommitGroupResult[]\n /** True when the model plan was unavailable and a single fallback commit was used. */\n readonly fallback: boolean\n readonly model?: CommitModelInfo\n}\n\n/**\n * Commits that already exist when a later group fails or the run is cancelled.\n * `commits` is the durable outcome; `failure` is why the rest did not run.\n * A recorded commit is never rolled back and never retried by this plugin.\n */\nexport interface PartialCommitResult {\n readonly branch: string\n readonly commits: readonly CommitGroupResult[]\n readonly fallback: boolean\n readonly model?: CommitModelInfo\n readonly failure: { readonly code: string; readonly message: string }\n readonly remaining: readonly { readonly message: string; readonly files: readonly string[] }[]\n /** After a rejected commit command, unchanged HEAD could not be proved; completion and ownership are unconfirmed. */\n readonly uncertain?: readonly { readonly message: string; readonly files: readonly string[] }[]\n}\n"],"mappings":";;AAgBA,SAAgB,oBAAgC;CAC9C,OAAO;EAAE,UAAU;EAAI,OAAO;CAAG;AACnC;AASA,MAAM,eAAe;AACrB,MAAM,mBAAmB;AAEzB,SAAS,OAAO,OAAoC;CAClD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI,KAAA;AACpE;;;;;AAMA,SAAgB,oBAAoB,OAA4B;CAC9D,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO,kBAAkB;CAC1F,MAAM,MAAM;CACZ,MAAM,WAAW,OAAO,IAAI,QAAQ,KAAK;CACzC,MAAM,QAAQ,OAAO,IAAI,KAAK,KAAK;CACnC,MAAM,SAAS,OAAO,IAAI,eAAe;CACzC,IAAI,CAAC,YAAY,CAAC,SAAS,SAAS,SAAS,gBAAgB,MAAM,SAAS,cAAc,OAAO,kBAAkB;CACnH,OAAO,UAAU,OAAO,UAAU,mBAAmB;EAAE;EAAU;EAAO,iBAAiB;CAAO,IAAI;EAAE;EAAU;CAAM;AACxH;;AAGA,SAAgB,mBAAmB,OAAuD;CACxF,MAAM,WAAW,OAAO,UAAU,KAAK;CACvC,MAAM,QAAQ,OAAO,OAAO,KAAK;CACjC,IAAI,CAAC,YAAY,CAAC,OAAO,OAAO,KAAA;CAChC,MAAM,SAAS,OAAO,iBAAiB,KAAK;CAC5C,OAAO,SAAS;EAAE;EAAU;EAAO,iBAAiB;CAAO,IAAI;EAAE;EAAU;CAAM;AACnF;;;AC7CA,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,4BAA4B;AACzC,MAAa,iBAAiB;;AAE9B,MAAa,sBAAsB;AACnC,MAAa,iBAAiB;AAC9B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;;AAElC,MAAa,8BAA8B;;AAE3C,MAAa,mBAAmB;;AAEhC,MAAa,oBAAoB;;AAEjC,MAAa,iBAAiB;AAC9B,MAAa,eAAe;AAoB5B,MAAa,yBAA4C;CACvD,UAAU;CAAG,OAAO,kBAAkB;CAAG,eAAe;AAC1D;;AAGA,SAAgB,kBAAkB,OAAyB;CACzD,OAAO,UAAU;AACnB"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as LlmRuntime, O as normalizeModelRoute, T as normalizeFallback, d as GitCommitStatus, o as CommitRunResult, u as GitCommitSettings, w as defaultSettings, x as RpcResult } from "./contracts.js";
|
|
2
2
|
import { Context } from "@deepseek-ai/cordis";
|
|
3
3
|
//#region ../dsh-plugin-kit/src/llm-call.d.ts
|
|
4
4
|
type LlmTextCaller = Pick<LlmRuntime, 'prepareCall' | 'resolveCallConfig'>;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as normalizeFallback, b as normalizeModelRoute, c as MAX_UNTRACKED_PREVIEW_CHARS, g as defaultSettings, h as SETTINGS_KEY, l as PLUGIN_NAME, o as MAX_MANIFEST_CHARS, p as RPC_CHANNEL, t as COMMIT_PLAN_FEATURE, y as modelRouteOverride } from "./contracts2.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
4
4
|
import { execFile } from "node:child_process";
|
|
@@ -730,7 +730,7 @@ async function retainAuxiliaryModel(ctx) {
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
//#endregion
|
|
733
|
-
//#region ../../node_modules
|
|
733
|
+
//#region ../../node_modules/@deepseek-ai/dsh-util-values/lib/index.js
|
|
734
734
|
/**
|
|
735
735
|
* Lazily scanned view of one JSON object's top-level fields, built from text
|
|
736
736
|
* that may still be streaming or from an already parsed object. Nothing is
|
|
@@ -1407,7 +1407,7 @@ function deepFreeze(value) {
|
|
|
1407
1407
|
return value;
|
|
1408
1408
|
}
|
|
1409
1409
|
//#endregion
|
|
1410
|
-
//#region ../../node_modules
|
|
1410
|
+
//#region ../../node_modules/@deepseek-ai/dsh-util-crypto/lib/index.js
|
|
1411
1411
|
/**
|
|
1412
1412
|
* Random v4 UUID, minted from `crypto.getRandomValues`.
|
|
1413
1413
|
* @returns the UUID string.
|
|
@@ -1420,7 +1420,7 @@ function randomUUID() {
|
|
|
1420
1420
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
1421
1421
|
}
|
|
1422
1422
|
//#endregion
|
|
1423
|
-
//#region ../../node_modules
|
|
1423
|
+
//#region ../../node_modules/@deepseek-ai/dsh-brand/lib/index.js
|
|
1424
1424
|
/**
|
|
1425
1425
|
* Duplicate-install-safe nominal primitive helpers.
|
|
1426
1426
|
*
|
|
@@ -1443,7 +1443,7 @@ function brandString(value) {
|
|
|
1443
1443
|
return value;
|
|
1444
1444
|
}
|
|
1445
1445
|
//#endregion
|
|
1446
|
-
//#region ../../node_modules
|
|
1446
|
+
//#region ../../node_modules/@deepseek-ai/cosmokit/lib/index.js
|
|
1447
1447
|
/** Return true when a value is `null` or `undefined`. */
|
|
1448
1448
|
function isNullable(value) {
|
|
1449
1449
|
return value === null || value === void 0;
|
|
@@ -1697,7 +1697,7 @@ var Time;
|
|
|
1697
1697
|
Time.template = template;
|
|
1698
1698
|
})(Time || (Time = {}));
|
|
1699
1699
|
//#endregion
|
|
1700
|
-
//#region ../../node_modules
|
|
1700
|
+
//#region ../../node_modules/@deepseek-ai/schemastery/lib/index.mjs
|
|
1701
1701
|
const kSchema = Symbol.for("schemastery");
|
|
1702
1702
|
const kValidationError = Symbol.for("ValidationError");
|
|
1703
1703
|
globalThis.__schemastery_index__ ??= 0;
|
|
@@ -2330,11 +2330,11 @@ defineMethod("transform", [
|
|
|
2330
2330
|
"preserve"
|
|
2331
2331
|
], ({ inner }, isInner) => inner.toString(isInner));
|
|
2332
2332
|
//#endregion
|
|
2333
|
-
//#region ../../node_modules
|
|
2333
|
+
//#region ../../node_modules/@deepseek-ai/dsh-timeout/lib/index.js
|
|
2334
2334
|
/** Largest delay Node schedules without clamping it to one millisecond. */
|
|
2335
2335
|
const MAX_TIMER_DELAY_MS = 2147483647;
|
|
2336
2336
|
//#endregion
|
|
2337
|
-
//#region ../../node_modules
|
|
2337
|
+
//#region ../../node_modules/@deepseek-ai/dsh-llm/lib/index.js
|
|
2338
2338
|
/**
|
|
2339
2339
|
* Detach and deep-freeze a message whose identity already exists.
|
|
2340
2340
|
* @param message - complete message, including its stable identity.
|
|
@@ -3411,12 +3411,17 @@ var LlmError = class extends HarnessError {
|
|
|
3411
3411
|
if (typeof model.provider !== "string" || model.provider !== provider || typeof model.id !== "string" || model.id.length === 0 || typeof model.name !== "string" || model.name.length === 0 || model.description !== void 0 && typeof model.description !== "string" || seen.has(model.id)) throw new LlmError(`adapter returned invalid or duplicate model metadata for provider "${provider}"`, "INVALID_CATALOG");
|
|
3412
3412
|
seen.add(model.id);
|
|
3413
3413
|
const inputModalities = this.detachedModalities(model.inputModalities);
|
|
3414
|
+
const badge = model.badge;
|
|
3414
3415
|
return {
|
|
3415
3416
|
provider: model.provider,
|
|
3416
3417
|
id: model.id,
|
|
3417
3418
|
name: model.name,
|
|
3418
3419
|
...model.description === void 0 ? {} : { description: model.description },
|
|
3419
|
-
...inputModalities === void 0 ? {} : { inputModalities }
|
|
3420
|
+
...inputModalities === void 0 ? {} : { inputModalities },
|
|
3421
|
+
...badge === void 0 ? {} : { badge: {
|
|
3422
|
+
text: typeof badge.text === "string" ? badge.text : { ...badge.text },
|
|
3423
|
+
tone: badge.tone
|
|
3424
|
+
} }
|
|
3420
3425
|
};
|
|
3421
3426
|
});
|
|
3422
3427
|
}
|
|
@@ -3843,14 +3848,15 @@ async function callLlmText(llm, request) {
|
|
|
3843
3848
|
provider: request.route.provider,
|
|
3844
3849
|
model: request.route.model,
|
|
3845
3850
|
...effort ? { reasoningEffort: ReasoningEffortId(effort) } : {},
|
|
3846
|
-
maxTokens: request.maxTokens
|
|
3851
|
+
...request.maxTokens !== void 0 ? { maxTokens: request.maxTokens } : {}
|
|
3847
3852
|
}, request.signal, request.configure);
|
|
3848
3853
|
if (!live()) throw Object.assign(/* @__PURE__ */ new Error("调用已取消。"), { name: "AbortError" });
|
|
3854
|
+
const maxTokens = request.maxTokens === void 0 ? prepared.config.maxTokens : Math.min(request.maxTokens, prepared.config.maxTokens ?? request.maxTokens);
|
|
3849
3855
|
const options = {
|
|
3850
3856
|
provider: prepared.config.provider,
|
|
3851
3857
|
model: prepared.config.model,
|
|
3852
3858
|
...prepared.config.reasoningEffort ? { reasoningEffort: prepared.config.reasoningEffort } : {},
|
|
3853
|
-
...
|
|
3859
|
+
...maxTokens !== void 0 ? { maxTokens } : {},
|
|
3854
3860
|
...prepared.config.temperature !== void 0 ? { temperature: prepared.config.temperature } : {},
|
|
3855
3861
|
...prepared.config.stop ? { stop: [...prepared.config.stop] } : {},
|
|
3856
3862
|
system: request.system,
|
|
@@ -4786,7 +4792,6 @@ var GitCommitService = class {
|
|
|
4786
4792
|
text: buildPlanText(planInput, Math.max(1024, MAX_MANIFEST_CHARS - envelopeBase.length)),
|
|
4787
4793
|
route: planned.route,
|
|
4788
4794
|
system: planSystemPrompt(),
|
|
4789
|
-
maxTokens: DEFAULT_MAX_OUTPUT_TOKENS,
|
|
4790
4795
|
signal,
|
|
4791
4796
|
sessionId
|
|
4792
4797
|
});
|