@cortexkit/opencode-antigravity-auth 3.0.36 → 3.0.38

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 (83) hide show
  1. package/dist/cli.js +12 -2
  2. package/dist/cli.js.map +2 -2
  3. package/dist/cli.meta.json +17 -17
  4. package/dist/index.js +20 -9
  5. package/dist/index.js.map +2 -2
  6. package/dist/index.meta.json +36 -20
  7. package/dist/server.js +243 -104
  8. package/dist/server.js.map +4 -4
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/auth-method-labels.d.ts +2 -0
  11. package/dist/src/auth-method-labels.d.ts.map +1 -1
  12. package/dist/src/auth-method-labels.js +2 -0
  13. package/dist/src/auth-method-labels.js.map +1 -1
  14. package/dist/src/common-auth-embedded/claustrum/availability.d.ts +1 -0
  15. package/dist/src/common-auth-embedded/claustrum/availability.js +2 -0
  16. package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  17. package/dist/src/common-auth-embedded/claustrum/index.js +1 -1
  18. package/dist/src/common-auth-embedded/routing-accessor/cache-policy.d.ts +51 -0
  19. package/dist/src/common-auth-embedded/routing-accessor/cache-policy.js +186 -0
  20. package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +2 -1
  21. package/dist/src/common-auth-embedded/routing-accessor/index.js +1 -0
  22. package/dist/src/common-auth-embedded/source-output.json +41 -25
  23. package/dist/src/ga/server/auth.js +2 -2
  24. package/dist/src/ga/server/auth.js.map +1 -1
  25. package/dist/src/ga/server/index.js +1 -1
  26. package/dist/src/ga/server/index.js.map +1 -1
  27. package/dist/src/ga/server/pool-login.d.ts +9 -0
  28. package/dist/src/ga/server/pool-login.d.ts.map +1 -1
  29. package/dist/src/ga/server/pool-login.js +155 -73
  30. package/dist/src/ga/server/pool-login.js.map +1 -1
  31. package/dist/src/ga/tui/host-ga.d.ts +7 -0
  32. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  33. package/dist/src/ga/tui/host-ga.js +70 -1
  34. package/dist/src/ga/tui/host-ga.js.map +1 -1
  35. package/dist/src/logging/provider-key-policy.d.ts +2 -0
  36. package/dist/src/logging/provider-key-policy.d.ts.map +1 -1
  37. package/dist/src/logging/provider-key-policy.js +5 -1
  38. package/dist/src/logging/provider-key-policy.js.map +1 -1
  39. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  40. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  41. package/dist/src/plugin/ga-location-services.js +77 -12
  42. package/dist/src/plugin/ga-location-services.js.map +1 -1
  43. package/dist/src/plugin/logger.d.ts.map +1 -1
  44. package/dist/src/plugin/logger.js +2 -1
  45. package/dist/src/plugin/logger.js.map +1 -1
  46. package/dist/src/plugin/vault-custody.js +6 -6
  47. package/dist/src/plugin/vault-custody.js.map +1 -1
  48. package/dist/src/setup.js +1 -1
  49. package/dist/src/setup.js.map +1 -1
  50. package/dist/src/tui/file-logger.d.ts.map +1 -1
  51. package/dist/src/tui/file-logger.js +2 -1
  52. package/dist/src/tui/file-logger.js.map +1 -1
  53. package/dist/tui-build-map.json +9 -9
  54. package/dist/tui-ga-build-map.json +5 -5
  55. package/dist/types/src/auth-method-labels.d.ts +2 -0
  56. package/dist/types/src/auth-method-labels.d.ts.map +1 -1
  57. package/dist/types/src/common-auth-embedded/claustrum/availability.d.ts +1 -0
  58. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  59. package/dist/types/src/common-auth-embedded/routing-accessor/cache-policy.d.ts +51 -0
  60. package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +2 -1
  61. package/dist/types/src/ga/server/pool-login.d.ts +9 -0
  62. package/dist/types/src/ga/server/pool-login.d.ts.map +1 -1
  63. package/dist/types/src/logging/provider-key-policy.d.ts +2 -0
  64. package/dist/types/src/logging/provider-key-policy.d.ts.map +1 -1
  65. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  66. package/dist/types/src/plugin/logger.d.ts.map +1 -1
  67. package/package.json +4 -4
  68. package/src/common-auth-embedded/claustrum/availability.d.ts +1 -0
  69. package/src/common-auth-embedded/claustrum/availability.js +2 -0
  70. package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  71. package/src/common-auth-embedded/claustrum/index.js +1 -1
  72. package/src/common-auth-embedded/routing-accessor/cache-policy.d.ts +51 -0
  73. package/src/common-auth-embedded/routing-accessor/cache-policy.js +186 -0
  74. package/src/common-auth-embedded/routing-accessor/index.d.ts +2 -1
  75. package/src/common-auth-embedded/routing-accessor/index.js +1 -0
  76. package/src/common-auth-embedded/source-output.json +41 -25
  77. package/src/tui/file-logger.ts +5 -1
  78. package/src/tui-compiled/logging/provider-key-policy.js +4 -1
  79. package/src/tui-compiled/tui/file-logger.js +5 -1
  80. package/src/tui-ga-compiled/host-ga.js +66 -1
  81. package/src/tui-ga-raw/host-ga.tsx +79 -1
  82. package/src/tui-raw/logging/provider-key-policy.js +4 -1
  83. package/src/tui-raw/tui/file-logger.js +5 -1
