dsh-grok-subscription 0.1.13 → 1.0.0

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
@@ -25,7 +25,7 @@ dsh plugin --profile web add BaronCyrus/dsh-grok-subscription
25
25
  # 或本地路径
26
26
  # dsh plugin --profile web add /absolute/path/to/dsh-grok-subscription
27
27
  # 或 npm(发布后)
28
- # dsh plugin --profile web add dsh-grok-subscription@0.1.13
28
+ # dsh plugin --profile web add dsh-grok-subscription@1.0.0
29
29
  ```
30
30
 
31
31
  然后重启 `dsh web`,打开 **Settings → Grok 订阅**。也可以在设置页点击“CLI 登录”或“设备码登录”;设备码流程会在启动 DSH 的终端中显示提示。登录完成后点击“从 Grok CLI 拉取”可立即同步;Chat 模型列表会随之刷新。
@@ -46,6 +46,10 @@ npm test
46
46
  npm run build
47
47
  ```
48
48
 
49
+ ## v1.0.0
50
+
51
+ 首个稳定版,已发布 npm:`dsh-grok-subscription@1.0.0`。内置模型选择器现可通过 `model.reasoning`(efforts + defaultEffort)展示 Grok Build 的 reasoning effort 子菜单(low/medium/high/xhigh),与 Codex 一致。修复 duck `listModels`/`resolveModel` 此前省略该元数据的问题。
52
+
49
53
  ## v0.1.13
50
54
 
51
55
  Chat 输入区模型选择旁增加 Codex 风格的每周剩余额度徽章(如 `16%`);悬停/点击显示「每周额度 剩余 N% · 重置于 M/D HH:mm」。仅在当前会话 provider 为 `grok-build` 且用量 `ok` 时显示。Settings 中 Pull/登录成功后会派发刷新事件更新徽章。本地 0.1.13 供复测,**未发 npm**。升级后请用新 token URL 硬刷新。
@@ -119,6 +123,10 @@ dsh plugin --profile web add BaronCyrus/dsh-grok-subscription
119
123
 
120
124
  Reinstall after upgrades, restart `dsh web`, then open **Settings → Grok Subscription**.
121
125
 
126
+ ### v1.0.0
127
+
128
+ First stable release, published to npm as `dsh-grok-subscription@1.0.0`. Stock model picker now shows Grok Build reasoning effort (low/medium/high/xhigh) via `model.reasoning` metadata (`efforts` + `defaultEffort`), matching Codex. Fixes duck `listModels`/`resolveModel` omitting that shape.
129
+
122
130
  ### v0.1.13
123
131
 
124
132
  Chat 输入区模型选择旁增加 Codex 风格的每周剩余额度徽章(如 `16%`);悬停/点击显示「每周额度 剩余 N% · 重置于 M/D HH:mm」。仅在当前会话 provider 为 `grok-build` 且用量 `ok` 时显示。Settings 中 Pull/登录成功后会派发刷新事件更新徽章。本地 0.1.13 供复测,**未发 npm**。升级后请用新 token URL 硬刷新。
package/lib/client.js CHANGED
@@ -34,7 +34,7 @@ var import_react2 = require("react");
34
34
  var zh = {
35
35
  nav: "Grok \u8BA2\u9605",
36
36
  title: "Grok \u8BA2\u9605",
37
- subtitle: "\u7528 SuperGrok / X Premium\uFF08Grok Build\uFF09\u4F1A\u8BDD\uFF0C\u800C\u4E0D\u662F XAI_API_KEY\u3002\xB7 0.1.13",
37
+ subtitle: "\u7528 SuperGrok / X Premium\uFF08Grok Build\uFF09\u4F1A\u8BDD\uFF0C\u800C\u4E0D\u662F XAI_API_KEY\u3002\xB7 1.0.0",
38
38
  signedIn: "\u5DF2\u767B\u5F55",
39
39
  signedOut: "\u672A\u767B\u5F55",
40
40
  account: "\u8D26\u6237",
@@ -81,7 +81,7 @@ var zh = {
81
81
  var en = {
82
82
  nav: "Grok Subscription",
83
83
  title: "Grok Subscription",
84
- subtitle: "Use a SuperGrok / X Premium (Grok Build) session, not XAI_API_KEY. \xB7 0.1.13",
84
+ subtitle: "Use a SuperGrok / X Premium (Grok Build) session, not XAI_API_KEY. \xB7 1.0.0",
85
85
  signedIn: "Signed in",
86
86
  signedOut: "Signed out",
87
87
  account: "Account",
package/lib/index.js CHANGED
@@ -325,6 +325,7 @@ function fallbackModels() {
325
325
  maxTokens: 5e5,
326
326
  reasoning: true,
327
327
  reasoningEfforts: id === "grok-4.5" ? ["low", "medium", "high"] : ["low", "medium", "high", "xhigh"],
328
+ defaultEffort: "high",
328
329
  source: "fallback"
329
330
  }));
330
331
  }
