omnigateway 0.9.1 → 0.10.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 (34) hide show
  1. package/README.md +12 -4
  2. package/bin/omni.js +1790 -117
  3. package/gateway.js +2437 -244
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-DJkUCwNJ.js → Chip-BeKVtewW.js} +1 -1
  6. package/public/assets/{CopyValue-CJ3ZYgvs.js → CopyValue-NTHhiCuT.js} +1 -1
  7. package/public/assets/{Lamp-D7hJcQ90.js → Lamp-C2Q3t5Mn.js} +1 -1
  8. package/public/assets/{Rack-CaxD9IY1.js → Rack-sUGRoZUx.js} +2 -2
  9. package/public/assets/{RequestTable-bXapHDrR.js → RequestTable-C2RLARWy.js} +1 -1
  10. package/public/assets/{SummaryDeck-Dt_qbFtg.js → SummaryDeck-BHXcb_Ji.js} +1 -1
  11. package/public/assets/{Toggle-C_iC6W50.js → Toggle-DwKz1aVq.js} +1 -1
  12. package/public/assets/{TokenBreakdown-C96x_g6d.js → TokenBreakdown-DM-1HvOr.js} +1 -1
  13. package/public/assets/{WindowChart-D4dcv4DX.js → WindowChart-BsonO5Py.js} +1 -1
  14. package/public/assets/{_app.accounts-CGFOyYZc.js → _app.accounts-DUYxItf0.js} +1 -1
  15. package/public/assets/{_app.console-DrCT8eLd.js → _app.console-BQJMLRv4.js} +1 -1
  16. package/public/assets/{_app.database-D32je-GL.js → _app.database-BIiajZm6.js} +1 -1
  17. package/public/assets/{_app.index-BG6mGxkv.js → _app.index-DagK0Pqp.js} +1 -1
  18. package/public/assets/{_app.keys-C1AjjeHc.js → _app.keys-DLAG_bmt.js} +1 -1
  19. package/public/assets/{_app.logs-BDLj_H_j.js → _app.logs-AyVq3lLb.js} +1 -1
  20. package/public/assets/{_app.models-Cgg7gVSF.js → _app.models-CwlkGPrx.js} +1 -1
  21. package/public/assets/{_app.plugins._pluginId-C5FSNOfN.js → _app.plugins._pluginId-BhvEnawY.js} +1 -1
  22. package/public/assets/{_app.settings-B7lKNDoh.js → _app.settings-BKA-1YLs.js} +1 -1
  23. package/public/assets/{_app.usage-DjqlIHDL.js → _app.usage-C7JEWKZM.js} +1 -1
  24. package/public/assets/{chevron-right-DJj6SEIT.js → chevron-right-S84SGCvk.js} +1 -1
  25. package/public/assets/{client-Q2fvA2EK.js → client-DCvpw0LS.js} +1 -1
  26. package/public/assets/{index-D1ewvjU0.js → index-pZbadEun.js} +3 -3
  27. package/public/assets/{login-Br_AimWR.js → login-CitmheGz.js} +1 -1
  28. package/public/assets/plus-E7qLz9CF.js +1 -0
  29. package/public/assets/{preload-helper-92RRH0nq.js → preload-helper-BC9bKUg1.js} +1 -1
  30. package/public/assets/{shared-Cp_kzH_a.js → shared-C47BfV_u.js} +1 -1
  31. package/public/assets/{trash-2-Chg8CwQf.js → trash-2-DmtElUHr.js} +1 -1
  32. package/public/index.html +4 -4
  33. package/public/shared/dashboard-sdk.js +1 -1
  34. package/public/assets/plus-CCwmaxw3.js +0 -1
package/bin/omni.js CHANGED
@@ -25,7 +25,9 @@ var ANSI = {
25
25
  blue: "\x1B[34m",
26
26
  magenta: "\x1B[35m",
27
27
  cyan: "\x1B[36m",
28
- orange: "\x1B[38;5;208m"
28
+ orange: "\x1B[38;5;208m",
29
+ violet: "\x1B[38;5;99m",
30
+ azure: "\x1B[38;5;33m"
29
31
  };
