dsh-codearts 1.4.0 → 1.4.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/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
3
3
  本文件记录本插件的重要改动。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
4
4
  版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
5
5
 
6
+ ## [1.4.1] - 2026-11-14
7
+
8
+ ### 新增
9
+
10
+ - **模型列表里就地调上下文窗口**(#9):卡片「模型」页每行右端只多一枚按钮
11
+ (`1M 上下文 · 64K 输出` + 下拉箭头),点开才弹出浮层,里面是滑块 + 数字框 ——
12
+ 滑块和输入框常驻行内会把模型名挤掉,收进浮层后行宽不变。拖到档位或直接填 token
13
+ 数就写入 `contextWindowOverrides`,清空 / 填回上游标称值 = 跟随上游;点别处或按
14
+ Esc 收起,收起时若还有没提交的草稿会先提交。滑块刻度按人眼能分辨的档摆
15
+ (8K/16K/32K/64K/128K/192K/256K/384K/491520/512K/774K/1M/1.5M/2M),不按 token
16
+ 线性铺 —— 线性的话最该调的 40-50 万那一段只有几个像素。被覆盖的模型按钮会加粗
17
+ 描边,和「跟随上游」一眼能分开。
18
+ 后端配套 `POST /api/codearts/context-window`,目录新增 `contextWindowDiscovered`
19
+ 保留上游标称值,删覆盖时生效值就退回它。
20
+ - **按模型覆盖 `contextWindow`**(#9):设置 schema 新增 `contextWindowOverrides`
21
+ (模型 id → tokens,大小写不敏感),压过动态发现值。免费档真实窗口远小于目录标称、
22
+ 还会随服务端漂移,没有这个入口用户既纠正不了目录值,也没法在上游收紧时自救。
23
+ 例:`{ "deepseek-v4.1-flash-1017": 491520, "glm-5.3-flash": 774000 }`。
24
+ shim 每次请求实时读取,改完下一句话就生效,不用等下一轮模型发现。
25
+ - **按模型学习真实窗口上界**(#9):`max_tokens` 已降到 8192 地板仍被上游判
26
+ 「参数非法」时,把本次 prompt 估算记为该模型的上界(进程内、只收紧不放宽)。
27
+ 下一轮守卫直接在本地拦下并给出具体数字,不再每轮白撞上游。
28
+
29
+ ### 修复
30
+
31
+ - **到地板时不再报 max_tokens**(#9):以前的文案把用户引向重发 / 换号 / 降
32
+ max_tokens,而真因是 prompt 装不下。现在报「上下文放不下 —— 本次 prompt 估算约
33
+ N tokens,max_tokens 已降到 8192 仍被拒,请压缩上下文(/compact)或新建会话」。
34
+ 顺带修了单轮内永远走不到地板分支的问题(`heal < 3` 提前返回,只有第二轮才看得到
35
+ 这句):到地板后会多进一次循环,那一次不重发,只把真实原因说出来。
36
+ - **不带 `max_tokens` 的请求不再白撞三次上游**:降档对它没有任何意义,以前会把
37
+ 同一帧错误重试到次数上限才透传。
38
+
6
39
  ## [1.4.0] - 2026-11-13
7
40
 
8
41
  ### 新增
package/README.en.md CHANGED
@@ -134,8 +134,14 @@ other local processes cannot impersonate it.
134
134
  393216, while the chat endpoint rejects anything above 65536 with
135
135
  `InferHub.001001005.400`. Requests are clamped to the **measured** ceiling per model
136
136
  (65536 for the free DeepSeek family, 131072 for GLM-5.2, which was measured); models
137
- without a measurement fall back to the conservative 65536. Context length uses the
138
- discovered value, which only affects DSH’s context meter and truncation margin.
137
+ without a measurement fall back to the conservative 65536.
138
+ - **Context window** starts from the discovered value, but the free tier’s real window can be
139
+ far smaller than advertised and it drifts (issue #9). When long sessions always fail, correct
140
+ it per model with `contextWindowOverrides`, e.g.
141
+ `{ "deepseek-v4.1-flash-1017": 491520, "glm-5.3-flash": 774000 }`. Separately, when
142
+ `max_tokens` is already at the 8192 floor and upstream still rejects the request, the plugin
143
+ records this request’s prompt estimate as that model’s upper bound (in-process, tighten-only),
144
+ so the next round is blocked locally with a `/compact` or new-session hint.
139
145
  - The usage ledger counts only requests **this machine sent through the plugin**, so its
140
146
  numbers are not an account total; the card links to the official page. The ledger keeps
141
147
  60 days and is lost when you move machines or clear `$DSH_HOME`.
package/README.md CHANGED
@@ -99,8 +99,12 @@ shim 只监听回环地址,并校验 Host、Origin 与本进程随机密钥,
99
99
  - 某个模型没出现时,用 `dsh-codearts models` 看上游到底返回了什么;上游标称的参数不一定可用:
100
100
  福利网关把 `max_tokens` 标成 393216,而聊天端点实测超过 65536 就报
101
101
  `InferHub.001001005.400`。插件按**实测上限**下发请求(免费 DeepSeek 系列 65536、
102
- GLM-5.2 已实测可到 131072),没实测过的模型退回 65536 保守值。上下文长度用发现值,
103
- 它只影响 DSH 的上下文计量与截断余量。
102
+ GLM-5.2 已实测可到 131072),没实测过的模型退回 65536 保守值。
103
+ - **上下文窗口**以发现值为准,但免费档的真实窗口可能远小于标称、还会漂(issue #9)。
104
+ 遇到「超长会话必然失败」时,用 `contextWindowOverrides` 按模型纠正,例:
105
+ `{ "deepseek-v4.1-flash-1017": 491520, "glm-5.3-flash": 774000 }`。此外,当
106
+ `max_tokens` 已降到 8192 地板仍被判参数非法时,插件会把本次 prompt 估算记为该模型的
107
+ 上界(进程内、只收紧不放宽),下一轮直接在本地拦下并提示 `/compact` 或新建会话。
104
108
  - 用量账本只统计**本机经插件发出**的请求,不等于账号总额度;额度/积分以卡片上的账号余额为准,
105
109
  官方明细走卡片里的链接。账本按天保留 60 天,换机器/清 `$DSH_HOME` 即丢失。
106
110
  - 文档:README 与 INSTALL 有英文版([README.en.md](./README.en.md) / [INSTALL.en.md](./INSTALL.en.md)),
@@ -428,7 +428,7 @@ async function clearCredential(path) {
428
428
  async function claimIfPossible(cred) {
429
429
  if (!cred.accessKeyId || !cred.secretAccessKey) return;
430
430
  try {
431
- const { claimBenefit } = await import("./upstream-CVtspzAv.mjs").then((n) => n.D);
431
+ const { claimBenefit } = await import("./upstream-D1wYeXC7.mjs").then((n) => n.j);
432
432
  await claimBenefit({
433
433
  token: cred.token,
434
434
  accessKeyId: cred.accessKeyId,
package/lib/bin.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { i as codeartsAccountsPath, t as CodeArtsAccountStore } from "./auth-Ch0vYSAo.mjs";
3
- import { F as isBenefitModel, s as fetchCallerIdentity } from "./upstream-CVtspzAv.mjs";
4
- import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-BjBwEMks.mjs";
2
+ import { i as codeartsAccountsPath, t as CodeArtsAccountStore } from "./auth-C00dJphV.mjs";
3
+ import { l as fetchCallerIdentity, z as isBenefitModel } from "./upstream-D1wYeXC7.mjs";
4
+ import { i as discoverModels, n as CodeArtsUsageTracker, r as codeartsUsagePath, t as CODEARTS_VERSION } from "./version-DC5JRWls.mjs";
5
5
  import { existsSync, statSync } from "node:fs";
6
6
  //#region src/bin.ts
7
7
  /**
@@ -99,6 +99,12 @@ interface CodeArtsSettingsKey {
99
99
  /** 行内的上下文窗口 / 最大输出(`1M · 64K`)。 */
100
100
  modelSpec: string;
101
101
  modelSpecTitle: string;
102
+ /** 模型行里的窗口按钮与弹层(issue #9)。 */
103
+ modelWindowLabel: string;
104
+ modelWindowTitle: string;
105
+ modelWindowHeading: string;
106
+ modelWindowFollow: string;
107
+ modelWindowHint: string;
102
108
  /** 账号暂停/置顶。 */
103
109
  accountPaused: string;
104
110
  accountPinned: string;