@vibedev-si/dsh-vibedev 0.3.8 → 0.3.9

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  在 DeepSeek Harness 里登录 VibeDev 账号,和 DeepSeek 账号并存:
4
4
 
5
- - **VibeDev 的模型**:登录后,模型选择器里会多出「VibeDev」一组(Claude、GPT 等网关提供的模型),和 DeepSeek 的模型并列,选中就能用;
5
+ - **VibeDev 的模型**:登录后,模型选择器里会多出「VibeDev」一组(Claude、GPT 等普通网关模型),`relay-` 开头的聊天模型另列「中转」组,和 DeepSeek 的模型并列,选中就能用;
6
6
  - **媒体生成**:Agent 可以生成图片、视频、音乐、播客和语音,并把语音转成文字,结果保存在工作区的 `media/` 目录下;
7
7
  - **网页搜索**:提供走 VibeDev 网关的网页搜索,见下面的「网页搜索」。
8
8
 
@@ -74,7 +74,9 @@
74
74
  媒体创建、完成、刷新请求走所选 API;上传和下载使用服务器返回的完整签名 URL,保留 host、path、query,不携带 VibeDev app token。返回签名链接时下载不再先探测旧 `/content` 接口;未返回链接的旧接口仍可直接返回文件。API 和下载请求拒绝重定向,不把失败或503当作跨区域重发理由。现有同站同键重试、SSE、心跳和取消语义保留。默认不读取开发密钥,旧 `VIBEDEV_GATEWAY_API_KEY` 变量不再使用;开发调试需显式指定本站专用环境变量。本地验证版不解除服务器503挡板,不发送真实模型或付费媒体测试。
75
75
 
76
76
  - 模型列表来自 VibeDev 网关,按你的账号下发,所以**未登录时不显示**,登录后立即出现,不用重启。
77
- - 模型在选择器里的「VibeDev」组;默认模型仍是 DeepSeek Harness 原来的,想用 VibeDev 的模型就在选择器里选。
77
+ - 普通模型在选择器里的「VibeDev」组;`relay-` 开头的聊天模型在「中转」组,两组共用同一个账号、余额和网关地址。没有中转模型时不显示空分组。
78
+ - 0.3.9 起,`relay-gpt-6.1-sol-x0.3` 显示为 `gpt-6.1-sol · 0.3倍率`;`relay-gpt-6.1-sol` 同样归入「中转」,但不显示倍率。网关给了可读的 `display_name` 时保留该名称。只把末尾 `-x数字` 当作倍率;其他文字后缀照常显示。
79
+ - 分组和倍率只影响显示:请求、历史记录和模型选择使用网关下发的完整模型 ID,不会去掉 `relay-` 或倍率后缀。不同倍率和无倍率的同名模型保持独立;价格和扣费仍以网关为准,插件不会按名称再乘一次倍率。中转模型保留目录声明的上下文、图片输入和推理档位,并按原模型族选择协议。原来已保存的普通路由与中转模型选择仍可解析。
78
80
  - 没登录就用了 VibeDev 的模型,或登录已失效时,对话里会提示到侧边栏或设置里登录;余额不足时会提示并给出充值链接。这些提示和 DeepSeek 账号的登录、充值提示是分开的。
79
81
  - 访问令牌过期时插件会自动续期并重发请求,不会重复输出。
80
82
  - 网关到上游模型服务的连接中途断开(例如 `upstream_http2_stream_error`、上游响应流被中断)属于可恢复的传输故障,会和超时、5xx、限流一样按退避自动重试,不再直接判定成一次不可重试的失败;重试会重新发起该次请求,已经输出的内容不会续写。
@@ -137,7 +139,7 @@
137
139
  | 保存目录 | `media` | 相对于工作区。 |
138
140
  | 默认生图 / 视频 / 音乐 / 播客 / 语音合成 / 转写模型 | 空 | 留空时由 Agent 按模型目录选择;可以填模型 id 或别名。 |
139
141
 
