opencode-antigravity-auth-mf 1.3.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.
Files changed (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +630 -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 +99 -0
  12. package/dist/src/constants.d.ts.map +1 -0
  13. package/dist/src/constants.js +135 -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 +86 -0
  36. package/dist/src/plugin/accounts.d.ts.map +1 -0
  37. package/dist/src/plugin/accounts.js +609 -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 +375 -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 +37 -0
  64. package/dist/src/plugin/config/loader.d.ts.map +1 -0
  65. package/dist/src/plugin/config/loader.js +206 -0
  66. package/dist/src/plugin/config/loader.js.map +1 -0
  67. package/dist/src/plugin/config/schema.d.ts +411 -0
  68. package/dist/src/plugin/config/schema.d.ts.map +1 -0
  69. package/dist/src/plugin/config/schema.js +339 -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 +10 -0
  76. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  77. package/dist/src/plugin/core/streaming/transformer.js +255 -0
  78. package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
  79. package/dist/src/plugin/core/streaming/types.d.ts +35 -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 +325 -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/image-saver.d.ts +25 -0
  92. package/dist/src/plugin/image-saver.d.ts.map +1 -0
  93. package/dist/src/plugin/image-saver.js +86 -0
  94. package/dist/src/plugin/image-saver.js.map +1 -0
  95. package/dist/src/plugin/logger.d.ts +54 -0
  96. package/dist/src/plugin/logger.d.ts.map +1 -0
  97. package/dist/src/plugin/logger.js +120 -0
  98. package/dist/src/plugin/logger.js.map +1 -0
  99. package/dist/src/plugin/project.d.ts +33 -0
  100. package/dist/src/plugin/project.d.ts.map +1 -0
  101. package/dist/src/plugin/project.js +234 -0
  102. package/dist/src/plugin/project.js.map +1 -0
  103. package/dist/src/plugin/recovery/constants.d.ts +22 -0
  104. package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
  105. package/dist/src/plugin/recovery/constants.js +43 -0
  106. package/dist/src/plugin/recovery/constants.js.map +1 -0
  107. package/dist/src/plugin/recovery/index.d.ts +12 -0
  108. package/dist/src/plugin/recovery/index.d.ts.map +1 -0
  109. package/dist/src/plugin/recovery/index.js +12 -0
  110. package/dist/src/plugin/recovery/index.js.map +1 -0
  111. package/dist/src/plugin/recovery/storage.d.ts +24 -0
  112. package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
  113. package/dist/src/plugin/recovery/storage.js +354 -0
  114. package/dist/src/plugin/recovery/storage.js.map +1 -0
  115. package/dist/src/plugin/recovery/types.d.ts +116 -0
  116. package/dist/src/plugin/recovery/types.d.ts.map +1 -0
  117. package/dist/src/plugin/recovery/types.js +6 -0
  118. package/dist/src/plugin/recovery/types.js.map +1 -0
  119. package/dist/src/plugin/recovery.d.ts +61 -0
  120. package/dist/src/plugin/recovery.d.ts.map +1 -0
  121. package/dist/src/plugin/recovery.js +376 -0
  122. package/dist/src/plugin/recovery.js.map +1 -0
  123. package/dist/src/plugin/refresh-queue.d.ts +101 -0
  124. package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
  125. package/dist/src/plugin/refresh-queue.js +244 -0
  126. package/dist/src/plugin/refresh-queue.js.map +1 -0
  127. package/dist/src/plugin/request-helpers.d.ts +278 -0
  128. package/dist/src/plugin/request-helpers.d.ts.map +1 -0
  129. package/dist/src/plugin/request-helpers.js +2268 -0
  130. package/dist/src/plugin/request-helpers.js.map +1 -0
  131. package/dist/src/plugin/request.d.ts +91 -0
  132. package/dist/src/plugin/request.d.ts.map +1 -0
  133. package/dist/src/plugin/request.js +1302 -0
  134. package/dist/src/plugin/request.js.map +1 -0
  135. package/dist/src/plugin/rotation.d.ts +168 -0
  136. package/dist/src/plugin/rotation.d.ts.map +1 -0
  137. package/dist/src/plugin/rotation.js +302 -0
  138. package/dist/src/plugin/rotation.js.map +1 -0
  139. package/dist/src/plugin/server.d.ts +23 -0
  140. package/dist/src/plugin/server.d.ts.map +1 -0
  141. package/dist/src/plugin/server.js +324 -0
  142. package/dist/src/plugin/server.js.map +1 -0
  143. package/dist/src/plugin/storage.d.ts +92 -0
  144. package/dist/src/plugin/storage.d.ts.map +1 -0
  145. package/dist/src/plugin/storage.js +417 -0
  146. package/dist/src/plugin/storage.js.map +1 -0
  147. package/dist/src/plugin/stores/signature-store.d.ts +5 -0
  148. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
  149. package/dist/src/plugin/stores/signature-store.js +25 -0
  150. package/dist/src/plugin/stores/signature-store.js.map +1 -0
  151. package/dist/src/plugin/thinking-recovery.d.ts +90 -0
  152. package/dist/src/plugin/thinking-recovery.d.ts.map +1 -0
  153. package/dist/src/plugin/thinking-recovery.js +316 -0
  154. package/dist/src/plugin/thinking-recovery.js.map +1 -0
  155. package/dist/src/plugin/token.d.ts +19 -0
  156. package/dist/src/plugin/token.d.ts.map +1 -0
  157. package/dist/src/plugin/token.js +128 -0
  158. package/dist/src/plugin/token.js.map +1 -0
  159. package/dist/src/plugin/transform/claude.d.ts +80 -0
  160. package/dist/src/plugin/transform/claude.d.ts.map +1 -0
  161. package/dist/src/plugin/transform/claude.js +265 -0
  162. package/dist/src/plugin/transform/claude.js.map +1 -0
  163. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +35 -0
  164. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
  165. package/dist/src/plugin/transform/cross-model-sanitizer.js +225 -0
  166. package/dist/src/plugin/transform/cross-model-sanitizer.js.map +1 -0
  167. package/dist/src/plugin/transform/gemini.d.ts +112 -0
  168. package/dist/src/plugin/transform/gemini.d.ts.map +1 -0
  169. package/dist/src/plugin/transform/gemini.js +409 -0
  170. package/dist/src/plugin/transform/gemini.js.map +1 -0
  171. package/dist/src/plugin/transform/index.d.ts +15 -0
  172. package/dist/src/plugin/transform/index.d.ts.map +1 -0
  173. package/dist/src/plugin/transform/index.js +14 -0
  174. package/dist/src/plugin/transform/index.js.map +1 -0
  175. package/dist/src/plugin/transform/model-resolver.d.ts +101 -0
  176. package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -0
  177. package/dist/src/plugin/transform/model-resolver.js +356 -0
  178. package/dist/src/plugin/transform/model-resolver.js.map +1 -0
  179. package/dist/src/plugin/transform/types.d.ts +106 -0
  180. package/dist/src/plugin/transform/types.d.ts.map +1 -0
  181. package/dist/src/plugin/transform/types.js +1 -0
  182. package/dist/src/plugin/transform/types.js.map +1 -0
  183. package/dist/src/plugin/types.d.ts +96 -0
  184. package/dist/src/plugin/types.d.ts.map +1 -0
  185. package/dist/src/plugin/types.js +1 -0
  186. package/dist/src/plugin/types.js.map +1 -0
  187. package/dist/src/plugin/usage-reporter.d.ts +23 -0
  188. package/dist/src/plugin/usage-reporter.d.ts.map +1 -0
  189. package/dist/src/plugin/usage-reporter.js +43 -0
  190. package/dist/src/plugin/usage-reporter.js.map +1 -0
  191. package/dist/src/plugin.d.ts +8 -0
  192. package/dist/src/plugin.d.ts.map +1 -0
  193. package/dist/src/plugin.js +1708 -0
  194. package/dist/src/plugin.js.map +1 -0
  195. package/package.json +67 -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,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAY1C,MAAM,CAAC,MAAM,gCAAgC,GAA2B;IACtE,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI,EAAE,aAAa;IAClC,oBAAoB,EAAE,GAAG,EAAE,YAAY;CACxC,CAAC;AAaF;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAqB;IACf,MAAM,CAAyB;IAC/B,MAAM,CAAe;IACrB,UAAU,CAAS;IAC5B,cAAc,GAA0B,IAAI,CAAC;IAE7C,KAAK,GAAsB;QACjC,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,IAAI;QACpB,YAAY,EAAE,KAAK;QACnB,aAAa,EAAE,CAAC;QAChB,eAAe,EAAE,CAAC;QAClB,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;KACd,CAAC;IAEF,YACE,MAAoB,EACpB,UAAkB,EAClB,MAAwC;QAExC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,gCAAgC;YACnC,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAC,OAAuB;QACvC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,OAAuB;QAClC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,mCAAmC;YACnC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E,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;SAClC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,QAAQ;QAQN,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;CACF;AAED;;GAEG;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,278 @@
1
+ import type { GoogleSearchConfig } from "./transform/types";
2
+ /**
3
+ * Cleans a JSON schema for Antigravity API compatibility.
4
+ * Transforms unsupported features into description hints while preserving semantic information.
5
+ *
6
+ * Ported from CLIProxyAPI's CleanJSONSchemaForAntigravity (gemini_schema.go)
7
+ */
8
+ export declare function cleanJSONSchemaForAntigravity(schema: any): any;
9
+ export interface AntigravityApiError {
10
+ code?: number;
11
+ message?: string;
12
+ status?: string;
13
+ [key: string]: unknown;
14
+ }
15
+ /**
16
+ * Minimal representation of Antigravity API responses we touch.
17
+ */
18
+ export interface AntigravityApiBody {
19
+ response?: unknown;
20
+ error?: AntigravityApiError;
21
+ [key: string]: unknown;
22
+ }
23
+ /**
24
+ * Usage metadata exposed by Antigravity responses. Fields are optional to reflect partial payloads.
25
+ */
26
+ export interface AntigravityUsageMetadata {
27
+ totalTokenCount?: number;
28
+ promptTokenCount?: number;
29
+ candidatesTokenCount?: number;
30
+ cachedContentTokenCount?: number;
31
+ thoughtsTokenCount?: number;
32
+ }
33
+ /**
34
+ * Normalized thinking configuration accepted by Antigravity.
35
+ */
36
+ export interface ThinkingConfig {
37
+ thinkingBudget?: number;
38
+ includeThoughts?: boolean;
39
+ }
40
+ /**
41
+ * Default token budget for thinking/reasoning. 16000 tokens provides sufficient
42
+ * space for complex reasoning while staying within typical model limits.
43
+ */
44
+ export declare const DEFAULT_THINKING_BUDGET = 16000;
45
+ /**
46
+ * Checks if a model name indicates thinking/reasoning capability.
47
+ * Models with "thinking", "gemini-3", or "opus" in their name support extended thinking.
48
+ */
49
+ export declare function isThinkingCapableModel(modelName: string): boolean;
50
+ /**
51
+ * Extracts thinking configuration from various possible request locations.
52
+ * Supports both Gemini-style thinkingConfig and Anthropic-style thinking options.
53
+ */
54
+ export declare function extractThinkingConfig(requestPayload: Record<string, unknown>, rawGenerationConfig: Record<string, unknown> | undefined, extraBody: Record<string, unknown> | undefined): ThinkingConfig | undefined;
55
+ /**
56
+ * Variant thinking config extracted from OpenCode's providerOptions.
57
+ */
58
+ export interface VariantThinkingConfig {
59
+ /** Gemini 3 native thinking level (low/medium/high) */
60
+ thinkingLevel?: string;
61
+ /** Numeric thinking budget for Claude and Gemini 2.5 */
62
+ thinkingBudget?: number;
63
+ /** Whether to include thoughts in output */
64
+ includeThoughts?: boolean;
65
+ /** Google Search configuration */
66
+ googleSearch?: GoogleSearchConfig;
67
+ }
68
+ /**
69
+ * Extracts variant thinking config from OpenCode's providerOptions.
70
+ *
71
+ * All Antigravity models route through the Google provider, so we only check
72
+ * providerOptions.google. Supports two formats:
73
+ *
74
+ * 1. Gemini 3 native: { google: { thinkingLevel: "high", includeThoughts: true } }
75
+ * 2. Budget-based (Claude/Gemini 2.5): { google: { thinkingConfig: { thinkingBudget: 32000 } } }
76
+ */
77
+ export declare function extractVariantThinkingConfig(providerOptions: Record<string, unknown> | undefined): VariantThinkingConfig | undefined;
78
+ /**
79
+ * Determines the final thinking configuration based on model capabilities and user settings.
80
+ * For Claude thinking models, we keep thinking enabled even in multi-turn conversations.
81
+ * The filterUnsignedThinkingBlocks function will handle signature validation/restoration.
82
+ */
83
+ export declare function resolveThinkingConfig(userConfig: ThinkingConfig | undefined, isThinkingModel: boolean, _isClaudeModel: boolean, _hasAssistantHistory: boolean): ThinkingConfig | undefined;
84
+ /**
85
+ * Filters thinking blocks from contents unless the signature matches our cache.
86
+ * Attempts to restore signatures from cache for thinking blocks that lack signatures.
87
+ *
88
+ * @param contents - The contents array from the request
89
+ * @param sessionId - Optional session ID for signature cache lookup
90
+ * @param getCachedSignatureFn - Optional function to retrieve cached signatures
91
+ */
92
+ export declare function filterUnsignedThinkingBlocks(contents: any[], sessionId?: string, getCachedSignatureFn?: (sessionId: string, text: string) => string | undefined, isClaudeModel?: boolean): any[];
93
+ /**
94
+ * Filters thinking blocks from Anthropic-style messages[] payloads using cached signatures.
95
+ */
96
+ export declare function filterMessagesThinkingBlocks(messages: any[], sessionId?: string, getCachedSignatureFn?: (sessionId: string, text: string) => string | undefined, isClaudeModel?: boolean): any[];
97
+ export declare function deepFilterThinkingBlocks(payload: unknown, sessionId?: string, getCachedSignatureFn?: (sessionId: string, text: string) => string | undefined, isClaudeModel?: boolean): unknown;
98
+ /**
99
+ * Transforms thinking/reasoning content in response parts to OpenCode's expected format.
100
+ * Handles both Gemini-style (thought: true) and Anthropic-style (type: "thinking") formats.
101
+ * Also extracts reasoning_content for Anthropic-style responses.
102
+ */
103
+ export declare function transformThinkingParts(response: unknown): unknown;
104
+ /**
105
+ * Ensures thinkingConfig is valid: includeThoughts only allowed when budget > 0.
106
+ */
107
+ export declare function normalizeThinkingConfig(config: unknown): ThinkingConfig | undefined;
108
+ /**
109
+ * Parses an Antigravity API body; handles array-wrapped responses the API sometimes returns.
110
+ */
111
+ export declare function parseAntigravityApiBody(rawText: string): AntigravityApiBody | null;
112
+ /**
113
+ * Extracts usageMetadata from a response object, guarding types.
114
+ */
115
+ export declare function extractUsageMetadata(body: AntigravityApiBody): AntigravityUsageMetadata | null;
116
+ /**
117
+ * Walks SSE lines to find a usage-bearing response chunk.
118
+ */
119
+ export declare function extractUsageFromSsePayload(payload: string): AntigravityUsageMetadata | null;
120
+ /**
121
+ * Enhances 404 errors for Antigravity models with a direct preview-access message.
122
+ */
123
+ export declare function rewriteAntigravityPreviewAccessError(body: AntigravityApiBody, status: number, requestedModel?: string): AntigravityApiBody | null;
124
+ /**
125
+ * Checks if a JSON response body represents an empty response.
126
+ *
127
+ * Empty responses occur when:
128
+ * - No candidates in Gemini format
129
+ * - No choices in OpenAI format
130
+ * - Candidates/choices exist but have no content
131
+ *
132
+ * @param text - The response body text (should be valid JSON)
133
+ * @returns true if the response is empty
134
+ */
135
+ export declare function isEmptyResponseBody(text: string): boolean;
136
+ /**
137
+ * Checks if a streaming SSE response yielded zero meaningful chunks.
138
+ *
139
+ * This is used after consuming a streaming response to determine if retry is needed.
140
+ */
141
+ export interface StreamingChunkCounter {
142
+ increment: () => void;
143
+ getCount: () => number;
144
+ hasContent: () => boolean;
145
+ }
146
+ export declare function createStreamingChunkCounter(): StreamingChunkCounter;
147
+ /**
148
+ * Checks if an SSE line contains meaningful content.
149
+ *
150
+ * @param line - A single SSE line (e.g., "data: {...}")
151
+ * @returns true if the line contains content worth counting
152
+ */
153
+ export declare function isMeaningfulSseLine(line: string): boolean;
154
+ export declare function recursivelyParseJsonStrings(obj: unknown, skipParseKeys?: Set<string>, currentKey?: string): unknown;
155
+ /**
156
+ * Groups function calls with their responses, handling ID mismatches.
157
+ *
158
+ * This is a port of LLM-API-Key-Proxy's _fix_tool_response_grouping() function.
159
+ *
160
+ * When context compaction or other processes strip tool responses, the tool call
161
+ * IDs become orphaned. This function attempts to recover by:
162
+ *
163
+ * 1. Pass 1: Match by exact ID (normal case)
164
+ * 2. Pass 2: Match by function name (for ID mismatches)
165
+ * 3. Pass 3: Match "unknown_function" orphans or take first available
166
+ * 4. Fallback: Create placeholder responses for missing tool results
167
+ *
168
+ * @param contents - Array of Gemini-style content messages
169
+ * @returns Fixed contents array with matched tool responses
170
+ */
171
+ export declare function fixToolResponseGrouping(contents: any[]): any[];
172
+ /**
173
+ * Checks if contents have any tool call/response ID mismatches.
174
+ *
175
+ * @param contents - Array of Gemini-style content messages
176
+ * @returns Object with mismatch details
177
+ */
178
+ export declare function detectToolIdMismatches(contents: any[]): {
179
+ hasMismatches: boolean;
180
+ expectedIds: string[];
181
+ foundIds: string[];
182
+ missingIds: string[];
183
+ orphanIds: string[];
184
+ };
185
+ /**
186
+ * Find orphaned tool_use IDs (tool_use without matching tool_result).
187
+ * Works on Claude format messages.
188
+ */
189
+ export declare function findOrphanedToolUseIds(messages: any[]): Set<string>;
190
+ /**
191
+ * Fix orphaned tool_use blocks in Claude format messages.
192
+ * Mirrors fixToolResponseGrouping() but for Claude's messages[] format.
193
+ *
194
+ * Claude format:
195
+ * - assistant message with content[]: { type: 'tool_use', id, name, input }
196
+ * - user message with content[]: { type: 'tool_result', tool_use_id, content }
197
+ *
198
+ * @param messages - Claude format messages array
199
+ * @returns Fixed messages with placeholder tool_results for orphans
200
+ */
201
+ export declare function fixClaudeToolPairing(messages: any[]): any[];
202
+ /**
203
+ * Validate and fix tool pairing with fallback nuclear option.
204
+ * Defense in depth: tries gentle fix first, then nuclear removal.
205
+ */
206
+ export declare function validateAndFixClaudeToolPairing(messages: any[]): any[];
207
+ /**
208
+ * Injects parameter signatures into tool descriptions.
209
+ * Port of LLM-API-Key-Proxy's _inject_signature_into_descriptions()
210
+ *
211
+ * This helps prevent tool hallucination by explicitly listing parameters
212
+ * in the description, making it harder for the model to hallucinate
213
+ * parameters from its training data.
214
+ *
215
+ * @param tools - Array of tool definitions (Gemini format)
216
+ * @param promptTemplate - Template for the signature (default: "\\n\\nSTRICT PARAMETERS: {params}.")
217
+ * @returns Modified tools array with signatures injected
218
+ */
219
+ export declare function injectParameterSignatures(tools: any[], promptTemplate?: string): any[];
220
+ /**
221
+ * Injects a tool hardening system instruction into the request payload.
222
+ * Port of LLM-API-Key-Proxy's _inject_tool_hardening_instruction()
223
+ *
224
+ * @param payload - The Gemini request payload
225
+ * @param instructionText - The instruction text to inject
226
+ */
227
+ export declare function injectToolHardeningInstruction(payload: Record<string, unknown>, instructionText: string): void;
228
+ /**
229
+ * Assigns IDs to functionCall parts and returns the pending call IDs by name.
230
+ * This is the first pass of tool ID assignment.
231
+ *
232
+ * @param contents - Gemini-style contents array
233
+ * @returns Object with modified contents and pending call IDs map
234
+ */
235
+ export declare function assignToolIdsToContents(contents: any[]): {
236
+ contents: any[];
237
+ pendingCallIdsByName: Map<string, string[]>;
238
+ toolCallCounter: number;
239
+ };
240
+ /**
241
+ * Matches functionResponse IDs to their corresponding functionCall IDs.
242
+ * This is the second pass of tool ID assignment.
243
+ *
244
+ * @param contents - Gemini-style contents array
245
+ * @param pendingCallIdsByName - Map of function names to pending call IDs
246
+ * @returns Modified contents with matched response IDs
247
+ */
248
+ export declare function matchResponseIdsToContents(contents: any[], pendingCallIdsByName: Map<string, string[]>): any[];
249
+ /**
250
+ * Applies all tool fixes to a request payload for Claude models.
251
+ * This includes:
252
+ * 1. Tool ID assignment for functionCalls
253
+ * 2. Response ID matching for functionResponses
254
+ * 3. Orphan recovery via fixToolResponseGrouping
255
+ * 4. Claude format pairing fix via validateAndFixClaudeToolPairing
256
+ *
257
+ * @param payload - Request payload object
258
+ * @param isClaude - Whether this is a Claude model request
259
+ * @returns Object with fix applied status
260
+ */
261
+ export declare function applyToolPairingFixes(payload: Record<string, unknown>, isClaude: boolean): {
262
+ contentsFixed: boolean;
263
+ messagesFixed: boolean;
264
+ };
265
+ /**
266
+ * Creates a synthetic Claude SSE streaming response with error content.
267
+ *
268
+ * When returning HTTP 400/500 errors to OpenCode, the session becomes locked
269
+ * and the user cannot use /compact or other commands. This function creates
270
+ * a fake "successful" SSE response (200 OK) with the error message as text content,
271
+ * allowing the user to continue using the session.
272
+ *
273
+ * @param errorMessage - The error message to include in the response
274
+ * @param requestedModel - The model that was requested
275
+ * @returns A Response object with synthetic SSE stream
276
+ */
277
+ export declare function createSyntheticErrorResponse(errorMessage: string, requestedModel?: string): Response;
278
+ //# sourceMappingURL=request-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-helpers.d.ts","sourceRoot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