@linxiraos/pi-catalog 1.4.3 → 1.4.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/THIRD-PARTY-NOTICES.txt +14 -0
  3. package/dist/types/compat/anthropic.d.ts +20 -0
  4. package/dist/types/compat/behavior.d.ts +2 -0
  5. package/dist/types/compat/catalog-policy.d.ts +2 -2
  6. package/dist/types/compat/collapse.d.ts +10 -0
  7. package/dist/types/compat/factory-droid.d.ts +2 -0
  8. package/dist/types/compat/resolve.d.ts +2 -2
  9. package/dist/types/compat/types.d.ts +2 -0
  10. package/dist/types/discovery/antigravity.d.ts +7 -2
  11. package/dist/types/discovery/devin.d.ts +1 -1
  12. package/dist/types/provider-models/google.d.ts +2 -0
  13. package/dist/types/provider-models/openai-compat.d.ts +16 -3
  14. package/dist/types/types.d.ts +58 -3
  15. package/dist/types/wire/devin.d.ts +2 -2
  16. package/dist/types/wire/gemini-headers.d.ts +41 -22
  17. package/dist/types/wire/xiaomi-token-plan.d.ts +2 -0
  18. package/package.json +4 -4
  19. package/src/build.ts +47 -1
  20. package/src/compat/anthropic.d.ts +20 -0
  21. package/src/compat/anthropic.ts +47 -0
  22. package/src/compat/axes.ts +10 -3
  23. package/src/compat/behavior.d.ts +2 -0
  24. package/src/compat/behavior.ts +5 -0
  25. package/src/compat/catalog-policy.ts +10 -8
  26. package/src/compat/collapse.d.ts +10 -0
  27. package/src/compat/collapse.ts +63 -2
  28. package/src/compat/factory-droid.d.ts +2 -0
  29. package/src/compat/factory-droid.ts +3 -0
  30. package/src/compat/resolve.d.ts +2 -2
  31. package/src/compat/resolve.ts +7 -5
  32. package/src/compat/rules/README.md +13 -5
  33. package/src/compat/rules/auth/google-antigravity.kdl +2 -1
  34. package/src/compat/rules/auth/llama.cpp.kdl +1 -1
  35. package/src/compat/rules/auth/xiaomi-token-plan-ams.kdl +1 -1
  36. package/src/compat/rules/auth/xiaomi-token-plan-cn.kdl +1 -1
  37. package/src/compat/rules/auth/xiaomi-token-plan-sgp.kdl +1 -1
  38. package/src/compat/rules/classes/anthropic.kdl +6 -1
  39. package/src/compat/rules/classes/minimax.kdl +10 -0
  40. package/src/compat/rules/providers/anthropic.kdl +15 -1
  41. package/src/compat/rules/providers/deepseek.kdl +13 -10
  42. package/src/compat/rules/providers/factory-droid.kdl +48 -0
  43. package/src/compat/rules/providers/google-antigravity.kdl +7 -0
  44. package/src/compat/rules/providers/kimi-code.kdl +20 -0
  45. package/src/compat/rules/providers/moonshot.kdl +25 -0
  46. package/src/compat/rules/providers/muse-code.kdl +1 -1
  47. package/src/compat/rules/providers/openai-codex.kdl +17 -4
  48. package/src/compat/rules/providers/openai.kdl +23 -2
  49. package/src/compat/rules/providers/opencode-go.kdl +38 -3
  50. package/src/compat/rules/providers/opencode-zen.kdl +7 -0
  51. package/src/compat/rules/providers/xiaomi-token-plan-ams.kdl +1 -1
  52. package/src/compat/rules/providers/xiaomi-token-plan-cn.kdl +1 -1
  53. package/src/compat/rules/providers/xiaomi-token-plan-sgp.kdl +1 -1
  54. package/src/compat/rules/providers/xiaomi.kdl +1 -1
  55. package/src/compat/rules/runtime/behavior.kdl +30 -14
  56. package/src/compat/rules/taxonomy/kimi.kdl +7 -0
  57. package/src/compat/rules.json +1 -1
  58. package/src/compat/types.d.ts +2 -0
  59. package/src/compat/types.ts +2 -0
  60. package/src/discovery/antigravity.d.ts +7 -2
  61. package/src/discovery/antigravity.ts +41 -6
  62. package/src/discovery/cursor.ts +0 -6
  63. package/src/discovery/devin.d.ts +1 -1
  64. package/src/discovery/devin.ts +9 -3
  65. package/src/discovery/factory-droid.ts +38 -6
  66. package/src/model-cache.ts +4 -2
  67. package/src/models.json +1 -1
  68. package/src/provider-models/cache-provider-id.ts +5 -2
  69. package/src/provider-models/google.d.ts +2 -0
  70. package/src/provider-models/google.ts +13 -1
  71. package/src/provider-models/openai-compat.d.ts +16 -3
  72. package/src/provider-models/openai-compat.ts +127 -38
  73. package/src/types.d.ts +58 -3
  74. package/src/types.ts +63 -1
  75. package/src/wire/devin.d.ts +2 -2
  76. package/src/wire/devin.ts +2 -2
  77. package/src/wire/gemini-headers.d.ts +41 -22
  78. package/src/wire/gemini-headers.ts +68 -24
  79. package/src/wire/xiaomi-token-plan.d.ts +2 -0
  80. package/src/wire/xiaomi-token-plan.ts +4 -0
