@vibedev-si/dsh-vibedev 0.3.6 → 0.3.7

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
@@ -78,6 +78,7 @@
78
78
  - 没登录就用了 VibeDev 的模型,或登录已失效时,对话里会提示到侧边栏或设置里登录;余额不足时会提示并给出充值链接。这些提示和 DeepSeek 账号的登录、充值提示是分开的。
79
79
  - 访问令牌过期时插件会自动续期并重发请求,不会重复输出。
80
80
  - 网关到上游模型服务的连接中途断开(例如 `upstream_http2_stream_error`、上游响应流被中断)属于可恢复的传输故障,会和超时、5xx、限流一样按退避自动重试,不再直接判定成一次不可重试的失败;重试会重新发起该次请求,已经输出的内容不会续写。
81
+ - 0.3.7 起,网关新上架或下架的模型不用退出重新登录就能看到:指针停在侧边栏的 VibeDev 账号行上打开余额卡片、打开账号菜单(显示的余额超过 10 秒时),以及点「刷新」或打开「设置 → VibeDev 账号」时,插件在重新读取余额的同时也重新读取模型列表,最多每分钟一次;余额照常立刻显示,不等模型列表。模型有变化时,选择器里的「VibeDev」组和设置页的「N 个模型」随即更新。没人操作时,仍按原来的方式在启动、登录或切换账号时以及每 30 分钟(`catalogRefreshMinutes`)读取一次,不会定时轮询。
81
82
 
82
83
  ## 网页搜索
83
84
 
@@ -136,7 +137,7 @@
136
137
  | 保存目录 | `media` | 相对于工作区。 |
137
138
  | 默认生图 / 视频 / 音乐 / 播客 / 语音合成 / 转写模型 | 空 | 留空时由 Agent 按模型目录选择;可以填模型 id 或别名。 |
138
139
 
139
- 另有几项只能在配置文件(`cordis.patch.yml` 中 `dsh-vibedev` 一行)里改:`displayName`(模型选择器里显示的组名,默认 `VibeDev`)、`preferredModels`(排在最前的 VibeDev 模型)、`openBrowserOnSignIn`(登录时是否自动打开系统浏览器,默认开)、`catalogRefreshMinutes`(模型目录刷新间隔,默认 30 分钟)、`client`(登录时报给网关的客户端名称,默认 `vibedev-plugin`)、`primary`(作为应用的主账号显示,默认关,VibeDev 应用里开)。
140
+ 另有几项只能在配置文件(`cordis.patch.yml` 中 `dsh-vibedev` 一行)里改:`displayName`(模型选择器里显示的组名,默认 `VibeDev`)、`preferredModels`(排在最前的 VibeDev 模型)、`openBrowserOnSignIn`(登录时是否自动打开系统浏览器,默认开)、`catalogRefreshMinutes`(模型目录定时刷新间隔,默认 30 分钟;是没人打开余额卡片、账号菜单或设置时的兜底)、`client`(登录时报给网关的客户端名称,默认 `vibedev-plugin`)、`primary`(作为应用的主账号显示,默认关,VibeDev 应用里开)。
140
141
 
141
142
  ## 从 dsh-media 升级
142
143
 
@@ -199,6 +200,8 @@ Everything is paid from your VibeDev balance; the DeepSeek account stays DeepSee
199
200
 
200
201
  **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.
201
202
 
203
+ **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.
204
+
202
205
  **Web search**: the plugin registers the web search provider `vibedev-gateway`, signed in with your VibeDev account. Registering does not select it: DeepSeek Harness keeps its own search unless the profile sets `searchProvider: vibedev-gateway` on the `web` row (the VibeDev app does). Searching is free, but the gateway refuses every request, searches included, while the balance is zero.
203
206
 
204
207
  **Media tools**: `image_generate`, `video_generate` (runs as a background job), `audio_generate` (music, a podcast or speech), `audio_transcribe` (a multipart file upload; languages and limits as each model declares), `media_models`, `media_tasks` and `media_account`. Reference images, videos and audio, and first and last frames, can each be a workspace path, an http(s) link, or `chat:1` for the most recent matching file you attached. A request the model cannot serve is refused before anything is uploaded or charged.
@@ -1,4 +1,4 @@
1
- THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.3.6
1
+ THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.3.7
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.
@@ -9,8 +9,10 @@
9
9
  * when it was read, a sign-in waiting for the browser, and how many VibeDev
10
10
  * models the pickers list; `?fresh=1` reads the balance again (a read that
11
11
  * fails keeps the last balance, says when it was read, and says the read
12
- * failed); `?since=<revision>` holds the request until the person or the
13
- * balance changes (a charge is read again right after it ends), so the pages
12
+ * failed) and, at most once a minute, the model catalog too (without waiting
13
+ * for it: a list that changed reaches the pages through the long poll);
14
+ * `?since=<revision>` holds the request until the person, the balance or the
15
+ * model list changes (a charge is read again right after it ends), so the pages
14
16
  * show a new balance within seconds instead of on their next minute poll;
