@eddyskywalker/dsh-chatgpt-subscription 0.65.0 → 0.66.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/CHANGELOG.md +47 -0
- package/lib/client.js +257 -18
- package/lib/client.js.map +1 -1
- package/lib/index.js +2509 -1061
- package/lib/types/client/antigravity/styles.d.ts.map +1 -1
- package/lib/types/client/glm-coding-plan/styles.d.ts.map +1 -1
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -1
- package/lib/types/client/kimi-code/locales.d.ts +50 -2
- package/lib/types/client/kimi-code/locales.d.ts.map +1 -1
- package/lib/types/client/kimi-code/styles.d.ts.map +1 -1
- package/lib/types/client/locales-ru/kimi-code.d.ts.map +1 -1
- package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
- package/lib/types/client/locales-ru/step-code.d.ts.map +1 -1
- package/lib/types/client/progress-updates/locales.d.ts +23 -11
- package/lib/types/client/progress-updates/locales.d.ts.map +1 -1
- package/lib/types/client/progress-updates/settings-binding.d.ts +11 -1
- package/lib/types/client/progress-updates/settings-binding.d.ts.map +1 -1
- package/lib/types/client/progress-updates/settings-section.d.ts +2 -2
- package/lib/types/client/progress-updates/settings-section.d.ts.map +1 -1
- package/lib/types/client/step-code/StepCodeSection.d.ts.map +1 -1
- package/lib/types/client/step-code/locales.d.ts +5 -2
- package/lib/types/client/step-code/locales.d.ts.map +1 -1
- package/lib/types/client/workbuddy/styles.d.ts.map +1 -1
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/host/antigravity/adapter.d.ts +2 -0
- package/lib/types/host/antigravity/adapter.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/budget.d.ts +2 -2
- package/lib/types/host/cache-warmup/budget.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/contracts.d.ts +3 -1
- package/lib/types/host/cache-warmup/contracts.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/install.d.ts +4 -4
- package/lib/types/host/cache-warmup/install.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/projection.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/result-tool.d.ts +3 -1
- package/lib/types/host/cache-warmup/result-tool.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/settings.d.ts +5 -1
- package/lib/types/host/cache-warmup/settings.d.ts.map +1 -1
- package/lib/types/host/cache-warmup/usage.d.ts +1 -1
- package/lib/types/host/cache-warmup/usage.d.ts.map +1 -1
- package/lib/types/host/claude/adapter.d.ts +3 -0
- package/lib/types/host/claude/adapter.d.ts.map +1 -1
- package/lib/types/host/cline-pass/mapper.d.ts.map +1 -1
- package/lib/types/host/common/account-pool.d.ts +27 -1
- package/lib/types/host/common/account-pool.d.ts.map +1 -1
- package/lib/types/host/common/cache-activity.d.ts +14 -0
- package/lib/types/host/common/cache-activity.d.ts.map +1 -0
- package/lib/types/host/common/cache-affinity.d.ts +23 -0
- package/lib/types/host/common/cache-affinity.d.ts.map +1 -0
- package/lib/types/host/common/cache-hint.d.ts +18 -0
- package/lib/types/host/common/cache-hint.d.ts.map +1 -0
- package/lib/types/host/common/failure-classification.d.ts +21 -0
- package/lib/types/host/common/failure-classification.d.ts.map +1 -0
- package/lib/types/host/common/hosted-media.d.ts +36 -0
- package/lib/types/host/common/hosted-media.d.ts.map +1 -0
- package/lib/types/host/common/prefix-request-coordinator.d.ts +46 -0
- package/lib/types/host/common/prefix-request-coordinator.d.ts.map +1 -0
- package/lib/types/host/common/prefix-stability.d.ts +24 -0
- package/lib/types/host/common/prefix-stability.d.ts.map +1 -0
- package/lib/types/host/common/prompt-cache-policy.d.ts +43 -0
- package/lib/types/host/common/prompt-cache-policy.d.ts.map +1 -0
- package/lib/types/host/common/reasoning-dialect.d.ts +24 -0
- package/lib/types/host/common/reasoning-dialect.d.ts.map +1 -0
- package/lib/types/host/common/session-cache-state.d.ts +29 -0
- package/lib/types/host/common/session-cache-state.d.ts.map +1 -0
- package/lib/types/host/common/sticky-image-budget.d.ts +10 -0
- package/lib/types/host/common/sticky-image-budget.d.ts.map +1 -0
- package/lib/types/host/common/tool-runaway.d.ts +52 -0
- package/lib/types/host/common/tool-runaway.d.ts.map +1 -0
- package/lib/types/host/glm-coding-plan/adapter.d.ts +11 -0
- package/lib/types/host/glm-coding-plan/adapter.d.ts.map +1 -1
- package/lib/types/host/kimi-code/account-pool.d.ts +19 -2
- package/lib/types/host/kimi-code/account-pool.d.ts.map +1 -1
- package/lib/types/host/kimi-code/adapter.d.ts +48 -40
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
- package/lib/types/host/kimi-code/cache-affinity.d.ts +112 -0
- package/lib/types/host/kimi-code/cache-affinity.d.ts.map +1 -0
- package/lib/types/host/kimi-code/cache-hint.d.ts +3 -28
- package/lib/types/host/kimi-code/cache-hint.d.ts.map +1 -1
- package/lib/types/host/kimi-code/cache-wait.d.ts +6 -4
- package/lib/types/host/kimi-code/cache-wait.d.ts.map +1 -1
- package/lib/types/host/kimi-code/mapper.d.ts +13 -7
- package/lib/types/host/kimi-code/mapper.d.ts.map +1 -1
- package/lib/types/host/kimi-code/media-files.d.ts +2 -28
- package/lib/types/host/kimi-code/media-files.d.ts.map +1 -1
- package/lib/types/host/kimi-code/repeat-breaker.d.ts +13 -16
- package/lib/types/host/kimi-code/repeat-breaker.d.ts.map +1 -1
- package/lib/types/host/kimi-code/routes.d.ts.map +1 -1
- package/lib/types/host/kimi-code/session-cache-state.d.ts +34 -54
- package/lib/types/host/kimi-code/session-cache-state.d.ts.map +1 -1
- package/lib/types/host/kimi-code/tool-argument-guard.d.ts +36 -0
- package/lib/types/host/kimi-code/tool-argument-guard.d.ts.map +1 -0
- package/lib/types/host/kimi-code/tool-argument-recovery.d.ts +16 -0
- package/lib/types/host/kimi-code/tool-argument-recovery.d.ts.map +1 -0
- package/lib/types/host/minimax-code/adapter.d.ts +5 -1
- package/lib/types/host/minimax-code/adapter.d.ts.map +1 -1
- package/lib/types/host/minimax-code/files-api.d.ts.map +1 -1
- package/lib/types/host/minimax-code/runtime-enhancements.d.ts.map +1 -1
- package/lib/types/host/opendesign/mapper.d.ts.map +1 -1
- package/lib/types/host/qoder/mapper.d.ts.map +1 -1
- package/lib/types/host/responses-client.d.ts +4 -0
- package/lib/types/host/responses-client.d.ts.map +1 -1
- package/lib/types/host/step-code/account-pool.d.ts +2 -2
- package/lib/types/host/step-code/account-pool.d.ts.map +1 -1
- package/lib/types/host/step-code/adapter.d.ts +10 -0
- package/lib/types/host/step-code/adapter.d.ts.map +1 -1
- package/lib/types/host/step-code/routes.d.ts +3 -0
- package/lib/types/host/step-code/routes.d.ts.map +1 -1
- package/lib/types/index.d.ts +22 -3
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/kimi-code-contracts.d.ts +79 -0
- package/lib/types/shared/kimi-code-contracts.d.ts.map +1 -1
- package/lib/types/shared/step-code-contracts.d.ts +5 -0
- package/lib/types/shared/step-code-contracts.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky-image-budget.d.ts","sourceRoot":"","sources":["../../../../src/host/common/sticky-image-budget.ts"],"names":[],"mappings":"AAyBA,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiD;gBAE3D,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAS/C,8EAA8E;IAC9E,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAKzD,+DAA+D;IAC/D,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI;IAKtE,KAAK,IAAI,IAAI;CACd"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral tool-call repetition primitives.
|
|
3
|
+
*
|
|
4
|
+
* The detector knows nothing about model wire formats. Providers supply reminder
|
|
5
|
+
* text and may opt into a hard handoff threshold; coordination tools are exempt
|
|
6
|
+
* because they are expected to recur while real work continues.
|
|
7
|
+
*/
|
|
8
|
+
/** Stable identity for one tool call, independent of object key order. */
|
|
9
|
+
export declare function canonicalToolCallKey(toolName: string, args: unknown): string;
|
|
10
|
+
export interface ExactRepeatObservation {
|
|
11
|
+
readonly key: string;
|
|
12
|
+
readonly count: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ExactRepeatTracker {
|
|
15
|
+
observe(toolName: string, args: unknown): ExactRepeatObservation;
|
|
16
|
+
current(): ExactRepeatObservation | undefined;
|
|
17
|
+
reset(): void;
|
|
18
|
+
}
|
|
19
|
+
/** One immediately-repeated action streak. A different action starts at one. */
|
|
20
|
+
export declare function createExactRepeatTracker(): ExactRepeatTracker;
|
|
21
|
+
/** Coordination calls that must not break or inflate an action streak. */
|
|
22
|
+
export declare const TOOL_RUNAWAY_EXEMPT_TOOLS: readonly string[];
|
|
23
|
+
export declare function isToolRunawayExemptTool(toolName: string): boolean;
|
|
24
|
+
export interface ToolRunawayGuardConfig {
|
|
25
|
+
readonly toolRunawayGuard?: boolean | {
|
|
26
|
+
get(): boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Read the live global switch; legacy Kimi-only installs without it stay on. */
|
|
30
|
+
export declare function resolveToolRunawayGuardEnabled(config?: ToolRunawayGuardConfig): boolean;
|
|
31
|
+
export interface ExactRepeatBreakerOptions {
|
|
32
|
+
/** Reminder for a completed execution; undefined leaves the decision untouched. */
|
|
33
|
+
readonly reminder: (count: number) => string | undefined;
|
|
34
|
+
/** Optional execution veto once the same call reaches this count. */
|
|
35
|
+
readonly forceStopAt?: number;
|
|
36
|
+
readonly handoffReminder?: string;
|
|
37
|
+
readonly handoffVeto?: string;
|
|
38
|
+
readonly exemptTools?: readonly string[];
|
|
39
|
+
/** Bound on remembered sessions; least-recently-written is evicted first. */
|
|
40
|
+
readonly maxSessions?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ExactRepeatBreaker {
|
|
43
|
+
checkBeforeExecute(sessionId: string, toolName: string, args: unknown): string | undefined;
|
|
44
|
+
recordAfterExecute(sessionId: string, toolName: string, args: unknown): string | undefined;
|
|
45
|
+
resetSession(sessionId: string): void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Exact-repeat state machine shared by provider profiles. A missing forceStopAt
|
|
49
|
+
* gives reminders only; no provider inherits Kimi's hard stop accidentally.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createExactRepeatBreaker(options: ExactRepeatBreakerOptions): ExactRepeatBreaker;
|
|
52
|
+
//# sourceMappingURL=tool-runaway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-runaway.d.ts","sourceRoot":"","sources":["../../../../src/host/common/tool-runaway.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAQ5E;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,sBAAsB,CAAA;IAChE,OAAO,IAAI,sBAAsB,GAAG,SAAS,CAAA;IAC7C,KAAK,IAAI,IAAI,CAAA;CACd;AAED,gFAAgF;AAChF,wBAAgB,wBAAwB,IAAI,kBAAkB,CAc7D;AAED,0EAA0E;AAC1E,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAYrD,CAAA;AAEF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG;QAAE,GAAG,IAAI,OAAO,GAAG,SAAS,CAAA;KAAE,CAAA;CACrE;AAED,iFAAiF;AACjF,wBAAgB,8BAA8B,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAMvF;AAED,MAAM,WAAW,yBAAyB;IACxC,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;IACxD,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IAC1F,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IAC1F,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAQD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CA6C/F"}
|
|
@@ -122,6 +122,7 @@ export declare class GlmCodingPlanAdapter extends LlmAdapter {
|
|
|
122
122
|
private readonly preferences;
|
|
123
123
|
private readonly accountPool;
|
|
124
124
|
private readonly options;
|
|
125
|
+
private catalogRegionSnapshot;
|
|
125
126
|
constructor(store?: GlmCodingPlanCredentialStore, modelSettings?: GlmCodingPlanModelSettingsStore, preferences?: GlmCodingPlanPreferenceStore, options?: GlmCodingPlanAdapterOptions);
|
|
126
127
|
providerInfo(provider: string): LlmProviderInfo;
|
|
127
128
|
providerRetryPolicy(): ResolvedRetryPolicy;
|
|
@@ -134,6 +135,16 @@ export declare class GlmCodingPlanAdapter extends LlmAdapter {
|
|
|
134
135
|
* 实时目录只由 `/catalog/refresh` 与连接测试拉取,落进 `client.ts` 的缓存。
|
|
135
136
|
*/
|
|
136
137
|
private catalog;
|
|
138
|
+
/**
|
|
139
|
+
* 模型目录只需要区域,不需要一把可发请求的凭据。
|
|
140
|
+
*
|
|
141
|
+
* 这里刻意不调用 credentialFor:那是真实请求的选号入口,会重复解密号池并回写
|
|
142
|
+
* lastUsedAt。目录构建会为每个模型并发调用 resolveModel,把它放在这里会让一次
|
|
143
|
+
* 选择器刷新放大成一串 DPAPI 读写。区域快照按号池 revision 与指定账号失效,
|
|
144
|
+
* 同一代的并发调用共享同一次只读;读不到或尚未登录时不缓存,登录后即可重试。
|
|
145
|
+
*/
|
|
146
|
+
private catalogRegion;
|
|
147
|
+
private readCatalogRegion;
|
|
137
148
|
/**
|
|
138
149
|
* 这一行请求用哪份凭据。
|
|
139
150
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/host/glm-coding-plan/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,UAAU,EAIV,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAA;AAM7B,OAAO,EAA4B,KAAK,eAAe,IAAI,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAGrH,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAA;AAQpC,OAAO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AAoB,CAAC;IAoClG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/F,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;IAUnE;;;;;OAKG;YACY,aAAa;CAmK7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountPoolCore, type AccountPoolRefreshOptions, type PoolAccountShape, type PoolData } from '../common/account-pool.ts';
|
|
1
|
+
import { AccountPoolCore, type AccountPoolRefreshOptions, type AccountSelectionHint, type PoolAccountShape, type PoolData } from '../common/account-pool.ts';
|
|
2
2
|
import type { CredentialStore } from '../token-store.ts';
|
|
3
3
|
import { FileCredentialStore, type KimiCodeCredentials } from './token-store.ts';
|
|
4
4
|
import type { PoolAccountQuotaDto } from '../../shared/account-pool-contracts.ts';
|
|
@@ -68,11 +68,28 @@ export declare class KimiCodeAccountPool extends AccountPoolCore<KimiCodeCredent
|
|
|
68
68
|
*
|
|
69
69
|
* The returned credential carries its own region, OAuth host and base URL, so
|
|
70
70
|
* the caller must use those rather than the process-wide defaults.
|
|
71
|
+
*
|
|
72
|
+
* @param selection - this request's own preference, used by the cache-affinity
|
|
73
|
+
* routing to put an account whose prefix cache is still warm first. Absent
|
|
74
|
+
* means the rotation strategy decides alone.
|
|
71
75
|
*/
|
|
72
|
-
getEffectiveCredential(excludeIds?: ReadonlySet<string>, fetchFn?: typeof fetch, options?: AccountPoolRefreshOptions): Promise<{
|
|
76
|
+
getEffectiveCredential(excludeIds?: ReadonlySet<string>, fetchFn?: typeof fetch, options?: AccountPoolRefreshOptions, selection?: AccountSelectionHint): Promise<{
|
|
73
77
|
account: KimiCodePoolAccount;
|
|
74
78
|
credentials: KimiCodeCredentials;
|
|
75
79
|
}>;
|
|
80
|
+
/**
|
|
81
|
+
* Every pooled account's id with the region that decides its prefix group.
|
|
82
|
+
*
|
|
83
|
+
* The cache-affinity routing needs exactly two facts per account — which one
|
|
84
|
+
* it is, and which regional service answers it, because each region keeps its
|
|
85
|
+
* own prefix cache — and nothing else. Deliberately a narrow projection over
|
|
86
|
+
* the pool document rather than a credential read: tokens never leave the
|
|
87
|
+
* pool, and nothing here can be mistaken for a credential accessor.
|
|
88
|
+
*/
|
|
89
|
+
accountScopes(): Promise<Array<{
|
|
90
|
+
id: string;
|
|
91
|
+
region: KimiCodeRegion | null;
|
|
92
|
+
}>>;
|
|
76
93
|
/** The pre-pool credential file this pool mirrors its primary account into. */
|
|
77
94
|
mirrorStore(): FileCredentialStore;
|
|
78
95
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/account-pool.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAGf,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EACL,mBAAmB,EAEnB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAA;AAKzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AACjF,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,cAAc,EACf,MAAM,qCAAqC,CAAA;AAE5C,oFAAoF;AACpF,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB,CAAC,mBAAmB,CAAC;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,IAAI,MAAM,CAE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B,OAAO,CAAC;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,WAAW,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAI9E;;;;;;;;OAQG;IACG,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAQpF,+EAA+E;IAC/E,WAAW,IAAI,mBAAmB;IAIlC;;;;;;;;;;;;;;;OAeG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CA8B/E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ProviderFailureClassification } from '../common/failure-classification.ts';
|
|
1
2
|
import { LlmAdapter, ReasoningEffortId, type GenerateOptions, type LlmModelInfo, type LlmProviderInfo, type LlmResolvedModelInfo, type PreparedAdapterCall, type ResolvedRetryPolicy, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
2
3
|
import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
3
4
|
import { PROVIDER_ID, reasoningEffortsFor } from './types.ts';
|
|
@@ -70,7 +71,11 @@ export declare function resolveDefaultReasoningEffort(efforts: readonly string[]
|
|
|
70
71
|
* retried. The body text is what separates them, so the classification reads
|
|
71
72
|
* it rather than trusting the status alone.
|
|
72
73
|
*/
|
|
73
|
-
|
|
74
|
+
/** What the account pool may do with one failed attempt. */
|
|
75
|
+
export type KimiPoolAction = 'retry-same-account' | 'cooldown-and-rotate' | 'mark-auth-failed' | 'none';
|
|
76
|
+
export interface KimiFailureClassification extends ProviderFailureClassification {
|
|
77
|
+
/** Account-pool side effect, kept separate from the retry code. */
|
|
78
|
+
poolAction: KimiPoolAction;
|
|
74
79
|
/** DSH error code; decides whether the route retries. */
|
|
75
80
|
code: string;
|
|
76
81
|
/** Message shown to the user, with the provider's own text appended. */
|
|
@@ -241,6 +246,15 @@ export interface KimiCodeAdapterOptions {
|
|
|
241
246
|
* per account rather than once per turn.
|
|
242
247
|
*/
|
|
243
248
|
mediaFiles?: KimiMediaFilesUploader;
|
|
249
|
+
/**
|
|
250
|
+
* Whether a request may state an account preference from the prefix cache.
|
|
251
|
+
*
|
|
252
|
+
* A live getter rather than a captured boolean: the switch is volatile in
|
|
253
|
+
* settings, and a captured value would keep routing by an answer the user has
|
|
254
|
+
* already changed. Absent means enabled — the behaviour the routing has when
|
|
255
|
+
* nothing turns it off.
|
|
256
|
+
*/
|
|
257
|
+
cacheAffinity?: () => boolean;
|
|
244
258
|
}
|
|
245
259
|
/**
|
|
246
260
|
* Longest edge of the request version this route asks the attachment store for.
|
|
@@ -284,37 +298,16 @@ export declare const KIMI_CODE_REQUEST_IMAGE_MAX_EDGE = 2000;
|
|
|
284
298
|
* @returns the tool-update mode, or undefined when this route must resend everything.
|
|
285
299
|
*/
|
|
286
300
|
export declare function toolUpdateMode(modelId: string, catalog: readonly KimiCodeCatalogModel[]): 'in-history' | undefined;
|
|
287
|
-
/**
|
|
288
|
-
* How long a cold-start follower waits for the leader warming the same prefix.
|
|
289
|
-
*
|
|
290
|
-
* The leader only has to reach the response headers: past that the service is
|
|
291
|
-
* already processing the prefix, and a follower that waited out the whole
|
|
292
|
-
* budget would have lost more than the shared warm-up was worth.
|
|
293
|
-
*/
|
|
301
|
+
/** How long a cold-start follower waits for the leader warming the same prefix. */
|
|
294
302
|
export declare const COLD_START_WARMUP_WAIT_MS = 2500;
|
|
295
|
-
/**
|
|
296
|
-
* Forget every remembered prefix and release every waiting follower.
|
|
297
|
-
*
|
|
298
|
-
* Test seam only: these maps are process-wide, and a test that asserts on the
|
|
299
|
-
* cold-start gate must start from a clean slate.
|
|
300
|
-
*/
|
|
303
|
+
/** Forget every remembered prefix and release every waiting follower. */
|
|
301
304
|
export declare function resetColdStartSingleflightForTests(): void;
|
|
302
|
-
/**
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
* the key because each region is a separate service with a cache of its own.
|
|
309
|
-
*
|
|
310
|
-
* A request with no system prompt has no prefix worth warming, and gets no
|
|
311
|
-
* group at all.
|
|
312
|
-
*
|
|
313
|
-
* @param region - The region the request will be answered from.
|
|
314
|
-
* @param options - The request about to be sent.
|
|
315
|
-
* @returns The group key, or undefined when the request has no prefix.
|
|
316
|
-
*/
|
|
317
|
-
export declare function coldStartGroupKey(region: string, options: NormalizedGenerateOptions): string | undefined;
|
|
305
|
+
/** The prefix identity shared by requests on one region/model. */
|
|
306
|
+
export declare function prefixGroupKey(region: string, options: NormalizedGenerateOptions): string | undefined;
|
|
307
|
+
/** The cache group on one account; cross-account warmth is never inferred. */
|
|
308
|
+
export declare function coldStartGroupKey(region: string, options: NormalizedGenerateOptions, accountScope: string): string | undefined;
|
|
309
|
+
/** Whether this account's prefix is still warm under the measured Kimi TTL. */
|
|
310
|
+
export declare function isWarmPrefixGroup(region: string, options: NormalizedGenerateOptions, accountScope: string, now?: number): boolean;
|
|
318
311
|
export declare class KimiCodeAdapter extends LlmAdapter {
|
|
319
312
|
private readonly store;
|
|
320
313
|
private readonly modelSettings;
|
|
@@ -380,6 +373,31 @@ export declare class KimiCodeAdapter extends LlmAdapter {
|
|
|
380
373
|
maxBytes: number;
|
|
381
374
|
};
|
|
382
375
|
private settings;
|
|
376
|
+
/** Whether this deployment routes by warm prefix cache; on unless switched off. */
|
|
377
|
+
private cacheAffinityEnabled;
|
|
378
|
+
/**
|
|
379
|
+
* Which accounts this request would rather be served by, when the prefix cache
|
|
380
|
+
* can say something useful about it.
|
|
381
|
+
*
|
|
382
|
+
* The service keeps one prefix cache per account, so rotation — which knows
|
|
383
|
+
* cooldowns, tokens and last use, never prompt content — can spend a request on
|
|
384
|
+
* an account that has never seen this prompt while another one has it hot. Both
|
|
385
|
+
* facts needed to do better are already in this process: the cold-start gate
|
|
386
|
+
* records which (prefix, account) pairs are warm, and the quota cache says how
|
|
387
|
+
* much each account has left.
|
|
388
|
+
*
|
|
389
|
+
* Returns undefined — no preference at all — wherever a preference would be a
|
|
390
|
+
* guess: the switch is off, there is no pool or only one account, the pool
|
|
391
|
+
* document cannot be read, a region cannot be resolved, or no account has this
|
|
392
|
+
* prefix warm. The pool then applies its rotation strategy exactly as it would
|
|
393
|
+
* have without this method.
|
|
394
|
+
*
|
|
395
|
+
* @param pool - The account pool serving this route, or null when none is installed.
|
|
396
|
+
* @param options - The request about to be sent; its system prompt, tools and
|
|
397
|
+
* static bootstrap are what decide the prefix identity.
|
|
398
|
+
* @returns a preference for the pool, or undefined for "strategy decides".
|
|
399
|
+
*/
|
|
400
|
+
private cacheAffinityHint;
|
|
383
401
|
/**
|
|
384
402
|
* Catalog for the picker: the live managed listing when reachable, the
|
|
385
403
|
* shipped fallback otherwise, narrowed by the user's enabled selection.
|
|
@@ -427,16 +445,6 @@ export declare class KimiCodeAdapter extends LlmAdapter {
|
|
|
427
445
|
* policy owns the repeat.
|
|
428
446
|
*/
|
|
429
447
|
private inBandStreamFailure;
|
|
430
|
-
/**
|
|
431
|
-
* Cool the account whose own rate limit the stream reported.
|
|
432
|
-
*
|
|
433
|
-
* The window this route already defaults to, never a Retry-After: there is no
|
|
434
|
-
* 429 response to read one from, and a delay stated on the 200 belongs to a
|
|
435
|
-
* different message. An account-scoped verdict takes its own window instead,
|
|
436
|
-
* because a spent balance is not back-pressure and 15 minutes would put the
|
|
437
|
-
* account back into rotation four times inside the window that refused it.
|
|
438
|
-
*/
|
|
439
|
-
private coolInBandRateLimit;
|
|
440
448
|
}
|
|
441
449
|
export { clearCachedCatalog, buildModelOptions, reasoningEffortsFor, PROVIDER_ID };
|
|
442
450
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRo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,OAAO,CAAC,aAAa,CAAoC;IAEzD,+EAA+E;IAC/E,OAAO,CAAC,UAAU;IAQlB;;;;;;;;;;;;;;;;;;OAkBG;YACW,uBAAuB;IAuCrC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IAI/C,mBAAmB,IAAI,mBAAmB;IAI1C,mBAAmB,IAAI,SAAS;IAIhC,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;;;;;;;;;;IAQ/E,OAAO,CAAC,QAAQ;IAIhB,mFAAmF;IACnF,OAAO,CAAC,oBAAoB;IAQ5B;;;;;;;;;;;;;;;;;;;;;OAqBG;YACW,iBAAiB;IA0D/B;;;OAGG;YACW,OAAO;IA0BrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,gBAAgB;IAYlB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;IAmB/D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6CpG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/F,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;YAgBpD,aAAa;IA2tB5B;;;;;;;;;;;;;;;OAeG;YACW,mBAAmB;CA8ClC;AAqFD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which account should serve this request when one of them still has it warm.
|
|
3
|
+
*
|
|
4
|
+
* Kimi's prefix cache lives on the service, one cache per account, so two
|
|
5
|
+
* accounts in the same pool do not share a warm prefix: the account that
|
|
6
|
+
* answered this exact prompt a minute ago reads it back at the cache price,
|
|
7
|
+
* while the account the rotation strategy happens to pick reprocesses the whole
|
|
8
|
+
* thing. Rotation cannot see that difference — it knows cooldowns, tokens and
|
|
9
|
+
* last use, never prompt content — so the request names the accounts it would
|
|
10
|
+
* rather use and the pool honours the order.
|
|
11
|
+
*
|
|
12
|
+
* The whole decision is here, as a pure function of four inputs, for the same
|
|
13
|
+
* reason `cache-hint` is: the numbers behind it (how long an entry survives, how
|
|
14
|
+
* much a cache read costs against a fresh one) are measured elsewhere, and
|
|
15
|
+
* swapping a source must change only where a value comes from, never the rule.
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-chatgpt-subscription/kimi-code-cache-affinity
|
|
18
|
+
*/
|
|
19
|
+
import type { KimiCodeAccountQuota } from '../../shared/kimi-code-contracts.ts';
|
|
20
|
+
/**
|
|
21
|
+
* Remaining share below which a warm account stops being preferred.
|
|
22
|
+
*
|
|
23
|
+
* Affinity is a discount, not a right: an account holding 4% of its window can
|
|
24
|
+
* serve a few cheap cache reads and then take the line offline mid-conversation,
|
|
25
|
+
* which costs far more than the prefix it saved. 20% is the same floor the
|
|
26
|
+
* background warmup uses before it spends anything (`DEFAULT_MIN_WARMUP_QUOTA_RATIO`),
|
|
27
|
+
* so the two decisions agree about when an account is running dry instead of
|
|
28
|
+
* each inventing its own answer.
|
|
29
|
+
*/
|
|
30
|
+
export declare const AFFINITY_QUOTA_FLOOR_SHARE = 0.2;
|
|
31
|
+
/**
|
|
32
|
+
* The share of its tightest window an account has left, or null when unknown.
|
|
33
|
+
*
|
|
34
|
+
* The TIGHTEST window is the only honest answer: a pool row can carry several
|
|
35
|
+
* at once, and an account with 90% of a weekly window but 2% of its five-hour
|
|
36
|
+
* one is about to be refused. A window whose consumption was never measured
|
|
37
|
+
* is skipped rather than read as empty or full, and a snapshot with no measured
|
|
38
|
+
* window at all answers null — "unknown", which the caller treats as "not
|
|
39
|
+
* provably short" instead of blocking the account on a number nobody measured.
|
|
40
|
+
*
|
|
41
|
+
* @param quota - The account's newest quota snapshot, when one was ever read.
|
|
42
|
+
* @returns the smallest remaining fraction in `[0, 1]`, or null when unknown.
|
|
43
|
+
*/
|
|
44
|
+
export declare function remainingQuotaShare(quota: KimiCodeAccountQuota | null | undefined): number | null;
|
|
45
|
+
/** Settings-card description for the cache-affinity switch. */
|
|
46
|
+
export declare const CACHE_AFFINITY_SETTING_DESCRIPTION: string;
|
|
47
|
+
/**
|
|
48
|
+
* Environment override for the affinity switch.
|
|
49
|
+
*
|
|
50
|
+
* The same contract as the wait-time warmup switch beside it in settings: an
|
|
51
|
+
* explicit value wins over the stored setting, so a deployment can pin the
|
|
52
|
+
* behavioural change without editing preferences on disk.
|
|
53
|
+
*/
|
|
54
|
+
export declare const CACHE_AFFINITY_ENV = "DSH_KIMI_CODE_CACHE_AFFINITY";
|
|
55
|
+
/**
|
|
56
|
+
* Resolve whether cache-affinity routing is enabled.
|
|
57
|
+
*
|
|
58
|
+
* Enabled by default. `0`/`false`/`no`/`off` and `1`/`true`/`yes`/`on` override
|
|
59
|
+
* the stored setting; otherwise the live `cacheAffinity` setting (default
|
|
60
|
+
* `true`) governs. Anything unreadable falls back to enabled rather than
|
|
61
|
+
* throwing inside a request path.
|
|
62
|
+
*
|
|
63
|
+
* @param config - Plugin config carrying the live setting.
|
|
64
|
+
* @param env - Environment to consult; `process.env` in production.
|
|
65
|
+
* @returns whether a request may state an account preference.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveCacheAffinityEnabled(config?: {
|
|
68
|
+
cacheAffinity?: {
|
|
69
|
+
get(): boolean | undefined;
|
|
70
|
+
} | boolean;
|
|
71
|
+
}, env?: Record<string, string | undefined>): boolean;
|
|
72
|
+
/** One account the request could be served by. */
|
|
73
|
+
export interface AffinityCandidate {
|
|
74
|
+
/** Pool account id. */
|
|
75
|
+
readonly id: string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether this account's own prefix group for this request is warm right now.
|
|
78
|
+
*
|
|
79
|
+
* Per account by design: the pool's cache is per account, so "the prefix is
|
|
80
|
+
* warm" is a fact about one account, never about the pool.
|
|
81
|
+
*/
|
|
82
|
+
readonly warm: boolean;
|
|
83
|
+
}
|
|
84
|
+
export interface AffinityOrderInput {
|
|
85
|
+
/** Accounts that may serve this request right now, in pool order. */
|
|
86
|
+
readonly candidates: readonly AffinityCandidate[];
|
|
87
|
+
/** Remaining share per account id; a missing or null entry means unknown. */
|
|
88
|
+
readonly remainingShareById?: Readonly<Record<string, number | null | undefined>>;
|
|
89
|
+
/** Floor below which a warm account gives way; defaults to {@link AFFINITY_QUOTA_FLOOR_SHARE}. */
|
|
90
|
+
readonly floorShare?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Order the accounts this request would rather use, warmest and safest first.
|
|
94
|
+
*
|
|
95
|
+
* Only accounts whose prefix is warm AND whose remaining share is either
|
|
96
|
+
* unknown or at least the floor are returned: a warm account that is nearly
|
|
97
|
+
* spent is deliberately absent, because the pool then falls back to its own
|
|
98
|
+
* rotation instead of spending the last of a window on a discount. An empty
|
|
99
|
+
* result means "no preference" — the caller passes no hint at all and the
|
|
100
|
+
* strategy behaves exactly as it would have without this module.
|
|
101
|
+
*
|
|
102
|
+
* Order: a warm account with a known-and-sufficient share first (largest
|
|
103
|
+
* remaining first, so two warm accounts spread the load instead of always
|
|
104
|
+
* spending one), then a warm account whose share nobody measured. Unknown last
|
|
105
|
+
* because a measured account is a better bet than an unmeasured one, but still
|
|
106
|
+
* listed: an unmeasured warm account is not evidence of anything bad.
|
|
107
|
+
*
|
|
108
|
+
* @param input - candidates plus the quota evidence behind them.
|
|
109
|
+
* @returns account ids in preference order; empty when nothing is preferred.
|
|
110
|
+
*/
|
|
111
|
+
export declare function orderAffinityCandidates(input: AffinityOrderInput): string[];
|
|
112
|
+
//# sourceMappingURL=cache-affinity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAE3E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CacheHintDecision, type CacheHintInput } from '../common/cache-hint.ts';
|
|
1
2
|
/**
|
|
2
3
|
* When it is worth telling the user their prompt cache has gone cold.
|
|
3
4
|
*
|
|
@@ -58,33 +59,7 @@ export declare function markSessionActive(sessionId: string | undefined, now?: n
|
|
|
58
59
|
export declare function sessionLastActiveAt(sessionId: string | undefined): number | undefined;
|
|
59
60
|
/** Forget one session's activity, or all of it. Test seam and teardown. */
|
|
60
61
|
export declare function resetSessionActivity(sessionId?: string): void;
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
readonly now: number;
|
|
64
|
-
/**
|
|
65
|
-
* When the conversation last did anything, epoch ms.
|
|
66
|
-
*
|
|
67
|
-
* Absent means nothing is known, and the hint is skipped: a client that
|
|
68
|
-
* cannot say how long the session was idle cannot claim the entry expired.
|
|
69
|
-
*/
|
|
70
|
-
readonly lastActiveAt?: number;
|
|
71
|
-
/** Context currently loaded, in tokens. Absent means no local estimate. */
|
|
72
|
-
readonly totalTokens?: number;
|
|
73
|
-
}
|
|
74
|
-
export type CacheHintDecision = {
|
|
75
|
-
readonly kind: 'skip';
|
|
76
|
-
} | {
|
|
77
|
-
readonly kind: 'hint';
|
|
78
|
-
readonly idleMs: number;
|
|
79
|
-
readonly totalTokens: number;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Whether one conversation should be warned about a cold cache.
|
|
83
|
-
*
|
|
84
|
-
* Every missing-data branch skips. That asymmetry is deliberate and matches
|
|
85
|
-
* the official client: a false negative costs one turn nobody noticed, while a
|
|
86
|
-
* false positive teaches the user the notice is noise and stops them reading
|
|
87
|
-
* the one that mattered.
|
|
88
|
-
*/
|
|
62
|
+
export type { CacheHintDecision, CacheHintInput } from '../common/cache-hint.ts';
|
|
63
|
+
/** Kimi supplies its measured defaults; other providers call the common pure function directly. */
|
|
89
64
|
export declare function evaluateCacheHint(input: CacheHintInput): CacheHintDecision;
|
|
90
65
|
//# sourceMappingURL=cache-hint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-hint.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/cache-hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,QAAiB,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SAAU,CAAA;AAczC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,GAAE,MAAmB,GAAG,IAAI,CAS/F;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGrF;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAM7D;AAED,
|
|
1
|
+
{"version":3,"file":"cache-hint.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/cache-hint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAA;AAEhC;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,QAAiB,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SAAU,CAAA;AAczC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,GAAE,MAAmB,GAAG,IAAI,CAS/F;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGrF;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAM7D;AAED,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAEhF,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,iBAAiB,CAM1E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PromptCacheOverride } from '../common/prompt-cache-policy.ts';
|
|
1
2
|
/** When an idle parent reaches its cache decision point (five minutes before TTL). */
|
|
2
3
|
export declare const CACHE_WAIT_DECISION_MS: number;
|
|
3
4
|
/** Minimum prompt tokens required before a wait warmup is sent (0 = any active context). */
|
|
@@ -5,7 +6,7 @@ export declare const DEFAULT_MIN_WARMUP_TOKENS = 0;
|
|
|
5
6
|
/** Environment override for wait-time cache keepalive warmup. */
|
|
6
7
|
export declare const CACHE_WAIT_WARMUP_ENV = "DSH_KIMI_CODE_CACHE_WAIT_WARMUP";
|
|
7
8
|
/** Settings description for the progress-updates / Kimi cache-wait switch. */
|
|
8
|
-
export declare const CACHE_WAIT_WARMUP_SETTING_DESCRIPTION = "
|
|
9
|
+
export declare const CACHE_WAIT_WARMUP_SETTING_DESCRIPTION = "\u7B49\u5F85\u5B50\u4EE3\u7406\u5B8C\u6210\u671F\u95F4\u6309\u7EBF\u8DEF\u7F13\u5B58 TTL \u8F7B\u91CF\u7EED\u70ED\uFF1B\u9ED8\u8BA4\u7528\u4E8E Kimi\uFF0820/25 \u5206\u949F\uFF09\uFF0C\u5176\u4ED6\u7EBF\u8DEF\u9700\u660E\u786E TTL \u5E76\u5728 promptCacheOverrides \u4E2D\u663E\u5F0F\u542F\u7528\u3002";
|
|
9
10
|
export interface CacheWaitSession {
|
|
10
11
|
readonly id: string;
|
|
11
12
|
requestHeader?(): {
|
|
@@ -43,8 +44,10 @@ export interface CacheWaitOptions {
|
|
|
43
44
|
readonly now?: () => number;
|
|
44
45
|
readonly timer?: CacheWaitTimer;
|
|
45
46
|
readonly agents?: CacheWaitAgents;
|
|
46
|
-
readonly activity?: (sessionId: string) => CacheWaitActivity | undefined;
|
|
47
|
+
readonly activity?: (sessionId: string, provider?: string) => CacheWaitActivity | undefined;
|
|
47
48
|
readonly kimiSession?: (session: CacheWaitSession) => boolean;
|
|
49
|
+
/** Deployment policy overrides; unknown providers remain inert. */
|
|
50
|
+
readonly overrides?: Readonly<Record<string, PromptCacheOverride>>;
|
|
48
51
|
readonly logger?: CacheWaitLogger;
|
|
49
52
|
readonly decisionMs?: number;
|
|
50
53
|
readonly ttlMs?: number;
|
|
@@ -113,7 +116,6 @@ export declare class KimiCacheWaitController {
|
|
|
113
116
|
private readonly warmup;
|
|
114
117
|
private readonly logger?;
|
|
115
118
|
private readonly decisionMs;
|
|
116
|
-
private readonly ttlMs;
|
|
117
119
|
private readonly minWarmupTokens;
|
|
118
120
|
private disposed;
|
|
119
121
|
constructor(options?: CacheWaitOptions);
|
|
@@ -132,7 +134,7 @@ export declare class KimiCacheWaitController {
|
|
|
132
134
|
private dropState;
|
|
133
135
|
private removeChild;
|
|
134
136
|
private clearTimer;
|
|
135
|
-
private
|
|
137
|
+
private providerForSession;
|
|
136
138
|
private isWarmupEnabled;
|
|
137
139
|
private reconcile;
|
|
138
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-wait.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/cache-wait.ts"],"names":[],"mappings":"AAKA,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,QAAiB,CAAA;AACpD,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,IAAI,CAAA;AAC1C,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,oCAAoC,CAAA;AACtE,8EAA8E;AAC9E,eAAO,MAAM,qCAAqC,
|
|
1
|
+
{"version":3,"file":"cache-wait.d.ts","sourceRoot":"","sources":["../../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AO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,SAAS;CAwDlB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAA;IACzE,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,oBAAoB,EACzB,OAAO,GAAE,gBAAqB,GAC7B,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAgB1B"}
|
|
@@ -29,13 +29,15 @@
|
|
|
29
29
|
import { type OutboundContentBlock, type GenerateOptions, type Message, type StreamChunk } from '../common/llm-compat.ts';
|
|
30
30
|
import { normalizeKimiToolSchema } from '../common/tool-schema.ts';
|
|
31
31
|
import { estimatedInputTokens } from '../common/prompt-estimate.ts';
|
|
32
|
+
import { ReasoningKeyDialect as SharedReasoningKeyDialect } from '../common/reasoning-dialect.ts';
|
|
32
33
|
export { estimatedInputTokens, normalizeKimiToolSchema };
|
|
33
34
|
import { MAX_MESSAGE_BODY_BYTES, MAX_REQUEST_IMAGE_BYTES, MAX_REQUEST_VIDEO_BYTES, MAX_VIDEO_MESSAGE_BODY_BYTES, NO_RESOLVED_IMAGES, REQUEST_IMAGE_MAX_EDGE, collectRemainingImageKeys, offloadOldestRequestImages, offloadRequestImagesWithStickyBudget, requestImageKey, requestImageTarget, resolveRequestImages, type AttachmentImageReader, type ResolvedRequestImage, type ResolvedRequestImages, type StickyImageOffloadResult } from '../common/request-images.ts';
|
|
34
35
|
export { MAX_MESSAGE_BODY_BYTES, MAX_REQUEST_IMAGE_BYTES, MAX_REQUEST_VIDEO_BYTES, MAX_VIDEO_MESSAGE_BODY_BYTES, NO_RESOLVED_IMAGES, REQUEST_IMAGE_MAX_EDGE, collectRemainingImageKeys, offloadOldestRequestImages, offloadRequestImagesWithStickyBudget, requestImageKey, requestImageTarget, resolveRequestImages, type AttachmentImageReader, type ResolvedRequestImage, type ResolvedRequestImages, type StickyImageOffloadResult, };
|
|
35
36
|
export { DEFAULT_LOW_REQUEST_IMAGE_BYTES, lowRequestImageBytes } from './types.ts';
|
|
36
37
|
import { offloadOldestRequestVideos as offloadVideosWithinBudget, requestHasVideo, resolveRequestVideos, type AttachmentVideoReader, type ResolvedRequestVideos } from '../common/video-request.ts';
|
|
37
38
|
export { offloadVideosWithinBudget as offloadOldestRequestVideos, requestHasVideo, resolveRequestVideos, type AttachmentVideoReader, type ResolvedRequestVideos, };
|
|
38
|
-
import type { KimiCodeReasoningEffort, KimiCodeWire } from '../../shared/kimi-code-contracts.ts';
|
|
39
|
+
import type { KimiCodeReasoningEffort, KimiCodeRequestDiagnostic, KimiCodeWire } from '../../shared/kimi-code-contracts.ts';
|
|
40
|
+
import { KimiToolArgumentGuard } from './tool-argument-guard.ts';
|
|
39
41
|
/**
|
|
40
42
|
* Wire keys an OpenAI-compatible response can carry reasoning under.
|
|
41
43
|
*
|
|
@@ -112,8 +114,7 @@ export declare function reasoningFragmentsOf(source: unknown): ReasoningFragment
|
|
|
112
114
|
* turn. Detection never clears: a response with no reasoning keeps the last
|
|
113
115
|
* known dialect, and an endpoint that switches is adapted on its next reply.
|
|
114
116
|
*/
|
|
115
|
-
export declare class ReasoningKeyDialect {
|
|
116
|
-
private detected;
|
|
117
|
+
export declare class ReasoningKeyDialect extends SharedReasoningKeyDialect {
|
|
117
118
|
/**
|
|
118
119
|
* Every reasoning fragment one inbound delta carries, remembering the dialect.
|
|
119
120
|
*
|
|
@@ -132,10 +133,6 @@ export declare class ReasoningKeyDialect {
|
|
|
132
133
|
observeAll(source: unknown): ReasoningFragment[];
|
|
133
134
|
/** First reasoning fragment on an inbound message or delta, remembering its key. */
|
|
134
135
|
observe(source: unknown): string | undefined;
|
|
135
|
-
/** The key to serialize thinking into on an outbound assistant message. */
|
|
136
|
-
outboundKey(): string;
|
|
137
|
-
/** Forget the detected key, returning to the default. Test seam only. */
|
|
138
|
-
reset(): void;
|
|
139
136
|
}
|
|
140
137
|
/**
|
|
141
138
|
* The reasoning key an outbound assistant message should use.
|
|
@@ -530,6 +527,7 @@ interface PendingToolCall {
|
|
|
530
527
|
name: string;
|
|
531
528
|
arguments: string;
|
|
532
529
|
started: boolean;
|
|
530
|
+
guard?: KimiToolArgumentGuard;
|
|
533
531
|
}
|
|
534
532
|
/**
|
|
535
533
|
* One failure the stream reported itself, as the wire stated it.
|
|
@@ -627,6 +625,10 @@ export interface KimiCodeStreamState {
|
|
|
627
625
|
cacheWrite5mTokens: number;
|
|
628
626
|
cacheWrite1hTokens: number;
|
|
629
627
|
reasoningTokens: number;
|
|
628
|
+
/** Whether the upstream actually carried each optional usage field. */
|
|
629
|
+
cacheReadReported: boolean;
|
|
630
|
+
cacheWriteReported: boolean;
|
|
631
|
+
reasoningReported: boolean;
|
|
630
632
|
sawUsage: boolean;
|
|
631
633
|
/**
|
|
632
634
|
* Per-request tool-call id assignment.
|
|
@@ -651,6 +653,10 @@ export interface KimiCodeStreamState {
|
|
|
651
653
|
* rolling cache ratio would then describe a prompt the session never sent.
|
|
652
654
|
*/
|
|
653
655
|
sideChannel: boolean;
|
|
656
|
+
/** Actual pooled account behind this response, retained through terminal events. */
|
|
657
|
+
accountId?: string;
|
|
658
|
+
/** Bounded guard evidence; never includes the tool argument payload. */
|
|
659
|
+
toolGuard?: NonNullable<KimiCodeRequestDiagnostic['toolGuard']>;
|
|
654
660
|
}
|
|
655
661
|
export declare function createStreamState(wire: KimiCodeWire, sessionId?: string, sideChannel?: boolean): KimiCodeStreamState;
|
|
656
662
|
/** Feed one SSE `data:` payload from `/chat/completions`. */
|