package/src/types.ts CHANGED
@@ -94,6 +94,7 @@ export const IMAGE_GENERATION_APIS = [
94
94
  "google-gemini-cli",
95
95
  "openai-responses",
96
96
  "openai-codex-responses",
97
+ "factory-droid-agent",
97
98
  ] as const;
98
99
  export type ImageGenerationApi = (typeof IMAGE_GENERATION_APIS)[number];
99
100
 
@@ -103,7 +104,7 @@ const IMAGE_CHAT_TRANSPORT_KINDS: readonly ModelKind[] = ["chat", "tiny", "image
103
104
  /**
104
105
  * Kinds a model on `api` may declare: a runner api serves its own kind; a chat
105
106
  * transport serves `chat` and `tiny`, plus `image` when `generate_image` runs it
106
- * (hosted Responses image tool, Gemini image models). `undefined` for
107
+ * (hosted Responses image tool, Gemini and Factory Droid image models). `undefined` for
107
108
  * `local-inference`, which hosts several kinds chosen by the model itself.
108
109
  */
109
110
  export function servedKinds(api: Api): readonly ModelKind[] | undefined {
@@ -671,6 +672,8 @@ export interface AnthropicCompat {
671
672
  supportsEagerToolInputStreaming?: boolean;
672
673
  /** Whether long prompt-cache retention (`ttl: "1h"`) is supported. Default: true for canonical Anthropic API. */
673
674
  supportsLongCacheRetention?: boolean;
675
+ /** Whether a `ttl: "1h"` breakpoint on API-key requests adds the `extended-cache-ttl-2025-04-11` beta. Unset: true (Vertex rawPredict URLs never send it). */
676
+ extendedCacheTtlBeta?: boolean;
674
677
  /**
675
678
  * Whether mid-conversation `role: "system"` messages are accepted in the
676
679
  * `messages` array. When unset, auto-detected from model and deployment policy.
@@ -729,6 +732,21 @@ export interface AnthropicCompat {
729
732
  * Default: auto-detected from provider/baseUrl and `model.reasoning`.
730
733
  */
731
734
  replayUnsignedThinking?: boolean;
735
+ /**
736
+ * Whether a thinking-mode history must carry a `thinking` block on EVERY
737
+ * assistant turn of the current turn. DeepSeek's Anthropic endpoint rejects
738
+ * the whole request (`The content[].thinking in the thinking mode must be
739
+ * passed back to the API.`) when any assistant turn after the last user text
740
+ * lacks one, including turns another upstream in the same gateway model group
741
+ * produced without reasoning. Presence is all it validates (the block text may
742
+ * be a placeholder, the signature may be empty), and only `thinking` counts —
743
+ * `redacted_thinking` does not, and that endpoint rejects the block outright.
744
+ * A model group that may fail over to such an endpoint must set this: the
745
+ * stricter member defines the replay contract for the group.
746
+ * Default: false (official Anthropic and lax proxies tolerate a turn without
747
+ * thinking and the block is not invented for them).
748
+ */
749
+ requiresThinkingPresence?: boolean;
732
750
  /**
733
751
  * Whether the endpoint requires `thinking.type: "enabled"` whenever the
734
752
  * model reasons. Use for models that reject omitted or disabled thinking.
@@ -1186,6 +1204,7 @@ export type ResolvedAnthropicCompat = Required<
1186
1204
  | "thinkingLoopGuard"
1187
1205
  | "bedrockMessagesApi"
1188
1206
  | "effortBeta"
1207
+ | "extendedCacheTtlBeta"
1189
1208
  | "disabledThinking"
1190
1209
  | "betweenToolsEffort"
1191
1210
  | "stripThinkingHistory"
@@ -1196,6 +1215,8 @@ export type ResolvedAnthropicCompat = Required<
1196
1215
  > & {
1197
1216
  /** Effort-beta override; undefined keeps the transport's legacy heuristic. */
1198
1217
  effortBeta?: AnthropicCompat["effortBeta"];
1218
+ /** Extended-cache-ttl beta opt-out; undefined sends it where a 1h breakpoint needs it. */
1219
+ extendedCacheTtlBeta?: AnthropicCompat["extendedCacheTtlBeta"];
1199
1220
  /** Disabled-thinking wire form; undefined keeps the direct-provider behavior. */
1200
1221
  disabledThinking?: AnthropicCompat["disabledThinking"];
1201
1222
  /** Effort pinned on `between_tools` turns; undefined leaves effort untouched. */
@@ -1494,6 +1515,13 @@ export interface ModelAccountAccess {
1494
1515
  * Absent when the backend reported no program metadata.
1495
1516
  */
1496
1517
  cyberPrograms?: readonly string[];
1518
+ /**
1519
+ * Antigravity request constants this account's `fetchAvailableModels`
1520
+ * roster advertised, keyed by upstream SKU id. Takes precedence over
1521
+ * {@link Model.antigravityWireProfiles}, which keeps only the first
1522
+ * account's values when multi-account rosters are unioned.
1523
+ */
1524
+ antigravityWireProfiles?: Readonly<Record<string, AntigravityModelWireProfile>>;
1497
1525
  }
1498
1526
 
1499
1527
  /** One Cursor `RequestedModel.parameters` entry recovered from rich discovery. */
@@ -1508,6 +1536,21 @@ export interface CursorModelRoute {
1508
1536
  parameters: readonly CursorModelParameter[];
1509
1537
  maxMode?: boolean;
1510
1538
  }
1539
+
1540
+ /**
1541
+ * Antigravity Cloud Code Assist request constants for one upstream SKU, as the
1542
+ * native client sends them; see {@link Model.antigravityWireProfiles}.
1543
+ */
1544
+ export interface AntigravityModelWireProfile {
1545
+ /** Opaque `labels.model_enum` token (`fetchAvailableModels` `model`). */
1546
+ modelEnum?: string;
1547
+ /** Fixed `generationConfig.maxOutputTokens` the client always sends. */
1548
+ maxOutputTokens?: number;
1549
+ /** SKU thinking level; the native client sends it in preference to a budget. */
1550
+ thinkingLevel?: "LOW" | "MEDIUM" | "HIGH";
1551
+ /** SKU thinking budget (`-1` is dynamic), sent when no level is advertised. */
1552
+ thinkingBudget?: number;
1553
+ }
1511
1554
  // Model interface for the unified model system
1512
1555
  export interface Model<TApi extends Api = Api> {
1513
1556
  id: string;
@@ -1622,6 +1665,13 @@ export interface Model<TApi extends Api = Api> {
1622
1665
  * their single wire id) and on bundled snapshots that predate discovery.
1623
1666
  */
1624
1667
  cursorMaxModeRoutes?: Readonly<Record<string, boolean>>;
1668
+ /**
1669
+ * Per-wire-id Antigravity request constants recorded from the account's
1670
+ * `fetchAvailableModels` roster, keyed by upstream SKU id. A collapsed row
1671
+ * carries one entry per member it routes to; a raw row carries its own.
1672
+ * Absent on bundled snapshots that predate discovery.
1673
+ */
1674
+ antigravityWireProfiles?: Readonly<Record<string, AntigravityModelWireProfile>>;
1625
1675
  /**
1626
1676
  * Per-account availability recorded by multi-account discovery: provider
1627
1677
  * account key (Codex: ChatGPT `chatgpt_account_id`; Antigravity: login
@@ -1830,3 +1880,15 @@ export interface ModelSpec<TApi extends Api = Api> extends Omit<
1830
1880
  /** Sparse compatibility overrides; resolved into `Model.compat` by `buildModel`. */
1831
1881
  compat?: CompatConfigOf<TApi>;
1832
1882
  }
1883
+
1884
+ /**
1885
+ * The model facts the catalog policy cascade reads: the resolve-target inputs
1886
+ * (`providerType ?? provider`, the request adapter, the wire model id, the
1887
+ * reasoning flag) plus the unverified-thinking correction applied before the
1888
+ * cascade. Callers holding a reduced model view — request adapters that only
1889
+ * need policy — supply exactly these instead of asserting a full `Model`.
1890
+ */
1891
+ export type CatalogPolicyInputs = Pick<
1892
+ ModelSpec<Api>,
1893
+ "provider" | "providerType" | "api" | "id" | "reasoning" | "requestModelId" | "thinking"
1894
+ >;
@@ -13,9 +13,9 @@ export declare const DEVIN_DEFAULT_BASE_URL = "https://server.codeium.com";
13
13
  export declare function devinCliMetadata(apiKey: string | undefined, userJwt?: string): {
14
14
  ideName: "devin-cli";
15
15
  ideType: "chisel";
16
- ideVersion: "3000.11.3";
16
+ ideVersion: "3000.11.205";
17
17
  extensionName: "chisel";
18
- extensionVersion: "3000.11.3";
18
+ extensionVersion: "3000.11.205";
19
19
  locale: "en";
20
20
  os: "darwin" | "linux" | "windows";
21
21
  apiKey: string;
package/src/wire/devin.ts CHANGED
@@ -22,9 +22,9 @@ const DEVIN_LOCALE = "en";
22
22
  const DEVIN_CLI_METADATA = {
23
23
  ideName: "devin-cli",
24
24
  ideType: "chisel",
25
- ideVersion: "3000.11.3",
25
+ ideVersion: "3000.11.205",
26
26
  extensionName: "chisel",
27
- extensionVersion: "3000.11.3",
27
+ extensionVersion: "3000.11.205",
28
28
  locale: DEVIN_LOCALE,
29
29
  os: DEVIN_OS,
30
30
  } as const;
@@ -1,4 +1,5 @@
1
1
  import type { FetchImpl } from "@linxiraos/pi-utils";
2
+ import type { AntigravityModelWireProfile } from "../types";
2
3
  /**
3
4
  * Build a User-Agent string that identifies as Gemini CLI to unlock higher rate limits.
4
5
  * Uses the same format as the official Gemini CLI (v0.35+):
@@ -15,16 +16,19 @@ export declare const getGeminiCliHeaders: (modelId?: string) => {
15
16
  * (and its @google/genai → google-auth-library dependency chain) into the startup
16
17
  * parse graph.
17
18
  *
18
- * Format captured from the real 2.8.0 `antigravity/hub` client:
19
- * `antigravity/hub/2.8.0 (aidev_client; os_type=darwin; arch=arm64; cl=963137146)`.
19
+ * Format captured from the real 2.26.0 `antigravity/hub` client:
20
+ * `antigravity/hub/2.26.0 (aidev_client; os_type=darwin; arch=arm64; cl=1005016104)`.
20
21
  * The backend gates newer models (e.g. gemini-3.7-flash) on the client version,
21
22
  * so the version tracks the latest Antigravity release via the update manifest
22
23
  * (see {@link ensureAntigravityVersion}) with `DEFAULT_ANTIGRAVITY_VERSION` as
23
- * the offline fallback. os_type/arch are pinned to the darwin/arm64 reference
24
- * client the version and manifest are captured from, independent of the host
25
- * platform. Overrides: PI_AI_ANTIGRAVITY_VERSION / _CL / _OS / _ARCH.
24
+ * the offline fallback. os_type/arch name the native build for the host OS:
25
+ * each 2.26.0 installer ships one language-server build whose Go target is
26
+ * stamped into the header (macOS darwin/arm64, Linux linux/amd64, Windows
27
+ * windows/amd64; no other OS/arch builds exist); see
28
+ * {@link getAntigravityPlatform}. The changelist is identical across those
29
+ * builds. Overrides: PI_AI_ANTIGRAVITY_VERSION / _CL / _OS / _ARCH.
26
30
  */
27
- export declare const DEFAULT_ANTIGRAVITY_VERSION = "2.19.1";
31
+ export declare const DEFAULT_ANTIGRAVITY_VERSION = "2.26.0";
28
32
  /** Current Antigravity client version: env override → manifest-discovered → pinned fallback. */
29
33
  export declare function getAntigravityVersion(): string;
30
34
  /**
@@ -42,24 +46,39 @@ export declare function parseAntigravityManifestVersion(yamlText: string): strin
42
46
  * timeout; `signal` ends this caller's wait without cancelling the lookup.
43
47
  */
44
48
  export declare function ensureAntigravityVersion(fetcher?: FetchImpl, signal?: AbortSignal): Promise<void>;
49
+ /**
50
+ * Native build the host would run. OSes without a native build report the
51
+ * Linux build, the closest client that exists.
52
+ */
53
+ export declare function getAntigravityPlatform(platform?: NodeJS.Platform): {
54
+ os: string;
55
+ arch: string;
56
+ };
45
57
  /** Antigravity `User-Agent` header value; rebuilt when the discovered version changes. */
46
58
  export declare function getAntigravityUserAgent(): string;
47
59
  /**
48
- * Per-wire-id Antigravity Cloud Code Assist request constants, captured from the
49
- * real `antigravity/hub` client against `daily-cloudcode-pa`. `modelEnum` is the
50
- * opaque `labels.model_enum` token the client tags each request with — optional
51
- * because Anthropic-backed wire ids (e.g. `claude-sonnet-4-6`,
52
- * `claude-opus-4-6-thinking`) are accepted without one; the label is purely
53
- * telemetry. `maxOutputTokens` is the fixed `generationConfig.maxOutputTokens`
54
- * the backend enforces regardless of the thinking budget (Claude caps at
55
- * 64000, Gemini accepts the discovered cap). Keyed by the routed upstream wire
56
- * id (post effort-routing), not the collapsed logical id. Checkpoint-only ids
57
- * (e.g. `gemini-3.1-flash-lite`) are intentionally absent — this provider only
58
- * emits agent requests.
60
+ * Client headers for every Antigravity Cloud Code Assist request. The native
61
+ * client is Go `net/http`, which offers `Accept-Encoding: gzip` and no `Accept`;
62
+ * pinning the encoding replaces the runtime's `gzip, deflate, br, zstd` (Bun
63
+ * still decompresses the gzip body). Bun always adds `Accept: *\/*` itself, so
64
+ * callers must not set a more specific `Accept`.
65
+ */
66
+ export declare function getAntigravityHeaders(userAgent?: string): {
67
+ "User-Agent": string;
68
+ "Accept-Encoding": string;
69
+ };
70
+ /**
71
+ * Offline fallback for {@link Model.antigravityWireProfiles}: per-SKU request
72
+ * constants for rows that carry no discovered profile. Keyed by the routed
73
+ * upstream wire id (post effort-routing), not the collapsed logical id.
74
+ * `modelEnum` is the opaque `labels.model_enum` token; the backend accepts
75
+ * requests without it. Discovery (and the bundled snapshot baked from it)
76
+ * owns current SKUs; do not extend this table.
59
77
  */
60
- export interface AntigravityModelWireProfile {
61
- modelEnum?: string;
62
- maxOutputTokens: number;
63
- }
64
78
  export declare const ANTIGRAVITY_MODEL_WIRE_PROFILES: Readonly<Record<string, AntigravityModelWireProfile>>;
65
- export declare function getAntigravityModelWireProfile(wireModelId: string): AntigravityModelWireProfile | undefined;
79
+ /**
80
+ * Request constants for `wireModelId`: the first discovered profile map that
81
+ * lists it (callers pass the serving account's before the row's), else the
82
+ * offline fallback table.
83
+ */
84
+ export declare function getAntigravityModelWireProfile(wireModelId: string, ...discovered: (Readonly<Record<string, AntigravityModelWireProfile>> | undefined)[]): AntigravityModelWireProfile | undefined;
@@ -1,4 +1,5 @@
1
1
  import type { FetchImpl } from "@linxiraos/pi-utils";
2
+ import type { AntigravityModelWireProfile } from "../types";
2
3
 
3
4
  /**
4
5
  * Build a User-Agent string that identifies as Gemini CLI to unlock higher rate limits.
@@ -23,16 +24,19 @@ export const getGeminiCliHeaders = (modelId?: string) => ({
23
24
  * (and its @google/genai → google-auth-library dependency chain) into the startup
24
25
  * parse graph.
25
26
  *
26
- * Format captured from the real 2.8.0 `antigravity/hub` client:
27
- * `antigravity/hub/2.8.0 (aidev_client; os_type=darwin; arch=arm64; cl=963137146)`.
27
+ * Format captured from the real 2.26.0 `antigravity/hub` client:
28
+ * `antigravity/hub/2.26.0 (aidev_client; os_type=darwin; arch=arm64; cl=1005016104)`.
28
29
  * The backend gates newer models (e.g. gemini-3.7-flash) on the client version,
29
30
  * so the version tracks the latest Antigravity release via the update manifest
30
31
  * (see {@link ensureAntigravityVersion}) with `DEFAULT_ANTIGRAVITY_VERSION` as
31
- * the offline fallback. os_type/arch are pinned to the darwin/arm64 reference
32
- * client the version and manifest are captured from, independent of the host
33
- * platform. Overrides: PI_AI_ANTIGRAVITY_VERSION / _CL / _OS / _ARCH.
32
+ * the offline fallback. os_type/arch name the native build for the host OS:
33
+ * each 2.26.0 installer ships one language-server build whose Go target is
34
+ * stamped into the header (macOS darwin/arm64, Linux linux/amd64, Windows
35
+ * windows/amd64; no other OS/arch builds exist); see
36
+ * {@link getAntigravityPlatform}. The changelist is identical across those
37
+ * builds. Overrides: PI_AI_ANTIGRAVITY_VERSION / _CL / _OS / _ARCH.
34
38
  */
35
- export const DEFAULT_ANTIGRAVITY_VERSION = "2.19.1";
39
+ export const DEFAULT_ANTIGRAVITY_VERSION = "2.26.0";
36
40
 
37
41
  const ANTIGRAVITY_VERSION_MANIFEST_URL =
38
42
  "https://antigravity-hub-auto-updater-974169037036.us-central1.run.app/manifest/latest-arm64-mac.yml";
@@ -107,35 +111,62 @@ export function ensureAntigravityVersion(fetcher: FetchImpl = fetch, signal?: Ab
107
111
  return Promise.race([lookup, aborted]).finally(() => signal.removeEventListener("abort", onAbort));
108
112
  }
109
113
 
114
+ /**
115
+ * Native Antigravity builds, keyed by host OS, as their language server reports
116
+ * itself (`GOOS`/`GOARCH`). The macOS installer ships arm64 only and the Linux
117
+ * and Windows installers x64 only, so the reported arch is the build's, not
118
+ * the host's: advertising e.g. darwin/amd64 would name a client that does not
119
+ * exist.
120
+ */
121
+ const ANTIGRAVITY_BUILDS: Partial<Record<NodeJS.Platform, { os: string; arch: string }>> = {
122
+ darwin: { os: "darwin", arch: "arm64" },
123
+ linux: { os: "linux", arch: "amd64" },
124
+ win32: { os: "windows", arch: "amd64" },
125
+ };
126
+
127
+ /**
128
+ * Native build the host would run. OSes without a native build report the
129
+ * Linux build, the closest client that exists.
130
+ */
131
+ export function getAntigravityPlatform(platform: NodeJS.Platform = process.platform): { os: string; arch: string } {
132
+ return ANTIGRAVITY_BUILDS[platform] ?? { os: "linux", arch: "amd64" };
133
+ }
134
+
110
135
  /** Antigravity `User-Agent` header value; rebuilt when the discovered version changes. */
111
136
  export function getAntigravityUserAgent(): string {
112
137
  const version = getAntigravityVersion();
113
138
  // The backend does not validate `cl` (verified live: stale, zero, and absent
114
139
  // cl all pass model gating on daily-cloudcode-pa; only the version gates).
115
140
  // The update manifest carries no changelist, so the captured value stays.
116
- const cl = process.env.PI_AI_ANTIGRAVITY_CL || "963137146";
117
- const os = process.env.PI_AI_ANTIGRAVITY_OS || "darwin";
118
- const arch = process.env.PI_AI_ANTIGRAVITY_ARCH || "arm64";
141
+ const cl = process.env.PI_AI_ANTIGRAVITY_CL || "1005016104";
142
+ const host = getAntigravityPlatform();
143
+ const os = process.env.PI_AI_ANTIGRAVITY_OS || host.os;
144
+ const arch = process.env.PI_AI_ANTIGRAVITY_ARCH || host.arch;
119
145
  return `antigravity/hub/${version} (aidev_client; os_type=${os}; arch=${arch}; cl=${cl})`;
120
146
  }
121
147
 
122
148
  /**
123
- * Per-wire-id Antigravity Cloud Code Assist request constants, captured from the
124
- * real `antigravity/hub` client against `daily-cloudcode-pa`. `modelEnum` is the
125
- * opaque `labels.model_enum` token the client tags each request with — optional
126
- * because Anthropic-backed wire ids (e.g. `claude-sonnet-4-6`,
127
- * `claude-opus-4-6-thinking`) are accepted without one; the label is purely
128
- * telemetry. `maxOutputTokens` is the fixed `generationConfig.maxOutputTokens`
129
- * the backend enforces regardless of the thinking budget (Claude caps at
130
- * 64000, Gemini accepts the discovered cap). Keyed by the routed upstream wire
131
- * id (post effort-routing), not the collapsed logical id. Checkpoint-only ids
132
- * (e.g. `gemini-3.1-flash-lite`) are intentionally absent — this provider only
133
- * emits agent requests.
149
+ * Client headers for every Antigravity Cloud Code Assist request. The native
150
+ * client is Go `net/http`, which offers `Accept-Encoding: gzip` and no `Accept`;
151
+ * pinning the encoding replaces the runtime's `gzip, deflate, br, zstd` (Bun
152
+ * still decompresses the gzip body). Bun always adds `Accept: *\/*` itself, so
153
+ * callers must not set a more specific `Accept`.
134
154
  */
135
- export interface AntigravityModelWireProfile {
136
- modelEnum?: string;
137
- maxOutputTokens: number;
155
+ export function getAntigravityHeaders(userAgent: string = getAntigravityUserAgent()): {
156
+ "User-Agent": string;
157
+ "Accept-Encoding": string;
158
+ } {
159
+ return { "User-Agent": userAgent, "Accept-Encoding": "gzip" };
138
160
  }
161
+
162
+ /**
163
+ * Offline fallback for {@link Model.antigravityWireProfiles}: per-SKU request
164
+ * constants for rows that carry no discovered profile. Keyed by the routed
165
+ * upstream wire id (post effort-routing), not the collapsed logical id.
166
+ * `modelEnum` is the opaque `labels.model_enum` token; the backend accepts
167
+ * requests without it. Discovery (and the bundled snapshot baked from it)
168
+ * owns current SKUs; do not extend this table.
169
+ */
139
170
  export const ANTIGRAVITY_MODEL_WIRE_PROFILES: Readonly<Record<string, AntigravityModelWireProfile>> = {
140
171
  "gemini-3.5-flash-extra-low": { modelEnum: "MODEL_PLACEHOLDER_M187", maxOutputTokens: 65536 },
141
172
  "gemini-3.5-flash-low": { modelEnum: "MODEL_PLACEHOLDER_M20", maxOutputTokens: 65536 },
@@ -148,6 +179,19 @@ export const ANTIGRAVITY_MODEL_WIRE_PROFILES: Readonly<Record<string, Antigravit
148
179
  "claude-sonnet-4-6": { maxOutputTokens: 64000 },
149
180
  "claude-opus-4-6-thinking": { maxOutputTokens: 64000 },
150
181
  };
151
- export function getAntigravityModelWireProfile(wireModelId: string): AntigravityModelWireProfile | undefined {
182
+
183
+ /**
184
+ * Request constants for `wireModelId`: the first discovered profile map that
185
+ * lists it (callers pass the serving account's before the row's), else the
186
+ * offline fallback table.
187
+ */
188
+ export function getAntigravityModelWireProfile(
189
+ wireModelId: string,
190
+ ...discovered: (Readonly<Record<string, AntigravityModelWireProfile>> | undefined)[]
191
+ ): AntigravityModelWireProfile | undefined {
192
+ for (const profiles of discovered) {
193
+ const profile = profiles?.[wireModelId];
194
+ if (profile !== undefined) return profile;
195
+ }
152
196
  return ANTIGRAVITY_MODEL_WIRE_PROFILES[wireModelId];
153
197
  }
@@ -0,0 +1,2 @@
1
+ /** Identifies Xiaomi Token Plan keys so login and discovery use regional hosts instead of the pay-as-you-go host. */
2
+ export declare function isXiaomiTokenPlanKey(apiKey: string): boolean;
@@ -0,0 +1,4 @@
1
+ /** Identifies Xiaomi Token Plan keys so login and discovery use regional hosts instead of the pay-as-you-go host. */
2
+ export function isXiaomiTokenPlanKey(apiKey: string): boolean {
3
+ return apiKey.startsWith("tp-") || apiKey.startsWith("ttp-");
4
+ }