package/dist/server.js CHANGED
@@ -12137,7 +12137,8 @@ function accountsSection(options, ids, now) {
12137
12137
  {
12138
12138
  id: "add",
12139
12139
  label: options.login.label ?? "Add account",
12140
- run: ({ invocation }) => options.login ? options.login.run(invocation) : Promise.resolve(failure("Login is unavailable.", "refused"))
12140
+ ...options.login.knobs ? { knobs: options.login.knobs } : {},
12141
+ run: ({ invocation, values }) => options.login ? options.login.run(invocation, values) : Promise.resolve(failure("Login is unavailable.", "refused"))
12141
12142
  }
12142
12143
  ] : [];
12143
12144
  if (read.status !== "ready")
@@ -19494,6 +19495,8 @@ var init_availability = __esm({
19494
19495
  unavailable: "unreachable",
19495
19496
  timeout: "unreachable",
19496
19497
  route_closed: "unreachable",
19498
+ // The daemon refused before forwarding, so the vault never saw the request.
19499
+ route_busy: "unreachable",
19497
19500
  daemon_draining: "unreachable",
19498
19501
  connection_closed: "unreachable",
19499
19502
  connection_dropped: "unreachable",
@@ -25659,6 +25662,7 @@ __export(claustrum_exports, {
25659
25662
  enrollmentAuthority: () => enrollmentAuthority,
25660
25663
  enrollmentName: () => enrollmentName,
25661
25664
  getClaustrumEnrollmentPaths: () => getClaustrumEnrollmentPaths,
25665
+ hasVaultHost: () => hasVaultHost,
25662
25666
  hostEnrollmentPaths: () => hostEnrollmentPaths,
25663
25667
  isCustodyPlaceholder: () => isCustodyPlaceholder,
25664
25668
  isCustodyPlaceholderValue: () => isCustodyPlaceholderValue,
@@ -30226,13 +30230,17 @@ var init_logger3 = __esm({
30226
30230
 
30227
30231
  // src/logging/provider-key-policy.ts
30228
30232
  function isProviderSecretKey(normalizedKey2) {
30229
- return /token|refresh|access|project|fingerprint|deviceid|sessionid|sessiontoken|secret|password|apikey|clientsecret/.test(
30233
+ return /token|refresh|access|project|fingerprint|deviceid|sessionid|sessiontoken|secret|password|apikey|clientsecret|callback|redirecturl|authorizationcode/.test(
30230
30234
  normalizedKey2
30231
30235
  );
30232
30236
  }
30237
+ var OAUTH_REDIRECT_VALUE_PATTERNS;
30233
30238
  var init_provider_key_policy = __esm({
30234
30239
  "src/logging/provider-key-policy.ts"() {
30235
30240
  "use strict";
30241
+ OAUTH_REDIRECT_VALUE_PATTERNS = [
30242
+ /https?:\/\/[^\s<>"']*[?&](?:code|state)=[^\s<>"']*/gi
30243
+ ];
30236
30244
  }
30237
30245
  });
30238
30246
 
@@ -30873,7 +30881,7 @@ function createOpenCodeVaultCustody(options) {
30873
30881
  const readEnrollment = async () => {
30874
30882
  if (layoutRefusal !== void 0) return unsettled;
30875
30883
  const claustrum = await loadClaustrum();
30876
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
30884
+ if (claustrum.hasVaultHost())
30877
30885
  return {
30878
30886
  state: "unavailable",
30879
30887
  code: "host",
@@ -30901,7 +30909,7 @@ function createOpenCodeVaultCustody(options) {
30901
30909
  const readEnrollmentSnapshot = async () => {
30902
30910
  if (layoutRefusal !== void 0)
30903
30911
  return { authority: "unreadable", status: unsettled };
30904
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
30912
+ if ((await loadClaustrum()).hasVaultHost())
30905
30913
  return { authority: "host", status: await readEnrollment() };
30906
30914
  const enrollment = await enrollmentPaths();
30907
30915
  const identity3 = await enrollmentFilesIdentity(enrollment);
@@ -31148,7 +31156,7 @@ function createOpenCodeVaultCustody(options) {
31148
31156
  },
31149
31157
  async requestAccess() {
31150
31158
  const claustrum = await loadClaustrum();
31151
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
31159
+ if (claustrum.hasVaultHost())
31152
31160
  throw new OpenCodeVaultCustodyError(
31153
31161
  claustrum.VAULT_HOST_CONNECT_REFUSAL
31154
31162
  );
@@ -31156,7 +31164,7 @@ function createOpenCodeVaultCustody(options) {
31156
31164
  },
31157
31165
  async useVault() {
31158
31166
  refuseUnsettled();
31159
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus") return;
31167
+ if ((await loadClaustrum()).hasVaultHost()) return;
31160
31168
  const enrollment = await readEnrollment();
31161
31169
  if (enrollment.state !== "approved")
31162
31170
  throw new OpenCodeVaultCustodyError(
@@ -31168,7 +31176,7 @@ function createOpenCodeVaultCustody(options) {
31168
31176
  async useLocal() {
31169
31177
  refuseUnsettled();
31170
31178
  const claustrum = await loadClaustrum();
31171
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
31179
+ if (claustrum.hasVaultHost())
31172
31180
  throw new OpenCodeVaultCustodyError(
31173
31181
  claustrum.VAULT_HOST_CONNECT_REFUSAL
31174
31182
  );
@@ -31203,7 +31211,7 @@ function createOpenCodeVaultCustody(options) {
31203
31211
  if (layoutRefusal !== void 0)
31204
31212
  return { lines: [`Vault: ${layoutRefusal}`], actions: [] };
31205
31213
  const claustrum = await loadClaustrum();
31206
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
31214
+ if (claustrum.hasVaultHost())
31207
31215
  return { lines: [claustrum.VAULT_HOST_STATUS], actions: [] };
31208
31216
  const status = await custody.status();
31209
31217
  const lines = statusLines(status);
@@ -34470,6 +34478,7 @@ function createLocationLogger(options) {
34470
34478
  const engine = createLoggerInstance2({
34471
34479
  level: () => configuredLevel,
34472
34480
  extraSecretKeys: isProviderSecretKey,
34481
+ extraValuePatterns: OAUTH_REDIRECT_VALUE_PATTERNS,
34473
34482
  captureSink: ({ channel: channel3, level, message, data }) => {
34474
34483
  const extra = data !== null && typeof data === "object" && !Array.isArray(data) ? Object.fromEntries(Object.entries(data)) : void 0;
34475
34484
  emit({
@@ -34775,14 +34784,16 @@ async function registerOpenCode2AuthMethods(ctx, options) {
34775
34784
  init_dist();
34776
34785
  import { randomBytes as randomBytes5 } from "node:crypto";
34777
34786
 
34778
- // src/ga/server/pool-login.ts
34779
- init_dist();
34780
-
34781
34787
  // src/auth-method-labels.ts
34782
34788
  var OPENCODE2_POOL_AUTH_LABEL = "Google (antigravity-auth pool, browser)";
34789
+ var OPENCODE2_POOL_PASTE_AUTH_LABEL = "Google (antigravity-auth pool, paste redirect URL)";
34790
+ var GA_POOL_PASTE_PROMPT = "Paste the redirect URL from your browser's address bar";
34783
34791
  var OPENCODE2_VAULT_AUTH_LABEL = "Use approved Antigravity vault";
34784
34792
  var OPENCODE2_POOL_RECONNECT_LABEL = "Use existing local Antigravity pool";
34785
34793
 
34794
+ // src/ga/server/pool-login.ts
34795
+ init_dist();
34796
+
34786
34797
  // src/plugin/server.ts
34787
34798
  import { existsSync as existsSync2, readFileSync } from "node:fs";
34788
34799
  import { createServer } from "node:http";
@@ -35072,6 +35083,7 @@ async function startOAuthListener({
35072
35083
 
35073
35084
  // src/ga/server/pool-login.ts
35074
35085
  var GA_POOL_METHOD_ID = "antigravity-auth-pool-browser";
35086
+ var GA_POOL_PASTE_METHOD_ID = "antigravity-auth-pool-paste";
35075
35087
  var GA_POOL_RECONNECT_METHOD_ID = "antigravity-auth-pool-reconnect";
35076
35088
  var LOGIN_FAILED = "The Antigravity pool login could not be completed.";
35077
35089
  function abortable(pending, signal) {
@@ -35113,89 +35125,154 @@ function createGaPoolLogin(input2) {
35113
35125
  listeners.delete(listener);
35114
35126
  }
35115
35127
  };
35116
- const method = {
35117
- method: {
35118
- id: GA_POOL_METHOD_ID,
35119
- type: "oauth",
35120
- label: OPENCODE2_POOL_AUTH_LABEL
35121
- },
35122
- authorize: () => track(
35123
- (async () => {
35128
+ const start = (listen = true) => track(
35129
+ (async () => {
35130
+ await admit2();
35131
+ const authorization = await (async () => {
35132
+ try {
35133
+ return await abortable(
35134
+ (input2.oauth?.authorize ?? authorizeAntigravity)(),
35135
+ shutdown.signal
35136
+ );
35137
+ } catch {
35138
+ throw new Error(LOGIN_FAILED);
35139
+ }
35140
+ })();
35141
+ await admit2();
35142
+ const state = new URL(authorization.url).searchParams.get("state");
35143
+ if (!state) throw new Error(LOGIN_FAILED);
35144
+ const redirect = new URL(ANTIGRAVITY_REDIRECT_URI);
35145
+ const parse3 = (value) => {
35146
+ try {
35147
+ const url = new URL(value);
35148
+ const code3 = url.searchParams.get("code");
35149
+ if (url.origin !== redirect.origin || url.pathname !== redirect.pathname || url.username || url.password || url.hash || url.searchParams.has("error") || url.searchParams.getAll("state").length !== 1 || url.searchParams.get("state") !== state || url.searchParams.getAll("code").length !== 1 || !code3)
35150
+ throw new Error(LOGIN_FAILED);
35151
+ return code3;
35152
+ } catch {
35153
+ throw new Error(LOGIN_FAILED);
35154
+ }
35155
+ };
35156
+ let listener;
35157
+ const code2 = Promise.withResolvers();
35158
+ let claimed = false;
35159
+ const claim = (value) => {
35160
+ if (claimed) throw new Error(LOGIN_FAILED);
35161
+ claimed = true;
35162
+ code2.resolve(value);
35163
+ };
35164
+ const waitForCode = input2.oauth?.waitForCode;
35165
+ if (listen && waitForCode) {
35166
+ void Promise.resolve().then(() => waitForCode(state)).then(claim, code2.reject).catch(() => {
35167
+ });
35168
+ } else if (listen) {
35169
+ listener = await startOAuthListener();
35170
+ listeners.add(listener);
35171
+ void listener.waitForCallback().then((url) => claim(parse3(url.href)), code2.reject).catch(code2.reject);
35172
+ }
35173
+ void code2.promise.catch(() => {
35174
+ });
35175
+ try {
35176
+ await admit2();
35177
+ } catch (error) {
35178
+ if (listener) await close(listener);
35179
+ throw error;
35180
+ }
35181
+ const ownedListener = listener;
35182
+ const cancellation = new AbortController();
35183
+ const signal = AbortSignal.any([shutdown.signal, cancellation.signal]);
35184
+ const admitAttempt = async () => {
35185
+ signal.throwIfAborted();
35124
35186
  await admit2();
35125
- const authorization = await (async () => {
35187
+ signal.throwIfAborted();
35188
+ };
35189
+ const timeout = setTimeout(
35190
+ () => code2.reject(new Error(LOGIN_FAILED)),
35191
+ 5 * 60 * 1e3
35192
+ );
35193
+ timeout.unref?.();
35194
+ const callback = track(
35195
+ (async () => {
35126
35196
  try {
35127
- return await abortable(
35128
- (input2.oauth?.authorize ?? authorizeAntigravity)(),
35129
- shutdown.signal
35197
+ await admitAttempt();
35198
+ const value = await abortable(code2.promise, signal);
35199
+ if (ownedListener) await close(ownedListener);
35200
+ await admitAttempt();
35201
+ const result = await abortable(
35202
+ (input2.oauth?.exchange ?? exchangeAntigravity)(value, state, {
35203
+ signal,
35204
+ admit: admitAttempt
35205
+ }),
35206
+ signal
35130
35207
  );
35208
+ await admitAttempt();
35209
+ if (result.type !== "success") throw new Error(LOGIN_FAILED);
35210
+ return result;
35131
35211
  } catch {
35132
35212
  throw new Error(LOGIN_FAILED);
35213
+ } finally {
35214
+ claimed = true;
35215
+ clearTimeout(timeout);
35216
+ if (ownedListener) await close(ownedListener);
35133
35217
  }
35134
- })();
35135
- await admit2();
35136
- const state = new URL(authorization.url).searchParams.get("state");
35137
- if (!state) throw new Error(LOGIN_FAILED);
35138
- let listener;
35139
- let code2;
35140
- const waitForCode = input2.oauth?.waitForCode;
35141
- if (waitForCode) {
35142
- code2 = Promise.resolve().then(() => waitForCode(state));
35143
- } else {
35144
- listener = await startOAuthListener();
35145
- listeners.add(listener);
35146
- code2 = listener.waitForCallback().then((url) => {
35147
- if (url.searchParams.get("state") !== state)
35148
- throw new Error(LOGIN_FAILED);
35149
- const value = url.searchParams.get("code");
35150
- if (!value) throw new Error(LOGIN_FAILED);
35151
- return value;
35152
- });
35153
- }
35154
- void code2.catch(() => {
35155
- });
35156
- try {
35157
- await admit2();
35158
- } catch (error) {
35159
- if (listener) await close(listener);
35160
- throw error;
35218
+ })()
35219
+ );
35220
+ void callback.catch(() => {
35221
+ });
35222
+ return {
35223
+ url: authorization.url,
35224
+ completion: callback,
35225
+ async paste(value) {
35226
+ await admitAttempt();
35227
+ if (!value.trim()) return callback;
35228
+ claim(parse3(value));
35229
+ return callback;
35230
+ },
35231
+ async cancel() {
35232
+ claimed = true;
35233
+ cancellation.abort(new Error(LOGIN_FAILED));
35234
+ code2.reject(new Error(LOGIN_FAILED));
35235
+ if (ownedListener) await close(ownedListener);
35161
35236
  }
35162
- const ownedListener = listener;
35163
- const callback = track(
35164
- (async () => {
35165
- try {
35166
- await admit2();
35167
- const value = await abortable(code2, shutdown.signal);
35168
- await admit2();
35169
- const result = await abortable(
35170
- (input2.oauth?.exchange ?? exchangeAntigravity)(value, state, {
35171
- signal: shutdown.signal,
35172
- admit: admit2
35173
- }),
35174
- shutdown.signal
35175
- );
35176
- await admit2();
35177
- if (result.type !== "success") throw new Error(LOGIN_FAILED);
35178
- return result;
35179
- } catch {
35180
- throw new Error(LOGIN_FAILED);
35181
- } finally {
35182
- if (ownedListener) await close(ownedListener);
35183
- }
35184
- })()
35185
- );
35186
- void callback.catch(() => {
35187
- });
35188
- return {
35189
- mode: "auto",
35190
- url: authorization.url,
35191
- instructions: "Complete Google sign-in in your browser.",
35192
- callback
35193
- };
35194
- })()
35195
- )
35237
+ };
35238
+ })()
35239
+ );
35240
+ const method = {
35241
+ method: {
35242
+ id: GA_POOL_METHOD_ID,
35243
+ type: "oauth",
35244
+ label: OPENCODE2_POOL_AUTH_LABEL
35245
+ },
35246
+ async authorize() {
35247
+ const attempt = await start();
35248
+ return {
35249
+ mode: "auto",
35250
+ url: attempt.url,
35251
+ instructions: "Complete Google sign-in in your browser.",
35252
+ callback: attempt.completion
35253
+ };
35254
+ }
35255
+ };
35256
+ const pasteMethod = {
35257
+ method: {
35258
+ id: GA_POOL_PASTE_METHOD_ID,
35259
+ type: "oauth",
35260
+ label: OPENCODE2_POOL_PASTE_AUTH_LABEL
35261
+ },
35262
+ async authorize() {
35263
+ const attempt = await start(false);
35264
+ return {
35265
+ mode: "code",
35266
+ url: attempt.url,
35267
+ instructions: GA_POOL_PASTE_PROMPT,
35268
+ callback: (value) => attempt.paste(value)
35269
+ };
35270
+ }
35196
35271
  };
35197
35272
  return {
35198
35273
  method,
35274
+ pasteMethod,
35275
+ start,
35199
35276
  connectExisting: () => track(
35200
35277
  (async () => {
35201
35278
  let stage = "initial-admission";
@@ -50603,7 +50680,7 @@ function createGaLocationServicesFactory(bindings) {
50603
50680
  local: {
50604
50681
  ...localLogin,
50605
50682
  async assertAdmission() {
50606
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
50683
+ if ((await loadCommonAuthClaustrum()).hasVaultHost())
50607
50684
  throw new Error("Vault authority excludes local sign-in.");
50608
50685
  await localLogin.assertAdmission();
50609
50686
  }
@@ -50611,6 +50688,7 @@ function createGaLocationServicesFactory(bindings) {
50611
50688
  oauth: overrides.oauth
50612
50689
  });
50613
50690
  const loginCompletions = /* @__PURE__ */ new Set();
50691
+ const drawerLogins = /* @__PURE__ */ new Map();
50614
50692
  return {
50615
50693
  runtime,
50616
50694
  localLogin,
@@ -50731,30 +50809,89 @@ function createGaLocationServicesFactory(bindings) {
50731
50809
  runtime: location,
50732
50810
  reauthorize: pendingReauthorization,
50733
50811
  login: {
50734
- async run(invocation) {
50735
- const authorization = await menuLogin.method.authorize({});
50736
- if (authorization.mode !== "auto")
50737
- throw new Error(
50738
- "Antigravity sign-in needs a local browser callback."
50739
- );
50740
- const completion = authorization.callback.then((result) => menuLogin.onLogin(result)).then(
50812
+ knobs: [
50813
+ {
50814
+ kind: "text",
50815
+ id: "callback",
50816
+ label: GA_POOL_PASTE_PROMPT,
50817
+ masked: true
50818
+ },
50819
+ {
50820
+ kind: "toggle",
50821
+ id: "cancel",
50822
+ label: "Cancel sign-in",
50823
+ value: false
50824
+ }
50825
+ ],
50826
+ async run(invocation, values) {
50827
+ await assertLocal();
50828
+ const key = invocation.sessionId ?? "";
50829
+ const previous = drawerLogins.get(key);
50830
+ const failure2 = () => ({
50831
+ ok: false,
50832
+ text: "The Antigravity pool login could not be completed.",
50833
+ code: "refused"
50834
+ });
50835
+ if (values.cancel === true) {
50836
+ if (previous) {
50837
+ previous.cancelled = true;
50838
+ await previous.attempt.cancel();
50839
+ drawerLogins.delete(key);
50840
+ }
50841
+ return "Sign-in cancelled.";
50842
+ }
50843
+ if (typeof values.callback === "string") {
50844
+ if (!previous) return failure2();
50845
+ try {
50846
+ await previous.attempt.paste(values.callback);
50847
+ return await previous.completion ? "Account added." : failure2();
50848
+ } catch {
50849
+ return failure2();
50850
+ }
50851
+ }
50852
+ if (previous) {
50853
+ previous.cancelled = true;
50854
+ await previous.attempt.cancel();
50855
+ }
50856
+ const attempt = await menuLogin.start();
50857
+ const entry = {
50858
+ attempt,
50859
+ cancelled: false,
50860
+ completion: Promise.resolve(false)
50861
+ };
50862
+ entry.completion = attempt.completion.then((result) => {
50863
+ if (entry.cancelled)
50864
+ throw new Error(
50865
+ "The Antigravity pool login could not be completed."
50866
+ );
50867
+ return menuLogin.onLogin(result);
50868
+ }).then(
50741
50869
  () => {
50742
- invocation.notify("Account added.", "info");
50870
+ if (!entry.cancelled)
50871
+ invocation.notify("Account added.", "info");
50872
+ return true;
50743
50873
  },
50744
50874
  () => {
50745
- invocation.notify(
50746
- "Antigravity sign-in did not complete.",
50747
- "error"
50748
- );
50875
+ if (!entry.cancelled)
50876
+ invocation.notify(
50877
+ "The Antigravity pool login could not be completed.",
50878
+ "error"
50879
+ );
50880
+ return false;
50749
50881
  }
50750
- ).catch(() => {
50882
+ ).finally(() => {
50883
+ if (drawerLogins.get(key) === entry)
50884
+ drawerLogins.delete(key);
50885
+ });
50886
+ drawerLogins.set(key, entry);
50887
+ const completion = entry.completion.then(() => {
50751
50888
  });
50752
50889
  loginCompletions.add(completion);
50753
50890
  void completion.finally(
50754
50891
  () => loginCompletions.delete(completion)
50755
50892
  );
50756
- return `Open ${authorization.url} in your browser and sign in.
50757
- The account is added when the browser returns here; there is nothing to paste.`;
50893
+ return `Open ${attempt.url} in your browser and sign in.
50894
+ ${GA_POOL_PASTE_PROMPT}, or wait for the browser to finish.`;
50758
50895
  }
50759
50896
  },
50760
50897
  ...custody ? { vault: custody.menuSection() } : {},
@@ -52422,7 +52559,7 @@ async function registerGaAuthMethods(context, authority = readAuthority, input2
52422
52559
  local: {
52423
52560
  ...local,
52424
52561
  assertAdmission: async () => {
52425
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
52562
+ if ((await loadCommonAuthClaustrum()).hasVaultHost())
52426
52563
  throw new Error("Vault authority excludes local sign-in.");
52427
52564
  await local.assertAdmission();
52428
52565
  }
@@ -52434,7 +52571,7 @@ async function registerGaAuthMethods(context, authority = readAuthority, input2
52434
52571
  registrations.push(
52435
52572
  await registerOpenCode2AuthMethods(context, {
52436
52573
  integrationID: ANTIGRAVITY_PROVIDER_ID,
52437
- methods: [pool.method],
52574
+ methods: [pool.method, pool.pasteMethod],
52438
52575
  onLogin: pool.onLogin,
52439
52576
  vault: {
52440
52577
  method: {
@@ -53195,7 +53332,7 @@ function createGaRpcActivation(options) {
53195
53332
  const cursor = last ? last.cursor : Math.max(acknowledged, queue2.evictedThrough);
53196
53333
  const claustrum = await loadCommonAuthClaustrum();
53197
53334
  const output2 = {
53198
- ...process.env.CORTEXKIT_VAULT_HOST === "thalamus" ? { vaultHostStatus: claustrum.VAULT_HOST_STATUS } : {},
53335
+ ...claustrum.hasVaultHost() ? { vaultHostStatus: claustrum.VAULT_HOST_STATUS } : {},
53199
53336
  version: ANTIGRAVITY_RPC_VERSION,
53200
53337
  kind: "snapshot",
53201
53338
  generation,
@@ -54881,6 +55018,8 @@ var VAULT_FAILURE_CLASSES2 = Object.freeze({
54881
55018
  unavailable: "unreachable",
54882
55019
  timeout: "unreachable",
54883
55020
  route_closed: "unreachable",
55021
+ // The daemon refused before forwarding, so the vault never saw the request.
55022
+ route_busy: "unreachable",
54884
55023
  daemon_draining: "unreachable",
54885
55024
  connection_closed: "unreachable",
54886
55025
  connection_dropped: "unreachable",
@@ -57417,7 +57556,7 @@ Setup has not completed the OpenCode 2 native Google connection.
57417
57556
  }
57418
57557
  async function runPluginSetup(argv, deps, migrateOpenCode, io = {}) {
57419
57558
  const claustrum = await loadCommonAuthClaustrum();
57420
- if (process.env.CORTEXKIT_VAULT_HOST === "thalamus")
57559
+ if (claustrum.hasVaultHost())
57421
57560
  throw new Error(claustrum.VAULT_HOST_CONNECT_REFUSAL);
57422
57561
  const plugin2 = await createSetupPlugin(
57423
57562
  deps,