opencode-antigravity-auth-remix 1.0.7

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.
Files changed (187) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +723 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/antigravity/oauth.d.ts +31 -0
  8. package/dist/src/antigravity/oauth.d.ts.map +1 -0
  9. package/dist/src/antigravity/oauth.js +168 -0
  10. package/dist/src/antigravity/oauth.js.map +1 -0
  11. package/dist/src/constants.d.ts +107 -0
  12. package/dist/src/constants.d.ts.map +1 -0
  13. package/dist/src/constants.js +138 -0
  14. package/dist/src/constants.js.map +1 -0
  15. package/dist/src/hooks/auto-update-checker/cache.d.ts +3 -0
  16. package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
  17. package/dist/src/hooks/auto-update-checker/cache.js +71 -0
  18. package/dist/src/hooks/auto-update-checker/cache.js.map +1 -0
  19. package/dist/src/hooks/auto-update-checker/checker.d.ts +16 -0
  20. package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
  21. package/dist/src/hooks/auto-update-checker/checker.js +237 -0
  22. package/dist/src/hooks/auto-update-checker/checker.js.map +1 -0
  23. package/dist/src/hooks/auto-update-checker/constants.d.ts +9 -0
  24. package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
  25. package/dist/src/hooks/auto-update-checker/constants.js +23 -0
  26. package/dist/src/hooks/auto-update-checker/constants.js.map +1 -0
  27. package/dist/src/hooks/auto-update-checker/index.d.ts +34 -0
  28. package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -0
  29. package/dist/src/hooks/auto-update-checker/index.js +125 -0
  30. package/dist/src/hooks/auto-update-checker/index.js.map +1 -0
  31. package/dist/src/hooks/auto-update-checker/types.d.ts +25 -0
  32. package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -0
  33. package/dist/src/hooks/auto-update-checker/types.js +1 -0
  34. package/dist/src/hooks/auto-update-checker/types.js.map +1 -0
  35. package/dist/src/plugin/accounts.d.ts +58 -0
  36. package/dist/src/plugin/accounts.d.ts.map +1 -0
  37. package/dist/src/plugin/accounts.js +350 -0
  38. package/dist/src/plugin/accounts.js.map +1 -0
  39. package/dist/src/plugin/auth.d.ts +21 -0
  40. package/dist/src/plugin/auth.d.ts.map +1 -0
  41. package/dist/src/plugin/auth.js +46 -0
  42. package/dist/src/plugin/auth.js.map +1 -0
  43. package/dist/src/plugin/cache/index.d.ts +5 -0
  44. package/dist/src/plugin/cache/index.d.ts.map +1 -0
  45. package/dist/src/plugin/cache/index.js +5 -0
  46. package/dist/src/plugin/cache/index.js.map +1 -0
  47. package/dist/src/plugin/cache/signature-cache.d.ts +111 -0
  48. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -0
  49. package/dist/src/plugin/cache/signature-cache.js +373 -0
  50. package/dist/src/plugin/cache/signature-cache.js.map +1 -0
  51. package/dist/src/plugin/cache.d.ts +44 -0
  52. package/dist/src/plugin/cache.d.ts.map +1 -0
  53. package/dist/src/plugin/cache.js +200 -0
  54. package/dist/src/plugin/cache.js.map +1 -0
  55. package/dist/src/plugin/cli.d.ts +19 -0
  56. package/dist/src/plugin/cli.d.ts.map +1 -0
  57. package/dist/src/plugin/cli.js +59 -0
  58. package/dist/src/plugin/cli.js.map +1 -0
  59. package/dist/src/plugin/config/index.d.ts +16 -0
  60. package/dist/src/plugin/config/index.d.ts.map +1 -0
  61. package/dist/src/plugin/config/index.js +16 -0
  62. package/dist/src/plugin/config/index.js.map +1 -0
  63. package/dist/src/plugin/config/loader.d.ts +35 -0
  64. package/dist/src/plugin/config/loader.d.ts.map +1 -0
  65. package/dist/src/plugin/config/loader.js +178 -0
  66. package/dist/src/plugin/config/loader.js.map +1 -0
  67. package/dist/src/plugin/config/schema.d.ts +257 -0
  68. package/dist/src/plugin/config/schema.d.ts.map +1 -0
  69. package/dist/src/plugin/config/schema.js +229 -0
  70. package/dist/src/plugin/config/schema.js.map +1 -0
  71. package/dist/src/plugin/core/streaming/index.d.ts +3 -0
  72. package/dist/src/plugin/core/streaming/index.d.ts.map +1 -0
  73. package/dist/src/plugin/core/streaming/index.js +3 -0
  74. package/dist/src/plugin/core/streaming/index.js.map +1 -0
  75. package/dist/src/plugin/core/streaming/transformer.d.ts +9 -0
  76. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  77. package/dist/src/plugin/core/streaming/transformer.js +134 -0
  78. package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
  79. package/dist/src/plugin/core/streaming/types.d.ts +26 -0
  80. package/dist/src/plugin/core/streaming/types.d.ts.map +1 -0
  81. package/dist/src/plugin/core/streaming/types.js +1 -0
  82. package/dist/src/plugin/core/streaming/types.js.map +1 -0
  83. package/dist/src/plugin/debug.d.ts +68 -0
  84. package/dist/src/plugin/debug.d.ts.map +1 -0
  85. package/dist/src/plugin/debug.js +321 -0
  86. package/dist/src/plugin/debug.js.map +1 -0
  87. package/dist/src/plugin/errors.d.ts +28 -0
  88. package/dist/src/plugin/errors.d.ts.map +1 -0
  89. package/dist/src/plugin/errors.js +42 -0
  90. package/dist/src/plugin/errors.js.map +1 -0
  91. package/dist/src/plugin/logger.d.ts +54 -0
  92. package/dist/src/plugin/logger.d.ts.map +1 -0
  93. package/dist/src/plugin/logger.js +120 -0
  94. package/dist/src/plugin/logger.js.map +1 -0
  95. package/dist/src/plugin/project.d.ts +33 -0
  96. package/dist/src/plugin/project.d.ts.map +1 -0
  97. package/dist/src/plugin/project.js +239 -0
  98. package/dist/src/plugin/project.js.map +1 -0
  99. package/dist/src/plugin/recovery/constants.d.ts +22 -0
  100. package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
  101. package/dist/src/plugin/recovery/constants.js +43 -0
  102. package/dist/src/plugin/recovery/constants.js.map +1 -0
  103. package/dist/src/plugin/recovery/index.d.ts +12 -0
  104. package/dist/src/plugin/recovery/index.d.ts.map +1 -0
  105. package/dist/src/plugin/recovery/index.js +12 -0
  106. package/dist/src/plugin/recovery/index.js.map +1 -0
  107. package/dist/src/plugin/recovery/storage.d.ts +24 -0
  108. package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
  109. package/dist/src/plugin/recovery/storage.js +354 -0
  110. package/dist/src/plugin/recovery/storage.js.map +1 -0
  111. package/dist/src/plugin/recovery/types.d.ts +116 -0
  112. package/dist/src/plugin/recovery/types.d.ts.map +1 -0
  113. package/dist/src/plugin/recovery/types.js +6 -0
  114. package/dist/src/plugin/recovery/types.js.map +1 -0
  115. package/dist/src/plugin/recovery.d.ts +61 -0
  116. package/dist/src/plugin/recovery.d.ts.map +1 -0
  117. package/dist/src/plugin/recovery.js +376 -0
  118. package/dist/src/plugin/recovery.js.map +1 -0
  119. package/dist/src/plugin/refresh-queue.d.ts +101 -0
  120. package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
  121. package/dist/src/plugin/refresh-queue.js +244 -0
  122. package/dist/src/plugin/refresh-queue.js.map +1 -0
  123. package/dist/src/plugin/request-helpers.d.ts +270 -0
  124. package/dist/src/plugin/request-helpers.d.ts.map +1 -0
  125. package/dist/src/plugin/request-helpers.js +2158 -0
  126. package/dist/src/plugin/request-helpers.js.map +1 -0
  127. package/dist/src/plugin/request.d.ts +87 -0
  128. package/dist/src/plugin/request.d.ts.map +1 -0
  129. package/dist/src/plugin/request.js +1233 -0
  130. package/dist/src/plugin/request.js.map +1 -0
  131. package/dist/src/plugin/search.d.ts +19 -0
  132. package/dist/src/plugin/search.d.ts.map +1 -0
  133. package/dist/src/plugin/search.js +191 -0
  134. package/dist/src/plugin/search.js.map +1 -0
  135. package/dist/src/plugin/server.d.ts +23 -0
  136. package/dist/src/plugin/server.d.ts.map +1 -0
  137. package/dist/src/plugin/server.js +222 -0
  138. package/dist/src/plugin/server.js.map +1 -0
  139. package/dist/src/plugin/storage.d.ts +77 -0
  140. package/dist/src/plugin/storage.d.ts.map +1 -0
  141. package/dist/src/plugin/storage.js +207 -0
  142. package/dist/src/plugin/storage.js.map +1 -0
  143. package/dist/src/plugin/stores/signature-store.d.ts +5 -0
  144. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
  145. package/dist/src/plugin/stores/signature-store.js +25 -0
  146. package/dist/src/plugin/stores/signature-store.js.map +1 -0
  147. package/dist/src/plugin/thinking-recovery.d.ts +90 -0
  148. package/dist/src/plugin/thinking-recovery.d.ts.map +1 -0
  149. package/dist/src/plugin/thinking-recovery.js +316 -0
  150. package/dist/src/plugin/thinking-recovery.js.map +1 -0
  151. package/dist/src/plugin/token.d.ts +19 -0
  152. package/dist/src/plugin/token.d.ts.map +1 -0
  153. package/dist/src/plugin/token.js +128 -0
  154. package/dist/src/plugin/token.js.map +1 -0
  155. package/dist/src/plugin/transform/claude.d.ts +80 -0
  156. package/dist/src/plugin/transform/claude.d.ts.map +1 -0
  157. package/dist/src/plugin/transform/claude.js +265 -0
  158. package/dist/src/plugin/transform/claude.js.map +1 -0
  159. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +35 -0
  160. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
  161. package/dist/src/plugin/transform/cross-model-sanitizer.js +225 -0
  162. package/dist/src/plugin/transform/cross-model-sanitizer.js.map +1 -0
  163. package/dist/src/plugin/transform/gemini.d.ts +63 -0
  164. package/dist/src/plugin/transform/gemini.d.ts.map +1 -0
  165. package/dist/src/plugin/transform/gemini.js +142 -0
  166. package/dist/src/plugin/transform/gemini.js.map +1 -0
  167. package/dist/src/plugin/transform/index.d.ts +14 -0
  168. package/dist/src/plugin/transform/index.d.ts.map +1 -0
  169. package/dist/src/plugin/transform/index.js +14 -0
  170. package/dist/src/plugin/transform/index.js.map +1 -0
  171. package/dist/src/plugin/transform/model-resolver.d.ts +78 -0
  172. package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -0
  173. package/dist/src/plugin/transform/model-resolver.js +221 -0
  174. package/dist/src/plugin/transform/model-resolver.js.map +1 -0
  175. package/dist/src/plugin/transform/types.d.ts +93 -0
  176. package/dist/src/plugin/transform/types.d.ts.map +1 -0
  177. package/dist/src/plugin/transform/types.js +1 -0
  178. package/dist/src/plugin/transform/types.js.map +1 -0
  179. package/dist/src/plugin/types.d.ts +97 -0
  180. package/dist/src/plugin/types.d.ts.map +1 -0
  181. package/dist/src/plugin/types.js +1 -0
  182. package/dist/src/plugin/types.js.map +1 -0
  183. package/dist/src/plugin.d.ts +8 -0
  184. package/dist/src/plugin.d.ts.map +1 -0
  185. package/dist/src/plugin.js +1845 -0
  186. package/dist/src/plugin.js.map +1 -0
  187. package/package.json +65 -0
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Proactive Token Refresh Queue
3
+ *
4
+ * Ported from LLM-API-Key-Proxy's BackgroundRefresher.
5
+ *
6
+ * This module provides background token refresh to ensure OAuth tokens
7
+ * remain valid without blocking user requests. It periodically checks
8
+ * all accounts and refreshes tokens that are approaching expiry.
9
+ *
10
+ * Features:
11
+ * - Non-blocking background refresh (doesn't block requests)
12
+ * - Configurable refresh buffer (default: 30 minutes before expiry)
13
+ * - Configurable check interval (default: 5 minutes)
14
+ * - Serialized refresh to prevent concurrent refresh storms
15
+ * - Integrates with existing AccountManager and token refresh logic
16
+ * - Silent operation: no console output, uses structured logger
17
+ */
18
+ import { refreshAccessToken } from "./token";
19
+ import { createLogger } from "./logger";
20
+ const log = createLogger("refresh-queue");
21
+ export const DEFAULT_PROACTIVE_REFRESH_CONFIG = {
22
+ enabled: true,
23
+ bufferSeconds: 1800, // 30 minutes
24
+ checkIntervalSeconds: 300, // 5 minutes
25
+ };
26
+ /**
27
+ * Proactive Token Refresh Queue
28
+ *
29
+ * Runs in the background and proactively refreshes tokens before they expire.
30
+ * This ensures that user requests never block on token refresh.
31
+ *
32
+ * All logging is silent by default - uses structured logger that only outputs
33
+ * when OPENCODE_ANTIGRAVITY_CONSOLE_LOG=1 is set or TUI logging is available.
34
+ */
35
+ export class ProactiveRefreshQueue {
36
+ config;
37
+ client;
38
+ providerId;
39
+ accountManager = null;
40
+ state = {
41
+ isRunning: false,
42
+ intervalHandle: null,
43
+ isRefreshing: false,
44
+ lastCheckTime: 0,
45
+ lastRefreshTime: 0,
46
+ refreshCount: 0,
47
+ errorCount: 0,
48
+ };
49
+ constructor(client, providerId, config) {
50
+ this.client = client;
51
+ this.providerId = providerId;
52
+ this.config = {
53
+ ...DEFAULT_PROACTIVE_REFRESH_CONFIG,
54
+ ...config,
55
+ };
56
+ }
57
+ /**
58
+ * Set the account manager to use for refresh operations.
59
+ * Must be called before start().
60
+ */
61
+ setAccountManager(manager) {
62
+ this.accountManager = manager;
63
+ }
64
+ /**
65
+ * Check if a token needs proactive refresh.
66
+ * Returns true if the token expires within the buffer period.
67
+ */
68
+ needsRefresh(account) {
69
+ if (!account.expires) {
70
+ // No expiry set - assume it's fine
71
+ return false;
72
+ }
73
+ const now = Date.now();
74
+ const bufferMs = this.config.bufferSeconds * 1000;
75
+ const refreshThreshold = now + bufferMs;
76
+ return account.expires <= refreshThreshold;
77
+ }
78
+ /**
79
+ * Check if a token is already expired.
80
+ */
81
+ isExpired(account) {
82
+ if (!account.expires) {
83
+ return false;
84
+ }
85
+ return account.expires <= Date.now();
86
+ }
87
+ /**
88
+ * Get all accounts that need proactive refresh.
89
+ */
90
+ getAccountsNeedingRefresh() {
91
+ if (!this.accountManager) {
92
+ return [];
93
+ }
94
+ return this.accountManager.getAccounts().filter((account) => {
95
+ // Only refresh if not already expired (let the main flow handle expired tokens)
96
+ if (this.isExpired(account)) {
97
+ return false;
98
+ }
99
+ return this.needsRefresh(account);
100
+ });
101
+ }
102
+ /**
103
+ * Perform a single refresh check iteration.
104
+ * This is called periodically by the background interval.
105
+ */
106
+ async runRefreshCheck() {
107
+ if (this.state.isRefreshing) {
108
+ // Already refreshing - skip this iteration
109
+ return;
110
+ }
111
+ if (!this.accountManager) {
112
+ return;
113
+ }
114
+ this.state.isRefreshing = true;
115
+ this.state.lastCheckTime = Date.now();
116
+ try {
117
+ const accountsToRefresh = this.getAccountsNeedingRefresh();
118
+ if (accountsToRefresh.length === 0) {
119
+ return;
120
+ }
121
+ log.debug("Found accounts needing refresh", { count: accountsToRefresh.length });
122
+ // Refresh accounts serially to avoid concurrent refresh storms
123
+ for (const account of accountsToRefresh) {
124
+ if (!this.state.isRunning) {
125
+ // Queue was stopped - abort
126
+ break;
127
+ }
128
+ try {
129
+ const auth = this.accountManager.toAuthDetails(account);
130
+ const refreshed = await this.refreshToken(auth, account);
131
+ if (refreshed) {
132
+ this.accountManager.updateFromAuth(account, refreshed);
133
+ this.state.refreshCount++;
134
+ this.state.lastRefreshTime = Date.now();
135
+ // Persist the refreshed token
136
+ try {
137
+ await this.accountManager.saveToDisk();
138
+ }
139
+ catch {
140
+ // Non-fatal - token is refreshed in memory
141
+ }
142
+ }
143
+ }
144
+ catch (error) {
145
+ this.state.errorCount++;
146
+ // Log but don't throw - continue with other accounts
147
+ log.warn("Failed to refresh account", {
148
+ accountIndex: account.index,
149
+ error: error instanceof Error ? error.message : String(error),
150
+ });
151
+ }
152
+ }
153
+ }
154
+ finally {
155
+ this.state.isRefreshing = false;
156
+ }
157
+ }
158
+ /**
159
+ * Refresh a single token.
160
+ */
161
+ async refreshToken(auth, account) {
162
+ const minutesUntilExpiry = account.expires
163
+ ? Math.round((account.expires - Date.now()) / 60000)
164
+ : "unknown";
165
+ log.debug("Proactively refreshing token", {
166
+ accountIndex: account.index,
167
+ email: account.email ?? "unknown",
168
+ minutesUntilExpiry,
169
+ });
170
+ return refreshAccessToken(auth, this.client, this.providerId);
171
+ }
172
+ /**
173
+ * Start the background refresh queue.
174
+ */
175
+ start() {
176
+ if (this.state.isRunning) {
177
+ return;
178
+ }
179
+ if (!this.config.enabled) {
180
+ log.debug("Proactive refresh disabled by config");
181
+ return;
182
+ }
183
+ this.state.isRunning = true;
184
+ const intervalMs = this.config.checkIntervalSeconds * 1000;
185
+ log.debug("Started proactive refresh queue", {
186
+ checkIntervalSeconds: this.config.checkIntervalSeconds,
187
+ bufferSeconds: this.config.bufferSeconds,
188
+ });
189
+ // Run initial check after a short delay (let things settle)
190
+ setTimeout(() => {
191
+ if (this.state.isRunning) {
192
+ this.runRefreshCheck().catch((error) => {
193
+ log.error("Initial check failed", {
194
+ error: error instanceof Error ? error.message : String(error),
195
+ });
196
+ });
197
+ }
198
+ }, 5000);
199
+ // Set up periodic checks
200
+ this.state.intervalHandle = setInterval(() => {
201
+ this.runRefreshCheck().catch((error) => {
202
+ log.error("Check failed", {
203
+ error: error instanceof Error ? error.message : String(error),
204
+ });
205
+ });
206
+ }, intervalMs);
207
+ }
208
+ /**
209
+ * Stop the background refresh queue.
210
+ */
211
+ stop() {
212
+ if (!this.state.isRunning) {
213
+ return;
214
+ }
215
+ this.state.isRunning = false;
216
+ if (this.state.intervalHandle) {
217
+ clearInterval(this.state.intervalHandle);
218
+ this.state.intervalHandle = null;
219
+ }
220
+ log.debug("Stopped proactive refresh queue", {
221
+ refreshCount: this.state.refreshCount,
222
+ errorCount: this.state.errorCount,
223
+ });
224
+ }
225
+ /**
226
+ * Get current queue statistics.
227
+ */
228
+ getStats() {
229
+ return { ...this.state };
230
+ }
231
+ /**
232
+ * Check if the queue is currently running.
233
+ */
234
+ isRunning() {
235
+ return this.state.isRunning;
236
+ }
237
+ }
238
+ /**
239
+ * Create a proactive refresh queue instance.
240
+ */
241
+ export function createProactiveRefreshQueue(client, providerId, config) {
242
+ return new ProactiveRefreshQueue(client, providerId, config);
243
+ }
244
+ //# sourceMappingURL=refresh-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-queue.js","sourceRoot":"","sources":["../../../src/plugin/refresh-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,GAAG,GA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AEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAoB,EACpB,UAAkB,EAClB,MAAwC;IAExC,OAAO,IAAI,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,270 @@
1
+ /**
2
+ * Cleans a JSON schema for Antigravity API compatibility.
3
+ * Transforms unsupported features into description hints while preserving semantic information.
4
+ *
5
+ * Ported from CLIProxyAPI's CleanJSONSchemaForAntigravity (gemini_schema.go)
6
+ */
7
+ export declare function cleanJSONSchemaForAntigravity(schema: any): any;
8
+ export interface AntigravityApiError {
9
+ code?: number;
10
+ message?: string;
11
+ status?: string;
12
+ [key: string]: unknown;
13
+ }
14
+ /**
15
+ * Minimal representation of Antigravity API responses we touch.
16
+ */
17
+ export interface AntigravityApiBody {
18
+ response?: unknown;
19
+ error?: AntigravityApiError;
20
+ [key: string]: unknown;
21
+ }
22
+ /**
23
+ * Usage metadata exposed by Antigravity responses. Fields are optional to reflect partial payloads.
24
+ */
25
+ export interface AntigravityUsageMetadata {
26
+ totalTokenCount?: number;
27
+ promptTokenCount?: number;
28
+ candidatesTokenCount?: number;
29
+ cachedContentTokenCount?: number;
30
+ thoughtsTokenCount?: number;
31
+ }
32
+ /**
33
+ * Normalized thinking configuration accepted by Antigravity.
34
+ */
35
+ export interface ThinkingConfig {
36
+ thinkingBudget?: number;
37
+ includeThoughts?: boolean;
38
+ }
39
+ /**
40
+ * Default token budget for thinking/reasoning. 16000 tokens provides sufficient
41
+ * space for complex reasoning while staying within typical model limits.
42
+ */
43
+ export declare const DEFAULT_THINKING_BUDGET = 16000;
44
+ /**
45
+ * Checks if a model name indicates thinking/reasoning capability.
46
+ * Models with "thinking", "gemini-3", or "opus" in their name support extended thinking.
47
+ */
48
+ export declare function isThinkingCapableModel(modelName: string): boolean;
49
+ /**
50
+ * Extracts thinking configuration from various possible request locations.
51
+ * Supports both Gemini-style thinkingConfig and Anthropic-style thinking options.
52
+ */
53
+ export declare function extractThinkingConfig(requestPayload: Record<string, unknown>, rawGenerationConfig: Record<string, unknown> | undefined, extraBody: Record<string, unknown> | undefined): ThinkingConfig | undefined;
54
+ /**
55
+ * Determines the final thinking configuration based on model capabilities and user settings.
56
+ * For Claude thinking models, we keep thinking enabled even in multi-turn conversations.
57
+ * The filterUnsignedThinkingBlocks function will handle signature validation/restoration.
58
+ */
59
+ export declare function resolveThinkingConfig(userConfig: ThinkingConfig | undefined, isThinkingModel: boolean, _isClaudeModel: boolean, _hasAssistantHistory: boolean): ThinkingConfig | undefined;
60
+ /**
61
+ * Filters thinking blocks from contents unless the signature matches our cache.
62
+ * Attempts to restore signatures from cache for thinking blocks that lack signatures.
63
+ *
64
+ * @param contents - The contents array from the request
65
+ * @param sessionId - Optional session ID for signature cache lookup
66
+ * @param getCachedSignatureFn - Optional function to retrieve cached signatures
67
+ */
68
+ export declare function filterUnsignedThinkingBlocks(contents: any[], sessionId?: string, getCachedSignatureFn?: (sessionId: string, text: string) => string | undefined, isClaudeModel?: boolean): any[];
69
+ /**
70
+ * Filters thinking blocks from Anthropic-style messages[] payloads using cached signatures.
71
+ */
72
+ export declare function filterMessagesThinkingBlocks(messages: any[], sessionId?: string, getCachedSignatureFn?: (sessionId: string, text: string) => string | undefined, isClaudeModel?: boolean): any[];
73
+ export declare function deepFilterThinkingBlocks(payload: unknown, sessionId?: string, getCachedSignatureFn?: (sessionId: string, text: string) => string | undefined, isClaudeModel?: boolean): unknown;
74
+ /**
75
+ * Transforms thinking/reasoning content in response parts to OpenCode's expected format.
76
+ * Handles both Gemini-style (thought: true) and Anthropic-style (type: "thinking") formats.
77
+ * Also extracts reasoning_content for Anthropic-style responses.
78
+ */
79
+ export declare function transformThinkingParts(response: unknown): unknown;
80
+ /**
81
+ * Ensures thinkingConfig is valid: includeThoughts only allowed when budget > 0.
82
+ */
83
+ export declare function normalizeThinkingConfig(config: unknown): ThinkingConfig | undefined;
84
+ /**
85
+ * Parses an Antigravity API body; handles array-wrapped responses the API sometimes returns.
86
+ */
87
+ export declare function parseAntigravityApiBody(rawText: string): AntigravityApiBody | null;
88
+ /**
89
+ * Extracts usageMetadata from a response object, guarding types.
90
+ */
91
+ export declare function extractUsageMetadata(body: AntigravityApiBody): AntigravityUsageMetadata | null;
92
+ /**
93
+ * Walks SSE lines to find a usage-bearing response chunk.
94
+ */
95
+ export declare function extractUsageFromSsePayload(payload: string): AntigravityUsageMetadata | null;
96
+ /**
97
+ * Enhances 404 errors for Antigravity models with a direct preview-access message.
98
+ */
99
+ export declare function rewriteAntigravityPreviewAccessError(body: AntigravityApiBody, status: number, requestedModel?: string): AntigravityApiBody | null;
100
+ /**
101
+ * Checks if a JSON response body represents an empty response.
102
+ *
103
+ * Empty responses occur when:
104
+ * - No candidates in Gemini format
105
+ * - No choices in OpenAI format
106
+ * - Candidates/choices exist but have no content
107
+ *
108
+ * @param text - The response body text (should be valid JSON)
109
+ * @returns true if the response is empty
110
+ */
111
+ export declare function isEmptyResponseBody(text: string): boolean;
112
+ /**
113
+ * Checks if a streaming SSE response yielded zero meaningful chunks.
114
+ *
115
+ * This is used after consuming a streaming response to determine if retry is needed.
116
+ */
117
+ export interface StreamingChunkCounter {
118
+ increment: () => void;
119
+ getCount: () => number;
120
+ hasContent: () => boolean;
121
+ }
122
+ export declare function createStreamingChunkCounter(): StreamingChunkCounter;
123
+ /**
124
+ * Checks if an SSE line contains meaningful content.
125
+ *
126
+ * @param line - A single SSE line (e.g., "data: {...}")
127
+ * @returns true if the line contains content worth counting
128
+ */
129
+ export declare function isMeaningfulSseLine(line: string): boolean;
130
+ /**
131
+ * Recursively parses JSON strings in nested data structures.
132
+ *
133
+ * This is a port of LLM-API-Key-Proxy's _recursively_parse_json_strings() function.
134
+ *
135
+ * Handles:
136
+ * - JSON-stringified values: {"files": "[{...}]"} → {"files": [{...}]}
137
+ * - Malformed double-encoded JSON (extra trailing chars)
138
+ * - Escaped control characters (\\n → \n, \\t → \t)
139
+ *
140
+ * This is useful because Antigravity sometimes returns JSON-stringified values
141
+ * in tool arguments, which can cause downstream parsing issues.
142
+ *
143
+ * @param obj - The object to recursively parse
144
+ * @returns The parsed object with JSON strings expanded
145
+ */
146
+ export declare function recursivelyParseJsonStrings(obj: unknown): unknown;
147
+ /**
148
+ * Groups function calls with their responses, handling ID mismatches.
149
+ *
150
+ * This is a port of LLM-API-Key-Proxy's _fix_tool_response_grouping() function.
151
+ *
152
+ * When context compaction or other processes strip tool responses, the tool call
153
+ * IDs become orphaned. This function attempts to recover by:
154
+ *
155
+ * 1. Pass 1: Match by exact ID (normal case)
156
+ * 2. Pass 2: Match by function name (for ID mismatches)
157
+ * 3. Pass 3: Match "unknown_function" orphans or take first available
158
+ * 4. Fallback: Create placeholder responses for missing tool results
159
+ *
160
+ * @param contents - Array of Gemini-style content messages
161
+ * @returns Fixed contents array with matched tool responses
162
+ */
163
+ export declare function fixToolResponseGrouping(contents: any[]): any[];
164
+ /**
165
+ * Checks if contents have any tool call/response ID mismatches.
166
+ *
167
+ * @param contents - Array of Gemini-style content messages
168
+ * @returns Object with mismatch details
169
+ */
170
+ export declare function detectToolIdMismatches(contents: any[]): {
171
+ hasMismatches: boolean;
172
+ expectedIds: string[];
173
+ foundIds: string[];
174
+ missingIds: string[];
175
+ orphanIds: string[];
176
+ };
177
+ /**
178
+ * Find orphaned tool_use IDs (tool_use without matching tool_result).
179
+ * Works on Claude format messages.
180
+ */
181
+ export declare function findOrphanedToolUseIds(messages: any[]): Set<string>;
182
+ /**
183
+ * Fix orphaned tool_use blocks in Claude format messages.
184
+ * Mirrors fixToolResponseGrouping() but for Claude's messages[] format.
185
+ *
186
+ * Claude format:
187
+ * - assistant message with content[]: { type: 'tool_use', id, name, input }
188
+ * - user message with content[]: { type: 'tool_result', tool_use_id, content }
189
+ *
190
+ * @param messages - Claude format messages array
191
+ * @returns Fixed messages with placeholder tool_results for orphans
192
+ */
193
+ export declare function fixClaudeToolPairing(messages: any[]): any[];
194
+ /**
195
+ * Validate and fix tool pairing with fallback nuclear option.
196
+ * Defense in depth: tries gentle fix first, then nuclear removal.
197
+ */
198
+ export declare function validateAndFixClaudeToolPairing(messages: any[]): any[];
199
+ /**
200
+ * Injects parameter signatures into tool descriptions.
201
+ * Port of LLM-API-Key-Proxy's _inject_signature_into_descriptions()
202
+ *
203
+ * This helps prevent tool hallucination by explicitly listing parameters
204
+ * in the description, making it harder for the model to hallucinate
205
+ * parameters from its training data.
206
+ *
207
+ * @param tools - Array of tool definitions (Gemini format)
208
+ * @param promptTemplate - Template for the signature (default: "\\n\\nSTRICT PARAMETERS: {params}.")
209
+ * @returns Modified tools array with signatures injected
210
+ */
211
+ export declare function injectParameterSignatures(tools: any[], promptTemplate?: string): any[];
212
+ /**
213
+ * Injects a tool hardening system instruction into the request payload.
214
+ * Port of LLM-API-Key-Proxy's _inject_tool_hardening_instruction()
215
+ *
216
+ * @param payload - The Gemini request payload
217
+ * @param instructionText - The instruction text to inject
218
+ */
219
+ export declare function injectToolHardeningInstruction(payload: Record<string, unknown>, instructionText: string): void;
220
+ /**
221
+ * Assigns IDs to functionCall parts and returns the pending call IDs by name.
222
+ * This is the first pass of tool ID assignment.
223
+ *
224
+ * @param contents - Gemini-style contents array
225
+ * @returns Object with modified contents and pending call IDs map
226
+ */
227
+ export declare function assignToolIdsToContents(contents: any[]): {
228
+ contents: any[];
229
+ pendingCallIdsByName: Map<string, string[]>;
230
+ toolCallCounter: number;
231
+ };
232
+ /**
233
+ * Matches functionResponse IDs to their corresponding functionCall IDs.
234
+ * This is the second pass of tool ID assignment.
235
+ *
236
+ * @param contents - Gemini-style contents array
237
+ * @param pendingCallIdsByName - Map of function names to pending call IDs
238
+ * @returns Modified contents with matched response IDs
239
+ */
240
+ export declare function matchResponseIdsToContents(contents: any[], pendingCallIdsByName: Map<string, string[]>): any[];
241
+ /**
242
+ * Applies all tool fixes to a request payload for Claude models.
243
+ * This includes:
244
+ * 1. Tool ID assignment for functionCalls
245
+ * 2. Response ID matching for functionResponses
246
+ * 3. Orphan recovery via fixToolResponseGrouping
247
+ * 4. Claude format pairing fix via validateAndFixClaudeToolPairing
248
+ *
249
+ * @param payload - Request payload object
250
+ * @param isClaude - Whether this is a Claude model request
251
+ * @returns Object with fix applied status
252
+ */
253
+ export declare function applyToolPairingFixes(payload: Record<string, unknown>, isClaude: boolean): {
254
+ contentsFixed: boolean;
255
+ messagesFixed: boolean;
256
+ };
257
+ /**
258
+ * Creates a synthetic Claude SSE streaming response with error content.
259
+ *
260
+ * When returning HTTP 400/500 errors to OpenCode, the session becomes locked
261
+ * and the user cannot use /compact or other commands. This function creates
262
+ * a fake "successful" SSE response (200 OK) with the error message as text content,
263
+ * allowing the user to continue using the session.
264
+ *
265
+ * @param errorMessage - The error message to include in the response
266
+ * @param requestedModel - The model that was requested
267
+ * @returns A Response object with synthetic SSE stream
268
+ */
269
+ export declare function createSyntheticErrorResponse(errorMessage: string, requestedModel?: string): Response;
270
+ //# sourceMappingURL=request-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-helpers.d.ts","sourceRoot":"","sources":["../../../src/plugin/request-helpers.ts"],"names":[],"mappings":"AAwoBA;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CA2B9D;AAMD,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CA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