@vibedev-si/dsh-vibedev 0.11.0 → 0.11.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 +16 -0
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/lib/auth/credentials.d.ts +8 -0
- package/lib/index.js +107 -28
- package/lib/llm/adapter.d.ts +7 -0
- package/lib/llm/context.d.ts +34 -2
- package/lib/llm/limits.d.ts +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
本插件由 `dsh-media` 改名而来,见下面的「从 dsh-media 升级」。
|
|
12
12
|
|
|
13
|
+
## 0.11.1 用户可见更新
|
|
14
|
+
|
|
15
|
+
兼容 DSH 0.2.3:修复发送图片失败。桌面版升级到 DeepSeek Harness 0.2.3 后,用 VibeDev 网关的模型发一张图片,那一轮会失败,并提示 `Image request maxImageBytes must be a positive integer.`;图片留在对话里后,之后每一轮和 `/compact` 也会失败。0.11.1 修好了这些,改版后不需要清理或重发对话。
|
|
16
|
+
|
|
17
|
+
- **图片**:请求图片的大小上限同时按 0.2.3 的新规则和 0.2.2-rc.5 的旧规则给出,每张图片仍限制在 1 MiB 以内(超过时会继续缩小)。DeepSeek Harness 0.2.2-rc.5 及以上继续可用。
|
|
18
|
+
- **系统提示**:0.2.3 把系统提示按段落分别保存,插件原来把它们直接连在一起;现在按空行分隔,之后补充的系统指令以「系统提醒」的形式发给模型,不再混作你说的话。
|
|
19
|
+
- **Computer Use 截图**:Computer Use 取截图尺寸用的是插件给出的同一套图片预算,截图只缩一次,模型看到的尺寸和点击坐标一致。
|
|
20
|
+
- **凭据**:向 VibeDev 网关取宿主登录凭据时,优先使用 0.2.3 的公开接口,找不到时才用旧接口;两者都没有时回退到插件自己的登录,不会让所有请求都取不到凭据。
|
|
13
21
|
## 0.11.0 用户可见更新
|
|
14
22
|
|
|
15
23
|
- **公告改叫「通知」**:账户中心的「消息」页改名为「通知」,账号菜单里的那一行也一起改,例如「通知(3)」;行上的未读提示写「3 条未读通知」,空的时候写「还没有未读通知」,公告弹窗里的按钮是「查看全部通知」。弹窗标题仍是「VibeDev 公告」。改名是为了和 VibeDev 桌面的聊天「消息」分开;公告内容、红点和已读规则都不变。英文界面是 Notifications。
|
|
@@ -445,6 +453,14 @@ npm run build
|
|
|
445
453
|
|
|
446
454
|
## English
|
|
447
455
|
|
|
456
|
+
### What changes in 0.11.1
|
|
457
|
+
|
|
458
|
+
Compatible with DSH 0.2.3: fixes sending images. After the desktop app moved to DeepSeek Harness 0.2.3, sending a picture with a VibeDev gateway model failed that turn with `Image request maxImageBytes must be a positive integer.`; once the picture was in the conversation, every later turn and `/compact` failed too. 0.11.1 fixes this; no need to clear or resend the conversation.
|
|
459
|
+
|
|
460
|
+
- **Images**: the request-image size limit is now given in both the 0.2.3 shape and the 0.2.2-rc.5 shape, and each image stays within 1 MiB (a larger one is shrunk further). DeepSeek Harness 0.2.2-rc.5 and later keep working.
|
|
461
|
+
- **System prompt**: 0.2.3 stores the system prompt one section at a time, and the plugin used to run the sections together. They are now separated by a blank line, and system instructions added later reach the model as a system reminder instead of looking like something you said.
|
|
462
|
+
- **Computer Use screenshots**: Computer Use now sizes a screenshot with the same image budget the plugin uses for the request, so a screenshot is shrunk once and the coordinates the model sees match the click targets.
|
|
463
|
+
- **Credentials**: the host's signed-in credential for the VibeDev gateway is read through 0.2.3's public interface first and the older one only when that is missing; with neither, the plugin's own sign-in answers instead of every request losing its credential.
|
|
448
464
|
### What changes in 0.11.0
|
|
449
465
|
|
|
450
466
|
- **Announcements are now Notifications**: the account center's Messages page is renamed Notifications (通知), and so is its row in the account menus, for example "Notifications (3)". The row's unread hint says "3 unread notifications", an empty page says "No unread notifications", and the announcement dialog's button says "See all notifications". The dialog title stays "VibeDev announcement". The rename keeps announcements apart from the VibeDev desktop's chat, which is called Messages; content, the red dot and the read rules are unchanged.
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.11.
|
|
1
|
+
THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.11.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.
|
|
@@ -24,6 +24,8 @@ export interface CredentialChainOptions {
|
|
|
24
24
|
/** Resolves the credential for each request and routes rejections back to its owner. */
|
|
25
25
|
export declare class CredentialChain {
|
|
26
26
|
private readonly options;
|
|
27
|
+
/** The host credential released last through `resolveRequestCredential`, so a rejection can use its own invalidation. */
|
|
28
|
+
private released;
|
|
27
29
|
/**
|
|
28
30
|
* @param options - origin and the three sources.
|
|
29
31
|
*/
|
|
@@ -35,6 +37,12 @@ export declare class CredentialChain {
|
|
|
35
37
|
* @param credential - the rejected credential.
|
|
36
38
|
*/
|
|
37
39
|
reject(credential: GatewayCredential): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* The host account's token for the gateway, whichever way this DSH release offers it. A host that offers neither
|
|
42
|
+
* method, or whose lookup fails (synchronously or not), yields nothing and the chain moves on to the plugin's own sign-in.
|
|
43
|
+
*/
|
|
44
|
+
private hostedToken;
|
|
45
|
+
private rejectHosted;
|
|
38
46
|
}
|
|
39
47
|
/** Credential identity for one gateway; never consult another gateway's record. */
|
|
40
48
|
export declare function gatewayGrantKey(origin: string): import("@deepseek-ai/dsh-credentials").CredentialKey;
|
package/lib/index.js
CHANGED
|
@@ -4882,9 +4882,13 @@ function developmentKey(origin, name, env = process.env) {
|
|
|
4882
4882
|
* key named by an environment variable.
|
|
4883
4883
|
* @module dsh-vibedev/auth/credentials
|
|
4884
4884
|
*/
|
|
4885
|
+
/** The header `resolveRequestCredential` carries the account token in (`ACCOUNT_TOKEN_HEADER` of the 0.2.3 account service). */
|
|
4886
|
+
const HOST_ACCOUNT_TOKEN_HEADER = "x-dsh-auth-token";
|
|
4885
4887
|
/** Resolves the credential for each request and routes rejections back to its owner. */
|
|
4886
4888
|
var CredentialChain = class {
|
|
4887
4889
|
options;
|
|
4890
|
+
/** The host credential released last through `resolveRequestCredential`, so a rejection can use its own invalidation. */
|
|
4891
|
+
released;
|
|
4888
4892
|
/**
|
|
4889
4893
|
* @param options - origin and the three sources.
|
|
4890
4894
|
*/
|
|
@@ -4893,7 +4897,7 @@ var CredentialChain = class {
|
|
|
4893
4897
|
}
|
|
4894
4898
|
/** The credential for the next request, or undefined while nobody is signed in. */
|
|
4895
4899
|
async resolve() {
|
|
4896
|
-
const hosted = await this.
|
|
4900
|
+
const hosted = await this.hostedToken(`${this.options.origin.replace(/\/+$/, "")}/v1/models`);
|
|
4897
4901
|
if (hosted !== void 0 && hosted !== "") return {
|
|
4898
4902
|
token: hosted,
|
|
4899
4903
|
kind: "account"
|
|
@@ -4914,9 +4918,42 @@ var CredentialChain = class {
|
|
|
4914
4918
|
* @param credential - the rejected credential.
|
|
4915
4919
|
*/
|
|
4916
4920
|
async reject(credential) {
|
|
4917
|
-
if (credential.kind === "account") await this.
|
|
4921
|
+
if (credential.kind === "account") await this.rejectHosted(credential.token);
|
|
4918
4922
|
else if (credential.kind === "plugin") await this.options.plugin?.reject(credential.token);
|
|
4919
4923
|
}
|
|
4924
|
+
/**
|
|
4925
|
+
* The host account's token for the gateway, whichever way this DSH release offers it. A host that offers neither
|
|
4926
|
+
* method, or whose lookup fails (synchronously or not), yields nothing and the chain moves on to the plugin's own sign-in.
|
|
4927
|
+
*/
|
|
4928
|
+
async hostedToken(url) {
|
|
4929
|
+
const account = this.options.account();
|
|
4930
|
+
if (account === void 0) return void 0;
|
|
4931
|
+
try {
|
|
4932
|
+
if (typeof account.resolveRequestCredential === "function") {
|
|
4933
|
+
const credential = await account.resolveRequestCredential(url);
|
|
4934
|
+
if (credential === void 0) return void 0;
|
|
4935
|
+
const token = credential.headers[HOST_ACCOUNT_TOKEN_HEADER];
|
|
4936
|
+
if (typeof token === "string" && token !== "") {
|
|
4937
|
+
this.released = {
|
|
4938
|
+
token,
|
|
4939
|
+
reject: () => credential.reject()
|
|
4940
|
+
};
|
|
4941
|
+
return token;
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4944
|
+
if (typeof account.resolveToken === "function") return await account.resolveToken(url);
|
|
4945
|
+
} catch {}
|
|
4946
|
+
}
|
|
4947
|
+
async rejectHosted(token) {
|
|
4948
|
+
const released = this.released;
|
|
4949
|
+
if (released?.token === token) {
|
|
4950
|
+
this.released = void 0;
|
|
4951
|
+
await released.reject();
|
|
4952
|
+
return;
|
|
4953
|
+
}
|
|
4954
|
+
const account = this.options.account();
|
|
4955
|
+
if (typeof account?.rejectToken === "function") await account.rejectToken(token);
|
|
4956
|
+
}
|
|
4920
4957
|
};
|
|
4921
4958
|
/** Credential identity for one gateway; never consult another gateway's record. */
|
|
4922
4959
|
function gatewayGrantKey(origin) {
|
|
@@ -5631,7 +5668,12 @@ var PluginLogin = class {
|
|
|
5631
5668
|
const DEFAULT_MAX_REQUEST_IMAGE_BYTES = 20971520;
|
|
5632
5669
|
/** Total-pixel budget that preserves the complete 2048px normalized attachment. */
|
|
5633
5670
|
const DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET = 4194304;
|
|
5634
|
-
/**
|
|
5671
|
+
/**
|
|
5672
|
+
* Raw encoded bytes allowed for one request image, before inline base64 expansion. A hard limit under DSH 0.2.3 (a larger
|
|
5673
|
+
* encoding is shrunk further; that is also the preferred size) and a target under rc.5. DSH's pi-ai default is 0.75 MiB
|
|
5674
|
+
* (a 20 MiB request over 20 images); 1 MiB keeps what 0.11.0 sent, and the oldest images are offloaded when the request
|
|
5675
|
+
* exceeds `DEFAULT_MAX_REQUEST_IMAGE_BYTES`.
|
|
5676
|
+
*/
|
|
5635
5677
|
const DEFAULT_REQUEST_IMAGE_MAX_BYTES = 1048576;
|
|
5636
5678
|
//#endregion
|
|
5637
5679
|
//#region src/llm/relay.ts
|
|
@@ -6076,6 +6118,9 @@ function toPiAssistant(message, onDegrade) {
|
|
|
6076
6118
|
* image-limit import moved to ./limits.ts,
|
|
6077
6119
|
* so the gateway adapter can choose a wire protocol per model. Keep it in step with upstream.
|
|
6078
6120
|
*
|
|
6121
|
+
* Kept in step with 0.2.3 for what changes at run time: the request-image target (see `requestImageTarget`) and the text of a
|
|
6122
|
+
* system message (see `systemText`).
|
|
6123
|
+
*
|
|
6079
6124
|
* Harness request-history conversion into pi-ai's Context vocabulary.
|
|
6080
6125
|
*
|
|
6081
6126
|
* @module dsh-llm-pi-ai/context
|
|
@@ -6084,6 +6129,16 @@ function toPiAssistant(message, onDegrade) {
|
|
|
6084
6129
|
function flattenText(message) {
|
|
6085
6130
|
return message.content.filter((block) => block.type === "text").map((block) => block.text).join("");
|
|
6086
6131
|
}
|
|
6132
|
+
/**
|
|
6133
|
+
* The text of a system message: each text block trimmed, empty ones dropped, the rest joined with blank lines.
|
|
6134
|
+
* DSH 0.2.3 stores one system message as one trimmed text block per prompt section and leaves the separators to the
|
|
6135
|
+
* adapter (rc.5 stored the whole prompt as a single block, which this leaves as it was but for its outer whitespace).
|
|
6136
|
+
* Joining the blocks with nothing, as `flattenText` does, would run the sections together.
|
|
6137
|
+
* Same as `systemText` of DSH's own pi-ai adapter.
|
|
6138
|
+
*/
|
|
6139
|
+
function systemText(message) {
|
|
6140
|
+
return message.content.filter((block) => block.type === "text").map((block) => block.text.trim()).filter((text) => text.length > 0).join("\n\n");
|
|
6141
|
+
}
|
|
6087
6142
|
/** Recover the pi-ai toolResult message for one harness tool-role message. */
|
|
6088
6143
|
function toolResultOf(message, toolNames, content) {
|
|
6089
6144
|
return {
|
|
@@ -6156,25 +6211,21 @@ function toolsOf(options) {
|
|
|
6156
6211
|
}
|
|
6157
6212
|
/**
|
|
6158
6213
|
* Select the pi-ai `systemPrompt` source shared by both conversion paths.
|
|
6159
|
-
* `options.system
|
|
6160
|
-
*
|
|
6161
|
-
* message. Otherwise a leading `system` history message supplies the prompt
|
|
6162
|
-
* and leaves the converted history; empty leading text sends no prompt.
|
|
6214
|
+
* `options.system`, when defined, comes first; every leading `system` history message follows it, all joined with
|
|
6215
|
+
* blank lines, and those messages leave the converted history. Empty text sends no prompt.
|
|
6163
6216
|
*/
|
|
6164
6217
|
function splitSystemPrompt(options) {
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
};
|
|
6174
|
-
const text = flattenText(first);
|
|
6218
|
+
const text = [options.system];
|
|
6219
|
+
let end = 0;
|
|
6220
|
+
for (const message of options.messages) {
|
|
6221
|
+
if (message.role !== "system") break;
|
|
6222
|
+
text.push(systemText(message));
|
|
6223
|
+
end++;
|
|
6224
|
+
}
|
|
6225
|
+
const systemPrompt = text.filter(Boolean).join("\n\n");
|
|
6175
6226
|
return {
|
|
6176
|
-
systemPrompt:
|
|
6177
|
-
messages:
|
|
6227
|
+
systemPrompt: systemPrompt.length > 0 ? systemPrompt : void 0,
|
|
6228
|
+
messages: options.messages.slice(end)
|
|
6178
6229
|
};
|
|
6179
6230
|
}
|
|
6180
6231
|
/** Assemble the request-level pi-ai context envelope shared by both conversion paths. */
|
|
@@ -6194,11 +6245,15 @@ function appendAssistant(message, messages, toolNames, onReplayDegrade) {
|
|
|
6194
6245
|
/** Append the system and assistant roles both context builders treat identically; true when consumed. */
|
|
6195
6246
|
function appendSystemOrAssistant(message, messages, toolNames, onReplayDegrade) {
|
|
6196
6247
|
if (message.role === "system") {
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
content
|
|
6200
|
-
|
|
6201
|
-
|
|
6248
|
+
const content = systemText(message);
|
|
6249
|
+
if (content.length > 0) {
|
|
6250
|
+
const reminder = content.replaceAll("</system-reminder>", "<\\/system-reminder>");
|
|
6251
|
+
messages.push({
|
|
6252
|
+
role: "user",
|
|
6253
|
+
content: `<system-reminder>\n${reminder}\n</system-reminder>`,
|
|
6254
|
+
timestamp: 0
|
|
6255
|
+
});
|
|
6256
|
+
}
|
|
6202
6257
|
return true;
|
|
6203
6258
|
}
|
|
6204
6259
|
if (message.role === "assistant") {
|
|
@@ -6227,11 +6282,17 @@ function textOnlyContext(options, onReplayDegrade) {
|
|
|
6227
6282
|
}
|
|
6228
6283
|
return piContext(split.systemPrompt, options, messages);
|
|
6229
6284
|
}
|
|
6230
|
-
/**
|
|
6285
|
+
/**
|
|
6286
|
+
* Deterministic request target for one source under the route budgets.
|
|
6287
|
+
* Assigned to `ImageRequestTarget` of whichever `@deepseek-ai/dsh-attachment` the host runs: the declared type
|
|
6288
|
+
* changed in 0.2.3, and the object satisfies both.
|
|
6289
|
+
*/
|
|
6231
6290
|
function requestImageTarget(ref, budget) {
|
|
6232
6291
|
return {
|
|
6233
6292
|
...requestImageDimensions(ref.width, ref.height, budget.maxPixels),
|
|
6234
|
-
maxBytes: budget.maxBytes
|
|
6293
|
+
maxBytes: budget.maxBytes,
|
|
6294
|
+
maxImageBytes: budget.maxBytes,
|
|
6295
|
+
imageTargetBytes: budget.maxBytes
|
|
6235
6296
|
};
|
|
6236
6297
|
}
|
|
6237
6298
|
function toPiContext(options, images, onReplayDegrade) {
|
|
@@ -7246,6 +7307,12 @@ function _usingCtx() {
|
|
|
7246
7307
|
* raise its sign-in prompt; the chat shows this failure's own message.
|
|
7247
7308
|
*/
|
|
7248
7309
|
const SIGN_IN_REQUIRED_CODE = "VIBEDEV_SIGN_IN_REQUIRED";
|
|
7310
|
+
/**
|
|
7311
|
+
* LlmError's constructor takes only built-in codes in DSH 0.2.3's types, though it accepts any non-empty string at run time
|
|
7312
|
+
* (0.2.2-rc.5 and 0.2.3 alike; LlmError.fromFailure is the upstream route for a foreign code but rc.5 lacks it). The
|
|
7313
|
+
* plugin's own code is therefore passed through the constructor's parameter type, which is a cast that holds in both.
|
|
7314
|
+
*/
|
|
7315
|
+
const SIGN_IN_REQUIRED_LLM_CODE = SIGN_IN_REQUIRED_CODE;
|
|
7249
7316
|
/** Failure code for a used-up balance; not the Harness's `ACCOUNT_QUOTA`, which opens the DeepSeek top-up. */
|
|
7250
7317
|
const INSUFFICIENT_BALANCE_CODE = "VIBEDEV_INSUFFICIENT_BALANCE";
|
|
7251
7318
|
/** No promotions apply, shared so an unlabelled listing allocates nothing. */
|
|
@@ -7341,7 +7408,7 @@ var GatewayAdapter = class extends LlmAdapter {
|
|
|
7341
7408
|
}
|
|
7342
7409
|
modelOf(snapshot, provider, id) {
|
|
7343
7410
|
this.assertOwned(provider);
|
|
7344
|
-
if (snapshot.catalog.length === 0) throw new LlmError(SIGN_IN_MESSAGE,
|
|
7411
|
+
if (snapshot.catalog.length === 0) throw new LlmError(SIGN_IN_MESSAGE, SIGN_IN_REQUIRED_LLM_CODE);
|
|
7345
7412
|
const catalog = snapshot.byId.get(id);
|
|
7346
7413
|
const model = snapshot.models.getModel(provider, id);
|
|
7347
7414
|
if (catalog === void 0 || model === void 0) throw new LlmError(`VibeDev has no model "${id}"`, "UNKNOWN_MODEL");
|
|
@@ -7350,6 +7417,18 @@ var GatewayAdapter = class extends LlmAdapter {
|
|
|
7350
7417
|
catalog
|
|
7351
7418
|
};
|
|
7352
7419
|
}
|
|
7420
|
+
/**
|
|
7421
|
+
* The request-image target for a stored image: the one `toPiContext` reads the request version with, from the same
|
|
7422
|
+
* function and the same budgets. Computer Use asks for it to size and encode a screenshot and to map coordinates onto
|
|
7423
|
+
* the image the model sees; the base class returns the source size, which would let `toPiContext` shrink the
|
|
7424
|
+
* screenshot again afterwards and put the model's coordinates out of step with the tool's.
|
|
7425
|
+
*/
|
|
7426
|
+
imageRequestTarget(_provider, _model, image) {
|
|
7427
|
+
return requestImageTarget(image, {
|
|
7428
|
+
maxPixels: DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET,
|
|
7429
|
+
maxBytes: DEFAULT_REQUEST_IMAGE_MAX_BYTES
|
|
7430
|
+
});
|
|
7431
|
+
}
|
|
7353
7432
|
providerInfo(provider) {
|
|
7354
7433
|
this.assertOwned(provider);
|
|
7355
7434
|
const relay = this.config.relayProvider;
|
|
@@ -7439,7 +7518,7 @@ var GatewayAdapter = class extends LlmAdapter {
|
|
|
7439
7518
|
const starting = startingReasoning(catalog);
|
|
7440
7519
|
const reasoning = resolveReasoningLevel(model, options.reasoningEffort ?? (starting === void 0 ? void 0 : effortOf(starting)));
|
|
7441
7520
|
let credential = await this.config.resolveCredential();
|
|
7442
|
-
if (credential === void 0) throw new LlmError(SIGN_IN_MESSAGE,
|
|
7521
|
+
if (credential === void 0) throw new LlmError(SIGN_IN_MESSAGE, SIGN_IN_REQUIRED_LLM_CODE);
|
|
7443
7522
|
const sessionId = options.sessionId === void 0 ? void 0 : String(options.sessionId);
|
|
7444
7523
|
const deviceId = model.api === "anthropic-messages" && sessionId !== void 0 ? await this.config.deviceId?.() : void 0;
|
|
7445
7524
|
const consumer = new AbortController();
|
package/lib/llm/adapter.d.ts
CHANGED
|
@@ -125,6 +125,13 @@ export declare class GatewayAdapter extends LlmAdapter {
|
|
|
125
125
|
private owns;
|
|
126
126
|
private assertOwned;
|
|
127
127
|
private modelOf;
|
|
128
|
+
/**
|
|
129
|
+
* The request-image target for a stored image: the one `toPiContext` reads the request version with, from the same
|
|
130
|
+
* function and the same budgets. Computer Use asks for it to size and encode a screenshot and to map coordinates onto
|
|
131
|
+
* the image the model sees; the base class returns the source size, which would let `toPiContext` shrink the
|
|
132
|
+
* screenshot again afterwards and put the model's coordinates out of step with the tool's.
|
|
133
|
+
*/
|
|
134
|
+
imageRequestTarget(_provider: string, _model: string, image: ImageAttachmentRef): import("./context.js").CompatImageRequestTarget;
|
|
128
135
|
providerInfo(provider: string): LlmProviderInfo;
|
|
129
136
|
providerRetryPolicy(provider: string): ResolvedRetryPolicy | undefined;
|
|
130
137
|
listModels(provider: string): Promise<readonly GatewayListedModel[]>;
|
package/lib/llm/context.d.ts
CHANGED
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
* image-limit import moved to ./limits.ts,
|
|
5
5
|
* so the gateway adapter can choose a wire protocol per model. Keep it in step with upstream.
|
|
6
6
|
*
|
|
7
|
+
* Kept in step with 0.2.3 for what changes at run time: the request-image target (see `requestImageTarget`) and the text of a
|
|
8
|
+
* system message (see `systemText`).
|
|
9
|
+
*
|
|
7
10
|
* Harness request-history conversion into pi-ai's Context vocabulary.
|
|
8
11
|
*
|
|
9
12
|
* @module dsh-llm-pi-ai/context
|
|
10
13
|
*/
|
|
11
14
|
import type { GenerateOptions, ImageAttachmentAccessResolver } from '@deepseek-ai/dsh-llm';
|
|
12
|
-
import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
|
|
15
|
+
import type { AttachmentStore, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
13
16
|
import type { Context as PiContext } from '@earendil-works/pi-ai';
|
|
14
17
|
/** Inputs that bind deterministic request images to one current tool execution world. */
|
|
15
18
|
export interface PiImageRequestContext {
|
|
@@ -26,9 +29,38 @@ export interface PiImageRequestContext {
|
|
|
26
29
|
export interface PiImageRequestBudget {
|
|
27
30
|
/** Total-pixel budget; larger sources are downscaled proportionally. */
|
|
28
31
|
maxPixels: number;
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Raw encoded bytes for one request image. DSH 0.2.3 treats it as a hard limit (a larger encoding is shrunk
|
|
34
|
+
* further) and also as the preferred size; DSH 0.2.2-rc.5 treated it as a target only.
|
|
35
|
+
*/
|
|
30
36
|
maxBytes: number;
|
|
31
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A request-image target that both DSH generations accept. `ImageRequestTarget` changed between them:
|
|
40
|
+
* - DSH 0.2.2-rc.5: `{ width, height, maxBytes }`;
|
|
41
|
+
* - DSH 0.2.3: `{ width, height, maxImageBytes, imageTargetBytes }`, where `maxImageBytes` is the hard limit,
|
|
42
|
+
* `imageTargetBytes` the preferred size (never above the limit), and `readImageRequest` rejects a target
|
|
43
|
+
* missing either with `INVALID_ATTACHMENT_REF` ("maxImageBytes must be a positive integer").
|
|
44
|
+
* 0.2.3 validates only the fields it knows and rc.5 ignores extra ones, so one object carries all three byte fields,
|
|
45
|
+
* each the same budget (the shape DSH's own pi-ai adapter builds, which sets `imageTargetBytes = maxImageBytes`).
|
|
46
|
+
* Drop `maxBytes` once rc.5 is no longer supported.
|
|
47
|
+
*/
|
|
48
|
+
export interface CompatImageRequestTarget {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
/** rc.5's byte target. */
|
|
52
|
+
maxBytes: number;
|
|
53
|
+
/** 0.2.3's hard limit on the encoded bytes. */
|
|
54
|
+
maxImageBytes: number;
|
|
55
|
+
/** 0.2.3's preferred encoded size; not above `maxImageBytes`. */
|
|
56
|
+
imageTargetBytes: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Deterministic request target for one source under the route budgets.
|
|
60
|
+
* Assigned to `ImageRequestTarget` of whichever `@deepseek-ai/dsh-attachment` the host runs: the declared type
|
|
61
|
+
* changed in 0.2.3, and the object satisfies both.
|
|
62
|
+
*/
|
|
63
|
+
export declare function requestImageTarget(ref: ImageAttachmentRef, budget: PiImageRequestBudget): CompatImageRequestTarget;
|
|
32
64
|
/**
|
|
33
65
|
* Convert text-only harness history to a synchronous pi-ai Context. Tool
|
|
34
66
|
* result names are recovered from preceding assistant tool calls.
|
package/lib/llm/limits.d.ts
CHANGED
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
export declare const DEFAULT_MAX_REQUEST_IMAGE_BYTES: number;
|
|
10
10
|
/** Total-pixel budget that preserves the complete 2048px normalized attachment. */
|
|
11
11
|
export declare const DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET: number;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Raw encoded bytes allowed for one request image, before inline base64 expansion. A hard limit under DSH 0.2.3 (a larger
|
|
14
|
+
* encoding is shrunk further; that is also the preferred size) and a target under rc.5. DSH's pi-ai default is 0.75 MiB
|
|
15
|
+
* (a 20 MiB request over 20 images); 1 MiB keeps what 0.11.0 sent, and the oldest images are offloaded when the request
|
|
16
|
+
* exceeds `DEFAULT_MAX_REQUEST_IMAGE_BYTES`.
|
|
17
|
+
*/
|
|
13
18
|
export declare const DEFAULT_REQUEST_IMAGE_MAX_BYTES: number;
|
|
14
19
|
/** Maximum provider idle time while one stream read is outstanding. */
|
|
15
20
|
export declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 300000;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibedev-si/dsh-vibedev",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.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",
|