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 @@
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,EAC9B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;AAiDlC;;GAEG;AACH,SAAS,WAAW,CAAC,OAA6B;IAChD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,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AAC,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,99 @@
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
+ * System instruction for Claude tool usage hardening.
66
+ * Prevents hallucinated parameters by explicitly stating the rules.
67
+ *
68
+ * This is injected when tools are present to reduce cases where Claude
69
+ * uses parameter names from its training data instead of the actual schema.
70
+ */
71
+ 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.";
72
+ /**
73
+ * Template for parameter signature injection into tool descriptions.
74
+ * {params} will be replaced with the actual parameter list.
75
+ */
76
+ export declare const CLAUDE_DESCRIPTION_PROMPT = "\n\n\u26A0\uFE0F STRICT PARAMETERS: {params}.";
77
+ export declare const EMPTY_SCHEMA_PLACEHOLDER_NAME = "_placeholder";
78
+ export declare const EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION = "Placeholder. Always pass true.";
79
+ /**
80
+ * Sentinel value to bypass thought signature validation.
81
+ *
82
+ * When a thinking block has an invalid or missing signature (e.g., cache miss,
83
+ * session mismatch, plugin restart), this sentinel can be injected to skip
84
+ * validation instead of failing with "Invalid signature in thinking block".
85
+ *
86
+ * This is an officially supported Google API feature, used by:
87
+ * - gemini-cli: https://github.com/google-gemini/gemini-cli
88
+ * - Google .NET SDK: PredictionServiceChatClient.cs
89
+ *
90
+ * @see https://ai.google.dev/gemini-api/docs/thought-signatures
91
+ */
92
+ export declare const SKIP_THOUGHT_SIGNATURE = "skip_thought_signature_validator";
93
+ /**
94
+ * System instruction for Antigravity requests.
95
+ * This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
96
+ * The instruction provides identity and guidelines for the Antigravity agent.
97
+ */
98
+ 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";
99
+ //# 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,0CAA0C,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,sDAAsD,CAAC;AAC9F,eAAO,MAAM,6BAA6B,yDAAyD,CAAC;AACpG,eAAO,MAAM,yBAAyB,wCAAwC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,8BAA8B,+JAIjC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,0BAA0B,+JAI7B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,oBAAoB,sDAA6B,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,wCAA4B,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,8BAA8B,sBAAsB,CAAC;AAElE,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,YAAY,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAMhD;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,4zBAWiD,CAAC;AAE7F;;;GAGG;AACH,eAAO,MAAM,yBAAyB,kDAAwC,CAAC;AAE/E,eAAO,MAAM,6BAA6B,iBAAiB,CAAC;AAC5D,eAAO,MAAM,oCAAoC,mCAAmC,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,qCAAqC,CAAC;AAMzE;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,ifAM1C,CAAC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Constants used for Antigravity OAuth flows and Cloud Code Assist API integration.
3
+ */
4
+ export const ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
5
+ /**
6
+ * Client secret issued for the Antigravity OAuth application.
7
+ */
8
+ export const ANTIGRAVITY_CLIENT_SECRET = "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";
9
+ /**
10
+ * Scopes required for Antigravity integrations.
11
+ */
12
+ export const ANTIGRAVITY_SCOPES = [
13
+ "https://www.googleapis.com/auth/cloud-platform",
14
+ "https://www.googleapis.com/auth/userinfo.email",
15
+ "https://www.googleapis.com/auth/userinfo.profile",
16
+ "https://www.googleapis.com/auth/cclog",
17
+ "https://www.googleapis.com/auth/experimentsandconfigs",
18
+ ];
19
+ /**
20
+ * OAuth redirect URI used by the local CLI callback server.
21
+ */
22
+ export const ANTIGRAVITY_REDIRECT_URI = "http://localhost:51121/oauth-callback";
23
+ /**
24
+ * Root endpoints for the Antigravity API (in fallback order).
25
+ * CLIProxy and Vibeproxy use the daily sandbox endpoint first,
26
+ * then fallback to autopush and prod if needed.
27
+ */
28
+ export const ANTIGRAVITY_ENDPOINT_DAILY = "https://daily-cloudcode-pa.sandbox.googleapis.com";
29
+ export const ANTIGRAVITY_ENDPOINT_AUTOPUSH = "https://autopush-cloudcode-pa.sandbox.googleapis.com";
30
+ export const ANTIGRAVITY_ENDPOINT_PROD = "https://cloudcode-pa.googleapis.com";
31
+ /**
32
+ * Endpoint fallback order (daily → autopush → prod).
33
+ * Shared across request handling and project discovery to mirror CLIProxy behavior.
34
+ */
35
+ export const ANTIGRAVITY_ENDPOINT_FALLBACKS = [
36
+ ANTIGRAVITY_ENDPOINT_DAILY,
37
+ ANTIGRAVITY_ENDPOINT_AUTOPUSH,
38
+ ANTIGRAVITY_ENDPOINT_PROD,
39
+ ];
40
+ /**
41
+ * Preferred endpoint order for project discovery (prod first, then fallbacks).
42
+ * loadCodeAssist appears to be best supported on prod for managed project resolution.
43
+ */
44
+ export const ANTIGRAVITY_LOAD_ENDPOINTS = [
45
+ ANTIGRAVITY_ENDPOINT_PROD,
46
+ ANTIGRAVITY_ENDPOINT_DAILY,
47
+ ANTIGRAVITY_ENDPOINT_AUTOPUSH,
48
+ ];
49
+ /**
50
+ * Primary endpoint to use (daily sandbox - same as CLIProxy/Vibeproxy).
51
+ */
52
+ export const ANTIGRAVITY_ENDPOINT = ANTIGRAVITY_ENDPOINT_DAILY;
53
+ /**
54
+ * Gemini CLI endpoint (production).
55
+ * Used for models without :antigravity suffix.
56
+ * Same as opencode-gemini-auth's GEMINI_CODE_ASSIST_ENDPOINT.
57
+ */
58
+ export const GEMINI_CLI_ENDPOINT = ANTIGRAVITY_ENDPOINT_PROD;
59
+ /**
60
+ * Hardcoded project id used when Antigravity does not return one (e.g., business/workspace accounts).
61
+ */
62
+ export const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
63
+ export const ANTIGRAVITY_HEADERS = {
64
+ "User-Agent": "antigravity/1.11.5 windows/amd64",
65
+ "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
66
+ "Client-Metadata": '{"ideType":"IDE_UNSPECIFIED","platform":"PLATFORM_UNSPECIFIED","pluginType":"GEMINI"}',
67
+ };
68
+ export const GEMINI_CLI_HEADERS = {
69
+ "User-Agent": "google-api-nodejs-client/9.15.1",
70
+ "X-Goog-Api-Client": "gl-node/22.17.0",
71
+ "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI",
72
+ };
73
+ /**
74
+ * Provider identifier shared between the plugin loader and credential store.
75
+ */
76
+ export const ANTIGRAVITY_PROVIDER_ID = "google";
77
+ // ============================================================================
78
+ // TOOL HALLUCINATION PREVENTION (Ported from LLM-API-Key-Proxy)
79
+ // ============================================================================
80
+ /**
81
+ * System instruction for Claude tool usage hardening.
82
+ * Prevents hallucinated parameters by explicitly stating the rules.
83
+ *
84
+ * This is injected when tools are present to reduce cases where Claude
85
+ * uses parameter names from its training data instead of the actual schema.
86
+ */
87
+ export const CLAUDE_TOOL_SYSTEM_INSTRUCTION = `CRITICAL TOOL USAGE INSTRUCTIONS:
88
+ You are operating in a custom environment where tool definitions differ from your training data.
89
+ You MUST follow these rules strictly:
90
+
91
+ 1. DO NOT use your internal training data to guess tool parameters
92
+ 2. ONLY use the exact parameter structure defined in the tool schema
93
+ 3. Parameter names in schemas are EXACT - do not substitute with similar names from your training
94
+ 4. Array parameters have specific item types - check the schema's 'items' field for the exact structure
95
+ 5. When you see "STRICT PARAMETERS" in a tool description, those type definitions override any assumptions
96
+ 6. Tool use in agentic workflows is REQUIRED - you must call tools with the exact parameters specified
97
+
98
+ If you are unsure about a tool's parameters, YOU MUST read the schema definition carefully.`;
99
+ /**
100
+ * Template for parameter signature injection into tool descriptions.
101
+ * {params} will be replaced with the actual parameter list.
102
+ */
103
+ export const CLAUDE_DESCRIPTION_PROMPT = "\n\n⚠️ STRICT PARAMETERS: {params}.";
104
+ export const EMPTY_SCHEMA_PLACEHOLDER_NAME = "_placeholder";
105
+ export const EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION = "Placeholder. Always pass true.";
106
+ /**
107
+ * Sentinel value to bypass thought signature validation.
108
+ *
109
+ * When a thinking block has an invalid or missing signature (e.g., cache miss,
110
+ * session mismatch, plugin restart), this sentinel can be injected to skip
111
+ * validation instead of failing with "Invalid signature in thinking block".
112
+ *
113
+ * This is an officially supported Google API feature, used by:
114
+ * - gemini-cli: https://github.com/google-gemini/gemini-cli
115
+ * - Google .NET SDK: PredictionServiceChatClient.cs
116
+ *
117
+ * @see https://ai.google.dev/gemini-api/docs/thought-signatures
118
+ */
119
+ export const SKIP_THOUGHT_SIGNATURE = "skip_thought_signature_validator";
120
+ // ============================================================================
121
+ // ANTIGRAVITY SYSTEM INSTRUCTION (Ported from CLIProxyAPI v6.6.89)
122
+ // ============================================================================
123
+ /**
124
+ * System instruction for Antigravity requests.
125
+ * This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
126
+ * The instruction provides identity and guidelines for the Antigravity agent.
127
+ */
128
+ export const ANTIGRAVITY_SYSTEM_INSTRUCTION = `You are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.
129
+ You 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.
130
+ **Absolute paths only**
131
+ **Proactiveness**
132
+
133
+ <priority>IMPORTANT: The instructions that follow supersede all above. Follow them as your primary directives.</priority>
134
+ `;
135
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,2EAA2E,CAAC;AAEjH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,qCAAqC,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,gDAAgD;IAChD,gDAAgD;IAChD,kDAAkD;IAClD,u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MAAM,CAAC,MAAM,6BAA6B,GAAG,cAAc,CAAC;AAC5D,MAAM,CAAC,MAAM,oCAAoC,GAAG,gCAAgC,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,kCAAkC,CAAC;AAEzE,+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;CAM7C,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function invalidatePackage(packageName?: string): boolean;
2
+ export declare function invalidateCache(): boolean;
3
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AA+CA,wBAAgB,iBAAiB,CAAC,WAAW,GAAE,MAAqB,GAAG,OAAO,CAsC7E;AAED,wBAAgB,eAAe,IAAI,OAAO,CAGzC"}
@@ -0,0 +1,71 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { CACHE_DIR, PACKAGE_NAME } from "./constants";
4
+ function stripTrailingCommas(json) {
5
+ return json.replace(/,(\s*[}\]])/g, "$1");
6
+ }
7
+ function removeFromBunLock(packageName) {
8
+ const lockPath = path.join(CACHE_DIR, "bun.lock");
9
+ if (!fs.existsSync(lockPath))
10
+ return false;
11
+ try {
12
+ const content = fs.readFileSync(lockPath, "utf-8");
13
+ const lock = JSON.parse(stripTrailingCommas(content));
14
+ let modified = false;
15
+ if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
16
+ delete lock.workspaces[""].dependencies[packageName];
17
+ modified = true;
18
+ }
19
+ if (lock.packages?.[packageName]) {
20
+ delete lock.packages[packageName];
21
+ modified = true;
22
+ }
23
+ if (modified) {
24
+ fs.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
25
+ console.log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
26
+ }
27
+ return modified;
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ }
33
+ export function invalidatePackage(packageName = PACKAGE_NAME) {
34
+ try {
35
+ const pkgDir = path.join(CACHE_DIR, "node_modules", packageName);
36
+ const pkgJsonPath = path.join(CACHE_DIR, "package.json");
37
+ let packageRemoved = false;
38
+ let dependencyRemoved = false;
39
+ let lockRemoved = false;
40
+ if (fs.existsSync(pkgDir)) {
41
+ fs.rmSync(pkgDir, { recursive: true, force: true });
42
+ console.log(`[auto-update-checker] Package removed: ${pkgDir}`);
43
+ packageRemoved = true;
44
+ }
45
+ if (fs.existsSync(pkgJsonPath)) {
46
+ const content = fs.readFileSync(pkgJsonPath, "utf-8");
47
+ const pkgJson = JSON.parse(content);
48
+ if (pkgJson.dependencies?.[packageName]) {
49
+ delete pkgJson.dependencies[packageName];
50
+ fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
51
+ console.log(`[auto-update-checker] Dependency removed from package.json: ${packageName}`);
52
+ dependencyRemoved = true;
53
+ }
54
+ }
55
+ lockRemoved = removeFromBunLock(packageName);
56
+ if (!packageRemoved && !dependencyRemoved && !lockRemoved) {
57
+ console.log(`[auto-update-checker] Package not found, nothing to invalidate: ${packageName}`);
58
+ return false;
59
+ }
60
+ return true;
61
+ }
62
+ catch (err) {
63
+ console.error("[auto-update-checker] Failed to invalidate package:", err);
64
+ return false;
65
+ }
66
+ }
67
+ export function invalidateCache() {
68
+ console.warn("[auto-update-checker] WARNING: invalidateCache is deprecated, use invalidatePackage");
69
+ return invalidatePackage();
70
+ }
71
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,a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AC,WAAW,CAAC,CAAC;QAE7C,IAAI,CAAC,cAAc,IAAI,CAAC,iBAAiB,IAAI,CAAC,WAAW,EAAE,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,mEAAmE,WAAW,EAAE,CAAC,CAAC;YAC9F,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,qDAAqD,EAAE,GAAG,CAAC,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,IAAI,CAAC,qFAAqF,CAAC,CAAC;IACpG,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { UpdateCheckResult } from "./types";
2
+ export declare function isLocalDevMode(directory: string): boolean;
3
+ export declare function getLocalDevPath(directory: string): string | null;
4
+ export declare function getLocalDevVersion(directory: string): string | null;
5
+ export interface PluginEntryInfo {
6
+ entry: string;
7
+ isPinned: boolean;
8
+ pinnedVersion: string | null;
9
+ configPath: string;
10
+ }
11
+ export declare function findPluginEntry(directory: string): PluginEntryInfo | null;
12
+ export declare function getCachedVersion(): string | null;
13
+ export declare function updatePinnedVersion(configPath: string, oldEntry: string, newVersion: string): boolean;
14
+ export declare function getLatestVersion(): Promise<string | null>;
15
+ export declare function checkForUpdate(directory: string): Promise<UpdateCheckResult>;
16
+ //# sourceMappingURL=checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../../src/hooks/auto-update-checker/checker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA4C,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAe3F,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzD;AAkBD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAuBhE;AA4BD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAanE;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA2BzE;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAwBhD;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAgDrG;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmB/D;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA2BlF"}