dsh-grok-provider 0.1.7 → 0.1.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/CHANGELOG.md +15 -1
- package/README.en.md +21 -17
- package/README.md +21 -17
- package/SECURITY.md +7 -5
- package/dist/client/client.js +99 -3
- package/dist/host/index.mjs +11 -2
- package/dist/internal/grok-adapter.mjs +10 -14
- package/dist/internal/llm-error.mjs +9 -1
- package/dist/internal/model-catalog.mjs +4 -0
- package/dist/internal/responses-call.mjs +60 -0
- package/dist/internal/responses-codec.mjs +684 -30
- package/dist/internal/responses-request-compiler.mjs +159 -4
- package/dist/internal/responses-request.mjs +39 -2
- package/docs/01-product-requirements.md +8 -5
- package/docs/03-security-threat-model.md +13 -2
- package/docs/05-test-plan.md +6 -3
- package/docs/06-release-plan.md +5 -5
- package/docs/09-implementation-status.md +29 -10
- package/docs/10-release-checklist.md +24 -3
- package/docs/11-capability-roadmap.md +15 -12
- package/docs/12-upstream-image-input-evidence.md +1 -1
- package/docs/13-upstream-search-evidence.md +91 -0
- package/docs/README.md +12 -7
- package/docs/adr/0010-default-off-web-x-search.md +101 -0
- package/docs/releases/v0.1.7.md +2 -2
- package/docs/releases/v0.1.8.md +22 -0
- package/docs/releases/v0.1.9.md +76 -0
- package/package.json +2 -2
- package/types/index.d.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.9 - 2026-08-30
|
|
4
|
+
|
|
5
|
+
- Add independent, default-off Web Search and X Search Provider settings for exact `grok-4.6`; keep every other dynamically discovered model Search-disabled until the same fixed-Proxy evidence exists.
|
|
6
|
+
- Compile Harness function tools followed by `web_search` and `x_search` under one 128-tool and 16 MiB request budget, while preserving the byte-identical `0.1.7` request path when both settings are off and disabling Search for non-interactive `purpose` calls.
|
|
7
|
+
- Bind each final request to a private response receipt so undeclared function names, disabled server tools, unknown events, malformed citations, and incomplete or out-of-order Search lifecycles fail closed before they can be projected into Harness.
|
|
8
|
+
- Decode the fixed Proxy's standard Web Search lifecycle and its Grok-Build-specific four-name X Search `custom_tool_call` lifecycle as server-executed activity that emits no Harness tool-call chunks; observing either category suppresses encrypted reasoning replay for that response.
|
|
9
|
+
- Preserve inline citation Markdown as assistant text while bounding and discarding structured citation metadata; never follow, preview, or download citation URLs.
|
|
10
|
+
- Add bilingual Search risk disclosures to the existing Grok Build settings page through Harness `settingsScope`, without a second configuration RPC, renderer-local persistence, a production dependency, a new endpoint, or a new authentication mode.
|
|
11
|
+
|
|
12
|
+
## 0.1.8 - 2026-08-30 (withdrawn)
|
|
13
|
+
|
|
14
|
+
- Briefly published a Grok-only sidebar quota card that moved the sidebar's Grok quota querying and display ownership into the Provider, then withdrew the release by reverting that change.
|
|
15
|
+
- The npm Registry version `dsh-grok-provider@0.1.8` remains permanently reserved and cannot be reused after unpublish; `latest` remains `0.1.7`, and the independent Search slice moves to `0.1.9`.
|
|
16
|
+
|
|
3
17
|
## 0.1.7 - 2026-08-29
|
|
4
18
|
|
|
5
19
|
- Add a separate Host diagnostics RPC that reports the installed package version and a closed Grok Build CLI state/version without exposing executable paths, stderr, environment, proxy data, or OAuth URLs.
|
|
@@ -8,7 +22,7 @@
|
|
|
8
22
|
- Keep runtime diagnostics single-flight and lifecycle-owned: capability teardown cancels and awaits inspection, cleanup failure latches the CLI instance and aborts its in-flight authentication actions, and serial authentication polling uses a request epoch to reject stale responses after user actions, settlement, or unmount.
|
|
9
23
|
- Document the Windows pre-browser OIDC failure boundary and keep runtime diagnostics outside the authentication status polling path; the official CLI still owns sign-in URL generation and external-browser launch, so this release does not claim to repair Windows network/proxy conditions or to have verified network-reachable browser launch on a real Windows device.
|
|
10
24
|
- Render the MIT-licensed `IconThinkOutline16` path geometry from `@deepseek-ai/dsh-client-ui-primitives@0.1.0-rc.7` for the one exact Grok Build settings navigation match through a scoped, lifecycle-owned compatibility layer; ambiguous labels or unexpected DOM structure retain the Host gear, unload removes every injected resource, and the bundled third-party notice preserves attribution.
|
|
11
|
-
- Keep Web/X Search, image generation, new server-tool events, arbitrary URL downloads, API-key mode, and custom endpoints out of this maintenance release; the independent Search slice moves to `0.1.8
|
|
25
|
+
- Keep Web/X Search, image generation, new server-tool events, arbitrary URL downloads, API-key mode, and custom endpoints out of this maintenance release; the independent Search slice moves to `0.1.9` because the sidebar-quota `0.1.8` release was withdrawn and its Registry version cannot be reused.
|
|
12
26
|
|
|
13
27
|
## 0.1.6 - 2026-08-28
|
|
14
28
|
|
package/README.en.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.md) | [English](README.en.md)
|
|
4
4
|
|
|
5
|
-
Use an already authenticated official Grok Build account from DeepSeek Harness, with dynamic model discovery, streaming reasoning, tool calls, and an account quota/model capability dashboard.
|
|
5
|
+
Use an already authenticated official Grok Build account from DeepSeek Harness, with dynamic model discovery, streaming reasoning, image input, optional Web/X Search, tool calls, and an account quota/model capability dashboard.
|
|
6
6
|
|
|
7
|
-
> Unofficial community project; not affiliated with xAI or DeepSeek Harness. The current source candidate is `0.1.
|
|
7
|
+
> Unofficial community project; not affiliated with xAI or DeepSeek Harness. The current source candidate is `0.1.9`. Version `0.1.8` was published and then withdrawn, and npm version numbers cannot be reused; npm Registry `latest` and the current installable stable baseline remain `0.1.7`. The project no longer publishes prereleases; stable defects are fixed in a new incremented stable version.
|
|
8
8
|
|
|
9
9
|
## What it provides
|
|
10
10
|
|
|
@@ -15,6 +15,7 @@ Use an already authenticated official Grok Build account from DeepSeek Harness,
|
|
|
15
15
|
| Models | Discovers every model visible to the account at runtime; no static model allowlist |
|
|
16
16
|
| Conversations | Streaming Responses text, reasoning, encrypted reasoning replay, usage, and finish reasons |
|
|
17
17
|
| Images | Only exact `grok-4.6` accepts bounded JPEG/PNG images from Harness attachments; `grok-4.5` and all other models remain text-only |
|
|
18
|
+
| Search | The `0.1.9` candidate provides independent, default-off Web Search and X Search for exact `grok-4.6`; remote lifecycles are never misrepresented as local tools |
|
|
18
19
|
| Tools | Returns function calls to the Harness permission layer; the provider never executes tools |
|
|
19
20
|
| Account dashboard | Login status, weekly/monthly quota, reset time, dynamic model capabilities and reasoning efforts |
|
|
20
21
|
| Surfaces | Bilingual Web settings and a closed `/grok` TUI command set |
|
|
@@ -35,14 +36,14 @@ grok --version
|
|
|
35
36
|
grok models
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
When the network is reachable and OIDC discovery succeeds, the official CLI opens a browser on first use. The provider supports only the official default `~/.grok` directory (`%USERPROFILE%\.grok` on Windows).
|
|
39
40
|
|
|
40
41
|
### 2. Install the provider
|
|
41
42
|
|
|
42
|
-
After `0.1.
|
|
43
|
+
After `0.1.9` is published, install that exact version from npm:
|
|
43
44
|
|
|
44
45
|
```sh
|
|
45
|
-
dsh plugin --profile web add dsh-grok-provider@0.1.
|
|
46
|
+
dsh plugin --profile web add dsh-grok-provider@0.1.9
|
|
46
47
|
dsh web
|
|
47
48
|
```
|
|
48
49
|
|
|
@@ -65,6 +66,7 @@ The Web settings page shows:
|
|
|
65
66
|
- the official installation link and “Check again” recovery when the CLI is missing or invalid;
|
|
66
67
|
- used/remaining quota and the real billing-period reset time;
|
|
67
68
|
- account-visible models, context windows, reasoning efforts, and image-input, streaming, and tool capabilities.
|
|
69
|
+
- independent, default-off Web Search and X Search settings with nearby remote-query, additional-usage, citation, and prompt-injection disclosures.
|
|
68
70
|
|
|
69
71
|
When protobuf-backed billing includes a complete weekly/monthly period but omits a zero-valued percentage, the page restores “0% used / 100% remaining.” Other incomplete responses remain unknown.
|
|
70
72
|
|
|
@@ -128,8 +130,8 @@ Uninstalling the provider does not remove the official Grok CLI or directly modi
|
|
|
128
130
|
|
|
129
131
|
## Sources and discovery
|
|
130
132
|
|
|
131
|
-
- Current npm stable release: [dsh-grok-provider@0.1.
|
|
132
|
-
- Most recent GitHub release and integrity values: [v0.1.
|
|
133
|
+
- Current npm stable release: [dsh-grok-provider@0.1.7](https://www.npmjs.com/package/dsh-grok-provider/v/0.1.7)
|
|
134
|
+
- Most recent GitHub release and integrity values: [v0.1.7](https://github.com/yoshino-xiao7/dsh-grok-provider/releases/tag/v0.1.7)
|
|
133
135
|
- GitHub community discovery: the repository carries the DeepSeek Harness-recommended `dsh-plugin` and `dsh` topics
|
|
134
136
|
- YukiRyou managed source: [deepseek-yukiryou-plugin-catalog](https://github.com/yoshino-xiao7/deepseek-yukiryou-plugin-catalog), still pinned to the real-device-accepted `dsh-grok-provider@0.1.0` and marking only `darwin-arm64`
|
|
135
137
|
|
|
@@ -137,19 +139,21 @@ Directory inclusion is not an endorsement by xAI or DeepSeek Harness. [Listing P
|
|
|
137
139
|
|
|
138
140
|
## Compatibility and scope
|
|
139
141
|
|
|
140
|
-
| Item | `0.1.
|
|
142
|
+
| Item | `0.1.9` candidate status |
|
|
141
143
|
| --- | --- |
|
|
142
144
|
| DeepSeek Harness | Exact support for `0.1.1-rc.2` |
|
|
143
145
|
| Node.js | `>=24.19.0` |
|
|
144
|
-
| macOS arm64 |
|
|
145
|
-
| Windows x64 | Covered by code
|
|
146
|
+
| macOS arm64 | The published `0.1.7` baseline completed real-network acceptance; `0.1.9` Search passed four isolated Web Harness cases under fail-closed fixtures |
|
|
147
|
+
| Windows x64 | Covered by code, slow fakes, and passing `0.1.9` Windows 2022 CI. On a reachable network the official CLI generates the URL and opens the browser, and that path still lacks real-device Windows acceptance |
|
|
146
148
|
| macOS x64 / Linux | Unsupported |
|
|
147
149
|
| Grok CLI | No full-version lock; official path, `login --oauth` capability, and production OIDC credential contract are enforced |
|
|
148
150
|
| Models | Every account catalog model whose backend has a strict codec in this release |
|
|
149
151
|
|
|
150
|
-
`0.1.
|
|
152
|
+
`0.1.9` preserves the image boundary of published `0.1.7`: image input is enabled only for exact `grok-4.6`, while `grok-4.5` and every other dynamically discovered model remain text-only. Image sending has been confirmed in a real Harness conversation. Images must be verified JPEG/PNG projections from the Harness attachment service. Ordinary user content and images nested one level inside a tool result are supported with fixed `detail:"high"`; URLs, filesystem paths, file IDs, and caller-supplied data URLs are rejected. Private reasoning in ordinary user/system history is omitted while adjacent visible text remains ordered.
|
|
151
153
|
|
|
152
|
-
Each projected image is limited to 4 MiB, 16,777,216 pixels, and 8192px per side. A request retains at most eight images and 8 MiB of projected image bytes. When a limit is exceeded, the globally oldest images are offloaded to Harness text placeholders; the final JSON remains capped at 16 MiB.
|
|
154
|
+
Each projected image is limited to 4 MiB, 16,777,216 pixels, and 8192px per side. A request retains at most eight images and 8 MiB of projected image bytes. When a limit is exceeded, the globally oldest images are offloaded to Harness text placeholders; the final JSON remains capped at 16 MiB.
|
|
155
|
+
|
|
156
|
+
The `0.1.9` candidate adds two default-off Search settings only for exact `grok-4.6`. Once enabled, ordinary conversation content and model-derived queries are sent to xAI and may incur additional usage. Web/X activity is already executed server-side and is not projected as a Harness-local tool call. Citation Markdown remains ordinary assistant text; bounded structured URL metadata is discarded, and the plugin never opens or downloads a citation. Search results are untrusted remote data, so verify sources before commands or file changes. Image generation, arbitrary downloads, API-key mode, multiple accounts, enterprise OIDC, ACP, and Headless agent wrapping remain out of scope; see the [capability roadmap](docs/11-capability-roadmap.md).
|
|
153
157
|
|
|
154
158
|
## How it works
|
|
155
159
|
|
|
@@ -175,7 +179,7 @@ Model IDs come from the runtime catalog rather than a hardcoded list. Image moda
|
|
|
175
179
|
- The Host must perform a bounded read of the official `auth.json`, whose raw file may contain a refresh token. The parser does not use, cache, or persist that refresh token; it retains only validation metadata and a short-lived access-token lease.
|
|
176
180
|
- The provider does not implement a refresh grant. Near expiry it may invoke one bounded official `grok models`, then reread and revalidate the official credential file.
|
|
177
181
|
- Login subprocesses use fixed argv, a scrubbed environment, output limits, deadlines, cancellation, and no shell.
|
|
178
|
-
- Prompts, tool results,
|
|
182
|
+
- Prompts, tool results, image projections selected for a request, and Search queries when enabled are sent to the xAI Grok Build service; the provider itself does not log that content, source images, projected bytes, or citation URLs.
|
|
179
183
|
|
|
180
184
|
See the full [threat model](docs/03-security-threat-model.md). For vulnerabilities, read the [security policy](SECURITY.md) and never post tokens, `auth.json`, personal data, or full diagnostic logs in a public issue.
|
|
181
185
|
|
|
@@ -199,7 +203,7 @@ Run the official CLI directly first:
|
|
|
199
203
|
|
|
200
204
|
If it times out at `auth.x.ai/.well-known/openid-configuration`, the failure occurs before a sign-in URL is generated; it is not a broken Provider browser button. Check Windows DNS, outbound HTTPS, firewall, VPN, and proxy settings—especially when the browser uses PAC/system proxy but the CLI process has no `HTTPS_PROXY`. Do not disable TLS verification or post proxy credentials, sign-in URLs, authorization codes, or tokens in an issue.
|
|
201
205
|
|
|
202
|
-
The
|
|
206
|
+
The settings page promptly settles this known discovery timeout and says that browser sign-in has not started. An authentication flow that is still running within the five-minute deadline remains cancellable, while unknown CLI output is reduced to a redacted generic error. This is accurate diagnosis of the failure boundary: the Provider does not open the browser itself and does not repair Windows DNS, proxy, firewall, VPN, or official-CLI behavior.
|
|
203
207
|
|
|
204
208
|
### A model is missing
|
|
205
209
|
|
|
@@ -215,7 +219,7 @@ Versions through `0.1.2` could not convert some third-party tool-call histories
|
|
|
215
219
|
|
|
216
220
|
### Does Windows work?
|
|
217
221
|
|
|
218
|
-
Windows x64 is covered by code
|
|
222
|
+
Windows x64 is covered by code, slow fakes, and passing `0.1.9` Windows 2022 CI. The official CLI still generates the sign-in URL and launches the external browser. Network-reachable browser launch has not yet been confirmed on a real Windows device, so it must not be described as fixed or verified.
|
|
219
223
|
|
|
220
224
|
## Development
|
|
221
225
|
|
|
@@ -250,8 +254,8 @@ Read the [contributing guide](CONTRIBUTING.md) before filing an issue or PR. Cha
|
|
|
250
254
|
- [x] Publish `0.1.4`: image input only for exact `grok-4.6`; red/blue user/tool-result Proxy gates and final Harness attachment revalidation passed, while `grok-4.5` fails closed as text-only
|
|
251
255
|
- [x] Publish `0.1.5`: maintenance for release binding, dashboard capability badges, and transactional Provider Runtime installation; the unique artifact, dual-platform CI, signatures, and SLSA provenance are verified
|
|
252
256
|
- [x] Publish `0.1.6`: image-history reasoning compatibility and per-stage official-CLI deadline repair for Windows; image sending is confirmed in a real Harness conversation
|
|
253
|
-
- [
|
|
254
|
-
- [ ]
|
|
257
|
+
- [x] Publish `0.1.7`: Provider/CLI version diagnostics, CLI installation recovery, redacted OIDC discovery-timeout settlement, and the `IconThinkOutline16` settings-navigation compatibility layer
|
|
258
|
+
- [ ] Publish `0.1.9`: opt-in, default-off Web Search / X Search; `0.1.8` was published and then withdrawn, and its npm version number cannot be reused
|
|
255
259
|
- [ ] A subsequent slice: opt-in image generation (inline results only, committed through Harness attachments)
|
|
256
260
|
- [ ] Complete independent Windows x64 acceptance and publish a later stable fix if needed
|
|
257
261
|
|
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.md) | [English](README.en.md)
|
|
4
4
|
|
|
5
|
-
让 DeepSeek Harness 使用你已登录的官方 Grok Build
|
|
5
|
+
让 DeepSeek Harness 使用你已登录的官方 Grok Build 账号:动态模型发现、流式推理、图片输入、可选 Web/X Search、工具调用,以及账号额度与模型能力面板。
|
|
6
6
|
|
|
7
|
-
> 非官方社区项目,与 xAI 或 DeepSeek Harness 官方无隶属关系。当前源码候选版本为 `0.1.
|
|
7
|
+
> 非官方社区项目,与 xAI 或 DeepSeek Harness 官方无隶属关系。当前源码候选版本为 `0.1.9`。`0.1.8` 曾发布后撤回,npm 版本号不可复用;npm Registry 的 `latest` 与当前可安装的稳定基线仍为 `0.1.7`。项目不再发行预发行版;正式版缺陷通过新的递增稳定版本修复。
|
|
8
8
|
|
|
9
9
|
## 它解决什么问题
|
|
10
10
|
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
| 模型 | 运行时读取账号可见的全部 Grok Build 模型,不维护静态模型白名单 |
|
|
16
16
|
| 对话 | Responses 流式文本、reasoning、加密 reasoning replay、usage 与 finish reason |
|
|
17
17
|
| 图片 | 仅精确 `grok-4.6` 接收 Harness attachment 中有界的 JPEG/PNG 图片;`grok-4.5` 与其他模型保持 text-only |
|
|
18
|
+
| 搜索 | `0.1.9` 候选为精确 `grok-4.6` 提供默认关闭、可分别开启的 Web Search / X Search;远端 lifecycle 不伪装成本地工具 |
|
|
18
19
|
| 工具 | 将 function call 交回 Harness 权限层;Provider 本身不执行工具 |
|
|
19
20
|
| 账户面板 | 登录状态、每周/月额度、重置时间、动态模型能力与 reasoning 档位 |
|
|
20
21
|
| 界面 | Web 设置页中英文切换;TUI 提供闭合的 `/grok` 命令 |
|
|
@@ -35,14 +36,14 @@ grok --version
|
|
|
35
36
|
grok models
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
当网络可达且 OIDC discovery 成功时,首次运行 Grok CLI 会打开浏览器登录。插件只支持官方默认的 `~/.grok`(Windows 为 `%USERPROFILE%\.grok`)目录。
|
|
39
40
|
|
|
40
41
|
### 2. 安装 Provider
|
|
41
42
|
|
|
42
|
-
`0.1.
|
|
43
|
+
`0.1.9` 发布后,从 npm 安装该精确版本:
|
|
43
44
|
|
|
44
45
|
```sh
|
|
45
|
-
dsh plugin --profile web add dsh-grok-provider@0.1.
|
|
46
|
+
dsh plugin --profile web add dsh-grok-provider@0.1.9
|
|
46
47
|
dsh web
|
|
47
48
|
```
|
|
48
49
|
|
|
@@ -65,6 +66,7 @@ Web 设置页展示:
|
|
|
65
66
|
- CLI 缺失或无效时的官方安装入口与“重新检测”操作;
|
|
66
67
|
- 已使用/剩余额度和真实周期重置时间;
|
|
67
68
|
- 当前账号可见模型、上下文窗口、reasoning 档位,以及图片输入、streaming 与 tool capability。
|
|
69
|
+
- 默认关闭且相互独立的 Web Search / X Search 开关,以及远端检索、额外用量、citation 和 prompt injection 风险提示。
|
|
68
70
|
|
|
69
71
|
当 protobuf-backed billing 返回完整的 weekly/monthly 周期但省略零值百分比时,页面会恢复为“已使用 0% / 剩余 100%”;其他不完整响应保持未知,不伪造额度。
|
|
70
72
|
|
|
@@ -128,8 +130,8 @@ dsh web
|
|
|
128
130
|
|
|
129
131
|
## 项目来源与发现
|
|
130
132
|
|
|
131
|
-
- npm 当前稳定版:[dsh-grok-provider@0.1.
|
|
132
|
-
- GitHub 最近发行版与校验值:[v0.1.
|
|
133
|
+
- npm 当前稳定版:[dsh-grok-provider@0.1.7](https://www.npmjs.com/package/dsh-grok-provider/v/0.1.7)
|
|
134
|
+
- GitHub 最近发行版与校验值:[v0.1.7](https://github.com/yoshino-xiao7/dsh-grok-provider/releases/tag/v0.1.7)
|
|
133
135
|
- GitHub 社区发现:仓库已添加 DeepSeek Harness 官方推荐的 `dsh-plugin` 与 `dsh` Topics
|
|
134
136
|
- YukiRyou 受管来源:[deepseek-yukiryou-plugin-catalog](https://github.com/yoshino-xiao7/deepseek-yukiryou-plugin-catalog),当前仍锁定已完成真机验收的 `dsh-grok-provider@0.1.0`,且只标记 `darwin-arm64`
|
|
135
137
|
|
|
@@ -137,19 +139,21 @@ dsh web
|
|
|
137
139
|
|
|
138
140
|
## 兼容性与范围
|
|
139
141
|
|
|
140
|
-
| 项目 | `0.1.
|
|
142
|
+
| 项目 | `0.1.9` 候选状态 |
|
|
141
143
|
| --- | --- |
|
|
142
144
|
| DeepSeek Harness | 精确支持 `0.1.1-rc.2` |
|
|
143
145
|
| Node.js | `>=24.19.0` |
|
|
144
|
-
| macOS arm64 |
|
|
145
|
-
| Windows x64 |
|
|
146
|
+
| macOS arm64 | 已发布的 `0.1.7` 基线已完成真实网络验收;`0.1.9` Search 已完成失败关闭 fixture 下的隔离 Web Harness 四场景验收 |
|
|
147
|
+
| Windows x64 | 代码、slow-fake 与 `0.1.9` Windows 2022 CI 已通过;网络可达时由官方 CLI 生成 URL 并打开浏览器,该路径仍未完成 Windows 真机验收 |
|
|
146
148
|
| macOS x64 / Linux | 不支持 |
|
|
147
149
|
| Grok CLI | 不锁完整版本;严格校验官方路径、`login --oauth` 能力与生产 OIDC 凭据契约 |
|
|
148
150
|
| 模型 | 当前账号目录中 backend 已被严格 codec 支持的全部模型 |
|
|
149
151
|
|
|
150
|
-
`0.1.
|
|
152
|
+
`0.1.9` 沿用已发布 `0.1.7` 的图片边界:只为精确的 `grok-4.6` 开启图片输入;`grok-4.5` 与其他动态发现的模型继续按 text-only 处理。图片发送已在真实 Harness 对话中确认可用。图片只能来自 Harness attachment service 的已验证 JPEG/PNG 投影,支持普通用户内容和一层工具结果中的图片,并固定使用 `detail:"high"`;不接受 URL、文件路径、file ID 或调用方预制的 data URL。普通 user/system 历史中的私有 reasoning 会被省略并保留相邻可见文本。
|
|
151
153
|
|
|
152
|
-
每张投影图片最多 4 MiB、16,777,216 像素且任一边不超过 8192px;每次请求最多保留 8 张、投影字节合计最多 8 MiB。超限时按全局最旧优先移除图片并保留 Harness 的文本占位,最终 JSON 仍受 16 MiB 上限约束。
|
|
154
|
+
每张投影图片最多 4 MiB、16,777,216 像素且任一边不超过 8192px;每次请求最多保留 8 张、投影字节合计最多 8 MiB。超限时按全局最旧优先移除图片并保留 Harness 的文本占位,最终 JSON 仍受 16 MiB 上限约束。
|
|
155
|
+
|
|
156
|
+
`0.1.9` 候选只为精确 `grok-4.6` 增加两个默认关闭的 Search 开关。开启后,普通对话内容以及模型据此生成的检索词会交给 xAI,并可能产生额外用量。Web/X 是服务端已执行的检索过程,不会变成 Harness 本地工具调用;回答中的 citation Markdown 保留为普通文本,结构化 URL 元数据有界校验后丢弃,插件不会打开或下载引用。搜索结果属于不可信远端数据,执行命令或修改文件前应核实来源。图片生成、任意文件下载、API Key 模式、多账号、企业 OIDC、ACP 与 Headless agent 封装仍不在本版本范围内;后续切片见[能力路线图](docs/11-capability-roadmap.md)。
|
|
153
157
|
|
|
154
158
|
## 工作原理
|
|
155
159
|
|
|
@@ -175,7 +179,7 @@ dsh-grok-provider Host
|
|
|
175
179
|
- Host 必须有界读取官方 `auth.json`,其原始文件可能包含 refresh token;解析器不使用、不缓存、不持久化 refresh token,只保留闭合校验所需元数据与短期 access-token lease。
|
|
176
180
|
- 插件不实现 refresh grant;凭据临近过期时,只能有界调用一次官方 `grok models`,再重新读取并验证官方文件。
|
|
177
181
|
- 登录子进程使用固定 argv、过滤后的环境、输出上限、deadline 与取消处理,不通过 shell 启动。
|
|
178
|
-
-
|
|
182
|
+
- 提示词、工具结果、用户选择发送的图片投影,以及启用 Search 后的检索词会发往 xAI Grok Build 服务;插件本身不记录这些内容、原图、投影字节或 citation URL。
|
|
179
183
|
|
|
180
184
|
完整边界见[威胁模型](docs/03-security-threat-model.md)。发现安全问题时,请阅读[安全策略](SECURITY.md),不要在公开 Issue 中提交 token、`auth.json`、个人信息或完整诊断日志。
|
|
181
185
|
|
|
@@ -199,7 +203,7 @@ dsh-grok-provider Host
|
|
|
199
203
|
|
|
200
204
|
如果它在 `auth.x.ai/.well-known/openid-configuration` 超时,失败发生在生成登录链接之前,不是 Provider 的浏览器按钮失效。请检查 Windows 的 DNS、HTTPS 出站、防火墙、VPN 与代理;尤其是浏览器使用 PAC/系统代理、CLI 进程却没有 `HTTPS_PROXY` 的情况。不要关闭 TLS 校验,也不要把代理凭据、登录 URL、授权码或 token 提交到 Issue。
|
|
201
205
|
|
|
202
|
-
|
|
206
|
+
设置页会及时结算这个已知 discovery 超时并显示“浏览器登录尚未开始”;实际仍在运行的五分钟登录流程可以取消,未知 CLI 输出只显示脱敏的通用错误。这是对失败边界的准确诊断,不是插件自行打开浏览器,也不修复 Windows 的 DNS、代理、防火墙、VPN 或官方 CLI 行为。
|
|
203
207
|
|
|
204
208
|
### 没有看到某个模型
|
|
205
209
|
|
|
@@ -215,7 +219,7 @@ dsh-grok-provider Host
|
|
|
215
219
|
|
|
216
220
|
### Windows 能用吗
|
|
217
221
|
|
|
218
|
-
|
|
222
|
+
代码、slow-fake 与 `0.1.9` Windows 2022 CI 已覆盖 Windows x64。官方 CLI 仍负责生成登录 URL 与打开外部浏览器;网络可达的 Windows 真机浏览器弹出尚未确认,因此不能表述为该问题已经修复或验证。
|
|
219
223
|
|
|
220
224
|
## 开发
|
|
221
225
|
|
|
@@ -250,8 +254,8 @@ npm run pack:check
|
|
|
250
254
|
- [x] 发布 `0.1.4`:仅精确 `grok-4.6` 图片输入;user/tool-result 红蓝语义 Proxy 门禁与最终 Harness attachment 复验通过,`grok-4.5` 失败关闭为 text-only
|
|
251
255
|
- [x] 发布 `0.1.5`:发布链路、账户面板能力标签与 Provider Runtime 安装回滚维护版;唯一制品、双平台 CI、签名与 SLSA provenance 均已验证
|
|
252
256
|
- [x] 发布 `0.1.6`:图片历史 reasoning 兼容与 Windows 官方 CLI 分阶段 deadline 修复版;图片发送已完成真实 Harness 验证
|
|
253
|
-
- [
|
|
254
|
-
- [ ] `0.1.
|
|
257
|
+
- [x] 发布 `0.1.7`:Provider/CLI 双版本诊断、CLI 安装恢复、OIDC discovery 超时脱敏结算与 `IconThinkOutline16` 设置导航兼容层
|
|
258
|
+
- [ ] 发布 `0.1.9`:默认关闭、用户分别开启的 Web Search / X Search;`0.1.8` 已发布后撤回且 npm 版本号不可复用
|
|
255
259
|
- [ ] 再后续独立切片:默认关闭的图片生成(只收内联结果,提交 Harness attachment)
|
|
256
260
|
- [ ] 完成 Windows x64 独立真机验收并按需发布后续稳定修复版
|
|
257
261
|
|
package/SECURITY.md
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
## 支持范围
|
|
6
6
|
|
|
7
|
-
本安全策略对应源码候选版本 `0.1.
|
|
7
|
+
本安全策略对应源码候选版本 `0.1.9`。`0.1.8` 曾发布后撤回,npm 版本号不可复用;npm Registry 的 `latest` 与当前可安装的稳定基线仍为 `0.1.7`。DeepSeek Harness、Node.js 与操作系统按发布线明确维护;Grok CLI 不使用完整版本字符串作为信任门禁,而是严格校验官方默认路径、命令能力、生产 OIDC 凭据契约和固定服务端协议。已发布的 `0.1.7` 基线在 macOS arm64 完成真实验收,图片发送也已在真实 Harness 对话中确认可用;`0.1.9` Search 已完成失败关闭 fixture 下的隔离 Web Harness `ctx.llm` 四场景验收。macOS 14 / Windows 2022 CI 已通过,但浏览器手工对话、OAuth、真实账号/真实 xAI Search 请求和网络可达 Windows 真机外部浏览器弹出不在该隔离验收覆盖范围内。
|
|
8
8
|
|
|
9
|
-
`0.1.
|
|
9
|
+
`0.1.9` 沿用已发布 `0.1.7` 的图片边界:只为精确 `grok-4.6` 提供有界图片输入;`grok-4.5` 与所有其他模型保持 text-only。普通 user/system 历史中的私有 reasoning 会被省略并保留相邻可见 text/image;只有有效的同 Provider assistant 历史可进入加密 reasoning replay,一层 tool-result 仍只接受公开 text/image。图片只能来自 Harness attachment service 的已验证 JPEG/PNG 投影,以 `detail:"high"` 发送,并受单图字节、像素、边长、数量、总字节与最终 JSON 上限约束;URL、路径、file ID 和调用方预制 data URL 都会被拒绝。
|
|
10
10
|
|
|
11
|
-
`0.1.7`
|
|
11
|
+
`0.1.7` 的闭合运行时诊断、CLI 安装恢复、OIDC timeout 脱敏结算和 `IconThinkOutline16` 兼容层在本版保持不变。官方 CLI 仍负责生成登录 URL 与打开外部浏览器;插件不修复系统 DNS、代理、防火墙、VPN 或 CLI 行为。
|
|
12
|
+
|
|
13
|
+
`0.1.9` 只为精确 `grok-4.6` 增加两个默认关闭的 Web/X Search 开关。启用后,普通对话内容与模型生成的检索词会交给 xAI,并可能产生额外用量;结果和 citation 属于可能错误或含提示注入的不可信远端数据。Provider 只允许固定 Proxy 实测的 Web lifecycle 与四项 X custom-tool 名称,不把它们映射为 Harness 本地工具,不跟随或下载 citation URL,并在观察到 Search 后放弃该响应的 encrypted reasoning replay。后台 purpose、未验证模型、未启用类别、未知事件和未闭合 lifecycle 均失败关闭。固定路径/argv、最小环境、无 shell、输出上限、凭据、固定 origin 与 URL 拒绝边界不变;本版不新增生成、认证模式或 endpoint。
|
|
12
14
|
|
|
13
15
|
## 私下报告漏洞
|
|
14
16
|
|
|
@@ -25,7 +27,7 @@
|
|
|
25
27
|
|
|
26
28
|
## 不属于漏洞的情况
|
|
27
29
|
|
|
28
|
-
-
|
|
30
|
+
- 网络可达 Windows 真机外部浏览器弹出尚未完成验收这一已披露状态;
|
|
29
31
|
- 上游未提供额度字段时 UI 显示 unknown;
|
|
30
32
|
- 不受支持的 CLI/Harness/平台版本被明确拒绝;
|
|
31
33
|
- 官方 CLI 或 xAI 服务自身的行为,且无法由本插件边界缓解的问题。
|
|
@@ -36,4 +38,4 @@
|
|
|
36
38
|
|
|
37
39
|
---
|
|
38
40
|
|
|
39
|
-
English summary: GitHub Private vulnerability reporting is enabled and
|
|
41
|
+
English summary: GitHub Private vulnerability reporting is enabled and preferred. The current source candidate is `0.1.9`. Version `0.1.8` was published and then withdrawn, and npm version numbers cannot be reused; npm Registry `latest` and the current installable stable baseline remain `0.1.7`. Bounded JPEG/PNG input with fixed `detail:"high"` remains enabled only for exact `grok-4.6`; browser sign-in diagnostics remain closed and redacted, and the official CLI still owns URL generation and browser launch. The `0.1.9` candidate adds independent, default-off Web/X Search only for exact `grok-4.6`. Its four isolated Web Harness `ctx.llm` cases and macOS 14 / Windows 2022 CI have passed under fail-closed fixtures; this does not cover manual browser conversations, OAuth, a real account, real xAI Search requests, or network-reachable Windows browser launch. When enabled, prompts and model-derived queries reach xAI and may incur additional usage; results and citations are untrusted remote data. The provider accepts only the fixed-Proxy Web lifecycle and four verified X custom-tool names, emits no Harness-local tool calls for server search, never follows citation URLs, and suppresses encrypted reasoning replay after Search. Background-purpose calls, unverified models, disabled categories, unknown events, and incomplete lifecycles fail closed. Fixed path/argv, no-shell, credential, origin, and URL-rejection boundaries remain unchanged; no image generation, new auth mode, or custom endpoint is added. Never send credentials, identity data, prompts, tool arguments, cookies, image bytes, Search contents, or unreviewed diagnostics.
|
package/dist/client/client.js
CHANGED
|
@@ -28,6 +28,13 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
weekly: "每周额度", monthly: "每月额度", currentPeriod: "当前额度周期",
|
|
29
29
|
remaining: "剩余", used: "已使用", resetTime: "重置时间", resetUnknown: "上游未提供重置时间",
|
|
30
30
|
usageUnknown: "上游未提供使用比例", quotaUnavailable: "暂时无法读取 Grok Build 额度。",
|
|
31
|
+
searchTitle: "在线搜索", searchDescription: "默认关闭,并分别控制普通 Grok 请求是否可调用 xAI 的远端搜索;当前仅精确 grok-4.6 支持,其他模型会失败关闭;后台摘要与会话标题不会启用搜索。",
|
|
32
|
+
webSearch: "Web Search", webSearchDescription: "允许 xAI 根据对话和生成的搜索词远端查询公开网页,可能产生额外用量。",
|
|
33
|
+
xSearch: "X Search", xSearchDescription: "允许 xAI 根据对话和生成的搜索词远端查询 X 帖子、用户与线程,可能产生额外用量。",
|
|
34
|
+
searchRisk: "搜索结果和 citation 是不可信的远端内容,可能包含错误或 prompt injection。执行敏感操作前请核实来源;插件不会打开或下载引用链接。",
|
|
35
|
+
searchEnabled: "已开启", searchDisabled: "已关闭", searchLoading: "正在读取搜索设置…",
|
|
36
|
+
searchUnavailable: "搜索设置暂时不可用;开关不可操作,也不会写入未知值。", searchReadOnly: "当前搜索设置不可写。",
|
|
37
|
+
searchSaveFailed: "搜索设置保存失败,已保留 Host 当前值。",
|
|
31
38
|
modelsTitle: "当前账号可用的模型", modelsDescription: "模型来自 Grok Build 动态目录;Harness 模型选择器会显示这里列出的全部模型。",
|
|
32
39
|
modelsUnavailable: "暂时无法读取模型目录。", noModels: "当前账号没有返回可用模型。",
|
|
33
40
|
context: "上下文", reasoning: "推理档位", defaultEffort: "默认", text: "文本输入", image: "图片输入", streaming: "流式输出", tools: "工具调用",
|
|
@@ -54,6 +61,13 @@ window.__ModuleLoader__.load({
|
|
|
54
61
|
weekly: "Weekly quota", monthly: "Monthly quota", currentPeriod: "Current quota period",
|
|
55
62
|
remaining: "remaining", used: "Used", resetTime: "Resets", resetUnknown: "Reset time was not provided",
|
|
56
63
|
usageUnknown: "Usage percentage was not provided", quotaUnavailable: "Grok Build quota is temporarily unavailable.",
|
|
64
|
+
searchTitle: "Online Search", searchDescription: "Off by default. These settings independently allow regular Grok requests to use xAI remote search. Only exact grok-4.6 is supported; other models fail closed. Background summaries and conversation titles do not use Search.",
|
|
65
|
+
webSearch: "Web Search", webSearchDescription: "Allows xAI to remotely query public web pages from the conversation and generated search terms, which may incur additional usage.",
|
|
66
|
+
xSearch: "X Search", xSearchDescription: "Allows xAI to remotely query X posts, users, and threads from the conversation and generated search terms, which may incur additional usage.",
|
|
67
|
+
searchRisk: "Search results and citations are untrusted remote content and may contain errors or prompt injection. Verify sources before sensitive actions; the plugin does not open or download citation links.",
|
|
68
|
+
searchEnabled: "On", searchDisabled: "Off", searchLoading: "Reading Search settings…",
|
|
69
|
+
searchUnavailable: "Search settings are temporarily unavailable. Controls are disabled and no unknown value will be written.", searchReadOnly: "Search settings are currently read-only.",
|
|
70
|
+
searchSaveFailed: "Search settings could not be saved. The current Host value was preserved.",
|
|
57
71
|
modelsTitle: "Models available to this account", modelsDescription: "Models come from the live Grok Build catalog; every model listed here remains visible in the Harness model selector.",
|
|
58
72
|
modelsUnavailable: "The model catalog is temporarily unavailable.", noModels: "This account returned no available models.",
|
|
59
73
|
context: "Context", reasoning: "Reasoning", defaultEffort: "default", text: "Text input", image: "Image input", streaming: "Streaming", tools: "Tool calling",
|
|
@@ -61,6 +75,17 @@ window.__ModuleLoader__.load({
|
|
|
61
75
|
},
|
|
62
76
|
}
|
|
63
77
|
|
|
78
|
+
function decodeSearchConfig(value) {
|
|
79
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return undefined
|
|
80
|
+
const webSearch = Object.getOwnPropertyDescriptor(value, "webSearch")
|
|
81
|
+
const xSearch = Object.getOwnPropertyDescriptor(value, "xSearch")
|
|
82
|
+
if (
|
|
83
|
+
!webSearch || !("value" in webSearch) || typeof webSearch.value !== "boolean"
|
|
84
|
+
|| !xSearch || !("value" in xSearch) || typeof xSearch.value !== "boolean"
|
|
85
|
+
) return undefined
|
|
86
|
+
return Object.freeze({ webSearch: webSearch.value, xSearch: xSearch.value })
|
|
87
|
+
}
|
|
88
|
+
|
|
64
89
|
const navIconMarker = "data-dsh-grok-provider-nav-icon"
|
|
65
90
|
const navIconStyleSelector = 'style[data-plugin-nav-icon="dsh-grok-provider"]'
|
|
66
91
|
const navIconStateKey = Symbol.for("dsh-grok-provider.settings-nav-icon.v1")
|
|
@@ -178,6 +203,7 @@ window.__ModuleLoader__.load({
|
|
|
178
203
|
.dsh-grok-runtime{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:10px;color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:11px;line-height:18px}.dsh-grok-runtime strong{color:var(--dsw-alias-label-secondary);font-weight:600}.dsh-grok-install{margin-top:13px;padding:12px 13px;border:1px solid rgb(217 155 43 / 30%);border-radius:11px;background:rgb(217 155 43 / 8%)}.dsh-grok-install strong{display:block;font-size:12px}.dsh-grok-install p{margin:4px 0 10px;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:18px}.dsh-grok-link{display:inline-flex;align-items:center;height:32px;border-radius:999px;padding:0 12px;color:var(--dsw-static-deepseek-500,#4d6bfe);text-decoration:none;background:rgb(77 107 254 / 8%);font-size:11px}.dsh-grok-link:hover{text-decoration:underline}
|
|
179
204
|
.dsh-grok-divider{height:1px;margin:18px 0;background:rgb(190 93 138 / 20%)}.dsh-grok-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.dsh-grok-section-head h3{margin:0;font-size:15px;line-height:23px}.dsh-grok-section-head .dsh-grok-button{height:30px;padding:0 11px}
|
|
180
205
|
.dsh-grok-quota{margin-top:15px}.dsh-grok-quota-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:8px;color:var(--dsw-alias-label-secondary);font-size:13px}.dsh-grok-quota-name{color:var(--dsw-alias-label-primary);font-weight:600}.dsh-grok-progress{height:9px;overflow:hidden;border-radius:999px;background:rgb(190 93 138 / 13%)}.dsh-grok-progress-fill{height:100%;border-radius:inherit;background:linear-gradient(90deg,#d7448a,#ea1768);transition:width .25s ease}.dsh-grok-quota-meta{display:flex;flex-wrap:wrap;justify-content:space-between;gap:7px;margin-top:9px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.dsh-grok-muted{margin:12px 0 0;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:19px}
|
|
206
|
+
.dsh-grok-search-head h3{margin:0;font-size:16px;line-height:24px}.dsh-grok-search-head p{margin:5px 0 0;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:19px}.dsh-grok-search-list{margin-top:14px;border-top:1px solid rgb(190 93 138 / 18%)}.dsh-grok-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:18px;padding:14px 0;border-bottom:1px solid rgb(190 93 138 / 18%)}.dsh-grok-search-copy strong{display:block;font-size:13px;line-height:20px}.dsh-grok-search-copy p{margin:3px 0 0;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:18px}.dsh-grok-switch{position:relative;width:44px;height:25px;flex:none;border:0;border-radius:999px;padding:0;background:var(--dsw-alias-interactive-bg-hover);cursor:pointer;transition:background .18s ease}.dsh-grok-switch::after{content:"";position:absolute;top:3px;left:3px;width:19px;height:19px;border-radius:50%;background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 3px rgb(0 0 0 / 18%);transition:transform .18s ease}.dsh-grok-switch[data-checked="true"]{background:var(--dsw-static-deepseek-500,#4d6bfe)}.dsh-grok-switch[data-checked="true"]::after{transform:translateX(19px)}.dsh-grok-switch:disabled{cursor:default;opacity:.48}.dsh-grok-search-risk{margin:13px 0 0;padding:11px 12px;border-radius:10px;color:var(--dsw-alias-label-secondary);background:rgb(217 155 43 / 8%);font-size:11px;line-height:18px}.dsh-grok-search-status{margin:11px 0 0;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:18px}.dsh-grok-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;clip-path:inset(50%)}
|
|
181
207
|
.dsh-grok-models-head{padding:20px 20px 0}.dsh-grok-models-head h3{margin:0;font-size:16px;line-height:24px}.dsh-grok-models-head p{margin:5px 0 0;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:19px}.dsh-grok-model-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:16px 20px 20px}.dsh-grok-model{min-width:0;border:1px solid var(--dsw-alias-border-l2);border-radius:13px;padding:14px;background:var(--dsw-alias-bg-layer-1)}.dsh-grok-model-title{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.dsh-grok-model-title strong{overflow-wrap:anywhere;font-size:14px}.dsh-grok-model-id{overflow-wrap:anywhere;color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px}.dsh-grok-model-description{margin:5px 0 10px;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:17px}.dsh-grok-badges{display:flex;flex-wrap:wrap;gap:5px}.dsh-grok-badge{border-radius:999px;padding:2px 8px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover);font-size:10px;line-height:18px}.dsh-grok-badge[data-accent="true"]{color:#a9326b;background:rgb(215 68 138 / 11%)}.dsh-grok-efforts{margin-top:10px;color:var(--dsw-alias-label-secondary);font-size:10px;line-height:17px}.dsh-grok-footer{padding:0 20px 16px;color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:10px}
|
|
182
208
|
.dsh-grok-notice{padding:13px 14px;border:1px solid rgb(229 72 77 / 28%);border-radius:11px;color:var(--dsw-alias-label-secondary);background:rgb(229 72 77 / 7%);font-size:12px;line-height:19px}.dsh-grok-error{margin:10px 0 0;color:var(--dsw-static-red-500,#e5484d);font-size:12px;line-height:19px}
|
|
183
209
|
@media(max-width:680px){.dsh-grok-panel-inner,.dsh-grok-models-head{padding:16px}.dsh-grok-model-grid{grid-template-columns:1fr;padding:14px 16px 16px}.dsh-grok-account-head{align-items:flex-start;flex-direction:column}.dsh-grok-quota-row{align-items:flex-start;flex-direction:column;gap:3px}}
|
|
@@ -189,7 +215,7 @@ window.__ModuleLoader__.load({
|
|
|
189
215
|
document.head.appendChild(style)
|
|
190
216
|
}
|
|
191
217
|
|
|
192
|
-
function GrokSettings({ connection, t }) {
|
|
218
|
+
function GrokSettings({ connection, t, searchSettings }) {
|
|
193
219
|
const [status, setStatus] = React.useState()
|
|
194
220
|
const [dashboard, setDashboard] = React.useState()
|
|
195
221
|
const [busy, setBusy] = React.useState(false)
|
|
@@ -200,6 +226,22 @@ window.__ModuleLoader__.load({
|
|
|
200
226
|
const [diagnosticsError, setDiagnosticsError] = React.useState(false)
|
|
201
227
|
const [statusEpoch] = React.useState(() => ({ value: 0 }))
|
|
202
228
|
const [diagnosticsEpoch] = React.useState(() => ({ value: 0 }))
|
|
229
|
+
const [searchSnapshot, setSearchSnapshot] = React.useState(() => searchSettings.getSnapshot())
|
|
230
|
+
const [searchSaving, setSearchSaving] = React.useState()
|
|
231
|
+
const [searchSaveError, setSearchSaveError] = React.useState(false)
|
|
232
|
+
const [searchWrite] = React.useState(() => ({ field: undefined }))
|
|
233
|
+
React.useEffect(() => {
|
|
234
|
+
let active = true
|
|
235
|
+
const publish = () => {
|
|
236
|
+
if (active) setSearchSnapshot(searchSettings.getSnapshot())
|
|
237
|
+
}
|
|
238
|
+
const unsubscribe = searchSettings.subscribe(publish)
|
|
239
|
+
publish()
|
|
240
|
+
return () => {
|
|
241
|
+
active = false
|
|
242
|
+
unsubscribe()
|
|
243
|
+
}
|
|
244
|
+
}, [searchSettings])
|
|
203
245
|
const call = React.useCallback(async (endpoint, payload = {}) => {
|
|
204
246
|
const result = await connection.rpc.call("/grok-auth", endpoint, payload)
|
|
205
247
|
if (!result || result.ok !== true) throw new Error("Grok account RPC failed")
|
|
@@ -314,6 +356,31 @@ window.__ModuleLoader__.load({
|
|
|
314
356
|
statusEpoch.value += 1
|
|
315
357
|
await Promise.all([refreshStatus({ includeDashboard: true }), refreshDiagnostics()])
|
|
316
358
|
})
|
|
359
|
+
const updateSearchSetting = async (field, enabled) => {
|
|
360
|
+
const current = searchSettings.getSnapshot()
|
|
361
|
+
if (
|
|
362
|
+
current.status !== "ready" || current.writable !== true
|
|
363
|
+
|| typeof current.value?.[field] !== "boolean" || current.value[field] === enabled
|
|
364
|
+
|| searchWrite.field !== undefined
|
|
365
|
+
) return
|
|
366
|
+
searchWrite.field = field
|
|
367
|
+
setSearchSaving(field)
|
|
368
|
+
setSearchSaveError(false)
|
|
369
|
+
try {
|
|
370
|
+
await searchSettings.set(field, enabled)
|
|
371
|
+
const settled = searchSettings.getSnapshot()
|
|
372
|
+
if (
|
|
373
|
+
settled.status !== "ready"
|
|
374
|
+
|| typeof settled.value?.[field] !== "boolean"
|
|
375
|
+
|| settled.value[field] !== enabled
|
|
376
|
+
) setSearchSaveError(true)
|
|
377
|
+
} catch {
|
|
378
|
+
setSearchSaveError(true)
|
|
379
|
+
} finally {
|
|
380
|
+
searchWrite.field = undefined
|
|
381
|
+
setSearchSaving(undefined)
|
|
382
|
+
}
|
|
383
|
+
}
|
|
317
384
|
|
|
318
385
|
if (!connection.isLoopback) return React.createElement("section", { className: "dsh-grok-page" },
|
|
319
386
|
React.createElement("h2", null, t("title")), React.createElement("p", { className: "dsh-grok-notice" }, t("loopback")))
|
|
@@ -380,6 +447,25 @@ window.__ModuleLoader__.load({
|
|
|
380
447
|
effortText && React.createElement("div", { className: "dsh-grok-efforts" }, `${t("reasoning")}:${effortText}`))
|
|
381
448
|
}
|
|
382
449
|
|
|
450
|
+
const searchReady = searchSnapshot.status === "ready"
|
|
451
|
+
const searchWritable = searchReady && searchSnapshot.writable === true
|
|
452
|
+
const searchStatus = searchSnapshot.status === "loading" ? t("searchLoading")
|
|
453
|
+
: searchSnapshot.status !== "ready" ? t("searchUnavailable")
|
|
454
|
+
: !searchWritable ? t("searchReadOnly") : undefined
|
|
455
|
+
const renderSearchSetting = (field, labelKey, descriptionKey) => {
|
|
456
|
+
const enabled = searchReady && searchSnapshot.value?.[field] === true
|
|
457
|
+
const disabled = !searchWritable || searchSaving !== undefined
|
|
458
|
+
return React.createElement("div", { className: "dsh-grok-search-row", key: field },
|
|
459
|
+
React.createElement("div", { className: "dsh-grok-search-copy" },
|
|
460
|
+
React.createElement("strong", null, t(labelKey)),
|
|
461
|
+
React.createElement("p", null, t(descriptionKey))),
|
|
462
|
+
React.createElement("button", {
|
|
463
|
+
className: "dsh-grok-switch", type: "button", role: "switch",
|
|
464
|
+
"aria-checked": enabled, "aria-label": `${t(labelKey)}:${t(enabled ? "searchEnabled" : "searchDisabled")}`,
|
|
465
|
+
"data-checked": enabled, disabled, onClick: () => updateSearchSetting(field, !enabled),
|
|
466
|
+
}, React.createElement("span", { className: "dsh-grok-visually-hidden" }, t(enabled ? "searchEnabled" : "searchDisabled"))))
|
|
467
|
+
}
|
|
468
|
+
|
|
383
469
|
const models = dashboard?.models
|
|
384
470
|
return React.createElement("section", { className: "dsh-grok-page" },
|
|
385
471
|
React.createElement("h2", null, t("title")), React.createElement("p", { className: "dsh-grok-description" }, t("description")),
|
|
@@ -413,6 +499,15 @@ window.__ModuleLoader__.load({
|
|
|
413
499
|
React.createElement("div", { className: "dsh-grok-section-head" }, React.createElement("h3", null, t("usage")),
|
|
414
500
|
React.createElement("button", { className: "dsh-grok-button", type: "button", disabled: busy || !available, onClick: manualRefresh }, busy ? t("refreshing") : t("refresh"))),
|
|
415
501
|
renderQuota(), error && React.createElement("p", { className: "dsh-grok-error" }, t("unavailable")))),
|
|
502
|
+
React.createElement("article", { className: "dsh-grok-panel" }, React.createElement("div", { className: "dsh-grok-panel-inner" },
|
|
503
|
+
React.createElement("div", { className: "dsh-grok-search-head" },
|
|
504
|
+
React.createElement("h3", null, t("searchTitle")), React.createElement("p", null, t("searchDescription"))),
|
|
505
|
+
React.createElement("div", { className: "dsh-grok-search-list" },
|
|
506
|
+
renderSearchSetting("webSearch", "webSearch", "webSearchDescription"),
|
|
507
|
+
renderSearchSetting("xSearch", "xSearch", "xSearchDescription")),
|
|
508
|
+
React.createElement("p", { className: "dsh-grok-search-risk" }, t("searchRisk")),
|
|
509
|
+
searchStatus && React.createElement("p", { className: "dsh-grok-search-status", role: "status", "aria-live": "polite" }, searchStatus),
|
|
510
|
+
searchSaveError && React.createElement("p", { className: "dsh-grok-error", role: "alert" }, t("searchSaveFailed")))),
|
|
416
511
|
React.createElement("article", { className: "dsh-grok-panel" },
|
|
417
512
|
React.createElement("div", { className: "dsh-grok-models-head" }, React.createElement("h3", null, t("modelsTitle")), React.createElement("p", null, t("modelsDescription"))),
|
|
418
513
|
React.createElement("div", { className: "dsh-grok-model-grid" },
|
|
@@ -432,14 +527,15 @@ window.__ModuleLoader__.load({
|
|
|
432
527
|
return new Intl.NumberFormat().format(value)
|
|
433
528
|
}
|
|
434
529
|
|
|
435
|
-
const inject = ["slots", "locale", "connection"]
|
|
530
|
+
const inject = ["slots", "locale", "connection", "settingsScope"]
|
|
436
531
|
function apply(ctx) {
|
|
437
532
|
ctx.effect(() => ctx.locale.register(namespace, dictionaries), "dsh-grok: dictionaries")
|
|
438
533
|
ctx.effect(() => installSettingsNavIcon(), "dsh-grok: settings nav icon")
|
|
439
534
|
const t = ctx.locale.bind(namespace)
|
|
535
|
+
const searchSettings = ctx.settingsScope.bind({ namespace: "llm-grok", decode: decodeSearchConfig })
|
|
440
536
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
441
537
|
name: "settings.section", id: "grok-auth", order: 45, label: () => t("nav"), locale: namespace,
|
|
442
|
-
inject: () => ({ connection: ctx.connection, t }),
|
|
538
|
+
inject: () => ({ connection: ctx.connection, t, searchSettings }),
|
|
443
539
|
}, GrokSettings))
|
|
444
540
|
}
|
|
445
541
|
module.exports.inject = inject
|
package/dist/host/index.mjs
CHANGED
|
@@ -28,14 +28,22 @@ import { createRuntimeDiagnostics } from "../internal/runtime-diagnostics.mjs"
|
|
|
28
28
|
export const name = "llm-grok"
|
|
29
29
|
export const inject = ["llm"]
|
|
30
30
|
|
|
31
|
-
export const Config = Schema.object({
|
|
31
|
+
export const Config = Schema.object({
|
|
32
|
+
webSearch: Schema.boolean().default(false).description("Allow xAI Web Search for regular Grok requests"),
|
|
33
|
+
xSearch: Schema.boolean().default(false).description("Allow xAI X Search for regular Grok requests"),
|
|
34
|
+
})
|
|
32
35
|
|
|
33
|
-
export function apply(ctx) {
|
|
36
|
+
export function apply(ctx, config) {
|
|
34
37
|
const platform = process.platform
|
|
35
38
|
if (platform !== "darwin" && platform !== "win32") {
|
|
36
39
|
throw new TypeError("dsh-grok-provider supports macOS and Windows")
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
const searchPolicy = Object.freeze({
|
|
43
|
+
webSearch: config.webSearch,
|
|
44
|
+
xSearch: config.xSearch,
|
|
45
|
+
})
|
|
46
|
+
|
|
39
47
|
const homeDir = os.homedir()
|
|
40
48
|
let refreshOfficialCredential
|
|
41
49
|
let inspectOfficialCli
|
|
@@ -65,6 +73,7 @@ export function apply(ctx) {
|
|
|
65
73
|
getGeneration,
|
|
66
74
|
getAttachmentStore: () => ctx.get("attachments"),
|
|
67
75
|
mapError: mapLlmError,
|
|
76
|
+
searchPolicy,
|
|
68
77
|
}),
|
|
69
78
|
})
|
|
70
79
|
const authController = createAuthController({
|