140
- 另有几项只能在配置文件(`cordis.patch.yml` 中 `dsh-vibedev` 一行)里改:`displayName`(模型选择器里显示的组名,默认 `VibeDev`)、`preferredModels`(排在最前的 VibeDev 模型)、`openBrowserOnSignIn`(登录时是否自动打开系统浏览器,默认开)、`catalogRefreshMinutes`(模型目录定时刷新间隔,默认 30 分钟;是没人打开余额卡片、账号菜单或设置时的兜底)、`client`(登录时报给网关的客户端名称,默认 `vibedev-plugin`)、`primary`(作为应用的主账号显示,默认关,VibeDev 应用里开)。
142
+ 另有几项只能在配置文件(`cordis.patch.yml` 中 `dsh-vibedev` 一行)里改:`displayName`(普通模型分组名,默认 `VibeDev`)、`relayDisplayName`(中转模型分组名,默认「中转」)、`preferredModels`(排在最前的 VibeDev 模型)、`openBrowserOnSignIn`(登录时是否自动打开系统浏览器,默认开)、`catalogRefreshMinutes`(模型目录定时刷新间隔,默认 30 分钟;是没人打开余额卡片、账号菜单或设置时的兜底)、`client`(登录时报给网关的客户端名称,默认 `vibedev-plugin`)、`primary`(作为应用的主账号显示,默认关,VibeDev 应用里开)。
141
143
 
142
144
  ## 从 dsh-media 升级
143
145
 
@@ -177,7 +179,7 @@ npm run build
177
179
 
178
180
  Sign in to VibeDev in DeepSeek Harness, next to the DeepSeek account:
179
181
 
180
- - **VibeDev models**: once signed in, the model picker gains a "VibeDev" group (Claude, GPT and the other models of the VibeDev gateway) next to DeepSeek's;
182
+ - **VibeDev models**: once signed in, the model picker gains a "VibeDev" group for ordinary gateway models and a separate 中转 (Relay) group for `relay-` chat models, next to DeepSeek's;
181
183
  - **Media generation**: the agent generates images, videos, music, podcasts and speech, and transcribes speech; results are saved in the workspace under `media/`.
182
184
 
183
185
  Everything is paid from your VibeDev balance; the DeepSeek account stays DeepSeek Harness's own, and the two do not affect each other. To create an account, register at [VibeDev](https://api.vibedev.studio). This plugin was renamed from `dsh-media`.
@@ -202,6 +204,8 @@ Everything is paid from your VibeDev balance; the DeepSeek account stays DeepSee
202
204
 
203
205
  **Models**: the list comes from the VibeDev gateway for your account, so nothing is listed before you sign in; models appear right after, without a restart. Using a VibeDev model while signed out, or after the sign-in has ended, asks you to sign in; a used-up balance says so with the top-up link. These messages are separate from the DeepSeek account's. An expired access token is renewed and the request sent again, without repeating any output.
204
206
 