@@ -362,13 +363,28 @@ function toPiModels(models) {
362
363
  };
363
364
  });
364
365
  }
366
+ function reasoningInfoOf(model) {
367
+ if (model?.reasoning === false) return void 0;
368
+ const efforts = Array.isArray(model?.reasoningEfforts) && model.reasoningEfforts.length ? model.reasoningEfforts : ["low", "medium", "high", "xhigh"];
369
+ const title = (id) => `${id.charAt(0).toUpperCase()}${id.slice(1)}`;
370
+ const preferred = model?.defaultEffort && efforts.includes(model.defaultEffort) ? model.defaultEffort : efforts.includes("high") ? "high" : efforts[efforts.length - 1];
371
+ return {
372
+ efforts: efforts.map((id) => ({ id, name: title(id) })),
373
+ defaultEffort: preferred
374
+ };
375
+ }
365
376
  function toLlmModels(models) {
366
- return models.map((model) => ({
367
- provider: PROVIDER_ID,
368
- id: model.id,
369
- name: model.name,
370
- inputModalities: ["text"]
371
- }));
377
+ return models.map((model) => {
378
+ const info = {
379
+ provider: PROVIDER_ID,
380
+ id: model.id,
381
+ name: model.name,
382
+ inputModalities: ["text"]
383
+ };
384
+ const reasoning = reasoningInfoOf(model);
385
+ if (reasoning) info.reasoning = reasoning;
386
+ return info;
387
+ });
372
388
  }
373
389
  async function fetchLiveCatalog(accessToken, options = {}) {
374
390
  const fetchImpl = options.fetch ?? globalThis.fetch;
@@ -942,13 +958,18 @@ function createDuckAdapter(session) {
942
958
  },
943
959
  async resolveModel(provider, model) {
944
960
  const found = list().find((item) => item.id === model);
945
- return {
961
+ const raw = session.publicAccount()?.signedIn === true ? session.models().find((item) => item.id === model) : void 0;
962
+ const info = {
946
963
  provider,
947
964
  id: model,
948
965
  name: found?.name ?? model,
949
966
  inputModalities: ["text"],
950
- context: { contextWindow: 5e5 }
967
+ context: { contextWindow: raw?.contextWindow ?? 5e5 }
951
968
  };
969
+ const reasoning = reasoningInfoOf(raw);
970
+ if (reasoning) info.reasoning = reasoning;
971
+ else if (found?.reasoning) info.reasoning = found.reasoning;
972
+ return info;
952
973
  },
953
974
  async prepareCall(provider, model, signal) {
954
975
  const resolved = await this.resolveModel(provider, model, signal);
@@ -1145,7 +1166,8 @@ async function createGrokBuildAdapter(session, options = {}) {
1145
1166
  requestImagePixelBudget: REQUEST_IMAGE_PIXEL_BUDGET,
1146
1167
  requestImageMaxBytes: REQUEST_IMAGE_MAX_BYTES,
1147
1168
  cacheRetention: "short",
1148
- transport: "sse"
1169
+ transport: "sse",
1170
+ reasoning: "high"
1149
1171
  });
1150
1172
  const LlmError = dshLlm?.LlmError;
1151
1173
  const adapter = new dshPi.PiAiAdapter({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-grok-subscription",
3
- "version": "0.1.13",
3
+ "version": "1.0.0",
4
4
  "description": "Use a SuperGrok or X Premium Grok Build subscription in DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",