@cortexkit/opencode-antigravity-auth 3.0.23 → 3.0.25

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 (40) hide show
  1. package/dist/cli.js +32 -3
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +8 -8
  4. package/dist/index.js +247 -68
  5. package/dist/index.js.map +3 -3
  6. package/dist/index.meta.json +12 -12
  7. package/dist/server.js +380 -98
  8. package/dist/server.js.map +3 -3
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/auth-method-labels.d.ts +1 -0
  11. package/dist/src/auth-method-labels.d.ts.map +1 -1
  12. package/dist/src/auth-method-labels.js +1 -0
  13. package/dist/src/auth-method-labels.js.map +1 -1
  14. package/dist/src/ga/server/auth.d.ts.map +1 -1
  15. package/dist/src/ga/server/auth.js +63 -21
  16. package/dist/src/ga/server/auth.js.map +1 -1
  17. package/dist/src/ga/server/pool-login.d.ts +4 -0
  18. package/dist/src/ga/server/pool-login.d.ts.map +1 -1
  19. package/dist/src/ga/server/pool-login.js +22 -1
  20. package/dist/src/ga/server/pool-login.js.map +1 -1
  21. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  22. package/dist/src/plugin/ga-location-services.js +42 -4
  23. package/dist/src/plugin/ga-location-services.js.map +1 -1
  24. package/dist/src/plugin/shared/request-services.d.ts +4 -0
  25. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  26. package/dist/src/plugin/shared/request-services.js +71 -23
  27. package/dist/src/plugin/shared/request-services.js.map +1 -1
  28. package/dist/src/setup.d.ts.map +1 -1
  29. package/dist/src/setup.js +38 -4
  30. package/dist/src/setup.js.map +1 -1
  31. package/dist/types/src/auth-method-labels.d.ts +1 -0
  32. package/dist/types/src/auth-method-labels.d.ts.map +1 -1
  33. package/dist/types/src/ga/server/auth.d.ts.map +1 -1
  34. package/dist/types/src/ga/server/pool-login.d.ts +4 -0
  35. package/dist/types/src/ga/server/pool-login.d.ts.map +1 -1
  36. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  37. package/dist/types/src/plugin/shared/request-services.d.ts +4 -0
  38. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  39. package/dist/types/src/setup.d.ts.map +1 -1
  40. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -27479,6 +27479,7 @@ import { join as join22, resolve as resolve20 } from "node:path";
27479
27479
  // src/auth-method-labels.ts
27480
27480
  var OPENCODE2_POOL_AUTH_LABEL = "Google (antigravity-auth pool, browser)";
27481
27481
  var OPENCODE2_VAULT_AUTH_LABEL = "Use approved Antigravity vault";
27482
+ var OPENCODE2_POOL_RECONNECT_LABEL = "Use existing local Antigravity pool";
27482
27483
 
27483
27484
  // src/common-auth-embedded/auth-menu/ansi.js
27484
27485
  var ANSI2 = {
@@ -30712,6 +30713,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30712
30713
  }
30713
30714
  };
30714
30715
  let openCodeLogin;
30716
+ let hasLocalPool = false;
30715
30717
  const manifest = JSON.parse(
30716
30718
  await readFile13(new URL("../package.json", import.meta.url), "utf8")
30717
30719
  );
@@ -30767,7 +30769,23 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30767
30769
  },
30768
30770
  signInLocal: async (host, context) => {
30769
30771
  await assertLocal(host, context);
30770
- if (host === "opencode" && context.opencodeGeneration === "2") return;
30772
+ if (host === "opencode" && context.opencodeGeneration === "2") {
30773
+ if (!forceLogin) {
30774
+ try {
30775
+ const source2 = await deps.accountStore.read(
30776
+ deps.accountStore.legacyPath()
30777
+ );
30778
+ const candidateAccounts = source2.kind === "store" ? source2.accounts : source2.kind === "legacy" ? (await deps.loadAccounts())?.accounts ?? [] : [];
30779
+ if (candidateAccounts.some(
30780
+ (account) => account.enabled !== false && account.accountIneligible !== true && account.verificationRequired !== true && typeof account.refreshToken === "string" && account.refreshToken.length > 0
30781
+ )) {
30782
+ hasLocalPool = true;
30783
+ }
30784
+ } catch {
30785
+ }
30786
+ }
30787
+ return;
30788
+ }
30771
30789
  const slot = (await nativeAuth(host, context))[provider(host)];
30772
30790
  const source = host === "opencode" ? await deps.accountStore.read(deps.accountStore.legacyPath()) : void 0;
30773
30791
  if (source?.kind === "unavailable") throw new Error(source.reason);
@@ -30779,6 +30797,11 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30779
30797
  `Using existing local Antigravity login for ${host}.
30780
30798
  `
30781
30799
  );
30800
+ if (host === "opencode" && accounts.some(
30801
+ (account) => account.enabled !== false && account.accountIneligible !== true && account.verificationRequired !== true && typeof account.refreshToken === "string" && account.refreshToken.length > 0
30802
+ )) {
30803
+ hasLocalPool = true;
30804
+ }
30782
30805
  if (host === "opencode" && claustrum.classifyHostSlot(slot, provider(host)) !== "login") {
30783
30806
  const account = accounts[0];
30784
30807
  await writeNativeSlot(
@@ -30809,7 +30832,10 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30809
30832
  host,
30810
30833
  context
30811
30834
  );
30812
- if (host === "opencode") openCodeLogin = result;
30835
+ if (host === "opencode") {
30836
+ openCodeLogin = result;
30837
+ hasLocalPool = true;
30838
+ }
30813
30839
  },
30814
30840
  beforeRegister: async (host, mode, context) => {
30815
30841
  const needsOpenCode2 = host === "opencode" && context.opencodeGeneration !== "1";
@@ -30833,7 +30859,10 @@ Setup has not completed the OpenCode 2 native Google connection.
30833
30859
  },
30834
30860
  context
30835
30861
  );
30836
- if (needsOpenCode2) nativeNextStep(OPENCODE2_POOL_AUTH_LABEL);
30862
+ if (needsOpenCode2)
30863
+ nativeNextStep(
30864
+ hasLocalPool ? OPENCODE2_POOL_RECONNECT_LABEL : OPENCODE2_POOL_AUTH_LABEL
30865
+ );
30837
30866
  return;
30838
30867
  }
30839
30868
  if (await authority(host) !== "vault")