207
+ **Relay models (0.3.9)**: chat model IDs beginning with `relay-` appear in a separate 中转 (Relay) group, sharing the VibeDev account, gateway and balance. A terminal decimal `-x0.3` is displayed as `0.3倍率` next to the readable model name: `relay-gpt-6.1-sol-x0.3` becomes `gpt-6.1-sol · 0.3倍率`. `relay-gpt-6.1-sol` is in the same group without a multiplier. A gateway `display_name` is kept after removing these presentation markers. Other suffixes are retained as text. Requests, saved selections and history keep the complete exact model ID; rates and the suffix-free variant remain separate entries. Catalog prices are used unchanged, never multiplied by the suffix locally. Protocol-family detection handles the relay prefix while the catalog's endpoints, reasoning levels, image inputs and capacity remain authoritative. Old selections on the original route still resolve, both groups refresh together, and empty groups are hidden.
208
+
205
209
  **New models without signing out (0.3.7)**: models the gateway publishes or withdraws now reach the picker on the next look at the account. Opening the balance card (resting the pointer on the sidebar's VibeDev row) or the account menu when the balance shown is more than 10 s old, Refresh on the card or in Settings → VibeDev Account, and opening that Settings page read the account with `?fresh=1`; the Host then reads the model catalog (`GET /v1/models`) again as well — at most once a minute and one read at a time, without making the balance wait. A list that changed republishes the picker's VibeDev group at once and reaches the "N models" line in Settings through the account route's long poll; a failed read keeps the list as it was. When nobody opens anything, the catalog is read as before: at start, on every sign-in, sign-out or account change, and every `catalogRefreshMinutes` (30 by default) — there is no other polling.
206
210
 
207
211
  **Image sizes and ratios for the film workbench (0.3.8)**: an image model in the gateway catalog may declare its size tiers and aspect ratios (`capabilities.image_sizes`, such as `["1K", "1.5K", "2K", "4K"]`, and `capabilities.image_ratios`, such as `["1:1", "16:9", "9:16"]`); `vibedevMedia.models()` now hands them over on that model as `imageSizes` and `imageRatios`, for the image node's pickers. Each model keeps its own lists exactly as the gateway writes them, in its order — nothing is invented, converted or sorted (`1.5K` and `3K` stay as they are) — with entries that are not text, are blank or repeat an earlier one left out. A model that declares nothing, an empty list or a malformed one carries neither field, and nothing else in the catalog is affected. The lists follow the catalog through its cache and every refresh, so options the gateway drops disappear. They are capabilities, never request parameters: an image request still sends only `model`, `prompt`, `n`, `size` (pixels) and `quality`, and video models keep their own `ratios` and `resolutions`.
@@ -214,7 +218,7 @@ Everything is paid from your VibeDev balance; the DeepSeek account stays DeepSee
214
218
 
215
219
  **Cost**: chat models are billed by usage at the gateway's prices; images per image, video per second (reference video length counts), music and podcasts per request, speech per second of original audio (the length the provider reports, which can differ from playback), transcription per minute. A model without a catalog price is shown as "not priced" (未定价), never as free. Video models priced per video Token (`video_pricing` in the catalog) have one Token price per resolution and presence of reference video, audio and images (first and last frames count as images); before a run the plugin estimates the matching rule's per-second price times the output length plus every reference video's length, and the final charge is the actual video Tokens. When that cannot be estimated (an unmeasured reference video, no per-second estimate, a pricing mode this version does not read) it says "estimate unavailable; billed by actual video Token usage" — never free, never "not priced". A finished video whose billing is still pending (`billing_status: pending`) is saved as usual and never generated again; only the charge is still to be confirmed. Failed and cancelled video and audio tasks are not charged, and a submitted video cannot be cancelled. One operation generates once: an unconfirmed submission is settled under the same key, a failed query or download only queries again or renews the link, and a result whose charge is still settling (`settlement_pending`) is kept, never generated again. "Ask before each paid generation" is off by default.
216
220
 
217
- **Settings**: open "VibeDev Account & Models" on the Plugins page for the spending confirmation, the output folder and the default media models. `displayName`, `preferredModels`, `openBrowserOnSignIn`, `catalogRefreshMinutes`, `client` (the client name sent with the sign-in, default `vibedev-plugin`) and `primary` (show the account as the app's main account; off by default, on in the VibeDev app) are set in the profile's `cordis.patch.yml` row `dsh-vibedev`.
221
+ **Settings**: open "VibeDev Account & Models" on the Plugins page for the spending confirmation, the output folder and the default media models. `displayName`, `relayDisplayName` (the relay group label, default 中转), `preferredModels`, `openBrowserOnSignIn`, `catalogRefreshMinutes`, `client` (the client name sent with the sign-in, default `vibedev-plugin`) and `primary` (show the account as the app's main account; off by default, on in the VibeDev app) are set in the profile's `cordis.patch.yml` row `dsh-vibedev`.
218
222
 
219
223
  **Upgrading from dsh-media**: the VibeDev Plugin Center (0.1.5 or later) switches it over for you, from its banner or when you install this plugin, the film workbench or the AI Creator Suite: the new package is installed disabled, `dsh-media` is disabled, the new one enabled, and `dsh-media` removed only after that worked. By hand, disable `dsh-media` first, install `@vibedev-si/dsh-vibedev`, uninstall `dsh-media` and restart the app fully. The two cannot both be enabled: they register the same tool names, and whichever loads second fails to start. The sign-in and running video and audio tasks carry over; the media settings go back to their defaults.
220
224
 
@@ -1,4 +1,4 @@
1
- THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.3.8
1
+ THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.3.9
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.d.ts CHANGED
@@ -37,7 +37,7 @@ export { LATENCY_ROUTE } from './account/latency.js';
37
37
  export type { LatencyErrorKind, LatencyResult } from './account/latency.js';
38
38
  export { FEEDBACK_ATTACHMENT_ROUTE, FEEDBACK_ROUTE } from './feedback/index.js';
39
39
  export { GATEWAY_SEARCH_PROVIDER_ID as SEARCH_PROVIDER_ID } from './search/provider.js';
40
- export { INSUFFICIENT_BALANCE_CODE, SIGN_IN_REQUIRED_CODE, VIBEDEV_ROUTE } from './llm/index.js';
40
+ export { INSUFFICIENT_BALANCE_CODE, SIGN_IN_REQUIRED_CODE, VIBEDEV_ROUTE, VIBEDEV_RELAY_ROUTE } from './llm/index.js';
41
41
  /** The package version, sent in the `User-Agent` the gateway attributes plugin traffic by. */
42
42
  export declare const version: string;
43
43
  export declare const name = "dsh-vibedev";
@@ -45,6 +45,8 @@ export declare const inject: string[];
45
45
  export interface Config {
46
46
  /** Name the model pickers and the Models page show for the VibeDev models. */
47
47
  displayName: string;
48
+ /** Name shown for relay chat models in model pickers. */
49
+ relayDisplayName: string;
48
50
  /** VibeDev chat models listed first, in this order, when the catalog offers them. */
49
51
  preferredModels: string[];
50
52
  /** Open the system browser when a sign-in starts (off: the page opens the link itself). */
@@ -78,6 +80,7 @@ export interface Config {
78
80
  }
79
81
  export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
80
82
  displayName: Schema<string, string, "defined">;
83
+ relayDisplayName: Schema<string, string, "defined">;
81
84
  preferredModels: Schema<string[], string[], "defined">;
82
85
  openBrowserOnSignIn: Schema<boolean, boolean, "defined">;
83
86
  catalogRefreshMinutes: Schema<number, number, "defined">;
@@ -96,6 +99,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
96
99
  stateDir: Schema<string, string, "defined">;
97
100
  }>>, Schemastery.ObjectT<NoInfer<{
98
101
  displayName: Schema<string, string, "defined">;
102
+ relayDisplayName: Schema<string, string, "defined">;
99
103
  preferredModels: Schema<string[], string[], "defined">;
100
104
  openBrowserOnSignIn: Schema<boolean, boolean, "defined">;
101
105
  catalogRefreshMinutes: Schema<number, number, "defined">;
package/lib/index.js CHANGED
@@ -3196,6 +3196,53 @@ const DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET = 4194304;
3196
3196
  /** Raw encoded-byte target before inline base64 expansion. */
3197
3197
  const DEFAULT_REQUEST_IMAGE_MAX_BYTES = 1048576;
3198
3198
  //#endregion
3199
+ //#region src/llm/relay.ts
3200
+ /** Naming metadata for relay chat models; the gateway id itself is never rewritten. */
3201
+ const RELAY_PREFIX = "relay-";
3202
+ const RATE_SUFFIX = /-x(\d+(?:\.\d+)?)$/;
3203
+ /**
3204
+ * Read relay markers without changing routing identity.
3205
+ * @param id - exact gateway model id.
3206
+ * @returns whether it is a relay model, its family id and any display multiplier.
3207
+ */
3208
+ function relayIdentity(id) {
3209
+ if (!id.startsWith(RELAY_PREFIX)) return {
3210
+ relay: false,
3211
+ baseId: id
3212
+ };
3213
+ const base = id.slice(6);
3214
+ const rate = RATE_SUFFIX.exec(base);
3215
+ if (rate === null || rate.index === 0) return {
3216
+ relay: true,
3217
+ baseId: base || id
3218
+ };
3219
+ const [integer, fraction] = rate[1].split(".");
3220
+ const whole = integer.replace(/^0+(?=\d)/, "");
3221
+ const decimal = fraction?.replace(/0+$/, "");
3222
+ const multiplier = decimal ? `${whole}.${decimal}` : whole;
3223
+ return {
3224
+ relay: true,
3225
+ baseId: base.slice(0, rate.index),
3226
+ multiplier
3227
+ };
3228
+ }
3229
+ /**
3230
+ * Format a catalog label, keeping gateway-authored readable names.
3231
+ * @param id - exact gateway model id (the only source of the rate).
3232
+ * @param displayName - nonempty gateway display name, when supplied.
3233
+ * @returns the normal name, or a relay name with an optional multiplier.
3234
+ */
3235
+ function modelDisplayName(id, displayName) {
3236
+ const identity = relayIdentity(id);
3237
+ if (!identity.relay) return displayName ?? id;
3238
+ const shown = displayName ?? id;
3239
+ const display = relayIdentity(shown);
3240
+ const matchingRate = display.relay && identity.multiplier !== void 0 && display.multiplier === identity.multiplier;
3241
+ const withoutPrefix = shown.startsWith(RELAY_PREFIX) ? shown.slice(6) : shown;
3242
+ const name = (matchingRate ? display.baseId : withoutPrefix) || identity.baseId;
3243
+ return identity.multiplier === void 0 ? name : `${name} · ${identity.multiplier}倍率`;
3244
+ }
3245
+ //#endregion
3199
3246
  //#region src/llm/catalog.ts
3200
3247
  /**
3201
3248
  * The VibeDev gateway's model catalog (`GET /v1/models`), narrowed to the chat
@@ -3238,7 +3285,7 @@ const price$1 = (value) => typeof value === "number" && Number.isFinite(value) &
3238
3285
  * @returns the preferred protocol.
3239
3286
  */
3240
3287
  function preferredApi(id) {
3241
- const family = id.toLowerCase();
3288
+ const family = relayIdentity(id).baseId.toLowerCase();
3242
3289
  if (family.startsWith("claude")) return "anthropic-messages";
3243
3290
  if (/^(?:gpt|o\d|codex|grok)/.test(family)) return "openai-responses";
3244
3291
  return "openai-completions";
@@ -3304,7 +3351,7 @@ function parseCatalog(body) {
3304
3351
  seen.add(id);
3305
3352
  models.push({
3306
3353
  id,
3307
- name: typeof entry.display_name === "string" && entry.display_name.trim() !== "" ? entry.display_name.trim() : id,
3354
+ name: modelDisplayName(id, typeof entry.display_name === "string" && entry.display_name.trim() !== "" ? entry.display_name.trim() : void 0),
3308
3355
  api,
3309
3356
  contextWindow: positive$1(capabilities.context_window) ?? 2e5,
3310
3357
  maxTokens: positive$1(capabilities.max_output_tokens) ?? 32768,
@@ -3990,7 +4037,7 @@ function compatOf(model) {
3990
4037
  supportsStore: false,
3991
4038
  maxTokensField: "max_tokens"
3992
4039
  };
3993
- if (model.id.toLowerCase().startsWith("deepseek")) return {
4040
+ if (relayIdentity(model.id).baseId.toLowerCase().startsWith("deepseek")) return {
3994
4041
  ...common,
3995
4042
  thinkingFormat: "deepseek",
3996
4043
  supportsReasoningEffort: true,
@@ -4481,6 +4528,15 @@ var GatewayAdapter = class extends LlmAdapter {
4481
4528
  name: this.config.displayName,
4482
4529
  models: piModels
4483
4530
  }));
4531
+ const relay = this.config.relayProvider;
4532
+ if (relay !== void 0) {
4533
+ const relayModels = catalog.filter((model) => relayIdentity(model.id).relay).map((model) => toPiModel(model, relay.id, origin));
4534
+ models.setProvider(gatewayProvider({
4535
+ id: relay.id,
4536
+ name: relay.displayName,
4537
+ models: relayModels
4538
+ }));
4539
+ }
4484
4540
  this.snapshot = {
4485
4541
  catalog,
4486
4542
  origin,
@@ -4489,8 +4545,11 @@ var GatewayAdapter = class extends LlmAdapter {
4489
4545
  };
4490
4546
  return this.snapshot;
4491
4547
  }
4548
+ owns(provider) {
4549
+ return provider === this.config.provider || provider === this.config.relayProvider?.id;
4550
+ }
4492
4551
  assertOwned(provider) {
4493
- if (provider !== this.config.provider) throw new LlmError(`VibeDev gateway adapter does not own provider "${provider}"`, "NO_ADAPTER");
4552
+ if (!this.owns(provider)) throw new LlmError(`VibeDev gateway adapter does not own provider "${provider}"`, "NO_ADAPTER");
4494
4553
  }
4495
4554
  modelOf(snapshot, provider, id) {
4496
4555
  this.assertOwned(provider);
@@ -4504,18 +4563,22 @@ var GatewayAdapter = class extends LlmAdapter {
4504
4563
  };
4505
4564
  }
4506
4565
  providerInfo(provider) {
4566
+ this.assertOwned(provider);
4567
+ const relay = this.config.relayProvider;
4507
4568
  return {
4508
4569
  id: provider,
4509
- name: this.config.displayName
4570
+ name: relay?.id === provider ? relay.displayName : this.config.displayName
4510
4571
  };
4511
4572
  }
4512
4573
  providerRetryPolicy(provider) {
4513
- return provider === this.config.provider ? this.config.retryPolicy?.() : void 0;
4574
+ return this.owns(provider) ? this.config.retryPolicy?.() : void 0;
4514
4575
  }
4515
4576
  async listModels(provider) {
4516
4577
  this.assertOwned(provider);
4517
4578
  if (this.current().catalog.length === 0) await this.config.refreshCatalog?.();
4518
- return this.current().models.getModels(provider).map((model) => ({
4579
+ const listed = this.current().models.getModels(provider);
4580
+ const hideRelay = provider === this.config.provider && this.config.relayProvider !== void 0;
4581
+ return listed.filter((model) => !hideRelay || !relayIdentity(model.id).relay).map((model) => ({
4519
4582
  provider,
4520
4583
  id: model.id,
4521
4584
  name: model.name,
@@ -4706,7 +4769,7 @@ var GatewayAdapter = class extends LlmAdapter {
4706
4769
  switch (model.api) {
4707
4770
  case "openai-completions":
4708
4771
  if (request.sessionId !== void 0 && shaped.prompt_cache_key === void 0) shaped.prompt_cache_key = request.sessionId;
4709
- if (request.off && model.id.toLowerCase().startsWith("deepseek")) {
4772
+ if (request.off && relayIdentity(model.id).baseId.toLowerCase().startsWith("deepseek")) {
4710
4773
  shaped.thinking = { type: "disabled" };
4711
4774
  delete shaped.reasoning_effort;
4712
4775
  } else if (request.off) shaped.reasoning_effort = "none";
@@ -4790,6 +4853,8 @@ function isUnauthorized(chunk, response) {
4790
4853
  //#region src/llm/index.ts
4791
4854
  /** The route the gateway's chat models are listed under. */
4792
4855
  const VIBEDEV_ROUTE = "vibedev-gateway";
4856
+ /** The relay group shares the VibeDev account and keeps the gateway's complete model IDs. */
4857
+ const VIBEDEV_RELAY_ROUTE = "vibedev-relay";
4793
4858
  /** Shortest gap between two catalog reads that an empty model list asks for. */
4794
4859
  const ON_DEMAND_READ_GAP_MS = 15e3;
4795
4860
  /**
@@ -4828,6 +4893,10 @@ function installGatewayModels(ctx, options) {
4828
4893
  const adapter = new GatewayAdapter({
4829
4894
  provider: VIBEDEV_ROUTE,
4830
4895
  displayName: options.displayName,
4896
+ relayProvider: {
4897
+ id: VIBEDEV_RELAY_ROUTE,
4898
+ displayName: options.relayDisplayName ?? "中转"
4899
+ },
4831
4900
  origin: () => origin,
4832
4901
  catalog: () => catalog,
4833
4902
  refreshCatalog: () => refreshIfEmpty(),
@@ -4842,7 +4911,7 @@ function installGatewayModels(ctx, options) {
4842
4911
  },
4843
4912
  ...options.onRequestEnded === void 0 ? {} : { onRequestEnded: options.onRequestEnded }
4844
4913
  });
4845
- const registration = ctx.llm.registerAdapter([VIBEDEV_ROUTE], adapter);
4914
+ const registration = ctx.llm.registerAdapter([VIBEDEV_ROUTE, VIBEDEV_RELAY_ROUTE], adapter);
4846
4915
  ctx.inject(["settings"], (child) => {
4847
4916
  child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
4848
4917
  });
@@ -4851,6 +4920,11 @@ function installGatewayModels(ctx, options) {
4851
4920
  displayName: options.displayName,
4852
4921
  settingsNs: entryId(ctx) ?? "dsh-vibedev",
4853
4922
  settingsPath: []
4923
+ }, {
4924
+ provider: VIBEDEV_RELAY_ROUTE,
4925
+ displayName: options.relayDisplayName ?? "中转",
4926
+ settingsNs: entryId(ctx) ?? "dsh-vibedev",
4927
+ settingsPath: []
4854
4928
  }]);
4855
4929
  let reading;
4856
4930
  let readRequests = 0;
@@ -4861,7 +4935,7 @@ function installGatewayModels(ctx, options) {
4861
4935
  if (disposed || key === catalogKey) return;
4862
4936
  catalog = next;
4863
4937
  catalogKey = key;
4864
- registration.replace([VIBEDEV_ROUTE]);
4938
+ registration.replace([VIBEDEV_ROUTE, VIBEDEV_RELAY_ROUTE]);
4865
4939
  ctx.logger.info(`dsh-vibedev: the VibeDev route lists ${next.length} chat model(s)`);
4866
4940
  };
4867
4941
  const readOnce = async () => {
@@ -10879,6 +10953,7 @@ const name = "dsh-vibedev";
10879
10953
  const inject = ["tools"];
10880
10954
  const Config = Schema.object({
10881
10955
  displayName: Schema.string().default("VibeDev"),
10956
+ relayDisplayName: Schema.string().default("中转"),
10882
10957
  preferredModels: Schema.array(Schema.string()).default([]),
10883
10958
  openBrowserOnSignIn: Schema.boolean().default(true),
10884
10959
  catalogRefreshMinutes: Schema.number().min(1).max(1440).default(30),
@@ -10898,6 +10973,7 @@ const Config = Schema.object({
10898
10973
  }).i18n({
10899
10974
  "zh-CN": {
10900
10975
  displayName: "模型选择器里显示的名称",
10976
+ relayDisplayName: "中转模型分组名称",
10901
10977
  preferredModels: "排在最前的 VibeDev 模型(按顺序,留空按网关顺序)",
10902
10978
  openBrowserOnSignIn: "登录时自动打开系统浏览器",
10903
10979
  catalogRefreshMinutes: "模型目录定时刷新间隔(分钟;没人打开余额卡片、账号菜单或设置时的兜底)",
@@ -10917,6 +10993,7 @@ const Config = Schema.object({
10917
10993
  },
10918
10994
  "en-US": {
10919
10995
  displayName: "Name the model pickers show",
10996
+ relayDisplayName: "Relay model group name",
10920
10997
  preferredModels: "VibeDev models listed first, in this order (empty: the gateway's order)",
10921
10998
  openBrowserOnSignIn: "Open the system browser when signing in",
10922
10999
  catalogRefreshMinutes: "Model catalog refresh interval in minutes (the fallback when nobody opens the balance card, the account menu or Settings)",
@@ -11034,6 +11111,7 @@ function apply(ctx, config) {
11034
11111
  route = installGatewayModels(llmCtx, {
11035
11112
  origin,
11036
11113
  displayName: config.displayName,
11114
+ relayDisplayName: config.relayDisplayName,
11037
11115
  resolveCredential: () => chain.resolve(),
11038
11116
  rejectCredential: (credential) => chain.reject(credential),
11039
11117
  deviceId: () => storage.deviceId(),
@@ -11123,6 +11201,6 @@ function apply(ctx, config) {
11123
11201
  });
11124
11202
  }
11125
11203
  //#endregion
11126
- export { ACCOUNT_ROUTE_PREFIX, AccountService, Config, FEEDBACK_ATTACHMENT_ROUTE, FEEDBACK_ROUTE, INSUFFICIENT_BALANCE_CODE, LATENCY_ROUTE, MediaError, MediaHostService, GATEWAY_SEARCH_PROVIDER_ID as SEARCH_PROVIDER_ID, SIGN_IN_REQUIRED_CODE, VIBEDEV_ROUTE, apply, inject, name, parseMediaCatalog, version };
11204
+ export { ACCOUNT_ROUTE_PREFIX, AccountService, Config, FEEDBACK_ATTACHMENT_ROUTE, FEEDBACK_ROUTE, INSUFFICIENT_BALANCE_CODE, LATENCY_ROUTE, MediaError, MediaHostService, GATEWAY_SEARCH_PROVIDER_ID as SEARCH_PROVIDER_ID, SIGN_IN_REQUIRED_CODE, VIBEDEV_RELAY_ROUTE, VIBEDEV_ROUTE, apply, inject, name, parseMediaCatalog, version };
11127
11205
 
11128
11206
  //# sourceMappingURL=index.js.map
@@ -62,6 +62,11 @@ export interface GatewayAdapterOptions {
62
62
  readonly provider: string;
63
63
  /** The name selectors show for the route. */
64
64
  readonly displayName: string;
65
+ /** Optional picker group for relay models, served by the same account and gateway. */
66
+ readonly relayProvider?: {
67
+ readonly id: string;
68
+ readonly displayName: string;
69
+ };
65
70
  /** The gateway origin, read per snapshot. */
66
71
  readonly origin: () => string;
67
72
  /** The current catalog; a new array identity means a new catalog. */
@@ -99,6 +104,7 @@ export declare class GatewayAdapter extends LlmAdapter {
99
104
  private snapshot;
100
105
  constructor(config: GatewayAdapterOptions);
101
106
  private current;
107
+ private owns;
102
108
  private assertOwned;
103
109
  private modelOf;
104
110
  providerInfo(provider: string): LlmProviderInfo;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The VibeDev gateway's chat models on their own route, `vibedev-gateway`, so
3
- * they sit in the model pickers next to whatever else the Harness offers — the
4
- * DeepSeek account's models included — and are paid from the VibeDev balance.
2
+ * The VibeDev gateway's chat models on `vibedev-gateway` and `vibedev-relay`, so
3
+ * normal and relay models sit in separate picker groups next to the Harness's
4
+ * other providers, sharing the VibeDev account and balance.
5
5
  *
6
6
  * The catalog comes from the gateway (`GET /v1/models`) with the credential
7
7
  * requests use, so nothing is listed before a sign-in: the catalog is per
@@ -28,12 +28,16 @@ export { parseCatalog } from './catalog.js';
28
28
  export type { GatewayModel } from './catalog.js';
29
29
  /** The route the gateway's chat models are listed under. */
30
30
  export declare const VIBEDEV_ROUTE = "vibedev-gateway";
31
+ /** The relay group shares the VibeDev account and keeps the gateway's complete model IDs. */
32
+ export declare const VIBEDEV_RELAY_ROUTE = "vibedev-relay";
31
33
  /** What the route needs from the rest of the plugin. */
32
34
  export interface GatewayModelsOptions {
33
35
  /** Gateway origin, without a trailing slash. */
34
36
  readonly origin: string;
35
37
  /** The name pickers and the Models page show for the route. */
36
38
  readonly displayName: string;
39
+ /** Relay provider group label, default 中转. */
40
+ readonly relayDisplayName?: string;
37
41
  /** The credential for the next request, from the plugin's credential chain. */
38
42
  readonly resolveCredential: () => Promise<GatewayCredential | undefined>;
39
43
  /** Hand a credential the gateway refused back to its owner. */
@@ -0,0 +1,21 @@
1
+ /** Naming metadata for relay chat models; the gateway id itself is never rewritten. */
2
+ /** Presentation and family identity parsed from one exact gateway model id. */
3
+ export interface RelayIdentity {
4
+ readonly relay: boolean;
5
+ readonly baseId: string;
6
+ /** Decimal text for display only; it is never applied to catalog prices. */
7
+ readonly multiplier?: string;
8
+ }
9
+ /**
10
+ * Read relay markers without changing routing identity.
11
+ * @param id - exact gateway model id.
12
+ * @returns whether it is a relay model, its family id and any display multiplier.
13
+ */
14
+ export declare function relayIdentity(id: string): RelayIdentity;
15
+ /**
16
+ * Format a catalog label, keeping gateway-authored readable names.
17
+ * @param id - exact gateway model id (the only source of the rate).
18
+ * @param displayName - nonempty gateway display name, when supplied.
19
+ * @returns the normal name, or a relay name with an optional multiplier.
20
+ */
21
+ export declare function modelDisplayName(id: string, displayName?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedev-si/dsh-vibedev",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
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",