@psnext/slingcli 2.4.20260505-4 → 2.4.20260505-6

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 (64) hide show
  1. package/bin/sling.js +48 -2
  2. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/clipboard.linux-x64-gnu.node +0 -0
  3. package/node_modules/@mariozechner/{clipboard-darwin-arm64 → clipboard-linux-x64-gnu}/package.json +8 -5
  4. package/node_modules/semver/LICENSE +15 -0
  5. package/node_modules/semver/README.md +665 -0
  6. package/node_modules/semver/bin/semver.js +191 -0
  7. package/node_modules/semver/classes/comparator.js +143 -0
  8. package/node_modules/semver/classes/index.js +7 -0
  9. package/node_modules/semver/classes/range.js +557 -0
  10. package/node_modules/semver/classes/semver.js +333 -0
  11. package/node_modules/semver/functions/clean.js +8 -0
  12. package/node_modules/semver/functions/cmp.js +54 -0
  13. package/node_modules/semver/functions/coerce.js +62 -0
  14. package/node_modules/semver/functions/compare-build.js +9 -0
  15. package/node_modules/semver/functions/compare-loose.js +5 -0
  16. package/node_modules/semver/functions/compare.js +7 -0
  17. package/node_modules/semver/functions/diff.js +60 -0
  18. package/node_modules/semver/functions/eq.js +5 -0
  19. package/node_modules/semver/functions/gt.js +5 -0
  20. package/node_modules/semver/functions/gte.js +5 -0
  21. package/node_modules/semver/functions/inc.js +21 -0
  22. package/node_modules/semver/functions/lt.js +5 -0
  23. package/node_modules/semver/functions/lte.js +5 -0
  24. package/node_modules/semver/functions/major.js +5 -0
  25. package/node_modules/semver/functions/minor.js +5 -0
  26. package/node_modules/semver/functions/neq.js +5 -0
  27. package/node_modules/semver/functions/parse.js +18 -0
  28. package/node_modules/semver/functions/patch.js +5 -0
  29. package/node_modules/semver/functions/prerelease.js +8 -0
  30. package/node_modules/semver/functions/rcompare.js +5 -0
  31. package/node_modules/semver/functions/rsort.js +5 -0
  32. package/node_modules/semver/functions/satisfies.js +12 -0
  33. package/node_modules/semver/functions/sort.js +5 -0
  34. package/node_modules/semver/functions/valid.js +8 -0
  35. package/node_modules/semver/index.js +91 -0
  36. package/node_modules/semver/internal/constants.js +37 -0
  37. package/node_modules/semver/internal/debug.js +11 -0
  38. package/node_modules/semver/internal/identifiers.js +29 -0
  39. package/node_modules/semver/internal/lrucache.js +42 -0
  40. package/node_modules/semver/internal/parse-options.js +17 -0
  41. package/node_modules/semver/internal/re.js +223 -0
  42. package/node_modules/semver/package.json +78 -0
  43. package/node_modules/semver/preload.js +4 -0
  44. package/node_modules/semver/range.bnf +16 -0
  45. package/node_modules/semver/ranges/gtr.js +6 -0
  46. package/node_modules/semver/ranges/intersects.js +9 -0
  47. package/node_modules/semver/ranges/ltr.js +6 -0
  48. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  49. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  50. package/node_modules/semver/ranges/min-version.js +63 -0
  51. package/node_modules/semver/ranges/outside.js +82 -0
  52. package/node_modules/semver/ranges/simplify.js +49 -0
  53. package/node_modules/semver/ranges/subset.js +249 -0
  54. package/node_modules/semver/ranges/to-comparators.js +10 -0
  55. package/node_modules/semver/ranges/valid.js +13 -0
  56. package/package.json +4 -3
  57. package/slingshot/index.js +1 -1
  58. package/node_modules/@mariozechner/clipboard-darwin-arm64/clipboard.darwin-arm64.node +0 -0
  59. package/node_modules/@mariozechner/clipboard-darwin-universal/clipboard.darwin-universal.node +0 -0
  60. package/node_modules/@mariozechner/clipboard-darwin-universal/package.json +0 -19
  61. package/node_modules/@mariozechner/pi-ai/dist/providers/google-gemini-cli.js +0 -776
  62. package/node_modules/@mariozechner/pi-ai/dist/utils/http-proxy.js +0 -15
  63. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/google-antigravity.js +0 -376
  64. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/google-gemini-cli.js +0 -481
