@vibedev-si/dsh-vibedev 0.7.0 → 0.7.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/README.md +12 -0
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/lib/index.js +69 -1
- package/lib/llm/catalog.d.ts +2 -0
- package/lib/llm/context-budget.d.ts +45 -0
- package/lib/llm/stream.d.ts +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
本插件由 `dsh-media` 改名而来,见下面的「从 dsh-media 升级」。
|
|
12
12
|
|
|
13
|
+
## 0.7.1 用户可见更新
|
|
14
|
+
|
|
15
|
+
长对话更不容易在自动压缩之前撞上模型上限:插件现在按网关下发的输入上限(`max_input_tokens`)计算模型的上下文窗口,让宿主的自动压缩落在真实输入的 80%–90% 之间(这个 1M 窗口的模型是 88%,之前是 80%);网关没下发这个值的模型行为不变,仍是按声明的窗口算。
|
|
16
|
+
|
|
17
|
+
供应商返回「prompt is too long: N tokens > M maximum」这类超窗错误时,现在会被识别成上下文超限:宿主会先压缩再重试一次这次请求,而不是把它判成不可重试的错误。之前这种措辞(Anthropic Messages 的原话)认不出来,一次长会话可能整轮失败。
|
|
18
|
+
|
|
13
19
|
## 0.7.0 用户可见更新
|
|
14
20
|
|
|
15
21
|
账户中心新增「消息」页:VibeDev 的版本更新、服务调整和账号通知都发在这里。有未读时,侧栏账号头像右上角出现红点,账号菜单里的「消息」一行带上未读数。`popup` 类型的公告一次启动最多弹一次:「知道了」发出已读回执,「稍后」和「查看全部消息」只关掉弹窗、不标为已读,红点和未读数会留着。网关还没上线这两个读取接口时,这一块安静地不出现,其它功能不受影响。见[消息读取契约](docs/announcements-read-contract.md)。
|
|
@@ -334,6 +340,12 @@ npm run build
|
|
|
334
340
|
|
|
335
341
|
## English
|
|
336
342
|
|
|
343
|
+
### What changes in 0.7.1
|
|
344
|
+
|
|
345
|
+
Long sessions are less likely to reach a model's hard limit before automatic compaction runs: the plugin now sizes each model's context window from the gateway's input cap (`max_input_tokens`), which puts the host's compaction between 80% and 90% of the real input budget (88% for the 1M model, 80% before). A model whose catalogue states no input cap behaves exactly as before.
|
|
346
|
+
|
|
347
|
+
A provider overflow such as "prompt is too long: N tokens > M maximum" is now classified as a context-window failure, so the host compacts once and retries that request instead of treating the turn as a non-retryable error. That wording — Anthropic Messages' own — used to be unrecognized, and one long session could fail the whole turn.
|
|
348
|
+
|
|
337
349
|
### What changes in 0.7.0
|
|
338
350
|
|
|
339
351
|
The account center gains a Messages page for VibeDev's version updates, service changes and account notices. While something is unread, the sidebar avatar carries a red dot and the account menu's Messages row shows the count. A `popup` announcement interrupts at most once per launch: Got it sends the read receipt, while Later and See all messages only close it and mark nothing read, so the dot and the count stay. Until the gateway serves these reads the whole thing stays quiet. See the [messages read contract](docs/announcements-read-contract.md).
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.7.
|
|
1
|
+
THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.7.1
|
|
2
2
|
|
|
3
3
|
This package bundles code from the projects below. Each is used under the licence that
|
|
4
4
|
follows its name; the licence texts are reproduced as the projects ship them.
|
package/lib/index.js
CHANGED
|
@@ -5244,12 +5244,14 @@ function parseCatalog(body) {
|
|
|
5244
5244
|
const levels = reasoningLevelsOf(capabilities.reasoning_levels);
|
|
5245
5245
|
const defaultReasoning = typeof capabilities.default_reasoning === "string" && levels?.includes(capabilities.default_reasoning) ? capabilities.default_reasoning : void 0;
|
|
5246
5246
|
const inputs = strings$1(capabilities.input_modalities) ?? [];
|
|
5247
|
+
const maxInputTokens = positive$2(capabilities.max_input_tokens);
|
|
5247
5248
|
seen.add(id);
|
|
5248
5249
|
models.push({
|
|
5249
5250
|
id,
|
|
5250
5251
|
name: modelDisplayName(id, typeof entry.display_name === "string" && entry.display_name.trim() !== "" ? entry.display_name.trim() : void 0),
|
|
5251
5252
|
api,
|
|
5252
5253
|
contextWindow: positive$2(capabilities.context_window) ?? 2e5,
|
|
5254
|
+
...maxInputTokens === void 0 ? {} : { maxInputTokens },
|
|
5253
5255
|
maxTokens: positive$2(capabilities.max_output_tokens) ?? 32768,
|
|
5254
5256
|
input: inputs.includes("image") ? ["text", "image"] : ["text"],
|
|
5255
5257
|
...levels === void 0 ? {} : { reasoningLevels: levels },
|
|
@@ -5877,6 +5879,54 @@ const openAICompletionsApi = () => lazyApi(() => import("./openai-completions-Dq
|
|
|
5877
5879
|
//#region node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.js
|
|
5878
5880
|
const openAIResponsesApi = () => lazyApi(() => import("./openai-responses-DygWnsye.js"));
|
|
5879
5881
|
//#endregion
|
|
5882
|
+
//#region src/llm/context-budget.ts
|
|
5883
|
+
/**
|
|
5884
|
+
* What a catalog model's returned `contextWindow` should be.
|
|
5885
|
+
*
|
|
5886
|
+
* The host compacts from the window it is told: `basic-compaction` starts at
|
|
5887
|
+
* `min(thresholdRatio × window, window − maxTokens − headroomTokens)` (defaults 0.8, 65,536) and
|
|
5888
|
+
* measures against provider usage plus a heuristic delta. Declaring the provider's *input cap* as the
|
|
5889
|
+
* window therefore compacts at 80% of that cap at best, and earlier whenever the output reserve is
|
|
5890
|
+
* large — but declaring more than the cap lets a request outgrow it before compaction fires.
|
|
5891
|
+
*
|
|
5892
|
+
* The gateway states both numbers: `context_window` (capacity) and `max_input_tokens` (the cap its
|
|
5893
|
+
* provider enforces; the value a `context_length_exceeded` error quotes). Where the two agree, the
|
|
5894
|
+
* input cap is the real limit and the provider bills output outside it, so the host's total capacity
|
|
5895
|
+
* is `input + maxTokens`: the reserve the host subtracts then cancels out and the trigger lands in
|
|
5896
|
+
* the 80–90% band of the real input budget. Where `context_window` is larger than the input cap it
|
|
5897
|
+
* is a real total, and the window never claims past it.
|
|
5898
|
+
*
|
|
5899
|
+
* @module dsh-vibedev/llm/context-budget
|
|
5900
|
+
*/
|
|
5901
|
+
/** Share of the provider's input budget compaction should start around. */
|
|
5902
|
+
const CONTEXT_COMPACT_TARGET = .88;
|
|
5903
|
+
/** The host compaction default this arithmetic is written against (`thresholdRatio`). */
|
|
5904
|
+
const HOST_THRESHOLD_RATIO = .8;
|
|
5905
|
+
/** The host compaction default reserve below the message budget (`headroomTokens`). */
|
|
5906
|
+
const HOST_HEADROOM_TOKENS = 65536;
|
|
5907
|
+
/**
|
|
5908
|
+
* The window to report to the host.
|
|
5909
|
+
*
|
|
5910
|
+
* Without a stated input cap this is the catalog capacity unchanged: nothing here may claim more
|
|
5911
|
+
* capacity than the catalog gave. With one, the declared window is sized so the host's own threshold
|
|
5912
|
+
* lands near {@link CONTEXT_COMPACT_TARGET} of that cap, bounded by the real total whenever the
|
|
5913
|
+
* catalog states one.
|
|
5914
|
+
* @param budget - the catalog's capacity, input cap and output reserve.
|
|
5915
|
+
* @param fallback - window for a catalog that states no capacity at all.
|
|
5916
|
+
* @returns a positive token count to declare as the model's context window.
|
|
5917
|
+
*/
|
|
5918
|
+
function declaredContextWindow(budget, fallback) {
|
|
5919
|
+
const window = budget.contextWindow;
|
|
5920
|
+
const input = budget.maxInputTokens;
|
|
5921
|
+
if (input === void 0) return window ?? fallback;
|
|
5922
|
+
const inputBudget = window === void 0 ? input : Math.min(input, window);
|
|
5923
|
+
if (inputBudget <= 0) return window ?? fallback;
|
|
5924
|
+
const target = Math.round(inputBudget * CONTEXT_COMPACT_TARGET);
|
|
5925
|
+
const reachable = Math.max(Math.ceil(target / HOST_THRESHOLD_RATIO), target + budget.maxTokens + HOST_HEADROOM_TOKENS);
|
|
5926
|
+
const ceiling = window === void 0 || window === input ? inputBudget + budget.maxTokens : window;
|
|
5927
|
+
return Math.max(inputBudget, Math.min(reachable, ceiling));
|
|
5928
|
+
}
|
|
5929
|
+
//#endregion
|
|
5880
5930
|
//#region src/llm/models.ts
|
|
5881
5931
|
/**
|
|
5882
5932
|
* pi-ai model descriptors and the multi-protocol provider for the gateway.
|
|
@@ -5981,7 +6031,11 @@ function toPiModel(model, provider, origin) {
|
|
|
5981
6031
|
...reasoning ? { thinkingLevelMap: thinkingLevelMap(levels) } : {},
|
|
5982
6032
|
input: [...model.input],
|
|
5983
6033
|
cost: { ...model.cost },
|
|
5984
|
-
contextWindow:
|
|
6034
|
+
contextWindow: declaredContextWindow({
|
|
6035
|
+
contextWindow: model.contextWindow,
|
|
6036
|
+
...model.maxInputTokens === void 0 ? {} : { maxInputTokens: model.maxInputTokens },
|
|
6037
|
+
maxTokens: model.maxTokens
|
|
6038
|
+
}, model.contextWindow),
|
|
5985
6039
|
maxTokens: model.maxTokens,
|
|
5986
6040
|
...compat === void 0 ? {} : { compat }
|
|
5987
6041
|
};
|
|
@@ -6085,9 +6139,23 @@ function mapUsage(usage) {
|
|
|
6085
6139
|
...usage.cacheWrite > 0 ? { cacheWriteTokens: usage.cacheWrite } : {}
|
|
6086
6140
|
};
|
|
6087
6141
|
}
|
|
6142
|
+
/**
|
|
6143
|
+
* Provider wordings for a request that outgrew the model's context window and that
|
|
6144
|
+
* {@link isContextWindowExceededError} does not know. Anthropic's Messages API answers
|
|
6145
|
+
* `prompt is too long: 1025721 tokens > 1000000 maximum`, which matches none of its patterns;
|
|
6146
|
+
* classified as a generic 400 this failure is non-retryable, so the host never gets the chance to
|
|
6147
|
+
* compact and retry the request it could still serve.
|
|
6148
|
+
*/
|
|
6149
|
+
const PROMPT_OVER_LIMIT = /\b(?:prompt|input|messages?|request)\b[^.]{0,40}\btoo\s+(?:long|large)\b|\b\d+\s*tokens?\s*>\s*\d+\s*(?:maximum|max)\b/i;
|
|
6150
|
+
/**
|
|
6151
|
+
* Classify one pi-ai error message into the harness failure code it should carry.
|
|
6152
|
+
* @param message - the flattened provider error text pi-ai hands over.
|
|
6153
|
+
* @returns the harness code for this failure.
|
|
6154
|
+
*/
|
|
6088
6155
|
function classifyPiAiError(message) {
|
|
6089
6156
|
if (/\b(?:401|403)\b/.test(message)) return "AUTH";
|
|
6090
6157
|
if (isQuotaExceededError(message)) return QUOTA_EXCEEDED_CODE;
|
|
6158
|
+
if (isContextWindowExceededError(message) || PROMPT_OVER_LIMIT.test(message)) return CONTEXT_WINDOW_EXCEEDED_CODE;
|
|
6091
6159
|
if (/\b429\b|rate.?limit/i.test(message)) return "RATE_LIMIT";
|
|
6092
6160
|
if (/\b413\b|failed to buffer the request body:\s*length limit exceeded|payload too large|request body too large/i.test(message)) return "INVALID_REQUEST";
|
|
6093
6161
|
if (/\b400\b|invalid.?request/i.test(message)) return "INVALID_REQUEST";
|
package/lib/llm/catalog.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface GatewayModel {
|
|
|
23
23
|
/** The protocol requests for this model use. */
|
|
24
24
|
readonly api: GatewayApi;
|
|
25
25
|
readonly contextWindow: number;
|
|
26
|
+
/** The provider input cap the gateway states (`max_input_tokens`), when it states one. */
|
|
27
|
+
readonly maxInputTokens?: number;
|
|
26
28
|
readonly maxTokens: number;
|
|
27
29
|
readonly input: readonly ('text' | 'image')[];
|
|
28
30
|
/**
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a catalog model's returned `contextWindow` should be.
|
|
3
|
+
*
|
|
4
|
+
* The host compacts from the window it is told: `basic-compaction` starts at
|
|
5
|
+
* `min(thresholdRatio × window, window − maxTokens − headroomTokens)` (defaults 0.8, 65,536) and
|
|
6
|
+
* measures against provider usage plus a heuristic delta. Declaring the provider's *input cap* as the
|
|
7
|
+
* window therefore compacts at 80% of that cap at best, and earlier whenever the output reserve is
|
|
8
|
+
* large — but declaring more than the cap lets a request outgrow it before compaction fires.
|
|
9
|
+
*
|
|
10
|
+
* The gateway states both numbers: `context_window` (capacity) and `max_input_tokens` (the cap its
|
|
11
|
+
* provider enforces; the value a `context_length_exceeded` error quotes). Where the two agree, the
|
|
12
|
+
* input cap is the real limit and the provider bills output outside it, so the host's total capacity
|
|
13
|
+
* is `input + maxTokens`: the reserve the host subtracts then cancels out and the trigger lands in
|
|
14
|
+
* the 80–90% band of the real input budget. Where `context_window` is larger than the input cap it
|
|
15
|
+
* is a real total, and the window never claims past it.
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-vibedev/llm/context-budget
|
|
18
|
+
*/
|
|
19
|
+
/** Share of the provider's input budget compaction should start around. */
|
|
20
|
+
export declare const CONTEXT_COMPACT_TARGET = 0.88;
|
|
21
|
+
/** The host compaction default this arithmetic is written against (`thresholdRatio`). */
|
|
22
|
+
export declare const HOST_THRESHOLD_RATIO = 0.8;
|
|
23
|
+
/** The host compaction default reserve below the message budget (`headroomTokens`). */
|
|
24
|
+
export declare const HOST_HEADROOM_TOKENS = 65536;
|
|
25
|
+
/** What the catalog says about one model's capacity. */
|
|
26
|
+
export interface CatalogBudget {
|
|
27
|
+
/** Catalog capacity, when it states one. */
|
|
28
|
+
readonly contextWindow?: number;
|
|
29
|
+
/** The provider input cap the gateway states (`max_input_tokens`), when it states one. */
|
|
30
|
+
readonly maxInputTokens?: number;
|
|
31
|
+
/** Output the catalog reserves per request. */
|
|
32
|
+
readonly maxTokens: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The window to report to the host.
|
|
36
|
+
*
|
|
37
|
+
* Without a stated input cap this is the catalog capacity unchanged: nothing here may claim more
|
|
38
|
+
* capacity than the catalog gave. With one, the declared window is sized so the host's own threshold
|
|
39
|
+
* lands near {@link CONTEXT_COMPACT_TARGET} of that cap, bounded by the real total whenever the
|
|
40
|
+
* catalog states one.
|
|
41
|
+
* @param budget - the catalog's capacity, input cap and output reserve.
|
|
42
|
+
* @param fallback - window for a catalog that states no capacity at all.
|
|
43
|
+
* @returns a positive token count to declare as the model's context window.
|
|
44
|
+
*/
|
|
45
|
+
export declare function declaredContextWindow(budget: CatalogBudget, fallback: number): number;
|
package/lib/llm/stream.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ import type { AssistantMessage, AssistantMessageEvent, Usage as PiUsage } from '
|
|
|
20
20
|
* when non-zero (pi-ai reports zeros, not absence).
|
|
21
21
|
*/
|
|
22
22
|
export declare function mapUsage(usage: PiUsage): TokenUsage;
|
|
23
|
+
/**
|
|
24
|
+
* Classify one pi-ai error message into the harness failure code it should carry.
|
|
25
|
+
* @param message - the flattened provider error text pi-ai hands over.
|
|
26
|
+
* @returns the harness code for this failure.
|
|
27
|
+
*/
|
|
28
|
+
export declare function classifyPiAiError(message: string): string;
|
|
23
29
|
/**
|
|
24
30
|
* Map a terminal pi-ai event to the harness finish reason.
|
|
25
31
|
* @param message - the assistant message carried by the `done` or `error` event.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibedev-si/dsh-vibedev",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "VibeDev 账号与模型:在 DeepSeek Harness 里登录 VibeDev,与 DeepSeek 账号并存,使用 VibeDev 网关的模型(Claude、GPT 等),并生成图片、视频、音乐和播客 · VibeDev account and models for DeepSeek Harness: sign in to VibeDev next to the DeepSeek account and use the VibeDev gateway's models (Claude, GPT and more), plus image, video, music and podcast generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|