@vibedev-si/dsh-vibedev 0.7.1 → 0.7.3

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
@@ -10,11 +10,19 @@
10
10
 
11
11
  本插件由 `dsh-media` 改名而来,见下面的「从 dsh-media 升级」。
12
12
 
13
- ## 0.7.1 用户可见更新
13
+ ## 0.7.3 用户可见更新
14
14
 
15
- 长对话更不容易在自动压缩之前撞上模型上限:插件现在按网关下发的输入上限(`max_input_tokens`)计算模型的上下文窗口,让宿主的自动压缩落在真实输入的 80%–90% 之间(这个 1M 窗口的模型是 88%,之前是 80%);网关没下发这个值的模型行为不变,仍是按声明的窗口算。
15
+ 「消息」页和账户中心其他页面一样居中显示,宽窗口里不再贴着左边。
16
16
 
17
- 供应商返回「prompt is too long: N tokens > M maximum」这类超窗错误时,现在会被识别成上下文超限:宿主会先压缩再重试一次这次请求,而不是把它判成不可重试的错误。之前这种措辞(Anthropic Messages 的原话)认不出来,一次长会话可能整轮失败。
17
+ VibeDev 开着时发布的 `popup` 公告,现在会在下一次读取消息时弹出:每 5 分钟读一次,窗口回到前台时也会读,不用等下次重启。仍然是一次启动最多弹一次:关掉一条后,之后的 `popup` 公告留到下次启动。
18
+
19
+ ## 0.7.2 用户可见更新
20
+
21
+ 上下文窗口现在就是网关下发的输入上限(`max_input_tokens`):1M 的模型显示 1M,不再显示 1.34M。宿主的自动压缩仍然落在窗口的 80%(宿主自己的 0.8 阈值),所以看到 80% 就是该压缩的时候,不会再出现「表上还剩四分之一、请求却被网关拒掉」的情况。
22
+
23
+ 阈值之所以能落在 80%,是因为插件现在把每次请求的输出预留也交给宿主了:网关按「消息 + 输出预留」计算同一个窗口(一次 655K 消息配 393K 预留就被判超窗),而之前宿主不知道这份预留,按消息独占全窗来算。现在预留收在窗口的 20% 以内(1M 窗口是 128K):压缩点是窗口的 80%,也就是 800K 消息,加上预留一共约 930K,仍在模型 1.05M 的合并上限之内;之前预留 393K,同一个压缩点合起来要 1.19M,根本发不出去。
24
+
25
+ 供应商返回「prompt is too long: N tokens > M maximum」这类超窗错误时,仍然会被识别成上下文超限:宿主会先压缩再重试一次这次请求,而不是把它判成不可重试的错误。
18
26
 
19
27
  ## 0.7.0 用户可见更新
20
28
 
@@ -340,11 +348,19 @@ npm run build
340
348
 
341
349
  ## English
342
350
 
343
- ### What changes in 0.7.1
351
+ ### What changes in 0.7.3
352
+
353
+ The Messages page is centred like the other account-center pages instead of hugging the left edge of a wide window.
354
+
355
+ A `popup` announcement published while VibeDev is open now pops on the next read of the mailbox — every five minutes, and whenever the window comes back — instead of waiting for the next launch. It still interrupts at most once per launch: after one is closed, any further `popup` message waits for the next launch.
356
+
357
+ ### What changes in 0.7.2
358
+
359
+ The context window is now exactly the input cap the gateway states (`max_input_tokens`): a 1M model reads 1M, not 1.34M. The host still compacts at 80% of that window — its own 0.8 ratio — so 80% on the meter is where compaction happens, and a request no longer gets refused while the meter still shows a third of the window free.
344
360
 
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.
361
+ That ratio only lands at 80% because the plugin now reports each request's completion reserve to the host as well: the gateway prices `messages + completion` against one window (655K of messages with a 393K reserve was refused), while the host, not knowing that reserve, priced the whole window as input. The reserve is now kept under 20% of the window (128K for a 1M window): the trigger is 80% of the window, 800K of messages, and the request released there is about 930K including the reserve — still inside the model's 1.05M combined limit. The old 393K reserve would have made the same trigger cost 1.19M, which could never be sent.
346
362
 
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.
363
+ A provider overflow such as "prompt is too long: N tokens > M maximum" is still 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.
348
364
 
