copilot-relay 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -10020,7 +10020,15 @@ const effortDescriptions = {
10020
10020
  xhigh: "Extra high reasoning depth for complex problems",
10021
10021
  max: "Maximum reasoning depth for the hardest problems"
10022
10022
  };
10023
- const codexContextWindow = 272e3;
10023
+ const contextWindows = (model) => {
10024
+ const limits = model.capabilities?.limits;
10025
+ if (limits === void 0) return {};
10026
+ const roomBesideReply = limits.max_context_window_tokens - limits.max_output_tokens;
10027
+ return {
10028
+ context_window: roomBesideReply > 0 ? Math.min(limits.max_prompt_tokens, roomBesideReply) : limits.max_prompt_tokens,
10029
+ max_context_window: limits.max_prompt_tokens
10030
+ };
10031
+ };
10024
10032
  const isRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
10025
10033
  const readVendorFile = async (name) => {
10026
10034
  let currentDir = dirname(fileURLToPath(import.meta.url));
@@ -10056,7 +10064,6 @@ const generatedEntry = (model, priority, prompt) => {
10056
10064
  description: effortDescriptions[effort]
10057
10065
  }));
10058
10066
  const defaultLevel = levels.find((level) => level.effort === "medium") ?? levels[0];
10059
- const maxPrompt = model.capabilities?.limits?.max_prompt_tokens;
10060
10067
  return {
10061
10068
  slug: model.id,
10062
10069
  display_name: displayName(model),
@@ -10076,10 +10083,7 @@ const generatedEntry = (model, priority, prompt) => {
10076
10083
  apply_patch_tool_type: "freeform",
10077
10084
  supports_parallel_tool_calls: true,
10078
10085
  input_modalities: ["text", "image"],
10079
- ...maxPrompt !== void 0 && {
10080
- context_window: Math.min(codexContextWindow, maxPrompt),
10081
- max_context_window: maxPrompt
10082
- },
10086
+ ...contextWindows(model),
10083
10087
  model_messages: { instructions_template: prompt }
10084
10088
  };
10085
10089
  };
@@ -10087,8 +10091,8 @@ const generatedEntry = (model, priority, prompt) => {
10087
10091
  * The catalog for these models, in order: the first is Codex's default.
10088
10092
  *
10089
10093
  * A model Codex ships keeps Codex's own entry, so its tuned instructions and settings are unchanged;
10090
- * only its position and visibility change. Any other model, such as a Claude model, gets a generated
10091
- * entry.
10094
+ * only its position, visibility and context window change, the window to the one Copilot allows. Any
10095
+ * other model, such as a Claude model, gets a generated entry.
10092
10096
  */
10093
10097
  const buildCodexCatalog = (models$1, vendor) => {
10094
10098
  const seen = /* @__PURE__ */ new Set();
@@ -10101,7 +10105,8 @@ const buildCodexCatalog = (models$1, vendor) => {
10101
10105
  entries.push(bundled ? {
10102
10106
  ...bundled,
10103
10107
  visibility: "list",
10104
- priority
10108
+ priority,
10109
+ ...contextWindows(model)
10105
10110
  } : generatedEntry(model, priority, vendor.prompt));
10106
10111
  }
10107
10112
  return { models: entries };
@@ -10675,7 +10680,7 @@ const routesToTier = (name, tier) => name.toLowerCase().includes("opus") === (ti
10675
10680
  * claude-sonnet-relay. Each tier therefore has its own name. The relay sends every model name without "opus"
10676
10681
  * to gptModel and every one with it to opusModel, so the route reaches the same upstream model. The
10677
10682
  * route names no real Claude model, so the app and its Claude Code take none of that model's
10678
- * built-in context window or tuning; supports1m on the entry says what the window is.
10683
+ * built-in context window or tuning; supports1m and prefer1m on the entry say what the window is.
10679
10684
  */
10680
10685
  const appModelName = (model) => looksAnthropic(model.id) && routesToTier(model.id, model.tier) ? model.id : `claude-${model.tier}-relay`;
10681
10686
  const inferenceModel = (model) => {
@@ -10685,7 +10690,10 @@ const inferenceModel = (model) => {
10685
10690
  return {
10686
10691
  name,
10687
10692
  ...label ? { labelOverride: label } : {},
10688
- ...promptTokens >= 1e6 ? { supports1m: true } : {},
10693
+ ...promptTokens >= 1e6 ? {
10694
+ supports1m: true,
10695
+ prefer1m: true
10696
+ } : {},
10689
10697
  anthropicFamilyTier: model.tier
10690
10698
  };
10691
10699
  };