dsh-grok-subscription 0.1.13 → 1.0.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/README.md +21 -5
- package/lib/client.js +2 -2
- package/lib/index.js +130 -27
- package/package.json +1 -1
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
|
|
28
|
+
# dsh plugin --profile web add dsh-grok-subscription@1.0.1
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
然后重启 `dsh web`,打开 **Settings → Grok 订阅**。也可以在设置页点击“CLI 登录”或“设备码登录”;设备码流程会在启动 DSH 的终端中显示提示。登录完成后点击“从 Grok CLI 拉取”可立即同步;Chat 模型列表会随之刷新。
|
|
@@ -46,15 +46,23 @@ npm test
|
|
|
46
46
|
npm run build
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
## v1.0.1
|
|
50
|
+
|
|
51
|
+
修复 grok-build 路由「发第二条消息没有回复」:`/v1/responses` 只在 `response.output_item.added` 与 `function_call_arguments.done` 上给函数名,参数增量事件不带 `name`,于是工具调用块带着 `name: undefined` 发给宿主。DSH 会拒绝任何无法无损 JSON 序列化的流片段,并以「Assistant stream chunk must be losslessly JSON-serializable」结束整轮,界面上完全没有回复——走 grok-build 的工具调用轮次都会这样,纯文本回复则正常。现:按 call id 记住工具名;采用 `arguments.done` / `response.completed` 的权威参数;从终止快照恢复只出现在 `completed` 里的调用;用量合计保持有限值、错误状态仅在其为数字时附带;出口再统一剔除 `undefined` / 非有限值兜底。附 8 个基于真实抓包帧的回归测试。
|
|
52
|
+
|
|
53
|
+
## v1.0.0
|
|
54
|
+
|
|
55
|
+
首个稳定版,已发布 npm:`dsh-grok-subscription@1.0.0`。内置模型选择器现可通过 `model.reasoning`(efforts + defaultEffort)展示 Grok Build 的 reasoning effort 子菜单(low/medium/high/xhigh),与 Codex 一致。修复 duck `listModels`/`resolveModel` 此前省略该元数据的问题。
|
|
56
|
+
|
|
49
57
|
## v0.1.13
|
|
50
58
|
|
|
51
|
-
Chat 输入区模型选择旁增加 Codex 风格的每周剩余额度徽章(如 `16%`);悬停/点击显示「每周额度 剩余 N% · 重置于 M/D HH:mm」。仅在当前会话 provider 为 `grok-build` 且用量 `ok` 时显示。Settings 中 Pull
|
|
59
|
+
Chat 输入区模型选择旁增加 Codex 风格的每周剩余额度徽章(如 `16%`);悬停/点击显示「每周额度 剩余 N% · 重置于 M/D HH:mm」。仅在当前会话 provider 为 `grok-build` 且用量 `ok` 时显示。Settings 中 Pull/登录成功后会派发刷新事件更新徽章。已发布 npm:`dsh-grok-subscription@0.1.13`。升级后请用新 token URL 硬刷新。
|
|
52
60
|
|
|
53
61
|
## v0.1.12
|
|
54
62
|
|
|
55
63
|
升级后请用 `dsh web` 新打印的带 token URL 打开,并硬刷新(Ctrl+Shift+R),避免旧 `/plugins` client 缓存。
|
|
56
64
|
|
|
57
|
-
修复 0.1.11 实机:Settings → Plugins 仍卡在「Reading plugins…」,Pull 等到客户端 45s 超时。根因是 `status` / `currentToken` 仍可能无超时地 `await credentials.resolve` 与裸 `import('@deepseek-ai/dsh-credentials')`,楔住连接桥后 Plugins 清单也跟着挂。现:`credentialRefOf` 用 timed `optionalImport`;resolve 硬超时(默认 1.5s);`status` 先内存 / auth.json,再可选 credentials;宿主 RPC 每端点 8s 硬超时;`llm/adapters-updated` 一律延后;`inject` 保持 `['llm','web']`;客户端缺 connection 软跳过,RPC 客户端超时降至 12s
|
|
65
|
+
修复 0.1.11 实机:Settings → Plugins 仍卡在「Reading plugins…」,Pull 等到客户端 45s 超时。根因是 `status` / `currentToken` 仍可能无超时地 `await credentials.resolve` 与裸 `import('@deepseek-ai/dsh-credentials')`,楔住连接桥后 Plugins 清单也跟着挂。现:`credentialRefOf` 用 timed `optionalImport`;resolve 硬超时(默认 1.5s);`status` 先内存 / auth.json,再可选 credentials;宿主 RPC 每端点 8s 硬超时;`llm/adapters-updated` 一律延后;`inject` 保持 `['llm','web']`;客户端缺 connection 软跳过,RPC 客户端超时降至 12s。已发布 npm:`dsh-grok-subscription@0.1.12`。
|
|
58
66
|
|
|
59
67
|
## v0.1.10
|
|
60
68
|
|
|
@@ -119,15 +127,23 @@ dsh plugin --profile web add BaronCyrus/dsh-grok-subscription
|
|
|
119
127
|
|
|
120
128
|
Reinstall after upgrades, restart `dsh web`, then open **Settings → Grok Subscription**.
|
|
121
129
|
|
|
130
|
+
### v1.0.1
|
|
131
|
+
|
|
132
|
+
Fixes "no reply after sending a second message" on the grok-build route: `/v1/responses` sends the function name only on `response.output_item.added` and `function_call_arguments.done`, never on the arguments delta, so tool-call chunks carried `name: undefined`. DSH rejects any stream chunk that is not losslessly JSON-serializable and ends the whole turn with "Assistant stream chunk must be losslessly JSON-serializable", leaving no reply in the UI; every tool-calling turn over grok-build failed this way while text-only replies looked fine. Now tool names are remembered by call id, arguments are adopted from `arguments.done` / `response.completed`, calls that appear only in the terminal snapshot are recovered, usage totals stay finite, an error status is attached only when numeric, and outgoing chunks are pruned of `undefined` / non-finite values. Adds 8 regression tests built from real captured frames.
|
|
133
|
+
|
|
134
|
+
### v1.0.0
|
|
135
|
+
|
|
136
|
+
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.
|
|
137
|
+
|
|
122
138
|
### v0.1.13
|
|
123
139
|
|
|
124
|
-
Chat 输入区模型选择旁增加 Codex 风格的每周剩余额度徽章(如 `16%`);悬停/点击显示「每周额度 剩余 N% · 重置于 M/D HH:mm」。仅在当前会话 provider 为 `grok-build` 且用量 `ok` 时显示。Settings 中 Pull
|
|
140
|
+
Chat 输入区模型选择旁增加 Codex 风格的每周剩余额度徽章(如 `16%`);悬停/点击显示「每周额度 剩余 N% · 重置于 M/D HH:mm」。仅在当前会话 provider 为 `grok-build` 且用量 `ok` 时显示。Settings 中 Pull/登录成功后会派发刷新事件更新徽章。已发布 npm:`dsh-grok-subscription@0.1.13`。升级后请用新 token URL 硬刷新。
|
|
125
141
|
|
|
126
142
|
## v0.1.12
|
|
127
143
|
|
|
128
144
|
After upgrading, open the fresh token URL from `dsh web` and hard-refresh (Ctrl+Shift+R) so the old immutable `/plugins` client is not reused.
|
|
129
145
|
|
|
130
|
-
修复 0.1.11 实机:Settings → Plugins 仍卡在「Reading plugins…」,Pull 等到客户端 45s 超时。根因是 `status` / `currentToken` 仍可能无超时地 `await credentials.resolve` 与裸 `import('@deepseek-ai/dsh-credentials')`,楔住连接桥后 Plugins 清单也跟着挂。现:`credentialRefOf` 用 timed `optionalImport`;resolve 硬超时(默认 1.5s);`status` 先内存 / auth.json,再可选 credentials;宿主 RPC 每端点 8s 硬超时;`llm/adapters-updated` 一律延后;`inject` 保持 `['llm','web']`;客户端缺 connection 软跳过,RPC 客户端超时降至 12s
|
|
146
|
+
修复 0.1.11 实机:Settings → Plugins 仍卡在「Reading plugins…」,Pull 等到客户端 45s 超时。根因是 `status` / `currentToken` 仍可能无超时地 `await credentials.resolve` 与裸 `import('@deepseek-ai/dsh-credentials')`,楔住连接桥后 Plugins 清单也跟着挂。现:`credentialRefOf` 用 timed `optionalImport`;resolve 硬超时(默认 1.5s);`status` 先内存 / auth.json,再可选 credentials;宿主 RPC 每端点 8s 硬超时;`llm/adapters-updated` 一律延后;`inject` 保持 `['llm','web']`;客户端缺 connection 软跳过,RPC 客户端超时降至 12s。已发布 npm:`dsh-grok-subscription@0.1.12`。
|
|
131
147
|
|
|
132
148
|
## v0.1.10
|
|
133
149
|
|
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
|
|
37
|
+
subtitle: "\u7528 SuperGrok / X Premium\uFF08Grok Build\uFF09\u4F1A\u8BDD\uFF0C\u800C\u4E0D\u662F XAI_API_KEY\u3002\xB7 1.0.1",
|
|
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
|
|
84
|
+
subtitle: "Use a SuperGrok / X Premium (Grok Build) session, not XAI_API_KEY. \xB7 1.0.1",
|
|
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
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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;
|
|
@@ -772,7 +788,31 @@ function mapFinish(reason) {
|
|
|
772
788
|
if (reason === "length" || reason === "max_tokens") return { kind: "max-tokens" };
|
|
773
789
|
return { kind: "stop" };
|
|
774
790
|
}
|
|
775
|
-
|
|
791
|
+
function finiteOr(value, fallback) {
|
|
792
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
793
|
+
}
|
|
794
|
+
function jsonSafeChunk(value) {
|
|
795
|
+
if (value === null) return null;
|
|
796
|
+
const type = typeof value;
|
|
797
|
+
if (type === "string" || type === "boolean") return value;
|
|
798
|
+
if (type === "number") return Number.isFinite(value) && !Object.is(value, -0) ? value : void 0;
|
|
799
|
+
if (type !== "object") return void 0;
|
|
800
|
+
if (Array.isArray(value)) {
|
|
801
|
+
const list = [];
|
|
802
|
+
for (const item of value) {
|
|
803
|
+
const safe = jsonSafeChunk(item);
|
|
804
|
+
if (safe !== void 0) list.push(safe);
|
|
805
|
+
}
|
|
806
|
+
return list;
|
|
807
|
+
}
|
|
808
|
+
const out = {};
|
|
809
|
+
for (const [key, item] of Object.entries(value)) {
|
|
810
|
+
const safe = jsonSafeChunk(item);
|
|
811
|
+
if (safe !== void 0) out[key] = safe;
|
|
812
|
+
}
|
|
813
|
+
return out;
|
|
814
|
+
}
|
|
815
|
+
async function* streamResponsesUnsafe(options, token) {
|
|
776
816
|
const headers = {
|
|
777
817
|
Accept: "text/event-stream",
|
|
778
818
|
"Content-Type": "application/json",
|
|
@@ -823,8 +863,24 @@ async function* streamResponses(options, token) {
|
|
|
823
863
|
let reasoningContent = "";
|
|
824
864
|
let nextIndex = 0;
|
|
825
865
|
const toolBlocks = /* @__PURE__ */ new Map();
|
|
866
|
+
const toolNames = /* @__PURE__ */ new Map();
|
|
826
867
|
let usage;
|
|
827
868
|
let finish = { kind: "stop" };
|
|
869
|
+
const toolIdOf = (payload) => {
|
|
870
|
+
const id = payload?.item_id ?? payload?.call_id ?? payload?.id;
|
|
871
|
+
return typeof id === "string" && id ? id : void 0;
|
|
872
|
+
};
|
|
873
|
+
const learnToolName = (id, name2) => {
|
|
874
|
+
if (typeof id !== "string" || !id || typeof name2 !== "string" || !name2) return;
|
|
875
|
+
toolNames.set(id, name2);
|
|
876
|
+
const tool = toolBlocks.get(id);
|
|
877
|
+
if (tool) tool.name = name2;
|
|
878
|
+
};
|
|
879
|
+
const adoptToolArguments = (id, value) => {
|
|
880
|
+
if (typeof id !== "string" || typeof value !== "string" || !value) return;
|
|
881
|
+
const tool = toolBlocks.get(id);
|
|
882
|
+
if (tool && value.length > tool.arguments.length) tool.arguments = value;
|
|
883
|
+
};
|
|
828
884
|
const flushSse = function* (raw) {
|
|
829
885
|
const lines = raw.split("\n");
|
|
830
886
|
let event = "message";
|
|
@@ -864,12 +920,33 @@ async function* streamResponses(options, token) {
|
|
|
864
920
|
yield { type: "reasoning-delta", index: reasoningIndex, text: String(delta) };
|
|
865
921
|
return;
|
|
866
922
|
}
|
|
923
|
+
if (type === "response.output_item.added" || type === "response.output_item.done") {
|
|
924
|
+
const item = payload.item;
|
|
925
|
+
if (item?.type === "function_call") {
|
|
926
|
+
learnToolName(item.id, item.name);
|
|
927
|
+
learnToolName(item.call_id, item.name);
|
|
928
|
+
adoptToolArguments(item.id, item.arguments);
|
|
929
|
+
}
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
if (type === "response.function_call_arguments.done") {
|
|
933
|
+
const id = toolIdOf(payload);
|
|
934
|
+
learnToolName(id, payload.name);
|
|
935
|
+
adoptToolArguments(id, payload.arguments);
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
867
938
|
if (type === "response.function_call_arguments.delta") {
|
|
868
|
-
const id = payload
|
|
939
|
+
const id = toolIdOf(payload);
|
|
869
940
|
if (!id) return;
|
|
870
941
|
let tool = toolBlocks.get(id);
|
|
871
942
|
if (!tool) {
|
|
872
|
-
tool = {
|
|
943
|
+
tool = {
|
|
944
|
+
index: nextIndex++,
|
|
945
|
+
id,
|
|
946
|
+
// Never leave this undefined: an unserializable chunk aborts the turn.
|
|
947
|
+
name: toolNames.get(id) ?? "tool",
|
|
948
|
+
arguments: ""
|
|
949
|
+
};
|
|
873
950
|
toolBlocks.set(id, tool);
|
|
874
951
|
yield { type: "block-start", index: tool.index, blockType: "tool-call" };
|
|
875
952
|
}
|
|
@@ -879,20 +956,38 @@ async function* streamResponses(options, token) {
|
|
|
879
956
|
return;
|
|
880
957
|
}
|
|
881
958
|
if (type === "response.completed") {
|
|
959
|
+
for (const item of payload.response?.output ?? []) {
|
|
960
|
+
if (item?.type !== "function_call") continue;
|
|
961
|
+
learnToolName(item.id, item.name);
|
|
962
|
+
learnToolName(item.call_id, item.name);
|
|
963
|
+
const id = typeof item.id === "string" && item.id ? item.id : void 0;
|
|
964
|
+
if (id && !toolBlocks.has(id)) {
|
|
965
|
+
const tool = { index: nextIndex++, id, name: toolNames.get(id) ?? "tool", arguments: "" };
|
|
966
|
+
toolBlocks.set(id, tool);
|
|
967
|
+
yield { type: "block-start", index: tool.index, blockType: "tool-call" };
|
|
968
|
+
}
|
|
969
|
+
adoptToolArguments(id, item.arguments);
|
|
970
|
+
}
|
|
882
971
|
const responseUsage = payload.response?.usage ?? payload.usage;
|
|
883
972
|
if (responseUsage) {
|
|
884
973
|
usage = {
|
|
885
|
-
inputTokens: responseUsage.input_tokens ?? responseUsage.prompt_tokens
|
|
886
|
-
outputTokens: responseUsage.output_tokens ?? responseUsage.completion_tokens
|
|
887
|
-
totalTokens: responseUsage.total_tokens
|
|
974
|
+
inputTokens: finiteOr(responseUsage.input_tokens ?? responseUsage.prompt_tokens, 0),
|
|
975
|
+
outputTokens: finiteOr(responseUsage.output_tokens ?? responseUsage.completion_tokens, 0)
|
|
888
976
|
};
|
|
977
|
+
usage.totalTokens = finiteOr(responseUsage.total_tokens, usage.inputTokens + usage.outputTokens);
|
|
889
978
|
}
|
|
890
979
|
finish = mapFinish(payload.response?.status === "incomplete" ? "length" : "stop");
|
|
891
980
|
if (toolBlocks.size) finish = { kind: "tool-calls" };
|
|
892
981
|
}
|
|
893
982
|
if (type === "response.failed" || type === "error") {
|
|
894
|
-
const
|
|
895
|
-
|
|
983
|
+
const raw2 = payload.error?.message ?? payload.message;
|
|
984
|
+
const failure = {
|
|
985
|
+
message: typeof raw2 === "string" && raw2 ? raw2 : "Grok Build stream failed",
|
|
986
|
+
code: "PROVIDER"
|
|
987
|
+
};
|
|
988
|
+
const status = finiteOr(payload.error?.status, void 0);
|
|
989
|
+
if (status !== void 0) failure.status = status;
|
|
990
|
+
finish = { kind: "error", failure };
|
|
896
991
|
}
|
|
897
992
|
};
|
|
898
993
|
for await (const chunk of response.body) {
|
|
@@ -921,6 +1016,12 @@ async function* streamResponses(options, token) {
|
|
|
921
1016
|
if (usage) yield { type: "usage", usage };
|
|
922
1017
|
yield { type: "finish", reason: finish };
|
|
923
1018
|
}
|
|
1019
|
+
async function* streamResponses(options, token) {
|
|
1020
|
+
for await (const chunk of streamResponsesUnsafe(options, token)) {
|
|
1021
|
+
const safe = jsonSafeChunk(chunk);
|
|
1022
|
+
if (safe) yield safe;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
924
1025
|
function visiblePiModels(session) {
|
|
925
1026
|
if (session.publicAccount()?.signedIn !== true) return [];
|
|
926
1027
|
return toPiModels(session.models()).map((model) => model.provider === PROVIDER_ID ? model : { ...model, provider: PROVIDER_ID });
|
|
@@ -942,13 +1043,18 @@ function createDuckAdapter(session) {
|
|
|
942
1043
|
},
|
|
943
1044
|
async resolveModel(provider, model) {
|
|
944
1045
|
const found = list().find((item) => item.id === model);
|
|
945
|
-
|
|
1046
|
+
const raw = session.publicAccount()?.signedIn === true ? session.models().find((item) => item.id === model) : void 0;
|
|
1047
|
+
const info = {
|
|
946
1048
|
provider,
|
|
947
1049
|
id: model,
|
|
948
1050
|
name: found?.name ?? model,
|
|
949
1051
|
inputModalities: ["text"],
|
|
950
|
-
context: { contextWindow: 5e5 }
|
|
1052
|
+
context: { contextWindow: raw?.contextWindow ?? 5e5 }
|
|
951
1053
|
};
|
|
1054
|
+
const reasoning = reasoningInfoOf(raw);
|
|
1055
|
+
if (reasoning) info.reasoning = reasoning;
|
|
1056
|
+
else if (found?.reasoning) info.reasoning = found.reasoning;
|
|
1057
|
+
return info;
|
|
952
1058
|
},
|
|
953
1059
|
async prepareCall(provider, model, signal) {
|
|
954
1060
|
const resolved = await this.resolveModel(provider, model, signal);
|
|
@@ -971,17 +1077,13 @@ function createDuckAdapter(session) {
|
|
|
971
1077
|
yield* streamResponses(options, token);
|
|
972
1078
|
} catch (error) {
|
|
973
1079
|
const aborted = options.signal?.aborted === true;
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
kind: aborted ? "aborted" : "error",
|
|
978
|
-
failure: {
|
|
979
|
-
message: error instanceof Error ? error.message : "Grok Build request failed",
|
|
980
|
-
code: aborted ? "ABORTED" : "PROVIDER",
|
|
981
|
-
status: error?.status
|
|
982
|
-
}
|
|
983
|
-
}
|
|
1080
|
+
const failure = {
|
|
1081
|
+
message: error instanceof Error ? error.message : "Grok Build request failed",
|
|
1082
|
+
code: aborted ? "ABORTED" : "PROVIDER"
|
|
984
1083
|
};
|
|
1084
|
+
const status = finiteOr(error?.status, void 0);
|
|
1085
|
+
if (status !== void 0) failure.status = status;
|
|
1086
|
+
yield { type: "finish", reason: { kind: aborted ? "aborted" : "error", failure } };
|
|
985
1087
|
}
|
|
986
1088
|
}
|
|
987
1089
|
};
|
|
@@ -1145,7 +1247,8 @@ async function createGrokBuildAdapter(session, options = {}) {
|
|
|
1145
1247
|
requestImagePixelBudget: REQUEST_IMAGE_PIXEL_BUDGET,
|
|
1146
1248
|
requestImageMaxBytes: REQUEST_IMAGE_MAX_BYTES,
|
|
1147
1249
|
cacheRetention: "short",
|
|
1148
|
-
transport: "sse"
|
|
1250
|
+
transport: "sse",
|
|
1251
|
+
reasoning: "high"
|
|
1149
1252
|
});
|
|
1150
1253
|
const LlmError = dshLlm?.LlmError;
|
|
1151
1254
|
const adapter = new dshPi.PiAiAdapter({
|