@estebanforge/pi-antigravity-bridge 1.13.3 → 1.15.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.
package/src/models.ts CHANGED
@@ -35,14 +35,15 @@ const DISCOVERY_TIMEOUT_MS = 8_000;
35
35
  * real output and 1 MiB dwarfs any encoding difference. */
36
36
  export const MODELS_OUTPUT_CAP_BYTES = 1024 * 1024;
37
37
 
38
- /** Reasoning-effort tiers agy accepts via --effort. */
39
- export type AgyEffort = "low" | "medium" | "high";
38
+ /** Reasoning-effort tiers agy accepts via --effort. xhigh exists on the
39
+ * Gemini 4 line (agy 1.5.16 catalog); other families walk down to high. */
40
+ export type AgyEffort = "low" | "medium" | "high" | "xhigh";
40
41
 
41
- /** low < medium < high, for sorting/clamping. */
42
- const EFFORT_RANK: Record<AgyEffort, number> = { low: 0, medium: 1, high: 2 };
42
+ /** low < medium < high < xhigh, for sorting/clamping. */
43
+ const EFFORT_RANK: Record<AgyEffort, number> = { low: 0, medium: 1, high: 2, xhigh: 3 };
43
44
 
44
45
  /** pi thinking-effort order mirrors agy's, for clamping. */
45
- export const AGY_EFFORT_ORDER: readonly AgyEffort[] = ["low", "medium", "high"];
46
+ export const AGY_EFFORT_ORDER: readonly AgyEffort[] = ["low", "medium", "high", "xhigh"];
46
47
 
47
48
  /** Map pi's thinking level onto one of the tiers `efforts` the base actually
48
49
  * supports, clamping to the nearest available. agy rejects an effort tier a
@@ -63,8 +64,10 @@ export function toAgyEffort(
63
64
  case "medium":
64
65
  candidate = "medium";
65
66
  break;
66
- case "high":
67
67
  case "xhigh":
68
+ candidate = "xhigh";
69
+ break;
70
+ case "high":
68
71
  case "max":
69
72
  candidate = "high";
70
73
  break;
@@ -86,7 +89,7 @@ export function toAgyEffort(
86
89
  * -high/-medium/-low suffix - a shape only unverified families should
87
90
  * produce now, and those stay whole. Every Claude slug carries a tier
88
91
  * suffix and collapses to its base. */
89
- const TIER_RE = /^(.+)-(high|medium|low)$/;
92
+ const TIER_RE = /^(.+)-(xhigh|high|medium|low)$/;
90
93
 
91
94
  /** agy emits clean slug ids (gemini-3.6-flash-high). Validate col1 of each
92
95
  * line so a banner / auth / "Fetching models…" line can't register as a
@@ -346,14 +349,16 @@ export function slugify(full: string): string {
346
349
 
347
350
  /** Build the thinkingLevelMap for an effort-driven base: hide "off" and
348
351
  * "minimal" always (agy has no no-thinking mode; a base REQUIRES an effort),
349
- * and hide any of low/medium/high the base doesn't offer (e.g. Pro has no
350
- * medium). pi's getSupportedThinkingLevels treats a null value as hidden, so
351
- * the toggle then shows exactly agy's slider stops. */
352
+ * and hide any of low/medium/high/xhigh the base doesn't offer (e.g. Pro has
353
+ * no medium). pi's getSupportedThinkingLevels treats a null value as hidden
354
+ * for low/medium/high, but xhigh additionally requires an EXPLICIT non-null
355
+ * entry to appear at all, so a base that ships xhigh maps it to itself. */
352
356
  function thinkingLevelMapFor(efforts: readonly AgyEffort[]): ThinkingLevelMap {
353
357
  const map: Record<string, string | null> = { off: null, minimal: null };
354
- for (const level of ["low", "medium", "high"] as const) {
358
+ for (const level of ["low", "medium", "high", "xhigh"] as const) {
355
359
  if (!efforts.includes(level)) map[level] = null;
356
360
  }
361
+ if (efforts.includes("xhigh")) map.xhigh = "xhigh";
357
362
  return map as ThinkingLevelMap;
358
363
  }
359
364