oh-my-opencode 0.3.3 → 0.4.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/README.ko.md +162 -37
- package/README.md +160 -35
- package/dist/auth/antigravity/constants.d.ts +36 -0
- package/dist/auth/antigravity/fetch.d.ts +68 -0
- package/dist/auth/antigravity/index.d.ts +13 -0
- package/dist/auth/antigravity/message-converter.d.ts +54 -0
- package/dist/auth/antigravity/oauth.d.ts +85 -0
- package/dist/auth/antigravity/plugin.d.ts +54 -0
- package/dist/auth/antigravity/project.d.ts +20 -0
- package/dist/auth/antigravity/request.d.ts +104 -0
- package/dist/auth/antigravity/response.d.ts +137 -0
- package/dist/auth/antigravity/thinking.d.ts +234 -0
- package/dist/auth/antigravity/thought-signature-store.d.ts +52 -0
- package/dist/auth/antigravity/token.d.ts +41 -0
- package/dist/auth/antigravity/tools.d.ts +119 -0
- package/dist/auth/antigravity/types.d.ts +173 -0
- package/dist/config/schema.d.ts +454 -80
- package/dist/features/background-agent/index.d.ts +2 -0
- package/dist/features/background-agent/manager.d.ts +37 -0
- package/dist/features/background-agent/types.d.ts +27 -0
- package/dist/google-auth.d.ts +3 -0
- package/dist/hooks/anthropic-auto-compact/types.d.ts +11 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +6 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +8 -0
- package/dist/hooks/auto-update-checker/index.d.ts +12 -0
- package/dist/hooks/auto-update-checker/types.d.ts +19 -0
- package/dist/hooks/background-notification/index.d.ts +12 -0
- package/dist/hooks/background-notification/types.d.ts +4 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/rules-injector/constants.d.ts +6 -0
- package/dist/hooks/rules-injector/finder.d.ts +45 -0
- package/dist/hooks/rules-injector/index.d.ts +22 -0
- package/dist/hooks/rules-injector/matcher.d.ts +21 -0
- package/dist/hooks/rules-injector/parser.d.ts +18 -0
- package/dist/hooks/rules-injector/storage.d.ts +9 -0
- package/dist/hooks/rules-injector/types.d.ts +41 -0
- package/dist/hooks/session-recovery/storage.d.ts +1 -0
- package/dist/index.js +4320 -1445
- package/dist/tools/ast-grep/index.d.ts +4 -4
- package/dist/tools/ast-grep/tools.d.ts +4 -4
- package/dist/tools/background-task/constants.d.ts +3 -0
- package/dist/tools/background-task/index.d.ts +3 -0
- package/dist/tools/background-task/tools.d.ts +39 -0
- package/dist/tools/background-task/types.d.ts +13 -0
- package/dist/tools/call-omo-agent/constants.d.ts +2 -0
- package/dist/tools/call-omo-agent/index.d.ts +3 -0
- package/dist/tools/call-omo-agent/tools.d.ts +22 -0
- package/dist/tools/call-omo-agent/types.d.ts +24 -0
- package/dist/tools/index.d.ts +47 -6
- package/dist/tools/lsp/tools.d.ts +2 -2
- package/package.json +11 -3
package/README.ko.md
CHANGED
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
- [LLM Agent를 위한 안내](#llm-agent를-위한-안내)
|
|
9
9
|
- [Why OpenCode & Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
|
10
10
|
- [기능](#기능)
|
|
11
|
-
- [Hooks](#hooks)
|
|
12
11
|
- [Agents](#agents)
|
|
13
12
|
- [Tools](#tools)
|
|
14
13
|
- [내장 LSP Tools](#내장-lsp-tools)
|
|
15
14
|
- [내장 AST-Grep Tools](#내장-ast-grep-tools)
|
|
16
15
|
- [Grep](#grep)
|
|
17
16
|
- [내장 MCPs](#내장-mcps)
|
|
17
|
+
- [Background Task](#background-task)
|
|
18
|
+
- [Hooks](#hooks)
|
|
18
19
|
- [Claude Code 호환성](#claude-code-호환성)
|
|
19
20
|
- [기타 편의 기능](#기타-편의-기능)
|
|
20
21
|
- [설정](#설정)
|
|
@@ -40,9 +41,10 @@ OpenCode 가 낭만이 사라진것같은 오늘날의 시대에, 당신에게
|
|
|
40
41
|
|
|
41
42
|
- **모델 설정이 필요합니다**
|
|
42
43
|
- 이 플러그인은 [OpenCode Zen](https://opencode.ai/docs/zen/), Google, OpenAI, Anthropic 의 모델을 사용합니다.
|
|
43
|
-
- Anthropic 모델들을 사용하기 위해 [OpenCode 의 내장 Claude Code Max Plan 로그인 기능](https://opencode.ai/docs/providers/#anthropic)을 사용하세요.
|
|
44
|
-
- OpenAI
|
|
45
|
-
- Gemini
|
|
44
|
+
- Anthropic 모델들을 사용하기 위해 [OpenCode 의 내장 Claude Code Max Plan 로그인 기능](https://opencode.ai/docs/providers/#anthropic)을 사용하세요.
|
|
45
|
+
- OpenAI 모델 (ChatGPT Plus/Pro)을 사용하기 위해 [OpenCode-OpenAI-Codex-Auth 플러그인](https://github.com/numman-ali/opencode-openai-codex-auth)을 설치하세요.
|
|
46
|
+
- Google Gemini 모델을 위해 `oh-my-opencode/google-auth` 플러그인을 추가하세요 (**내장 Antigravity OAuth**).
|
|
47
|
+
- 다른 프로바이더를 위해 [VibeProxy (macOS Only)](https://github.com/automazeio/vibeproxy) 또는 [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)를 대안으로 사용할 수 있습니다.
|
|
46
48
|
- **사실 밑의 내용은 읽지 않아도 됩니다. 그냥 설치하시면 됩니다. 모델 설정하고나면 추가로 공부하거나 알 필요가 없고, 설치하고 나면 그냥 더 좋아집니다.**
|
|
47
49
|
- **이 문서도 그냥 Claude Code, OpenCode, Cursor에 붙여넣고, 설치하고, 사용자의 개입이 필요할 때 알려달라고 프롬프팅하세요. 그럼 그냥 깔립니다.**
|
|
48
50
|
- 당신이 LLM Agent 라면, 필요한 플러그인과 의존성을 설치하고, tmux 를 통해 opencode auth login 을 실행하여 사용자의 구성을 도와주세요.
|
|
@@ -108,11 +110,66 @@ cat ~/.config/opencode/opencode.json # plugin 배열에 "oh-my-opencode"가 있
|
|
|
108
110
|
|
|
109
111
|
### 4단계: 인증정보 설정
|
|
110
112
|
|
|
111
|
-
plugin 에 oh my opencode 를 추가했다면, tmux 를 사용하여
|
|
113
|
+
plugin 에 oh my opencode 를 추가했다면, tmux 를 사용하여 사용자의 인증 설정을 도와주세요.
|
|
114
|
+
|
|
115
|
+
#### 4.1 Anthropic (Claude)
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
opencode auth login
|
|
119
|
+
# Provider: Anthropic 선택
|
|
120
|
+
# Login method: Claude Pro/Max 선택
|
|
121
|
+
# 브라우저에서 OAuth 플로우 완료
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### 4.2 Google Gemini (내장 Antigravity OAuth)
|
|
125
|
+
|
|
126
|
+
먼저 google-auth 플러그인을 추가:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"plugin": [
|
|
131
|
+
"oh-my-opencode",
|
|
132
|
+
"oh-my-opencode/google-auth"
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
그 후 인증:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
opencode auth login
|
|
141
|
+
# Provider: Google 선택
|
|
142
|
+
# Login method: OAuth with Google (Antigravity) 선택
|
|
143
|
+
# 브라우저에서 OAuth 플로우 완료
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### 4.3 OpenAI (ChatGPT Plus/Pro)
|
|
147
|
+
|
|
148
|
+
먼저 opencode-openai-codex-auth 플러그인 추가:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"plugin": [
|
|
153
|
+
"oh-my-opencode",
|
|
154
|
+
"opencode-openai-codex-auth@4.1.0"
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**중요**: `opencode.json`에 전체 모델 설정도 구성해야 합니다. [`config/full-opencode.json`](https://github.com/numman-ali/opencode-openai-codex-auth/blob/main/config/full-opencode.json)에서 provider/models 설정을 복사하세요. 자세한 설정 방법은 [opencode-openai-codex-auth 문서](https://github.com/numman-ali/opencode-openai-codex-auth)를 참고하세요.
|
|
160
|
+
|
|
161
|
+
그 후 인증:
|
|
112
162
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
163
|
+
```bash
|
|
164
|
+
opencode auth login
|
|
165
|
+
# Provider: OpenAI 선택
|
|
166
|
+
# Login method: ChatGPT Plus/Pro (Codex Subscription) 선택
|
|
167
|
+
# 브라우저에서 OAuth 플로우 완료
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### 4.4 대안: 프록시 기반 인증
|
|
171
|
+
|
|
172
|
+
프록시 기반 인증을 선호하는 사용자를 위해 [VibeProxy](https://github.com/automazeio/vibeproxy) (macOS) 또는 [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)를 대안으로 사용할 수 있습니다.
|
|
116
173
|
|
|
117
174
|
### ⚠️ 주의
|
|
118
175
|
|
|
@@ -143,35 +200,6 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
|
|
|
143
200
|
|
|
144
201
|
## 기능
|
|
145
202
|
|
|
146
|
-
### Hooks
|
|
147
|
-
|
|
148
|
-
- **Todo Continuation Enforcer**: 에이전트가 멈추기 전 모든 TODO 항목을 완료하도록 강제합니다. LLM의 고질적인 "중도 포기" 문제를 방지합니다.
|
|
149
|
-
- **Context Window Monitor**: [컨텍스트 윈도우 불안 관리](https://agentic-patterns.com/patterns/context-window-anxiety-management/) 패턴을 구현합니다.
|
|
150
|
-
- 사용량이 70%를 넘으면 에이전트에게 아직 토큰이 충분하다고 상기시켜, 급하게 불완전한 작업을 하는 것을 완화합니다.
|
|
151
|
-
- **Session Notification**: 에이전트가 작업을 마치면 OS 네이티브 알림을 보냅니다 (macOS, Linux, Windows).
|
|
152
|
-
- **Session Recovery**: API 에러로부터 자동으로 복구하여 세션 안정성을 보장합니다. 네 가지 시나리오를 처리합니다:
|
|
153
|
-
- **Tool Result Missing**: `tool_use` 블록이 있지만 `tool_result`가 없을 때 (ESC 인터럽트) → "cancelled" tool result 주입
|
|
154
|
-
- **Thinking Block Order**: thinking 블록이 첫 번째여야 하는데 아닐 때 → 빈 thinking 블록 추가
|
|
155
|
-
- **Thinking Disabled Violation**: thinking 이 비활성화인데 thinking 블록이 있을 때 → thinking 블록 제거
|
|
156
|
-
- **Empty Content Message**: 메시지가 thinking/meta 블록만 있고 실제 내용이 없을 때 → 파일시스템을 통해 "(interrupted)" 텍스트 주입
|
|
157
|
-
- **Comment Checker**: 코드 수정 후 불필요한 주석을 감지하여 보고합니다. BDD 패턴, 지시어, 독스트링 등 유효한 주석은 똑똑하게 제외하고, AI가 남긴 흔적을 제거하여 코드를 깨끗하게 유지합니다.
|
|
158
|
-
- **Directory AGENTS.md Injector**: 파일을 읽을 때 `AGENTS.md` 내용을 자동으로 주입합니다. 파일 디렉토리부터 프로젝트 루트까지 탐색하며, 경로 상의 **모든** `AGENTS.md` 파일을 수집합니다. 중첩된 디렉토리별 지침을 지원합니다:
|
|
159
|
-
```
|
|
160
|
-
project/
|
|
161
|
-
├── AGENTS.md # 프로젝트 전체 컨텍스트
|
|
162
|
-
├── src/
|
|
163
|
-
│ ├── AGENTS.md # src 전용 컨텍스트
|
|
164
|
-
│ └── components/
|
|
165
|
-
│ ├── AGENTS.md # 컴포넌트 전용 컨텍스트
|
|
166
|
-
│ └── Button.tsx # 이 파일을 읽으면 위 3개 AGENTS.md 모두 주입
|
|
167
|
-
```
|
|
168
|
-
`Button.tsx`를 읽으면 순서대로 주입됩니다: `project/AGENTS.md` → `src/AGENTS.md` → `components/AGENTS.md`. 각 디렉토리의 컨텍스트는 세션당 한 번만 주입됩니다. Claude Code의 CLAUDE.md 기능에서 영감을 받았습니다.
|
|
169
|
-
- **Directory README.md Injector**: 파일을 읽을 때 `README.md` 내용을 자동으로 주입합니다. AGENTS.md Injector와 동일하게 동작하며, 파일 디렉토리부터 프로젝트 루트까지 탐색합니다. LLM 에이전트에게 프로젝트 문서 컨텍스트를 제공합니다. 각 디렉토리의 README는 세션당 한 번만 주입됩니다.
|
|
170
|
-
- **Think Mode**: 확장된 사고(Extended Thinking)가 필요한 상황을 자동으로 감지하고 모드를 전환합니다. 사용자가 깊은 사고를 요청하는 표현(예: "think deeply", "ultrathink")을 감지하면, 추론 능력을 극대화하도록 모델 설정을 동적으로 조정합니다.
|
|
171
|
-
- **Anthropic Auto Compact**: Anthropic 모델 사용 시 컨텍스트 한계에 도달하면 대화 기록을 자동으로 압축하여 효율적으로 관리합니다.
|
|
172
|
-
- **Empty Task Response Detector**: 서브 에이전트가 수행한 작업이 비어있거나 무의미한 응답을 반환하는 경우를 감지하여, 오류 없이 우아하게 처리합니다.
|
|
173
|
-
- **Grep Output Truncator**: Grep 검색 결과가 너무 길어 컨텍스트를 장악해버리는 것을 방지하기 위해, 과도한 출력을 자동으로 자릅니다.
|
|
174
|
-
|
|
175
203
|
### Agents
|
|
176
204
|
|
|
177
205
|
- **oracle** (`openai/gpt-5.2`): 아키텍처, 코드 리뷰, 전략 수립을 위한 전문가 조언자. GPT-5.2의 뛰어난 논리적 추론과 깊은 분석 능력을 활용합니다. AmpCode 에서 영감을 받았습니다.
|
|
@@ -190,6 +218,12 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
|
|
|
190
218
|
|
|
191
219
|
에이전트의 모델, 프롬프트, 권한은 `oh-my-opencode.json`에서 커스텀할 수 있습니다. 자세한 내용은 [설정](#설정)을 참고하세요.
|
|
192
220
|
|
|
221
|
+
#### 서브 에이전트 오케스트레이션 (omo_task)
|
|
222
|
+
|
|
223
|
+
`omo_task` 도구를 사용하면 에이전트(`oracle`, `frontend-ui-ux-engineer` 등)가 `explore`나 `librarian`을 서브 에이전트로 호출하여 특정 작업을 위임할 수 있습니다. 이를 통해 에이전트가 작업을 진행하기 전에 전문화된 다른 에이전트에게 정보를 요청하는 강력한 워크플로우가 가능합니다.
|
|
224
|
+
|
|
225
|
+
> **참고**: 무한 재귀를 방지하기 위해 `explore`와 `librarian` 에이전트는 `omo_task` 도구를 직접 사용할 수 없습니다.
|
|
226
|
+
|
|
193
227
|
### Tools
|
|
194
228
|
|
|
195
229
|
#### 내장 LSP Tools
|
|
@@ -238,10 +272,101 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
|
|
|
238
272
|
}
|
|
239
273
|
```
|
|
240
274
|
|
|
275
|
+
#### Background Task
|
|
276
|
+
|
|
277
|
+
장시간 실행되는 작업이나 복잡한 분석을 메인 세션을 차단하지 않고 백그라운드에서 실행합니다. 작업이 완료되면 시스템이 자동으로 알림을 보냅니다.
|
|
278
|
+
|
|
279
|
+
- **background_task**: 백그라운드 에이전트 작업을 시작합니다. 설명, 프롬프트, 에이전트 타입을 지정하면 즉시 task ID를 반환합니다.
|
|
280
|
+
- **background_output**: 작업 진행 상황 확인(`block=false`) 또는 결과 대기(`block=true`). 최대 10분까지 커스텀 타임아웃을 지원합니다.
|
|
281
|
+
- **background_cancel**: task ID로 실행 중인 백그라운드 작업을 취소합니다.
|
|
282
|
+
|
|
283
|
+
주요 기능:
|
|
284
|
+
- **비동기 실행**: 복잡한 분석이나 연구 작업을 백그라운드에서 처리하면서 다른 작업 계속 가능
|
|
285
|
+
- **자동 알림**: 백그라운드 작업 완료 시 메인 세션에 자동 알림
|
|
286
|
+
- **상태 추적**: 도구 호출 횟수, 마지막 사용 도구 등 실시간 진행 상황 모니터링
|
|
287
|
+
- **세션 격리**: 각 작업은 독립된 세션에서 실행
|
|
288
|
+
|
|
289
|
+
사용 예시:
|
|
290
|
+
```
|
|
291
|
+
1. 시작: background_task → task_id="bg_abc123" 반환
|
|
292
|
+
2. 다른 작업 계속 진행
|
|
293
|
+
3. 시스템 알림: "Task bg_abc123 completed"
|
|
294
|
+
4. 결과 조회: background_output(task_id="bg_abc123") → 전체 결과 획득
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Hooks
|
|
298
|
+
|
|
299
|
+
- **Todo Continuation Enforcer**: 에이전트가 멈추기 전 모든 TODO 항목을 완료하도록 강제합니다. LLM의 고질적인 "중도 포기" 문제를 방지합니다.
|
|
300
|
+
- **Context Window Monitor**: [컨텍스트 윈도우 불안 관리](https://agentic-patterns.com/patterns/context-window-anxiety-management/) 패턴을 구현합니다.
|
|
301
|
+
- 사용량이 70%를 넘으면 에이전트에게 아직 토큰이 충분하다고 상기시켜, 급하게 불완전한 작업을 하는 것을 완화합니다.
|
|
302
|
+
- **Session Notification**: 에이전트가 작업을 마치면 OS 네이티브 알림을 보냅니다 (macOS, Linux, Windows).
|
|
303
|
+
- **Session Recovery**: API 에러로부터 자동으로 복구하여 세션 안정성을 보장합니다. 네 가지 시나리오를 처리합니다:
|
|
304
|
+
- **Tool Result Missing**: `tool_use` 블록이 있지만 `tool_result`가 없을 때 (ESC 인터럽트) → "cancelled" tool result 주입
|
|
305
|
+
- **Thinking Block Order**: thinking 블록이 첫 번째여야 하는데 아닐 때 → 빈 thinking 블록 추가
|
|
306
|
+
- **Thinking Disabled Violation**: thinking 이 비활성화인데 thinking 블록이 있을 때 → thinking 블록 제거
|
|
307
|
+
- **Empty Content Message**: 메시지가 thinking/meta 블록만 있고 실제 내용이 없을 때 → 파일시스템을 통해 "(interrupted)" 텍스트 주입
|
|
308
|
+
- **Comment Checker**: 코드 수정 후 불필요한 주석을 감지하여 보고합니다. BDD 패턴, 지시어, 독스트링 등 유효한 주석은 똑똑하게 제외하고, AI가 남긴 흔적을 제거하여 코드를 깨끗하게 유지합니다.
|
|
309
|
+
- **Directory AGENTS.md Injector**: 파일을 읽을 때 `AGENTS.md` 내용을 자동으로 주입합니다. 파일 디렉토리부터 프로젝트 루트까지 탐색하며, 경로 상의 **모든** `AGENTS.md` 파일을 수집합니다. 중첩된 디렉토리별 지침을 지원합니다:
|
|
310
|
+
```
|
|
311
|
+
project/
|
|
312
|
+
├── AGENTS.md # 프로젝트 전체 컨텍스트
|
|
313
|
+
├── src/
|
|
314
|
+
│ ├── AGENTS.md # src 전용 컨텍스트
|
|
315
|
+
│ └── components/
|
|
316
|
+
│ ├── AGENTS.md # 컴포넌트 전용 컨텍스트
|
|
317
|
+
│ └── Button.tsx # 이 파일을 읽으면 위 3개 AGENTS.md 모두 주입
|
|
318
|
+
```
|
|
319
|
+
`Button.tsx`를 읽으면 순서대로 주입됩니다: `project/AGENTS.md` → `src/AGENTS.md` → `components/AGENTS.md`. 각 디렉토리의 컨텍스트는 세션당 한 번만 주입됩니다. Claude Code의 CLAUDE.md 기능에서 영감을 받았습니다.
|
|
320
|
+
- **Directory README.md Injector**: 파일을 읽을 때 `README.md` 내용을 자동으로 주입합니다. AGENTS.md Injector와 동일하게 동작하며, 파일 디렉토리부터 프로젝트 루트까지 탐색합니다. LLM 에이전트에게 프로젝트 문서 컨텍스트를 제공합니다. 각 디렉토리의 README는 세션당 한 번만 주입됩니다.
|
|
321
|
+
- **Rules Injector**: 파일을 읽을 때 `.claude/rules/` 디렉토리의 규칙을 자동으로 주입합니다.
|
|
322
|
+
- 파일 디렉토리부터 프로젝트 루트까지 상향 탐색하며, `~/.claude/rules/` (사용자) 경로도 포함합니다.
|
|
323
|
+
- `.md` 및 `.mdc` 파일을 지원합니다.
|
|
324
|
+
- Frontmatter의 `globs` 필드(glob 패턴)를 기반으로 매칭합니다.
|
|
325
|
+
- 항상 적용되어야 하는 규칙을 위한 `alwaysApply: true` 옵션을 지원합니다.
|
|
326
|
+
- 규칙 파일 구조 예시:
|
|
327
|
+
```markdown
|
|
328
|
+
---
|
|
329
|
+
globs: ["*.ts", "src/**/*.js"]
|
|
330
|
+
description: "TypeScript/JavaScript coding rules"
|
|
331
|
+
---
|
|
332
|
+
- Use PascalCase for interface names
|
|
333
|
+
- Use camelCase for function names
|
|
334
|
+
```
|
|
335
|
+
- **Think Mode**: 확장된 사고(Extended Thinking)가 필요한 상황을 자동으로 감지하고 모드를 전환합니다. 사용자가 깊은 사고를 요청하는 표현(예: "think deeply", "ultrathink")을 감지하면, 추론 능력을 극대화하도록 모델 설정을 동적으로 조정합니다.
|
|
336
|
+
- **Anthropic Auto Compact**: Anthropic 모델 사용 시 컨텍스트 한계에 도달하면 대화 기록을 자동으로 압축하여 효율적으로 관리합니다.
|
|
337
|
+
- **Empty Task Response Detector**: 서브 에이전트가 수행한 작업이 비어있거나 무의미한 응답을 반환하는 경우를 감지하여, 오류 없이 우아하게 처리합니다.
|
|
338
|
+
- **Grep Output Truncator**: Grep 검색 결과가 너무 길어 컨텍스트를 장악해버리는 것을 방지하기 위해, 과도한 출력을 자동으로 자릅니다.
|
|
339
|
+
|
|
241
340
|
### Claude Code 호환성
|
|
242
341
|
|
|
243
342
|
Oh My OpenCode는 Claude Code 설정과 완벽하게 호환됩니다. Claude Code를 사용하셨다면, 기존 설정을 그대로 사용할 수 있습니다.
|
|
244
343
|
|
|
344
|
+
#### 호환성 토글
|
|
345
|
+
|
|
346
|
+
특정 Claude Code 호환 기능을 비활성화하려면 `claude_code` 설정 객체를 사용하세요:
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"claude_code": {
|
|
351
|
+
"mcp": false,
|
|
352
|
+
"commands": false,
|
|
353
|
+
"skills": false,
|
|
354
|
+
"agents": false,
|
|
355
|
+
"hooks": false
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
| 토글 | `false`일 때 로딩 비활성화 경로 | 영향 받지 않음 |
|
|
361
|
+
|------|-------------------------------|---------------|
|
|
362
|
+
| `mcp` | `~/.claude/.mcp.json`, `./.mcp.json`, `./.claude/.mcp.json` | 내장 MCP (context7, websearch_exa) |
|
|
363
|
+
| `commands` | `~/.claude/commands/*.md`, `./.claude/commands/*.md` | `~/.config/opencode/command/`, `./.opencode/command/` |
|
|
364
|
+
| `skills` | `~/.claude/skills/*/SKILL.md`, `./.claude/skills/*/SKILL.md` | - |
|
|
365
|
+
| `agents` | `~/.claude/agents/*.md`, `./.claude/agents/*.md` | 내장 에이전트 (oracle, librarian 등) |
|
|
366
|
+
| `hooks` | `~/.claude/settings.json`, `./.claude/settings.json`, `./.claude/settings.local.json` | - |
|
|
367
|
+
|
|
368
|
+
모든 토글은 기본값이 `true` (활성화)입니다. 완전한 Claude Code 호환성을 원하면 `claude_code` 객체를 생략하세요.
|
|
369
|
+
|
|
245
370
|
#### Hooks 통합
|
|
246
371
|
|
|
247
372
|
Claude Code의 `settings.json` 훅 시스템을 통해 커스텀 스크립트를 실행합니다. Oh My OpenCode는 다음 위치의 훅을 읽고 실행합니다:
|
package/README.md
CHANGED
|
@@ -8,13 +8,14 @@ English | [한국어](README.ko.md)
|
|
|
8
8
|
- [For LLM Agents](#for-llm-agents)
|
|
9
9
|
- [Why OpenCode & Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
|
10
10
|
- [Features](#features)
|
|
11
|
-
- [Hooks](#hooks)
|
|
12
11
|
- [Agents](#agents)
|
|
13
12
|
- [Tools](#tools)
|
|
14
13
|
- [Built-in LSP Tools](#built-in-lsp-tools)
|
|
15
14
|
- [Built-in AST-Grep Tools](#built-in-ast-grep-tools)
|
|
16
15
|
- [Grep](#grep)
|
|
17
16
|
- [Built-in MCPs](#built-in-mcps)
|
|
17
|
+
- [Background Task](#background-task)
|
|
18
|
+
- [Hooks](#hooks)
|
|
18
19
|
- [Claude Code Compatibility](#claude-code-compatibility)
|
|
19
20
|
- [Other Features](#other-features)
|
|
20
21
|
- [Configuration](#configuration)
|
|
@@ -40,8 +41,9 @@ Even if you don't, invest a little time. Boost your skills and productivity by m
|
|
|
40
41
|
- **Model Setup Required**
|
|
41
42
|
- This plugin utilizes models from [OpenCode Zen](https://opencode.ai/docs/zen/), Google, OpenAI, and Anthropic.
|
|
42
43
|
- For Anthropic models, use [OpenCode's built-in Claude Code Max Plan login](https://opencode.ai/docs/providers/#anthropic).
|
|
43
|
-
- For OpenAI models,
|
|
44
|
-
- For Gemini
|
|
44
|
+
- For OpenAI models (ChatGPT Plus/Pro), install the [OpenCode-OpenAI-Codex-Auth plugin](https://github.com/numman-ali/opencode-openai-codex-auth).
|
|
45
|
+
- For Google Gemini models, add `oh-my-opencode/google-auth` plugin for **built-in Antigravity OAuth**.
|
|
46
|
+
- For other providers, [VibeProxy (macOS Only)](https://github.com/automazeio/vibeproxy) or [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) remain available as alternatives.
|
|
45
47
|
- **Truth be told, the rest is optional. Just install it. Once set up, no further learning is required. It simply evolves.**
|
|
46
48
|
- **Paste this document into Claude Code, OpenCode, or Cursor, instruct it to install, and ask for assistance if needed. It just installs.**
|
|
47
49
|
- If you are an LLM Agent, install the required plugins and dependencies, then run `opencode auth login` via tmux to assist the user with configuration.
|
|
@@ -107,11 +109,66 @@ cat ~/.config/opencode/opencode.json # Should contain "oh-my-opencode" in plugi
|
|
|
107
109
|
|
|
108
110
|
### Step 4: Configure Authentication
|
|
109
111
|
|
|
110
|
-
Once `oh-my-opencode` is added to the plugin list, use `tmux` to
|
|
112
|
+
Once `oh-my-opencode` is added to the plugin list, use `tmux` to assist the user with authentication setup.
|
|
113
|
+
|
|
114
|
+
#### 4.1 Anthropic (Claude)
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
opencode auth login
|
|
118
|
+
# Select Provider: Anthropic
|
|
119
|
+
# Select Login method: Claude Pro/Max
|
|
120
|
+
# Complete OAuth flow in browser
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### 4.2 Google Gemini (Built-in Antigravity OAuth)
|
|
124
|
+
|
|
125
|
+
First, add the google-auth plugin:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"plugin": [
|
|
130
|
+
"oh-my-opencode",
|
|
131
|
+
"oh-my-opencode/google-auth"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Then authenticate:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
opencode auth login
|
|
140
|
+
# Select Provider: Google
|
|
141
|
+
# Select Login method: OAuth with Google (Antigravity)
|
|
142
|
+
# Complete OAuth flow in browser
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### 4.3 OpenAI (ChatGPT Plus/Pro)
|
|
146
|
+
|
|
147
|
+
First, add the opencode-openai-codex-auth plugin:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"plugin": [
|
|
152
|
+
"oh-my-opencode",
|
|
153
|
+
"opencode-openai-codex-auth@4.1.0"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
```
|
|
111
157
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
158
|
+
**Important**: You must also configure the full model settings in your `opencode.json`. Copy the provider/models configuration from [`config/full-opencode.json`](https://github.com/numman-ali/opencode-openai-codex-auth/blob/main/config/full-opencode.json). See the [opencode-openai-codex-auth documentation](https://github.com/numman-ali/opencode-openai-codex-auth) for detailed setup instructions.
|
|
159
|
+
|
|
160
|
+
Then authenticate:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
opencode auth login
|
|
164
|
+
# Select Provider: OpenAI
|
|
165
|
+
# Select Login method: ChatGPT Plus/Pro (Codex Subscription)
|
|
166
|
+
# Complete OAuth flow in browser
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### 4.4 Alternative: Proxy-based Authentication
|
|
170
|
+
|
|
171
|
+
For users who prefer proxy-based authentication, [VibeProxy](https://github.com/automazeio/vibeproxy) (macOS) or [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) remain available as alternatives.
|
|
115
172
|
|
|
116
173
|
### ⚠️ Warning
|
|
117
174
|
|
|
@@ -141,34 +198,6 @@ I believe in the right tool for the job. For your wallet's sake, use CLIProxyAPI
|
|
|
141
198
|
|
|
142
199
|
## Features
|
|
143
200
|
|
|
144
|
-
### Hooks
|
|
145
|
-
|
|
146
|
-
- **Todo Continuation Enforcer**: Forces the agent to complete all tasks before exiting. Eliminates the common LLM issue of "giving up halfway".
|
|
147
|
-
- **Context Window Monitor**: Implements [Context Window Anxiety Management](https://agentic-patterns.com/patterns/context-window-anxiety-management/). When context usage exceeds 70%, it reminds the agent that resources are sufficient, preventing rushed or low-quality output.
|
|
148
|
-
- **Session Notification**: Sends a native OS notification when the job is done (macOS, Linux, Windows).
|
|
149
|
-
- **Session Recovery**: Automatically recovers from API errors, ensuring session stability. Handles four scenarios:
|
|
150
|
-
- **Tool Result Missing**: When `tool_use` block exists without `tool_result` (ESC interrupt) → injects "cancelled" tool results
|
|
151
|
-
- **Thinking Block Order**: When thinking block must be first but isn't → prepends empty thinking block
|
|
152
|
-
- **Thinking Disabled Violation**: When thinking blocks exist but thinking is disabled → strips thinking blocks
|
|
153
|
-
- **Empty Content Message**: When message has only thinking/meta blocks without actual content → injects "(interrupted)" text via filesystem
|
|
154
|
-
- **Comment Checker**: Detects and reports unnecessary comments after code modifications. Smartly ignores valid patterns (BDD, directives, docstrings, shebangs) to keep the codebase clean from AI-generated artifacts.
|
|
155
|
-
- **Directory AGENTS.md Injector**: Automatically injects `AGENTS.md` contents when reading files. Searches upward from the file's directory to project root, collecting **all** `AGENTS.md` files along the path hierarchy. This enables nested, directory-specific instructions:
|
|
156
|
-
```
|
|
157
|
-
project/
|
|
158
|
-
├── AGENTS.md # Project-wide context
|
|
159
|
-
├── src/
|
|
160
|
-
│ ├── AGENTS.md # src-specific context
|
|
161
|
-
│ └── components/
|
|
162
|
-
│ ├── AGENTS.md # Component-specific context
|
|
163
|
-
│ └── Button.tsx # Reading this injects ALL 3 AGENTS.md files
|
|
164
|
-
```
|
|
165
|
-
When reading `Button.tsx`, the hook injects contexts in order: `project/AGENTS.md` → `src/AGENTS.md` → `components/AGENTS.md`. Each directory's context is injected only once per session. Inspired by Claude Code's CLAUDE.md feature.
|
|
166
|
-
- **Directory README.md Injector**: Automatically injects `README.md` contents when reading files. Works identically to the AGENTS.md Injector, searching upward from the file's directory to project root. Provides project documentation context to the LLM agent. Each directory's README is injected only once per session.
|
|
167
|
-
- **Think Mode**: Automatic extended thinking detection and mode switching. Detects when user requests deep thinking (e.g., "think deeply", "ultrathink") and dynamically adjusts model settings for enhanced reasoning.
|
|
168
|
-
- **Anthropic Auto Compact**: Automatically compacts conversation history when approaching context limits for Anthropic models.
|
|
169
|
-
- **Empty Task Response Detector**: Detects when subagent tasks return empty or meaningless responses and handles gracefully.
|
|
170
|
-
- **Grep Output Truncator**: Prevents grep output from overwhelming the context by truncating excessively long results.
|
|
171
|
-
|
|
172
201
|
### Agents
|
|
173
202
|
- **oracle** (`openai/gpt-5.2`): The architect. Expert in code reviews and strategy. Uses GPT-5.2 for its unmatched logic and reasoning capabilities. Inspired by AmpCode.
|
|
174
203
|
- **librarian** (`anthropic/claude-haiku-4-5`): Multi-repo analysis, documentation lookup, and implementation examples. Haiku is chosen for its speed, competence, excellent tool usage, and cost-efficiency. Inspired by AmpCode.
|
|
@@ -186,6 +215,12 @@ Each agent is automatically invoked by the main agent, but you can also explicit
|
|
|
186
215
|
|
|
187
216
|
Agent models, prompts, and permissions can be customized via `oh-my-opencode.json`. See [Configuration](#configuration) for details.
|
|
188
217
|
|
|
218
|
+
#### Subagent Orchestration (omo_task)
|
|
219
|
+
|
|
220
|
+
The `omo_task` tool allows agents (like `oracle`, `frontend-ui-ux-engineer`) to spawn `explore` or `librarian` as subagents to delegate specific tasks. This enables powerful workflows where an agent can "ask" another specialized agent to gather information before proceeding.
|
|
221
|
+
|
|
222
|
+
> **Note**: To prevent infinite recursion, `explore` and `librarian` agents cannot use the `omo_task` tool themselves.
|
|
223
|
+
|
|
189
224
|
### Tools
|
|
190
225
|
|
|
191
226
|
#### Built-in LSP Tools
|
|
@@ -236,10 +271,100 @@ Don't need these? Disable them via `oh-my-opencode.json`:
|
|
|
236
271
|
}
|
|
237
272
|
```
|
|
238
273
|
|
|
274
|
+
#### Background Task
|
|
275
|
+
|
|
276
|
+
Run long-running or complex tasks in the background without blocking your main session. The system automatically notifies you when tasks complete.
|
|
277
|
+
|
|
278
|
+
- **background_task**: Launch a background agent task. Specify description, prompt, and agent type. Returns immediately with a task ID.
|
|
279
|
+
- **background_output**: Check task progress (`block=false`) or wait for results (`block=true`). Supports custom timeout up to 10 minutes.
|
|
280
|
+
- **background_cancel**: Cancel a running background task by task ID.
|
|
281
|
+
|
|
282
|
+
Key capabilities:
|
|
283
|
+
- **Async Execution**: Offload complex analysis or research while you continue working
|
|
284
|
+
- **Auto Notification**: System notifies the main session when background tasks complete
|
|
285
|
+
- **Status Tracking**: Real-time progress with tool call counts and last tool used
|
|
286
|
+
- **Session Isolation**: Each task runs in an independent session
|
|
287
|
+
|
|
288
|
+
Example workflow:
|
|
289
|
+
```
|
|
290
|
+
1. Launch: background_task → returns task_id="bg_abc123"
|
|
291
|
+
2. Continue working on other tasks
|
|
292
|
+
3. System notification: "Task bg_abc123 completed"
|
|
293
|
+
4. Retrieve: background_output(task_id="bg_abc123") → get full results
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Hooks
|
|
297
|
+
|
|
298
|
+
- **Todo Continuation Enforcer**: Forces the agent to complete all tasks before exiting. Eliminates the common LLM issue of "giving up halfway".
|
|
299
|
+
- **Context Window Monitor**: Implements [Context Window Anxiety Management](https://agentic-patterns.com/patterns/context-window-anxiety-management/). When context usage exceeds 70%, it reminds the agent that resources are sufficient, preventing rushed or low-quality output.
|
|
300
|
+
- **Session Notification**: Sends a native OS notification when the job is done (macOS, Linux, Windows).
|
|
301
|
+
- **Session Recovery**: Automatically recovers from API errors, ensuring session stability. Handles four scenarios:
|
|
302
|
+
- **Tool Result Missing**: When `tool_use` block exists without `tool_result` (ESC interrupt) → injects "cancelled" tool results
|
|
303
|
+
- **Thinking Block Order**: When thinking block must be first but isn't → prepends empty thinking block
|
|
304
|
+
- **Thinking Disabled Violation**: When thinking blocks exist but thinking is disabled → strips thinking blocks
|
|
305
|
+
- **Empty Content Message**: When message has only thinking/meta blocks without actual content → injects "(interrupted)" text via filesystem
|
|
306
|
+
- **Comment Checker**: Detects and reports unnecessary comments after code modifications. Smartly ignores valid patterns (BDD, directives, docstrings, shebangs) to keep the codebase clean from AI-generated artifacts.
|
|
307
|
+
- **Directory AGENTS.md Injector**: Automatically injects `AGENTS.md` contents when reading files. Searches upward from the file's directory to project root, collecting **all** `AGENTS.md` files along the path hierarchy. This enables nested, directory-specific instructions:
|
|
308
|
+
```
|
|
309
|
+
project/
|
|
310
|
+
├── AGENTS.md # Project-wide context
|
|
311
|
+
├── src/
|
|
312
|
+
│ ├── AGENTS.md # src-specific context
|
|
313
|
+
│ └── components/
|
|
314
|
+
│ ├── AGENTS.md # Component-specific context
|
|
315
|
+
│ └── Button.tsx # Reading this injects ALL 3 AGENTS.md files
|
|
316
|
+
```
|
|
317
|
+
When reading `Button.tsx`, the hook injects contexts in order: `project/AGENTS.md` → `src/AGENTS.md` → `components/AGENTS.md`. Each directory's context is injected only once per session. Inspired by Claude Code's CLAUDE.md feature.
|
|
318
|
+
- **Directory README.md Injector**: Automatically injects `README.md` contents when reading files. Works identically to the AGENTS.md Injector, searching upward from the file's directory to project root. Provides project documentation context to the LLM agent. Each directory's README is injected only once per session.
|
|
319
|
+
- **Rules Injector**: Automatically injects rules from `.claude/rules/` directory when reading files.
|
|
320
|
+
- Searches upward from the file's directory to project root, plus `~/.claude/rules/` (user).
|
|
321
|
+
- Supports `.md` and `.mdc` files.
|
|
322
|
+
- Frontmatter-based matching with `globs` field (glob patterns).
|
|
323
|
+
- `alwaysApply: true` option for rules that should always apply.
|
|
324
|
+
- Example rule file structure:
|
|
325
|
+
```markdown
|
|
326
|
+
---
|
|
327
|
+
globs: ["*.ts", "src/**/*.js"]
|
|
328
|
+
description: "TypeScript/JavaScript coding rules"
|
|
329
|
+
---
|
|
330
|
+
- Use PascalCase for interface names
|
|
331
|
+
- Use camelCase for function names
|
|
332
|
+
```
|
|
333
|
+
- **Think Mode**: Automatic extended thinking detection and mode switching. Detects when user requests deep thinking (e.g., "think deeply", "ultrathink") and dynamically adjusts model settings for enhanced reasoning.
|
|
334
|
+
- **Anthropic Auto Compact**: Automatically compacts conversation history when approaching context limits for Anthropic models.
|
|
335
|
+
- **Empty Task Response Detector**: Detects when subagent tasks return empty or meaningless responses and handles gracefully.
|
|
336
|
+
- **Grep Output Truncator**: Prevents grep output from overwhelming the context by truncating excessively long results.
|
|
337
|
+
|
|
239
338
|
### Claude Code Compatibility
|
|
240
339
|
|
|
241
340
|
Oh My OpenCode provides seamless Claude Code configuration compatibility. If you've been using Claude Code, your existing setup works out of the box.
|
|
242
341
|
|
|
342
|
+
#### Compatibility Toggles
|
|
343
|
+
|
|
344
|
+
If you want to disable specific Claude Code compatibility features, use the `claude_code` configuration object:
|
|
345
|
+
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"claude_code": {
|
|
349
|
+
"mcp": false,
|
|
350
|
+
"commands": false,
|
|
351
|
+
"skills": false,
|
|
352
|
+
"agents": false,
|
|
353
|
+
"hooks": false
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
| Toggle | When `false`, disables loading from... | NOT affected |
|
|
359
|
+
|--------|----------------------------------------|--------------|
|
|
360
|
+
| `mcp` | `~/.claude/.mcp.json`, `./.mcp.json`, `./.claude/.mcp.json` | Built-in MCPs (context7, websearch_exa) |
|
|
361
|
+
| `commands` | `~/.claude/commands/*.md`, `./.claude/commands/*.md` | `~/.config/opencode/command/`, `./.opencode/command/` |
|
|
362
|
+
| `skills` | `~/.claude/skills/*/SKILL.md`, `./.claude/skills/*/SKILL.md` | - |
|
|
363
|
+
| `agents` | `~/.claude/agents/*.md`, `./.claude/agents/*.md` | Built-in agents (oracle, librarian, etc.) |
|
|
364
|
+
| `hooks` | `~/.claude/settings.json`, `./.claude/settings.json`, `./.claude/settings.local.json` | - |
|
|
365
|
+
|
|
366
|
+
All toggles default to `true` (enabled). Omit the entire `claude_code` object for full Claude Code compatibility.
|
|
367
|
+
|
|
243
368
|
#### Hooks Integration
|
|
244
369
|
|
|
245
370
|
Execute custom scripts via Claude Code's `settings.json` hook system. Oh My OpenCode reads and executes hooks defined in:
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity OAuth configuration constants.
|
|
3
|
+
* Values sourced from cliproxyapi/sdk/auth/antigravity.go
|
|
4
|
+
*
|
|
5
|
+
* ## Logging Policy
|
|
6
|
+
*
|
|
7
|
+
* All console logging in antigravity modules follows a consistent policy:
|
|
8
|
+
*
|
|
9
|
+
* - **Debug logs**: Guard with `if (process.env.ANTIGRAVITY_DEBUG === "1")`
|
|
10
|
+
* - Includes: info messages, warnings, non-fatal errors
|
|
11
|
+
* - Enable debugging: `ANTIGRAVITY_DEBUG=1 opencode`
|
|
12
|
+
*
|
|
13
|
+
* - **Fatal errors**: None currently. All errors are handled by returning
|
|
14
|
+
* appropriate error responses to OpenCode's auth system.
|
|
15
|
+
*
|
|
16
|
+
* This policy ensures production silence while enabling verbose debugging
|
|
17
|
+
* when needed for troubleshooting OAuth flows.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
|
|
20
|
+
export declare const ANTIGRAVITY_CLIENT_SECRET = "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";
|
|
21
|
+
export declare const ANTIGRAVITY_CALLBACK_PORT = 51121;
|
|
22
|
+
export declare const ANTIGRAVITY_REDIRECT_URI = "http://localhost:51121/oauth-callback";
|
|
23
|
+
export declare const ANTIGRAVITY_SCOPES: readonly ["https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/cclog", "https://www.googleapis.com/auth/experimentsandconfigs"];
|
|
24
|
+
export declare const ANTIGRAVITY_ENDPOINT_FALLBACKS: readonly ["https://daily-cloudcode-pa.sandbox.googleapis.com", "https://autopush-cloudcode-pa.sandbox.googleapis.com", "https://cloudcode-pa.googleapis.com"];
|
|
25
|
+
export declare const ANTIGRAVITY_API_VERSION = "v1internal";
|
|
26
|
+
export declare const ANTIGRAVITY_HEADERS: {
|
|
27
|
+
readonly "User-Agent": "google-api-nodejs-client/9.15.1";
|
|
28
|
+
readonly "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1";
|
|
29
|
+
readonly "Client-Metadata": string;
|
|
30
|
+
};
|
|
31
|
+
export declare const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
|
|
32
|
+
export declare const GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
33
|
+
export declare const GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
34
|
+
export declare const GOOGLE_USERINFO_URL = "https://www.googleapis.com/oauth2/v1/userinfo";
|
|
35
|
+
export declare const ANTIGRAVITY_TOKEN_REFRESH_BUFFER_MS = 60000;
|
|
36
|
+
export declare const SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity Fetch Interceptor
|
|
3
|
+
*
|
|
4
|
+
* Creates a custom fetch function that:
|
|
5
|
+
* - Checks token expiration and auto-refreshes
|
|
6
|
+
* - Rewrites URLs to Antigravity endpoints
|
|
7
|
+
* - Applies request transformation (including tool normalization)
|
|
8
|
+
* - Applies response transformation (including thinking extraction)
|
|
9
|
+
* - Implements endpoint fallback (daily → autopush → prod)
|
|
10
|
+
*
|
|
11
|
+
* **Body Type Assumption:**
|
|
12
|
+
* This interceptor assumes `init.body` is a JSON string (OpenAI format).
|
|
13
|
+
* Non-string bodies (ReadableStream, Blob, FormData, URLSearchParams, etc.)
|
|
14
|
+
* are passed through unchanged to the original fetch to avoid breaking
|
|
15
|
+
* other requests that may not be OpenAI-format API calls.
|
|
16
|
+
*
|
|
17
|
+
* Debug logging available via ANTIGRAVITY_DEBUG=1 environment variable.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Auth interface matching OpenCode's auth system
|
|
21
|
+
*/
|
|
22
|
+
interface Auth {
|
|
23
|
+
access?: string;
|
|
24
|
+
refresh?: string;
|
|
25
|
+
expires?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Client interface for auth operations
|
|
29
|
+
*/
|
|
30
|
+
interface AuthClient {
|
|
31
|
+
set(providerId: string, auth: Auth): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create Antigravity fetch interceptor
|
|
35
|
+
*
|
|
36
|
+
* Factory function that creates a custom fetch function for Antigravity API.
|
|
37
|
+
* Handles token management, request/response transformation, and endpoint fallback.
|
|
38
|
+
*
|
|
39
|
+
* @param getAuth - Async function to retrieve current auth state
|
|
40
|
+
* @param client - Auth client for saving updated tokens
|
|
41
|
+
* @param providerId - Provider identifier (e.g., "google")
|
|
42
|
+
* @param clientId - Optional custom client ID for token refresh (defaults to ANTIGRAVITY_CLIENT_ID)
|
|
43
|
+
* @param clientSecret - Optional custom client secret for token refresh (defaults to ANTIGRAVITY_CLIENT_SECRET)
|
|
44
|
+
* @returns Custom fetch function compatible with standard fetch signature
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const customFetch = createAntigravityFetch(
|
|
49
|
+
* () => auth(),
|
|
50
|
+
* client,
|
|
51
|
+
* "google",
|
|
52
|
+
* "custom-client-id",
|
|
53
|
+
* "custom-client-secret"
|
|
54
|
+
* )
|
|
55
|
+
*
|
|
56
|
+
* // Use like standard fetch
|
|
57
|
+
* const response = await customFetch("https://api.example.com/chat", {
|
|
58
|
+
* method: "POST",
|
|
59
|
+
* body: JSON.stringify({ messages: [...] })
|
|
60
|
+
* })
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function createAntigravityFetch(getAuth: () => Promise<Auth>, client: AuthClient, providerId: string, clientId?: string, clientSecret?: string): (url: string, init?: RequestInit) => Promise<Response>;
|
|
64
|
+
/**
|
|
65
|
+
* Type export for createAntigravityFetch return type
|
|
66
|
+
*/
|
|
67
|
+
export type AntigravityFetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export * from "./oauth";
|
|
4
|
+
export * from "./token";
|
|
5
|
+
export * from "./project";
|
|
6
|
+
export * from "./request";
|
|
7
|
+
export * from "./response";
|
|
8
|
+
export * from "./tools";
|
|
9
|
+
export * from "./thinking";
|
|
10
|
+
export * from "./thought-signature-store";
|
|
11
|
+
export * from "./message-converter";
|
|
12
|
+
export * from "./fetch";
|
|
13
|
+
export * from "./plugin";
|