@cortexkit/pi-antigravity-auth 3.0.5 → 3.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAG9B,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,uDAAuD,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAEnE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAIlB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,uBAAuB,CAAA;IACjC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACrC,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACvD;AAED,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC,EACzC,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAkBN;AAMD;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,CAAA;AAElE,MAAM,WAAW,mCAAmC;IAClD,KAAK,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAA;IAClC,QAAQ,EAAE,MAAM,mBAAmB,CAAA;CACpC;AA4CD,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,mCAAmC,GAC3C,4BAA4B,CA0G9B"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAG9B,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,uDAAuD,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAEnE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAOlB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,uBAAuB,CAAA;IACjC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACrC,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACvD;AAED,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC,EACzC,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAkBN;AAMD;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,CAAA;AAElE,MAAM,WAAW,mCAAmC;IAClD,KAAK,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAA;IAClC,QAAQ,EAAE,MAAM,mBAAmB,CAAA;CACpC;AA4CD,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,mCAAmC,GAC3C,4BAA4B,CA4G9B"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { join as join2 } from "node:path";
2
+ import { join } from "node:path";
3
3
  import {
4
4
  ANTIGRAVITY_PROVIDER_ID as ANTIGRAVITY_PROVIDER_ID2,
5
5
  authorizeAntigravity,
@@ -26,7 +26,10 @@ import { createHash, randomBytes } from "node:crypto";
26
26
  import { readFileSync } from "node:fs";
27
27
  import {
28
28
  ANTIGRAVITY_PROVIDER_ID,
29
- enrollmentAuthority
29
+ enrollmentAuthority,
30
+ sharedVaultTokenFolder,
31
+ sharedVaultTokenFolderOutcome,
32
+ sharedVaultTokenFolderText
30
33
  } from "@cortexkit/antigravity-auth-core";
31
34
  import { writeJsonAtomic } from "@cortexkit/antigravity-auth-core/atomic-write";
32
35
  var PI_ANTIGRAVITY_PROVIDER_ID = ANTIGRAVITY_PROVIDER_ID;
@@ -62,16 +65,19 @@ function readPiVaultMode(path) {
62
65
  } catch (error) {
63
66
  if (error?.code === "ENOENT")
64
67
  return { ok: true, record: LOCAL_MODE };
65
- return { ok: false, reason: "the vault mode file could not be read" };
68
+ return { ok: false, reason: "its vault settings file could not be read" };
66
69
  }
67
70
  let raw;
68
71
  try {
69
72
  raw = JSON.parse(text);
70
73
  } catch {
71
- return { ok: false, reason: "the vault mode file is not valid JSON" };
74
+ return { ok: false, reason: "its vault settings file is damaged" };
72
75
  }
73
76
  const record = parseModeRecord(raw);
74
- return record ? { ok: true, record } : { ok: false, reason: "the vault mode file has an unknown shape" };
77
+ return record ? { ok: true, record } : {
78
+ ok: false,
79
+ reason: "its vault settings file holds settings it does not understand"
80
+ };
75
81
  }
76
82
  async function writePiVaultMode(path, record) {
77
83
  const value = record.routeId === void 0 ? { version: 1, mode: record.mode } : { version: 1, mode: record.mode, routeId: record.routeId };
@@ -177,7 +183,7 @@ var PiVaultSetup = class {
177
183
  );
178
184
  if (enrollment.state !== "approved")
179
185
  throw new PiVaultSetupError(
180
- "Pi is not enrolled with the vault yet. Request access and wait for the operator to approve it first."
186
+ "Pi doesn't have vault access yet. Choose Request vault access and wait for the vault operator to approve it."
181
187
  );
182
188
  if (routeId !== void 0 && routeId.trim() === "")
183
189
  throw new PiVaultSetupError("Choose a vault account to use.");
@@ -194,7 +200,7 @@ var PiVaultSetup = class {
194
200
  this.#options.claustrum
195
201
  ) !== "local") {
196
202
  throw new PiVaultSetupError(
197
- "Disconnect vault enrollment before using local accounts."
203
+ "Disconnect from the vault before switching to Pi's own login."
198
204
  );
199
205
  }
