llm-relay 0.72.1 → 0.72.2

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/cli.js CHANGED
@@ -1647,6 +1647,15 @@ ${lane} — ${entry.models.length} models, probed ${entry.probedAt} via \`${entr
1647
1647
  process.stdout.write("These are removed from the ladder and their command is withheld.\n");
1648
1648
  }
1649
1649
  }
1650
+ function setupDispatchCatalog(cfg) {
1651
+ const catalog = new ModelCatalog();
1652
+ try {
1653
+ materializeDynamicPools(cfg, catalog);
1654
+ }
1655
+ catch {
1656
+ }
1657
+ return contextWindowResolver((provider, model) => catalog.cachedLimits(provider, model)?.contextLength ?? null, snapshotContextWindow, observedContextLimit);
1658
+ }
1650
1659
  export async function resolveDispatchView(opts) {
1651
1660
  const cfg = opts.cfg ?? loadOrExit();
1652
1661
  const qs = new URLSearchParams();
@@ -1657,13 +1666,7 @@ export async function resolveDispatchView(opts) {
1657
1666
  if (opts.client)
1658
1667
  qs.set("client", opts.client);
1659
1668
  qs.set("host", "bypassed");
1660
- const catalog = new ModelCatalog();
1661
- try {
1662
- materializeDynamicPools(cfg, catalog);
1663
- }
1664
- catch {
1665
- }
1666
- const cachedContextWindow = contextWindowResolver((provider, model) => catalog.cachedLimits(provider, model)?.contextLength ?? null, snapshotContextWindow, observedContextLimit);
1669
+ const cachedContextWindow = setupDispatchCatalog(cfg);
1667
1670
  const liveRaw = (await tryServer(cfg, `/dispatch?${qs}`));
1668
1671
  const live = liveRaw !== null && liveRaw.host === "bypassed" ? liveRaw : null;
1669
1672
  restoreExhaustedRows(cfg, loadExhaustedRows());
@@ -1776,13 +1779,7 @@ export async function runDispatch(arg) {
1776
1779
  if (hostRouting.entrypoint)
1777
1780
  qs.set("entrypoint", hostRouting.entrypoint);
1778
1781
  const path = `/dispatch${qs.toString() ? `?${qs}` : ""}`;
1779
- const catalog = new ModelCatalog();
1780
- try {
1781
- materializeDynamicPools(cfg, catalog);
1782
- }
1783
- catch {
1784
- }
1785
- const cachedContextWindow = contextWindowResolver((provider, model) => catalog.cachedLimits(provider, model)?.contextLength ?? null, snapshotContextWindow, observedContextLimit);
1782
+ const cachedContextWindow = setupDispatchCatalog(cfg);
1786
1783
  const liveRaw = (await tryServer(cfg, path));
1787
1784
  const hostStale = liveRaw !== null && hostRouting.state !== "unknown" && liveRaw.host !== hostRouting.state;
1788
1785
  const windowStale = liveRaw !== null &&