30
32
  var consoleWriter = {
31
33
  out: (line) => {
@@ -23466,6 +23468,12 @@ var ANTHROPIC_MODELS = {
23466
23468
  defaultModel: "claude-opus-5",
23467
23469
  authTypes: ["oauth", "apiKey"],
23468
23470
  models: [
23471
+ {
23472
+ id: "claude-fable-5-1",
23473
+ label: "Claude Fable 5.1",
23474
+ pricing: { input: 10, output: 50, cacheRead: 0.25, cacheWrite5m: 12.5, cacheWrite1h: 20 },
23475
+ limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
23476
+ },
23469
23477
  {
23470
23478
  id: "claude-fable-5",
23471
23479
  label: "Claude Fable 5",
@@ -23481,7 +23489,7 @@ var ANTHROPIC_MODELS = {
23481
23489
  {
23482
23490
  id: "claude-sonnet-5",
23483
23491
  label: "Claude Sonnet 5",
23484
- pricing: { input: 3, output: 15, cacheRead: 0.3, cacheWrite5m: 3.75, cacheWrite1h: 6 },
23492
+ pricing: { input: 2, output: 10, cacheRead: 0.2, cacheWrite5m: 2.5, cacheWrite1h: 4 },
23485
23493
  limits: { contextWindow: 1e6, maxOutputTokens: 128000 }
23486
23494
  },
23487
23495
  {
@@ -23519,6 +23527,144 @@ var anthropicDescriptor = {
23519
23527
  }
23520
23528
  };
23521
23529
 
23530
+ // packages/providers/src/antigravity/models.ts
23531
+ var MAX_OUTPUT_TOKENS = 65536;
23532
+ var PRO_MAX_OUTPUT_TOKENS = 65535;
23533
+ var FREE = { input: 0, output: 0, cacheRead: 0, cacheWrite5m: 0, cacheWrite1h: 0 };
23534
+ var FLASH_LIMITS = { contextWindow: 1048576, maxOutputTokens: MAX_OUTPUT_TOKENS };
23535
+ var PRO_LIMITS = { contextWindow: 1048576, maxOutputTokens: PRO_MAX_OUTPUT_TOKENS };
23536
+ var ANTIGRAVITY_MODELS = {
23537
+ defaultModel: "gemini-3.8-flash-high",
23538
+ authTypes: ["oauth"],
23539
+ models: [
23540
+ {
23541
+ id: "gemini-3.8-flash-high",
23542
+ label: "Gemini 3.8 Flash (High)",
23543
+ pricing: FREE,
23544
+ limits: FLASH_LIMITS
23545
+ },
23546
+ {
23547
+ id: "gemini-3.8-flash-medium",
23548
+ label: "Gemini 3.8 Flash (Medium)",
23549
+ pricing: FREE,
23550
+ limits: FLASH_LIMITS
23551
+ },
23552
+ {
23553
+ id: "gemini-3.8-flash-low",
23554
+ label: "Gemini 3.8 Flash (Low)",
23555
+ pricing: FREE,
23556
+ limits: FLASH_LIMITS
23557
+ },
23558
+ {
23559
+ id: "gemini-3.7-flash-high",
23560
+ label: "Gemini 3.7 Flash (High)",
23561
+ pricing: FREE,
23562
+ limits: FLASH_LIMITS
23563
+ },
23564
+ {
23565
+ id: "gemini-3.7-flash-medium",
23566
+ label: "Gemini 3.7 Flash (Medium)",
23567
+ pricing: FREE,
23568
+ limits: FLASH_LIMITS
23569
+ },
23570
+ {
23571
+ id: "gemini-3.7-flash-low",
23572
+ label: "Gemini 3.7 Flash (Low)",
23573
+ pricing: FREE,
23574
+ limits: FLASH_LIMITS
23575
+ },
23576
+ {
23577
+ id: "gemini-3.6-flash-high",
23578
+ label: "Gemini 3.6 Flash (High)",
23579
+ pricing: FREE,
23580
+ limits: FLASH_LIMITS
23581
+ },
23582
+ {
23583
+ id: "gemini-3.6-flash-medium",
23584
+ label: "Gemini 3.6 Flash (Medium)",
23585
+ pricing: FREE,
23586
+ limits: FLASH_LIMITS
23587
+ },
23588
+ {
23589
+ id: "gemini-3.6-flash-low",
23590
+ label: "Gemini 3.6 Flash (Low)",
23591
+ pricing: FREE,
23592
+ limits: FLASH_LIMITS
23593
+ },
23594
+ {
23595
+ id: "gemini-3-flash-agent",
23596
+ label: "Gemini 3.5 Flash (High)",
23597
+ pricing: FREE,
23598
+ limits: FLASH_LIMITS
23599
+ },
23600
+ {
23601
+ id: "gemini-3.5-flash-low",
23602
+ label: "Gemini 3.5 Flash (Medium)",
23603
+ pricing: FREE,
23604
+ limits: FLASH_LIMITS
23605
+ },
23606
+ {
23607
+ id: "gemini-3.5-flash-extra-low",
23608
+ label: "Gemini 3.5 Flash (Low)",
23609
+ pricing: FREE,
23610
+ limits: FLASH_LIMITS
23611
+ },
23612
+ {
23613
+ id: "gemini-3-flash",
23614
+ label: "Gemini 3 Flash",
23615
+ pricing: FREE,
23616
+ limits: FLASH_LIMITS
23617
+ },
23618
+ {
23619
+ id: "gemini-3.5-flash-lite",
23620
+ label: "Gemini 3.5 Flash Lite",
23621
+ pricing: FREE,
23622
+ limits: PRO_LIMITS
23623
+ },
23624
+ {
23625
+ id: "gemini-3.1-pro-high",
23626
+ label: "Gemini 3.1 Pro (High)",
23627
+ pricing: FREE,
23628
+ limits: PRO_LIMITS
23629
+ },
23630
+ {
23631
+ id: "gemini-3.1-pro-low",
23632
+ label: "Gemini 3.1 Pro (Low)",
23633
+ pricing: FREE,
23634
+ limits: PRO_LIMITS
23635
+ },
23636
+ {
23637
+ id: "gemini-3.1-flash-lite",
23638
+ label: "Gemini 3.1 Flash Lite",
23639
+ pricing: FREE,
23640
+ limits: PRO_LIMITS
23641
+ },
23642
+ {
23643
+ id: "gemini-2.5-pro",
23644
+ label: "Gemini 2.5 Pro",
23645
+ pricing: FREE,
23646
+ limits: PRO_LIMITS
23647
+ }
23648
+ ]
23649
+ };
23650
+
23651
+ // packages/providers/src/antigravity/descriptor.ts
23652
+ var antigravityDescriptor = {
23653
+ id: "antigravity",
23654
+ capabilities: { tools: true, images: true, reasoning: true },
23655
+ writeOverInput: { fiveMinute: 0, oneHour: 0 },
23656
+ catalog: ANTIGRAVITY_MODELS,
23657
+ modelPrefixes: ["gemini-"],
23658
+ callback: { uri: "http://127.0.0.1:51121/callback", label: "Antigravity" },
23659
+ presentation: {
23660
+ label: "Antigravity",
23661
+ order: 6,
23662
+ tone: "violet",
23663
+ colour: { light: "oklch(0.52 0.14 277)", dark: "oklch(0.74 0.14 277)" },
23664
+ pasteHint: "Approve in a browser on the gateway's own machine \u2014 or SSH-forward port 51121 first. When it redirects to 127.0.0.1, paste the whole URL."
23665
+ }
23666
+ };
23667
+
23522
23668
  // packages/providers/src/custom/models.ts
23523
23669
  var CUSTOM_MODELS = {
23524
23670
  defaultModel: "",
@@ -23535,7 +23681,7 @@ var customDescriptor = {
23535
23681
  modelPrefixes: [],
23536
23682
  presentation: {
23537
23683
  label: "OpenAI Compatible",
23538
- order: 6,
23684
+ order: 8,
23539
23685
  tone: "cyan",
23540
23686
  colour: { light: "oklch(0.5 0.03 258)", dark: "oklch(0.72 0.03 258)" },
23541
23687
  pasteHint: "Enter endpoint metadata and API key."
@@ -23860,35 +24006,90 @@ var kimiDescriptor = {
23860
24006
  }
23861
24007
  };
23862
24008
 
24009
+ // packages/providers/src/muse/models.ts
24010
+ var MUSE_MODELS = {
24011
+ defaultModel: "muse-spark-1.3",
24012
+ authTypes: ["oauth", "apiKey"],
24013
+ models: [
24014
+ {
24015
+ id: "muse-spark-1.3",
24016
+ label: "Muse Spark 1.3",
24017
+ pricing: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite5m: 0, cacheWrite1h: 0 },
24018
+ limits: { contextWindow: 1048576, maxOutputTokens: 943718 }
24019
+ },
24020
+ {
24021
+ id: "muse-spark-1.3-contributor",
24022
+ label: "Muse Spark 1.3 \u2014 Meta trains on this traffic",
24023
+ pricing: { input: 0.1, output: 0.2, cacheRead: 0.002, cacheWrite5m: 0, cacheWrite1h: 0 },
24024
+ limits: { contextWindow: 1048576, maxOutputTokens: 943718 }
24025
+ },
24026
+ {
24027
+ id: "muse-spark-1.2",
24028
+ label: "Muse Spark 1.2",
24029
+ pricing: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite5m: 0, cacheWrite1h: 0 },
24030
+ limits: { contextWindow: 1048576, maxOutputTokens: 943718 }
24031
+ },
24032
+ {
24033
+ id: "muse-spark-1.2-contributor",
24034
+ label: "Muse Spark 1.2 \u2014 Meta trains on this traffic",
24035
+ pricing: { input: 0.1, output: 0.2, cacheRead: 0.002, cacheWrite5m: 0, cacheWrite1h: 0 },
24036
+ limits: { contextWindow: 1048576, maxOutputTokens: 943718 }
24037
+ }
24038
+ ]
24039
+ };
24040
+
24041
+ // packages/providers/src/muse/descriptor.ts
24042
+ var museDescriptor = {
24043
+ id: "muse",
24044
+ capabilities: { tools: true, images: true, reasoning: true },
24045
+ writeOverInput: { fiveMinute: 0, oneHour: 0 },
24046
+ catalog: MUSE_MODELS,
24047
+ modelPrefixes: ["muse-", "muse-spark"],
24048
+ presentation: {
24049
+ label: "Muse",
24050
+ order: 7,
24051
+ tone: "azure",
24052
+ colour: { light: "oklch(0.55 0.23 262)", dark: "oklch(0.72 0.17 262)" },
24053
+ pasteHint: "Enter the code on Meta's device page. This dialog finishes on its own."
24054
+ }
24055
+ };
24056
+
23863
24057
  // packages/providers/src/openai/models.ts
23864
24058
  var OPENAI_MODELS = {
23865
24059
  defaultModel: "gpt-5.6",
23866
24060
  authTypes: ["oauth", "apiKey"],
23867
24061
  models: [
24062
+ {
24063
+ id: "gpt-6-astra",
24064
+ label: "GPT-6 Astra",
24065
+ pricing: { input: 10, output: 50, cacheRead: 1, cacheWrite5m: 0, cacheWrite1h: 0 },
24066
+ limits: { contextWindow: 922000, maxOutputTokens: 128000 },
24067
+ oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
24068
+ },
23868
24069
  {
23869
24070
  id: "gpt-5.6",
23870
24071
  label: "GPT-5.6 \u2014 routes to Sol",
23871
- pricing: { input: 5, output: 30, cacheRead: 0.5, cacheWrite5m: 0, cacheWrite1h: 0 },
24072
+ pricing: { input: 4, output: 20, cacheRead: 0.4, cacheWrite5m: 0, cacheWrite1h: 0 },
23872
24073
  limits: { contextWindow: 922000, maxOutputTokens: 128000 },
23873
24074
  oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
23874
24075
  },
23875
24076
  {
23876
24077
  id: "gpt-5.6-sol",
23877
- label: "GPT-5.6 Sol \u2014 deepest reasoning",
23878
- pricing: { input: 5, output: 30, cacheRead: 0.5, cacheWrite5m: 0, cacheWrite1h: 0 },
24078
+ label: "GPT-5.6 Sol",
24079
+ pricing: { input: 4, output: 20, cacheRead: 0.4, cacheWrite5m: 0, cacheWrite1h: 0 },
23879
24080
  limits: { contextWindow: 922000, maxOutputTokens: 128000 },
23880
24081
  oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
23881
24082
  },
23882
24083
  {
23883
24084
  id: "gpt-5.6-terra",
23884
- label: "GPT-5.6 Terra \u2014 balanced",
24085
+ label: "GPT-5.6 Terra",
23885
24086
  pricing: { input: 2, output: 12, cacheRead: 0.2, cacheWrite5m: 0, cacheWrite1h: 0 },
23886
24087
  limits: { contextWindow: 922000, maxOutputTokens: 128000 },
23887
24088
  oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
23888
24089
  },
23889
24090
  {
23890
24091
  id: "gpt-5.6-luna",
23891
- label: "GPT-5.6 Luna \u2014 fastest",
24092
+ label: "GPT-5.6 Luna",
23892
24093
  pricing: { input: 0.2, output: 1.2, cacheRead: 0.02, cacheWrite5m: 0, cacheWrite1h: 0 },
23893
24094
  limits: { contextWindow: 922000, maxOutputTokens: 128000 },
23894
24095
  oauthLimits: { contextWindow: 272000, maxOutputTokens: 128000 }
@@ -23926,6 +24127,8 @@ var PROVIDER_DESCRIPTORS = {
23926
24127
  kimi: kimiDescriptor,
23927
24128
  kilo: kiloDescriptor,
23928
24129
  grok: grokDescriptor,
24130
+ antigravity: antigravityDescriptor,
24131
+ muse: museDescriptor,
23929
24132
  custom: customDescriptor
23930
24133
  };
23931
24134
  Object.setPrototypeOf(PROVIDER_DESCRIPTORS, null);
@@ -23967,6 +24170,19 @@ function loadConfig(env) {
23967
24170
  const bodyLoggingAllowed = TRUTHY.has((env.OMNI_BODY_LOGGING_ALLOWED ?? "").trim().toLowerCase());
23968
24171
  const rawLogLevel = env.OMNI_LOG_LEVEL?.trim();
23969
24172
  const logLevel = parseLogLevel(rawLogLevel);
24173
+ const metricsToken = env.OMNI_METRICS_TOKEN?.trim() || null;
24174
+ const rawMaxSeries = env.OMNI_METRICS_MAX_SERIES ?? "5000";
24175
+ const metricsMaxSeries = Number(rawMaxSeries);
24176
+ if (!DECIMAL_INTEGER.test(rawMaxSeries) || metricsMaxSeries < 1) {
24177
+ throw new Error(`OMNI_METRICS_MAX_SERIES must be a positive integer, got "${rawMaxSeries}"`);
24178
+ }
24179
+ const otlpEndpoint = env.OMNI_OTLP_ENDPOINT?.trim().replace(/\/+$/, "") || null;
24180
+ const otlpHeaders = env.OMNI_OTLP_HEADERS?.trim() || null;
24181
+ const rawTraceSample = env.OMNI_TRACE_SAMPLE ?? "1.0";
24182
+ const traceSample = Number(rawTraceSample);
24183
+ if (!Number.isFinite(traceSample) || traceSample < 0 || traceSample > 1) {
24184
+ throw new Error(`OMNI_TRACE_SAMPLE must be between 0 and 1, got "${rawTraceSample}"`);
24185
+ }
23970
24186
  return {
23971
24187
  logLevel: logLevel ?? "info",
23972
24188
  logLevelFallbackFrom: logLevel === null && rawLogLevel ? rawLogLevel : null,
@@ -23980,7 +24196,12 @@ function loadConfig(env) {
23980
24196
  logFile: logFile === undefined || logFile.length === 0 ? null : logFile,
23981
24197
  clusterMode,
23982
24198
  databaseUrl: clusterMode ? databaseUrl ?? null : null,
23983
- redisUrl: clusterMode ? redisUrl ?? null : null
24199
+ redisUrl: clusterMode ? redisUrl ?? null : null,
24200
+ metricsToken,
24201
+ metricsMaxSeries,
24202
+ otlpEndpoint,
24203
+ otlpHeaders,
24204
+ traceSample
23984
24205
  };
23985
24206
  }
23986
24207
  // packages/control/src/oauth/pending.ts
@@ -24179,7 +24400,8 @@ function codecAdapter(id, capabilities2, codec2, origins) {
24179
24400
  const res = await req.http({
24180
24401
  provider: id,
24181
24402
  ...sendable,
24182
- signal: req.signal
24403
+ signal: req.signal,
24404
+ ...req.requestId === undefined ? {} : { requestId: req.requestId }
24183
24405
  });
24184
24406
  if (res.status < 200 || res.status >= 300) {
24185
24407
  const text = await res.text().catch(() => "");
@@ -24337,6 +24559,38 @@ var anthropicBodyOrder = [
24337
24559
  "stream"
24338
24560
  ];
24339
24561
 
24562
+ // packages/providers/src/antigravity/profile.ts
24563
+ var ANTIGRAVITY_IDE_VERSION = env("OMNI_ANTIGRAVITY_IDE_VERSION", "2.12.2");
24564
+ var PLATFORM = "darwin/arm64";
24565
+ var antigravityProfile = {
24566
+ headers: [
24567
+ [
24568
+ "User-Agent",
24569
+ env("OMNI_UA_ANTIGRAVITY", `antigravity/ide/${ANTIGRAVITY_IDE_VERSION} ${PLATFORM}`)
24570
+ ],
24571
+ ["Content-Type", "application/json"],
24572
+ ["Accept", "text/event-stream"]
24573
+ ],
24574
+ order: envOrder("OMNI_ORDER_ANTIGRAVITY", [
24575
+ "Host",
24576
+ "Content-Type",
24577
+ "Authorization",
24578
+ "User-Agent",
24579
+ "X-Goog-Api-Client",
24580
+ "Accept",
24581
+ "Accept-Encoding",
24582
+ "Content-Length"
24583
+ ])
24584
+ };
24585
+ var antigravityBodyOrder = [
24586
+ "project",
24587
+ "requestId",
24588
+ "model",
24589
+ "userAgent",
24590
+ "requestType",
24591
+ "request"
24592
+ ];
24593
+
24340
24594
  // packages/providers/src/custom/profile.ts
24341
24595
  var customProfile = { headers: [], order: [] };
24342
24596
  var customBodyOrder = [];
@@ -24458,6 +24712,43 @@ var kimiBodyOrder = [
24458
24712
  "stream"
24459
24713
  ];
24460
24714
 
24715
+ // packages/providers/src/muse/profile.ts
24716
+ var MUSE_CLI_VERSION = env("OMNI_MUSE_CLI_VERSION", "1.0.3");
24717
+ var museProfile = {
24718
+ headers: [
24719
+ ["User-Agent", env("OMNI_UA_MUSE", `muse-code/${MUSE_CLI_VERSION}`)],
24720
+ ["x-api-version", env("OMNI_MUSE_API_VERSION", "1.0.0")],
24721
+ ["Accept", "text/event-stream"]
24722
+ ],
24723
+ order: envOrder("OMNI_ORDER_MUSE", [
24724
+ "Host",
24725
+ "Content-Type",
24726
+ "Authorization",
24727
+ "x-meta-ai-gateway-session-id",
24728
+ "x-api-version",
24729
+ "Accept",
24730
+ "User-Agent",
24731
+ "Accept-Encoding",
24732
+ "Content-Length"
24733
+ ])
24734
+ };
24735
+ var museBodyOrder = [
24736
+ "model",
24737
+ "stream",
24738
+ "input",
24739
+ "instructions",
24740
+ "store",
24741
+ "reasoning",
24742
+ "prompt_cache_key",
24743
+ "max_output_tokens",
24744
+ "temperature",
24745
+ "tools",
24746
+ "tool_choice",
24747
+ "include",
24748
+ "parallel_tool_calls",
24749
+ "metadata"
24750
+ ];
24751
+
24461
24752
  // packages/providers/src/openai/profile.ts
24462
24753
  var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.144.1");
24463
24754
  var OPENAI_UA_PLATFORM = env("OMNI_OPENAI_UA_PLATFORM", "Windows 10.0.26200");
@@ -24514,6 +24805,8 @@ var BODY_ORDER = {
24514
24805
  kimi: kimiBodyOrder,
24515
24806
  kilo: kiloBodyOrder,
24516
24807
  grok: grokBodyOrder,
24808
+ antigravity: antigravityBodyOrder,
24809
+ muse: museBodyOrder,
24517
24810
  custom: customBodyOrder
24518
24811
  };
24519
24812
  Object.setPrototypeOf(BODY_ORDER, null);
@@ -24607,6 +24900,8 @@ var PROVIDER_MODEL_CATALOG = {
24607
24900
  kimi: KIMI_MODELS,
24608
24901
  kilo: KILO_MODELS,
24609
24902
  grok: GROK_MODELS,
24903
+ antigravity: ANTIGRAVITY_MODELS,
24904
+ muse: MUSE_MODELS,
24610
24905
  custom: CUSTOM_MODELS
24611
24906
  };
24612
24907
  Object.setPrototypeOf(PROVIDER_MODEL_CATALOG, null);
@@ -24637,6 +24932,8 @@ var PROFILES = {
24637
24932
  kimi: kimiProfile,
24638
24933
  kilo: kiloProfile,
24639
24934
  grok: grokProfile,
24935
+ antigravity: antigravityProfile,
24936
+ muse: museProfile,
24640
24937
  custom: customProfile
24641
24938
  };
24642
24939
  Object.setPrototypeOf(PROFILES, null);
@@ -25905,6 +26202,751 @@ var anthropicOAuthFlow = {
25905
26202
  return parseAnthropicUsage(parsed(res.body), now());
25906
26203
  }
25907
26204
  };
26205
+ // packages/providers/src/antigravity/codec.ts
26206
+ import { createHash as createHash2 } from "crypto";
26207
+
26208
+ // packages/providers/src/antigravity/decode.ts
26209
+ var STOP_REASON2 = {
26210
+ STOP: "endTurn",
26211
+ MAX_TOKENS: "maxTokens",
26212
+ SAFETY: "contentFilter",
26213
+ PROHIBITED_CONTENT: "contentFilter",
26214
+ SPII: "contentFilter",
26215
+ BLOCKLIST: "contentFilter",
26216
+ RECITATION: "contentFilter"
26217
+ };
26218
+ var ERROR_CODE = {
26219
+ RESOURCE_EXHAUSTED: "RATE_LIMIT",
26220
+ UNAUTHENTICATED: "AUTH",
26221
+ PERMISSION_DENIED: "AUTH",
26222
+ INVALID_ARGUMENT: "BAD_REQUEST",
26223
+ FAILED_PRECONDITION: "BAD_REQUEST",
26224
+ UNAVAILABLE: "UPSTREAM",
26225
+ INTERNAL: "UPSTREAM",
26226
+ DEADLINE_EXCEEDED: "TIMEOUT"
26227
+ };
26228
+ function json3(data) {
26229
+ try {
26230
+ const value = JSON.parse(data);
26231
+ return typeof value === "object" && value !== null ? value : null;
26232
+ } catch {
26233
+ return null;
26234
+ }
26235
+ }
26236
+ function count(value) {
26237
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
26238
+ }
26239
+ function usageOf(meta3) {
26240
+ return usageFromPromptTotal(count(meta3?.promptTokenCount), count(meta3?.candidatesTokenCount) + count(meta3?.thoughtsTokenCount), count(meta3?.cachedContentTokenCount));
26241
+ }
26242
+ async function* decodeAntigravityStream(messages) {
26243
+ let started = false;
26244
+ let terminal = false;
26245
+ let nextIndex = 0;
26246
+ let toolCalls = 0;
26247
+ let open2 = null;
26248
+ const closeOpen = function* () {
26249
+ if (open2 === null)
26250
+ return;
26251
+ yield { type: "blockEnd", index: open2.index };
26252
+ open2 = null;
26253
+ };
26254
+ for await (const message of messages) {
26255
+ if (message.data === "[DONE]")
26256
+ continue;
26257
+ const frame = json3(message.data);
26258
+ if (frame === null)
26259
+ continue;
26260
+ const failure = frame.error ?? frame.response?.error;
26261
+ if (failure !== undefined) {
26262
+ terminal = true;
26263
+ yield* closeOpen();
26264
+ const status = String(failure.status ?? "");
26265
+ const code = (Object.hasOwn(ERROR_CODE, status) ? ERROR_CODE[status] : undefined) ?? "UPSTREAM";
26266
+ yield {
26267
+ type: "error",
26268
+ code,
26269
+ message: String(failure.message ?? "upstream error"),
26270
+ retryable: RETRYABLE[code]
26271
+ };
26272
+ return;
26273
+ }
26274
+ const response = frame.response;
26275
+ if (response === undefined)
26276
+ continue;
26277
+ const blocked = response.promptFeedback?.blockReason;
26278
+ if (blocked !== undefined && (response.candidates ?? []).length === 0) {
26279
+ terminal = true;
26280
+ if (!started)
26281
+ yield { type: "start", id: "", model: "" };
26282
+ yield* closeOpen();
26283
+ yield { type: "end", stopReason: "contentFilter", usage: usageOf(response.usageMetadata) };
26284
+ return;
26285
+ }
26286
+ if (!started) {
26287
+ started = true;
26288
+ yield {
26289
+ type: "start",
26290
+ id: String(response.responseId ?? ""),
26291
+ model: String(response.modelVersion ?? "")
26292
+ };
26293
+ }
26294
+ const candidates = response.candidates ?? [];
26295
+ if (candidates.length > 1) {
26296
+ terminal = true;
26297
+ yield* closeOpen();
26298
+ yield {
26299
+ type: "error",
26300
+ code: "UPSTREAM",
26301
+ message: `Antigravity returned ${candidates.length} candidates, which cannot be represented`,
26302
+ retryable: false
26303
+ };
26304
+ return;
26305
+ }
26306
+ const candidate = candidates[0];
26307
+ for (const part of candidate?.content?.parts ?? []) {
26308
+ const call = part.functionCall;
26309
+ if (call !== undefined && typeof call.name === "string") {
26310
+ yield* closeOpen();
26311
+ const index = nextIndex++;
26312
+ yield {
26313
+ type: "blockStart",
26314
+ index,
26315
+ block: {
26316
+ type: "toolUse",
26317
+ id: typeof call.id === "string" && call.id.length > 0 ? call.id : `fc_${toolCalls}`,
26318
+ name: call.name
26319
+ }
26320
+ };
26321
+ yield {
26322
+ type: "blockDelta",
26323
+ index,
26324
+ delta: { type: "toolJson", partial: JSON.stringify(call.args ?? {}) }
26325
+ };
26326
+ yield { type: "blockEnd", index };
26327
+ toolCalls++;
26328
+ continue;
26329
+ }
26330
+ if (typeof part.text !== "string")
26331
+ continue;
26332
+ const kind = part.thought === true ? "thinking" : "text";
26333
+ if (open2 === null || open2.kind !== kind) {
26334
+ yield* closeOpen();
26335
+ open2 = { kind, index: nextIndex++ };
26336
+ yield { type: "blockStart", index: open2.index, block: { type: kind } };
26337
+ }
26338
+ yield {
26339
+ type: "blockDelta",
26340
+ index: open2.index,
26341
+ delta: kind === "thinking" ? { type: "thinking", text: part.text } : { type: "text", text: part.text }
26342
+ };
26343
+ }
26344
+ const finish = candidate?.finishReason;
26345
+ if (finish === undefined || finish === null)
26346
+ continue;
26347
+ terminal = true;
26348
+ yield* closeOpen();
26349
+ const raw = String(finish);
26350
+ if (raw === "MALFORMED_FUNCTION_CALL") {
26351
+ yield {
26352
+ type: "error",
26353
+ code: "BAD_REQUEST",
26354
+ message: "the model emitted a malformed function call",
26355
+ retryable: false
26356
+ };
26357
+ return;
26358
+ }
26359
+ const mapped = Object.hasOwn(STOP_REASON2, raw) ? STOP_REASON2[raw] : undefined;
26360
+ if (mapped === undefined) {
26361
+ yield {
26362
+ type: "error",
26363
+ code: "UPSTREAM",
26364
+ message: `unrecognized Antigravity finish reason "${raw}"`,
26365
+ retryable: false
26366
+ };
26367
+ return;
26368
+ }
26369
+ yield {
26370
+ type: "end",
26371
+ stopReason: toolCalls > 0 ? "toolUse" : mapped,
26372
+ usage: usageOf(response.usageMetadata)
26373
+ };
26374
+ return;
26375
+ }
26376
+ if (!terminal) {
26377
+ yield* closeOpen();
26378
+ yield {
26379
+ type: "error",
26380
+ code: "UPSTREAM",
26381
+ message: "upstream stream ended before the response finished",
26382
+ retryable: RETRYABLE.UPSTREAM
26383
+ };
26384
+ }
26385
+ }
26386
+
26387
+ // packages/providers/src/antigravity/wire.ts
26388
+ var SIGNATURE_BYPASS = "skip_thought_signature_validator";
26389
+ function toolNamesById(req) {
26390
+ const names = new Map;
26391
+ for (const message of req.messages) {
26392
+ for (const block of message.content) {
26393
+ if (block.type === "toolUse")
26394
+ names.set(block.id, block.name);
26395
+ }
26396
+ }
26397
+ return names;
26398
+ }
26399
+ function mergeSameRole(contents) {
26400
+ const merged = [];
26401
+ for (const entry of contents) {
26402
+ const last = merged[merged.length - 1];
26403
+ if (last !== undefined && last.role === entry.role)
26404
+ last.parts.push(...entry.parts);
26405
+ else
26406
+ merged.push({ role: entry.role, parts: [...entry.parts] });
26407
+ }
26408
+ return merged;
26409
+ }
26410
+ var hasCacheControl = (block) => ("cacheControl" in block) && block.cacheControl !== undefined;
26411
+ function encodeToolChoice2(choice) {
26412
+ switch (choice.type) {
26413
+ case "auto":
26414
+ return { functionCallingConfig: { mode: "AUTO" } };
26415
+ case "any":
26416
+ return { functionCallingConfig: { mode: "ANY" } };
26417
+ case "none":
26418
+ return { functionCallingConfig: { mode: "NONE" } };
26419
+ case "tool":
26420
+ return { functionCallingConfig: { mode: "ANY", allowedFunctionNames: [choice.name] } };
26421
+ }
26422
+ }
26423
+ function toAntigravityWire(req, model, identity) {
26424
+ const degradations = [];
26425
+ const note2 = (d) => {
26426
+ if (!degradations.includes(d))
26427
+ degradations.push(d);
26428
+ };
26429
+ const names = toolNamesById(req);
26430
+ const contents = [];
26431
+ for (const message of req.messages) {
26432
+ const parts = [];
26433
+ if (message.role === "system")
26434
+ note2("antigravity:system-turn-as-user");
26435
+ let role = message.role === "assistant" ? "model" : "user";
26436
+ for (const block of message.content) {
26437
+ if (hasCacheControl(block))
26438
+ note2("antigravity:cache-control-dropped");
26439
+ switch (block.type) {
26440
+ case "text":
26441
+ parts.push({ text: block.text });
26442
+ break;
26443
+ case "image":
26444
+ parts.push({ inlineData: { mimeType: block.mediaType, data: block.data } });
26445
+ break;
26446
+ case "thinking":
26447
+ note2("antigravity:thinking-dropped");
26448
+ break;
26449
+ case "toolUse":
26450
+ parts.push({
26451
+ thoughtSignature: SIGNATURE_BYPASS,
26452
+ functionCall: { name: block.name, args: block.input }
26453
+ });
26454
+ break;
26455
+ case "toolResult": {
26456
+ const name = names.get(block.toolUseId);
26457
+ if (name === undefined)
26458
+ note2("antigravity:tool-result-unmatched");
26459
+ if (block.isError === true)
26460
+ note2("antigravity:tool-result-error-flag-dropped");
26461
+ parts.push({
26462
+ functionResponse: {
26463
+ name: name ?? block.toolUseId,
26464
+ response: { output: block.content }
26465
+ }
26466
+ });
26467
+ role = "user";
26468
+ break;
26469
+ }
26470
+ case "providerNative":
26471
+ note2("antigravity:provider-native-block-dropped");
26472
+ break;
26473
+ }
26474
+ }
26475
+ if (parts.length > 0)
26476
+ contents.push({ role, parts });
26477
+ }
26478
+ const request2 = { contents: mergeSameRole(contents) };
26479
+ const system = systemText(req.system, "antigravity", note2);
26480
+ if (system !== undefined && system.length > 0) {
26481
+ request2.systemInstruction = { parts: [{ text: system }] };
26482
+ }
26483
+ const generationConfig = {};
26484
+ if (req.maxTokens !== undefined)
26485
+ generationConfig.maxOutputTokens = req.maxTokens;
26486
+ if (req.temperature !== undefined)
26487
+ generationConfig.temperature = req.temperature;
26488
+ if (req.stopSequences !== undefined)
26489
+ generationConfig.stopSequences = req.stopSequences;
26490
+ if (req.reasoning !== undefined) {
26491
+ switch (req.reasoning.mode) {
26492
+ case "off":
26493
+ generationConfig.thinkingConfig = { thinkingBudget: 0, includeThoughts: false };
26494
+ break;
26495
+ case "budget":
26496
+ generationConfig.thinkingConfig = {
26497
+ thinkingBudget: req.reasoning.budgetTokens,
26498
+ includeThoughts: req.reasoning.budgetTokens !== 0
26499
+ };
26500
+ break;
26501
+ case "adaptive":
26502
+ generationConfig.thinkingConfig = {
26503
+ includeThoughts: req.reasoning.display !== "omitted"
26504
+ };
26505
+ if (req.reasoning.effort !== undefined)
26506
+ note2("antigravity:reasoning-effort-dropped");
26507
+ break;
26508
+ }
26509
+ }
26510
+ const max = generationConfig.maxOutputTokens;
26511
+ if (max !== undefined && max > MAX_OUTPUT_TOKENS) {
26512
+ generationConfig.maxOutputTokens = MAX_OUTPUT_TOKENS;
26513
+ note2("antigravity:max-tokens-clamped");
26514
+ }
26515
+ const budget = generationConfig.thinkingConfig?.thinkingBudget;
26516
+ if (budget !== undefined && budget > 0) {
26517
+ const ceiling = generationConfig.maxOutputTokens;
26518
+ if (ceiling === undefined || ceiling <= budget) {
26519
+ generationConfig.maxOutputTokens = Math.min(budget + 1, MAX_OUTPUT_TOKENS);
26520
+ }
26521
+ }
26522
+ if (Object.keys(generationConfig).length > 0)
26523
+ request2.generationConfig = generationConfig;
26524
+ if (req.tools !== undefined) {
26525
+ const portable = req.tools.filter((t) => t.kind === "portable");
26526
+ if (portable.length !== req.tools.length)
26527
+ note2("antigravity:provider-tool-dropped");
26528
+ if (portable.length > 0) {
26529
+ request2.tools = [
26530
+ {
26531
+ functionDeclarations: portable.map((t) => ({
26532
+ name: t.name,
26533
+ description: t.description,
26534
+ parameters: t.inputSchema
26535
+ }))
26536
+ }
26537
+ ];
26538
+ }
26539
+ }
26540
+ if (req.toolChoice !== undefined)
26541
+ request2.toolConfig = encodeToolChoice2(req.toolChoice);
26542
+ Object.assign(request2, req.vendor?.antigravity ?? {});
26543
+ return {
26544
+ body: {
26545
+ project: identity.project,
26546
+ requestId: identity.requestId,
26547
+ model,
26548
+ userAgent: "antigravity",
26549
+ requestType: "agent",
26550
+ request: request2
26551
+ },
26552
+ degradations
26553
+ };
26554
+ }
26555
+
26556
+ // packages/providers/src/antigravity/codec.ts
26557
+ var URL2 = "https://daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse";
26558
+ var REQUEST_NAMESPACE = "omni-antigravity-req";
26559
+ function derivedRequestId(seed) {
26560
+ const h = createHash2("sha256").update(`${REQUEST_NAMESPACE}:${seed}`).digest("hex");
26561
+ const variant = (Number.parseInt(h[16], 16) & 3 | 8).toString(16);
26562
+ return [
26563
+ h.slice(0, 8),
26564
+ h.slice(8, 12),
26565
+ `4${h.slice(13, 16)}`,
26566
+ `${variant}${h.slice(17, 20)}`,
26567
+ h.slice(20, 32)
26568
+ ].join("-");
26569
+ }
26570
+ function projectOf(input2) {
26571
+ const stored = input2.credentials.providerData.projectId;
26572
+ const project = typeof stored === "string" ? stored.trim() : "";
26573
+ if (project.length === 0) {
26574
+ throw input2.fail("AUTH", "antigravity credential has no Cloud Code project; reconnect the account");
26575
+ }
26576
+ return project;
26577
+ }
26578
+ var antigravityCodec = {
26579
+ buildRequest(input2) {
26580
+ const accessToken = input2.credentials.accessToken;
26581
+ if (accessToken === null || accessToken.length === 0) {
26582
+ throw input2.fail("AUTH", "antigravity credential has no access token");
26583
+ }
26584
+ const project = projectOf(input2);
26585
+ const requestId = input2.requestId !== undefined && input2.requestId.length > 0 ? input2.requestId : derivedRequestId(`${input2.model}:${project}`);
26586
+ const { body, degradations } = toAntigravityWire(input2.request, input2.model, {
26587
+ project,
26588
+ requestId
26589
+ });
26590
+ const protocol = [["Authorization", `Bearer ${accessToken}`]];
26591
+ const headers = orderHeaders(mergeHeaders(antigravityProfile.headers, protocol), antigravityProfile.order);
26592
+ return {
26593
+ request: {
26594
+ url: URL2,
26595
+ method: "POST",
26596
+ headers,
26597
+ body: JSON.stringify(body)
26598
+ },
26599
+ degradations
26600
+ };
26601
+ },
26602
+ decode({ body }) {
26603
+ return decodeAntigravityStream(parseSse(body));
26604
+ }
26605
+ };
26606
+
26607
+ // packages/providers/src/antigravity/index.ts
26608
+ var antigravityAdapter = codecAdapter("antigravity", antigravityDescriptor.capabilities, antigravityCodec);
26609
+ // packages/providers/src/antigravity/oauth.ts
26610
+ var MASK = "omnigateway-public-v1";
26611
+ function unmask(bytes) {
26612
+ let out = "";
26613
+ for (let i = 0;i < bytes.length; i++) {
26614
+ out += String.fromCharCode(bytes[i] ^ MASK.charCodeAt(i % MASK.length));
26615
+ }
26616
+ return out;
26617
+ }
26618
+ var ANTIGRAVITY_CLIENT_ID = unmask([
26619
+ 94,
26620
+ 93,
26621
+ 89,
26622
+ 88,
26623
+ 87,
26624
+ 81,
26625
+ 66,
26626
+ 85,
26627
+ 65,
26628
+ 81,
26629
+ 76,
26630
+ 20,
26631
+ 65,
26632
+ 88,
26633
+ 22,
26634
+ 1,
26635
+ 1,
26636
+ 16,
26637
+ 94,
26638
+ 31,
26639
+ 95,
26640
+ 93,
26641
+ 5,
26642
+ 92,
26643
+ 88,
26644
+ 11,
26645
+ 2,
26646
+ 6,
26647
+ 0,
26648
+ 69,
26649
+ 82,
26650
+ 76,
26651
+ 91,
26652
+ 4,
26653
+ 26,
26654
+ 14,
26655
+ 3,
26656
+ 3,
26657
+ 11,
26658
+ 25,
26659
+ 17,
26660
+ 5,
26661
+ 95,
26662
+ 94,
26663
+ 11,
26664
+ 25,
26665
+ 73,
26666
+ 0,
26667
+ 4,
26668
+ 21,
26669
+ 4,
26670
+ 79,
26671
+ 30,
26672
+ 66,
26673
+ 31,
26674
+ 18,
26675
+ 14,
26676
+ 9,
26677
+ 28,
26678
+ 16,
26679
+ 72,
26680
+ 4,
26681
+ 82,
26682
+ 0,
26683
+ 3,
26684
+ 26,
26685
+ 12,
26686
+ 9,
26687
+ 21,
26688
+ 90,
26689
+ 6,
26690
+ 24,
26691
+ 12
26692
+ ]);
26693
+ var CLIENT_ID2 = ANTIGRAVITY_CLIENT_ID;
26694
+ var CLIENT_SECRET = unmask([
26695
+ 40,
26696
+ 34,
26697
+ 45,
26698
+ 58,
26699
+ 55,
26700
+ 57,
26701
+ 89,
26702
+ 46,
26703
+ 66,
26704
+ 89,
26705
+ 63,
26706
+ 122,
26707
+ 34,
26708
+ 65,
26709
+ 90,
26710
+ 90,
26711
+ 37,
26712
+ 7,
26713
+ 97,
26714
+ 60,
26715
+ 0,
26716
+ 2,
26717
+ 33,
26718
+ 44,
26719
+ 81,
26720
+ 20,
26721
+ 57,
26722
+ 55,
26723
+ 81,
26724
+ 13,
26725
+ 87,
26726
+ 8,
26727
+ 105,
26728
+ 49,
26729
+ 19
26730
+ ]);
26731
+ var AUTHORIZE_URL2 = "https://accounts.google.com/o/oauth2/v2/auth";
26732
+ var TOKEN_URL2 = "https://oauth2.googleapis.com/token";
26733
+ var USERINFO_URL = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json";
26734
+ var CODE_ASSIST = "https://cloudcode-pa.googleapis.com/v1internal";
26735
+ var LOAD_CODE_ASSIST_URL = `${CODE_ASSIST}:loadCodeAssist`;
26736
+ var ONBOARD_USER_URL = `${CODE_ASSIST}:onboardUser`;
26737
+ var QUOTA_SUMMARY_URL = `${CODE_ASSIST}:retrieveUserQuotaSummary`;
26738
+ var SCOPES2 = [
26739
+ "https://www.googleapis.com/auth/cloud-platform",
26740
+ "https://www.googleapis.com/auth/userinfo.email",
26741
+ "https://www.googleapis.com/auth/userinfo.profile",
26742
+ "https://www.googleapis.com/auth/cclog",
26743
+ "https://www.googleapis.com/auth/experimentsandconfigs"
26744
+ ].join(" ");
26745
+ var IDE_METADATA = { ideType: "ANTIGRAVITY" };
26746
+ var DEFAULT_TIER = "legacy-tier";
26747
+ function parseTokenResponse(value) {
26748
+ const record2 = recordOf(value);
26749
+ if (record2 === null || typeof record2.access_token !== "string")
26750
+ return null;
26751
+ return {
26752
+ accessToken: record2.access_token,
26753
+ refreshToken: typeof record2.refresh_token === "string" ? record2.refresh_token : null,
26754
+ expiresIn: typeof record2.expires_in === "number" ? record2.expires_in : null
26755
+ };
26756
+ }
26757
+ async function* postToken2(body, fail) {
26758
+ const res = yield postJsonRequest(TOKEN_URL2, antigravityProfile, {
26759
+ contentType: "application/x-www-form-urlencoded",
26760
+ body: new URLSearchParams(body).toString()
26761
+ });
26762
+ const parsed2 = parsed(res.body);
26763
+ if (res.status < 200 || res.status >= 300) {
26764
+ throw fail(tokenErrorCode(res.status), tokenErrorMessage(res.status, parsed2));
26765
+ }
26766
+ const token = parseTokenResponse(parsed2);
26767
+ if (token === null)
26768
+ throw fail("AUTH", "token endpoint returned no access_token");
26769
+ return token;
26770
+ }
26771
+ function projectFrom(value) {
26772
+ const record2 = recordOf(value);
26773
+ if (record2 === null)
26774
+ return "";
26775
+ const project = record2.cloudaicompanionProject;
26776
+ if (typeof project === "string")
26777
+ return project.trim();
26778
+ const nested = recordOf(project);
26779
+ const id = nested?.id;
26780
+ return typeof id === "string" ? id.trim() : "";
26781
+ }
26782
+ function tierFrom(value) {
26783
+ const record2 = recordOf(value);
26784
+ const tiers = record2?.allowedTiers;
26785
+ if (Array.isArray(tiers)) {
26786
+ for (const entry of tiers) {
26787
+ const tier = recordOf(entry);
26788
+ if (tier?.isDefault === true && typeof tier.id === "string")
26789
+ return tier.id;
26790
+ }
26791
+ }
26792
+ const current = recordOf(record2?.currentTier);
26793
+ return typeof current?.id === "string" ? current.id : DEFAULT_TIER;
26794
+ }
26795
+ function codeAssistRequest(url2, accessToken, body) {
26796
+ return postJsonRequest(url2, antigravityProfile, {
26797
+ contentType: "application/json",
26798
+ body: JSON.stringify(body),
26799
+ extraHeaders: [["Authorization", `Bearer ${accessToken}`]]
26800
+ });
26801
+ }
26802
+ async function* bootstrapProject(accessToken) {
26803
+ const loaded = yield codeAssistRequest(LOAD_CODE_ASSIST_URL, accessToken, {
26804
+ metadata: IDE_METADATA
26805
+ });
26806
+ const body = loaded.status >= 200 && loaded.status < 300 ? parsed(loaded.body) : null;
26807
+ const tier = tierFrom(body);
26808
+ const existing = projectFrom(body);
26809
+ if (existing.length > 0)
26810
+ return { projectId: existing, tier };
26811
+ const onboarded = yield codeAssistRequest(ONBOARD_USER_URL, accessToken, {
26812
+ tier_id: tier,
26813
+ metadata: IDE_METADATA
26814
+ });
26815
+ if (onboarded.status < 200 || onboarded.status >= 300)
26816
+ return { projectId: "", tier };
26817
+ const operation = recordOf(parsed(onboarded.body));
26818
+ return { projectId: projectFrom(operation?.response), tier };
26819
+ }
26820
+ async function* readEmail(accessToken) {
26821
+ const res = yield getJsonRequest(USERINFO_URL, antigravityProfile, { accessToken });
26822
+ if (res.status < 200 || res.status >= 300)
26823
+ return null;
26824
+ const record2 = recordOf(parsed(res.body));
26825
+ const email3 = record2?.email;
26826
+ return typeof email3 === "string" && email3.trim().length > 0 ? email3 : null;
26827
+ }
26828
+ function toResult2(token, fallbackRefresh, accountEmail, providerData, now) {
26829
+ return {
26830
+ secrets: {
26831
+ accessToken: token.accessToken,
26832
+ refreshToken: token.refreshToken ?? fallbackRefresh,
26833
+ apiKey: null,
26834
+ idToken: null
26835
+ },
26836
+ expiresAt: token.expiresIn === null ? null : now() + token.expiresIn * 1000,
26837
+ accountEmail,
26838
+ providerData
26839
+ };
26840
+ }
26841
+ var GEMINI_GROUP = /\bgemini\b/;
26842
+ function windowOf(bucket) {
26843
+ const text = `${String(bucket.bucketId ?? "")} ${String(bucket.displayName ?? "")}`.toLowerCase();
26844
+ if (/\bweekly\b|\bweek\b/.test(text))
26845
+ return "weekly";
26846
+ if (/\b5\s*-?\s*hour|\b5h\b|\bfive\s*hour/.test(text))
26847
+ return "fiveHour";
26848
+ return null;
26849
+ }
26850
+ function groupsOf(value) {
26851
+ const root = recordOf(value);
26852
+ if (root === null)
26853
+ return [];
26854
+ if (Array.isArray(root.groups))
26855
+ return root.groups;
26856
+ const nested = recordOf(root.quotaSummary)?.groups;
26857
+ return Array.isArray(nested) ? nested : [];
26858
+ }
26859
+ function parseAntigravityQuota(value, now) {
26860
+ const windows = [];
26861
+ for (const groupValue of groupsOf(value)) {
26862
+ const group = recordOf(groupValue);
26863
+ if (group === null)
26864
+ continue;
26865
+ if (!GEMINI_GROUP.test(String(group.displayName ?? "").toLowerCase()))
26866
+ continue;
26867
+ const buckets = Array.isArray(group.buckets) ? group.buckets : [];
26868
+ for (const bucketValue of buckets) {
26869
+ const bucket = recordOf(bucketValue);
26870
+ if (bucket === null || bucket.disabled === true)
26871
+ continue;
26872
+ const windowType = windowOf(bucket);
26873
+ if (windowType === null)
26874
+ continue;
26875
+ const fraction = numberOf(bucket, ["remainingFraction"]);
26876
+ if (fraction === null)
26877
+ continue;
26878
+ const remaining = Math.max(0, Math.min(1, fraction));
26879
+ windows.push({
26880
+ windowType,
26881
+ used: Math.round((1 - remaining) * 100),
26882
+ limit: 100,
26883
+ resetsAt: resetAtOf(bucket, { absolute: ["resetTime"] }, now),
26884
+ windowMs: null
26885
+ });
26886
+ }
26887
+ }
26888
+ return reportFrom(windows);
26889
+ }
26890
+ var antigravityOAuthFlow = {
26891
+ kind: "pkce",
26892
+ supportsManualPaste: true,
26893
+ async* start({ redirectUri, randomState }) {
26894
+ const state = randomState();
26895
+ const url2 = new URL(AUTHORIZE_URL2);
26896
+ url2.searchParams.set("client_id", CLIENT_ID2);
26897
+ url2.searchParams.set("response_type", "code");
26898
+ url2.searchParams.set("redirect_uri", redirectUri);
26899
+ url2.searchParams.set("scope", SCOPES2);
26900
+ url2.searchParams.set("state", state);
26901
+ url2.searchParams.set("access_type", "offline");
26902
+ url2.searchParams.set("prompt", "consent");
26903
+ return {
26904
+ authorizeUrl: url2.toString(),
26905
+ pending: { verifier: "", challenge: "", state, redirectUri }
26906
+ };
26907
+ },
26908
+ async* exchange({ code, pending, fail, now }) {
26909
+ const [rawCode, pastedState] = code.split("#");
26910
+ if (pastedState !== undefined && pastedState !== pending.state) {
26911
+ throw fail("AUTH", "authorization state mismatch");
26912
+ }
26913
+ const token = yield* postToken2({
26914
+ grant_type: "authorization_code",
26915
+ client_id: CLIENT_ID2,
26916
+ client_secret: CLIENT_SECRET,
26917
+ code: (rawCode ?? "").trim(),
26918
+ redirect_uri: pending.redirectUri
26919
+ }, fail);
26920
+ const email3 = yield* readEmail(token.accessToken);
26921
+ const { projectId, tier } = yield* bootstrapProject(token.accessToken);
26922
+ return toResult2(token, null, email3, { projectId, tier }, now);
26923
+ },
26924
+ async* refresh({ refreshToken, providerData, fail, now }) {
26925
+ const token = yield* postToken2({
26926
+ grant_type: "refresh_token",
26927
+ client_id: CLIENT_ID2,
26928
+ client_secret: CLIENT_SECRET,
26929
+ refresh_token: refreshToken
26930
+ }, fail);
26931
+ return toResult2(token, refreshToken, null, providerData, now);
26932
+ },
26933
+ async* usage({ secrets, providerData, now }) {
26934
+ const project = typeof providerData.projectId === "string" ? providerData.projectId : "";
26935
+ if (project.trim().length === 0)
26936
+ return null;
26937
+ const res = yield {
26938
+ ...postJsonRequest(QUOTA_SUMMARY_URL, antigravityProfile, {
26939
+ contentType: "application/json",
26940
+ body: JSON.stringify({ project }),
26941
+ extraHeaders: [["Authorization", `Bearer ${secrets.accessToken}`]]
26942
+ }),
26943
+ timeoutMs: SHORT_TIMEOUT_MS
26944
+ };
26945
+ if (!usageReadable(res.status, "antigravity"))
26946
+ return null;
26947
+ return parseAntigravityQuota(parsed(res.body), now());
26948
+ }
26949
+ };
25908
26950
  // packages/providers/src/grok/device.ts
25909
26951
  import { randomUUID } from "crypto";
25910
26952
  function mintGrokDevice() {
@@ -25918,10 +26960,10 @@ function grokDeviceHeaders(providerData) {
25918
26960
  }
25919
26961
 
25920
26962
  // packages/providers/src/grok/oauth.ts
25921
- var CLIENT_ID2 = "b1a00492-073a-47ea-816f-4c329264a828";
26963
+ var CLIENT_ID3 = "b1a00492-073a-47ea-816f-4c329264a828";
25922
26964
  var ISSUER = "https://auth.x.ai";
25923
26965
  var DISCOVERY_URL = `${ISSUER}/.well-known/openid-configuration`;
25924
- var SCOPES2 = [
26966
+ var SCOPES3 = [
25925
26967
  "openid",
25926
26968
  "profile",
25927
26969
  "email",
@@ -25967,7 +27009,7 @@ async function* discover(fail) {
25967
27009
  tokenUrl: trustedEndpoint(parsed2.token_endpoint, "token_endpoint", fail)
25968
27010
  };
25969
27011
  }
25970
- function parseTokenResponse(value) {
27012
+ function parseTokenResponse2(value) {
25971
27013
  if (!isRecord2(value) || typeof value.access_token !== "string")
25972
27014
  return null;
25973
27015
  return {
@@ -25983,15 +27025,15 @@ function emailFromIdToken(idToken) {
25983
27025
  if (parts.length !== 3 || payload === undefined || payload.length === 0)
25984
27026
  return null;
25985
27027
  try {
25986
- const json3 = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
25987
- if (!isRecord2(json3))
27028
+ const json4 = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
27029
+ if (!isRecord2(json4))
25988
27030
  return null;
25989
- return typeof json3.email === "string" && json3.email.trim().length > 0 ? json3.email : null;
27031
+ return typeof json4.email === "string" && json4.email.trim().length > 0 ? json4.email : null;
25990
27032
  } catch {
25991
27033
  return null;
25992
27034
  }
25993
27035
  }
25994
- async function* postToken2(tokenUrl, body, fail) {
27036
+ async function* postToken3(tokenUrl, body, fail) {
25995
27037
  const res = yield postJsonRequest(tokenUrl, grokProfile, {
25996
27038
  contentType: "application/x-www-form-urlencoded",
25997
27039
  body: new URLSearchParams(body).toString()
@@ -26000,7 +27042,7 @@ async function* postToken2(tokenUrl, body, fail) {
26000
27042
  if (res.status < 200 || res.status >= 300) {
26001
27043
  throw fail(tokenErrorCode(res.status), tokenErrorMessage(res.status, parsed2));
26002
27044
  }
26003
- const token = parseTokenResponse(parsed2);
27045
+ const token = parseTokenResponse2(parsed2);
26004
27046
  if (token === null) {
26005
27047
  throw fail("AUTH", "token endpoint returned no access_token");
26006
27048
  }
@@ -26010,7 +27052,7 @@ function agentIdFrom(providerData) {
26010
27052
  const stored = providerData.agentId;
26011
27053
  return typeof stored === "string" && stored.trim().length > 0 ? stored : mintGrokDevice().agentId;
26012
27054
  }
26013
- function toResult2(token, fallbackRefresh, agentId, now) {
27055
+ function toResult3(token, fallbackRefresh, agentId, now) {
26014
27056
  return {
26015
27057
  secrets: {
26016
27058
  accessToken: token.accessToken,
@@ -26032,9 +27074,9 @@ var grokOAuthFlow = {
26032
27074
  const state = randomState();
26033
27075
  const url2 = new URL(authorizeUrl);
26034
27076
  url2.searchParams.set("response_type", "code");
26035
- url2.searchParams.set("client_id", CLIENT_ID2);
27077
+ url2.searchParams.set("client_id", CLIENT_ID3);
26036
27078
  url2.searchParams.set("redirect_uri", redirectUri);
26037
- url2.searchParams.set("scope", SCOPES2);
27079
+ url2.searchParams.set("scope", SCOPES3);
26038
27080
  url2.searchParams.set("code_challenge", challenge);
26039
27081
  url2.searchParams.set("code_challenge_method", "S256");
26040
27082
  url2.searchParams.set("state", state);
@@ -26048,19 +27090,19 @@ var grokOAuthFlow = {
26048
27090
  throw fail("AUTH", "authorization state mismatch");
26049
27091
  }
26050
27092
  const { tokenUrl } = yield* discover(fail);
26051
- const token = yield* postToken2(tokenUrl, {
27093
+ const token = yield* postToken3(tokenUrl, {
26052
27094
  grant_type: "authorization_code",
26053
27095
  code: (rawCode ?? "").trim(),
26054
27096
  redirect_uri: pending.redirectUri,
26055
- client_id: CLIENT_ID2,
27097
+ client_id: CLIENT_ID3,
26056
27098
  code_verifier: pending.verifier
26057
27099
  }, fail);
26058
- return toResult2(token, null, mintGrokDevice().agentId, now);
27100
+ return toResult3(token, null, mintGrokDevice().agentId, now);
26059
27101
  },
26060
27102
  async* refresh({ refreshToken, providerData, fail, now }) {
26061
27103
  const { tokenUrl } = yield* discover(fail);
26062
- const token = yield* postToken2(tokenUrl, { grant_type: "refresh_token", client_id: CLIENT_ID2, refresh_token: refreshToken }, fail);
26063
- return toResult2(token, refreshToken, agentIdFrom(providerData), now);
27104
+ const token = yield* postToken3(tokenUrl, { grant_type: "refresh_token", client_id: CLIENT_ID3, refresh_token: refreshToken }, fail);
27105
+ return toResult3(token, refreshToken, agentIdFrom(providerData), now);
26064
27106
  }
26065
27107
  };
26066
27108
 
@@ -26220,9 +27262,9 @@ function kimiDeviceHeaders(providerData) {
26220
27262
  }
26221
27263
 
26222
27264
  // packages/providers/src/kimi/oauth.ts
26223
- var CLIENT_ID3 = "17e5f671-d194-4dfb-9706-5516cb48c098";
27265
+ var CLIENT_ID4 = "17e5f671-d194-4dfb-9706-5516cb48c098";
26224
27266
  var DEVICE_CODE_URL = "https://auth.kimi.com/api/oauth/device_authorization";
26225
- var TOKEN_URL2 = "https://auth.kimi.com/api/oauth/token";
27267
+ var TOKEN_URL3 = "https://auth.kimi.com/api/oauth/token";
26226
27268
  var USAGE_URL2 = "https://api.kimi.com/coding/v1/usages";
26227
27269
  var DEFAULT_INTERVAL_SECONDS = 5;
26228
27270
  var PENDING_ERRORS = new Set(["authorization_pending", "slow_down"]);
@@ -26276,7 +27318,7 @@ function deviceCodeFrom2(value, fail) {
26276
27318
  async function* post(url2, body, device, fail, keepPolling) {
26277
27319
  const res = yield postJsonRequest(url2, kimiProfile, {
26278
27320
  contentType: "application/x-www-form-urlencoded",
26279
- body: new URLSearchParams({ ...body, client_id: CLIENT_ID3 }).toString(),
27321
+ body: new URLSearchParams({ ...body, client_id: CLIENT_ID4 }).toString(),
26280
27322
  extraHeaders: kimiDeviceHeaders(device)
26281
27323
  });
26282
27324
  const parsed2 = parsed(res.body);
@@ -26307,7 +27349,7 @@ function deviceFrom(source) {
26307
27349
  function deviceForBegin(deviceId) {
26308
27350
  return { ...mintKimiDevice(), deviceId };
26309
27351
  }
26310
- function toResult3(token, device, fallbackRefresh, now) {
27352
+ function toResult4(token, device, fallbackRefresh, now) {
26311
27353
  return {
26312
27354
  secrets: {
26313
27355
  accessToken: token.accessToken,
@@ -26362,17 +27404,17 @@ var kimiOAuthFlow = {
26362
27404
  throw fail("INTERNAL", "kimi exchange requires a pending flow produced by begin()");
26363
27405
  }
26364
27406
  const device = deviceFrom(pending.extra);
26365
- const token = tokenFrom(yield* post(TOKEN_URL2, {
27407
+ const token = tokenFrom(yield* post(TOKEN_URL3, {
26366
27408
  grant_type: "urn:ietf:params:oauth:grant-type:device_code",
26367
27409
  device_code: pending.deviceCode,
26368
27410
  device_id: device.deviceId
26369
27411
  }, device, fail, keepPolling), fail);
26370
- return toResult3(token, device, null, now);
27412
+ return toResult4(token, device, null, now);
26371
27413
  },
26372
27414
  async* refresh({ refreshToken, providerData, fail, keepPolling, now }) {
26373
27415
  const device = deviceFrom(providerData);
26374
- const token = tokenFrom(yield* post(TOKEN_URL2, { grant_type: "refresh_token", refresh_token: refreshToken, device_id: device.deviceId }, device, fail, keepPolling), fail);
26375
- return toResult3(token, device, refreshToken, now);
27416
+ const token = tokenFrom(yield* post(TOKEN_URL3, { grant_type: "refresh_token", refresh_token: refreshToken, device_id: device.deviceId }, device, fail, keepPolling), fail);
27417
+ return toResult4(token, device, refreshToken, now);
26376
27418
  },
26377
27419
  async* usage({ secrets, providerData, now }) {
26378
27420
  if (secrets.accessToken === null)
@@ -26388,13 +27430,225 @@ var kimiOAuthFlow = {
26388
27430
  }
26389
27431
  };
26390
27432
 
27433
+ // packages/providers/src/muse/endpoint.ts
27434
+ var TRUSTED_HOST2 = "meta.ai";
27435
+ var MUSE_DEFAULT_BASE_URL = "https://api.meta.ai/v1";
27436
+ function trustedBaseUrl(value) {
27437
+ if (typeof value !== "string" || value.length === 0)
27438
+ return null;
27439
+ let url2;
27440
+ try {
27441
+ url2 = new URL(value);
27442
+ } catch {
27443
+ return null;
27444
+ }
27445
+ if (url2.protocol !== "https:")
27446
+ return null;
27447
+ const host2 = url2.hostname;
27448
+ if (host2 !== TRUSTED_HOST2 && !host2.endsWith(`.${TRUSTED_HOST2}`))
27449
+ return null;
27450
+ return `${url2.origin}${url2.pathname}`.replace(/\/$/, "");
27451
+ }
27452
+ function museResponsesUrl(providerData) {
27453
+ return `${trustedBaseUrl(providerData.baseUrl) ?? MUSE_DEFAULT_BASE_URL}/responses`;
27454
+ }
27455
+
27456
+ // packages/providers/src/muse/oauth.ts
27457
+ var AUTH_BASE = "https://auth.meta.com";
27458
+ var DEVICE_CODE_URL2 = `${AUTH_BASE}/oidc/device/authorization/`;
27459
+ var TOKEN_URL4 = `${AUTH_BASE}/oidc/device/token/`;
27460
+ var MINT_URL = "https://api.meta.ai/muse-code/key";
27461
+ var CLIENT_ID5 = "1031625952748946";
27462
+ var DEVICE_CODE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
27463
+ var FALLBACK_VERIFICATION_URL2 = "https://auth.meta.com/oauth/device/";
27464
+ var DEFAULT_INTERVAL_SECONDS2 = 5;
27465
+ var PENDING_ERRORS2 = new Set(["authorization_pending", "slow_down"]);
27466
+ function isRecord5(value) {
27467
+ return typeof value === "object" && value !== null;
27468
+ }
27469
+ function recordFrom3(value) {
27470
+ return isRecord5(value) ? value : null;
27471
+ }
27472
+ function stringFrom3(value, field) {
27473
+ const candidate = value[field];
27474
+ return typeof candidate === "string" && candidate.trim().length > 0 ? candidate : null;
27475
+ }
27476
+ function positiveNumberFrom3(value, field) {
27477
+ const candidate = value[field];
27478
+ return typeof candidate === "number" && Number.isFinite(candidate) && candidate > 0 ? candidate : null;
27479
+ }
27480
+ function tokenFrom2(value, fail) {
27481
+ const record2 = recordFrom3(value);
27482
+ const accessToken = record2 === null ? null : stringFrom3(record2, "access_token");
27483
+ if (record2 === null || accessToken === null) {
27484
+ throw fail("AUTH", "token endpoint returned no access_token");
27485
+ }
27486
+ return {
27487
+ accessToken,
27488
+ refreshToken: stringFrom3(record2, "refresh_token"),
27489
+ expiresIn: positiveNumberFrom3(record2, "expires_in")
27490
+ };
27491
+ }
27492
+ function deviceCodeFrom3(value, fail) {
27493
+ const record2 = recordFrom3(value);
27494
+ const deviceCode = record2 === null ? null : stringFrom3(record2, "device_code");
27495
+ const userCode = record2 === null ? null : stringFrom3(record2, "user_code");
27496
+ if (record2 === null || deviceCode === null || userCode === null) {
27497
+ throw fail("AUTH", "device authorization response missing user_code or verification_uri");
27498
+ }
27499
+ return {
27500
+ deviceCode,
27501
+ userCode,
27502
+ verificationUri: stringFrom3(record2, "verification_uri_complete") ?? stringFrom3(record2, "verification_uri") ?? FALLBACK_VERIFICATION_URL2,
27503
+ interval: positiveNumberFrom3(record2, "interval") ?? DEFAULT_INTERVAL_SECONDS2
27504
+ };
27505
+ }
27506
+ async function* postForm(url2, body, fail, keepPolling) {
27507
+ const res = yield postJsonRequest(url2, museProfile, {
27508
+ contentType: "application/x-www-form-urlencoded",
27509
+ body: new URLSearchParams({ ...body, client_id: CLIENT_ID5 }).toString(),
27510
+ extraHeaders: [["Accept", "application/json"]]
27511
+ });
27512
+ const parsed2 = parsed(res.body);
27513
+ if (res.status >= 200 && res.status < 300)
27514
+ return parsed2;
27515
+ const record2 = recordFrom3(parsed2);
27516
+ const code = record2 === null ? `http_${res.status}` : stringFrom3(record2, "error") ?? `http_${res.status}`;
27517
+ if (PENDING_ERRORS2.has(code))
27518
+ throw keepPolling(code);
27519
+ if (code === "expired_token") {
27520
+ throw fail("AUTH", "muse device code expired; start the authorization again");
27521
+ }
27522
+ throw fail(tokenErrorCode(res.status), tokenErrorMessage(res.status, parsed2));
27523
+ }
27524
+ async function* mint(accessToken, fail) {
27525
+ const res = yield postJsonRequest(MINT_URL, museProfile, {
27526
+ contentType: "application/json",
27527
+ body: "{}",
27528
+ extraHeaders: [
27529
+ ["Authorization", `Bearer ${accessToken}`],
27530
+ ["Accept", "application/json"]
27531
+ ]
27532
+ });
27533
+ const parsed2 = parsed(res.body);
27534
+ if (res.status < 200 || res.status >= 300) {
27535
+ if (res.status === 401 || res.status === 403) {
27536
+ throw fail("AUTH", "muse rejected the saved login; reconnect the account or use a different one");
27537
+ }
27538
+ if (res.status === 429) {
27539
+ throw fail("RATE_LIMIT", `muse rate limited the key mint: http_${res.status}`);
27540
+ }
27541
+ throw fail("UPSTREAM", `muse key mint failed: http_${res.status}`);
27542
+ }
27543
+ const record2 = recordFrom3(parsed2);
27544
+ if (record2 === null) {
27545
+ throw fail("UPSTREAM", "muse key mint returned an unusable response");
27546
+ }
27547
+ if (record2.require_payment === true) {
27548
+ throw fail("AUTH", "muse requires a payment method on the Meta account; add one at https://dev.meta.ai and reconnect");
27549
+ }
27550
+ const apiKey = stringFrom3(record2, "api_key");
27551
+ if (apiKey === null) {
27552
+ throw fail("AUTH", "muse key mint returned an empty api key; finish onboarding at https://dev.meta.ai and reconnect");
27553
+ }
27554
+ return {
27555
+ apiKey,
27556
+ email: stringFrom3(record2, "user_email"),
27557
+ tierName: stringFrom3(record2, "subs_tier_name"),
27558
+ subscriptionActive: record2.is_subs_active === true,
27559
+ baseUrl: trustedBaseUrl(record2.base_url),
27560
+ usage: record2.subs_usage
27561
+ };
27562
+ }
27563
+ function toResult5(token, key, fallbackRefresh, now) {
27564
+ return {
27565
+ secrets: {
27566
+ accessToken: token.accessToken,
27567
+ refreshToken: token.refreshToken ?? fallbackRefresh,
27568
+ apiKey: key.apiKey,
27569
+ idToken: null
27570
+ },
27571
+ expiresAt: token.expiresIn === null ? null : now() + token.expiresIn * 1000,
27572
+ accountEmail: key.email,
27573
+ providerData: {
27574
+ ...key.tierName === null ? {} : { subscriptionTier: key.tierName },
27575
+ subscriptionActive: key.subscriptionActive,
27576
+ ...key.baseUrl === null ? {} : { baseUrl: key.baseUrl }
27577
+ }
27578
+ };
27579
+ }
27580
+ var museOAuthFlow = {
27581
+ kind: "device",
27582
+ supportsManualPaste: false,
27583
+ needsDeviceId: false,
27584
+ async* start() {
27585
+ return {
27586
+ authorizeUrl: FALLBACK_VERIFICATION_URL2,
27587
+ pending: { verifier: "", challenge: "", state: "", redirectUri: "" }
27588
+ };
27589
+ },
27590
+ async* begin({ fail, keepPolling }) {
27591
+ const response = deviceCodeFrom3(yield* postForm(DEVICE_CODE_URL2, {}, fail, keepPolling), fail);
27592
+ return {
27593
+ authorizeUrl: response.verificationUri,
27594
+ userCode: response.userCode,
27595
+ pending: {
27596
+ verifier: "",
27597
+ challenge: "",
27598
+ state: "",
27599
+ redirectUri: "",
27600
+ deviceCode: response.deviceCode,
27601
+ interval: response.interval
27602
+ }
27603
+ };
27604
+ },
27605
+ async* exchange({ pending, fail, keepPolling, now }) {
27606
+ if (pending.deviceCode === undefined) {
27607
+ throw fail("INTERNAL", "muse exchange requires a pending flow produced by begin()");
27608
+ }
27609
+ const token = tokenFrom2(yield* postForm(TOKEN_URL4, { grant_type: DEVICE_CODE_GRANT, device_code: pending.deviceCode }, fail, keepPolling), fail);
27610
+ return toResult5(token, yield* mint(token.accessToken, fail), null, now);
27611
+ },
27612
+ async* refresh({ refreshToken, fail, keepPolling, now }) {
27613
+ const token = tokenFrom2(yield* postForm(TOKEN_URL4, { grant_type: "refresh_token", refresh_token: refreshToken }, fail, keepPolling), fail);
27614
+ return toResult5(token, yield* mint(token.accessToken, fail), refreshToken, now);
27615
+ },
27616
+ async* usage({ secrets, now }) {
27617
+ if (secrets.accessToken === null)
27618
+ return null;
27619
+ const res = yield postJsonRequest(MINT_URL, museProfile, {
27620
+ contentType: "application/json",
27621
+ body: "{}",
27622
+ extraHeaders: [
27623
+ ["Authorization", `Bearer ${secrets.accessToken}`],
27624
+ ["Accept", "application/json"]
27625
+ ]
27626
+ });
27627
+ if (!usageReadable(res.status, "muse"))
27628
+ return null;
27629
+ const record2 = recordOf(parsed(res.body));
27630
+ return record2 === null ? null : parseMuseUsage(record2.subs_usage, now());
27631
+ }
27632
+ };
27633
+ function parseMuseUsage(value, now) {
27634
+ const root = recordOf(value);
27635
+ if (root === null)
27636
+ return null;
27637
+ const window = recordOf(root.window);
27638
+ const mins = window === null ? null : numberOf(window, ["window_duration_mins"]);
27639
+ return reportFrom([
27640
+ windowFrom(root.window, "fiveHour", now, mins === null ? null : mins * 60000),
27641
+ windowFrom(root.weekly, "weekly", now)
27642
+ ]);
27643
+ }
27644
+
26391
27645
  // packages/providers/src/openai/oauth.ts
26392
- var CLIENT_ID4 = "app_EMoamEEZ73f0CkXaXp7hrann";
26393
- var AUTHORIZE_URL2 = "https://auth.openai.com/oauth/authorize";
26394
- var TOKEN_URL3 = "https://auth.openai.com/oauth/token";
26395
- var SCOPES3 = "openid profile email offline_access";
27646
+ var CLIENT_ID6 = "app_EMoamEEZ73f0CkXaXp7hrann";
27647
+ var AUTHORIZE_URL3 = "https://auth.openai.com/oauth/authorize";
27648
+ var TOKEN_URL5 = "https://auth.openai.com/oauth/token";
27649
+ var SCOPES4 = "openid profile email offline_access";
26396
27650
  var USAGE_URL3 = "https://chatgpt.com/backend-api/wham/usage";
26397
- function isRecord5(value) {
27651
+ function isRecord6(value) {
26398
27652
  return typeof value === "object" && value !== null;
26399
27653
  }
26400
27654
  function nonBlankStringOrNull(value) {
@@ -26410,20 +27664,20 @@ function decodeClaims(idToken) {
26410
27664
  return { email: null, accountId: null };
26411
27665
  }
26412
27666
  try {
26413
- const json3 = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
26414
- if (!isRecord5(json3))
27667
+ const json4 = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
27668
+ if (!isRecord6(json4))
26415
27669
  return { email: null, accountId: null };
26416
- const auth = json3["https://api.openai.com/auth"];
27670
+ const auth = json4["https://api.openai.com/auth"];
26417
27671
  return {
26418
- email: typeof json3.email === "string" ? json3.email : null,
26419
- accountId: isRecord5(auth) ? nonBlankStringOrNull(auth.chatgpt_account_id) : null
27672
+ email: typeof json4.email === "string" ? json4.email : null,
27673
+ accountId: isRecord6(auth) ? nonBlankStringOrNull(auth.chatgpt_account_id) : null
26420
27674
  };
26421
27675
  } catch {
26422
27676
  return { email: null, accountId: null };
26423
27677
  }
26424
27678
  }
26425
- function parseTokenResponse2(value) {
26426
- if (!isRecord5(value) || typeof value.access_token !== "string")
27679
+ function parseTokenResponse3(value) {
27680
+ if (!isRecord6(value) || typeof value.access_token !== "string")
26427
27681
  return null;
26428
27682
  return {
26429
27683
  accessToken: value.access_token,
@@ -26432,22 +27686,22 @@ function parseTokenResponse2(value) {
26432
27686
  idToken: typeof value.id_token === "string" ? value.id_token : null
26433
27687
  };
26434
27688
  }
26435
- async function* postToken3(body, fail) {
26436
- const res = yield postJsonRequest(TOKEN_URL3, openaiProfile, {
27689
+ async function* postToken4(body, fail) {
27690
+ const res = yield postJsonRequest(TOKEN_URL5, openaiProfile, {
26437
27691
  contentType: "application/x-www-form-urlencoded",
26438
- body: new URLSearchParams({ ...body, client_id: CLIENT_ID4 }).toString()
27692
+ body: new URLSearchParams({ ...body, client_id: CLIENT_ID6 }).toString()
26439
27693
  });
26440
27694
  const parsed2 = parsed(res.body);
26441
27695
  if (res.status < 200 || res.status >= 300) {
26442
27696
  throw fail(tokenErrorCode(res.status), tokenErrorMessage(res.status, parsed2));
26443
27697
  }
26444
- const token = parseTokenResponse2(parsed2);
27698
+ const token = parseTokenResponse3(parsed2);
26445
27699
  if (token === null) {
26446
27700
  throw fail("AUTH", "token endpoint returned no access_token");
26447
27701
  }
26448
27702
  return token;
26449
27703
  }
26450
- function toResult4(token, fallbackRefresh, now, fallbackAccountId = null) {
27704
+ function toResult6(token, fallbackRefresh, now, fallbackAccountId = null) {
26451
27705
  const claims = decodeClaims(token.idToken);
26452
27706
  return {
26453
27707
  secrets: {
@@ -26505,11 +27759,11 @@ var openaiOAuthFlow = {
26505
27759
  async* start({ redirectUri, pkce, randomState }) {
26506
27760
  const { verifier, challenge } = pkce();
26507
27761
  const state = randomState();
26508
- const url2 = new URL(AUTHORIZE_URL2);
26509
- url2.searchParams.set("client_id", CLIENT_ID4);
27762
+ const url2 = new URL(AUTHORIZE_URL3);
27763
+ url2.searchParams.set("client_id", CLIENT_ID6);
26510
27764
  url2.searchParams.set("response_type", "code");
26511
27765
  url2.searchParams.set("redirect_uri", redirectUri);
26512
- url2.searchParams.set("scope", SCOPES3);
27766
+ url2.searchParams.set("scope", SCOPES4);
26513
27767
  url2.searchParams.set("code_challenge", challenge);
26514
27768
  url2.searchParams.set("code_challenge_method", "S256");
26515
27769
  url2.searchParams.set("id_token_add_organizations", "true");
@@ -26524,17 +27778,17 @@ var openaiOAuthFlow = {
26524
27778
  if (pastedState !== undefined && pastedState !== pending.state) {
26525
27779
  throw fail("AUTH", "authorization state mismatch");
26526
27780
  }
26527
- const token = yield* postToken3({
27781
+ const token = yield* postToken4({
26528
27782
  grant_type: "authorization_code",
26529
27783
  code: (rawCode ?? "").trim(),
26530
27784
  redirect_uri: pending.redirectUri,
26531
27785
  code_verifier: pending.verifier
26532
27786
  }, fail);
26533
- return toResult4(token, null, now);
27787
+ return toResult6(token, null, now);
26534
27788
  },
26535
27789
  async* refresh({ refreshToken, providerData, fail, now }) {
26536
- const token = yield* postToken3({ grant_type: "refresh_token", refresh_token: refreshToken, scope: SCOPES3 }, fail);
26537
- return toResult4(token, refreshToken, now, accountIdFromProviderData(providerData));
27790
+ const token = yield* postToken4({ grant_type: "refresh_token", refresh_token: refreshToken, scope: SCOPES4 }, fail);
27791
+ return toResult6(token, refreshToken, now, accountIdFromProviderData(providerData));
26538
27792
  },
26539
27793
  async* usage({ secrets, providerData, now }) {
26540
27794
  if (secrets.accessToken === null)
@@ -26557,7 +27811,9 @@ function builtinOAuthFlows() {
26557
27811
  ["openai", openaiOAuthFlow],
26558
27812
  ["kimi", kimiOAuthFlow],
26559
27813
  ["kilo", kiloOAuthFlow],
26560
- ["grok", grokOAuthFlow]
27814
+ ["grok", grokOAuthFlow],
27815
+ ["antigravity", antigravityOAuthFlow],
27816
+ ["muse", museOAuthFlow]
26561
27817
  ];
26562
27818
  }
26563
27819
  // packages/providers/src/custom/decode.ts
@@ -26585,7 +27841,7 @@ function reasoningText(delta) {
26585
27841
  return [];
26586
27842
  }).join("");
26587
27843
  }
26588
- function json3(data) {
27844
+ function json4(data) {
26589
27845
  try {
26590
27846
  const v = JSON.parse(data);
26591
27847
  return typeof v === "object" && v !== null ? v : null;
@@ -26607,7 +27863,7 @@ async function* decodeCustomChat(messages) {
26607
27863
  done = true;
26608
27864
  break;
26609
27865
  }
26610
- const d = json3(msg.data);
27866
+ const d = json4(msg.data);
26611
27867
  if (d === null)
26612
27868
  continue;
26613
27869
  if (!started && (d.id !== undefined || d.model !== undefined)) {
@@ -26765,7 +28021,7 @@ async function* decodeCustomResponses(messages) {
26765
28021
  };
26766
28022
  return;
26767
28023
  }
26768
- const d = json3(msg.data);
28024
+ const d = json4(msg.data);
26769
28025
  if (d === null)
26770
28026
  continue;
26771
28027
  switch (msg.event) {
@@ -27153,10 +28409,10 @@ var customCodec = {
27153
28409
  // packages/providers/src/custom/index.ts
27154
28410
  var customAdapter = codecAdapter("custom", customDescriptor.capabilities, customCodec);
27155
28411
  // packages/providers/src/grok/codec.ts
27156
- import { createHash as createHash3 } from "crypto";
28412
+ import { createHash as createHash4 } from "crypto";
27157
28413
 
27158
28414
  // packages/providers/src/grok/decode.ts
27159
- var ERROR_CODE = {
28415
+ var ERROR_CODE2 = {
27160
28416
  rate_limit_exceeded: "RATE_LIMIT",
27161
28417
  insufficient_quota: "QUOTA_EXHAUSTED",
27162
28418
  invalid_api_key: "AUTH",
@@ -27190,7 +28446,7 @@ var KNOWN_EVENTS2 = new Set([
27190
28446
  "response.failed",
27191
28447
  "error"
27192
28448
  ]);
27193
- function json4(data) {
28449
+ function json5(data) {
27194
28450
  try {
27195
28451
  const v = JSON.parse(data);
27196
28452
  return typeof v === "object" && v !== null ? v : null;
@@ -27225,7 +28481,7 @@ async function* decodeGrokResponses(messages) {
27225
28481
  };
27226
28482
  return;
27227
28483
  }
27228
- const d = json4(msg.data);
28484
+ const d = json5(msg.data);
27229
28485
  if (d === null)
27230
28486
  continue;
27231
28487
  switch (msg.event) {
@@ -27328,7 +28584,7 @@ async function* decodeGrokResponses(messages) {
27328
28584
  terminal = true;
27329
28585
  const err = d.response?.error ?? d.error ?? {};
27330
28586
  const raw = String(err.code ?? err.type);
27331
- const code = (Object.hasOwn(ERROR_CODE, raw) ? ERROR_CODE[raw] : undefined) ?? "UPSTREAM";
28587
+ const code = (Object.hasOwn(ERROR_CODE2, raw) ? ERROR_CODE2[raw] : undefined) ?? "UPSTREAM";
27332
28588
  yield {
27333
28589
  type: "error",
27334
28590
  code,
@@ -27352,9 +28608,9 @@ async function* decodeGrokResponses(messages) {
27352
28608
  }
27353
28609
 
27354
28610
  // packages/providers/src/grok/wire.ts
27355
- import { createHash as createHash2 } from "crypto";
28611
+ import { createHash as createHash3 } from "crypto";
27356
28612
  var MAX_TOOLS = 200;
27357
- function encodeToolChoice2(c) {
28613
+ function encodeToolChoice3(c) {
27358
28614
  switch (c.type) {
27359
28615
  case "auto":
27360
28616
  return "auto";
@@ -27368,7 +28624,7 @@ function encodeToolChoice2(c) {
27368
28624
  }
27369
28625
  function promptCacheKey(instructions, firstInput) {
27370
28626
  const stable = JSON.stringify({ instructions, firstInput });
27371
- return createHash2("sha256").update(stable).digest("hex").slice(0, 32);
28627
+ return createHash3("sha256").update(stable).digest("hex").slice(0, 32);
27372
28628
  }
27373
28629
  function toGrokWire(req, model) {
27374
28630
  const degradations = [];
@@ -27461,7 +28717,7 @@ function toGrokWire(req, model) {
27461
28717
  }));
27462
28718
  }
27463
28719
  if (req.toolChoice !== undefined)
27464
- body.tool_choice = encodeToolChoice2(req.toolChoice);
28720
+ body.tool_choice = encodeToolChoice3(req.toolChoice);
27465
28721
  if (req.reasoning !== undefined && req.reasoning.mode !== "off") {
27466
28722
  if (req.reasoning.mode === "budget") {
27467
28723
  note2("grok:reasoning-budget-dropped");
@@ -27479,7 +28735,7 @@ var PROXY_URL = "https://cli-chat-proxy.grok.com/v1/responses";
27479
28735
  var API_URL = "https://api.x.ai/v1/responses";
27480
28736
  var CONV_NAMESPACE = "omni-grok-conv";
27481
28737
  function derivedUuid(value) {
27482
- const h = createHash3("sha256").update(`${CONV_NAMESPACE}:${value}`).digest("hex");
28738
+ const h = createHash4("sha256").update(`${CONV_NAMESPACE}:${value}`).digest("hex");
27483
28739
  const variant = (Number.parseInt(h[16], 16) & 3 | 8).toString(16);
27484
28740
  return [
27485
28741
  h.slice(0, 8),
@@ -27548,15 +28804,28 @@ function nodeHttpClient(options = {}) {
27548
28804
  const startedAt = now();
27549
28805
  let traced = false;
27550
28806
  const trace = (status, failed = false) => {
27551
- if (traced || !logger2.enabled("debug"))
28807
+ if (traced)
27552
28808
  return;
27553
28809
  traced = true;
28810
+ const durationMs = now() - startedAt;
28811
+ try {
28812
+ options.onResponseHead?.({
28813
+ provider: req.provider,
28814
+ host: url2.host,
28815
+ path: url2.pathname,
28816
+ ...status === undefined ? {} : { status },
28817
+ durationMs,
28818
+ ...req.requestId === undefined ? {} : { requestId: req.requestId }
28819
+ });
28820
+ } catch {}
28821
+ if (!logger2.enabled("debug"))
28822
+ return;
27554
28823
  logger2.debug("upstream http", {
27555
28824
  provider: req.provider,
27556
28825
  status,
27557
28826
  host: url2.host,
27558
28827
  path: url2.pathname,
27559
- durationMs: now() - startedAt,
28828
+ durationMs,
27560
28829
  reason: failed ? "transport error" : undefined
27561
28830
  });
27562
28831
  };
@@ -27649,7 +28918,7 @@ function reasoningText2(delta) {
27649
28918
  return [];
27650
28919
  }).join("");
27651
28920
  }
27652
- function json5(data) {
28921
+ function json6(data) {
27653
28922
  try {
27654
28923
  const v = JSON.parse(data);
27655
28924
  return typeof v === "object" && v !== null ? v : null;
@@ -27671,7 +28940,7 @@ async function* decodeKiloChat(messages) {
27671
28940
  done = true;
27672
28941
  break;
27673
28942
  }
27674
- const d = json5(msg.data);
28943
+ const d = json6(msg.data);
27675
28944
  if (d === null)
27676
28945
  continue;
27677
28946
  if (!started && (d.id !== undefined || d.model !== undefined)) {
@@ -27771,7 +29040,7 @@ async function* decodeKiloChat(messages) {
27771
29040
  }
27772
29041
 
27773
29042
  // packages/providers/src/kilo/wire.ts
27774
- function encodeToolChoice3(c) {
29043
+ function encodeToolChoice4(c) {
27775
29044
  switch (c.type) {
27776
29045
  case "auto":
27777
29046
  return "auto";
@@ -27882,7 +29151,7 @@ function toKiloWire(req, model) {
27882
29151
  }));
27883
29152
  }
27884
29153
  if (req.toolChoice !== undefined)
27885
- body.tool_choice = encodeToolChoice3(req.toolChoice);
29154
+ body.tool_choice = encodeToolChoice4(req.toolChoice);
27886
29155
  if (req.reasoning !== undefined && req.reasoning.mode !== "off") {
27887
29156
  if (req.reasoning.mode === "budget") {
27888
29157
  body.reasoning = { max_tokens: req.reasoning.budgetTokens };
@@ -27941,7 +29210,7 @@ var FINISH2 = {
27941
29210
  tool_calls: "toolUse",
27942
29211
  content_filter: "contentFilter"
27943
29212
  };
27944
- function json6(data) {
29213
+ function json7(data) {
27945
29214
  try {
27946
29215
  const v = JSON.parse(data);
27947
29216
  return typeof v === "object" && v !== null ? v : null;
@@ -27963,7 +29232,7 @@ async function* decodeChat(messages) {
27963
29232
  done = true;
27964
29233
  break;
27965
29234
  }
27966
- const d = json6(msg.data);
29235
+ const d = json7(msg.data);
27967
29236
  if (d === null)
27968
29237
  continue;
27969
29238
  if (!started && (d.id !== undefined || d.model !== undefined)) {
@@ -28047,7 +29316,7 @@ async function* decodeChat(messages) {
28047
29316
  }
28048
29317
 
28049
29318
  // packages/providers/src/kimi/wire.ts
28050
- function encodeToolChoice4(c) {
29319
+ function encodeToolChoice5(c) {
28051
29320
  switch (c.type) {
28052
29321
  case "auto":
28053
29322
  return "auto";
@@ -28138,7 +29407,7 @@ function toChatWire(req, model, vendor = "kimi") {
28138
29407
  }));
28139
29408
  }
28140
29409
  if (req.toolChoice !== undefined)
28141
- body.tool_choice = encodeToolChoice4(req.toolChoice);
29410
+ body.tool_choice = encodeToolChoice5(req.toolChoice);
28142
29411
  if (req.reasoning !== undefined)
28143
29412
  note2("kimi:reasoning-dropped");
28144
29413
  Object.assign(body, req.vendor?.[vendor] ?? {});
@@ -28178,8 +29447,8 @@ var kimiCodec = {
28178
29447
 
28179
29448
  // packages/providers/src/kimi/index.ts
28180
29449
  var kimiAdapter = codecAdapter("kimi", kimiDescriptor.capabilities, kimiCodec);
28181
- // packages/providers/src/openai/decode.ts
28182
- var ERROR_CODE2 = {
29450
+ // packages/providers/src/muse/decode.ts
29451
+ var ERROR_CODE3 = {
28183
29452
  rate_limit_exceeded: "RATE_LIMIT",
28184
29453
  insufficient_quota: "QUOTA_EXHAUSTED",
28185
29454
  invalid_api_key: "AUTH",
@@ -28214,7 +29483,7 @@ var KNOWN_EVENTS3 = new Set([
28214
29483
  "response.failed",
28215
29484
  "error"
28216
29485
  ]);
28217
- function json7(data) {
29486
+ function json8(data) {
28218
29487
  try {
28219
29488
  const v = JSON.parse(data);
28220
29489
  return typeof v === "object" && v !== null ? v : null;
@@ -28222,7 +29491,7 @@ function json7(data) {
28222
29491
  return null;
28223
29492
  }
28224
29493
  }
28225
- async function* decodeResponses(messages, options = {}) {
29494
+ async function* decodeMuseResponses(messages, options = {}) {
28226
29495
  const nativeReasoning = options.nativeReasoning === true;
28227
29496
  const indices = new Map;
28228
29497
  let next = 0;
@@ -28245,12 +29514,12 @@ async function* decodeResponses(messages, options = {}) {
28245
29514
  yield {
28246
29515
  type: "error",
28247
29516
  code: "UPSTREAM",
28248
- message: `unrecognized OpenAI stream event "${msg.event}"`,
29517
+ message: `unrecognized muse stream event "${msg.event}"`,
28249
29518
  retryable: false
28250
29519
  };
28251
29520
  return;
28252
29521
  }
28253
- const d = json7(msg.data);
29522
+ const d = json8(msg.data);
28254
29523
  if (d === null)
28255
29524
  continue;
28256
29525
  switch (msg.event) {
@@ -28268,7 +29537,7 @@ async function* decodeResponses(messages, options = {}) {
28268
29537
  yield {
28269
29538
  type: "blockStart",
28270
29539
  index: irIndex(d.output_index ?? 0),
28271
- block: nativeReasoning ? { type: "providerNative", provider: "openai", blockType: "reasoning", data: {} } : { type: "thinking" }
29540
+ block: nativeReasoning ? { type: "providerNative", provider: "muse", blockType: "reasoning", data: {} } : { type: "thinking" }
28272
29541
  };
28273
29542
  } else if (item.type === "function_call") {
28274
29543
  sawToolCall = true;
@@ -28303,7 +29572,7 @@ async function* decodeResponses(messages, options = {}) {
28303
29572
  index: irIndex(d.output_index ?? 0),
28304
29573
  delta: nativeReasoning ? {
28305
29574
  type: "providerNative",
28306
- provider: "openai",
29575
+ provider: "muse",
28307
29576
  deltaType: "reasoning_summary_text.delta",
28308
29577
  data: { text: String(d.delta ?? "") }
28309
29578
  } : { type: "thinking", text: String(d.delta ?? "") }
@@ -28329,7 +29598,7 @@ async function* decodeResponses(messages, options = {}) {
28329
29598
  index: irIndex(outputIndex),
28330
29599
  delta: {
28331
29600
  type: "providerNative",
28332
- provider: "openai",
29601
+ provider: "muse",
28333
29602
  deltaType: "response.output_item.done",
28334
29603
  fold: "merge",
28335
29604
  data: item
@@ -28354,7 +29623,7 @@ async function* decodeResponses(messages, options = {}) {
28354
29623
  yield {
28355
29624
  type: "error",
28356
29625
  code: "UPSTREAM",
28357
- message: reason !== undefined ? `unrecognized OpenAI incomplete reason "${String(reason)}"` : r.status !== undefined && r.status !== "incomplete" ? `OpenAI reported terminal response status "${String(r.status)}"` : "OpenAI reported the response incomplete without a reason",
29626
+ message: reason !== undefined ? `unrecognized muse incomplete reason "${String(reason)}"` : r.status !== undefined && r.status !== "incomplete" ? `muse reported terminal response status "${String(r.status)}"` : "muse reported the response incomplete without a reason",
28358
29627
  retryable: false
28359
29628
  };
28360
29629
  break;
@@ -28371,7 +29640,7 @@ async function* decodeResponses(messages, options = {}) {
28371
29640
  terminal = true;
28372
29641
  const err = d.response?.error ?? d.error ?? {};
28373
29642
  const raw = String(err.code ?? err.type);
28374
- const code = (Object.hasOwn(ERROR_CODE2, raw) ? ERROR_CODE2[raw] : undefined) ?? "UPSTREAM";
29643
+ const code = (Object.hasOwn(ERROR_CODE3, raw) ? ERROR_CODE3[raw] : undefined) ?? "UPSTREAM";
28375
29644
  yield {
28376
29645
  type: "error",
28377
29646
  code,
@@ -28394,8 +29663,8 @@ async function* decodeResponses(messages, options = {}) {
28394
29663
  }
28395
29664
  }
28396
29665
 
28397
- // packages/providers/src/openai/wire.ts
28398
- import { createHash as createHash4 } from "crypto";
29666
+ // packages/providers/src/muse/wire.ts
29667
+ import { createHash as createHash5 } from "crypto";
28399
29668
  function suppliedKey(req) {
28400
29669
  const vendor = req.vendor?.openai;
28401
29670
  for (const name of ["prompt_cache_key", "session_id"]) {
@@ -28407,7 +29676,7 @@ function suppliedKey(req) {
28407
29676
  }
28408
29677
  function cacheKey(req, instructions, firstInput) {
28409
29678
  const stable = req.conversationId !== undefined && req.conversationId.length > 0 ? JSON.stringify({ conversation: req.conversationId }) : JSON.stringify({ instructions, firstInput: firstInput ?? null });
28410
- return createHash4("sha256").update(stable).digest("hex").slice(0, 32);
29679
+ return createHash5("sha256").update(stable).digest("hex").slice(0, 32);
28411
29680
  }
28412
29681
  function repairOrphanedCalls(input2) {
28413
29682
  const answered = new Set;
@@ -28426,7 +29695,407 @@ function repairOrphanedCalls(input2) {
28426
29695
  input2.splice(i + 1, 0, { type: "function_call_output", call_id: record2.call_id, output: "" });
28427
29696
  }
28428
29697
  }
28429
- function encodeToolChoice5(c) {
29698
+ function encodeToolChoice6(c) {
29699
+ switch (c.type) {
29700
+ case "auto":
29701
+ return "auto";
29702
+ case "any":
29703
+ return "required";
29704
+ case "none":
29705
+ return "none";
29706
+ case "tool":
29707
+ return { type: "function", name: c.name };
29708
+ }
29709
+ }
29710
+ function toMuseWire(req, model) {
29711
+ const degradations = [];
29712
+ const input2 = [];
29713
+ const note2 = (d) => {
29714
+ if (!degradations.includes(d))
29715
+ degradations.push(d);
29716
+ };
29717
+ if (req.betas?.includes(CONTEXT_1M_BETA))
29718
+ note2("muse:context-1m-dropped");
29719
+ for (const message of req.messages) {
29720
+ const parts = [];
29721
+ const asDeveloper = message.role === "system";
29722
+ if (asDeveloper)
29723
+ note2("muse:system-turn-as-developer");
29724
+ const role = asDeveloper ? "developer" : message.role;
29725
+ const flush = () => {
29726
+ if (parts.length === 0)
29727
+ return;
29728
+ input2.push({ type: "message", role, content: [...parts] });
29729
+ parts.length = 0;
29730
+ };
29731
+ for (const block of message.content) {
29732
+ switch (block.type) {
29733
+ case "text":
29734
+ parts.push({
29735
+ type: role === "assistant" ? "output_text" : "input_text",
29736
+ text: block.text
29737
+ });
29738
+ break;
29739
+ case "image":
29740
+ parts.push({
29741
+ type: "input_image",
29742
+ image_url: `data:${block.mediaType};base64,${block.data}`
29743
+ });
29744
+ break;
29745
+ case "thinking":
29746
+ note2("muse:thinking-dropped");
29747
+ break;
29748
+ case "toolUse":
29749
+ flush();
29750
+ input2.push({
29751
+ type: "function_call",
29752
+ call_id: block.id,
29753
+ name: block.name,
29754
+ arguments: JSON.stringify(block.input)
29755
+ });
29756
+ break;
29757
+ case "toolResult":
29758
+ flush();
29759
+ input2.push({
29760
+ type: "function_call_output",
29761
+ call_id: block.toolUseId,
29762
+ output: block.content
29763
+ });
29764
+ break;
29765
+ case "providerNative":
29766
+ if (block.provider === "muse") {
29767
+ flush();
29768
+ const { id: _id, ...rest } = block.data;
29769
+ input2.push({ type: block.blockType, ...rest });
29770
+ break;
29771
+ }
29772
+ note2("muse:foreign-native-block-dropped");
29773
+ break;
29774
+ }
29775
+ }
29776
+ flush();
29777
+ }
29778
+ repairOrphanedCalls(input2);
29779
+ const body = { model, input: input2, stream: req.stream, store: false };
29780
+ const instructions = systemText(req.system, "muse", note2);
29781
+ if (instructions !== undefined && instructions.length > 0)
29782
+ body.instructions = instructions;
29783
+ if (req.maxTokens !== undefined)
29784
+ body.max_output_tokens = req.maxTokens;
29785
+ if (req.temperature !== undefined)
29786
+ body.temperature = req.temperature;
29787
+ if (req.tools !== undefined) {
29788
+ const portable = req.tools.filter((t) => t.kind === "portable");
29789
+ if (portable.length !== req.tools.length)
29790
+ note2("muse:provider-tool-dropped");
29791
+ body.tools = portable.map((t) => ({
29792
+ type: "function",
29793
+ name: t.name,
29794
+ description: t.description,
29795
+ parameters: t.inputSchema
29796
+ }));
29797
+ }
29798
+ if (req.toolChoice !== undefined)
29799
+ body.tool_choice = encodeToolChoice6(req.toolChoice);
29800
+ if (req.reasoning !== undefined && req.reasoning.mode !== "off") {
29801
+ if (req.reasoning.mode === "budget") {
29802
+ note2("muse:reasoning-budget-dropped");
29803
+ } else {
29804
+ const effort = req.reasoning.effort ?? "medium";
29805
+ body.reasoning = { effort, summary: "auto" };
29806
+ }
29807
+ }
29808
+ const key = suppliedKey(req) ?? cacheKey(req, instructions ?? "", input2[0]);
29809
+ Object.assign(body, req.vendor?.openai ?? {});
29810
+ body.prompt_cache_key = key;
29811
+ return { body, degradations, cacheKey: key };
29812
+ }
29813
+
29814
+ // packages/providers/src/muse/codec.ts
29815
+ var museCodec = {
29816
+ buildRequest(input2) {
29817
+ const { body, degradations, cacheKey: cacheKey2 } = toMuseWire(input2.request, input2.model);
29818
+ if (input2.credentials.apiKey === null) {
29819
+ throw input2.fail("AUTH", "muse credential has no model api key");
29820
+ }
29821
+ const protocol = [
29822
+ ["Content-Type", "application/json"],
29823
+ ["Authorization", `Bearer ${input2.credentials.apiKey}`],
29824
+ ["x-meta-ai-gateway-session-id", cacheKey2]
29825
+ ];
29826
+ const headers = orderHeaders(mergeHeaders(museProfile.headers, protocol), museProfile.order);
29827
+ const include = body.include;
29828
+ const nativeReasoning = Array.isArray(include) && include.includes("reasoning.encrypted_content");
29829
+ return {
29830
+ decodeState: { nativeReasoning },
29831
+ request: {
29832
+ url: museResponsesUrl(input2.credentials.providerData),
29833
+ method: "POST",
29834
+ headers,
29835
+ body: JSON.stringify(orderFields({ ...body, stream: true }, museBodyOrder))
29836
+ },
29837
+ degradations
29838
+ };
29839
+ },
29840
+ decode({ body, decodeState }) {
29841
+ const state = decodeState;
29842
+ return decodeMuseResponses(parseSse(body), {
29843
+ nativeReasoning: state?.nativeReasoning === true
29844
+ });
29845
+ }
29846
+ };
29847
+
29848
+ // packages/providers/src/muse/index.ts
29849
+ var museAdapter = codecAdapter("muse", museDescriptor.capabilities, museCodec);
29850
+ // packages/providers/src/openai/decode.ts
29851
+ var ERROR_CODE4 = {
29852
+ rate_limit_exceeded: "RATE_LIMIT",
29853
+ insufficient_quota: "QUOTA_EXHAUSTED",
29854
+ invalid_api_key: "AUTH",
29855
+ server_error: "UPSTREAM",
29856
+ context_length_exceeded: "BAD_REQUEST",
29857
+ content_policy_violation: "CONTENT_FILTER"
29858
+ };
29859
+ var KNOWN_EVENTS4 = new Set([
29860
+ "keepalive",
29861
+ "response.created",
29862
+ "response.queued",
29863
+ "response.in_progress",
29864
+ "response.output_item.added",
29865
+ "response.output_item.done",
29866
+ "response.content_part.added",
29867
+ "response.content_part.done",
29868
+ "response.output_text.delta",
29869
+ "response.output_text.done",
29870
+ "response.output_text.annotation.added",
29871
+ "response.refusal.delta",
29872
+ "response.refusal.done",
29873
+ "response.reasoning_summary_part.added",
29874
+ "response.reasoning_summary_part.done",
29875
+ "response.reasoning_summary_text.delta",
29876
+ "response.reasoning_summary_text.done",
29877
+ "response.reasoning_text.delta",
29878
+ "response.reasoning_text.done",
29879
+ "response.function_call_arguments.delta",
29880
+ "response.function_call_arguments.done",
29881
+ "response.completed",
29882
+ "response.incomplete",
29883
+ "response.failed",
29884
+ "error"
29885
+ ]);
29886
+ function json9(data) {
29887
+ try {
29888
+ const v = JSON.parse(data);
29889
+ return typeof v === "object" && v !== null ? v : null;
29890
+ } catch {
29891
+ return null;
29892
+ }
29893
+ }
29894
+ async function* decodeResponses(messages, options = {}) {
29895
+ const nativeReasoning = options.nativeReasoning === true;
29896
+ const indices = new Map;
29897
+ let next = 0;
29898
+ const irIndex = (outputIndex, contentIndex = 0) => {
29899
+ const key = `${outputIndex}:${contentIndex}`;
29900
+ const existing = indices.get(key);
29901
+ if (existing !== undefined)
29902
+ return existing;
29903
+ const assigned = next++;
29904
+ indices.set(key, assigned);
29905
+ return assigned;
29906
+ };
29907
+ let sawToolCall = false;
29908
+ let terminal = false;
29909
+ const ownsBlock = new Set;
29910
+ for await (const msg of messages) {
29911
+ if (msg.data === "[DONE]")
29912
+ continue;
29913
+ if (!KNOWN_EVENTS4.has(msg.event)) {
29914
+ yield {
29915
+ type: "error",
29916
+ code: "UPSTREAM",
29917
+ message: `unrecognized OpenAI stream event "${msg.event}"`,
29918
+ retryable: false
29919
+ };
29920
+ return;
29921
+ }
29922
+ const d = json9(msg.data);
29923
+ if (d === null)
29924
+ continue;
29925
+ switch (msg.event) {
29926
+ case "response.created":
29927
+ yield {
29928
+ type: "start",
29929
+ id: String(d.response?.id ?? ""),
29930
+ model: String(d.response?.model ?? "")
29931
+ };
29932
+ break;
29933
+ case "response.output_item.added": {
29934
+ const item = d.item ?? {};
29935
+ if (item.type === "reasoning") {
29936
+ ownsBlock.add(d.output_index ?? 0);
29937
+ yield {
29938
+ type: "blockStart",
29939
+ index: irIndex(d.output_index ?? 0),
29940
+ block: nativeReasoning ? { type: "providerNative", provider: "openai", blockType: "reasoning", data: {} } : { type: "thinking" }
29941
+ };
29942
+ } else if (item.type === "function_call") {
29943
+ sawToolCall = true;
29944
+ ownsBlock.add(d.output_index ?? 0);
29945
+ yield {
29946
+ type: "blockStart",
29947
+ index: irIndex(d.output_index ?? 0),
29948
+ block: { type: "toolUse", id: String(item.call_id), name: String(item.name) }
29949
+ };
29950
+ }
29951
+ break;
29952
+ }
29953
+ case "response.content_part.added":
29954
+ if (d.part?.type === "output_text") {
29955
+ yield {
29956
+ type: "blockStart",
29957
+ index: irIndex(d.output_index ?? 0, d.content_index ?? 0),
29958
+ block: { type: "text" }
29959
+ };
29960
+ }
29961
+ break;
29962
+ case "response.output_text.delta":
29963
+ yield {
29964
+ type: "blockDelta",
29965
+ index: irIndex(d.output_index ?? 0, d.content_index ?? 0),
29966
+ delta: { type: "text", text: String(d.delta ?? "") }
29967
+ };
29968
+ break;
29969
+ case "response.reasoning_summary_text.delta":
29970
+ yield {
29971
+ type: "blockDelta",
29972
+ index: irIndex(d.output_index ?? 0),
29973
+ delta: nativeReasoning ? {
29974
+ type: "providerNative",
29975
+ provider: "openai",
29976
+ deltaType: "reasoning_summary_text.delta",
29977
+ data: { text: String(d.delta ?? "") }
29978
+ } : { type: "thinking", text: String(d.delta ?? "") }
29979
+ };
29980
+ break;
29981
+ case "response.function_call_arguments.delta":
29982
+ yield {
29983
+ type: "blockDelta",
29984
+ index: irIndex(d.output_index ?? 0),
29985
+ delta: { type: "toolJson", partial: String(d.delta ?? "") }
29986
+ };
29987
+ break;
29988
+ case "response.content_part.done":
29989
+ yield { type: "blockEnd", index: irIndex(d.output_index ?? 0, d.content_index ?? 0) };
29990
+ break;
29991
+ case "response.output_item.done": {
29992
+ const outputIndex = d.output_index ?? 0;
29993
+ if (ownsBlock.delete(outputIndex)) {
29994
+ const item = d.item ?? {};
29995
+ if (nativeReasoning && item.type === "reasoning") {
29996
+ yield {
29997
+ type: "blockDelta",
29998
+ index: irIndex(outputIndex),
29999
+ delta: {
30000
+ type: "providerNative",
30001
+ provider: "openai",
30002
+ deltaType: "response.output_item.done",
30003
+ fold: "merge",
30004
+ data: item
30005
+ }
30006
+ };
30007
+ }
30008
+ yield { type: "blockEnd", index: irIndex(outputIndex) };
30009
+ }
30010
+ break;
30011
+ }
30012
+ case "response.completed":
30013
+ case "response.incomplete": {
30014
+ terminal = true;
30015
+ const r = d.response ?? {};
30016
+ const reason = r.incomplete_details?.reason;
30017
+ let stopReason = sawToolCall ? "toolUse" : "endTurn";
30018
+ if (reason === "max_output_tokens")
30019
+ stopReason = "maxTokens";
30020
+ else if (reason === "content_filter")
30021
+ stopReason = "contentFilter";
30022
+ else if (reason !== undefined || msg.event === "response.incomplete" || r.status !== undefined && r.status !== "completed") {
30023
+ yield {
30024
+ type: "error",
30025
+ code: "UPSTREAM",
30026
+ message: reason !== undefined ? `unrecognized OpenAI incomplete reason "${String(reason)}"` : r.status !== undefined && r.status !== "incomplete" ? `OpenAI reported terminal response status "${String(r.status)}"` : "OpenAI reported the response incomplete without a reason",
30027
+ retryable: false
30028
+ };
30029
+ break;
30030
+ }
30031
+ yield {
30032
+ type: "end",
30033
+ stopReason,
30034
+ usage: usageFromPromptTotal(r.usage?.input_tokens ?? 0, r.usage?.output_tokens ?? 0, r.usage?.input_tokens_details?.cached_tokens ?? r.usage?.prompt_tokens_details?.cached_tokens ?? 0)
30035
+ };
30036
+ break;
30037
+ }
30038
+ case "response.failed":
30039
+ case "error": {
30040
+ terminal = true;
30041
+ const err = d.response?.error ?? d.error ?? {};
30042
+ const raw = String(err.code ?? err.type);
30043
+ const code = (Object.hasOwn(ERROR_CODE4, raw) ? ERROR_CODE4[raw] : undefined) ?? "UPSTREAM";
30044
+ yield {
30045
+ type: "error",
30046
+ code,
30047
+ message: String(err.message ?? "upstream error"),
30048
+ retryable: RETRYABLE[code]
30049
+ };
30050
+ break;
30051
+ }
30052
+ default:
30053
+ break;
30054
+ }
30055
+ }
30056
+ if (!terminal) {
30057
+ yield {
30058
+ type: "error",
30059
+ code: "UPSTREAM",
30060
+ message: "upstream stream ended before response completion",
30061
+ retryable: RETRYABLE.UPSTREAM
30062
+ };
30063
+ }
30064
+ }
30065
+
30066
+ // packages/providers/src/openai/wire.ts
30067
+ import { createHash as createHash6 } from "crypto";
30068
+ function suppliedKey2(req) {
30069
+ const vendor = req.vendor?.openai;
30070
+ for (const name of ["prompt_cache_key", "session_id"]) {
30071
+ const value = vendor?.[name];
30072
+ if (typeof value === "string" && value.length > 0)
30073
+ return value;
30074
+ }
30075
+ return;
30076
+ }
30077
+ function cacheKey2(req, instructions, firstInput) {
30078
+ const stable = req.conversationId !== undefined && req.conversationId.length > 0 ? JSON.stringify({ conversation: req.conversationId }) : JSON.stringify({ instructions, firstInput: firstInput ?? null });
30079
+ return createHash6("sha256").update(stable).digest("hex").slice(0, 32);
30080
+ }
30081
+ function repairOrphanedCalls2(input2) {
30082
+ const answered = new Set;
30083
+ for (const item of input2) {
30084
+ const record2 = item;
30085
+ if (record2.type === "function_call_output" && typeof record2.call_id === "string") {
30086
+ answered.add(record2.call_id);
30087
+ }
30088
+ }
30089
+ for (let i = input2.length - 1;i >= 0; i--) {
30090
+ const record2 = input2[i];
30091
+ if (record2.type !== "function_call" || typeof record2.call_id !== "string")
30092
+ continue;
30093
+ if (answered.has(record2.call_id))
30094
+ continue;
30095
+ input2.splice(i + 1, 0, { type: "function_call_output", call_id: record2.call_id, output: "" });
30096
+ }
30097
+ }
30098
+ function encodeToolChoice7(c) {
28430
30099
  switch (c.type) {
28431
30100
  case "auto":
28432
30101
  return "auto";
@@ -28508,7 +30177,7 @@ function toResponsesWire(req, model, opts = { oauth: false }) {
28508
30177
  }
28509
30178
  flush();
28510
30179
  }
28511
- repairOrphanedCalls(input2);
30180
+ repairOrphanedCalls2(input2);
28512
30181
  const body = { model, input: input2, stream: req.stream, store: false };
28513
30182
  const instructions = systemText(req.system, "openai", note2);
28514
30183
  if (instructions !== undefined && instructions.length > 0)
@@ -28537,7 +30206,7 @@ function toResponsesWire(req, model, opts = { oauth: false }) {
28537
30206
  }));
28538
30207
  }
28539
30208
  if (req.toolChoice !== undefined)
28540
- body.tool_choice = encodeToolChoice5(req.toolChoice);
30209
+ body.tool_choice = encodeToolChoice7(req.toolChoice);
28541
30210
  if (req.reasoning !== undefined && req.reasoning.mode !== "off") {
28542
30211
  if (req.reasoning.mode === "budget") {
28543
30212
  degradations.push("openai:reasoning-budget-dropped");
@@ -28546,7 +30215,7 @@ function toResponsesWire(req, model, opts = { oauth: false }) {
28546
30215
  body.reasoning = { effort, summary: "auto" };
28547
30216
  }
28548
30217
  }
28549
- const key = suppliedKey(req) ?? cacheKey(req, instructions ?? "", input2[0]);
30218
+ const key = suppliedKey2(req) ?? cacheKey2(req, instructions ?? "", input2[0]);
28550
30219
  Object.assign(body, req.vendor?.openai ?? {});
28551
30220
  body.prompt_cache_key = key;
28552
30221
  return { body, degradations, cacheKey: key };
@@ -28558,14 +30227,14 @@ var API_URL3 = "https://api.openai.com/v1/responses";
28558
30227
  var openaiCodec = {
28559
30228
  buildRequest(input2) {
28560
30229
  const oauth = input2.credentials.accessToken !== null;
28561
- const { body, degradations, cacheKey: cacheKey2 } = toResponsesWire(input2.request, input2.model, { oauth });
30230
+ const { body, degradations, cacheKey: cacheKey3 } = toResponsesWire(input2.request, input2.model, { oauth });
28562
30231
  const protocol = [["Content-Type", "application/json"]];
28563
30232
  if (oauth) {
28564
30233
  protocol.push(["Authorization", `Bearer ${input2.credentials.accessToken}`]);
28565
30234
  const accountId = input2.credentials.providerData.accountId;
28566
30235
  if (typeof accountId === "string")
28567
30236
  protocol.push(["chatgpt-account-id", accountId]);
28568
- protocol.push(["session_id", cacheKey2]);
30237
+ protocol.push(["session_id", cacheKey3]);
28569
30238
  } else if (input2.credentials.apiKey !== null) {
28570
30239
  protocol.push(["Authorization", `Bearer ${input2.credentials.apiKey}`]);
28571
30240
  } else {
@@ -28600,6 +30269,8 @@ var ADAPTERS = {
28600
30269
  kimi: kimiAdapter,
28601
30270
  kilo: kiloAdapter,
28602
30271
  grok: grokAdapter,
30272
+ antigravity: antigravityAdapter,
30273
+ muse: museAdapter,
28603
30274
  custom: customAdapter
28604
30275
  };
28605
30276
  Object.setPrototypeOf(ADAPTERS, null);
@@ -30106,7 +31777,7 @@ import { basename as basename2, join as join3, resolve as resolve2, sep as sep2
30106
31777
 
30107
31778
  // packages/plugin-api/src/version.ts
30108
31779
  var PLUGIN_API_VERSION = 3;
30109
- var DASHBOARD_SDK_VERSION = "0.1.6";
31780
+ var DASHBOARD_SDK_VERSION = "0.1.8";
30110
31781
  // packages/plugin-api/src/manifest.ts
30111
31782
  var CAPABILITIES = [
30112
31783
  "storage",
@@ -31185,7 +32856,7 @@ function createRefresher(deps) {
31185
32856
  }
31186
32857
  // packages/control/src/pluginProviders.ts
31187
32858
  import { join as join5 } from "path";
31188
- function isRecord6(value) {
32859
+ function isRecord7(value) {
31189
32860
  return typeof value === "object" && value !== null && !Array.isArray(value);
31190
32861
  }
31191
32862
  function isNumber(value) {
@@ -31196,7 +32867,7 @@ function checkAt(ok, id, path, expected) {
31196
32867
  throw new Error(`provider ${id} descriptor: ${path} must be ${expected}`);
31197
32868
  }
31198
32869
  function checkLimits(id, path, value) {
31199
- checkAt(isRecord6(value), id, path, "an object");
32870
+ checkAt(isRecord7(value), id, path, "an object");
31200
32871
  const limits = value;
31201
32872
  checkAt(isNumber(limits.contextWindow), id, `${path}.contextWindow`, "a finite number");
31202
32873
  checkAt(isNumber(limits.maxOutputTokens), id, `${path}.maxOutputTokens`, "a finite number");
@@ -31214,19 +32885,19 @@ function checkDescriptor(id, record2) {
31214
32885
  }
31215
32886
  }
31216
32887
  const capabilities2 = record2.capabilities;
31217
- checkAt(isRecord6(capabilities2), id, "capabilities", "an object");
32888
+ checkAt(isRecord7(capabilities2), id, "capabilities", "an object");
31218
32889
  for (const flag of ["tools", "images", "reasoning"]) {
31219
32890
  const value = capabilities2[flag];
31220
32891
  checkAt(typeof value === "boolean", id, `capabilities.${flag}`, "a boolean");
31221
32892
  }
31222
32893
  const write = record2.writeOverInput;
31223
- checkAt(isRecord6(write), id, "writeOverInput", "an object");
32894
+ checkAt(isRecord7(write), id, "writeOverInput", "an object");
31224
32895
  for (const ttl of ["fiveMinute", "oneHour"]) {
31225
32896
  const value = write[ttl];
31226
32897
  checkAt(isNumber(value), id, `writeOverInput.${ttl}`, "a finite number");
31227
32898
  }
31228
32899
  const catalog2 = record2.catalog;
31229
- checkAt(isRecord6(catalog2), id, "catalog", "an object");
32900
+ checkAt(isRecord7(catalog2), id, "catalog", "an object");
31230
32901
  const entry = catalog2;
31231
32902
  checkAt(typeof entry.defaultModel === "string", id, "catalog.defaultModel", "a string");
31232
32903
  checkAt(Array.isArray(entry.authTypes), id, "catalog.authTypes", "an array");
@@ -31237,11 +32908,11 @@ function checkDescriptor(id, record2) {
31237
32908
  checkAt(Array.isArray(entry.models), id, "catalog.models", "an array");
31238
32909
  for (const [index, model] of entry.models.entries()) {
31239
32910
  const at = `catalog.models[${index}]`;
31240
- checkAt(isRecord6(model), id, at, "an object");
32911
+ checkAt(isRecord7(model), id, at, "an object");
31241
32912
  const choice = model;
31242
32913
  checkAt(typeof choice.id === "string", id, `${at}.id`, "a string");
31243
32914
  checkAt(typeof choice.label === "string", id, `${at}.label`, "a string");
31244
- checkAt(isRecord6(choice.pricing), id, `${at}.pricing`, "an object");
32915
+ checkAt(isRecord7(choice.pricing), id, `${at}.pricing`, "an object");
31245
32916
  const pricing = choice.pricing;
31246
32917
  for (const field of ["input", "output", "cacheRead", "cacheWrite5m", "cacheWrite1h"]) {
31247
32918
  checkAt(isNumber(pricing[field]), id, `${at}.pricing.${field}`, "a finite number");
@@ -31257,13 +32928,13 @@ function checkDescriptor(id, record2) {
31257
32928
  checkAt(typeof prefix === "string", id, `modelPrefixes[${index}]`, "a string");
31258
32929
  }
31259
32930
  const presentation = record2.presentation;
31260
- checkAt(isRecord6(presentation), id, "presentation", "an object");
32931
+ checkAt(isRecord7(presentation), id, "presentation", "an object");
31261
32932
  const shown = presentation;
31262
32933
  for (const field of ["label", "tone"]) {
31263
32934
  checkAt(typeof shown[field] === "string", id, `presentation.${field}`, "a string");
31264
32935
  }
31265
32936
  checkAt(isNumber(shown.order), id, "presentation.order", "a finite number");
31266
- checkAt(isRecord6(shown.colour), id, "presentation.colour", "an object");
32937
+ checkAt(isRecord7(shown.colour), id, "presentation.colour", "an object");
31267
32938
  for (const scheme of ["light", "dark"]) {
31268
32939
  const value = shown.colour[scheme];
31269
32940
  checkAt(typeof value === "string", id, `presentation.colour.${scheme}`, "a string");
@@ -31275,7 +32946,7 @@ function checkDescriptor(id, record2) {
31275
32946
  function validateOAuthFlow(id, value) {
31276
32947
  if (value === undefined)
31277
32948
  return;
31278
- if (!isRecord6(value))
32949
+ if (!isRecord7(value))
31279
32950
  throw new Error(`provider ${id} oauth must be an object`);
31280
32951
  const kind = value.kind;
31281
32952
  if (kind !== "pkce" && kind !== "device") {
@@ -31755,7 +33426,9 @@ var TONES = {
31755
33426
  blue: true,
31756
33427
  magenta: true,
31757
33428
  cyan: true,
31758
- orange: true
33429
+ orange: true,
33430
+ violet: true,
33431
+ azure: true
31759
33432
  };
31760
33433
  function isTone(name) {
31761
33434
  return Object.hasOwn(TONES, name);
@@ -32796,7 +34469,7 @@ var dbMigrate = {
32796
34469
  emit(ctx, writer, { target: redact(to), ...report }, () => [
32797
34470
  fields([
32798
34471
  ["target", redact(to)],
32799
- ...Object.entries(report.counts).map(([table2, count]) => [table2, String(count)])
34472
+ ...Object.entries(report.counts).map(([table2, count2]) => [table2, String(count2)])
32800
34473
  ]),
32801
34474
  "",
32802
34475
  "not carried:",
@@ -32967,7 +34640,7 @@ var dbRestore = {
32967
34640
  emit(ctx, writer, result, () => fields([
32968
34641
  ["restored", id],
32969
34642
  ["undo", result.preRestoreSnapshot.id],
32970
- ...Object.entries(result.counts).map(([table2, count]) => [table2, String(count)])
34643
+ ...Object.entries(result.counts).map(([table2, count2]) => [table2, String(count2)])
32971
34644
  ]));
32972
34645
  }
32973
34646
  };
@@ -33702,7 +35375,7 @@ function createServiceDeps(input2) {
33702
35375
  }
33703
35376
 
33704
35377
  // apps/cli/src/version.ts
33705
- var VERSION = "0.9.1";
35378
+ var VERSION = "0.10.0";
33706
35379
 
33707
35380
  // apps/cli/src/commands/service.ts
33708
35381
  function gatewayArgv(root) {