dsh-grok-provider 0.1.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/CHANGELOG.md +15 -0
- package/CONTRIBUTING.md +51 -0
- package/LICENSE +21 -0
- package/README.en.md +200 -0
- package/README.md +200 -0
- package/SECURITY.md +35 -0
- package/dist/client/client.js +215 -0
- package/dist/host/index.mjs +147 -0
- package/dist/internal/account-dashboard.mjs +67 -0
- package/dist/internal/auth-controller.mjs +184 -0
- package/dist/internal/auth-registry.mjs +64 -0
- package/dist/internal/auth-rpc.mjs +118 -0
- package/dist/internal/billing-summary.mjs +105 -0
- package/dist/internal/credential-source.mjs +168 -0
- package/dist/internal/grok-adapter.mjs +160 -0
- package/dist/internal/grok-command-handler.mjs +62 -0
- package/dist/internal/grok-command.mjs +17 -0
- package/dist/internal/grok-transport.mjs +279 -0
- package/dist/internal/model-catalog.mjs +142 -0
- package/dist/internal/official-auth-driver.mjs +40 -0
- package/dist/internal/official-cli-auth.mjs +231 -0
- package/dist/internal/official-cli-verifier.mjs +62 -0
- package/dist/internal/official-credential-loader.mjs +64 -0
- package/dist/internal/provider-runtime.mjs +43 -0
- package/dist/internal/responses-codec.mjs +357 -0
- package/dist/internal/responses-request.mjs +246 -0
- package/dist/internal/responses-sse.mjs +123 -0
- package/docs/01-product-requirements.md +128 -0
- package/docs/02-architecture-options.md +180 -0
- package/docs/03-security-threat-model.md +243 -0
- package/docs/04-harness-contract.md +325 -0
- package/docs/05-test-plan.md +224 -0
- package/docs/06-release-plan.md +182 -0
- package/docs/07-decision-gate.md +76 -0
- package/docs/08-upstream-cli-1.0.5-evidence.md +98 -0
- package/docs/09-implementation-status.md +37 -0
- package/docs/README.md +60 -0
- package/docs/adr/0001-auth-and-transport-route.md +86 -0
- package/docs/adr/0002-v0.1-scope.md +46 -0
- package/docs/adr/0003-dual-authentication.md +77 -0
- package/docs/adr/0004-dynamic-model-catalog.md +34 -0
- package/docs/adr/0005-official-cli-only-authentication.md +36 -0
- package/docs/adr/0006-account-dashboard.md +84 -0
- package/grok-provider.patch.yml +3 -0
- package/package.json +92 -0
- package/types/index.d.ts +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 - Unreleased
|
|
4
|
+
|
|
5
|
+
- Clean-room Grok Build provider for DeepSeek Harness `0.1.1-rc.2`.
|
|
6
|
+
- Dynamic discovery of every account-visible Responses model.
|
|
7
|
+
- Streaming text, reasoning, encrypted reasoning replay, tools, usage, and finish reasons.
|
|
8
|
+
- Official Grok CLI browser OAuth on macOS arm64 and Windows x64; the CLI owns token persistence.
|
|
9
|
+
- Single authentication path with no embedded OAuth client identity, client secret, or plugin-managed refresh token.
|
|
10
|
+
- Single-flight renewal delegates expired official credentials to the verified Grok CLI `models` command; the plugin never executes an OAuth refresh grant itself.
|
|
11
|
+
- Loopback-only Web settings and a closed `/grok` TUI command surface.
|
|
12
|
+
- Responsive Web account dashboard with live Grok Build billing-period reset data and dynamic model capability cards; complete typed periods recover proto3-omitted zero usage while ambiguous missing percentages remain unknown.
|
|
13
|
+
- Community-oriented Simplified Chinese default `README.md` and English `README.en.md`, plus contribution and private security-reporting guidance; all are included in the npm artifact.
|
|
14
|
+
- Windows x64 code path is included but remains real-device unverified until the documented post-release `0.1.0` validation.
|
|
15
|
+
- Export package metadata for the Harness rc.2 Web client-module scanner and report credential readiness only after validating the official credential source.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# 贡献指南 / Contributing Guide
|
|
2
|
+
|
|
3
|
+
感谢你帮助改进 `dsh-grok-provider`。项目优先保证凭据安全、协议准确和跨平台可维护性;小而可验证的变更比同时扩展多个边界的大改动更容易合并。
|
|
4
|
+
|
|
5
|
+
## 提交问题
|
|
6
|
+
|
|
7
|
+
提交 Bug 前请先确认问题在受支持版本中可复现,并提供:
|
|
8
|
+
|
|
9
|
+
- 操作系统与架构;
|
|
10
|
+
- `dsh`、Node.js、Grok CLI 和本插件的精确版本;
|
|
11
|
+
- 最小复现步骤、预期行为与实际行为;
|
|
12
|
+
- 已脱敏的错误码或必要日志片段;
|
|
13
|
+
- 问题发生在 Web、TUI 还是 headless profile。
|
|
14
|
+
|
|
15
|
+
不要提交 `auth.json`、access/refresh token、`user_id`、邮箱、姓名、完整提示词、工具参数、私人路径或未经检查的诊断包。安全问题遵循 [`SECURITY.md`](SECURITY.md),不要开公开 Issue。
|
|
16
|
+
|
|
17
|
+
## 变更流程
|
|
18
|
+
|
|
19
|
+
1. 阅读 [`docs/README.md`](docs/README.md) 和与改动相关的 ADR。
|
|
20
|
+
2. 先写或更新测试,保持变更范围单一。
|
|
21
|
+
3. 认证、凭据、固定 endpoint、模型协议或发布边界变化时,先更新 ADR、威胁模型和测试计划。
|
|
22
|
+
4. 同步维护 `README.md` 与 `README.en.md` 的用户可见信息。
|
|
23
|
+
5. 运行验证:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm ci --ignore-scripts
|
|
27
|
+
npm test
|
|
28
|
+
npm run pack:check
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Pull Request 检查表
|
|
32
|
+
|
|
33
|
+
- [ ] 变更解决一个清晰的问题,没有无关重构或格式化噪音;
|
|
34
|
+
- [ ] 新行为有针对性测试,错误路径失败关闭;
|
|
35
|
+
- [ ] 没有新增 token、账号数据、真实响应、机器路径或日志 fixture;
|
|
36
|
+
- [ ] 没有增加普通 runtime dependency;如确有必要,PR 解释原因、体积与供应链影响;
|
|
37
|
+
- [ ] 中英文 README、CHANGELOG 和相关 `docs/` 已同步;
|
|
38
|
+
- [ ] `npm test` 与 `npm run pack:check` 通过;
|
|
39
|
+
- [ ] Windows 专用行为有自动化覆盖,并清楚标注是否完成真机验证。
|
|
40
|
+
|
|
41
|
+
## 设计原则
|
|
42
|
+
|
|
43
|
+
- 模型能力来自动态目录,不通过隐藏未知模型制造“全部支持”的假象。
|
|
44
|
+
- Renderer、RPC 与错误信息不接触凭据或身份数据。
|
|
45
|
+
- 只允许固定官方网络目标,拒绝用户配置任意 base URL 和认证重定向。
|
|
46
|
+
- 使用官方 CLI 的登录与持久化,不复制 refresh token 或实现第二套 OAuth 存储。
|
|
47
|
+
- 未知协议和不完整数据保持未知或失败关闭,不猜测安全关键值。
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
English summary: include exact versions, a minimal reproduction, and redacted diagnostics in bug reports. Never post credentials or personal data. Keep PRs focused, add tests first, update design/security documents for boundary changes, keep both READMEs synchronized, and run `npm test` plus `npm run pack:check` before submission.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 YukiRyou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# dsh-grok-provider
|
|
2
|
+
|
|
3
|
+
[简体中文](README.md) | [English](README.en.md)
|
|
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.
|
|
6
|
+
|
|
7
|
+
> Unofficial community project; not affiliated with xAI or DeepSeek Harness. `0.1.0` has not been published to npm, so the registry installation command below is not available yet. Windows x64 is code-supported, with its first real-device validation scheduled after the initial release.
|
|
8
|
+
|
|
9
|
+
## What it provides
|
|
10
|
+
|
|
11
|
+
| Capability | Current implementation |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| Sign-in | Invokes official `grok login --oauth`; the plugin does not implement an OAuth grant |
|
|
14
|
+
| Credentials | Reuses official CLI session state without creating a second token store |
|
|
15
|
+
| Models | Discovers every model visible to the account at runtime; no static model allowlist |
|
|
16
|
+
| Conversations | Streaming Responses text, reasoning, encrypted reasoning replay, usage, and finish reasons |
|
|
17
|
+
| Tools | Returns function calls to the Harness permission layer; the provider never executes tools |
|
|
18
|
+
| Account dashboard | Login status, weekly/monthly quota, reset time, dynamic model capabilities and reasoning efforts |
|
|
19
|
+
| Surfaces | Bilingual Web settings and a closed `/grok` TUI command set |
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
### 1. Prerequisites
|
|
24
|
+
|
|
25
|
+
- DeepSeek Harness `0.1.1-rc.2`
|
|
26
|
+
- Node.js `24.19.0` or newer
|
|
27
|
+
- macOS arm64 or Windows x64
|
|
28
|
+
- Official Grok Build CLI `1.0.5 (5115b46bc909)`
|
|
29
|
+
|
|
30
|
+
Install the CLI from the [official Grok Build documentation](https://docs.x.ai/build/overview), then verify:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
grok --version
|
|
34
|
+
grok models
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The official CLI opens a browser on first use. The provider supports only the official default `~/.grok` directory (`%USERPROFILE%\.grok` on Windows).
|
|
38
|
+
|
|
39
|
+
### 2. Install the provider
|
|
40
|
+
|
|
41
|
+
After `0.1.0` is released, install the exact version:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
dsh plugin --profile web add dsh-grok-provider@0.1.0
|
|
45
|
+
dsh web
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Pre-release acceptance installs only a verified local tarball:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
dsh plugin --profile web add ./dsh-grok-provider-0.1.0.tgz
|
|
52
|
+
dsh web
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Sign in and select a model
|
|
56
|
+
|
|
57
|
+
Open **Settings → Grok Build**:
|
|
58
|
+
|
|
59
|
+
1. Select “Sign in with Grok.”
|
|
60
|
+
2. Complete authorization in the page opened by the official Grok CLI.
|
|
61
|
+
3. Return to Harness and refresh the account dashboard.
|
|
62
|
+
4. Select any account-visible Grok model from the model picker.
|
|
63
|
+
|
|
64
|
+
The provider does not take over the login page or ask you to paste an access or refresh token.
|
|
65
|
+
|
|
66
|
+
## User surfaces
|
|
67
|
+
|
|
68
|
+
The Web settings page shows:
|
|
69
|
+
|
|
70
|
+
- login state and sign-in, cancel, and logout actions;
|
|
71
|
+
- used/remaining quota and the real billing-period reset time;
|
|
72
|
+
- account-visible models, context windows, reasoning efforts, streaming and tool capabilities.
|
|
73
|
+
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
TUI commands:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/grok status
|
|
80
|
+
/grok login
|
|
81
|
+
/grok cancel
|
|
82
|
+
/grok logout
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
These commands never enter model context. Logout requires confirmation because it invokes official `grok logout` and affects other clients sharing the same Grok home.
|
|
86
|
+
|
|
87
|
+
## Update and uninstall
|
|
88
|
+
|
|
89
|
+
Update after release:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
dsh plugin --profile web update dsh-grok-provider
|
|
93
|
+
dsh web
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Uninstall:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
dsh plugin --profile web remove dsh-grok-provider
|
|
100
|
+
dsh web
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Uninstalling the provider does not remove the official Grok CLI or directly modify/delete `auth.json`.
|
|
104
|
+
|
|
105
|
+
## Compatibility and scope
|
|
106
|
+
|
|
107
|
+
| Item | `0.1.0` status |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| DeepSeek Harness | Exact support for `0.1.1-rc.2` |
|
|
110
|
+
| Node.js | `>=24.19.0` |
|
|
111
|
+
| macOS arm64 | Real-network and isolated Harness acceptance completed |
|
|
112
|
+
| Windows x64 | Code-supported; real-device validation after initial release |
|
|
113
|
+
| macOS x64 / Linux | Unsupported |
|
|
114
|
+
| Grok CLI | Exact support for `1.0.5 (5115b46bc909)` |
|
|
115
|
+
| Models | Every account catalog model whose backend has a strict codec in this release |
|
|
116
|
+
|
|
117
|
+
The initial release excludes image input, Web/X Search, arbitrary downloads, API-key mode, multiple accounts, enterprise OIDC, ACP, and Headless agent wrapping. See the complete [product requirements](docs/01-product-requirements.md).
|
|
118
|
+
|
|
119
|
+
## How it works
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
Harness UI / TUI
|
|
123
|
+
│ closed actions and redacted DTOs only
|
|
124
|
+
▼
|
|
125
|
+
dsh-grok-provider Host
|
|
126
|
+
├── Official Grok CLI: login / models / logout
|
|
127
|
+
├── Pinned Models/Billing endpoints: catalog and quota
|
|
128
|
+
└── Pinned Responses endpoint: streamed inference
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
xAI Grok Build
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Model IDs come from the runtime catalog rather than a hardcoded list. If an account exposes a new backend that cannot be mapped safely, discovery fails closed instead of hiding the model and claiming complete support.
|
|
135
|
+
|
|
136
|
+
## Security and privacy
|
|
137
|
+
|
|
138
|
+
- Model, catalog, and billing requests allow only compile-time pinned HTTPS origins/paths and reject redirects.
|
|
139
|
+
- Renderer and RPC code never receive tokens, `user_id`, credential paths, arbitrary URLs, or raw upstream responses.
|
|
140
|
+
- 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.
|
|
141
|
+
- Login subprocesses use fixed argv, a scrubbed environment, output limits, deadlines, cancellation, and no shell.
|
|
142
|
+
- Prompts and tool results are sent to the xAI Grok Build service; the provider itself does not log them.
|
|
143
|
+
|
|
144
|
+
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.
|
|
145
|
+
|
|
146
|
+
## Troubleshooting
|
|
147
|
+
|
|
148
|
+
### “Grok CLI not found”
|
|
149
|
+
|
|
150
|
+
Confirm the official CLI is in its default location and run `grok --version`. The provider will not load an executable from PATH, the workspace, or a UI-selected arbitrary path.
|
|
151
|
+
|
|
152
|
+
### The page asks you to sign in again
|
|
153
|
+
|
|
154
|
+
Use the settings button or run `grok login --oauth` in a terminal. If the official CLI has updated to an unverified version, the provider fails closed instead of bypassing version checks.
|
|
155
|
+
|
|
156
|
+
### A model is missing
|
|
157
|
+
|
|
158
|
+
Run `grok models` and verify that the same account can see it. The provider returns every valid catalog record; an unknown backend fails discovery rather than being silently filtered.
|
|
159
|
+
|
|
160
|
+
### Why is quota percentage unknown?
|
|
161
|
+
|
|
162
|
+
A protobuf-omitted zero is restored only with a complete typed period. In every other case the upstream response lacks enough information, so the provider preserves “unknown.” OAuth token expiry is never shown as a quota reset.
|
|
163
|
+
|
|
164
|
+
### Does Windows work?
|
|
165
|
+
|
|
166
|
+
Windows x64 code and automated tests are present, but the first Registry real-device acceptance for `0.1.0` happens after release. Until then it remains “code-supported, real-device unverified.”
|
|
167
|
+
|
|
168
|
+
## Development
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
npm ci --ignore-scripts
|
|
172
|
+
npm test
|
|
173
|
+
npm run pack:check
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The package has zero ordinary runtime dependencies; Harness services are exact peer dependencies. `npm run build` creates disposable `dist/` artifacts. The npm tarball excludes `src/`, tests, spikes, and local evidence.
|
|
177
|
+
|
|
178
|
+
Project map:
|
|
179
|
+
|
|
180
|
+
- [`docs/README.md`](docs/README.md): design-document index and current decisions;
|
|
181
|
+
- [`docs/04-harness-contract.md`](docs/04-harness-contract.md): Harness integration contract;
|
|
182
|
+
- [`docs/05-test-plan.md`](docs/05-test-plan.md): platform, security, and release gates;
|
|
183
|
+
- [`docs/09-implementation-status.md`](docs/09-implementation-status.md): implementation and acceptance status;
|
|
184
|
+
- [`CHANGELOG.md`](CHANGELOG.md): version history.
|
|
185
|
+
|
|
186
|
+
Read the [contributing guide](CONTRIBUTING.md) before filing an issue or PR. Changes to authentication, transport, credential formats, or release boundaries must update the relevant ADR/threat model before implementation and tests.
|
|
187
|
+
|
|
188
|
+
## Roadmap
|
|
189
|
+
|
|
190
|
+
- [x] Official CLI browser login, dynamic model catalog, and Responses streaming
|
|
191
|
+
- [x] Web/TUI account controls, quota dashboard, and model capability display
|
|
192
|
+
- [ ] Publish `0.1.0` and verify Registry integrity/provenance
|
|
193
|
+
- [ ] Complete the first Windows x64 real-device acceptance after release
|
|
194
|
+
- [ ] Evaluate additional content types and platforms only against verified Harness/xAI contracts
|
|
195
|
+
|
|
196
|
+
The roadmap is not a compatibility promise; every new capability must pass the documented design and security gates.
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
[MIT](LICENSE)
|
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# dsh-grok-provider
|
|
2
|
+
|
|
3
|
+
[简体中文](README.md) | [English](README.en.md)
|
|
4
|
+
|
|
5
|
+
让 DeepSeek Harness 使用你已登录的官方 Grok Build 账号:动态模型发现、流式推理、工具调用,以及账号额度与模型能力面板。
|
|
6
|
+
|
|
7
|
+
> 非官方社区项目,与 xAI 或 DeepSeek Harness 官方无隶属关系。`0.1.0` 尚未发布到 npm;请勿把下面的 Registry 安装命令理解为已经可用。Windows x64 已完成代码支持,首次真机验证安排在首版发布后。
|
|
8
|
+
|
|
9
|
+
## 它解决什么问题
|
|
10
|
+
|
|
11
|
+
| 能力 | 当前实现 |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| 登录 | 调用官方 `grok login --oauth` 打开浏览器;插件不实现 OAuth grant |
|
|
14
|
+
| 凭据 | 复用官方 CLI 的登录状态;插件不创建第二份 token 存储 |
|
|
15
|
+
| 模型 | 运行时读取账号可见的全部 Grok Build 模型,不维护静态模型白名单 |
|
|
16
|
+
| 对话 | Responses 流式文本、reasoning、加密 reasoning replay、usage 与 finish reason |
|
|
17
|
+
| 工具 | 将 function call 交回 Harness 权限层;Provider 本身不执行工具 |
|
|
18
|
+
| 账户面板 | 登录状态、每周/月额度、重置时间、动态模型能力与 reasoning 档位 |
|
|
19
|
+
| 界面 | Web 设置页中英文切换;TUI 提供闭合的 `/grok` 命令 |
|
|
20
|
+
|
|
21
|
+
## 快速开始
|
|
22
|
+
|
|
23
|
+
### 1. 准备环境
|
|
24
|
+
|
|
25
|
+
- DeepSeek Harness `0.1.1-rc.2`
|
|
26
|
+
- Node.js `24.19.0` 或更高版本
|
|
27
|
+
- macOS arm64 或 Windows x64
|
|
28
|
+
- 官方 Grok Build CLI `1.0.5 (5115b46bc909)`
|
|
29
|
+
|
|
30
|
+
请从 [Grok Build 官方文档](https://docs.x.ai/build/overview) 安装 CLI,并先确认:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
grok --version
|
|
34
|
+
grok models
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
首次运行 Grok CLI 会打开浏览器登录。插件只支持官方默认的 `~/.grok`(Windows 为 `%USERPROFILE%\.grok`)目录。
|
|
38
|
+
|
|
39
|
+
### 2. 安装 Provider
|
|
40
|
+
|
|
41
|
+
`0.1.0` 正式发布后,安装精确版本:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
dsh plugin --profile web add dsh-grok-provider@0.1.0
|
|
45
|
+
dsh web
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
发布前验收只安装经过校验的本地 tarball:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
dsh plugin --profile web add ./dsh-grok-provider-0.1.0.tgz
|
|
52
|
+
dsh web
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. 登录并选择模型
|
|
56
|
+
|
|
57
|
+
打开 **设置 → Grok Build**:
|
|
58
|
+
|
|
59
|
+
1. 点击“使用 Grok 登录”;
|
|
60
|
+
2. 在官方 Grok CLI 打开的浏览器页面完成授权;
|
|
61
|
+
3. 返回 Harness,刷新账户面板;
|
|
62
|
+
4. 在模型选择器中选择当前账号可见的 Grok 模型。
|
|
63
|
+
|
|
64
|
+
插件不会接管登录页面,也不会要求粘贴 access token 或 refresh token。
|
|
65
|
+
|
|
66
|
+
## 使用界面
|
|
67
|
+
|
|
68
|
+
Web 设置页展示:
|
|
69
|
+
|
|
70
|
+
- 当前登录状态及登录、取消、退出操作;
|
|
71
|
+
- 已使用/剩余额度和真实周期重置时间;
|
|
72
|
+
- 当前账号可见模型、上下文窗口、reasoning 档位、streaming 与 tool capability。
|
|
73
|
+
|
|
74
|
+
当 protobuf-backed billing 返回完整的 weekly/monthly 周期但省略零值百分比时,页面会恢复为“已使用 0% / 剩余 100%”;其他不完整响应保持未知,不伪造额度。
|
|
75
|
+
|
|
76
|
+
TUI 命令:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/grok status
|
|
80
|
+
/grok login
|
|
81
|
+
/grok cancel
|
|
82
|
+
/grok logout
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
这些命令不会进入模型上下文。退出操作需要二次确认,因为它会调用官方 `grok logout`,并影响共享同一 Grok home 的其他客户端。
|
|
86
|
+
|
|
87
|
+
## 更新与卸载
|
|
88
|
+
|
|
89
|
+
正式发布后更新:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
dsh plugin --profile web update dsh-grok-provider
|
|
93
|
+
dsh web
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
卸载:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
dsh plugin --profile web remove dsh-grok-provider
|
|
100
|
+
dsh web
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
卸载插件不会删除官方 Grok CLI,也不会直接修改或删除 `auth.json`。
|
|
104
|
+
|
|
105
|
+
## 兼容性与范围
|
|
106
|
+
|
|
107
|
+
| 项目 | `0.1.0` 状态 |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| DeepSeek Harness | 精确支持 `0.1.1-rc.2` |
|
|
110
|
+
| Node.js | `>=24.19.0` |
|
|
111
|
+
| macOS arm64 | 已完成真实网络与隔离 Harness 验收 |
|
|
112
|
+
| Windows x64 | 代码支持;首版发布后真机验证 |
|
|
113
|
+
| macOS x64 / Linux | 不支持 |
|
|
114
|
+
| Grok CLI | 精确支持 `1.0.5 (5115b46bc909)` |
|
|
115
|
+
| 模型 | 当前账号目录中 backend 已被严格 codec 支持的全部模型 |
|
|
116
|
+
|
|
117
|
+
首版不包含图片输入、Web/X Search、任意文件下载、API Key 模式、多账号、企业 OIDC、ACP 或 Headless agent 封装。完整范围见[产品需求](docs/01-product-requirements.md)。
|
|
118
|
+
|
|
119
|
+
## 工作原理
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
Harness UI / TUI
|
|
123
|
+
│ 仅发送闭合操作与脱敏 DTO
|
|
124
|
+
▼
|
|
125
|
+
dsh-grok-provider Host
|
|
126
|
+
├── 官方 Grok CLI:login / models / logout
|
|
127
|
+
├── 固定 Models/Billing endpoint:目录与额度
|
|
128
|
+
└── 固定 Responses endpoint:流式推理
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
xAI Grok Build
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
模型 ID 来自运行时目录,不是硬编码列表。如果账号出现当前版本无法安全映射的新 backend,发现过程会失败关闭,而不是隐藏模型后宣称“全部支持”。
|
|
135
|
+
|
|
136
|
+
## 安全与隐私
|
|
137
|
+
|
|
138
|
+
- 模型、目录和计费请求只允许编译时固定的 HTTPS origin/path,并拒绝重定向。
|
|
139
|
+
- Renderer 和 RPC 不接收 token、`user_id`、凭据路径、任意 URL 或原始上游响应。
|
|
140
|
+
- 插件不实现 refresh grant;凭据临近过期时,只能有界调用一次官方 `grok models`,再重新读取并验证官方文件。
|
|
141
|
+
- 登录子进程使用固定 argv、过滤后的环境、输出上限、deadline 与取消处理,不通过 shell 启动。
|
|
142
|
+
- 提示词和工具结果会发送给 xAI Grok Build 服务;插件本身不把它们写入日志。
|
|
143
|
+
|
|
144
|
+
完整边界见[威胁模型](docs/03-security-threat-model.md)。发现安全问题时,请阅读[安全策略](SECURITY.md),不要在公开 Issue 中提交 token、`auth.json`、个人信息或完整诊断日志。
|
|
145
|
+
|
|
146
|
+
## 常见问题
|
|
147
|
+
|
|
148
|
+
### 页面显示“找不到 Grok CLI”
|
|
149
|
+
|
|
150
|
+
确认官方 CLI 位于默认路径,并在终端执行 `grok --version`。插件不会从 PATH、工作区或 UI 指定的任意路径加载可执行文件。
|
|
151
|
+
|
|
152
|
+
### 页面要求重新登录
|
|
153
|
+
|
|
154
|
+
在设置页点击登录,或先在终端运行 `grok login --oauth`。如果官方 CLI 已更新到未验证版本,插件会失败关闭,而不是跳过版本检查。
|
|
155
|
+
|
|
156
|
+
### 没有看到某个模型
|
|
157
|
+
|
|
158
|
+
先运行 `grok models`,确认该模型对同一账号可见。Provider 动态返回全部合法目录记录;未知 backend 会让发现失败,而不会被静默过滤。
|
|
159
|
+
|
|
160
|
+
### 为什么额度百分比显示未知
|
|
161
|
+
|
|
162
|
+
完整类型化周期下缺失的 protobuf 零值会恢复为 0%;其他情况下,上游没有提供足够信息,插件会保留未知。OAuth token 过期时间绝不会冒充额度刷新时间。
|
|
163
|
+
|
|
164
|
+
### Windows 能用吗
|
|
165
|
+
|
|
166
|
+
代码和自动测试覆盖 Windows x64,但 `0.1.0` 首次 Registry 真机验收将在发布后完成;在此之前按“代码支持、真机未验证”处理。
|
|
167
|
+
|
|
168
|
+
## 开发
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
npm ci --ignore-scripts
|
|
172
|
+
npm test
|
|
173
|
+
npm run pack:check
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
该包没有普通 runtime dependency;Harness services 使用精确 peer dependency。`npm run build` 生成可丢弃的 `dist/`,npm tarball 不包含 `src/`、测试、spike 或本机证据。
|
|
177
|
+
|
|
178
|
+
项目导航:
|
|
179
|
+
|
|
180
|
+
- [`docs/README.md`](docs/README.md):设计文档索引与当前决策;
|
|
181
|
+
- [`docs/04-harness-contract.md`](docs/04-harness-contract.md):Harness 集成契约;
|
|
182
|
+
- [`docs/05-test-plan.md`](docs/05-test-plan.md):平台、安全与发行门禁;
|
|
183
|
+
- [`docs/09-implementation-status.md`](docs/09-implementation-status.md):实现与验收状态;
|
|
184
|
+
- [`CHANGELOG.md`](CHANGELOG.md):版本变化。
|
|
185
|
+
|
|
186
|
+
提交 Issue 或 PR 前请阅读[贡献指南](CONTRIBUTING.md)。认证、传输、凭据格式或发布边界的变化必须先更新对应 ADR/威胁模型,再开发和测试。
|
|
187
|
+
|
|
188
|
+
## 路线图
|
|
189
|
+
|
|
190
|
+
- [x] 官方 CLI 浏览器登录、动态模型目录和 Responses 流
|
|
191
|
+
- [x] Web/TUI 账户控制、额度面板与模型能力展示
|
|
192
|
+
- [ ] 发布 `0.1.0` 并完成 Registry/provenance 回读
|
|
193
|
+
- [ ] 发布后完成 Windows x64 首次真机验收
|
|
194
|
+
- [ ] 根据已验证的 Harness/xAI 协议逐项评估更多内容类型和平台
|
|
195
|
+
|
|
196
|
+
路线图不是兼容性承诺;新增能力必须通过文档决策与安全门禁。
|
|
197
|
+
|
|
198
|
+
## 许可证
|
|
199
|
+
|
|
200
|
+
[MIT](LICENSE)
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# 安全策略 / Security Policy
|
|
2
|
+
|
|
3
|
+
`dsh-grok-provider` 处理官方 Grok CLI 的本机会话,并把模型请求发送到固定的 xAI Grok Build 服务,因此凭据泄漏、任意 endpoint、重定向、命令执行和解析器绕过都属于高优先级安全问题。
|
|
4
|
+
|
|
5
|
+
## 支持范围
|
|
6
|
+
|
|
7
|
+
项目尚处于 `0.1.0` 预发布阶段。正式发布后,仅维护当前发布线中明确列出的 DeepSeek Harness、Node.js、操作系统和 Grok CLI 精确版本;未经验证的版本会失败关闭。
|
|
8
|
+
|
|
9
|
+
## 私下报告漏洞
|
|
10
|
+
|
|
11
|
+
请优先使用公开仓库启用后的 GitHub **Private vulnerability reporting**。如果该入口暂不可用,请只创建一个不含技术细节、凭据或个人信息的公开联络 Issue,请维护者提供私下沟通渠道。
|
|
12
|
+
|
|
13
|
+
报告应包含:
|
|
14
|
+
|
|
15
|
+
- 受影响的精确版本与平台;
|
|
16
|
+
- 最小复现条件和安全影响;
|
|
17
|
+
- 已脱敏的请求/响应形状或错误码;
|
|
18
|
+
- 建议修复方向(如有)。
|
|
19
|
+
|
|
20
|
+
绝对不要发送真实 `auth.json`、access/refresh token、`user_id`、Cookie、邮箱、姓名、完整提示词、工具参数或包含这些数据的诊断包。若秘密已暴露,请先通过官方 Grok CLI 注销/重新登录并按相应服务流程撤销凭据。
|
|
21
|
+
|
|
22
|
+
## 不属于漏洞的情况
|
|
23
|
+
|
|
24
|
+
- Windows x64 在首次发布前尚未完成真机验证这一已披露状态;
|
|
25
|
+
- 上游未提供额度字段时 UI 显示 unknown;
|
|
26
|
+
- 不受支持的 CLI/Harness/平台版本被明确拒绝;
|
|
27
|
+
- 官方 CLI 或 xAI 服务自身的行为,且无法由本插件边界缓解的问题。
|
|
28
|
+
|
|
29
|
+
## 披露原则
|
|
30
|
+
|
|
31
|
+
维护者会先确认报告是否可复现和是否落在本项目边界内,再协调修复与发布。请在修复版本可用前避免公开可直接利用的细节。
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
English summary: use GitHub Private vulnerability reporting when available. If it is unavailable, open only a detail-free contact issue. Never publish or send real credentials, identity data, prompts, tool arguments, cookies, or unreviewed diagnostic archives. Include exact versions, platform, minimal reproduction conditions, impact, and redacted evidence.
|