349
365
  ### What changes in 0.7.0
350
366
 
@@ -1,4 +1,4 @@
1
- THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.7.1
1
+ THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.7.3
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.
@@ -2655,7 +2655,7 @@ window.__ModuleLoader__.load({
2655
2655
  //#region src/client/AccountCenter/announcement-styles.ts
2656
2656
  /** Presentation for the 消息 page, scoped to the account-center container like its siblings. */
2657
2657
  const ANNOUNCEMENT_STYLES = `
2658
- .vibedev-center .center-announcements{display:flex;flex-direction:column;gap:14px;max-width:960px}
2658
+ .vibedev-center .center-announcements{display:flex;flex-direction:column;gap:14px;width:100%;max-width:960px;margin-inline:auto}
2659
2659
  .vibedev-center .center-announcements-filters{display:flex;align-items:center;gap:8px}
2660
2660
  .vibedev-center .center-announcements-filter{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 10px;border:1px solid var(--center-border);border-radius:6px;background:transparent;color:var(--center-muted);font:inherit;cursor:pointer}
2661
2661
  .vibedev-center .center-announcements-filter:hover{border-color:var(--dsw-alias-border-l3,#d0d5dd);color:var(--dsw-alias-label-primary,#202124)}
@@ -3824,6 +3824,8 @@ window.__ModuleLoader__.load({
3824
3824
  timer;
3825
3825
  /** Dialogs shown in this launch, so one announcement cannot interrupt twice. */
3826
3826
  shown = /* @__PURE__ */ new Set();
3827
+ /** Whether this launch has already interrupted once; see {@link takeLaunchPopup}. */
3828
+ interrupted = false;
3827
3829
  pending;
3828
3830
  constructor(options = {}) {
3829
3831
  this.options = options;
@@ -3934,6 +3936,18 @@ window.__ModuleLoader__.load({
3934
3936
  return found;
3935
3937
  }
3936
3938
  /**
3939
+ * The one interruption this launch may make: the first unread `popup` message any read finds — at start-up, or on a
3940
+ * later poll when VibeDev published it while the app was open. After one has been handed out, nothing else
3941
+ * interrupts until the next launch, so closing one dialog never chains a second behind it.
3942
+ * @returns the message to show now, or undefined.
3943
+ */
3944
+ takeLaunchPopup() {
3945
+ if (this.interrupted) return void 0;
3946
+ const found = this.takePopup();
3947
+ if (found !== void 0) this.interrupted = true;
3948
+ return found;
3949
+ }
3950
+ /**
3937
3951
  * Remember that a person waved a dialog away, so it does not come back on the next launch.
3938
3952
  * @param id - the announcement whose dialog was dismissed.
3939
3953
  */
package/client/client.js CHANGED
@@ -3962,6 +3962,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
3962
3962
  timer;
3963
3963
  /** Dialogs shown in this launch, so one announcement cannot interrupt twice. */
3964
3964
  shown = /* @__PURE__ */ new Set();
3965
+ /** Whether this launch has already interrupted once; see {@link takeLaunchPopup}. */
3966
+ interrupted = false;
3965
3967
  pending;
3966
3968
  constructor(options = {}) {
3967
3969
  this.options = options;
@@ -4072,6 +4074,18 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4072
4074
  return found;
4073
4075
  }
4074
4076
  /**
4077
+ * The one interruption this launch may make: the first unread `popup` message any read finds — at start-up, or on a
4078
+ * later poll when VibeDev published it while the app was open. After one has been handed out, nothing else
4079
+ * interrupts until the next launch, so closing one dialog never chains a second behind it.
4080
+ * @returns the message to show now, or undefined.
4081
+ */
4082
+ takeLaunchPopup() {
4083
+ if (this.interrupted) return void 0;
4084
+ const found = this.takePopup();
4085
+ if (found !== void 0) this.interrupted = true;
4086
+ return found;
4087
+ }
4088
+ /**
4075
4089
  * Remember that a person waved a dialog away, so it does not come back on the next launch.
4076
4090
  * @param id - the announcement whose dialog was dismissed.
4077
4091
  */
@@ -4527,8 +4541,9 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4527
4541
  //#endregion
4528
4542
  //#region src/client/AnnouncementDialog.tsx
4529
4543
  /**
4530
- * The start-up announcement dialog: at most one `popup` message per launch, shown once the
4531
- * first read has landed (the store decides which; `silent` messages never interrupt).
4544
+ * The announcement dialog: at most one `popup` message per launch, shown on the first read that finds one — at
4545
+ * start-up, or on a later poll when the message was published while the app was open (the store decides which;
4546
+ * `silent` messages never interrupt).
4532
4547
  *
4533
4548
  * 知道了 sends the read receipt. 稍后 and 查看全部消息 close it and remember the id, so the
4534
4549
  * same message never interrupts again — neither marks it read, so the badge keeps its dot and
@@ -4622,13 +4637,15 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4622
4637
  useAnnouncementStyles();
4623
4638
  const snapshot = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
4624
4639
  const [item, setItem] = (0, react.useState)(void 0);
4625
- const took = (0, react.useRef)(false);
4626
4640
  (0, react.useEffect)(() => {
4627
- if (took.current || !snapshot.loaded) return;
4628
- took.current = true;
4629
- const next = store.takePopup();
4641
+ if (item !== void 0 || !snapshot.loaded) return;
4642
+ const next = store.takeLaunchPopup();
4630
4643
  if (next !== void 0) setItem(next);
4631
- }, [snapshot, store]);
4644
+ }, [
4645
+ snapshot,
4646
+ store,
4647
+ item
4648
+ ]);
4632
4649
  if (item === void 0) return null;
4633
4650
  return announcementModal({
4634
4651
  item,
@@ -37,7 +37,7 @@ export interface Announcement {
37
37
  readonly id: number;
38
38
  readonly title: string;
39
39
  readonly content: string;
40
- /** `popup` may interrupt at start-up once; `silent` only ever appears in the list. */
40
+ /** `popup` may interrupt once per launch; `silent` only ever appears in the list. */
41
41
  readonly notifyMode: 'popup' | 'silent';
42
42
  readonly startsAt?: string;
43
43
  readonly endsAt?: string;
package/lib/index.js CHANGED
@@ -5880,51 +5880,61 @@ const openAICompletionsApi = () => lazyApi(() => import("./openai-completions-Dq
5880
5880
  const openAIResponsesApi = () => lazyApi(() => import("./openai-responses-DygWnsye.js"));
5881
5881
  //#endregion
5882
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
5883
  /** The host compaction default reserve below the message budget (`headroomTokens`). */
5906
5884
  const HOST_HEADROOM_TOKENS = 65536;
5907
- /**
5908
- * The window to report to the host.
5885
+ /** A completion below this trades too much of the model's own output for compaction timing. */
5886
+ const MIN_COMPLETION_TOKENS = 32768;
5887
+ /** The trigger never falls below this share of the window, however tight the headroom gets. */
5888
+ const MIN_THRESHOLD_SHARE = .1;
5889
+ /** A derived completion is stated in whole blocks, so the reserve reads like a limit. */
5890
+ const COMPLETION_STEP = 4096;
5891
+ /**
5892
+ * The window to report to the host: the input the provider will actually take.
5909
5893
  *
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.
5894
+ * This is deliberately *not* sized to move the host's trigger; the trigger is moved by the
5895
+ * completion reserve instead, so the number on screen keeps meaning "input left".
5896
+ * @param budget - the catalog's capacity and input cap.
5915
5897
  * @param fallback - window for a catalog that states no capacity at all.
5916
5898
  * @returns a positive token count to declare as the model's context window.
5917
5899
  */
5918
5900
  function declaredContextWindow(budget, fallback) {
5919
5901
  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));
5902
+ const cap = budget.maxInputTokens;
5903
+ if (window === void 0) return Math.max(1, cap ?? fallback);
5904
+ if (cap === void 0) return Math.max(1, window);
5905
+ return Math.max(1, Math.min(window, cap));
5906
+ }
5907
+ /**
5908
+ * The completion to report and to request per call.
5909
+ *
5910
+ * An output the catalog already keeps under the reserve is left alone. A larger one is capped at
5911
+ * the reserve, so the host's ratio decides the trigger and `messages + completion` stays inside
5912
+ * the provider's combined limit. A window too small for the ratio keeps a workable floor and lets
5913
+ * the trigger fall earlier, and never reports a completion that would leave no pressure budget.
5914
+ * @param budget - the catalog's output and capacity.
5915
+ * @param contextWindow - the window declared by {@link declaredContextWindow}.
5916
+ * @returns the completion tokens one request may reserve.
5917
+ */
5918
+ function declaredCompletionTokens(budget, contextWindow) {
5919
+ const room = Math.floor(contextWindow * .19999999999999996) - HOST_HEADROOM_TOKENS;
5920
+ const safe = contextWindow - HOST_HEADROOM_TOKENS - Math.max(1, Math.floor(contextWindow * MIN_THRESHOLD_SHARE));
5921
+ const limit = Math.max(1, Math.min(Math.max(room, MIN_COMPLETION_TOKENS), safe));
5922
+ if (budget.maxTokens <= limit) return Math.max(1, budget.maxTokens);
5923
+ return Math.max(1, Math.floor(limit / COMPLETION_STEP) * COMPLETION_STEP);
5924
+ }
5925
+ /**
5926
+ * Both numbers an adapter model reports, kept together so the window and its reserve never
5927
+ * disagree.
5928
+ * @param budget - the catalog's capacity, input cap and output.
5929
+ * @param fallback - window for a catalog that states no capacity at all.
5930
+ * @returns the window and the completion to declare.
5931
+ */
5932
+ function declaredBudget(budget, fallback) {
5933
+ const contextWindow = declaredContextWindow(budget, fallback);
5934
+ return {
5935
+ contextWindow,
5936
+ maxTokens: declaredCompletionTokens(budget, contextWindow)
5937
+ };
5928
5938
  }
5929
5939
  //#endregion
5930
5940
  //#region src/llm/models.ts
@@ -6021,6 +6031,11 @@ function toPiModel(model, provider, origin) {
6021
6031
  const levels = model.reasoningLevels ?? [];
6022
6032
  const reasoning = levels.length > 0;
6023
6033
  const compat = compatOf(model);
6034
+ const budget = declaredBudget({
6035
+ contextWindow: model.contextWindow,
6036
+ ...model.maxInputTokens === void 0 ? {} : { maxInputTokens: model.maxInputTokens },
6037
+ maxTokens: model.maxTokens
6038
+ }, model.contextWindow);
6024
6039
  return {
6025
6040
  id: model.id,
6026
6041
  name: model.name,
@@ -6031,12 +6046,8 @@ function toPiModel(model, provider, origin) {
6031
6046
  ...reasoning ? { thinkingLevelMap: thinkingLevelMap(levels) } : {},
6032
6047
  input: [...model.input],
6033
6048
  cost: { ...model.cost },
6034
- contextWindow: declaredContextWindow({
6035
- contextWindow: model.contextWindow,
6036
- ...model.maxInputTokens === void 0 ? {} : { maxInputTokens: model.maxInputTokens },
6037
- maxTokens: model.maxTokens
6038
- }, model.contextWindow),
6039
- maxTokens: model.maxTokens,
6049
+ contextWindow: budget.contextWindow,
6050
+ maxTokens: budget.maxTokens,
6040
6051
  ...compat === void 0 ? {} : { compat }
6041
6052
  };
6042
6053
  }
@@ -6608,6 +6619,7 @@ var GatewayAdapter = class extends LlmAdapter {
6608
6619
  name: model.name,
6609
6620
  inputModalities: [...model.input],
6610
6621
  context: { contextWindow: model.contextWindow },
6622
+ defaultMaxTokens: model.maxTokens,
6611
6623
  ...reasoningInfo(model, catalog)
6612
6624
  };
6613
6625
  }
@@ -1,27 +1,34 @@
1
1
  /**
2
- * What a catalog model's returned `contextWindow` should be.
2
+ * The capacity and completion budget one catalog model reports to the host.
3
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.
4
+ * The host's `basic-compaction` reads two numbers from the adapter model and charges both to the
5
+ * same window: the window itself, and the completion the route reserves per request (the request
6
+ * header's `maxTokens`, else the adapter's `defaultMaxTokens`). It compacts at
7
+ * `min(thresholdRatio × window, window − completion − headroomTokens)`, defaulting to `0.8` and
8
+ * `65,536`. The gateway prices a request the same way: `messages + completion` against the
9
+ * provider's own combined limit.
9
10
  *
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.
11
+ * Two rules follow:
12
+ *
13
+ * - The window is the input the provider really takes (`max_input_tokens`), because the context
14
+ * meter divides pressure by it. Declaring more — the previous `input + completion` sizing that
15
+ * moved the ratio alone — made a request already at the real input budget read as two thirds of
16
+ * the way through, and pushed the host's trigger above the cap it was meant to respect.
17
+ * - The completion must fit under `window × (1 − thresholdRatio) − headroomTokens`, or the host
18
+ * subtracts it from the pressure budget and compacts early, while a request near the trigger
19
+ * overshoots the provider's combined limit by the completion it asked for.
20
+ *
21
+ * Both cannot always hold: a small window with the fixed 65,536 headroom cannot reach the ratio.
22
+ * There the completion wins a floor and the trigger lands lower, which is safe but earlier.
16
23
  *
17
24
  * @module dsh-vibedev/llm/context-budget
18
25
  */
19
- /** Share of the provider's input budget compaction should start around. */
20
- export declare const CONTEXT_COMPACT_TARGET = 0.88;
21
26
  /** The host compaction default this arithmetic is written against (`thresholdRatio`). */
22
27
  export declare const HOST_THRESHOLD_RATIO = 0.8;
23
28
  /** The host compaction default reserve below the message budget (`headroomTokens`). */
24
29
  export declare const HOST_HEADROOM_TOKENS = 65536;
30
+ /** A completion below this trades too much of the model's own output for compaction timing. */
31
+ export declare const MIN_COMPLETION_TOKENS = 32768;
25
32
  /** What the catalog says about one model's capacity. */
26
33
  export interface CatalogBudget {
27
34
  /** Catalog capacity, when it states one. */
@@ -31,15 +38,40 @@ export interface CatalogBudget {
31
38
  /** Output the catalog reserves per request. */
32
39
  readonly maxTokens: number;
33
40
  }
41
+ /** The two numbers one adapter model hands the host. */
42
+ export interface DeclaredBudget {
43
+ /** The window the context meter divides by and compaction starts from. */
44
+ readonly contextWindow: number;
45
+ /** The completion every request reserves inside that window. */
46
+ readonly maxTokens: number;
47
+ }
34
48
  /**
35
- * The window to report to the host.
49
+ * The window to report to the host: the input the provider will actually take.
36
50
  *
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.
51
+ * This is deliberately *not* sized to move the host's trigger; the trigger is moved by the
52
+ * completion reserve instead, so the number on screen keeps meaning "input left".
53
+ * @param budget - the catalog's capacity and input cap.
42
54
  * @param fallback - window for a catalog that states no capacity at all.
43
55
  * @returns a positive token count to declare as the model's context window.
44
56
  */
45
57
  export declare function declaredContextWindow(budget: CatalogBudget, fallback: number): number;
58
+ /**
59
+ * The completion to report and to request per call.
60
+ *
61
+ * An output the catalog already keeps under the reserve is left alone. A larger one is capped at
62
+ * the reserve, so the host's ratio decides the trigger and `messages + completion` stays inside
63
+ * the provider's combined limit. A window too small for the ratio keeps a workable floor and lets
64
+ * the trigger fall earlier, and never reports a completion that would leave no pressure budget.
65
+ * @param budget - the catalog's output and capacity.
66
+ * @param contextWindow - the window declared by {@link declaredContextWindow}.
67
+ * @returns the completion tokens one request may reserve.
68
+ */
69
+ export declare function declaredCompletionTokens(budget: CatalogBudget, contextWindow: number): number;
70
+ /**
71
+ * Both numbers an adapter model reports, kept together so the window and its reserve never
72
+ * disagree.
73
+ * @param budget - the catalog's capacity, input cap and output.
74
+ * @param fallback - window for a catalog that states no capacity at all.
75
+ * @returns the window and the completion to declare.
76
+ */
77
+ export declare function declaredBudget(budget: CatalogBudget, fallback: number): DeclaredBudget;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedev-si/dsh-vibedev",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
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",