15
17
  * - `POST /api/dsh-vibedev/account/sign-in` — `{ open?: boolean }`: start the
16
18
  * plugin's own sign-in; answers the authorization link (`open: false` leaves
@@ -102,6 +104,11 @@ export interface AccountServiceOptions {
102
104
  count: number;
103
105
  hidden?: 'signed-out' | 'host-account';
104
106
  };
107
+ /**
108
+ * Read the route's model catalog again (the route's `refresh()`; it republishes a changed list to the pickers).
109
+ * Started without waiting by an explicit read of the account, at most once a minute.
110
+ */
111
+ readonly refreshCatalog?: () => Promise<void>;
105
112
  /** Present the VibeDev account as the app's main account. */
106
113
  readonly primary?: boolean;
107
114
  readonly fetch?: typeof globalThis.fetch;
@@ -130,6 +137,9 @@ export declare class AccountService {
130
137
  private lastGood;
131
138
  /** The latest read failed, after the last one that succeeded. */
132
139
  private failure;
140
+ /** When the last catalog read an explicit read started began, and that read while it runs. */
141
+ private catalogReadAt;
142
+ private catalogRead;
133
143
  /**
134
144
  * @param options - origin, credential chain, the plugin's sign-in and the route's model state.
135
145
  */
@@ -157,9 +167,16 @@ export declare class AccountService {
157
167
  wait(since: number, signal?: AbortSignal): Promise<void>;
158
168
  /** Links to the gateway's pages. */
159
169
  links(): AccountView['links'];
170
+ /**
171
+ * Read the model catalog again, without waiting for it: at most one read a minute and one at a time. A read that
172
+ * changed the list (a model the gateway published or withdrew) is told to the pages at once, through the long
173
+ * poll; one that changed nothing, or failed, tells them nothing.
174
+ */
175
+ private refreshModels;
160
176
  /**
161
177
  * The account as it stands.
162
- * @param fresh - read the balance again instead of reusing a recent read.
178
+ * @param fresh - read the balance again instead of reusing a recent read, and the model catalog with it (at most
179
+ * once a minute; the answer does not wait for it).
163
180
  * @returns the view.
164
181
  */
165
182
  view(fresh?: boolean): Promise<AccountView>;
package/lib/index.d.ts CHANGED
@@ -49,7 +49,10 @@ export interface Config {
49
49
  preferredModels: string[];
50
50
  /** Open the system browser when a sign-in starts (off: the page opens the link itself). */
51
51
  openBrowserOnSignIn: boolean;
52
- /** Minutes between catalog reads while the app runs. */
52
+ /**
53
+ * Minutes between catalog reads while the app runs: the fallback that keeps the pickers current when nobody opens
54
+ * the balance card, the account menu or Settings (each of those reads the catalog too, at most once a minute).
55
+ */
53
56
  catalogRefreshMinutes: number;
54
57
  /** Ask the user before each paid request. */
55
58
  confirmSpending: Volatile<boolean>;
package/lib/index.js CHANGED
@@ -41,6 +41,13 @@ const WAIT_MS = 8e3;
41
41
  const SETTLE_READS_MS = [1500, 8e3];
42
42
  /** Reads after charges are at least this far apart. */
43
43
  const MIN_READ_SPACING_MS = 5e3;
44
+ /**
45
+ * An explicit read of the account (`?fresh=1`: the balance card opening on a balance older than 10 s, the account
46
+ * menu, 刷新, Settings opening) also reads the model catalog again, at most once in this long. The route's own reads
47
+ * (at start, on a sign-in change, every `catalogRefreshMinutes`) are untouched: they are what keeps the pickers
48
+ * current when nobody opens anything.
49
+ */
50
+ const CATALOG_REFRESH_GAP_MS = 6e4;
44
51
  const record$9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
45
52
  const text$8 = (value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
46
53
  /**
@@ -82,6 +89,9 @@ var AccountService = class {
82
89
  lastGood;
83
90
  /** The latest read failed, after the last one that succeeded. */
84
91
  failure;
92
+ /** When the last catalog read an explicit read started began, and that read while it runs. */
93
+ catalogReadAt = Number.NEGATIVE_INFINITY;
94
+ catalogRead;
85
95
  /**
86
96
  * @param options - origin, credential chain, the plugin's sign-in and the route's model state.
87
97
  */
@@ -168,18 +178,36 @@ var AccountService = class {
168
178
  };
169
179
  }
170
180
  /**
181
+ * Read the model catalog again, without waiting for it: at most one read a minute and one at a time. A read that
182
+ * changed the list (a model the gateway published or withdrew) is told to the pages at once, through the long
183
+ * poll; one that changed nothing, or failed, tells them nothing.
184
+ */
185
+ refreshModels() {
186
+ const refresh = this.options.refreshCatalog;
187
+ if (refresh === void 0 || this.catalogRead !== void 0 || this.now() - this.catalogReadAt < CATALOG_REFRESH_GAP_MS) return;
188
+ this.catalogReadAt = this.now();
189
+ const before = JSON.stringify(this.options.models());
190
+ const read = Promise.resolve().then(() => refresh()).then(() => {
191
+ if (JSON.stringify(this.options.models()) !== before) this.changed();
192
+ }, () => void 0).finally(() => {
193
+ if (this.catalogRead === read) this.catalogRead = void 0;
194
+ });
195
+ this.catalogRead = read;
196
+ }
197
+ /**
171
198
  * The account as it stands.
172
- * @param fresh - read the balance again instead of reusing a recent read.
199
+ * @param fresh - read the balance again instead of reusing a recent read, and the model catalog with it (at most
200
+ * once a minute; the answer does not wait for it).
173
201
  * @returns the view.
174
202
  */
175
203
  async view(fresh = false) {
176
204
  const credential = await this.options.chain.resolve().catch(() => void 0);
205
+ if (fresh && credential !== void 0) this.refreshModels();
177
206
  const source = credential === void 0 ? "none" : credential.kind === "account" ? "host" : credential.kind;
178
207
  const pending = this.options.login.pendingSignIn();
179
208
  const attempt = this.options.login.signInAttempt();
180
209
  const base = {
181
210
  source,
182
- models: this.options.models(),
183
211
  links: this.links(),
184
212
  primary: this.options.primary === true,
185
213
  ...pending === void 0 ? {} : { pending },
@@ -187,6 +215,7 @@ var AccountService = class {
187
215
  };
188
216
  if (credential === void 0) return {
189
217
  ...base,
218
+ models: this.options.models(),
190
219
  revision: this.revision
191
220
  };
192
221
  const [grantUser, read] = await Promise.all([credential.kind === "plugin" ? this.options.login.user().catch(() => void 0) : Promise.resolve(void 0), this.me(credential.token, fresh)]);
@@ -196,6 +225,7 @@ var AccountService = class {
196
225
  const failedAt = this.failure?.token === credential.token ? this.failure.at : void 0;
197
226
  return {
198
227
  ...base,
228
+ models: this.options.models(),
199
229
  ...user === void 0 ? {} : { user },
200
230
  ...me.balance === void 0 ? {} : { balance: me.balance },
201
231
  ...me.readAt === void 0 ? {} : { readAt: me.readAt },
@@ -10846,7 +10876,7 @@ const Config = Schema.object({
10846
10876
  displayName: "模型选择器里显示的名称",
10847
10877
  preferredModels: "排在最前的 VibeDev 模型(按顺序,留空按网关顺序)",
10848
10878
  openBrowserOnSignIn: "登录时自动打开系统浏览器",
10849
- catalogRefreshMinutes: "模型目录刷新间隔(分钟)",
10879
+ catalogRefreshMinutes: "模型目录定时刷新间隔(分钟;没人打开余额卡片、账号菜单或设置时的兜底)",
10850
10880
  confirmSpending: "每次付费生成前先询问(默认关闭)",
10851
10881
  outputDir: "保存目录(相对于工作区)",
10852
10882
  imageModel: "默认生图模型(留空由 Agent 按目录选择)",
@@ -10865,7 +10895,7 @@ const Config = Schema.object({
10865
10895
  displayName: "Name the model pickers show",
10866
10896
  preferredModels: "VibeDev models listed first, in this order (empty: the gateway's order)",
10867
10897
  openBrowserOnSignIn: "Open the system browser when signing in",
10868
- catalogRefreshMinutes: "Model catalog refresh interval (minutes)",
10898
+ catalogRefreshMinutes: "Model catalog refresh interval in minutes (the fallback when nobody opens the balance card, the account menu or Settings)",
10869
10899
  confirmSpending: "Ask before each paid generation (off by default)",
10870
10900
  outputDir: "Output folder (relative to the workspace)",
10871
10901
  imageModel: "Default image model (empty: the agent chooses from the catalog)",
@@ -11012,7 +11042,8 @@ function apply(ctx, config) {
11012
11042
  models: () => ({
11013
11043
  count: route?.models().length ?? 0,
11014
11044
  ...route?.hidden() === void 0 ? {} : { hidden: route.hidden() }
11015
- })
11045
+ }),
11046
+ refreshCatalog: () => route?.refresh() ?? Promise.resolve()
11016
11047
  });
11017
11048
  account = accountService;
11018
11049
  const latency = new LatencyProbe({
@@ -6,8 +6,12 @@
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
8
8
  * account. It is read at start, on every sign-in, sign-out or account change,
9
- * and every `catalogRefreshMinutes`; a changed catalog republishes the route
10
- * so pickers update without a restart.
9
+ * and every `catalogRefreshMinutes` (30 by default) — what keeps the pickers
10
+ * current when nobody opens anything — and, at most once a minute, when an
11
+ * account page reads the account fresh (the balance card or the account menu
12
+ * opening on a balance older than 10 s, 刷新, Settings opening; see
13
+ * account/index.ts). A changed catalog republishes the route so pickers update
14
+ * without a restart.
11
15
  *
12
16
  * Inside the VibeDev app the host account already serves these models on the
13
17
  * app's own account channel; when the credential comes from the host account
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedev-si/dsh-vibedev",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
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",