@dotobokuri/fleet-console 1.71.0 → 1.72.0

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 (67) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +13 -0
  3. package/dist/cli.mjs +437 -350
  4. package/dist/client/assets/{_baseUniq--GYoaiDn.js → _baseUniq-D_AjNlwO.js} +1 -1
  5. package/dist/client/assets/{arc-ioTPutEb.js → arc-DiscagS3.js} +1 -1
  6. package/dist/client/assets/{architectureDiagram-Q4EWVU46-DLfH6cdt.js → architectureDiagram-Q4EWVU46-PGPwULb9.js} +1 -1
  7. package/dist/client/assets/{blockDiagram-DXYQGD6D-ZM6X_dlD.js → blockDiagram-DXYQGD6D-DLexJaxZ.js} +1 -1
  8. package/dist/client/assets/{c4Diagram-AHTNJAMY-DDPTnZGS.js → c4Diagram-AHTNJAMY-D9Ye73ny.js} +1 -1
  9. package/dist/client/assets/channel-CR5OWwKU.js +1 -0
  10. package/dist/client/assets/{chunk-4BX2VUAB-0ShpcAto.js → chunk-4BX2VUAB-B7YgJYL4.js} +1 -1
  11. package/dist/client/assets/{chunk-4TB4RGXK-CvMAl5bA.js → chunk-4TB4RGXK-CEEQcTWi.js} +1 -1
  12. package/dist/client/assets/{chunk-55IACEB6-CgV8t6TS.js → chunk-55IACEB6-B8AcnGT7.js} +1 -1
  13. package/dist/client/assets/{chunk-EDXVE4YY-DQkbYjs9.js → chunk-EDXVE4YY-DjZ88S2h.js} +1 -1
  14. package/dist/client/assets/{chunk-FMBD7UC4-D4Pm3UM-.js → chunk-FMBD7UC4-io3C2TDz.js} +1 -1
  15. package/dist/client/assets/{chunk-OYMX7WX6-BrWIgOQ6.js → chunk-OYMX7WX6-s0DPD-0B.js} +1 -1
  16. package/dist/client/assets/{chunk-QZHKN3VN-BC-GEuDl.js → chunk-QZHKN3VN-DGcrSXIn.js} +1 -1
  17. package/dist/client/assets/{chunk-YZCP3GAM-Dst--QPc.js → chunk-YZCP3GAM-Dp1DewA_.js} +1 -1
  18. package/dist/client/assets/classDiagram-6PBFFD2Q-BxfrF-vv.js +1 -0
  19. package/dist/client/assets/classDiagram-v2-HSJHXN6E-BxfrF-vv.js +1 -0
  20. package/dist/client/assets/clone-BH8tX1wM.js +1 -0
  21. package/dist/client/assets/{cose-bilkent-S5V4N54A-D87Ru6Nw.js → cose-bilkent-S5V4N54A-D9PZkL8M.js} +1 -1
  22. package/dist/client/assets/{dagre-KV5264BT-CUG8AIPS.js → dagre-KV5264BT-M-8Bl0QN.js} +1 -1
  23. package/dist/client/assets/{diagram-5BDNPKRD-DrhhXUdy.js → diagram-5BDNPKRD-CbFVI18N.js} +1 -1
  24. package/dist/client/assets/{diagram-G4DWMVQ6-DgGQFVlD.js → diagram-G4DWMVQ6-Bofydoge.js} +1 -1
  25. package/dist/client/assets/{diagram-MMDJMWI5-DEyFyzNg.js → diagram-MMDJMWI5-BZQV1jqh.js} +1 -1
  26. package/dist/client/assets/{diagram-TYMM5635-ari8AKd5.js → diagram-TYMM5635-v_pX67fP.js} +1 -1
  27. package/dist/client/assets/{erDiagram-SMLLAGMA-Aywt-vx8.js → erDiagram-SMLLAGMA-DA8k24I7.js} +1 -1
  28. package/dist/client/assets/{flowDiagram-DWJPFMVM-FO46vDh_.js → flowDiagram-DWJPFMVM-CA3Jm5mj.js} +1 -1
  29. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-C0m3r6C5.js → ganttDiagram-T4ZO3ILL-B6YPlixu.js} +1 -1
  30. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-CTUKGfIc.js → gitGraphDiagram-UUTBAWPF-3BjoRhTq.js} +1 -1
  31. package/dist/client/assets/{graph-PzhNFXt_.js → graph-CjQR1bpo.js} +1 -1
  32. package/dist/client/assets/index-B21kBRWF.js +467 -0
  33. package/dist/client/assets/{index-Bcc3Exng.css → index-DKMT7UVt.css} +1 -1
  34. package/dist/client/assets/{infoDiagram-42DDH7IO-CFry6eYn.js → infoDiagram-42DDH7IO-Cz8NXcwy.js} +1 -1
  35. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-BBJvVjTh.js → ishikawaDiagram-UXIWVN3A-dJiEc4oW.js} +1 -1
  36. package/dist/client/assets/{journeyDiagram-VCZTEJTY-glHJeITG.js → journeyDiagram-VCZTEJTY-D0e9gSNl.js} +1 -1
  37. package/dist/client/assets/{kanban-definition-6JOO6SKY-Dp7IjAmS.js → kanban-definition-6JOO6SKY-DJ-tyN1D.js} +1 -1
  38. package/dist/client/assets/{layout-PhtOMDDE.js → layout-By8oq65c.js} +1 -1
  39. package/dist/client/assets/{linear-B3pjuRWl.js → linear-Bgvt1y1F.js} +1 -1
  40. package/dist/client/assets/{mermaid.core-DDurtDWt.js → mermaid.core-BzUsxrJd.js} +4 -4
  41. package/dist/client/assets/{min-ZS3oLuaq.js → min-C5LKMAsm.js} +1 -1
  42. package/dist/client/assets/{mindmap-definition-QFDTVHPH-D67iQI4K.js → mindmap-definition-QFDTVHPH-BVEgUjPO.js} +1 -1
  43. package/dist/client/assets/{pieDiagram-DEJITSTG-B95nftHb.js → pieDiagram-DEJITSTG-H6ERErU1.js} +1 -1
  44. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-BbBVDSwm.js → quadrantDiagram-34T5L4WZ-B3Y2XYCJ.js} +1 -1
  45. package/dist/client/assets/{requirementDiagram-MS252O5E-Dbtcs04o.js → requirementDiagram-MS252O5E-NgcHrVQM.js} +1 -1
  46. package/dist/client/assets/{sankeyDiagram-XADWPNL6-BuqmxYyX.js → sankeyDiagram-XADWPNL6-DtmwsCxU.js} +1 -1
  47. package/dist/client/assets/{sequenceDiagram-FGHM5R23-DmLihX3U.js → sequenceDiagram-FGHM5R23-Rd0S2w1n.js} +1 -1
  48. package/dist/client/assets/{stateDiagram-FHFEXIEX-D3Z_iYXj.js → stateDiagram-FHFEXIEX-Cpag_fk7.js} +1 -1
  49. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Cbjujcp-.js +1 -0
  50. package/dist/client/assets/{timeline-definition-GMOUNBTQ-witmATQr.js → timeline-definition-GMOUNBTQ-C8yS2XLP.js} +1 -1
  51. package/dist/client/assets/{vennDiagram-DHZGUBPP-BDI4z0F-.js → vennDiagram-DHZGUBPP-Bj7SvZFm.js} +1 -1
  52. package/dist/client/assets/{wardley-RL74JXVD-oYmBD5eO.js → wardley-RL74JXVD-DZhhw2v9.js} +1 -1
  53. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-DhnyRjSq.js → wardleyDiagram-NUSXRM2D-DgpBbIN3.js} +1 -1
  54. package/dist/client/assets/{xychartDiagram-5P7HB3ND-DUY-bU_6.js → xychartDiagram-5P7HB3ND-CUq82Sal.js} +1 -1
  55. package/dist/client/index.html +2 -2
  56. package/dist/fleet-plugins/ledger/routes.mjs +103 -16
  57. package/dist/fleet-plugins/quota/routes.mjs +662 -148
  58. package/dist/fleet-plugins/scuttlebutt/routes.mjs +103 -16
  59. package/dist/fleet-plugins/terminal/routes.mjs +1394 -488
  60. package/dist/fleet.mjs +3468 -1329
  61. package/package.json +1 -1
  62. package/dist/client/assets/channel-BvAoE0IP.js +0 -1
  63. package/dist/client/assets/classDiagram-6PBFFD2Q-BeVFxENS.js +0 -1
  64. package/dist/client/assets/classDiagram-v2-HSJHXN6E-BeVFxENS.js +0 -1
  65. package/dist/client/assets/clone-TnYsvJuQ.js +0 -1
  66. package/dist/client/assets/index-DkOT93yC.js +0 -467
  67. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-BbUn16lr.js +0 -1
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { execFile } from 'child_process';
2
+ import { execFile, spawn } from 'child_process';
3
3
  import { constants } from 'fs';
