vibe-open-auth 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/src/antigravity/oauth.d.ts +31 -0
- package/dist/src/antigravity/oauth.d.ts.map +1 -0
- package/dist/src/antigravity/oauth.js +168 -0
- package/dist/src/antigravity/oauth.js.map +1 -0
- package/dist/src/constants.d.ts +108 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +154 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/cache.d.ts +3 -0
- package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/cache.js +71 -0
- package/dist/src/hooks/auto-update-checker/cache.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/checker.d.ts +16 -0
- package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/checker.js +237 -0
- package/dist/src/hooks/auto-update-checker/checker.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/constants.d.ts +9 -0
- package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/constants.js +23 -0
- package/dist/src/hooks/auto-update-checker/constants.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/index.d.ts +34 -0
- package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/index.js +125 -0
- package/dist/src/hooks/auto-update-checker/index.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/types.d.ts +25 -0
- package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/types.js +1 -0
- package/dist/src/hooks/auto-update-checker/types.js.map +1 -0
- package/dist/src/kiro/auth.d.ts +13 -0
- package/dist/src/kiro/auth.d.ts.map +1 -0
- package/dist/src/kiro/auth.js +101 -0
- package/dist/src/kiro/auth.js.map +1 -0
- package/dist/src/kiro/eventstream.d.ts +14 -0
- package/dist/src/kiro/eventstream.d.ts.map +1 -0
- package/dist/src/kiro/eventstream.js +65 -0
- package/dist/src/kiro/eventstream.js.map +1 -0
- package/dist/src/kiro/handler.d.ts +2 -0
- package/dist/src/kiro/handler.d.ts.map +1 -0
- package/dist/src/kiro/handler.js +314 -0
- package/dist/src/kiro/handler.js.map +1 -0
- package/dist/src/kiro/index.d.ts +7 -0
- package/dist/src/kiro/index.d.ts.map +1 -0
- package/dist/src/kiro/index.js +7 -0
- package/dist/src/kiro/index.js.map +1 -0
- package/dist/src/kiro/plugin.d.ts +4 -0
- package/dist/src/kiro/plugin.d.ts.map +1 -0
- package/dist/src/kiro/plugin.js +423 -0
- package/dist/src/kiro/plugin.js.map +1 -0
- package/dist/src/kiro/request.d.ts +41 -0
- package/dist/src/kiro/request.d.ts.map +1 -0
- package/dist/src/kiro/request.js +241 -0
- package/dist/src/kiro/request.js.map +1 -0
- package/dist/src/kiro/response.d.ts +69 -0
- package/dist/src/kiro/response.d.ts.map +1 -0
- package/dist/src/kiro/response.js +196 -0
- package/dist/src/kiro/response.js.map +1 -0
- package/dist/src/kiro/storage.d.ts +28 -0
- package/dist/src/kiro/storage.d.ts.map +1 -0
- package/dist/src/kiro/storage.js +139 -0
- package/dist/src/kiro/storage.js.map +1 -0
- package/dist/src/kiro/types.d.ts +178 -0
- package/dist/src/kiro/types.d.ts.map +1 -0
- package/dist/src/kiro/types.js +23 -0
- package/dist/src/kiro/types.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +66 -0
- package/dist/src/plugin/accounts.d.ts.map +1 -0
- package/dist/src/plugin/accounts.js +435 -0
- package/dist/src/plugin/accounts.js.map +1 -0
- package/dist/src/plugin/auth.d.ts +21 -0
- package/dist/src/plugin/auth.d.ts.map +1 -0
- package/dist/src/plugin/auth.js +46 -0
- package/dist/src/plugin/auth.js.map +1 -0
- package/dist/src/plugin/cache/index.d.ts +5 -0
- package/dist/src/plugin/cache/index.d.ts.map +1 -0
- package/dist/src/plugin/cache/index.js +5 -0
- package/dist/src/plugin/cache/index.js.map +1 -0
- package/dist/src/plugin/cache/signature-cache.d.ts +111 -0
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -0
- package/dist/src/plugin/cache/signature-cache.js +373 -0
- package/dist/src/plugin/cache/signature-cache.js.map +1 -0
- package/dist/src/plugin/cache.d.ts +44 -0
- package/dist/src/plugin/cache.d.ts.map +1 -0
- package/dist/src/plugin/cache.js +200 -0
- package/dist/src/plugin/cache.js.map +1 -0
- package/dist/src/plugin/cli.d.ts +19 -0
- package/dist/src/plugin/cli.d.ts.map +1 -0
- package/dist/src/plugin/cli.js +59 -0
- package/dist/src/plugin/cli.js.map +1 -0
- package/dist/src/plugin/config/index.d.ts +16 -0
- package/dist/src/plugin/config/index.d.ts.map +1 -0
- package/dist/src/plugin/config/index.js +16 -0
- package/dist/src/plugin/config/index.js.map +1 -0
- package/dist/src/plugin/config/loader.d.ts +35 -0
- package/dist/src/plugin/config/loader.d.ts.map +1 -0
- package/dist/src/plugin/config/loader.js +187 -0
- package/dist/src/plugin/config/loader.js.map +1 -0
- package/dist/src/plugin/config/schema.d.ts +298 -0
- package/dist/src/plugin/config/schema.d.ts.map +1 -0
- package/dist/src/plugin/config/schema.js +266 -0
- package/dist/src/plugin/config/schema.js.map +1 -0
- package/dist/src/plugin/core/streaming/index.d.ts +3 -0
- package/dist/src/plugin/core/streaming/index.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/index.js +3 -0
- package/dist/src/plugin/core/streaming/index.js.map +1 -0
- package/dist/src/plugin/core/streaming/transformer.d.ts +10 -0
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/transformer.js +228 -0
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
- package/dist/src/plugin/core/streaming/types.d.ts +27 -0
- package/dist/src/plugin/core/streaming/types.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/types.js +1 -0
- package/dist/src/plugin/core/streaming/types.js.map +1 -0
- package/dist/src/plugin/debug.d.ts +68 -0
- package/dist/src/plugin/debug.d.ts.map +1 -0
- package/dist/src/plugin/debug.js +321 -0
- package/dist/src/plugin/debug.js.map +1 -0
- package/dist/src/plugin/errors.d.ts +28 -0
- package/dist/src/plugin/errors.d.ts.map +1 -0
- package/dist/src/plugin/errors.js +42 -0
- package/dist/src/plugin/errors.js.map +1 -0
- package/dist/src/plugin/logger.d.ts +54 -0
- package/dist/src/plugin/logger.d.ts.map +1 -0
- package/dist/src/plugin/logger.js +120 -0
- package/dist/src/plugin/logger.js.map +1 -0
- package/dist/src/plugin/project.d.ts +33 -0
- package/dist/src/plugin/project.d.ts.map +1 -0
- package/dist/src/plugin/project.js +239 -0
- package/dist/src/plugin/project.js.map +1 -0
- package/dist/src/plugin/recovery/constants.d.ts +22 -0
- package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
- package/dist/src/plugin/recovery/constants.js +43 -0
- package/dist/src/plugin/recovery/constants.js.map +1 -0
- package/dist/src/plugin/recovery/index.d.ts +12 -0
- package/dist/src/plugin/recovery/index.d.ts.map +1 -0
- package/dist/src/plugin/recovery/index.js +12 -0
- package/dist/src/plugin/recovery/index.js.map +1 -0
- package/dist/src/plugin/recovery/storage.d.ts +24 -0
- package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
- package/dist/src/plugin/recovery/storage.js +354 -0
- package/dist/src/plugin/recovery/storage.js.map +1 -0
- package/dist/src/plugin/recovery/types.d.ts +116 -0
- package/dist/src/plugin/recovery/types.d.ts.map +1 -0
- package/dist/src/plugin/recovery/types.js +6 -0
- package/dist/src/plugin/recovery/types.js.map +1 -0
- package/dist/src/plugin/recovery.d.ts +61 -0
- package/dist/src/plugin/recovery.d.ts.map +1 -0
- package/dist/src/plugin/recovery.js +376 -0
- package/dist/src/plugin/recovery.js.map +1 -0
- package/dist/src/plugin/refresh-queue.d.ts +101 -0
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
- package/dist/src/plugin/refresh-queue.js +244 -0
- package/dist/src/plugin/refresh-queue.js.map +1 -0
- package/dist/src/plugin/request-helpers.d.ts +275 -0
- package/dist/src/plugin/request-helpers.d.ts.map +1 -0
- package/dist/src/plugin/request-helpers.js +2233 -0
- package/dist/src/plugin/request-helpers.js.map +1 -0
- package/dist/src/plugin/request.d.ts +87 -0
- package/dist/src/plugin/request.d.ts.map +1 -0
- package/dist/src/plugin/request.js +1333 -0
- package/dist/src/plugin/request.js.map +1 -0
- package/dist/src/plugin/server.d.ts +23 -0
- package/dist/src/plugin/server.d.ts.map +1 -0
- package/dist/src/plugin/server.js +222 -0
- package/dist/src/plugin/server.js.map +1 -0
- package/dist/src/plugin/storage.d.ts +77 -0
- package/dist/src/plugin/storage.d.ts.map +1 -0
- package/dist/src/plugin/storage.js +311 -0
- package/dist/src/plugin/storage.js.map +1 -0
- package/dist/src/plugin/stores/signature-store.d.ts +5 -0
- package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
- package/dist/src/plugin/stores/signature-store.js +25 -0
- package/dist/src/plugin/stores/signature-store.js.map +1 -0
- package/dist/src/plugin/thinking-recovery.d.ts +90 -0
- package/dist/src/plugin/thinking-recovery.d.ts.map +1 -0
- package/dist/src/plugin/thinking-recovery.js +316 -0
- package/dist/src/plugin/thinking-recovery.js.map +1 -0
- package/dist/src/plugin/token.d.ts +19 -0
- package/dist/src/plugin/token.d.ts.map +1 -0
- package/dist/src/plugin/token.js +128 -0
- package/dist/src/plugin/token.js.map +1 -0
- package/dist/src/plugin/transform/claude.d.ts +80 -0
- package/dist/src/plugin/transform/claude.d.ts.map +1 -0
- package/dist/src/plugin/transform/claude.js +265 -0
- package/dist/src/plugin/transform/claude.js.map +1 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +35 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.js +225 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.js.map +1 -0
- package/dist/src/plugin/transform/gemini.d.ts +63 -0
- package/dist/src/plugin/transform/gemini.d.ts.map +1 -0
- package/dist/src/plugin/transform/gemini.js +161 -0
- package/dist/src/plugin/transform/gemini.js.map +1 -0
- package/dist/src/plugin/transform/index.d.ts +15 -0
- package/dist/src/plugin/transform/index.d.ts.map +1 -0
- package/dist/src/plugin/transform/index.js +14 -0
- package/dist/src/plugin/transform/index.js.map +1 -0
- package/dist/src/plugin/transform/model-resolver.d.ts +89 -0
- package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -0
- package/dist/src/plugin/transform/model-resolver.js +288 -0
- package/dist/src/plugin/transform/model-resolver.js.map +1 -0
- package/dist/src/plugin/transform/types.d.ts +95 -0
- package/dist/src/plugin/transform/types.d.ts.map +1 -0
- package/dist/src/plugin/transform/types.js +1 -0
- package/dist/src/plugin/transform/types.js.map +1 -0
- package/dist/src/plugin/types.d.ts +96 -0
- package/dist/src/plugin/types.d.ts.map +1 -0
- package/dist/src/plugin/types.js +1 -0
- package/dist/src/plugin/types.js.map +1 -0
- package/dist/src/plugin.d.ts +8 -0
- package/dist/src/plugin.d.ts.map +1 -0
- package/dist/src/plugin.js +1639 -0
- package/dist/src/plugin.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jens
|
|
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.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# vibe-open-auth
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
|
|
5
|
+
OpenCode plugin for Google Antigravity and Kiro (AWS CodeWhisperer) APIs. Access Claude and Gemini models using Google or AWS credentials.
|
|
6
|
+
|
|
7
|
+
> Fork of [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) with Kiro support and additional fixes.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Google Antigravity** - Access Claude and Gemini via Google OAuth
|
|
12
|
+
- **Kiro (AWS)** - Access Claude Opus/Sonnet via AWS Builder ID
|
|
13
|
+
- Dual Quota System - Antigravity + Gemini CLI quota
|
|
14
|
+
- Multi-Account Rotation - auto-switches on rate limit
|
|
15
|
+
- Session Recovery - auto-recover from tool_result_missing errors
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Add to `~/.config/opencode/opencode.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"plugin": ["github:frankekn/vibe-open-auth"],
|
|
24
|
+
"provider": {
|
|
25
|
+
"google": {
|
|
26
|
+
"models": {
|
|
27
|
+
"kiro-claude-opus-4-5": {
|
|
28
|
+
"name": "Claude Opus 4.5 (Kiro)",
|
|
29
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
30
|
+
"modalities": { "input": ["text", "image"], "output": ["text"] }
|
|
31
|
+
},
|
|
32
|
+
"kiro-claude-sonnet-4-5": {
|
|
33
|
+
"name": "Claude Sonnet 4.5 (Kiro)",
|
|
34
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
35
|
+
"modalities": { "input": ["text", "image"], "output": ["text"] }
|
|
36
|
+
},
|
|
37
|
+
"antigravity-claude-opus-4-5-thinking": {
|
|
38
|
+
"name": "Claude Opus 4.5 Thinking (Antigravity)",
|
|
39
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
40
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
41
|
+
"variants": {
|
|
42
|
+
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
|
|
43
|
+
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"antigravity-gemini-3-flash": {
|
|
47
|
+
"name": "Gemini 3 Flash (Antigravity)",
|
|
48
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
49
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
50
|
+
"variants": {
|
|
51
|
+
"low": { "thinkingLevel": "low" },
|
|
52
|
+
"high": { "thinkingLevel": "high" }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Kiro (requires Kiro IDE login first)
|
|
65
|
+
opencode run "Hello" --model=google/kiro-claude-opus-4-5
|
|
66
|
+
|
|
67
|
+
# Antigravity (requires Google OAuth)
|
|
68
|
+
opencode run "Hello" --model=google/antigravity-claude-opus-4-5-thinking --variant=max
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Available Models
|
|
72
|
+
|
|
73
|
+
### Kiro (AWS CodeWhisperer)
|
|
74
|
+
|
|
75
|
+
Requires: Login to [Kiro IDE](https://kiro.dev) first (uses `~/.aws/sso/cache/kiro-auth-token.json`)
|
|
76
|
+
|
|
77
|
+
| Model | Description |
|
|
78
|
+
|-------|-------------|
|
|
79
|
+
| `kiro-claude-opus-4-5` | Claude Opus 4.5 |
|
|
80
|
+
| `kiro-claude-sonnet-4-5` | Claude Sonnet 4.5 |
|
|
81
|
+
|
|
82
|
+
### Antigravity (Google)
|
|
83
|
+
|
|
84
|
+
Requires: `opencode auth login` with Google account
|
|
85
|
+
|
|
86
|
+
| Model | Variants |
|
|
87
|
+
|-------|----------|
|
|
88
|
+
| `antigravity-gemini-3-pro` | low, high |
|
|
89
|
+
| `antigravity-gemini-3-flash` | minimal, low, medium, high |
|
|
90
|
+
| `antigravity-claude-sonnet-4-5` | - |
|
|
91
|
+
| `antigravity-claude-sonnet-4-5-thinking` | low, max |
|
|
92
|
+
| `antigravity-claude-opus-4-5-thinking` | low, max |
|
|
93
|
+
|
|
94
|
+
### Gemini CLI
|
|
95
|
+
|
|
96
|
+
| Model |
|
|
97
|
+
|-------|
|
|
98
|
+
| `gemini-2.5-flash` |
|
|
99
|
+
| `gemini-2.5-pro` |
|
|
100
|
+
| `gemini-3-flash-preview` |
|
|
101
|
+
| `gemini-3-pro-preview` |
|
|
102
|
+
|
|
103
|
+
## Configuration
|
|
104
|
+
|
|
105
|
+
Create `~/.config/opencode/antigravity.json`:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"quiet_mode": false,
|
|
110
|
+
"debug": false,
|
|
111
|
+
"session_recovery": true,
|
|
112
|
+
"auto_resume": true
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Debug mode:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
OPENCODE_ANTIGRAVITY_DEBUG=1 opencode
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Multi-Account
|
|
123
|
+
|
|
124
|
+
Add multiple Google accounts for higher quota:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
opencode auth login
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Accounts auto-rotate when rate limited.
|
|
131
|
+
|
|
132
|
+
## Credits
|
|
133
|
+
|
|
134
|
+
- [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) - Original plugin by [@NoeFabris](https://github.com/NoeFabris)
|
|
135
|
+
- [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) - Gemini OAuth groundwork by [@jenslys](https://github.com/jenslys)
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AntigravityCLIOAuthPlugin, GoogleOAuthPlugin, } from "./src/plugin";
|
|
2
|
+
export { authorizeAntigravity, exchangeAntigravity, } from "./src/antigravity/oauth";
|
|
3
|
+
export type { AntigravityAuthorization, AntigravityTokenExchangeResult, } from "./src/antigravity/oauth";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result returned to the caller after constructing an OAuth authorization URL.
|
|
3
|
+
*/
|
|
4
|
+
export interface AntigravityAuthorization {
|
|
5
|
+
url: string;
|
|
6
|
+
verifier: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
}
|
|
9
|
+
interface AntigravityTokenExchangeSuccess {
|
|
10
|
+
type: "success";
|
|
11
|
+
refresh: string;
|
|
12
|
+
access: string;
|
|
13
|
+
expires: number;
|
|
14
|
+
email?: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
}
|
|
17
|
+
interface AntigravityTokenExchangeFailure {
|
|
18
|
+
type: "failed";
|
|
19
|
+
error: string;
|
|
20
|
+
}
|
|
21
|
+
export type AntigravityTokenExchangeResult = AntigravityTokenExchangeSuccess | AntigravityTokenExchangeFailure;
|
|
22
|
+
/**
|
|
23
|
+
* Build the Antigravity OAuth authorization URL including PKCE and optional project metadata.
|
|
24
|
+
*/
|
|
25
|
+
export declare function authorizeAntigravity(projectId?: string): Promise<AntigravityAuthorization>;
|
|
26
|
+
/**
|
|
27
|
+
* Exchange an authorization code for Antigravity CLI access and refresh tokens.
|
|
28
|
+
*/
|
|
29
|
+
export declare function exchangeAntigravity(code: string, state: string): Promise<AntigravityTokenExchangeResult>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/antigravity/oauth.ts"],"names":[],"mappings":"AA0BA;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,8BAA8B,GACtC,+BAA+B,GAC/B,+BAA+B,CAAC;AAoCpC;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,SAAK,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAsB5F;AAqFD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,8BAA8B,CAAC,CAkEzC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { generatePKCE } from "@openauthjs/openauth/pkce";
|
|
2
|
+
import { ANTIGRAVITY_CLIENT_ID, ANTIGRAVITY_CLIENT_SECRET, ANTIGRAVITY_REDIRECT_URI, ANTIGRAVITY_SCOPES, ANTIGRAVITY_ENDPOINT_FALLBACKS, ANTIGRAVITY_LOAD_ENDPOINTS, ANTIGRAVITY_HEADERS, } from "../constants";
|
|
3
|
+
import { createLogger } from "../plugin/logger";
|
|
4
|
+
import { calculateTokenExpiry } from "../plugin/auth";
|
|
5
|
+
const log = createLogger("oauth");
|
|
6
|
+
/**
|
|
7
|
+
* Encode an object into a URL-safe base64 string.
|
|
8
|
+
*/
|
|
9
|
+
function encodeState(payload) {
|
|
10
|
+
return Buffer.from(JSON.stringify(payload), "utf8").toString("base64url");
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Decode an OAuth state parameter back into its structured representation.
|
|
14
|
+
*/
|
|
15
|
+
function decodeState(state) {
|
|
16
|
+
const normalized = state.replace(/-/g, "+").replace(/_/g, "/");
|
|
17
|
+
const padded = normalized.padEnd(normalized.length + ((4 - normalized.length % 4) % 4), "=");
|
|
18
|
+
const json = Buffer.from(padded, "base64").toString("utf8");
|
|
19
|
+
const parsed = JSON.parse(json);
|
|
20
|
+
if (typeof parsed.verifier !== "string") {
|
|
21
|
+
throw new Error("Missing PKCE verifier in state");
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
verifier: parsed.verifier,
|
|
25
|
+
projectId: typeof parsed.projectId === "string" ? parsed.projectId : "",
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build the Antigravity OAuth authorization URL including PKCE and optional project metadata.
|
|
30
|
+
*/
|
|
31
|
+
export async function authorizeAntigravity(projectId = "") {
|
|
32
|
+
const pkce = (await generatePKCE());
|
|
33
|
+
const url = new URL("https://accounts.google.com/o/oauth2/v2/auth");
|
|
34
|
+
url.searchParams.set("client_id", ANTIGRAVITY_CLIENT_ID);
|
|
35
|
+
url.searchParams.set("response_type", "code");
|
|
36
|
+
url.searchParams.set("redirect_uri", ANTIGRAVITY_REDIRECT_URI);
|
|
37
|
+
url.searchParams.set("scope", ANTIGRAVITY_SCOPES.join(" "));
|
|
38
|
+
url.searchParams.set("code_challenge", pkce.challenge);
|
|
39
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
40
|
+
url.searchParams.set("state", encodeState({ verifier: pkce.verifier, projectId: projectId || "" }));
|
|
41
|
+
url.searchParams.set("access_type", "offline");
|
|
42
|
+
url.searchParams.set("prompt", "consent");
|
|
43
|
+
return {
|
|
44
|
+
url: url.toString(),
|
|
45
|
+
verifier: pkce.verifier,
|
|
46
|
+
projectId: projectId || "",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const FETCH_TIMEOUT_MS = 10000;
|
|
50
|
+
async function fetchWithTimeout(url, options, timeoutMs = FETCH_TIMEOUT_MS) {
|
|
51
|
+
const controller = new AbortController();
|
|
52
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
53
|
+
try {
|
|
54
|
+
return await fetch(url, { ...options, signal: controller.signal });
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
clearTimeout(timeout);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function fetchProjectID(accessToken) {
|
|
61
|
+
const errors = [];
|
|
62
|
+
const loadHeaders = {
|
|
63
|
+
Authorization: `Bearer ${accessToken}`,
|
|
64
|
+
"Content-Type": "application/json",
|
|
65
|
+
"User-Agent": "google-api-nodejs-client/9.15.1",
|
|
66
|
+
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
67
|
+
"Client-Metadata": ANTIGRAVITY_HEADERS["Client-Metadata"],
|
|
68
|
+
};
|
|
69
|
+
const loadEndpoints = Array.from(new Set([...ANTIGRAVITY_LOAD_ENDPOINTS, ...ANTIGRAVITY_ENDPOINT_FALLBACKS]));
|
|
70
|
+
for (const baseEndpoint of loadEndpoints) {
|
|
71
|
+
try {
|
|
72
|
+
const url = `${baseEndpoint}/v1internal:loadCodeAssist`;
|
|
73
|
+
const response = await fetchWithTimeout(url, {
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: loadHeaders,
|
|
76
|
+
body: JSON.stringify({
|
|
77
|
+
metadata: {
|
|
78
|
+
ideType: "IDE_UNSPECIFIED",
|
|
79
|
+
platform: "PLATFORM_UNSPECIFIED",
|
|
80
|
+
pluginType: "GEMINI",
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
if (!response.ok) {
|
|
85
|
+
const message = await response.text().catch(() => "");
|
|
86
|
+
errors.push(`loadCodeAssist ${response.status} at ${baseEndpoint}${message ? `: ${message}` : ""}`);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const data = await response.json();
|
|
90
|
+
if (typeof data.cloudaicompanionProject === "string" && data.cloudaicompanionProject) {
|
|
91
|
+
return data.cloudaicompanionProject;
|
|
92
|
+
}
|
|
93
|
+
if (data.cloudaicompanionProject &&
|
|
94
|
+
typeof data.cloudaicompanionProject.id === "string" &&
|
|
95
|
+
data.cloudaicompanionProject.id) {
|
|
96
|
+
return data.cloudaicompanionProject.id;
|
|
97
|
+
}
|
|
98
|
+
errors.push(`loadCodeAssist missing project id at ${baseEndpoint}`);
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
errors.push(`loadCodeAssist error at ${baseEndpoint}: ${e instanceof Error ? e.message : String(e)}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (errors.length) {
|
|
105
|
+
log.warn("Failed to resolve Antigravity project via loadCodeAssist", { errors: errors.join("; ") });
|
|
106
|
+
}
|
|
107
|
+
return "";
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Exchange an authorization code for Antigravity CLI access and refresh tokens.
|
|
111
|
+
*/
|
|
112
|
+
export async function exchangeAntigravity(code, state) {
|
|
113
|
+
try {
|
|
114
|
+
const { verifier, projectId } = decodeState(state);
|
|
115
|
+
const startTime = Date.now();
|
|
116
|
+
const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
|
|
117
|
+
method: "POST",
|
|
118
|
+
headers: {
|
|
119
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
120
|
+
},
|
|
121
|
+
body: new URLSearchParams({
|
|
122
|
+
client_id: ANTIGRAVITY_CLIENT_ID,
|
|
123
|
+
client_secret: ANTIGRAVITY_CLIENT_SECRET,
|
|
124
|
+
code,
|
|
125
|
+
grant_type: "authorization_code",
|
|
126
|
+
redirect_uri: ANTIGRAVITY_REDIRECT_URI,
|
|
127
|
+
code_verifier: verifier,
|
|
128
|
+
}),
|
|
129
|
+
});
|
|
130
|
+
if (!tokenResponse.ok) {
|
|
131
|
+
const errorText = await tokenResponse.text();
|
|
132
|
+
return { type: "failed", error: errorText };
|
|
133
|
+
}
|
|
134
|
+
const tokenPayload = (await tokenResponse.json());
|
|
135
|
+
const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v1/userinfo?alt=json", {
|
|
136
|
+
headers: {
|
|
137
|
+
Authorization: `Bearer ${tokenPayload.access_token}`,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
const userInfo = userInfoResponse.ok
|
|
141
|
+
? (await userInfoResponse.json())
|
|
142
|
+
: {};
|
|
143
|
+
const refreshToken = tokenPayload.refresh_token;
|
|
144
|
+
if (!refreshToken) {
|
|
145
|
+
return { type: "failed", error: "Missing refresh token in response" };
|
|
146
|
+
}
|
|
147
|
+
let effectiveProjectId = projectId;
|
|
148
|
+
if (!effectiveProjectId) {
|
|
149
|
+
effectiveProjectId = await fetchProjectID(tokenPayload.access_token);
|
|
150
|
+
}
|
|
151
|
+
const storedRefresh = `${refreshToken}|${effectiveProjectId || ""}`;
|
|
152
|
+
return {
|
|
153
|
+
type: "success",
|
|
154
|
+
refresh: storedRefresh,
|
|
155
|
+
access: tokenPayload.access_token,
|
|
156
|
+
expires: calculateTokenExpiry(startTime, tokenPayload.expires_in),
|
|
157
|
+
email: userInfo.email,
|
|
158
|
+
projectId: effectiveProjectId || "",
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
return {
|
|
163
|
+
type: "failed",
|
|
164
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/antigravity/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,8BAA8B,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AI,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,EAAE,CAAC;QACxE,CAAC;QAED,IAAI,kBAAkB,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,kBAAkB,GAAG,MAAM,cAAc,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,aAAa,GAAG,GAAG,YAAY,IAAI,kBAAkB,IAAI,EAAE,EAAE,CAAC;QAEpE,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,aAAa;YACtB,MAAM,EAAE,YAAY,CAAC,YAAY;YACjC,OAAO,EAAE,oBAAoB,CAAC,SAAS,EAAE,YAAY,CAAC,UAAU,CAAC;YACjE,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,SAAS,EAAE,kBAAkB,IAAI,EAAE;SACpC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants used for Antigravity OAuth flows and Cloud Code Assist API integration.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
|
|
5
|
+
/**
|
|
6
|
+
* Client secret issued for the Antigravity OAuth application.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ANTIGRAVITY_CLIENT_SECRET = "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";
|
|
9
|
+
/**
|
|
10
|
+
* Scopes required for Antigravity integrations.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ANTIGRAVITY_SCOPES: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* OAuth redirect URI used by the local CLI callback server.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ANTIGRAVITY_REDIRECT_URI = "http://localhost:51121/oauth-callback";
|
|
17
|
+
/**
|
|
18
|
+
* Root endpoints for the Antigravity API (in fallback order).
|
|
19
|
+
* CLIProxy and Vibeproxy use the daily sandbox endpoint first,
|
|
20
|
+
* then fallback to autopush and prod if needed.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ANTIGRAVITY_ENDPOINT_DAILY = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
|
23
|
+
export declare const ANTIGRAVITY_ENDPOINT_AUTOPUSH = "https://autopush-cloudcode-pa.sandbox.googleapis.com";
|
|
24
|
+
export declare const ANTIGRAVITY_ENDPOINT_PROD = "https://cloudcode-pa.googleapis.com";
|
|
25
|
+
/**
|
|
26
|
+
* Endpoint fallback order (daily → autopush → prod).
|
|
27
|
+
* Shared across request handling and project discovery to mirror CLIProxy behavior.
|
|
28
|
+
*/
|
|
29
|
+
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"];
|
|
30
|
+
/**
|
|
31
|
+
* Preferred endpoint order for project discovery (prod first, then fallbacks).
|
|
32
|
+
* loadCodeAssist appears to be best supported on prod for managed project resolution.
|
|
33
|
+
*/
|
|
34
|
+
export declare const ANTIGRAVITY_LOAD_ENDPOINTS: readonly ["https://cloudcode-pa.googleapis.com", "https://daily-cloudcode-pa.sandbox.googleapis.com", "https://autopush-cloudcode-pa.sandbox.googleapis.com"];
|
|
35
|
+
/**
|
|
36
|
+
* Primary endpoint to use (daily sandbox - same as CLIProxy/Vibeproxy).
|
|
37
|
+
*/
|
|
38
|
+
export declare const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
|
39
|
+
/**
|
|
40
|
+
* Gemini CLI endpoint (production).
|
|
41
|
+
* Used for models without :antigravity suffix.
|
|
42
|
+
* Same as opencode-gemini-auth's GEMINI_CODE_ASSIST_ENDPOINT.
|
|
43
|
+
*/
|
|
44
|
+
export declare const GEMINI_CLI_ENDPOINT = "https://cloudcode-pa.googleapis.com";
|
|
45
|
+
/**
|
|
46
|
+
* Hardcoded project id used when Antigravity does not return one (e.g., business/workspace accounts).
|
|
47
|
+
*/
|
|
48
|
+
export declare const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
|
|
49
|
+
export declare const ANTIGRAVITY_HEADERS: {
|
|
50
|
+
readonly "User-Agent": "antigravity/1.11.5 windows/amd64";
|
|
51
|
+
readonly "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1";
|
|
52
|
+
readonly "Client-Metadata": "{\"ideType\":\"IDE_UNSPECIFIED\",\"platform\":\"PLATFORM_UNSPECIFIED\",\"pluginType\":\"GEMINI\"}";
|
|
53
|
+
};
|
|
54
|
+
export declare const GEMINI_CLI_HEADERS: {
|
|
55
|
+
readonly "User-Agent": "google-api-nodejs-client/9.15.1";
|
|
56
|
+
readonly "X-Goog-Api-Client": "gl-node/22.17.0";
|
|
57
|
+
readonly "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI";
|
|
58
|
+
};
|
|
59
|
+
export type HeaderStyle = "antigravity" | "gemini-cli";
|
|
60
|
+
/**
|
|
61
|
+
* Provider identifier shared between the plugin loader and credential store.
|
|
62
|
+
*/
|
|
63
|
+
export declare const ANTIGRAVITY_PROVIDER_ID = "google";
|
|
64
|
+
/**
|
|
65
|
+
* Whether to preserve thinking blocks for Claude models.
|
|
66
|
+
*
|
|
67
|
+
* This value is now controlled via config (see plugin/config/schema.ts).
|
|
68
|
+
* The default is false for reliability. Set to true via:
|
|
69
|
+
* - Config file: { "keep_thinking": true }
|
|
70
|
+
* - Env var: OPENCODE_ANTIGRAVITY_KEEP_THINKING=1
|
|
71
|
+
*
|
|
72
|
+
* @deprecated Use config.keep_thinking from loadConfig() instead.
|
|
73
|
+
* This export is kept for backward compatibility but reads from env.
|
|
74
|
+
*/
|
|
75
|
+
export declare const KEEP_THINKING_BLOCKS: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* System instruction for Claude tool usage hardening.
|
|
78
|
+
* Prevents hallucinated parameters by explicitly stating the rules.
|
|
79
|
+
*
|
|
80
|
+
* This is injected when tools are present to reduce cases where Claude
|
|
81
|
+
* uses parameter names from its training data instead of the actual schema.
|
|
82
|
+
*/
|
|
83
|
+
export declare const CLAUDE_TOOL_SYSTEM_INSTRUCTION = "CRITICAL TOOL USAGE INSTRUCTIONS:\nYou are operating in a custom environment where tool definitions differ from your training data.\nYou MUST follow these rules strictly:\n\n1. DO NOT use your internal training data to guess tool parameters\n2. ONLY use the exact parameter structure defined in the tool schema\n3. Parameter names in schemas are EXACT - do not substitute with similar names from your training\n4. Array parameters have specific item types - check the schema's 'items' field for the exact structure\n5. When you see \"STRICT PARAMETERS\" in a tool description, those type definitions override any assumptions\n6. Tool use in agentic workflows is REQUIRED - you must call tools with the exact parameters specified\n\nIf you are unsure about a tool's parameters, YOU MUST read the schema definition carefully.";
|
|
84
|
+
/**
|
|
85
|
+
* Template for parameter signature injection into tool descriptions.
|
|
86
|
+
* {params} will be replaced with the actual parameter list.
|
|
87
|
+
*/
|
|
88
|
+
export declare const CLAUDE_DESCRIPTION_PROMPT = "\n\n\u26A0\uFE0F STRICT PARAMETERS: {params}.";
|
|
89
|
+
export declare const EMPTY_SCHEMA_PLACEHOLDER_NAME = "_placeholder";
|
|
90
|
+
export declare const EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION = "Placeholder. Always pass true.";
|
|
91
|
+
/**
|
|
92
|
+
* System instruction for Antigravity requests.
|
|
93
|
+
* This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
|
|
94
|
+
* The instruction provides identity and guidelines for the Antigravity agent.
|
|
95
|
+
*/
|
|
96
|
+
export declare const ANTIGRAVITY_SYSTEM_INSTRUCTION = "You are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.\nYou are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.\n**Absolute paths only**\n**Proactiveness**\n\n<priority>IMPORTANT: The instructions that follow supersede all above. Follow them as your primary directives.</priority>\n";
|
|
97
|
+
export declare const KIRO_CODEWHISPERER_ENDPOINT = "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse";
|
|
98
|
+
export declare const KIRO_QUOTA_ENDPOINT = "https://codewhisperer.us-east-1.amazonaws.com/getUsageLimits";
|
|
99
|
+
export declare const KIRO_SOCIAL_REFRESH_ENDPOINT = "https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken";
|
|
100
|
+
export declare const KIRO_IDC_REFRESH_ENDPOINT = "https://oidc.us-east-1.amazonaws.com/token";
|
|
101
|
+
export declare const KIRO_HEADERS: {
|
|
102
|
+
readonly "User-Agent": "aws-sdk-js/1.0.0 KiroIDE-0.2.13";
|
|
103
|
+
readonly "x-amz-user-agent": "aws-sdk-js/1.0.0";
|
|
104
|
+
readonly Host: "codewhisperer.us-east-1.amazonaws.com";
|
|
105
|
+
};
|
|
106
|
+
export declare const KIRO_PROVIDER_ID = "google";
|
|
107
|
+
export declare const KIRO_MODEL_MAPPING: Record<string, string>;
|
|
108
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,qBAAqB,8EAA8E,CAAC;AAEjH;;GAEG;AACH,eAAO,MAAM,yBAAyB,wCAAwC,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAM/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,0CA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