@@ -1,15 +0,0 @@
1
- /**
2
- * Set up HTTP proxy according to env variables for `fetch` based SDKs in Node.js.
3
- * Bun has builtin support for this.
4
- *
5
- * This module should be imported early by any code that needs proxy support for fetch().
6
- * ES modules are cached, so importing multiple times is safe - setup only runs once.
7
- */
8
- if (typeof process !== "undefined" && process.versions?.node) {
9
- import("undici").then((m) => {
10
- const { EnvHttpProxyAgent, setGlobalDispatcher } = m;
11
- setGlobalDispatcher(new EnvHttpProxyAgent());
12
- });
13
- }
14
- export {};
15
- //# sourceMappingURL=http-proxy.js.map
@@ -1,376 +0,0 @@
1
- /**
2
- * Antigravity OAuth flow (Gemini 3, Claude, GPT-OSS via Google Cloud)
3
- * Uses different OAuth credentials than google-gemini-cli for access to additional models.
4
- *
5
- * NOTE: This module uses Node.js http.createServer for the OAuth callback.
6
- * It is only intended for CLI use, not browser environments.
7
- */
8
- import { oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.js";
9
- import { generatePKCE } from "./pkce.js";
10
- let _createServer = null;
11
- let _httpImportPromise = null;
12
- if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
13
- _httpImportPromise = import("node:http").then((m) => {
14
- _createServer = m.createServer;
15
- });
16
- }
17
- // Antigravity OAuth credentials (different from Gemini CLI)
18
- const decode = (s) => atob(s);
19
- const CLIENT_ID = decode("MTA3MTAwNjA2MDU5MS10bWhzc2luMmgyMWxjcmUyMzV2dG9sb2poNGc0MDNlcC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbQ==");
20
- const CLIENT_SECRET = decode("R09DU1BYLUs1OEZXUjQ4NkxkTEoxbUxCOHNYQzR6NnFEQWY=");
21
- const REDIRECT_URI = "http://localhost:51121/oauth-callback";
22
- // Antigravity requires additional scopes
23
- const SCOPES = [
24
- "https://www.googleapis.com/auth/cloud-platform",
25
- "https://www.googleapis.com/auth/userinfo.email",
26
- "https://www.googleapis.com/auth/userinfo.profile",
27
- "https://www.googleapis.com/auth/cclog",
28
- "https://www.googleapis.com/auth/experimentsandconfigs",
29
- ];
30
- const AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
31
- const TOKEN_URL = "https://oauth2.googleapis.com/token";
32
- // Fallback project ID when discovery fails
33
- const DEFAULT_PROJECT_ID = "rising-fact-p41fc";
34
- /**
35
- * Start a local HTTP server to receive the OAuth callback
36
- */
37
- async function getNodeCreateServer() {
38
- if (_createServer)
39
- return _createServer;
40
- if (_httpImportPromise) {
41
- await _httpImportPromise;
42
- }
43
- if (_createServer)
44
- return _createServer;
45
- throw new Error("Antigravity OAuth is only available in Node.js environments");
46
- }
47
- async function startCallbackServer() {
48
- const createServer = await getNodeCreateServer();
49
- return new Promise((resolve, reject) => {
50
- let settleWait;
51
- const waitForCodePromise = new Promise((resolveWait) => {
52
- let settled = false;
53
- settleWait = (value) => {
54
- if (settled)
55
- return;
56
- settled = true;
57
- resolveWait(value);
58
- };
59
- });
60
- const server = createServer((req, res) => {
61
- const url = new URL(req.url || "", `http://localhost:51121`);
62
- if (url.pathname === "/oauth-callback") {
63
- const code = url.searchParams.get("code");
64
- const state = url.searchParams.get("state");
65
- const error = url.searchParams.get("error");
66
- if (error) {
67
- res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
68
- res.end(oauthErrorHtml("Google authentication did not complete.", `Error: ${error}`));
69
- return;
70
- }
71
- if (code && state) {
72
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
73
- res.end(oauthSuccessHtml("Google authentication completed. You can close this window."));
74
- settleWait?.({ code, state });
75
- }
76
- else {
77
- res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
78
- res.end(oauthErrorHtml("Missing code or state parameter."));
79
- }
80
- }
81
- else {
82
- res.writeHead(404, { "Content-Type": "text/html; charset=utf-8" });
83
- res.end(oauthErrorHtml("Callback route not found."));
84
- }
85
- });
86
- server.on("error", (err) => {
87
- reject(err);
88
- });
89
- server.listen(51121, "127.0.0.1", () => {
90
- resolve({
91
- server,
92
- cancelWait: () => {
93
- settleWait?.(null);
94
- },
95
- waitForCode: () => waitForCodePromise,
96
- });
97
- });
98
- });
99
- }
100
- /**
101
- * Parse redirect URL to extract code and state
102
- */
103
- function parseRedirectUrl(input) {
104
- const value = input.trim();
105
- if (!value)
106
- return {};
107
- try {
108
- const url = new URL(value);
109
- return {
110
- code: url.searchParams.get("code") ?? undefined,
111
- state: url.searchParams.get("state") ?? undefined,
112
- };
113
- }
114
- catch {
115
- // Not a URL, return empty
116
- return {};
117
- }
118
- }
119
- /**
120
- * Discover or provision a project for the user
121
- */
122
- async function discoverProject(accessToken, onProgress) {
123
- const headers = {
124
- Authorization: `Bearer ${accessToken}`,
125
- "Content-Type": "application/json",
126
- "User-Agent": "google-api-nodejs-client/9.15.1",
127
- "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
128
- "Client-Metadata": JSON.stringify({
129
- ideType: "IDE_UNSPECIFIED",
130
- platform: "PLATFORM_UNSPECIFIED",
131
- pluginType: "GEMINI",
132
- }),
133
- };
134
- // Try endpoints in order: prod first, then sandbox
135
- const endpoints = ["https://cloudcode-pa.googleapis.com", "https://daily-cloudcode-pa.sandbox.googleapis.com"];
136
- onProgress?.("Checking for existing project...");
137
- for (const endpoint of endpoints) {
138
- try {
139
- const loadResponse = await fetch(`${endpoint}/v1internal:loadCodeAssist`, {
140
- method: "POST",
141
- headers,
142
- body: JSON.stringify({
143
- metadata: {
144
- ideType: "IDE_UNSPECIFIED",
145
- platform: "PLATFORM_UNSPECIFIED",
146
- pluginType: "GEMINI",
147
- },
148
- }),
149
- });
150
- if (loadResponse.ok) {
151
- const data = (await loadResponse.json());
152
- // Handle both string and object formats
153
- if (typeof data.cloudaicompanionProject === "string" && data.cloudaicompanionProject) {
154
- return data.cloudaicompanionProject;
155
- }
156
- if (data.cloudaicompanionProject &&
157
- typeof data.cloudaicompanionProject === "object" &&
158
- data.cloudaicompanionProject.id) {
159
- return data.cloudaicompanionProject.id;
160
- }
161
- }
162
- }
163
- catch {
164
- // Try next endpoint
165
- }
166
- }
167
- // Use fallback project ID
168
- onProgress?.("Using default project...");
169
- return DEFAULT_PROJECT_ID;
170
- }
171
- /**
172
- * Get user email from the access token
173
- */
174
- async function getUserEmail(accessToken) {
175
- try {
176
- const response = await fetch("https://www.googleapis.com/oauth2/v1/userinfo?alt=json", {
177
- headers: {
178
- Authorization: `Bearer ${accessToken}`,
179
- },
180
- });
181
- if (response.ok) {
182
- const data = (await response.json());
183
- return data.email;
184
- }
185
- }
186
- catch {
187
- // Ignore errors, email is optional
188
- }
189
- return undefined;
190
- }
191
- /**
192
- * Refresh Antigravity token
193
- */
194
- export async function refreshAntigravityToken(refreshToken, projectId) {
195
- const response = await fetch(TOKEN_URL, {
196
- method: "POST",
197
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
198
- body: new URLSearchParams({
199
- client_id: CLIENT_ID,
200
- client_secret: CLIENT_SECRET,
201
- refresh_token: refreshToken,
202
- grant_type: "refresh_token",
203
- }),
204
- });
205
- if (!response.ok) {
206
- const error = await response.text();
207
- throw new Error(`Antigravity token refresh failed: ${error}`);
208
- }
209
- const data = (await response.json());
210
- return {
211
- refresh: data.refresh_token || refreshToken,
212
- access: data.access_token,
213
- expires: Date.now() + data.expires_in * 1000 - 5 * 60 * 1000,
214
- projectId,
215
- };
216
- }
217
- /**
218
- * Login with Antigravity OAuth
219
- *
220
- * @param onAuth - Callback with URL and optional instructions
221
- * @param onProgress - Optional progress callback
222
- * @param onManualCodeInput - Optional promise that resolves with user-pasted redirect URL.
223
- * Races with browser callback - whichever completes first wins.
224
- */
225
- export async function loginAntigravity(onAuth, onProgress, onManualCodeInput) {
226
- const { verifier, challenge } = await generatePKCE();
227
- // Start local server for callback
228
- onProgress?.("Starting local server for OAuth callback...");
229
- const server = await startCallbackServer();
230
- let code;
231
- try {
232
- // Build authorization URL
233
- const authParams = new URLSearchParams({
234
- client_id: CLIENT_ID,
235
- response_type: "code",
236
- redirect_uri: REDIRECT_URI,
237
- scope: SCOPES.join(" "),
238
- code_challenge: challenge,
239
- code_challenge_method: "S256",
240
- state: verifier,
241
- access_type: "offline",
242
- prompt: "consent",
243
- });
244
- const authUrl = `${AUTH_URL}?${authParams.toString()}`;
245
- // Notify caller with URL to open
246
- onAuth({
247
- url: authUrl,
248
- instructions: "Complete the sign-in in your browser.",
249
- });
250
- // Wait for the callback, racing with manual input if provided
251
- onProgress?.("Waiting for OAuth callback...");
252
- if (onManualCodeInput) {
253
- // Race between browser callback and manual input
254
- let manualInput;
255
- let manualError;
256
- const manualPromise = onManualCodeInput()
257
- .then((input) => {
258
- manualInput = input;
259
- server.cancelWait();
260
- })
261
- .catch((err) => {
262
- manualError = err instanceof Error ? err : new Error(String(err));
263
- server.cancelWait();
264
- });
265
- const result = await server.waitForCode();
266
- // If manual input was cancelled, throw that error
267
- if (manualError) {
268
- throw manualError;
269
- }
270
- if (result?.code) {
271
- // Browser callback won - verify state
272
- if (result.state !== verifier) {
273
- throw new Error("OAuth state mismatch - possible CSRF attack");
274
- }
275
- code = result.code;
276
- }
277
- else if (manualInput) {
278
- // Manual input won
279
- const parsed = parseRedirectUrl(manualInput);
280
- if (parsed.state && parsed.state !== verifier) {
281
- throw new Error("OAuth state mismatch - possible CSRF attack");
282
- }
283
- code = parsed.code;
284
- }
285
- // If still no code, wait for manual promise and try that
286
- if (!code) {
287
- await manualPromise;
288
- if (manualError) {
289
- throw manualError;
290
- }
291
- if (manualInput) {
292
- const parsed = parseRedirectUrl(manualInput);
293
- if (parsed.state && parsed.state !== verifier) {
294
- throw new Error("OAuth state mismatch - possible CSRF attack");
295
- }
296
- code = parsed.code;
297
- }
298
- }
299
- }
300
- else {
301
- // Original flow: just wait for callback
302
- const result = await server.waitForCode();
303
- if (result?.code) {
304
- if (result.state !== verifier) {
305
- throw new Error("OAuth state mismatch - possible CSRF attack");
306
- }
307
- code = result.code;
308
- }
309
- }
310
- if (!code) {
311
- throw new Error("No authorization code received");
312
- }
313
- // Exchange code for tokens
314
- onProgress?.("Exchanging authorization code for tokens...");
315
- const tokenResponse = await fetch(TOKEN_URL, {
316
- method: "POST",
317
- headers: {
318
- "Content-Type": "application/x-www-form-urlencoded",
319
- },
320
- body: new URLSearchParams({
321
- client_id: CLIENT_ID,
322
- client_secret: CLIENT_SECRET,
323
- code,
324
- grant_type: "authorization_code",
325
- redirect_uri: REDIRECT_URI,
326
- code_verifier: verifier,
327
- }),
328
- });
329
- if (!tokenResponse.ok) {
330
- const error = await tokenResponse.text();
331
- throw new Error(`Token exchange failed: ${error}`);
332
- }
333
- const tokenData = (await tokenResponse.json());
334
- if (!tokenData.refresh_token) {
335
- throw new Error("No refresh token received. Please try again.");
336
- }
337
- // Get user email
338
- onProgress?.("Getting user info...");
339
- const email = await getUserEmail(tokenData.access_token);
340
- // Discover project
341
- const projectId = await discoverProject(tokenData.access_token, onProgress);
342
- // Calculate expiry time (current time + expires_in seconds - 5 min buffer)
343
- const expiresAt = Date.now() + tokenData.expires_in * 1000 - 5 * 60 * 1000;
344
- const credentials = {
345
- refresh: tokenData.refresh_token,
346
- access: tokenData.access_token,
347
- expires: expiresAt,
348
- projectId,
349
- email,
350
- };
351
- return credentials;
352
- }
353
- finally {
354
- server.server.close();
355
- }
356
- }
357
- export const antigravityOAuthProvider = {
358
- id: "google-antigravity",
359
- name: "Antigravity (Gemini 3, Claude, GPT-OSS)",
360
- usesCallbackServer: true,
361
- async login(callbacks) {
362
- return loginAntigravity(callbacks.onAuth, callbacks.onProgress, callbacks.onManualCodeInput);
363
- },
364
- async refreshToken(credentials) {
365
- const creds = credentials;
366
- if (!creds.projectId) {
367
- throw new Error("Antigravity credentials missing projectId");
368
- }
369
- return refreshAntigravityToken(creds.refresh, creds.projectId);
370
- },
371
- getApiKey(credentials) {
372
- const creds = credentials;
373
- return JSON.stringify({ token: creds.access, projectId: creds.projectId });
374
- },
375
- };
376
- //# sourceMappingURL=google-antigravity.js.map