4
4
  import fs22 from 'fs/promises';
5
5
  import os4 from 'os';
6
6
  import { promisify } from 'util';
7
- import path32 from 'path';
7
+ import path42 from 'path';
8
8
  import { deflateRawSync } from 'zlib';
9
9
  import * as fs4 from 'node:fs';
10
10
  import * as path from 'node:path';
@@ -20,16 +20,16 @@ var __export = (target, all) => {
20
20
  function definePlugin(definition) {
21
21
  return definition;
22
22
  }
23
- function registerRouter(ctx, path5, handler, catalog) {
23
+ function registerRouter(ctx, path6, handler, catalog) {
24
24
  if (catalog) {
25
- ctx.registerRouter(normalizePath(path5), handler, catalog);
25
+ ctx.registerRouter(normalizePath(path6), handler, catalog);
26
26
  return;
27
27
  }
28
- ctx.registerRouter(normalizePath(path5), handler);
28
+ ctx.registerRouter(normalizePath(path6), handler);
29
29
  }
30
- function normalizePath(path5) {
31
- if (path5.length === 0 || path5 === "/") return "/";
32
- return path5;
30
+ function normalizePath(path6) {
31
+ if (path6.length === 0 || path6 === "/") return "/";
32
+ return path6;
33
33
  }
34
34
 
35
35
  // ../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/classic/external.js
@@ -794,10 +794,10 @@ function mergeDefs(...defs) {
794
794
  function cloneDef(schema) {
795
795
  return mergeDefs(schema._zod.def);
796
796
  }
797
- function getElementAtPath(obj, path5) {
798
- if (!path5)
797
+ function getElementAtPath(obj, path6) {
798
+ if (!path6)
799
799
  return obj;
800
- return path5.reduce((acc, key) => acc?.[key], obj);
800
+ return path6.reduce((acc, key) => acc?.[key], obj);
801
801
  }
802
802
  function promiseAllObject(promisesObj) {
803
803
  const keys = Object.keys(promisesObj);
@@ -1206,11 +1206,11 @@ function explicitlyAborted(x, startIndex = 0) {
1206
1206
  }
1207
1207
  return false;
1208
1208
  }
1209
- function prefixIssues(path5, issues) {
1209
+ function prefixIssues(path6, issues) {
1210
1210
  return issues.map((iss) => {
1211
1211
  var _a3;
1212
1212
  (_a3 = iss).path ?? (_a3.path = []);
1213
- iss.path.unshift(path5);
1213
+ iss.path.unshift(path6);
1214
1214
  return iss;
1215
1215
  });
1216
1216
  }
@@ -1357,16 +1357,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1357
1357
  }
1358
1358
  function formatError(error51, mapper = (issue2) => issue2.message) {
1359
1359
  const fieldErrors = { _errors: [] };
1360
- const processError = (error52, path5 = []) => {
1360
+ const processError = (error52, path6 = []) => {
1361
1361
  for (const issue2 of error52.issues) {
1362
1362
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1363
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
1363
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
1364
1364
  } else if (issue2.code === "invalid_key") {
1365
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1365
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1366
1366
  } else if (issue2.code === "invalid_element") {
1367
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1367
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1368
1368
  } else {
1369
- const fullpath = [...path5, ...issue2.path];
1369
+ const fullpath = [...path6, ...issue2.path];
1370
1370
  if (fullpath.length === 0) {
1371
1371
  fieldErrors._errors.push(mapper(issue2));
1372
1372
  } else {
@@ -1393,17 +1393,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1393
1393
  }
1394
1394
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1395
1395
  const result = { errors: [] };
1396
- const processError = (error52, path5 = []) => {
1396
+ const processError = (error52, path6 = []) => {
1397
1397
  var _a3, _b;
1398
1398
  for (const issue2 of error52.issues) {
1399
1399
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1400
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
1400
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
1401
1401
  } else if (issue2.code === "invalid_key") {
1402
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1402
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1403
1403
  } else if (issue2.code === "invalid_element") {
1404
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1404
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1405
1405
  } else {
1406
- const fullpath = [...path5, ...issue2.path];
1406
+ const fullpath = [...path6, ...issue2.path];
1407
1407
  if (fullpath.length === 0) {
1408
1408
  result.errors.push(mapper(issue2));
1409
1409
  continue;
@@ -1435,8 +1435,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1435
1435
  }
1436
1436
  function toDotPath(_path) {
1437
1437
  const segs = [];
1438
- const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1439
- for (const seg of path5) {
1438
+ const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1439
+ for (const seg of path6) {
1440
1440
  if (typeof seg === "number")
1441
1441
  segs.push(`[${seg}]`);
1442
1442
  else if (typeof seg === "symbol")
@@ -14100,13 +14100,13 @@ function resolveRef(ref, ctx) {
14100
14100
  if (!ref.startsWith("#")) {
14101
14101
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14102
14102
  }
14103
- const path5 = ref.slice(1).split("/").filter(Boolean);
14104
- if (path5.length === 0) {
14103
+ const path6 = ref.slice(1).split("/").filter(Boolean);
14104
+ if (path6.length === 0) {
14105
14105
  return ctx.rootSchema;
14106
14106
  }
14107
14107
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14108
- if (path5[0] === defsKey) {
14109
- const key = path5[1];
14108
+ if (path6[0] === defsKey) {
14109
+ const key = path6[1];
14110
14110
  if (!key || !ctx.defs[key]) {
14111
14111
  throw new Error(`Reference not found: ${ref}`);
14112
14112
  }
@@ -17094,8 +17094,8 @@ function bootEnumDescriptorProto(init) {
17094
17094
  }
17095
17095
 
17096
17096
  // ../../node_modules/.pnpm/@bufbuild+protobuf@2.13.0/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.js
17097
- function messageDesc(file2, path5, ...paths) {
17098
- return paths.reduce((acc, cur) => acc.nestedMessages[cur], file2.messages[path5]);
17097
+ function messageDesc(file2, path6, ...paths) {
17098
+ return paths.reduce((acc, cur) => acc.nestedMessages[cur], file2.messages[path6]);
17099
17099
  }
17100
17100
 
17101
17101
  // ../../node_modules/.pnpm/@bufbuild+protobuf@2.13.0/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js
@@ -17815,6 +17815,11 @@ var REASONING_EFFORTS = [
17815
17815
  new Map(
17816
17816
  REASONING_EFFORTS.map((effort, index) => [effort, index])
17817
17817
  );
17818
+ var CLAUDE_CLIENT_IDENTITY_SENTENCES = [
17819
+ "You are Claude Code, Anthropic's official CLI for Claude.",
17820
+ "You are a Claude agent, built on Anthropic's Claude Agent SDK."
17821
+ ];
17822
+ Math.max(...CLAUDE_CLIENT_IDENTITY_SENTENCES.map((sentence) => sentence.length)) + 16;
17818
17823
  var benchmarks_default = {
17819
17824
  version: 2,
17820
17825
  sources: {
@@ -18032,8 +18037,48 @@ var benchmarks_default = {
18032
18037
  };
18033
18038
  var models_default = {
18034
18039
  version: 1,
18035
- updatedAt: "2026-08-21T00:00:00Z",
18040
+ updatedAt: "2026-08-22T00:00:00Z",
18036
18041
  providers: {
18042
+ antigravity: {
18043
+ name: "Antigravity",
18044
+ defaultModel: "gemini-3.7-flash",
18045
+ source: "live POST https://daily-cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels read with the credential the Antigravity CLI (agy 1.1.18) owns, 2026-08-22; the same read reported defaultAgentModelId gemini-3.7-flash-high and a deprecatedModelIds entry mapping gemini-3.1-pro-high to gemini-pro-agent, and a live streamGenerateContent probe on that date confirmed gemini-3.1-pro-high is refused with INVALID_ARGUMENT while gemini-pro-agent answers. Effort spelling was measured per model on one fixed prompt: gemini-3.7-flash-tiered honours generationConfig.thinkingConfig.thinkingLevel (343 / 407 / 434 reasoning tokens at low / medium / high) so its ladder is a request field, while Gemini 3.1 Pro encodes the rung in the wire id. thinkingLevel accepts low, medium, and high only: minimal and max are both refused. Claude and GPT-OSS models are served by the same subscription but are deliberately not exposed here",
18046
+ models: [
18047
+ {
18048
+ modelId: "gemini-3.7-flash",
18049
+ name: "Gemini-3.7-Flash",
18050
+ capabilityClass: "light",
18051
+ providerModelId: "gemini-3.7-flash-tiered",
18052
+ contextWindow: 1048576,
18053
+ effort: {
18054
+ supported: true,
18055
+ levels: [
18056
+ "low",
18057
+ "medium",
18058
+ "high"
18059
+ ]
18060
+ }
18061
+ },
18062
+ {
18063
+ modelId: "gemini-3.1-pro",
18064
+ name: "Gemini-3.1-Pro",
18065
+ capabilityClass: "flagship",
18066
+ providerModelId: "gemini-3.1-pro-low",
18067
+ contextWindow: 1048576,
18068
+ effort: {
18069
+ supported: true,
18070
+ levels: [
18071
+ "low",
18072
+ "high"
18073
+ ],
18074
+ upstreamModelIds: {
18075
+ low: "gemini-3.1-pro-low",
18076
+ high: "gemini-pro-agent"
18077
+ }
18078
+ }
18079
+ }
18080
+ ]
18081
+ },
18037
18082
  codex: {
18038
18083
  name: "Codex",
18039
18084
  defaultModel: "gpt-5.6-sol",
@@ -18443,7 +18488,7 @@ var models_default = {
18443
18488
  {
18444
18489
  modelId: "composer-2.5",
18445
18490
  name: "Composer-2.5",
18446
- capabilityClass: "flagship",
18491
+ capabilityClass: "standard",
18447
18492
  quotaScope: "auto",
18448
18493
  contextWindow: 2e5,
18449
18494
  benchmarkKey: "composer-2.5"
@@ -18451,9 +18496,11 @@ var models_default = {
18451
18496
  {
18452
18497
  modelId: "composer-2.5-fast",
18453
18498
  name: "Composer-2.5-Fast",
18454
- capabilityClass: "light",
18499
+ capabilityClass: "standard",
18500
+ variantOf: "composer-2.5",
18455
18501
  quotaScope: "auto",
18456
- contextWindow: 2e5
18502
+ contextWindow: 2e5,
18503
+ benchmarkKey: "composer-2.5"
18457
18504
  },
18458
18505
  {
18459
18506
  modelId: "grok-4.5",
@@ -18475,7 +18522,8 @@ var models_default = {
18475
18522
  {
18476
18523
  modelId: "grok-4.5-fast",
18477
18524
  name: "Grok-4.5-Fast",
18478
- capabilityClass: "light",
18525
+ capabilityClass: "flagship",
18526
+ variantOf: "grok-4.5",
18479
18527
  quotaScope: "auto",
18480
18528
  contextWindow: 256e3,
18481
18529
  effort: {
@@ -18486,7 +18534,8 @@ var models_default = {
18486
18534
  "high"
18487
18535
  ],
18488
18536
  upstreamModelIdTemplate: "cursor-grok-4.5-{effort}-fast"
18489
- }
18537
+ },
18538
+ benchmarkKey: "grok-4.5"
18490
18539
  },
18491
18540
  {
18492
18541
  modelId: "grok-4.6",
@@ -18509,7 +18558,8 @@ var models_default = {
18509
18558
  {
18510
18559
  modelId: "grok-4.6-fast",
18511
18560
  name: "Grok-4.6-Fast",
18512
- capabilityClass: "light",
18561
+ capabilityClass: "flagship",
18562
+ variantOf: "grok-4.6",
18513
18563
  quotaScope: "auto",
18514
18564
  contextWindow: 256e3,
18515
18565
  effort: {
@@ -18521,7 +18571,8 @@ var models_default = {
18521
18571
  "xhigh"
18522
18572
  ],
18523
18573
  upstreamModelIdTemplate: "cursor-grok-4.6-{effort}-fast"
18524
- }
18574
+ },
18575
+ benchmarkKey: "grok-4.6"
18525
18576
  },
18526
18577
  {
18527
18578
  modelId: "claude-opus-5",
@@ -18906,7 +18957,7 @@ var models_default = {
18906
18957
  {
18907
18958
  modelId: "grok-composer-2.5-fast",
18908
18959
  name: "Grok-Composer-2.5-Fast",
18909
- capabilityClass: "light",
18960
+ capabilityClass: "standard",
18910
18961
  wire: "responses",
18911
18962
  contextWindow: 2e5
18912
18963
  }
@@ -19025,7 +19076,7 @@ var models_default = {
19025
19076
  };
19026
19077
  var KIMI_AUTH_PROVIDER_ID = "Claude Code with Moonshot Kimi";
19027
19078
  var KIMI_CODE_API_BASE_URL = "https://api.kimi.com/coding";
19028
- var GATEWAY_PROVIDERS = ["codex", "xai", "cursor", "opencode", "kimi"];
19079
+ var GATEWAY_PROVIDERS = ["codex", "xai", "cursor", "opencode", "antigravity", "kimi"];
19029
19080
  var GATEWAY_MODEL_WIRES = ["anthropic", "responses", "chat-completions"];
19030
19081
  var GATEWAY_REASONING_EFFORTS = [
19031
19082
  "low",
@@ -19103,6 +19154,14 @@ var GatewayModelEntrySchema = external_exports.object({
19103
19154
  benchmarkKey: external_exports.string().min(1).optional(),
19104
19155
  description: external_exports.string().min(1).optional(),
19105
19156
  providerModelId: external_exports.string().min(1).optional(),
19157
+ /**
19158
+ * The catalog entry this one is a serving variant of, when the provider gives
19159
+ * the variant its own wire id and `providerModelId` is therefore unavailable
19160
+ * as the lineage link. Pure provenance: it names a sibling `modelId` in the
19161
+ * same provider and never reaches a request, so the variant keeps sending its
19162
+ * own upstream id while inheriting the base's class and benchmark evidence.
19163
+ */
19164
+ variantOf: external_exports.string().min(1).optional(),
19106
19165
  serviceTier: external_exports.literal("priority").optional(),
19107
19166
  cursorMaxMode: external_exports.literal(true).optional(),
19108
19167
  quotaScope: external_exports.enum(GATEWAY_QUOTA_SCOPES).optional(),
@@ -19125,7 +19184,8 @@ var GatewayModelsRegistrySchema = external_exports.object({
19125
19184
  cursor: GatewayProviderSchema,
19126
19185
  kimi: GatewayProviderSchema,
19127
19186
  opencode: GatewayProviderSchema,
19128
- xai: GatewayProviderSchema
19187
+ xai: GatewayProviderSchema,
19188
+ antigravity: GatewayProviderSchema
19129
19189
  }).strict(),
19130
19190
  pricing: GatewayPricingRegistrySchema
19131
19191
  }).strict();
@@ -19151,7 +19211,6 @@ var registry2 = (() => {
19151
19211
  return parsed;
19152
19212
  })();
19153
19213
  registry2.updatedAt;
19154
- registry2.pricing.observedAt;
19155
19214
  Object.freeze(
19156
19215
  Object.fromEntries(
19157
19216
  Object.entries(registry2.pricing.models).map(([modelId, pricing]) => [
@@ -19301,8 +19360,24 @@ function validateRegistry(value) {
19301
19360
  if (!isRoutingAlias && !model.capabilityClass) {
19302
19361
  throw new Error(`Gateway model is missing a capability class: ${provider}/${model.modelId}`);
19303
19362
  }
19304
- if (!isRoutingAlias && model.providerModelId) {
19305
- const base = definition.models.find((candidate) => candidate.modelId === model.providerModelId);
19363
+ const catalogEntry = (modelId) => modelId === void 0 ? void 0 : definition.models.find((candidate) => candidate.modelId === modelId);
19364
+ const providerLinkedBase = isRoutingAlias ? void 0 : catalogEntry(model.providerModelId);
19365
+ if (model.variantOf && providerLinkedBase && model.providerModelId !== model.variantOf) {
19366
+ throw new Error(`Gateway service-tier sibling names two different bases: ${provider}/${model.modelId}`);
19367
+ }
19368
+ if (model.variantOf === model.modelId) {
19369
+ throw new Error(`Gateway service-tier sibling names itself as its base: ${provider}/${model.modelId}`);
19370
+ }
19371
+ const baseModelId = isRoutingAlias ? void 0 : model.variantOf ?? model.providerModelId;
19372
+ if (baseModelId) {
19373
+ const base = catalogEntry(baseModelId);
19374
+ if (model.variantOf && !base) {
19375
+ throw new Error(`Gateway service-tier sibling names an unknown base: ${provider}/${model.modelId} -> ${model.variantOf}`);
19376
+ }
19377
+ const baseLink = base && base.modelId !== base.providerModelId ? base.variantOf ?? base.providerModelId : base?.variantOf;
19378
+ if (base && catalogEntry(baseLink)) {
19379
+ throw new Error(`Gateway service-tier sibling names another sibling as its base: ${provider}/${model.modelId}`);
19380
+ }
19306
19381
  if (base && base.capabilityClass !== model.capabilityClass) {
19307
19382
  throw new Error(`Gateway service-tier sibling class differs from its base: ${provider}/${model.modelId}`);
19308
19383
  }
@@ -19343,8 +19418,8 @@ function validateRegistry(value) {
19343
19418
  }
19344
19419
  }
19345
19420
  if (exactModelIds) {
19346
- if (provider !== "cursor") {
19347
- throw new Error(`Gateway effort model id overrides are only supported by Cursor: ${provider}/${model.modelId}`);
19421
+ if (provider !== "cursor" && provider !== "antigravity") {
19422
+ throw new Error(`Gateway effort model id overrides are only supported by Cursor and Antigravity: ${provider}/${model.modelId}`);
19348
19423
  }
19349
19424
  for (const effort of Object.keys(exactModelIds)) {
19350
19425
  if (!model.effort.levels.includes(effort)) {
@@ -19403,63 +19478,375 @@ function findCauseCode(error51) {
19403
19478
  return void 0;
19404
19479
  }
19405
19480
  new TextEncoder().encode(": keep-alive\n\n");
19406
- var MS_PER_HOUR = 36e5;
19407
- var CADENCE_SESSION_MAX_MS = 20 * MS_PER_HOUR;
19408
- var CADENCE_DAILY_MAX_MS = 3 * 24 * MS_PER_HOUR;
19409
- var CADENCE_WEEKLY_MAX_MS = 20 * 24 * MS_PER_HOUR;
19410
- var MIN_ELAPSED_FRACTION = 0.05;
19411
- var PACE_CRITICAL = 1.5;
19412
- var PACE_ELEVATED = 1.1;
19413
- var USED_CRITICAL_PERCENT = 95;
19414
- var USED_ELEVATED_PERCENT = 80;
19415
- function quotaWindowCadence(durationMs) {
19416
- if (durationMs <= CADENCE_SESSION_MAX_MS) return "session";
19417
- if (durationMs <= CADENCE_DAILY_MAX_MS) return "daily";
19418
- if (durationMs <= CADENCE_WEEKLY_MAX_MS) return "weekly";
19419
- return "monthly";
19481
+ var execFileAsync = promisify(execFile);
19482
+ var MAX_CREDENTIAL_BYTES = 65536;
19483
+ var CREDENTIAL_OPEN_FLAGS = process.platform === "win32" ? constants.O_RDONLY : constants.O_RDONLY | constants.O_NONBLOCK;
19484
+ async function readBoundedFile(filePath, maxBytes) {
19485
+ const handle = await fs22.open(filePath, CREDENTIAL_OPEN_FLAGS);
19486
+ try {
19487
+ const stat2 = await handle.stat();
19488
+ if (!stat2.isFile() || stat2.size > maxBytes) return null;
19489
+ const buffer = Buffer.allocUnsafe(maxBytes + 1);
19490
+ let totalBytes = 0;
19491
+ while (totalBytes < buffer.byteLength) {
19492
+ const { bytesRead } = await handle.read(
19493
+ buffer,
19494
+ totalBytes,
19495
+ buffer.byteLength - totalBytes,
19496
+ totalBytes
19497
+ );
19498
+ if (bytesRead === 0) break;
19499
+ totalBytes += bytesRead;
19500
+ }
19501
+ return totalBytes > maxBytes ? null : buffer.subarray(0, totalBytes).toString("utf8");
19502
+ } finally {
19503
+ await handle.close();
19504
+ }
19420
19505
  }
19421
- function windowPressure(usedPercent, paceRatio) {
19422
- if (usedPercent >= USED_CRITICAL_PERCENT || paceRatio !== void 0 && paceRatio >= PACE_CRITICAL) {
19423
- return "critical";
19506
+ var defaultCredentialDeps = {
19507
+ platform: process.platform,
19508
+ homedir: os4.homedir,
19509
+ env: process.env,
19510
+ readBounded: readBoundedFile,
19511
+ execFile: async (file2, args, options) => {
19512
+ const result = await execFileAsync(file2, [...args], options);
19513
+ return result.stdout;
19424
19514
  }
19425
- if (usedPercent >= USED_ELEVATED_PERCENT || paceRatio !== void 0 && paceRatio >= PACE_ELEVATED) {
19426
- return "elevated";
19515
+ };
19516
+ function credentialRecord(value) {
19517
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
19518
+ }
19519
+ function optionalTrimmedString(value) {
19520
+ if (typeof value !== "string") return void 0;
19521
+ const trimmed = value.trim();
19522
+ return trimmed.length > 0 ? trimmed : void 0;
19523
+ }
19524
+ var ANTIGRAVITY_KEYCHAIN_SERVICE = "gemini";
19525
+ var ANTIGRAVITY_KEYCHAIN_ACCOUNT = "antigravity";
19526
+ var GO_KEYRING_BASE64_PREFIX = "go-keyring-base64:";
19527
+ var ANTIGRAVITY_CLI_BINARY = "agy";
19528
+ var ANTIGRAVITY_CLI_REFRESH_ARGS = ["models"];
19529
+ var ANTIGRAVITY_DAILY_API = "https://daily-cloudcode-pa.googleapis.com";
19530
+ var ANTIGRAVITY_PROD_API = "https://cloudcode-pa.googleapis.com";
19531
+ var ANTIGRAVITY_IDE_VERSION = "2.5.5";
19532
+ var ARCH_LABELS = Object.freeze({
19533
+ x64: "amd64",
19534
+ arm64: "arm64",
19535
+ ia32: "386"
19536
+ });
19537
+ function antigravityUserAgent(platform = process.platform, arch = process.arch) {
19538
+ const osType = platform === "win32" ? "windows" : platform;
19539
+ const archLabel = ARCH_LABELS[arch] ?? arch;
19540
+ return `antigravity/ide/${ANTIGRAVITY_IDE_VERSION} (os_type=${osType}; arch=${archLabel}; aidev_client; auth_method=oauth)`;
19541
+ }
19542
+ var ANTIGRAVITY_REFRESH_BUFFER_MS = 6e4;
19543
+ var VENDOR_REFRESH_TIMEOUT_MS = 2e4;
19544
+ var KEYCHAIN_TIMEOUT_MS = 5e3;
19545
+ var WINDOWS_CREDENTIAL_TIMEOUT_MS = 15e3;
19546
+ var vendorRefreshInFlight = /* @__PURE__ */ new Map();
19547
+ function expiry(value) {
19548
+ if (typeof value === "number" && Number.isFinite(value)) {
19549
+ return value < 1e12 ? Math.round(value * 1e3) : Math.round(value);
19427
19550
  }
19428
- return "ok";
19551
+ if (typeof value !== "string") return void 0;
19552
+ const parsed = Date.parse(value);
19553
+ return Number.isFinite(parsed) ? parsed : void 0;
19429
19554
  }
19430
- function deriveQuotaWindowRisk(window, at) {
19431
- const durationMs = window.period?.durationMs;
19432
- if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs <= 0) {
19433
- return { pressure: windowPressure(window.usedPercent, void 0) };
19555
+ function firstString(source, keys) {
19556
+ for (const key of keys) {
19557
+ const value = optionalTrimmedString(source[key]);
19558
+ if (value !== void 0) return value;
19434
19559
  }
19435
- const startsAt = window.period?.startsAt ?? (window.resetsAt !== void 0 && window.resetsAt > durationMs ? window.resetsAt - durationMs : void 0);
19436
- const resetBoundary = window.resetsAt ?? (startsAt !== void 0 ? startsAt + durationMs : void 0);
19437
- const stale = resetBoundary !== void 0 && at > resetBoundary;
19438
- let elapsedFraction;
19439
- let paceRatio;
19440
- let projectedExhaustionAt;
19441
- if (startsAt !== void 0 && resetBoundary !== void 0 && !stale && at > startsAt) {
19442
- const elapsed = Math.min(1, (at - startsAt) / durationMs);
19443
- elapsedFraction = Math.round(elapsed * 100) / 100;
19444
- if (elapsed >= MIN_ELAPSED_FRACTION) {
19445
- const used = Math.min(1, Math.max(0, window.usedPercent / 100));
19446
- paceRatio = Math.round(used / elapsed * 100) / 100;
19447
- if (used > 0 && used < 1) {
19448
- const exhaustionAt = startsAt + Math.round((at - startsAt) / used);
19449
- if (exhaustionAt < resetBoundary) projectedExhaustionAt = exhaustionAt;
19450
- }
19560
+ return void 0;
19561
+ }
19562
+ function parseAntigravityKeychainValue(raw) {
19563
+ let body = raw.trim();
19564
+ if (body.length === 0) return null;
19565
+ if (body.startsWith(GO_KEYRING_BASE64_PREFIX)) {
19566
+ try {
19567
+ body = Buffer.from(body.slice(GO_KEYRING_BASE64_PREFIX.length), "base64").toString("utf8");
19568
+ } catch {
19569
+ return null;
19451
19570
  }
19452
19571
  }
19572
+ if (/^bearer /i.test(body)) body = body.slice(7).trim();
19573
+ if (!body.startsWith("{")) {
19574
+ return body.length > 0 ? { accessToken: body } : null;
19575
+ }
19576
+ let parsed;
19577
+ try {
19578
+ parsed = JSON.parse(body);
19579
+ } catch {
19580
+ return null;
19581
+ }
19582
+ const root = credentialRecord(parsed);
19583
+ if (!root) return null;
19584
+ const source = credentialRecord(root.token) ?? credentialRecord(root.tokens) ?? credentialRecord(root.oauth) ?? credentialRecord(root.oauth2) ?? credentialRecord(root.credentials) ?? credentialRecord(root.auth) ?? root;
19585
+ const accessToken = firstString(source, [
19586
+ "access_token",
19587
+ "accessToken",
19588
+ "token",
19589
+ "id_token",
19590
+ "idToken",
19591
+ "bearerToken",
19592
+ "auth_token",
19593
+ "authToken"
19594
+ ]);
19595
+ const refreshToken2 = firstString(source, ["refresh_token", "refreshToken"]);
19596
+ const expiresAt = expiry(source.expiry) ?? expiry(source.expires_at) ?? expiry(source.expiresAt);
19597
+ if (!accessToken && !refreshToken2) return null;
19453
19598
  return {
19454
- cadence: quotaWindowCadence(durationMs),
19455
- ...elapsedFraction !== void 0 ? { elapsedFraction } : {},
19456
- ...paceRatio !== void 0 ? { paceRatio } : {},
19457
- ...projectedExhaustionAt !== void 0 ? { projectedExhaustionAt } : {},
19458
- recoveryHalfLifeMs: Math.round(durationMs / 2),
19459
- pressure: windowPressure(window.usedPercent, paceRatio)
19599
+ ...accessToken === void 0 ? {} : { accessToken },
19600
+ ...refreshToken2 === void 0 ? {} : { refreshToken: refreshToken2 },
19601
+ ...expiresAt === void 0 ? {} : { expiresAt }
19602
+ };
19603
+ }
19604
+ var WINDOWS_CREDENTIAL_TARGET = `${ANTIGRAVITY_KEYCHAIN_SERVICE}:${ANTIGRAVITY_KEYCHAIN_ACCOUNT}`;
19605
+ var WINDOWS_CREDENTIAL_READER = `$ErrorActionPreference = 'Stop'
19606
+ Add-Type -TypeDefinition @'
19607
+ using System;
19608
+ using System.Runtime.InteropServices;
19609
+ public static class FleetAntigravityCredential {
19610
+ [DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Unicode, EntryPoint="CredReadW")]
19611
+ private static extern bool CredRead(string target, uint type, uint flags, out IntPtr credential);
19612
+ [DllImport("advapi32.dll")]
19613
+ private static extern void CredFree(IntPtr credential);
19614
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
19615
+ private struct CREDENTIAL {
19616
+ public uint Flags; public uint Type; public IntPtr TargetName; public IntPtr Comment;
19617
+ public long LastWritten; public uint CredentialBlobSize; public IntPtr CredentialBlob;
19618
+ public uint Persist; public uint AttributeCount; public IntPtr Attributes;
19619
+ public IntPtr TargetAlias; public IntPtr UserName;
19620
+ }
19621
+ public static string Read(string target) {
19622
+ IntPtr handle;
19623
+ if (!CredRead(target, 1, 0, out handle)) return "";
19624
+ try {
19625
+ CREDENTIAL cred = (CREDENTIAL)Marshal.PtrToStructure(handle, typeof(CREDENTIAL));
19626
+ byte[] blob = new byte[cred.CredentialBlobSize];
19627
+ Marshal.Copy(cred.CredentialBlob, blob, 0, (int)cred.CredentialBlobSize);
19628
+ return Convert.ToBase64String(blob);
19629
+ } finally { CredFree(handle); }
19630
+ }
19631
+ }
19632
+ '@
19633
+ [Console]::Out.Write([FleetAntigravityCredential]::Read('${WINDOWS_CREDENTIAL_TARGET}'))
19634
+ `;
19635
+ function windowsPowerShell(deps) {
19636
+ const systemRoot = optionalTrimmedString(deps.env.SystemRoot);
19637
+ return systemRoot === void 0 ? "powershell.exe" : path42.win32.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
19638
+ }
19639
+ async function readKeychainValue(deps) {
19640
+ if (deps.platform === "darwin") {
19641
+ const raw = await deps.execFile(
19642
+ "security",
19643
+ [
19644
+ "find-generic-password",
19645
+ "-s",
19646
+ ANTIGRAVITY_KEYCHAIN_SERVICE,
19647
+ "-a",
19648
+ ANTIGRAVITY_KEYCHAIN_ACCOUNT,
19649
+ "-w"
19650
+ ],
19651
+ { timeout: KEYCHAIN_TIMEOUT_MS }
19652
+ );
19653
+ return raw.length > MAX_CREDENTIAL_BYTES ? null : raw;
19654
+ }
19655
+ if (deps.platform === "linux") {
19656
+ const raw = await deps.execFile(
19657
+ "secret-tool",
19658
+ [
19659
+ "lookup",
19660
+ "service",
19661
+ ANTIGRAVITY_KEYCHAIN_SERVICE,
19662
+ "username",
19663
+ ANTIGRAVITY_KEYCHAIN_ACCOUNT
19664
+ ],
19665
+ { timeout: KEYCHAIN_TIMEOUT_MS }
19666
+ );
19667
+ return raw.length > MAX_CREDENTIAL_BYTES ? null : raw;
19668
+ }
19669
+ if (deps.platform === "win32") {
19670
+ const encoded = await deps.execFile(
19671
+ windowsPowerShell(deps),
19672
+ [
19673
+ "-NoProfile",
19674
+ "-NonInteractive",
19675
+ "-EncodedCommand",
19676
+ // `-EncodedCommand` takes UTF-16LE base64, which is what keeps a script
19677
+ // full of quotes and `$` out of Windows command-line quoting entirely.
19678
+ Buffer.from(WINDOWS_CREDENTIAL_READER, "utf16le").toString("base64")
19679
+ ],
19680
+ { timeout: WINDOWS_CREDENTIAL_TIMEOUT_MS }
19681
+ );
19682
+ const blob = encoded.trim();
19683
+ if (blob.length === 0) return null;
19684
+ const raw = Buffer.from(blob, "base64").toString("utf8");
19685
+ return raw.length > MAX_CREDENTIAL_BYTES ? null : raw;
19686
+ }
19687
+ return null;
19688
+ }
19689
+ function spawnVendorRefresh(deps) {
19690
+ const binary = optionalTrimmedString(deps.env.FLEET_ANTIGRAVITY_CLI) ?? ANTIGRAVITY_CLI_BINARY;
19691
+ return new Promise((resolve) => {
19692
+ let child;
19693
+ try {
19694
+ child = spawn(binary, [...ANTIGRAVITY_CLI_REFRESH_ARGS], { stdio: "ignore" });
19695
+ } catch {
19696
+ resolve();
19697
+ return;
19698
+ }
19699
+ let settled = false;
19700
+ const finish = () => {
19701
+ if (settled) return;
19702
+ settled = true;
19703
+ clearTimeout(timer);
19704
+ resolve();
19705
+ };
19706
+ const timer = setTimeout(() => {
19707
+ child.kill("SIGKILL");
19708
+ finish();
19709
+ }, VENDOR_REFRESH_TIMEOUT_MS);
19710
+ child.once("error", finish);
19711
+ child.once("close", finish);
19712
+ });
19713
+ }
19714
+ async function runVendorRefresh(deps, refresh) {
19715
+ const binary = optionalTrimmedString(deps.env.FLEET_ANTIGRAVITY_CLI) ?? ANTIGRAVITY_CLI_BINARY;
19716
+ const key = `${binary}\0${deps.homedir()}`;
19717
+ const existing = vendorRefreshInFlight.get(key);
19718
+ if (existing) return existing;
19719
+ const task = refresh(deps).catch(() => void 0).finally(() => {
19720
+ vendorRefreshInFlight.delete(key);
19721
+ });
19722
+ vendorRefreshInFlight.set(key, task);
19723
+ return task;
19724
+ }
19725
+ async function resolveAntigravityAuth(deps, options = {}) {
19726
+ const now = options.now ?? Date.now;
19727
+ const read = async () => {
19728
+ let raw;
19729
+ try {
19730
+ raw = await readKeychainValue(deps);
19731
+ } catch {
19732
+ return null;
19733
+ }
19734
+ return raw === null ? null : parseAntigravityKeychainValue(raw);
19735
+ };
19736
+ const usable = (token) => {
19737
+ if (!token.accessToken) return null;
19738
+ if (token.expiresAt !== void 0 && token.expiresAt <= now()) return null;
19739
+ return {
19740
+ status: "ok",
19741
+ credentials: {
19742
+ accessToken: token.accessToken,
19743
+ method: "keychain",
19744
+ ...token.expiresAt === void 0 ? {} : { expiresAt: token.expiresAt }
19745
+ }
19746
+ };
19460
19747
  };
19748
+ const stored = await read();
19749
+ if (!stored) return { status: "signed_out" };
19750
+ const stale = stored.expiresAt !== void 0 && stored.expiresAt - now() <= ANTIGRAVITY_REFRESH_BUFFER_MS;
19751
+ if (options.forceRefresh !== true && !stale) {
19752
+ const ready2 = usable(stored);
19753
+ if (ready2) return ready2;
19754
+ }
19755
+ if (!stored.refreshToken) {
19756
+ return usable(stored) ?? { status: stored.accessToken ? "expired" : "signed_out" };
19757
+ }
19758
+ await runVendorRefresh(deps, options.refreshVendorCredential ?? spawnVendorRefresh);
19759
+ const renewed = await read();
19760
+ const ready = renewed ? usable(renewed) : null;
19761
+ if (ready) return ready;
19762
+ return { status: "expired" };
19461
19763
  }
19764
+ var ANTIGRAVITY_LOAD_CODE_ASSIST_URL = `${ANTIGRAVITY_PROD_API}/v1internal:loadCodeAssist`;
19462
19765
  var REQUEST_TIMEOUT_MS = 1e4;
19766
+ var ANTIGRAVITY_CODE_ASSIST_TTL_MS = 36e5;
19767
+ var MAX_PROJECT_ID_LENGTH = 128;
19768
+ var TIER_LABELS = Object.freeze({
19769
+ "free-tier": "Free",
19770
+ "legacy-tier": "Legacy",
19771
+ "standard-tier": "Standard",
19772
+ "g1-pro-tier": "Pro",
19773
+ "g1-ultra-tier": "Ultra"
19774
+ });
19775
+ function antigravityPlanLabel(tierId) {
19776
+ const id = optionalTrimmedString(tierId)?.toLowerCase();
19777
+ if (!id) return void 0;
19778
+ const known = TIER_LABELS[id];
19779
+ if (known) return known;
19780
+ const bare = id.replace(/-tier$/, "").replace(/[-_]+/g, " ").trim();
19781
+ if (bare.length === 0 || bare.length > 24 || !/^[a-z0-9][a-z0-9 .+-]*$/.test(bare)) return void 0;
19782
+ return bare.replace(/(^|\s)([a-z0-9])/g, (_, lead, char) => `${lead}${char.toUpperCase()}`);
19783
+ }
19784
+ function projectId(value) {
19785
+ const id = optionalTrimmedString(value);
19786
+ if (!id || id.length > MAX_PROJECT_ID_LENGTH) return void 0;
19787
+ return /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(id) ? id : void 0;
19788
+ }
19789
+ async function loadAntigravityCodeAssist(fetchImpl, accessToken, signal) {
19790
+ const controller = new AbortController();
19791
+ const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
19792
+ const onAbort = () => controller.abort();
19793
+ signal?.addEventListener("abort", onAbort, { once: true });
19794
+ try {
19795
+ const response = await fetchImpl(ANTIGRAVITY_LOAD_CODE_ASSIST_URL, {
19796
+ method: "POST",
19797
+ headers: {
19798
+ Accept: "application/json",
19799
+ "Content-Type": "application/json",
19800
+ Authorization: `Bearer ${accessToken}`,
19801
+ "User-Agent": antigravityUserAgent()
19802
+ },
19803
+ body: JSON.stringify({ metadata: { ideType: "ANTIGRAVITY" } }),
19804
+ signal: controller.signal
19805
+ });
19806
+ if (!response.ok) {
19807
+ await response.body?.cancel().catch(() => void 0);
19808
+ return {};
19809
+ }
19810
+ const payload = credentialRecord(await response.json());
19811
+ if (!payload) return {};
19812
+ const project = projectId(payload.cloudaicompanionProject);
19813
+ const plan = antigravityPlanLabel(credentialRecord(payload.currentTier)?.id);
19814
+ return {
19815
+ ...project === void 0 ? {} : { projectId: project },
19816
+ ...plan === void 0 ? {} : { plan }
19817
+ };
19818
+ } catch {
19819
+ return {};
19820
+ } finally {
19821
+ clearTimeout(timer);
19822
+ signal?.removeEventListener("abort", onAbort);
19823
+ }
19824
+ }
19825
+ function createAntigravityCodeAssistCache(now = Date.now, ttlMs = ANTIGRAVITY_CODE_ASSIST_TTL_MS) {
19826
+ let entry;
19827
+ let inFlight;
19828
+ return {
19829
+ async read(fetchImpl, accessToken, signal) {
19830
+ if (entry && entry.token === accessToken && entry.expiresAt > now()) return entry.value;
19831
+ if (inFlight && inFlight.token === accessToken) return inFlight.task;
19832
+ const task = loadAntigravityCodeAssist(fetchImpl, accessToken, signal).then((value) => {
19833
+ if (value.projectId !== void 0 || value.plan !== void 0) {
19834
+ entry = { token: accessToken, value, expiresAt: now() + ttlMs };
19835
+ }
19836
+ return value;
19837
+ }).finally(() => {
19838
+ if (inFlight?.token === accessToken) inFlight = void 0;
19839
+ });
19840
+ inFlight = { token: accessToken, task };
19841
+ return task;
19842
+ },
19843
+ clear() {
19844
+ entry = void 0;
19845
+ inFlight = void 0;
19846
+ }
19847
+ };
19848
+ }
19849
+ var REQUEST_TIMEOUT_MS2 = 1e4;
19463
19850
  var MAX_RESPONSE_BYTES = 262144;
19464
19851
  var MAX_WINDOWS = 8;
19465
19852
  var MAX_CREDIT_ENTRIES = 256;
@@ -19548,7 +19935,7 @@ function modelLabel(value) {
19548
19935
  }
19549
19936
  async function requestJson(fetchImpl, url2, init) {
19550
19937
  const controller = new AbortController();
19551
- const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
19938
+ const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS2);
19552
19939
  try {
19553
19940
  const response = await fetchImpl(url2, {
19554
19941
  ...init,
@@ -19618,48 +20005,171 @@ function sanitizeProviderError(error51) {
19618
20005
  }
19619
20006
  return "Provider request failed";
19620
20007
  }
19621
- var execFileAsync = promisify(execFile);
19622
- var MAX_CREDENTIAL_BYTES = 65536;
19623
- var CREDENTIAL_OPEN_FLAGS = process.platform === "win32" ? constants.O_RDONLY : constants.O_RDONLY | constants.O_NONBLOCK;
19624
- async function readBoundedFile(filePath, maxBytes) {
19625
- const handle = await fs22.open(filePath, CREDENTIAL_OPEN_FLAGS);
20008
+ var ANTIGRAVITY_QUOTA_SUMMARY_URLS = Object.freeze([
20009
+ `${ANTIGRAVITY_DAILY_API}/v1internal:retrieveUserQuotaSummary`,
20010
+ `${ANTIGRAVITY_PROD_API}/v1internal:retrieveUserQuotaSummary`
20011
+ ]);
20012
+ var SESSION_MS = 5 * HOUR_MS;
20013
+ var BUCKETS = Object.freeze({
20014
+ "gemini-5h": { id: "session", label: "Gemini", durationMs: SESSION_MS, reported: true },
20015
+ "gemini-weekly": { id: "weekly", label: "Gemini", durationMs: WEEK_MS, reported: true },
20016
+ "3p-5h": { id: "session", label: "Claude & GPT", durationMs: SESSION_MS, reported: false },
20017
+ "3p-weekly": { id: "weekly", label: "Claude & GPT", durationMs: WEEK_MS, reported: false }
20018
+ });
20019
+ var BUCKET_ORDER = Object.freeze(
20020
+ Object.keys(BUCKETS).filter((bucketId) => BUCKETS[bucketId]?.reported === true)
20021
+ );
20022
+ function usedPercentFromRemaining(value) {
20023
+ if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
20024
+ const clamped = Math.min(1, Math.max(0, value));
20025
+ return Math.round((1 - clamped) * 100);
20026
+ }
20027
+ function parseAntigravityQuotaSummary(payload) {
20028
+ const root = object2(payload);
20029
+ const groups = array2(root?.groups ?? object2(root?.response)?.groups);
20030
+ if (root === null) return null;
20031
+ if (!Array.isArray(root.groups) && !Array.isArray(object2(root.response)?.groups)) return null;
20032
+ const byBucket = /* @__PURE__ */ new Map();
20033
+ for (const rawGroup of groups) {
20034
+ for (const rawBucket of array2(object2(rawGroup)?.buckets)) {
20035
+ const bucket = object2(rawBucket);
20036
+ const bucketId = typeof bucket?.bucketId === "string" ? bucket.bucketId.trim() : "";
20037
+ const known = BUCKETS[bucketId];
20038
+ if (!known?.reported || byBucket.has(bucketId)) continue;
20039
+ const usedPercent = usedPercentFromRemaining(bucket?.remainingFraction);
20040
+ if (usedPercent === void 0) continue;
20041
+ const resetsAt = safeTimestamp(bucket?.resetTime);
20042
+ const period = windowPeriod(known.durationMs, "catalog", resetsAt);
20043
+ byBucket.set(bucketId, {
20044
+ id: known.id,
20045
+ label: known.label,
20046
+ usedPercent,
20047
+ ...resetsAt === void 0 ? {} : { resetsAt },
20048
+ ...period === void 0 ? {} : { period }
20049
+ });
20050
+ }
20051
+ }
20052
+ return BUCKET_ORDER.flatMap((bucketId) => {
20053
+ const window = byBucket.get(bucketId);
20054
+ return window ? [window] : [];
20055
+ });
20056
+ }
20057
+ function quotaHeaders(credentials) {
20058
+ return {
20059
+ Accept: "application/json",
20060
+ "Content-Type": "application/json",
20061
+ Authorization: `Bearer ${credentials.accessToken}`,
20062
+ "User-Agent": antigravityUserAgent()
20063
+ };
20064
+ }
20065
+ var codeAssistCache = createAntigravityCodeAssistCache();
20066
+ async function fetchAntigravityUsage(deps = {}) {
20067
+ const credentialDeps = deps.credentials ?? defaultCredentialDeps;
20068
+ const now = deps.now ?? Date.now;
20069
+ const fetchImpl = deps.fetch ?? fetch;
20070
+ const auth = await resolveAntigravityAuth(credentialDeps, { now });
20071
+ if (auth.status !== "ok") return { status: auth.status };
20072
+ const load = async (credentials) => {
20073
+ let lastError;
20074
+ for (const url2 of ANTIGRAVITY_QUOTA_SUMMARY_URLS) {
20075
+ try {
20076
+ return await postJson(fetchImpl, url2, quotaHeaders(credentials));
20077
+ } catch (error51) {
20078
+ if (expired(error51)) throw error51;
20079
+ lastError = error51;
20080
+ }
20081
+ }
20082
+ throw lastError;
20083
+ };
19626
20084
  try {
19627
- const stat2 = await handle.stat();
19628
- if (!stat2.isFile() || stat2.size > maxBytes) return null;
19629
- const buffer = Buffer.allocUnsafe(maxBytes + 1);
19630
- let totalBytes = 0;
19631
- while (totalBytes < buffer.byteLength) {
19632
- const { bytesRead } = await handle.read(
19633
- buffer,
19634
- totalBytes,
19635
- buffer.byteLength - totalBytes,
19636
- totalBytes
19637
- );
19638
- if (bytesRead === 0) break;
19639
- totalBytes += bytesRead;
20085
+ let credentials = auth.credentials;
20086
+ let payload;
20087
+ try {
20088
+ payload = await load(credentials);
20089
+ } catch (error51) {
20090
+ if (!expired(error51)) throw error51;
20091
+ const retried = await resolveAntigravityAuth(credentialDeps, { now, forceRefresh: true });
20092
+ if (retried.status !== "ok") return { status: "expired" };
20093
+ credentials = retried.credentials;
20094
+ try {
20095
+ payload = await load(credentials);
20096
+ } catch (retryError) {
20097
+ const result = expired(retryError);
20098
+ if (result) return result;
20099
+ throw retryError;
20100
+ }
19640
20101
  }
19641
- return totalBytes > maxBytes ? null : buffer.subarray(0, totalBytes).toString("utf8");
19642
- } finally {
19643
- await handle.close();
20102
+ const windows = parseAntigravityQuotaSummary(payload);
20103
+ if (!windows) throw new Error("Antigravity returned an unsupported quota response");
20104
+ const plan = (await codeAssistCache.read(fetchImpl, credentials.accessToken)).plan;
20105
+ return {
20106
+ status: "ok",
20107
+ method: credentials.method,
20108
+ ...plan ? { plan } : {},
20109
+ windows,
20110
+ fetchedAt: now()
20111
+ };
20112
+ } catch (error51) {
20113
+ const result = expired(error51);
20114
+ if (result) return result;
20115
+ throw error51;
19644
20116
  }
19645
20117
  }
19646
- var defaultCredentialDeps = {
19647
- platform: process.platform,
19648
- homedir: os4.homedir,
19649
- env: process.env,
19650
- readBounded: readBoundedFile,
19651
- execFile: async (file2, args, options) => {
19652
- const result = await execFileAsync(file2, [...args], options);
19653
- return result.stdout;
20118
+ var MS_PER_HOUR = 36e5;
20119
+ var CADENCE_SESSION_MAX_MS = 20 * MS_PER_HOUR;
20120
+ var CADENCE_DAILY_MAX_MS = 3 * 24 * MS_PER_HOUR;
20121
+ var CADENCE_WEEKLY_MAX_MS = 20 * 24 * MS_PER_HOUR;
20122
+ var MIN_ELAPSED_FRACTION = 0.05;
20123
+ var PACE_CRITICAL = 1.5;
20124
+ var PACE_ELEVATED = 1.1;
20125
+ var USED_CRITICAL_PERCENT = 95;
20126
+ var USED_ELEVATED_PERCENT = 80;
20127
+ function quotaWindowCadence(durationMs) {
20128
+ if (durationMs <= CADENCE_SESSION_MAX_MS) return "session";
20129
+ if (durationMs <= CADENCE_DAILY_MAX_MS) return "daily";
20130
+ if (durationMs <= CADENCE_WEEKLY_MAX_MS) return "weekly";
20131
+ return "monthly";
20132
+ }
20133
+ function windowPressure(usedPercent, paceRatio) {
20134
+ if (usedPercent >= USED_CRITICAL_PERCENT || paceRatio !== void 0 && paceRatio >= PACE_CRITICAL) {
20135
+ return "critical";
19654
20136
  }
19655
- };
19656
- function credentialRecord(value) {
19657
- return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
20137
+ if (usedPercent >= USED_ELEVATED_PERCENT || paceRatio !== void 0 && paceRatio >= PACE_ELEVATED) {
20138
+ return "elevated";
20139
+ }
20140
+ return "ok";
19658
20141
  }
19659
- function optionalTrimmedString(value) {
19660
- if (typeof value !== "string") return void 0;
19661
- const trimmed = value.trim();
19662
- return trimmed.length > 0 ? trimmed : void 0;
20142
+ function deriveQuotaWindowRisk(window, at) {
20143
+ const durationMs = window.period?.durationMs;
20144
+ if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs <= 0) {
20145
+ return { pressure: windowPressure(window.usedPercent, void 0) };
20146
+ }
20147
+ const startsAt = window.period?.startsAt ?? (window.resetsAt !== void 0 && window.resetsAt > durationMs ? window.resetsAt - durationMs : void 0);
20148
+ const resetBoundary = window.resetsAt ?? (startsAt !== void 0 ? startsAt + durationMs : void 0);
20149
+ const stale = resetBoundary !== void 0 && at > resetBoundary;
20150
+ let elapsedFraction;
20151
+ let paceRatio;
20152
+ let projectedExhaustionAt;
20153
+ if (startsAt !== void 0 && resetBoundary !== void 0 && !stale && at > startsAt) {
20154
+ const elapsed = Math.min(1, (at - startsAt) / durationMs);
20155
+ elapsedFraction = Math.round(elapsed * 100) / 100;
20156
+ if (elapsed >= MIN_ELAPSED_FRACTION) {
20157
+ const used = Math.min(1, Math.max(0, window.usedPercent / 100));
20158
+ paceRatio = Math.round(used / elapsed * 100) / 100;
20159
+ if (used > 0 && used < 1) {
20160
+ const exhaustionAt = startsAt + Math.round((at - startsAt) / used);
20161
+ if (exhaustionAt < resetBoundary) projectedExhaustionAt = exhaustionAt;
20162
+ }
20163
+ }
20164
+ }
20165
+ return {
20166
+ cadence: quotaWindowCadence(durationMs),
20167
+ ...elapsedFraction !== void 0 ? { elapsedFraction } : {},
20168
+ ...paceRatio !== void 0 ? { paceRatio } : {},
20169
+ ...projectedExhaustionAt !== void 0 ? { projectedExhaustionAt } : {},
20170
+ recoveryHalfLifeMs: Math.round(durationMs / 2),
20171
+ pressure: windowPressure(window.usedPercent, paceRatio)
20172
+ };
19663
20173
  }
19664
20174
  function optionalString(value) {
19665
20175
  return typeof value === "string" && value.length > 0 ? value : void 0;
@@ -19700,9 +20210,9 @@ async function resolveClaudeCredentials(deps) {
19700
20210
  } catch {
19701
20211
  }
19702
20212
  }
19703
- const configDir = deps.env.CLAUDE_CONFIG_DIR || path32.join(deps.homedir(), ".claude");
20213
+ const configDir = deps.env.CLAUDE_CONFIG_DIR || path42.join(deps.homedir(), ".claude");
19704
20214
  try {
19705
- const raw = await deps.readBounded(path32.join(configDir, ".credentials.json"), MAX_CREDENTIAL_BYTES);
20215
+ const raw = await deps.readBounded(path42.join(configDir, ".credentials.json"), MAX_CREDENTIAL_BYTES);
19706
20216
  return raw === null || raw.length > MAX_CREDENTIAL_BYTES ? null : parseClaudeCredentialJson(raw, "file");
19707
20217
  } catch {
19708
20218
  return null;
@@ -19813,7 +20323,7 @@ function optionalNonEmptyString(value) {
19813
20323
  return typeof value === "string" && value.length > 0 ? value : void 0;
19814
20324
  }
19815
20325
  function codexAuthFilePath(deps) {
19816
- return path32.join(deps.env.CODEX_HOME || path32.join(deps.homedir(), ".codex"), "auth.json");
20326
+ return path42.join(deps.env.CODEX_HOME || path42.join(deps.homedir(), ".codex"), "auth.json");
19817
20327
  }
19818
20328
  async function resolveCodexCredentials(deps) {
19819
20329
  try {
@@ -19874,9 +20384,9 @@ function parseResetCredits(payload) {
19874
20384
  for (let index = 0; index < credits.length && index < MAX_CREDIT_ENTRIES; index += 1) {
19875
20385
  const credit = object2(credits[index]);
19876
20386
  if (credit?.status !== "available") continue;
19877
- const expiry2 = safeTimestamp(credit.expires_at);
19878
- if (expiry2 !== void 0 && (nextExpiresAt === void 0 || expiry2 < nextExpiresAt)) {
19879
- nextExpiresAt = expiry2;
20387
+ const expiry3 = safeTimestamp(credit.expires_at);
20388
+ if (expiry3 !== void 0 && (nextExpiresAt === void 0 || expiry3 < nextExpiresAt)) {
20389
+ nextExpiresAt = expiry3;
19880
20390
  }
19881
20391
  }
19882
20392
  return {
@@ -19943,12 +20453,12 @@ function parseCursorCredentialJson(raw, method) {
19943
20453
  function cursorAuthFilePath(deps) {
19944
20454
  const home = deps.homedir();
19945
20455
  if (deps.platform === "win32") {
19946
- return path32.join(deps.env.APPDATA || path32.join(home, "AppData", "Roaming"), "Cursor", "auth.json");
20456
+ return path42.join(deps.env.APPDATA || path42.join(home, "AppData", "Roaming"), "Cursor", "auth.json");
19947
20457
  }
19948
20458
  if (deps.platform === "darwin") {
19949
- return path32.join(home, ".cursor", "auth.json");
20459
+ return path42.join(home, ".cursor", "auth.json");
19950
20460
  }
19951
- return path32.join(deps.env.XDG_CONFIG_HOME || path32.join(home, ".config"), "cursor", "auth.json");
20461
+ return path42.join(deps.env.XDG_CONFIG_HOME || path42.join(home, ".config"), "cursor", "auth.json");
19952
20462
  }
19953
20463
  async function resolveCursorCredentials(deps) {
19954
20464
  if (deps.platform === "darwin") {
@@ -20221,9 +20731,9 @@ var XAI_CLI_REFRESH_BUFFER_MS = 5 * 60 * 1e3;
20221
20731
  var REFRESH_TIMEOUT_MS = 15e3;
20222
20732
  var FALLBACK_ACCESS_TOKEN_TTL_MS = 36e5;
20223
20733
  function xaiCliAuthFilePath(deps) {
20224
- return path32.join(deps.env.GROK_HOME || path32.join(deps.homedir(), ".grok"), "auth.json");
20734
+ return path42.join(deps.env.GROK_HOME || path42.join(deps.homedir(), ".grok"), "auth.json");
20225
20735
  }
20226
- function expiry(value) {
20736
+ function expiry2(value) {
20227
20737
  if (typeof value !== "string" && typeof value !== "number") return void 0;
20228
20738
  const parsed = typeof value === "number" ? value : Date.parse(value);
20229
20739
  if (!Number.isFinite(parsed)) return void 0;
@@ -20243,7 +20753,7 @@ function jwtExpiry(token) {
20243
20753
  }
20244
20754
  }
20245
20755
  function effectiveExpiry(entry, accessToken) {
20246
- const fromEntry = expiry(entry.expires_at) ?? expiry(entry.expires);
20756
+ const fromEntry = expiry2(entry.expires_at) ?? expiry2(entry.expires);
20247
20757
  const fromJwt = jwtExpiry(accessToken);
20248
20758
  if (fromEntry !== void 0 && fromJwt !== void 0) return Math.min(fromEntry, fromJwt);
20249
20759
  return fromEntry ?? fromJwt;
@@ -20502,7 +21012,8 @@ function createAiGatewayQuotaCollectors(deps) {
20502
21012
  fetchCursor: () => fetchCursorUsage(providerDeps),
20503
21013
  fetchKimi: () => fetchKimiUsage(providerDeps),
20504
21014
  fetchOpencode: () => fetchOpencodeUsage(providerDeps),
20505
- fetchXai: () => fetchXaiUsage(providerDeps)
21015
+ fetchXai: () => fetchXaiUsage(providerDeps),
21016
+ fetchAntigravity: () => fetchAntigravityUsage(providerDeps)
20506
21017
  };
20507
21018
  }
20508
21019
  function isProviderSuccess(value) {
@@ -20516,7 +21027,8 @@ function createQuotaService(deps) {
20516
21027
  cursor: deps.fetchCursor,
20517
21028
  kimi: deps.fetchKimi,
20518
21029
  opencode: deps.fetchOpencode,
20519
- xai: deps.fetchXai ?? (async () => ({ status: "signed_out" }))
21030
+ xai: deps.fetchXai ?? (async () => ({ status: "signed_out" })),
21031
+ antigravity: deps.fetchAntigravity ?? (async () => ({ status: "signed_out" }))
20520
21032
  };
20521
21033
  const cache = /* @__PURE__ */ new Map();
20522
21034
  const lastGood = /* @__PURE__ */ new Map();
@@ -20559,13 +21071,14 @@ function createQuotaService(deps) {
20559
21071
  }
20560
21072
  return {
20561
21073
  async getSummary(options = {}) {
20562
- const [claude, codex, cursor, kimi, opencode, xai] = await Promise.all([
21074
+ const [claude, codex, cursor, kimi, opencode, xai, antigravity] = await Promise.all([
20563
21075
  load("claude", options.force === true || options.forceProvider === "claude"),
20564
21076
  load("codex", options.force === true || options.forceProvider === "codex"),
20565
21077
  load("cursor", options.force === true || options.forceProvider === "cursor"),
20566
21078
  load("kimi", options.force === true || options.forceProvider === "kimi"),
20567
21079
  load("opencode", options.force === true || options.forceProvider === "opencode"),
20568
- load("xai", options.force === true || options.forceProvider === "xai")
21080
+ load("xai", options.force === true || options.forceProvider === "xai"),
21081
+ load("antigravity", options.force === true || options.forceProvider === "antigravity")
20569
21082
  ]);
20570
21083
  return {
20571
21084
  providers: {
@@ -20574,7 +21087,8 @@ function createQuotaService(deps) {
20574
21087
  cursor: withRisk(cursor),
20575
21088
  kimi: withRisk(kimi),
20576
21089
  opencode: withRisk(opencode),
20577
- xai: withRisk(xai)
21090
+ xai: withRisk(xai),
21091
+ antigravity: withRisk(antigravity)
20578
21092
  }
20579
21093
  };
20580
21094
  }
@@ -21440,7 +21954,7 @@ messageDesc(cursorAgentFile, 70);
21440
21954
  new Set(REASONING_EFFORTS);
21441
21955
 
21442
21956
  // ../fleet-plugins/quota/provider-order.ts
21443
- var PROVIDER_ORDER_DEFAULT = ["claude", "codex", "xai", "cursor", "opencode", "kimi"];
21957
+ var PROVIDER_ORDER_DEFAULT = ["claude", "codex", "xai", "cursor", "opencode", "kimi", "antigravity"];
21444
21958
  function isProviderId(value) {
21445
21959
  return PROVIDER_ORDER_DEFAULT.includes(value);
21446
21960
  }