200
206
  await writePiVaultMode(this.#options.modeFile, LOCAL_MODE);
@@ -213,7 +219,7 @@ var PiVaultSetup = class {
213
219
  );
214
220
  if (result === "busy")
215
221
  throw new PiVaultSetupError(
216
- "Vault enrollment is busy; disconnect did not change it."
222
+ "Another vault setup step is running, so Pi is still connected to the vault. Try again in a moment."
217
223
  );
218
224
  await writePiVaultMode(this.#options.modeFile, LOCAL_MODE);
219
225
  await this.#options.onModeChanged?.(LOCAL_MODE);
@@ -222,42 +228,48 @@ var PiVaultSetup = class {
222
228
  function describeEnrollment(status) {
223
229
  switch (status.state) {
224
230
  case "idle":
225
- return "not requested";
231
+ return "Vault access: not requested yet.";
226
232
  case "pending":
227
- return status.retryCode ? `waiting for operator approval (retrying: ${status.retryCode})` : "waiting for operator approval";
233
+ return status.retryCode ? `Vault access: the vault can't take Pi's request right now; Pi asks again the next time it checks (reference: ${status.retryCode}).` : "Vault access: waiting for the vault operator to approve this request.";
228
234
  case "approved":
229
- return `approved as ${status.approvedName ?? status.proposedName}`;
235
+ return "Vault access: approved by the vault operator.";
230
236
  case "denied":
231
- return "denied by the operator";
237
+ return "Vault access: the vault operator denied the request. Choose Request vault access to ask again.";
232
238
  case "blocked":
233
- return `blocked (${status.code})`;
239
+ if (status.code === "pending_exists")
240
+ return "Vault access: the vault turned down a new request because an earlier request from Pi is still waiting.";
241
+ if (status.code === "missing_token")
242
+ return "Vault access: approved, but Pi's vault key is missing from this computer. Disconnect from the vault, then request vault access again.";
243
+ if (status.code === "unreadable-state")
244
+ return "Vault access: Pi can't read its record of the vault request. Disconnect from the vault, then request vault access again.";
245
+ return `Vault access: the vault ended this request (reference: ${status.code}). Choose Request vault access to start a new one.`;
234
246
  case "unavailable":
235
- return `vault unavailable (${status.code})`;
247
+ return `Vault access: Pi can't reach the vault right now. Try again later (reference: ${status.code}).`;
236
248
  case "busy":
237
- return "another setup step is running";
249
+ return "Vault access: another vault setup step is running. Try again in a moment.";
238
250
  }
239
251
  }
240
252
  var PI_VAULT_GRANT_COMMAND = `ck auth grant --principal enrolled:${PI_ANTIGRAVITY_ENROLLMENT_NAME} --selector-kind category --selector antigravity-native --operation read`;
241
253
  function piPendingEnrollmentGuidance(requestId) {
242
254
  return [
243
255
  "Next, the vault operator runs these outside Pi:",
244
- requestId === void 0 ? "1. Find the request ID with ck auth enroll list, then approve it: ck auth enroll approve --request-id <id>" : `1. Approve the request: ck auth enroll approve --request-id ${requestId}`,
256
+ requestId === void 0 ? `1. Find the request from ${PI_ANTIGRAVITY_ENROLLMENT_NAME} with ck auth enroll list, then approve it: ck auth enroll approve --request-id <id>` : `1. Approve the request: ck auth enroll approve --request-id ${requestId}`,
245
257
  `2. Grant read access: ${PI_VAULT_GRANT_COMMAND}`,
246
- "Both are needed: an approval without the grant serves Pi no accounts.",
247
- "3. Pi switches to the vault once it sees the approval; Request vault access checks again."
258
+ "Both are needed: without the grant, Pi can see no accounts in the vault.",
259
+ "3. Pi switches to the vault once it sees the approval. Choose Request vault access to check again."
248
260
  ];
249
261
  }
250
262
  function piPendingExistsGuidance() {
251
263
  return [
252
- `An earlier request for ${PI_ANTIGRAVITY_ENROLLMENT_NAME} is still pending in the vault, possibly from an enrollment forgotten here.`,
264
+ "The earlier request may come from a vault setup that was disconnected here before the operator answered it.",
253
265
  "It expires 15 minutes after it was made; request vault access again after that.",
254
- "Or the vault operator clears it now: find its ID with ck auth enroll list, run ck auth enroll deny --request-id <id>, then request vault access again here."
266
+ `Or the vault operator clears it now: find the request from ${PI_ANTIGRAVITY_ENROLLMENT_NAME} with ck auth enroll list, run ck auth enroll deny --request-id <id>, then request vault access again here.`
255
267
  ];
256
268
  }
257
269
  function piNoVaultAccountsGuidance() {
258
270
  return [
259
- `Enrollment is approved, but the vault serves ${PI_ANTIGRAVITY_ENROLLMENT_NAME} no Antigravity accounts.`,
260
- `The vault operator grants read access with: ${PI_VAULT_GRANT_COMMAND}`
271
+ "The vault operator approved Pi, but Pi can't see any Antigravity accounts in the vault yet.",
272
+ `If the operator has not granted Pi read access yet, they run: ${PI_VAULT_GRANT_COMMAND}`
261
273
  ];
262
274
  }
263
275
  function enrollmentGuidance(status) {
@@ -267,28 +279,20 @@ function enrollmentGuidance(status) {
267
279
  return piPendingExistsGuidance();
268
280
  return [];
269
281
  }
270
- function describeHostSlot(slot) {
271
- switch (slot) {
272
- case "login":
273
- return "signed in with a Pi login";
274
- case "placeholder":
275
- return "holds the vault placeholder";
276
- case "empty":
277
- return "empty";
282
+ function describeSource(status) {
283
+ switch (status.mode) {
284
+ case "custody":
285
+ return "Using the vault for Antigravity accounts; Pi's own login is set aside.";
286
+ case "local":
287
+ return status.hostSlot === "login" ? "Using Pi's own login (the account you signed in with /login), not the vault." : status.hostSlot === "dormant" ? "Using Pi's own login, not the vault." : "Using Pi's own login, not the vault, but you are not signed in. Run /login to sign in.";
288
+ case "unreadable":
289
+ return status.modeProblem === void 0 ? "Pi can't tell whether to use the vault or its own login, so it sends no Antigravity requests." : `Pi can't tell whether to use the vault or its own login (${status.modeProblem}), so it sends no Antigravity requests.`;
278
290
  }
279
291
  }
280
292
  function formatPiVaultSetupStatus(status) {
281
- const lines = [
282
- `Mode: ${status.mode === "custody" ? "vault (custody)" : status.mode === "local" ? "local Pi login" : `unreadable (${status.modeProblem ?? "unknown problem"})`}`,
283
- `Enrollment (${PI_ANTIGRAVITY_ENROLLMENT_NAME}): ${describeEnrollment(status.enrollment)}`,
284
- status.hostSlot === "dormant" ? "Pi auth slot: dormant (not read)" : `Pi auth slot: ${describeHostSlot(status.hostSlot)}`
285
- ];
286
- if (status.selectedRouteId !== void 0)
287
- lines.push("Vault account: a specific account is chosen (marked below)");
288
- if (status.mode === "local" && status.hostSlot === "placeholder")
289
- lines.push(
290
- "Conflict: local mode has no login to serve. Run /login or switch to the vault."
291
- );
293
+ const lines = [describeSource(status), describeEnrollment(status.enrollment)];
294
+ if (status.mode === "custody" && status.selectedRouteId !== void 0)
295
+ lines.push('Pi uses the vault account marked "in use by Pi" below.');
292
296
  lines.push(...enrollmentGuidance(status.enrollment));
293
297
  return lines;
294
298
  }
@@ -296,6 +300,9 @@ var ITEM_ID_SALT = randomBytes(16);
296
300
  function vaultAccountName(listed, account) {
297
301
  return `Vault account ${listed.indexOf(account) + 1}`;
298
302
  }
303
+ var VAULT_ACCOUNT_IN_USE = "in use by Pi";
304
+ var VAULT_ACCOUNT_AVAILABLE = "available";
305
+ var VAULT_ACCOUNT_TURNED_OFF = "turned off for Pi on this computer";
299
306
  function opaqueItemId(routeId) {
300
307
  return `vault-${createHash("sha256").update(ITEM_ID_SALT).update(routeId).digest("hex").slice(0, 16)}`;
301
308
  }
@@ -307,6 +314,11 @@ function refused(error) {
307
314
  return { ok: false, text: error.message, code: "vault-refused" };
308
315
  throw error;
309
316
  }
317
+ function sharedFolderRefusal(error) {
318
+ const outcome = sharedVaultTokenFolderOutcome(error);
319
+ if (outcome) return outcome;
320
+ throw error;
321
+ }
310
322
  async function waitForApproval(setup, wait = {}) {
311
323
  const sleep = wait.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
312
324
  const interval = wait.pollIntervalMs ?? 2e3;
@@ -333,7 +345,7 @@ function createPiVaultSection(options) {
333
345
  }
334
346
  };
335
347
  const stepText = async (step, suffix = "") => [
336
- `Enrollment: ${describeEnrollment(step)}${suffix}`,
348
+ `${describeEnrollment(step)}${suffix}`,
337
349
  ...enrollmentGuidance(step),
338
350
  ...step.state === "approved" ? await approvedRosterGuidance() : []
339
351
  ].join("\n");
@@ -356,36 +368,36 @@ function createPiVaultSection(options) {
356
368
  items.push({
357
369
  id: opaqueItemId(account.routeId),
358
370
  label: name,
359
- detail: account.declined ? "declined on this host" : serving ? "serving Pi" : "available",
371
+ detail: account.declined ? VAULT_ACCOUNT_TURNED_OFF : serving ? VAULT_ACCOUNT_IN_USE : VAULT_ACCOUNT_AVAILABLE,
360
372
  actions: account.declined ? [
361
373
  {
362
374
  id: "accept",
363
- label: "Accept on this host",
375
+ label: "Turn back on for Pi",
364
376
  run: async () => {
365
377
  await port.accept(account.routeId);
366
- return `${name} is accepted on this host.`;
378
+ return `Pi can use ${name} again.`;
367
379
  }
368
380
  }
369
381
  ] : [
370
382
  {
371
383
  id: "use",
372
- label: "Serve Pi from this account",
384
+ label: "Use this account",
373
385
  run: async () => {
374
386
  try {
375
387
  await setup.useVault(account.routeId);
376
388
  } catch (error) {
377
389
  return refused(error);
378
390
  }
379
- return `Pi now serves Antigravity from ${name}.`;
391
+ return `Pi now uses ${name} for Antigravity.`;
380
392
  }
381
393
  },
382
394
  {
383
395
  id: "decline",
384
- label: "Decline on this host",
385
- description: "It stays in the vault and in this list, and is never sent from this host until accepted again.",
396
+ label: "Turn off for Pi",
397
+ description: "The account stays in the vault and in this list, but Pi on this computer never uses it until you turn it back on.",
386
398
  run: async () => {
387
399
  await port.decline(account.routeId);
388
- return `${name} is declined on this host.`;
400
+ return `Pi on this computer won't use ${name} until you turn it back on.`;
389
401
  }
390
402
  }
391
403
  ]
@@ -394,10 +406,12 @@ function createPiVaultSection(options) {
394
406
  if (listed.length === 0) lines.push(...piNoVaultAccountsGuidance());
395
407
  else if (status.mode !== "custody")
396
408
  lines.push(
397
- "Next: choose Serve Pi from the vault to serve Pi from these accounts."
409
+ "Next: choose Use the vault to have Pi use these accounts."
398
410
  );
399
411
  } catch (error) {
400
- lines.push(`Vault accounts unavailable: ${errorText(error)}`);
412
+ lines.push(
413
+ `Pi can't load the vault accounts right now: ${errorText(error)}`
414
+ );
401
415
  }
402
416
  }
403
417
  const actions = [];
@@ -405,9 +419,14 @@ function createPiVaultSection(options) {
405
419
  actions.push({
406
420
  id: "request-access",
407
421
  label: "Request vault access",
408
- description: `Asks the vault to enroll Pi as ${PI_ANTIGRAVITY_ENROLLMENT_NAME}; the operator approves it in the vault.`,
422
+ description: "Asks the vault operator to let Pi use the vault's Antigravity accounts.",
409
423
  run: async ({ invocation }) => {
410
- const step = await setup.connectStep();
424
+ let step;
425
+ try {
426
+ step = await setup.connectStep();
427
+ } catch (error) {
428
+ return sharedFolderRefusal(error);
429
+ }
411
430
  if (step.state !== "pending" && step.state !== "busy")
412
431
  return {
413
432
  ok: step.state === "approved",
@@ -422,8 +441,9 @@ function createPiVaultSection(options) {
422
441
  final.state === "approved" ? "info" : "warning"
423
442
  );
424
443
  }).catch((error) => {
444
+ const folder = sharedVaultTokenFolder(error);
425
445
  invocation.notify(
426
- `Requesting vault access failed: ${errorText(error)}`,
446
+ folder === void 0 ? `Requesting vault access failed: ${errorText(error)}` : sharedVaultTokenFolderText(folder),
427
447
  "error"
428
448
  );
429
449
  }).finally(() => {
@@ -434,7 +454,7 @@ function createPiVaultSection(options) {
434
454
  ok: true,
435
455
  text: await stepText(
436
456
  step,
437
- ". You are told here when the operator decides."
457
+ " Pi tells you here when the operator decides."
438
458
  )
439
459
  };
440
460
  }
@@ -442,39 +462,39 @@ function createPiVaultSection(options) {
442
462
  if (approved && status.mode !== "custody")
443
463
  actions.push({
444
464
  id: "use-vault",
445
- label: "Serve Pi from the vault",
465
+ label: "Use the vault",
446
466
  run: async () => {
447
467
  try {
448
468
  await setup.useVault(status.selectedRouteId);
449
469
  } catch (error) {
450
470
  return refused(error);
451
471
  }
452
- return "Pi now serves Antigravity from the vault.";
472
+ return "Pi now uses the vault for Antigravity.";
453
473
  }
454
474
  });
455
475
  if (status.mode !== "local" && (status.enrollment.state === "idle" || status.enrollment.state === "pending" || status.enrollment.state === "denied"))
456
476
  actions.push({
457
477
  id: "use-local",
458
- label: "Serve Pi from its own login",
478
+ label: "Use Pi's own login",
459
479
  run: async () => {
460
480
  await setup.useLocal();
461
- return "Pi now serves Antigravity from its own login. Run /login if it has none.";
481
+ return "Pi now uses its own login for Antigravity. Run /login if you haven't signed in.";
462
482
  }
463
483
  });
464
484
  if (status.enrollment.state === "pending")
465
485
  lines.push(
466
- `Forget vault enrollment is offered again once Pi sees the request approved or denied. To drop it, the operator runs ck auth enroll deny --request-id ${status.enrollment.requestId ?? "<id>"}; then choose Request vault access here.`
486
+ `You can't disconnect while this request waits for the vault operator. To withdraw it, ask the vault operator to run ck auth enroll deny --request-id ${status.enrollment.requestId ?? "<id>"}, then choose Request vault access here so Pi sees the answer.`
467
487
  );
468
488
  else if (status.enrollment.state !== "idle")
469
489
  actions.push({
470
490
  id: "forget",
471
- label: "Forget vault enrollment",
472
- description: "Deletes Pi's enrollment token and returns to the local login. The operator can still revoke the enrollment in the vault.",
491
+ label: "Disconnect from the vault",
492
+ description: "Removes Pi's vault key from this computer and goes back to Pi's own login. Using the vault here again needs a new request and a new approval. The earlier approval stays in the vault until the vault operator revokes it.",
473
493
  irreversible: true,
474
- confirm: `Forget the ${PI_ANTIGRAVITY_ENROLLMENT_NAME} enrollment? Using the vault again needs a new approval.`,
494
+ confirm: "Disconnect this computer from the vault? Pi goes back to its own login, and using the vault here again needs a new approval from the vault operator.",
475
495
  run: async () => {
476
496
  await setup.disconnect();
477
- return "Vault enrollment forgotten; Pi serves Antigravity from its own login.";
497
+ return "Disconnected from the vault. Pi now uses its own login for Antigravity.";
478
498
  }
479
499
  });
480
500
  return { lines, items, actions };
@@ -517,18 +537,18 @@ async function custodyAccounts(status, options) {
517
537
  } catch (error) {
518
538
  return {
519
539
  list: [],
520
- problem: `Vault accounts unavailable: ${error instanceof Error ? error.message : String(error)}`
540
+ problem: `Pi can't load the vault accounts right now: ${error instanceof Error ? error.message : String(error)}`
521
541
  };
522
542
  }
523
543
  }
524
544
  function localLoginLine(status) {
525
545
  switch (status.hostSlot) {
526
546
  case "dormant":
527
- return "The native Pi login is dormant while vault enrollment controls serving.";
547
+ return "Pi's own login is set aside while Pi uses the vault.";
528
548
  case "login":
529
549
  return "Signed in with Pi's own login. Pi's /login replaces it and /logout removes it.";
530
550
  case "placeholder":
531
- return "Pi holds the vault placeholder, not a login. Run /login, or serve from the vault in the Vault section.";
551
+ return "Not signed in with Pi's own login. Run /login, or choose Use the vault in the Vault section.";
532
552
  case "empty":
533
553
  return "Not signed in. Run Pi's /login to sign in.";
534
554
  }
@@ -542,7 +562,7 @@ function createPiAntigravityAccountSections(options) {
542
562
  if (status.mode === "unreadable")
543
563
  return {
544
564
  lines: [
545
- `The vault mode file is unreadable (${status.modeProblem ?? "unknown problem"}); Pi serves nothing until a mode is chosen in the Vault section.`
565
+ status.modeProblem === void 0 ? "Pi can't tell whether to use the vault or its own login, so it sends no Antigravity requests. See the Vault section." : `Pi can't tell whether to use the vault or its own login (${status.modeProblem}), so it sends no Antigravity requests. Choose one in the Vault section.`
546
566
  ]
547
567
  };
548
568
  if (status.mode === "local")
@@ -557,13 +577,13 @@ function createPiAntigravityAccountSections(options) {
557
577
  const items = list.map((account) => ({
558
578
  id: opaqueItemId(account.routeId),
559
579
  label: vaultAccountName(list, account),
560
- detail: account.declined ? "declined on this host" : account === serving ? "serving Pi" : "available"
580
+ detail: account.declined ? VAULT_ACCOUNT_TURNED_OFF : account === serving ? VAULT_ACCOUNT_IN_USE : VAULT_ACCOUNT_AVAILABLE
561
581
  }));
562
582
  return {
563
583
  lines: [
564
- "Pi serves Antigravity from the vault, one account at a time. Choose, decline or accept accounts in the Vault section.",
584
+ "Pi uses the vault for Antigravity, one account at a time. Choose an account, or turn accounts off and on, in the Vault section.",
565
585
  ...status.hostSlot === "login" ? [
566
- "Conflict: Pi also holds its own login. Requests are refused until /logout or a switch back to the local login."
586
+ "Pi is also signed in with its own login, so requests are refused. Run /logout, or switch back to Pi's own login in the Vault section."
567
587
  ] : [],
568
588
  ...problem ? [problem] : [],
569
589
  // An approved enrollment without a read grant lists nothing;
@@ -589,7 +609,7 @@ function createPiAntigravityAccountSections(options) {
589
609
  if (status.mode === "unreadable")
590
610
  return {
591
611
  lines: [
592
- "Vault enrollment authority is unreadable; requests are refused. Recover or Disconnect in the Vault section."
612
+ "Pi can't read its vault setup, so requests are refused. See the Vault section."
593
613
  ]
594
614
  };
595
615
  if (status.mode !== "custody")
@@ -603,7 +623,7 @@ function createPiAntigravityAccountSections(options) {
603
623
  if (!problem && list.length === 0 && status.enrollment.state === "approved")
604
624
  return {
605
625
  lines: [
606
- "The vault serves Pi no accounts, so requests are refused. There is no account rotation.",
626
+ "The vault gives Pi no accounts, so requests are refused. There is no account rotation.",
607
627
  ...piNoVaultAccountsGuidance()
608
628
  ]
609
629
  };
@@ -643,23 +663,13 @@ function getPackedRefresh(accessToken) {
643
663
  }
644
664
 
645
665
  // src/paths.ts
646
- import { homedir } from "node:os";
647
- import { dirname, join } from "node:path";
648
- function getPiConfigDir() {
649
- return process.env.PI_AGENT_DIR?.trim() || join(homedir(), ".pi", "agent");
650
- }
651
- function getPiAntigravityAuthFile() {
652
- return process.env.PI_ANTIGRAVITY_AUTH_FILE?.trim() || join(getPiConfigDir(), "antigravity-accounts.json");
653
- }
654
- function getPiAntigravityVaultDir() {
655
- return join(dirname(getPiAntigravityAuthFile()), "antigravity-auth-vault");
656
- }
657
- function getPiAntigravityVaultModeFile() {
658
- return join(getPiAntigravityVaultDir(), "pi-mode.json");
659
- }
660
- function getPiAntigravityVaultRosterFile() {
661
- return join(getPiAntigravityVaultDir(), "pi-roster.json");
662
- }
666
+ import {
667
+ getPiAntigravityAuthFile,
668
+ getPiAntigravityVaultDir,
669
+ getPiAntigravityVaultModeFile,
670
+ getPiAntigravityVaultRosterFile,
671
+ getPiConfigDir
672
+ } from "@cortexkit/antigravity-auth-core";
663
673
 
664
674
  // src/stream.ts
665
675
  import {
@@ -677,7 +687,7 @@ import {
677
687
  RETIRED_AGY_MODEL_MESSAGE,
678
688
  redactCredentialError,
679
689
  redactCredentialText,
680
- resolveModelForHeaderStyle
690
+ resolveAntigravityModel
681
691
  } from "@cortexkit/antigravity-auth-core";
682
692
  import {
683
693
  calculateCost,
@@ -1021,11 +1031,11 @@ function resolvePiAntigravityModel(model, reasoning) {
1021
1031
  const lower = model.id.toLowerCase();
1022
1032
  const supportsAgyTiers = model.reasoning && (isGeminiArgonModel(lower) || lower.includes("gemini-3") || lower.includes("claude") && (lower.includes("thinking") || /claude-(opus|sonnet)-5-5/.test(lower)));
1023
1033
  if (!supportsAgyTiers || !reasoning) {
1024
- return resolveModelForHeaderStyle(model.id, "antigravity");
1034
+ return resolveAntigravityModel(model.id);
1025
1035
  }
1026
1036
  const tier = reasoning === "minimal" ? "low" : reasoning === "xhigh" ? "high" : reasoning;
1027
1037
  const baseModel = model.id.replace(/-(minimal|low|medium|high|xhigh)$/i, "");
1028
- return resolveModelForHeaderStyle(`${baseModel}-${tier}`, "antigravity");
1038
+ return resolveAntigravityModel(`${baseModel}-${tier}`);
1029
1039
  }
1030
1040
  function prepareAntigravityRequest(options) {
1031
1041
  const resolved = resolvePiAntigravityModel(
@@ -1783,8 +1793,8 @@ async function registerCortexKitPiAntigravity(pi, seams = {}) {
1783
1793
  const mode = await currentMode();
1784
1794
  const { openPiSlot } = await (seams.loadPiSlot ?? loadCommonAuthPiSlot)();
1785
1795
  const slot = openPiSlot({
1786
- authPath: seams.nativeAuthPath ?? join2(getAgentDir(), "auth.json"),
1787
- stashPath: seams.nativeStashPath ?? join2(
1796
+ authPath: seams.nativeAuthPath ?? join(getAgentDir(), "auth.json"),
1797
+ stashPath: seams.nativeStashPath ?? join(
1788
1798
  seams.vaultDir ?? getPiAntigravityVaultDir(),
1789
1799
  "google-login-stash.json"
1790
1800
  ),