dsh-grok-subscription 1.0.7 → 1.0.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.en.md +2 -2
- package/README.md +2 -2
- package/lib/client.js +2 -2
- package/lib/index.js +26 -4
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -25,7 +25,7 @@ Models, reasoning effort, and weekly quota all stay inside DSH.
|
|
|
25
25
|
|
|
26
26
|
## Three-step start
|
|
27
27
|
|
|
28
|
-
1. **Install the plugin.** Run the command below; to select a candidate version, enter the full `package@version`, for example `dsh-grok-subscription@1.0.
|
|
28
|
+
1. **Install the plugin.** Run the command below; to select a candidate version, enter the full `package@version`, for example `dsh-grok-subscription@1.0.9`.
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
dsh plugin --profile web add BaronCyrus/dsh-grok-subscription
|
|
@@ -91,7 +91,7 @@ dsh plugin --profile web add BaronCyrus/dsh-grok-subscription
|
|
|
91
91
|
You can also install the version published on npm:
|
|
92
92
|
|
|
93
93
|
```sh
|
|
94
|
-
dsh plugin --profile web add dsh-grok-subscription@1.0.
|
|
94
|
+
dsh plugin --profile web add dsh-grok-subscription@1.0.9
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
DSH handles target selection, the profile lock, dependency resolution, and bundle activation.
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
## 三步开始
|
|
27
27
|
|
|
28
|
-
1. **安装插件**:在终端运行下面的命令;指定候选版本时填写完整的 `包名@版本`,例如 `dsh-grok-subscription@1.0.
|
|
28
|
+
1. **安装插件**:在终端运行下面的命令;指定候选版本时填写完整的 `包名@版本`,例如 `dsh-grok-subscription@1.0.9`。
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
dsh plugin --profile web add BaronCyrus/dsh-grok-subscription
|
|
@@ -91,7 +91,7 @@ dsh plugin --profile web add BaronCyrus/dsh-grok-subscription
|
|
|
91
91
|
也可以按 npm 上的已发布版本安装:
|
|
92
92
|
|
|
93
93
|
```sh
|
|
94
|
-
dsh plugin --profile web add dsh-grok-subscription@1.0.
|
|
94
|
+
dsh plugin --profile web add dsh-grok-subscription@1.0.9
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
目标选择、profile 锁、依赖解析和 bundle 激活均由 DSH 负责。
|
package/lib/client.js
CHANGED
|
@@ -38,7 +38,7 @@ var import_react2 = require("react");
|
|
|
38
38
|
var zh = {
|
|
39
39
|
nav: "Grok \u8BA2\u9605",
|
|
40
40
|
title: "Grok \u8BA2\u9605",
|
|
41
|
-
subtitle: "\u7528 SuperGrok / X Premium\uFF08Grok Build\uFF09\u4F1A\u8BDD\uFF0C\u800C\u4E0D\u662F XAI_API_KEY\u3002\xB7 1.0.
|
|
41
|
+
subtitle: "\u7528 SuperGrok / X Premium\uFF08Grok Build\uFF09\u4F1A\u8BDD\uFF0C\u800C\u4E0D\u662F XAI_API_KEY\u3002\xB7 1.0.9",
|
|
42
42
|
signedIn: "\u5DF2\u767B\u5F55",
|
|
43
43
|
signedOut: "\u672A\u767B\u5F55",
|
|
44
44
|
account: "\u8D26\u6237",
|
|
@@ -95,7 +95,7 @@ var zh = {
|
|
|
95
95
|
var en = {
|
|
96
96
|
nav: "Grok Subscription",
|
|
97
97
|
title: "Grok Subscription",
|
|
98
|
-
subtitle: "Use a SuperGrok / X Premium (Grok Build) session, not XAI_API_KEY. \xB7 1.0.
|
|
98
|
+
subtitle: "Use a SuperGrok / X Premium (Grok Build) session, not XAI_API_KEY. \xB7 1.0.9",
|
|
99
99
|
signedIn: "Signed in",
|
|
100
100
|
signedOut: "Signed out",
|
|
101
101
|
account: "Account",
|
package/lib/index.js
CHANGED
|
@@ -1166,11 +1166,31 @@ async function* streamResponsesUnsafe(options, token) {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
const responseUsage = payload.response?.usage ?? payload.usage;
|
|
1168
1168
|
if (responseUsage) {
|
|
1169
|
+
const details = responseUsage.input_tokens_details ?? responseUsage.prompt_tokens_details ?? {};
|
|
1170
|
+
const cachedTokens = finiteOr(details.cached_tokens, 0);
|
|
1171
|
+
const cacheWriteTokens = finiteOr(details.cache_write_tokens, 0);
|
|
1172
|
+
const promptTotal = finiteOr(
|
|
1173
|
+
responseUsage.input_tokens ?? responseUsage.prompt_tokens,
|
|
1174
|
+
0
|
|
1175
|
+
);
|
|
1176
|
+
const outputTokens = finiteOr(
|
|
1177
|
+
responseUsage.output_tokens ?? responseUsage.completion_tokens,
|
|
1178
|
+
0
|
|
1179
|
+
);
|
|
1169
1180
|
usage = {
|
|
1170
|
-
|
|
1171
|
-
|
|
1181
|
+
// The provider folds cache hits into the prompt count, while DSH's
|
|
1182
|
+
// fields are disjoint: billed input = inputTokens + cacheRead +
|
|
1183
|
+
// cacheWrite. Subtracting is what makes the host's "cache hit" figure
|
|
1184
|
+
// real instead of a permanent 0%. Both cache fields stay numeric so
|
|
1185
|
+
// consumers can always add them up.
|
|
1186
|
+
inputTokens: Math.max(0, promptTotal - cachedTokens - cacheWriteTokens),
|
|
1187
|
+
outputTokens,
|
|
1188
|
+
cacheReadTokens: cachedTokens,
|
|
1189
|
+
cacheWriteTokens
|
|
1172
1190
|
};
|
|
1173
|
-
|
|
1191
|
+
const reasoningTokens = finiteOr(responseUsage.output_tokens_details?.reasoning_tokens, void 0);
|
|
1192
|
+
if (reasoningTokens !== void 0) usage.reasoningTokens = reasoningTokens;
|
|
1193
|
+
usage.totalTokens = finiteOr(responseUsage.total_tokens, promptTotal + outputTokens);
|
|
1174
1194
|
}
|
|
1175
1195
|
finish = mapFinish(payload.response?.status === "incomplete" ? "length" : "stop");
|
|
1176
1196
|
if (toolBlocks.size) finish = { kind: "tool-calls" };
|
|
@@ -1244,7 +1264,9 @@ function createDuckAdapter(session, adapterOptions = {}) {
|
|
|
1244
1264
|
provider,
|
|
1245
1265
|
id: model,
|
|
1246
1266
|
name: found?.name ?? model,
|
|
1247
|
-
|
|
1267
|
+
// The host gates prompt attachment admission on resolveModelInfo, NOT on
|
|
1268
|
+
// listModels, so this must match the catalog's modality map exactly.
|
|
1269
|
+
inputModalities: supportsImageInput(model) ? ["text", "image"] : ["text"],
|
|
1248
1270
|
context: { contextWindow: raw?.contextWindow ?? 5e5 }
|
|
1249
1271
|
};
|
|
1250
1272
|
const reasoning = reasoningInfoOf(raw);
|