dsh-coding-subscription-oauth 0.5.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 +136 -0
- package/CONTRIBUTING.md +109 -0
- package/INSTALL.md +220 -0
- package/LICENSE +19 -0
- package/NOTICE +11 -0
- package/README.de.md +254 -0
- package/README.es.md +254 -0
- package/README.fr.md +254 -0
- package/README.ja.md +254 -0
- package/README.ko.md +254 -0
- package/README.md +286 -0
- package/README.pt-BR.md +254 -0
- package/README.ru.md +254 -0
- package/README.zh-CN.md +271 -0
- package/cordis.patch.yml +13 -0
- package/docs/00-project-rules.md +195 -0
- package/docs/02-architecture.md +132 -0
- package/docs/02-architecture.zh-CN.md +128 -0
- package/lib/adapter.d.ts +24 -0
- package/lib/adapter.d.ts.map +1 -0
- package/lib/alias-adapter.d.ts +43 -0
- package/lib/alias-adapter.d.ts.map +1 -0
- package/lib/auth-routes.d.ts +155 -0
- package/lib/auth-routes.d.ts.map +1 -0
- package/lib/auth.d.ts +29 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/bin.d.ts +6 -0
- package/lib/bin.d.ts.map +1 -0
- package/lib/bin.js +27591 -0
- package/lib/bin.js.map +7 -0
- package/lib/capability-routes.d.ts +43 -0
- package/lib/capability-routes.d.ts.map +1 -0
- package/lib/capability-runtime.d.ts +56 -0
- package/lib/capability-runtime.d.ts.map +1 -0
- package/lib/capability-settings.d.ts +263 -0
- package/lib/capability-settings.d.ts.map +1 -0
- package/lib/capability-tools.d.ts +50 -0
- package/lib/capability-tools.d.ts.map +1 -0
- package/lib/catalog.d.ts +53 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/client.js +3 -0
- package/lib/client.js.map +7 -0
- package/lib/codex-http.d.ts +77 -0
- package/lib/codex-http.d.ts.map +1 -0
- package/lib/codex-images.d.ts +109 -0
- package/lib/codex-images.d.ts.map +1 -0
- package/lib/codex-model-capabilities.d.ts +112 -0
- package/lib/codex-model-capabilities.d.ts.map +1 -0
- package/lib/codex-search.d.ts +96 -0
- package/lib/codex-search.d.ts.map +1 -0
- package/lib/codex-usage.d.ts +79 -0
- package/lib/codex-usage.d.ts.map +1 -0
- package/lib/gateway-anthropic-messages.d.ts +8 -0
- package/lib/gateway-anthropic-messages.d.ts.map +1 -0
- package/lib/gateway-auth.d.ts +22 -0
- package/lib/gateway-auth.d.ts.map +1 -0
- package/lib/gateway-backend.d.ts +62 -0
- package/lib/gateway-backend.d.ts.map +1 -0
- package/lib/gateway-body.d.ts +9 -0
- package/lib/gateway-body.d.ts.map +1 -0
- package/lib/gateway-config.d.ts +24 -0
- package/lib/gateway-config.d.ts.map +1 -0
- package/lib/gateway-http.d.ts +16 -0
- package/lib/gateway-http.d.ts.map +1 -0
- package/lib/gateway-openai-chat.d.ts +8 -0
- package/lib/gateway-openai-chat.d.ts.map +1 -0
- package/lib/gateway-openai-responses.d.ts +8 -0
- package/lib/gateway-openai-responses.d.ts.map +1 -0
- package/lib/gateway-parse.d.ts +10 -0
- package/lib/gateway-parse.d.ts.map +1 -0
- package/lib/gateway-protocol.d.ts +47 -0
- package/lib/gateway-protocol.d.ts.map +1 -0
- package/lib/gateway-routes.d.ts +21 -0
- package/lib/gateway-routes.d.ts.map +1 -0
- package/lib/gateway.d.ts +48 -0
- package/lib/gateway.d.ts.map +1 -0
- package/lib/grok-imagine.d.ts +271 -0
- package/lib/grok-imagine.d.ts.map +1 -0
- package/lib/grok-import.d.ts +21 -0
- package/lib/grok-import.d.ts.map +1 -0
- package/lib/http-json.d.ts +10 -0
- package/lib/http-json.d.ts.map +1 -0
- package/lib/ids.d.ts +33 -0
- package/lib/ids.d.ts.map +1 -0
- package/lib/imagine-routes.d.ts +59 -0
- package/lib/imagine-routes.d.ts.map +1 -0
- package/lib/index.d.ts +69 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +35355 -0
- package/lib/index.js.map +7 -0
- package/lib/invariant.d.ts +9 -0
- package/lib/invariant.d.ts.map +1 -0
- package/lib/invariant.js +14 -0
- package/lib/invariant.js.map +7 -0
- package/lib/kimi-errors.d.ts +13 -0
- package/lib/kimi-errors.d.ts.map +1 -0
- package/lib/media-store.d.ts +130 -0
- package/lib/media-store.d.ts.map +1 -0
- package/lib/oauth-import-routes.d.ts +52 -0
- package/lib/oauth-import-routes.d.ts.map +1 -0
- package/lib/oauth-providers.d.ts +26 -0
- package/lib/oauth-providers.d.ts.map +1 -0
- package/lib/oauth-session.d.ts +40 -0
- package/lib/oauth-session.d.ts.map +1 -0
- package/lib/oauth-sources.d.ts +205 -0
- package/lib/oauth-sources.d.ts.map +1 -0
- package/lib/oauth.d.ts +79 -0
- package/lib/oauth.d.ts.map +1 -0
- package/lib/provider.d.ts +38 -0
- package/lib/provider.d.ts.map +1 -0
- package/lib/proxy.d.ts +17 -0
- package/lib/proxy.d.ts.map +1 -0
- package/lib/redact.d.ts +5 -0
- package/lib/redact.d.ts.map +1 -0
- package/lib/session.d.ts +40 -0
- package/lib/session.d.ts.map +1 -0
- package/lib/store.d.ts +46 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/web-origin.d.ts +10 -0
- package/lib/web-origin.d.ts.map +1 -0
- package/lib/web-routes.d.ts +20 -0
- package/lib/web-routes.d.ts.map +1 -0
- package/package.json +185 -0
- package/patches/dsh-agy@0.1.2.patch +25 -0
- package/scripts/release.mjs +166 -0
- package/scripts/smoke-deployed-routes.mjs +146 -0
- package/scripts/verify-deployed-catalog.mjs +87 -0
- package/src/adapter.ts +282 -0
- package/src/alias-adapter.ts +152 -0
- package/src/auth-routes.ts +871 -0
- package/src/auth.ts +67 -0
- package/src/bin.ts +350 -0
- package/src/capability-routes.ts +275 -0
- package/src/capability-runtime.ts +313 -0
- package/src/capability-settings.ts +657 -0
- package/src/capability-tools.ts +666 -0
- package/src/catalog.ts +271 -0
- package/src/client/GrokBuildSettings.tsx +2221 -0
- package/src/client/index.tsx +37 -0
- package/src/client/locales.ts +421 -0
- package/src/codex-http.ts +447 -0
- package/src/codex-images.ts +485 -0
- package/src/codex-model-capabilities.ts +320 -0
- package/src/codex-search.ts +245 -0
- package/src/codex-usage.ts +263 -0
- package/src/gateway-anthropic-messages.ts +84 -0
- package/src/gateway-auth.ts +100 -0
- package/src/gateway-backend.ts +274 -0
- package/src/gateway-body.ts +49 -0
- package/src/gateway-config.ts +76 -0
- package/src/gateway-http.ts +104 -0
- package/src/gateway-openai-chat.ts +124 -0
- package/src/gateway-openai-responses.ts +53 -0
- package/src/gateway-parse.ts +224 -0
- package/src/gateway-protocol.ts +52 -0
- package/src/gateway-routes.ts +152 -0
- package/src/gateway.ts +242 -0
- package/src/grok-imagine.ts +1627 -0
- package/src/grok-import.ts +151 -0
- package/src/http-json.ts +82 -0
- package/src/ids.ts +45 -0
- package/src/imagine-routes.ts +461 -0
- package/src/index.ts +598 -0
- package/src/invariant.ts +17 -0
- package/src/kimi-errors.ts +26 -0
- package/src/media-store.ts +927 -0
- package/src/oauth-import-routes.ts +314 -0
- package/src/oauth-providers.ts +152 -0
- package/src/oauth-session.ts +183 -0
- package/src/oauth-sources.ts +1104 -0
- package/src/oauth.ts +620 -0
- package/src/provider.ts +128 -0
- package/src/proxy.ts +99 -0
- package/src/redact.ts +72 -0
- package/src/session.ts +218 -0
- package/src/store.ts +217 -0
- package/src/web-origin.ts +60 -0
- package/src/web-routes.ts +75 -0
package/README.ko.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
|
|
2
|
+
<!-- banner -->
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
# 🔐 dsh-coding-subscription-oauth
|
|
6
|
+
|
|
7
|
+
**v0.5.0** · 이전 이름 `dsh-grok-build`
|
|
8
|
+
|
|
9
|
+
**[DeepSeek Harness](https://github.com/deepseek-ai/dsh)용 코딩 구독 OAuth 플러그인.** 이미 결제한 구독으로 한 번에 로그인하고, dsh 설정 페이지나 CLI에서 그 모델을 사용하세요. **채팅에 토큰을 붙여넣을 필요가 없습니다.**
|
|
10
|
+
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](CONTRIBUTING.md)
|
|
13
|
+
|
|
14
|
+
*[English](README.md) · [中文版](README.zh-CN.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Português (BR)](README.pt-BR.md) · [Español](README.es.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Русский](README.ru.md)*
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 이름 변경
|
|
21
|
+
|
|
22
|
+
처음에는 Grok Build 전용 **`dsh-grok-build`** 였습니다. 지금은 SuperGrok / Codex / Kimi / Claude / Antigravity 코딩 구독 OAuth입니다.
|
|
23
|
+
|
|
24
|
+
| | 이것을 쓰세요 | 계속 동작 |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| GitHub / `dsh plugin add` | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | `github:lninghaha/dsh-grok-build`(같은 `main`) |
|
|
27
|
+
| npm | 아직 게시되지 않음. GitHub에서 설치 | 레거시 npm 패키지는 게시된 적 없음 |
|
|
28
|
+
| CLI | `dsh-coding-oauth` | `dsh-grok-build` |
|
|
29
|
+
| Cordis 플러그인 id | `llm-grok-build-oauth` | 그대로 |
|
|
30
|
+
| 설정 페이지 HTTP API | `/plugins/dsh-grok-build/*` | 그대로 |
|
|
31
|
+
| 자격 증명 파일 | `$DSH_HOME/.grok-build-auth.json` 및 기타 `*-oauth-auth.json` | 그대로 |
|
|
32
|
+
|
|
33
|
+
## ✨ 기능
|
|
34
|
+
|
|
35
|
+
- 🧾 **내 구독 그대로 사용** — 별도 API key 없이 이미 결제한 코딩 플랜을 사용합니다.
|
|
36
|
+
- 🔑 **로컬 OAuth, 키 붙여넣기 불필요** — 설정 페이지나 CLI에서 인증하며, 토큰이 채팅에 들어가지 않습니다.
|
|
37
|
+
- 🧩 **하나의 플러그인, 다섯 프로바이더** — Grok Build, Codex, Kimi, Claude, Google Antigravity.
|
|
38
|
+
- 🛡️ **안전한 설계** — 인증 파일은 소유자 전용 `0600`, 원자적 쓰기, 크로스 프로세스 파일 잠금.
|
|
39
|
+
- ⚙️ **동적 카탈로그** — 모델 선택기에 인증을 완료한 프로바이더만 표시됩니다.
|
|
40
|
+
- 🌐 **프록시 인지형** — 검증된 신뢰 가능한 구독 도메인만 프록시합니다.
|
|
41
|
+
|
|
42
|
+
## 이 플러그인이 푸는 연동 문제
|
|
43
|
+
|
|
44
|
+
코딩 구독을 DSH에 붙일 때 아래 검색어·오류로 이 저장소에 오는 경우가 많습니다.
|
|
45
|
+
|
|
46
|
+
| 검색 / 화면 | 실제 원인 | 이 플러그인 |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| SuperGrok / X Premium를 DSH에, Grok Build vs `api.x.ai` | 내장 `xai`는 종량 API. 구독 추론은 `cli-chat-proxy.grok.com` | `grok-build` + CLI 지문 헤더(`X-XAI-Token-Auth` 등), 조용한 403 방지 |
|
|
49
|
+
| `API key is invalid` / `AUTH` | GUI는 모든 AUTH를 그 문구로 표시. 흔히 짧은 OAuth access token 만료 | 만료 **5분 전** refresh. 401이면 저장 토큰을 무효화하고 step 재시도 |
|
|
50
|
+
| Codex/Kimi 두 번째 턴 `INVALID_REPLAY_STATE` | replay가 pi-ai 네이티브 provider id를 유지 | Harness route id를 유지하고 오염된 replay를 복구 |
|
|
51
|
+
| grok-4.6에 **xhigh**가 없음 | `/v1/models-v2`의 `reasoning_efforts`를 버리고 4.5 템플릿을 복제 | live efforts를 `thinkingLevelMap`에 반영. 4.6은 xhigh, 4.5는 low/medium/high |
|
|
52
|
+
| Kimi Code가 Anthropic `x-api-key`로 나감 | OAuth token을 Anthropic 키로 전송 | `Authorization: Bearer`만 사용 |
|
|
53
|
+
| 로그인하지 않은 모델이 선택기에 남음 | 등록된 모든 라우트를 나열 | 미인증은 빈 목록. 인증됨은 `(OAuth)` |
|
|
54
|
+
| 원격/헤드리스에서 PKCE 불가 | localhost로 돌아올 수 없음 | Grok/Codex/Kimi는 디바이스 코드. Claude는 redirect URL 붙여넣기 |
|
|
55
|
+
| 프록시로 Grok은 되고 중국 Kimi는 죽음 | 전역 `HTTPS_PROXY` | 허용 도메인만. Kimi는 기본 직결(`proxyKimi: true`일 때만 프록시) |
|
|
56
|
+
|
|
57
|
+
## 지원 프로바이더
|
|
58
|
+
|
|
59
|
+
| 프로바이더 | 라우트 | 인증 | 기존 API-key 라우트와 공존 |
|
|
60
|
+
|---|---|---|---|
|
|
61
|
+
| **xAI Grok Build** | `grok-build` | SuperGrok / X Premium OAuth | `xai` |
|
|
62
|
+
| **OpenAI Codex** | `codex-oauth` | ChatGPT Plus/Pro OAuth | `openai` |
|
|
63
|
+
| **Kimi Code** | `kimi-code-oauth` | Kimi Code OAuth | `kimi-coding` |
|
|
64
|
+
| **Claude Code** | `claude-code-oauth` | Claude Pro/Max OAuth | — |
|
|
65
|
+
| **Google Antigravity** | `agy` | `dsh-agy` Google OAuth | — |
|
|
66
|
+
|
|
67
|
+
> Grok Build의 디바이스 로그인, 동적 `/v1/models-v2` 카탈로그, Responses 스트리밍 추론은 실제 배포에서 검증되었습니다. Codex/Kimi/Claude는 `@earendil-works/pi-ai`의 네이티브 OAuth/리프레시를 재사용하며 벤더 플로우를 재구현하지 않습니다.
|
|
68
|
+
|
|
69
|
+
## 🚀 빠른 시작
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# 1. web 프로필에 플러그인 설치
|
|
73
|
+
dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
|
|
74
|
+
|
|
75
|
+
# 2. 선택 사항 — Google Antigravity (검증된 고정 버전)
|
|
76
|
+
dsh plugin --profile web add dsh-agy@0.1.2
|
|
77
|
+
|
|
78
|
+
# 3. 상주하는 dsh web 서비스 재시작
|
|
79
|
+
systemctl --user restart dsh-web.service
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
그런 다음 **Settings → Coding OAuth**를 열고 원하는 프로바이더에 로그인하세요. 완료입니다 — 선택기에서 인증된 모델을 선택하면 됩니다.
|
|
83
|
+
|
|
84
|
+
## 📚 목차
|
|
85
|
+
|
|
86
|
+
- [이름 변경](#이름-변경)
|
|
87
|
+
- [이 플러그인이 푸는 연동 문제](#이-플러그인이-푸는-연동-문제)
|
|
88
|
+
- [설치](#설치)
|
|
89
|
+
- [설정 페이지](#설정-페이지)
|
|
90
|
+
- [CLI](#cli)
|
|
91
|
+
- [중국에서의 Kimi](#중국에서의-kimi)
|
|
92
|
+
- [네트워크 프록시](#네트워크-프록시)
|
|
93
|
+
- [복원력](#복원력)
|
|
94
|
+
- [자격 증명](#자격-증명)
|
|
95
|
+
- [아키텍처](#아키텍처)
|
|
96
|
+
- [기술 메모](#기술-메모)
|
|
97
|
+
- [준수](#준수)
|
|
98
|
+
- [문서](#문서)
|
|
99
|
+
- [기여](#기여)
|
|
100
|
+
- [라이선스](#라이선스)
|
|
101
|
+
|
|
102
|
+
## 설치
|
|
103
|
+
|
|
104
|
+
DeepSeek Harness `0.1.0-rc.6+` 및 Node.js 22.19+가 필요합니다. 자세한 내용은 [설치 노트](INSTALL.md)를 참조하세요.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# GitHub에서
|
|
108
|
+
dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
|
|
109
|
+
|
|
110
|
+
# 또는 로컬 개발 디렉터리에서
|
|
111
|
+
dsh plugin --profile web add ./dsh-coding-subscription-oauth
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
설치 후 `dsh web`을 재시작합니다. 실제 배포 검증:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm run verify:deployed # 실제 /api/llm.models + OAuth 상태 확인
|
|
118
|
+
DSH_EXPECT_AGY_AUTH=signed-in pnpm run verify:deployed # Google에 로그인된 경우
|
|
119
|
+
|
|
120
|
+
DSH_RESTORE_PROVIDER=openai \
|
|
121
|
+
DSH_RESTORE_MODEL=gpt-5.6-sol \
|
|
122
|
+
DSH_RESTORE_REASONING=max \
|
|
123
|
+
pnpm run smoke:deployed # 실제 Codex/Kimi 도구 호출 + 두 번째 사용자 turn 재생
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> `smoke:deployed`는 임시 세션을 만들고 Codex와 Kimi 도구 호출 및 두 번째 사용자 turn(`INVALID_REPLAY_STATE` 회귀)을 검증한 뒤 선언된 기본 모델을 복원하고 세션을 아카이브합니다.
|
|
127
|
+
|
|
128
|
+
## 설정 페이지
|
|
129
|
+
|
|
130
|
+
**Settings → Coding OAuth**를 열어 주세요:
|
|
131
|
+
|
|
132
|
+
| 프로바이더 | 방식 |
|
|
133
|
+
|---|---|
|
|
134
|
+
| Grok | 인증 코드 · 디바이스 코드 · Grok CLI import · 모델 선택 |
|
|
135
|
+
| Codex | 디바이스 코드(원격 DSH 권장) · 브라우저 PKCE |
|
|
136
|
+
| Kimi | 디바이스 코드 |
|
|
137
|
+
| Claude | 브라우저 PKCE(원격 브라우저는 전체 localhost redirect URL을 붙여넣기 가능) |
|
|
138
|
+
| Antigravity | `dsh-agy` 설치 상태 + profile-local CLI 명령 |
|
|
139
|
+
|
|
140
|
+
선택기는 인증을 완료한 라우트만 나열하며, 인증되지 않은 프로바이더는 빈 목록을 반환합니다. 프로바이더 이름에는 `(OAuth)`가 붙고, 로그인/아웃 후 `llm/adapters-updated`를 통해 카탈로그가 갱신됩니다.
|
|
141
|
+
|
|
142
|
+
## 선택적 기능
|
|
143
|
+
|
|
144
|
+
7개 스위치 `codexSearch`, `codexImages`, `codexImageEdits`, `codexUsage`, `codexFast`, `grokImagineImage`, `grokImagineVideo`는 모두 기본적으로 꺼져 있으며 재시작 없이 즉시 적용됩니다. 숫자 설정은 `searchResults`(1–20, 기본 5), `imageCount`(1–4, 기본 1), `videoArtifactTtlMs`(1시간–7일, 기본 7일, UI에서는 1–168시간)입니다. 보존 시간을 낮추면 기존 아티팩트도 즉시 단축·정리되며, 높인 값은 이후 생성된 아티팩트에만 적용됩니다.
|
|
145
|
+
|
|
146
|
+
## CLI
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# `dsh-grok-build` 는 같은 CLI 별칭
|
|
150
|
+
dsh-coding-oauth login [--pkce] | import | status | logout
|
|
151
|
+
|
|
152
|
+
# 최신 프로바이더
|
|
153
|
+
dsh-coding-oauth login codex --device-auth | codex --browser | kimi | claude
|
|
154
|
+
dsh-coding-oauth status all
|
|
155
|
+
dsh-coding-oauth logout codex
|
|
156
|
+
|
|
157
|
+
# Antigravity (먼저 web 프로필에 설치)
|
|
158
|
+
dsh plugin --profile web exec dsh-agy login --headless
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> `dsh-agy` CLI는 DSH 프로세스 밖에서 계정 풀을 수정하므로 프로세스 내 카탈로그 이벤트를 내보낼 수 없습니다 — 로그인/아웃 후 모델 선택기를 닫았다 다시 여세요.
|
|
162
|
+
|
|
163
|
+
## 중국에서의 Kimi
|
|
164
|
+
|
|
165
|
+
Kimi Code 구독 OAuth는 `https://auth.kimi.com`, 추론은 `https://api.kimi.com/coding`을 사용합니다. `https://api.moonshot.cn/v1`은 종량제 **Moonshot Open Platform** API-key 채널이며, 전환 가능한 "중국 OAuth 엔드포인트"는 없습니다. 이 플러그인은 별도 `kimi-code-oauth` 라우트를 사용하며 기존 `kimi-coding` API-key 설정에 영향을 주지 않습니다.
|
|
166
|
+
|
|
167
|
+
## 네트워크 프록시
|
|
168
|
+
|
|
169
|
+
우선순위: `config.proxy` → `CODING_OAUTH_PROXY` → `GROK_BUILD_PROXY` → `HTTPS_PROXY`/`HTTP_PROXY`.
|
|
170
|
+
|
|
171
|
+
```yaml
|
|
172
|
+
- id: llm-grok-build-oauth
|
|
173
|
+
config:
|
|
174
|
+
proxy: http://127.0.0.1:7890
|
|
175
|
+
proxyKimi: false
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
검증된 구독 도메인만 프록시됩니다(xAI/Grok, OpenAI Codex, Claude/Anthropic, Google Antigravity). 나머지 DSH 트래픽은 원래 디스패처를 유지합니다. Kimi는 기본적으로 직결이며 `proxyKimi: true`일 때만 프록시를 사용합니다.
|
|
179
|
+
|
|
180
|
+
## 복원력
|
|
181
|
+
|
|
182
|
+
OAuth 액세스 토큰은 저장된 만료 시각 **5분 전**에 선제적으로 갱신됩니다(pi-ai 0.84+). 업스트림이 로컬에서는 아직 유효한 토큰을 401/403으로 거절하면, 플러그인이 저장된 `expires`를 과거로 되돌리고 재시도 단계에서 먼저 갱신한 뒤 다시 요청합니다.
|
|
183
|
+
|
|
184
|
+
요청 재시도는 harness retry 정책을 따릅니다. 일시 오류(`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`)와 **`AUTH`**는 지수 백오프로 재시도합니다(기본 2회, 500 ms → 10 s, 10% jitter). 쿼터 소진과 죽은 refresh token은 재시도하지 않습니다. 배포별 재정의:
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
- id: llm-grok-build-oauth
|
|
188
|
+
config:
|
|
189
|
+
retryPolicy:
|
|
190
|
+
mode: normal
|
|
191
|
+
maxRetries: 2
|
|
192
|
+
retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
|
|
193
|
+
backoff: { initialDelayMs: 500, maxDelayMs: 10000, jitterRatio: 0.1 }
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 자격 증명
|
|
197
|
+
|
|
198
|
+
소유자 전용 `0600`, 원자적 쓰기, 크로스 프로세스 파일 잠금:
|
|
199
|
+
|
|
200
|
+
- `$DSH_HOME/.grok-build-auth.json`
|
|
201
|
+
- `$DSH_HOME/.codex-oauth-auth.json`
|
|
202
|
+
- `$DSH_HOME/.kimi-code-oauth-auth.json`
|
|
203
|
+
- `$DSH_HOME/.claude-code-oauth-auth.json`
|
|
204
|
+
|
|
205
|
+
선택 캐시는 해당 `*-models.json` 파일에 저장됩니다. **HTTP 상태, 로그, UI가 토큰을 반환해서는 안 됩니다.**
|
|
206
|
+
|
|
207
|
+
## 아키텍처
|
|
208
|
+
|
|
209
|
+
```mermaid
|
|
210
|
+
flowchart LR
|
|
211
|
+
subgraph DSH["DSH Harness"]
|
|
212
|
+
UI[설정 / Web · Coding OAuth] --> LLM[llm route]
|
|
213
|
+
LLM --> ALIA[라우트 별칭 어댑터]
|
|
214
|
+
end
|
|
215
|
+
ALIA --> PI[pi-ai 네이티브 프로바이더<br/>OAuth · 리프레시 · 스트림]
|
|
216
|
+
PI --> GROK[Grok Build]
|
|
217
|
+
PI --> COD[Codex]
|
|
218
|
+
PI --> KIMI[Kimi]
|
|
219
|
+
PI --> CLAU[Claude]
|
|
220
|
+
AGY[dsh-agy 플러그인] --> GAL[Google Antigravity]
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 기술 메모
|
|
224
|
+
|
|
225
|
+
- **Grok Build**: `cli-chat-proxy.grok.com/v1`의 커스텀 Responses 프로바이더, CLI 핑거프린트 헤더, 동적 모델 카탈로그.
|
|
226
|
+
- **Codex/Kimi/Claude**: pi-ai 네이티브 프로바이더가 OAuth와 리프레시를 처리합니다. 라우트 별칭 어댑터가 이를 네이티브 id에 매핑하되 모델 내부 아이덴티티는 변하지 않습니다.
|
|
227
|
+
- Kimi access token은 명시적으로 `Authorization: Bearer`로 변환됩니다 — Anthropic `x-api-key`로 잘못 보내지는 일이 없습니다.
|
|
228
|
+
- Google Antigravity는 여기서 리버스 엔지니어링**하지 않습니다**. 버전 고정형 전용 DSH 플러그인을 사용합니다.
|
|
229
|
+
|
|
230
|
+
## 준수
|
|
231
|
+
|
|
232
|
+
제3자 harness를 통한 코딩 구독 사용은 각 벤더 이용약관의 회색 지대에 놓일 수 있으며 할당량, 지역 또는 계정 리스크 관리가 트리거될 수 있습니다. **본인 계정만 사용하세요.** 이 프로젝트는 대량 계정, 할당량 재판매, 원격 릴레이, 페이월 우회, 클라이언트 사칭을 지원하지 않습니다. 상업용으로는 벤더 공식 API-key 채널을 권장합니다.
|
|
233
|
+
|
|
234
|
+
## 문서
|
|
235
|
+
|
|
236
|
+
| 문서 | 용도 |
|
|
237
|
+
|---|---|
|
|
238
|
+
| [`INSTALL.md`](INSTALL.md) | 설치·사용 상세 |
|
|
239
|
+
| [`CHANGELOG.md`](CHANGELOG.md) | 릴리스 이력 |
|
|
240
|
+
| [`docs/00-project-rules.md`](docs/00-project-rules.md) | 버전 관리, 릴리스 루프, 공개/로컬 분리 |
|
|
241
|
+
| [`docs/02-architecture.md`](docs/02-architecture.md) | 내부 아키텍처 (라우트 · 데이터 흐름 · 모듈 · API) · [中文](docs/02-architecture.zh-CN.md) |
|
|
242
|
+
| [`CONTRIBUTING.md`](CONTRIBUTING.md) | 기여 가이드 |
|
|
243
|
+
|
|
244
|
+
## 관련 프로젝트
|
|
245
|
+
|
|
246
|
+
- [`dsh-agy`](https://www.npmjs.com/package/dsh-agy) — Google Antigravity용 독립 고정 버전 플러그인.
|
|
247
|
+
|
|
248
|
+
## 기여
|
|
249
|
+
|
|
250
|
+
기능, 문서, 번역, 버그 보고 등 모든 기여를 환영합니다. 프로세스, 커밋 규칙 및 릴리스 루프는 **[CONTRIBUTING](CONTRIBUTING.md)**을 참조하세요. 목록에 없는 언어라면 README 번역을 PR로 보내 주세요. 위 언어 테이블에 추가하겠습니다.
|
|
251
|
+
|
|
252
|
+
## 라이선스
|
|
253
|
+
|
|
254
|
+
[Apache-2.0](LICENSE) · [NOTICE](NOTICE) 참조. 일부는 [dsh-xai](https://github.com/MirDie/dsh-xai) 프로젝트(Apache-2.0)에서 파생되었습니다.
|
package/README.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
|
|
2
|
+
<!-- banner -->
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
# 🔐 dsh-coding-subscription-oauth
|
|
6
|
+
|
|
7
|
+
**v0.5.0** · formerly `dsh-grok-build`
|
|
8
|
+
|
|
9
|
+
**Coding-subscription OAuth for [DeepSeek Harness](https://github.com/deepseek-ai/dsh).** Use SuperGrok / X Premium (Grok Build), ChatGPT Plus/Pro (Codex), Kimi Code, Claude Pro/Max and Google Antigravity inside DSH — without a second API-key bill and **without pasting any token into chat.**
|
|
10
|
+
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](CONTRIBUTING.md)
|
|
13
|
+
|
|
14
|
+
*[English](README.md) · [中文版](README.zh-CN.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Português (BR)](README.pt-BR.md) · [Español](README.es.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Русский](README.ru.md)*
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Name change
|
|
21
|
+
|
|
22
|
+
Published first as **`dsh-grok-build`** when it only covered Grok Build. The current name matches the full coding-subscription OAuth surface.
|
|
23
|
+
|
|
24
|
+
| | Use this | Still works |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| GitHub / `dsh plugin add` | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | `github:lninghaha/dsh-grok-build` (same `main`) |
|
|
27
|
+
| npm | Current release is `0.5.0`: `dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.0` then `dsh plugin --profile web update dsh-coding-subscription-oauth`. GitHub install still works. | No legacy npm package was published |
|
|
28
|
+
| CLI | `dsh-coding-oauth` | `dsh-grok-build` |
|
|
29
|
+
| Cordis plugin id | `llm-grok-build-oauth` | unchanged |
|
|
30
|
+
| Settings HTTP API | `/plugins/dsh-grok-build/*` | unchanged |
|
|
31
|
+
| Credential files | `$DSH_HOME/.grok-build-auth.json` and the other `*-oauth-auth.json` files | unchanged |
|
|
32
|
+
|
|
33
|
+
## ✨ Features
|
|
34
|
+
|
|
35
|
+
- 🧾 **Bring your own subscription** — SuperGrok, ChatGPT Plus/Pro, Kimi Code, Claude Pro/Max; no extra pay-as-you-go key.
|
|
36
|
+
- 🔑 **Local OAuth, no key-pasting** — authorize in Settings or CLI; access/refresh tokens never enter chat, logs or HTTP status.
|
|
37
|
+
- 🧩 **One plugin, five providers** — Grok Build (`cli-chat-proxy.grok.com`), Codex, Kimi Code, Claude Code and Google Antigravity.
|
|
38
|
+
- 🛡️ **Secure by design** — credential files are owner-only `0600`, atomically written, cross-process locked.
|
|
39
|
+
- ⚙️ **Dynamic catalog** — the selector lists only signed-in routes, labelled `(OAuth)`, including grok-4.6 `xhigh`.
|
|
40
|
+
- 🌐 **Proxy-aware** — proxies only reviewed subscription domains; Kimi China stays direct by default.
|
|
41
|
+
- 📥 **Manual CLI Pull** — Settings discovers allowlisted official Grok/Codex/Kimi/Claude CLI OAuth files read-only; you pull a one-way copy after preview and overwrite confirmation.
|
|
42
|
+
- 🎛️ **Optional capabilities, default off** — Codex search, usage/quota, image generate/edit, Fast, and Grok Imagine apply live when you turn them on.
|
|
43
|
+
- 🔌 **Opt-in local API gateway** — default-off loopback OpenAI/Anthropic-compatible server for your own tools; never a public relay.
|
|
44
|
+
|
|
45
|
+
## Problems this plugin solves
|
|
46
|
+
|
|
47
|
+
These are the searches and DSH errors that usually lead here. If one of them is your tab title, you are in the right repo.
|
|
48
|
+
|
|
49
|
+
| You searched / saw | What was actually broken | What this plugin does |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| SuperGrok / X Premium in DSH, “Grok Build vs `api.x.ai`” | The built-in `xai` route is the **pay-as-you-go API**. Coding-plan inference is `cli-chat-proxy.grok.com` | Dedicated `grok-build` route + official CLI fingerprint headers (`X-XAI-Token-Auth`, `x-grok-client-identifier`, `x-grok-client-version`) so you do not get a silent 403 |
|
|
52
|
+
| `本轮运行失败` **API key is invalid** / `AUTH` mid-turn | The GUI maps **every** `AUTH` code to that banner. Often the OAuth access token just expired (Kimi ~15 min) | Refresh **5 minutes** before expiry; on a 401, invalidate the stored token and **retry the step** after refresh |
|
|
53
|
+
| `INVALID_REPLAY_STATE` on the second Codex / Kimi turn | Replay state still carried the native pi-ai provider id after the Harness route alias | Keep the Harness route id in replay state and heal older poisoned messages |
|
|
54
|
+
| grok-4.6 **xhigh** / Extra High Effort missing | Live `GET /v1/models-v2` already returns `reasoning_efforts` including `xhigh`; cloning the grok-4.5 template hides it (pi-ai treats absent `xhigh` as unsupported) | Parse live `reasoning_efforts` into `thinkingLevelMap`. grok-4.6 gets `xhigh`; grok-4.5 stays low/medium/high |
|
|
55
|
+
| Kimi Code 401, or requests going out as Anthropic `x-api-key` | The OAuth token was attached as an Anthropic key | Wire **only** `Authorization: Bearer` on `api.kimi.com/coding` |
|
|
56
|
+
| Unsigned-in Grok / Codex / Claude still in the model picker | Every registered route was listed | Unauthenticated routes expose **no models**; signed-in names show `(OAuth)` |
|
|
57
|
+
| Device login on a **remote / headless** DSH | Browser PKCE cannot reach `localhost` | Device-code for Grok, Codex and Kimi; Claude accepts a pasted localhost redirect URL |
|
|
58
|
+
| Proxy works for Grok/Codex but breaks Kimi in China | One global `HTTPS_PROXY` | Allowlisted proxy; Kimi stays **direct** unless `proxyKimi: true`. `auth.kimi.com` ≠ `api.moonshot.cn` |
|
|
59
|
+
| ChatGPT Plus / Claude Pro in DSH without another API bill | Separate OpenAI / Anthropic API keys | Local OAuth on `codex-oauth` / `claude-code-oauth`, coexist with existing `openai` / `kimi-coding` API-key routes |
|
|
60
|
+
|
|
61
|
+
Grok Build device login, live `/v1/models-v2` and Responses streaming are verified on real deployments. Codex / Kimi / Claude reuse `@earendil-works/pi-ai` native OAuth instead of re-implementing vendor flows.
|
|
62
|
+
|
|
63
|
+
## Supported providers
|
|
64
|
+
|
|
65
|
+
| Provider | Route | Auth | Coexists with |
|
|
66
|
+
|---|---|---|---|
|
|
67
|
+
| **xAI Grok Build** | `grok-build` | SuperGrok / X Premium OAuth | `xai` |
|
|
68
|
+
| **OpenAI Codex** | `codex-oauth` · optional `codex-oauth-fast` | ChatGPT Plus/Pro OAuth | `openai` |
|
|
69
|
+
| **Kimi Code** | `kimi-code-oauth` | Kimi Code OAuth | `kimi-coding` |
|
|
70
|
+
| **Claude Code** | `claude-code-oauth` | Claude Pro/Max OAuth | — |
|
|
71
|
+
| **Google Antigravity** | `agy` | `dsh-agy` Google OAuth | — |
|
|
72
|
+
|
|
73
|
+
> Grok Build's device login, dynamic `/v1/models-v2` catalog and Responses streaming are verified on real deployments. Codex/Kimi/Claude reuse the provider-native OAuth/refresh from `@earendil-works/pi-ai` instead of re-implementing vendor flows.
|
|
74
|
+
|
|
75
|
+
## 🚀 Quick start
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# 1. install the plugin into the web profile
|
|
79
|
+
dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
|
|
80
|
+
|
|
81
|
+
# 2. optional — Google Antigravity (pinned, reviewed version)
|
|
82
|
+
dsh plugin --profile web add dsh-agy@0.1.2
|
|
83
|
+
|
|
84
|
+
# 3. restart the resident dsh web service
|
|
85
|
+
systemctl --user restart dsh-web.service
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Then open **Settings → Coding OAuth** and sign in to any provider. Done — pick your authenticated model from the selector.
|
|
89
|
+
|
|
90
|
+
## 📚 Table of contents
|
|
91
|
+
|
|
92
|
+
- [Name change](#name-change)
|
|
93
|
+
- [Problems this plugin solves](#problems-this-plugin-solves)
|
|
94
|
+
- [Install](#install)
|
|
95
|
+
- [Settings page](#settings-page)
|
|
96
|
+
- [Optional capabilities](#optional-capabilities)
|
|
97
|
+
- [CLI](#cli)
|
|
98
|
+
- [Kimi in China](#kimi-in-china)
|
|
99
|
+
- [Network proxy](#network-proxy)
|
|
100
|
+
- [Resilience](#resilience)
|
|
101
|
+
- [Credentials](#credentials)
|
|
102
|
+
- [Architecture](#architecture)
|
|
103
|
+
- [Technical notes](#technical-notes)
|
|
104
|
+
- [Compliance](#compliance)
|
|
105
|
+
- [Documentation](#documentation)
|
|
106
|
+
- [Contributing](#contributing)
|
|
107
|
+
- [License](#license)
|
|
108
|
+
|
|
109
|
+
## Install
|
|
110
|
+
|
|
111
|
+
Requires DeepSeek Harness `0.1.0-rc.6+` and Node.js 22.19+. Full details in the [installation notes](INSTALL.md).
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# from GitHub
|
|
115
|
+
dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
|
|
116
|
+
|
|
117
|
+
# or a local dev checkout
|
|
118
|
+
dsh plugin --profile web add ./dsh-coding-subscription-oauth
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Restart `dsh web` after installing. Verification against a live deployment:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pnpm run verify:deployed # checks real /api/llm.models + OAuth state
|
|
125
|
+
DSH_EXPECT_AGY_AUTH=signed-in pnpm run verify:deployed # if Google is signed in
|
|
126
|
+
|
|
127
|
+
DSH_RESTORE_PROVIDER=openai \
|
|
128
|
+
DSH_RESTORE_MODEL=gpt-5.6-sol \
|
|
129
|
+
DSH_RESTORE_REASONING=max \
|
|
130
|
+
pnpm run smoke:deployed # real Codex/Kimi tool-calls + second-turn replay
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
> `smoke:deployed` creates temporary sessions, exercises Codex and Kimi tool-calls plus a second user turn (regression coverage for `INVALID_REPLAY_STATE`), restores the declared default model, then archives the sessions.
|
|
134
|
+
|
|
135
|
+
## Settings page
|
|
136
|
+
|
|
137
|
+
Open **Settings → Coding OAuth**:
|
|
138
|
+
|
|
139
|
+
| Provider | Methods |
|
|
140
|
+
|---|---|
|
|
141
|
+
| Grok | auth code · device code · model selection |
|
|
142
|
+
| Codex | device code (recommended on remote DSH) · browser PKCE |
|
|
143
|
+
| Kimi | device code |
|
|
144
|
+
| Claude | browser PKCE (remote browser can paste the full localhost redirect URL) |
|
|
145
|
+
| Antigravity | `dsh-agy` install status + profile-local CLI commands |
|
|
146
|
+
|
|
147
|
+
Use device code when the DSH host is remote. Browser/PKCE sign-in opens the provider URL; if the localhost callback cannot reach this DSH host, paste either the returned authorization code or the complete redirect URL into the waiting Settings card.
|
|
148
|
+
|
|
149
|
+
Settings also **discovers** allowlisted official Grok / Codex / Kimi / Claude CLI OAuth files (read-only). Synchronization is an explicit one-way **Pull** — not auto-import: discover → preview → conflict/fingerprint check → confirm overwrite. Official CLI files are never written. Reads refuse symlinks, non-regular files, non-owner files, group/other access, and oversized documents (`O_NOFOLLOW`). Preview tickets are one-use, expire in five minutes, and are capped at 32.
|
|
150
|
+
|
|
151
|
+
The selector only lists routes that completed authentication; unauthenticated providers return an empty list. Provider names carry `(OAuth)`, and the catalog refreshes via `llm/adapters-updated` after sign-in/out.
|
|
152
|
+
|
|
153
|
+
## Optional capabilities
|
|
154
|
+
|
|
155
|
+
All seven switches start **off** and apply **live** (no restart): `codexSearch`, `codexImages`, `codexImageEdits`, `codexUsage`, `codexFast`, `grokImagineImage`, and `grokImagineVideo`. Numeric controls are `searchResults` (1–20, default 5), `imageCount` (1–4, default 1), and `videoArtifactTtlMs` (1 hour–7 days, default 7 days; the UI shows 1–168 hours). Lowering video retention shortens and cleans existing artifacts immediately; raising it affects only artifacts created afterward. Administrators may provide secret-free composition defaults under plugin config `capabilities`; live user settings in the `coding-subscription-oauth` settings section override that base, and omitting it keeps every switch off.
|
|
156
|
+
|
|
157
|
+
`codex-oauth-fast` is advertised only after a **fresh live catalog** lists at least one `priority`-eligible model. Those requests send `service_tier: priority` plus a routing hint. The UI says **Fast requested** and never guarantees latency or that upstream will honor the request.
|
|
158
|
+
|
|
159
|
+
Codex search, usage, and images are **opt-in** private `chatgpt.com/backend-api` endpoints. Image generation uses the fixed model `gpt-image-2`. Image edit accepts only current-session top-level attachment ids that this session already owns.
|
|
160
|
+
|
|
161
|
+
Grok Imagine calls official `https://api.x.ai` with `grok-imagine-image-2.0` and `grok-imagine-video-1.5`. It uses a **separate** DSH credential reference `XAI_API_KEY` — never Grok OAuth and never a process-env fallback. Generated outputs are fetched under MIME / size / time / redirect / DNS controls from frozen hosts `imgen.x.ai`, `videogen.x.ai`, and `vidgen.x.ai`, stored privately (256 MiB hard caps for one object and aggregate unique bytes, seven days), and served only on same-origin loopback routes.
|
|
162
|
+
|
|
163
|
+
## Local API gateway
|
|
164
|
+
|
|
165
|
+
Default **off**. When enabled it starts an isolated `node:http` server (not the DSH web port) on `127.0.0.1:18080` and reuses the same signed-in OAuth sessions:
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
gateway:
|
|
169
|
+
enabled: false
|
|
170
|
+
bind: 127.0.0.1
|
|
171
|
+
port: 18080
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Endpoints: `GET /healthz`, `GET /v1/models`, `POST /v1/chat/completions`, `POST /v1/responses`, `POST /v1/messages`. A Bearer key is stored at `$DSH_HOME/.coding-oauth-gateway.json` (`0600`). Settings can toggle and rotate the key; bind/port stay YAML-only. Non-loopback bind requires a key. This is not a remote relay.
|
|
175
|
+
|
|
176
|
+
## CLI
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# `dsh-grok-build` remains a command alias
|
|
180
|
+
dsh-coding-oauth login [--pkce] | import | status | logout
|
|
181
|
+
|
|
182
|
+
# newer providers
|
|
183
|
+
dsh-coding-oauth login codex --device-auth | codex --browser | kimi | claude
|
|
184
|
+
dsh-coding-oauth status all
|
|
185
|
+
dsh-coding-oauth logout codex
|
|
186
|
+
|
|
187
|
+
# Antigravity (install into web profile first)
|
|
188
|
+
dsh plugin --profile web exec dsh-agy login --headless
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
> `dsh-agy` CLI edits the account pool outside the DSH process, so it can't emit an in-process catalog event — close and reopen the model selector after signing in/out.
|
|
192
|
+
|
|
193
|
+
## Kimi in China
|
|
194
|
+
|
|
195
|
+
Kimi Code subscription OAuth uses `https://auth.kimi.com`; inference uses `https://api.kimi.com/coding`. `https://api.moonshot.cn/v1` is the pay-as-you-go **Moonshot Open Platform** API-key channel — there is no switchable "China OAuth endpoint". This plugin uses a separate `kimi-code-oauth` route and doesn't affect an existing `kimi-coding` API-key config.
|
|
196
|
+
|
|
197
|
+
## Network proxy
|
|
198
|
+
|
|
199
|
+
Priority: `config.proxy` → `CODING_OAUTH_PROXY` → `GROK_BUILD_PROXY` → `HTTPS_PROXY`/`HTTP_PROXY`.
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
- id: llm-grok-build-oauth
|
|
203
|
+
config:
|
|
204
|
+
proxy: http://127.0.0.1:7890
|
|
205
|
+
proxyKimi: false
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Only reviewed subscription domains are proxied (xAI/Grok, OpenAI Codex, Claude/Anthropic, Google Antigravity); all other DSH traffic keeps its original dispatcher. Kimi stays direct by default and only uses the proxy when `proxyKimi: true`.
|
|
209
|
+
|
|
210
|
+
## Resilience
|
|
211
|
+
|
|
212
|
+
OAuth access tokens refresh proactively **five minutes** before their stored expiry (pi-ai 0.84+), so a request never rides a token into its final seconds. If an upstream still rejects a locally-valid token with 401/403 — server-side revocation or clock skew — the plugin backdates the stored credential and the retried step refreshes before reuse, recovering transparently instead of failing the turn.
|
|
213
|
+
|
|
214
|
+
Request retries use the harness retry policy: transient failures (`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`) **and `AUTH`** retry with exponential backoff (default 2 retries, 500 ms → 10 s, 10% jitter). Quota exhaustion and a dead refresh token are **not** retried — they fail fast with the real message and a sign-in prompt. Override per deployment:
|
|
215
|
+
|
|
216
|
+
```yaml
|
|
217
|
+
- id: llm-grok-build-oauth
|
|
218
|
+
config:
|
|
219
|
+
retryPolicy:
|
|
220
|
+
mode: normal
|
|
221
|
+
maxRetries: 2
|
|
222
|
+
retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
|
|
223
|
+
backoff: { initialDelayMs: 500, maxDelayMs: 10000, jitterRatio: 0.1 }
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Credentials
|
|
227
|
+
|
|
228
|
+
Owner-only `0600`, atomically written, cross-process file lock:
|
|
229
|
+
|
|
230
|
+
- `$DSH_HOME/.grok-build-auth.json`
|
|
231
|
+
- `$DSH_HOME/.codex-oauth-auth.json`
|
|
232
|
+
- `$DSH_HOME/.kimi-code-oauth-auth.json`
|
|
233
|
+
- `$DSH_HOME/.claude-code-oauth-auth.json`
|
|
234
|
+
|
|
235
|
+
Selection caches live in the matching `*-models.json` files. Grok Imagine uses a separate DSH credential named `XAI_API_KEY` (not the Grok OAuth file). **No HTTP status, log or UI may ever return a token.**
|
|
236
|
+
|
|
237
|
+
## Architecture
|
|
238
|
+
|
|
239
|
+
```mermaid
|
|
240
|
+
flowchart LR
|
|
241
|
+
subgraph DSH["DSH Harness"]
|
|
242
|
+
UI[Settings / Web · Coding OAuth] --> LLM[llm route]
|
|
243
|
+
LLM --> ALIA[Route-alias adapter]
|
|
244
|
+
end
|
|
245
|
+
ALIA --> PI[pi-ai native provider<br/>OAuth · refresh · stream]
|
|
246
|
+
PI --> GROK[Grok Build]
|
|
247
|
+
PI --> COD[Codex]
|
|
248
|
+
PI --> KIMI[Kimi]
|
|
249
|
+
PI --> CLAU[Claude]
|
|
250
|
+
AGY[dsh-agy plugin] --> GAL[Google Antigravity]
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Technical notes
|
|
254
|
+
|
|
255
|
+
- **Grok Build**: Responses API on `cli-chat-proxy.grok.com/v1` (not `api.x.ai`), CLI fingerprint headers, live `/v1/models-v2` including grok-4.6 `reasoning.effort: xhigh`.
|
|
256
|
+
- **Codex/Kimi/Claude**: pi-ai native providers handle OAuth and refresh; the route-alias adapter maps them to native ids so multi-turn replay does not throw `INVALID_REPLAY_STATE`.
|
|
257
|
+
- The Kimi access token is explicitly converted to `Authorization: Bearer` — never mistakenly an Anthropic `x-api-key`.
|
|
258
|
+
- **Codex Fast / private endpoints**: `codex-oauth-fast` is opt-in and fail-closed on a stale catalog; search, usage and `gpt-image-2` images stay off until enabled.
|
|
259
|
+
- **Grok Imagine**: official `api.x.ai` only, `XAI_API_KEY` through DSH credentials, same-origin download routes under `/plugins/dsh-grok-build/imagine/*`.
|
|
260
|
+
- Google Antigravity is **not** reverse-engineered here; it uses a version-pinned dedicated DSH plugin.
|
|
261
|
+
|
|
262
|
+
## Compliance
|
|
263
|
+
|
|
264
|
+
Using coding subscriptions through a third-party harness may sit in a gray area of each vendor's terms and can trigger quota, regional or account-risk controls. **Use only your own accounts**; this project does not support bulk accounts, quota resale, remote relay, paywall bypass or client impersonation. For commercial use, prefer the vendors' official API-key channels.
|
|
265
|
+
|
|
266
|
+
## Documentation
|
|
267
|
+
|
|
268
|
+
| Doc | Purpose |
|
|
269
|
+
|---|---|
|
|
270
|
+
| [`INSTALL.md`](INSTALL.md) | Installation & usage details |
|
|
271
|
+
| [`CHANGELOG.md`](CHANGELOG.md) | Release history |
|
|
272
|
+
| [`docs/00-project-rules.md`](docs/00-project-rules.md) | Versioning, release loop, publish vs local-only split |
|
|
273
|
+
| [`docs/02-architecture.md`](docs/02-architecture.md) | Internal architecture (routes, data flow, modules, API) · [中文](docs/02-architecture.zh-CN.md) |
|
|
274
|
+
| [`CONTRIBUTING.md`](CONTRIBUTING.md) | Contribution guide |
|
|
275
|
+
|
|
276
|
+
## Related
|
|
277
|
+
|
|
278
|
+
- [`dsh-agy`](https://www.npmjs.com/package/dsh-agy) — separate pinned plugin for Google Antigravity.
|
|
279
|
+
|
|
280
|
+
## Contributing
|
|
281
|
+
|
|
282
|
+
Contributions of all kinds are welcome — features, docs, translations, bug reports. See **[CONTRIBUTING](CONTRIBUTING.md)** for the flow, commit conventions and the release loop. If your language isn't listed, PR a README translation and we'll add it to the table above.
|
|
283
|
+
|
|
284
|
+
## License
|
|
285
|
+
|
|
286
|
+
[Apache-2.0](LICENSE) · see [NOTICE](NOTICE). Portions derived from the [dsh-xai](https://github.com/MirDie/dsh-xai) project (Apache-2.0).
|