agentsw 0.11.1 → 0.11.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/discover.js CHANGED
@@ -26,8 +26,13 @@ const maxOutputKeys = ["maximum_output_tokens", "max_output_tokens", "max_comple
26
26
  function declaredLimit(row, keys) {
27
27
  for (const key of keys) {
28
28
  const value = row[key];
29
- if (typeof value === "number" && Number.isFinite(value) && value > 0)
30
- return Math.floor(value);
29
+ if (typeof value !== "number" || !Number.isFinite(value))
30
+ continue;
31
+ // Floor before the test: a fraction in (0, 1) floors to 0, which every other
32
+ // reader treats as "no window" while the merge would rank it a declaration.
33
+ const limit = Math.floor(value);
34
+ if (limit > 0)
35
+ return limit;
31
36
  }
32
37
  return undefined;
33
38
  }
@@ -92,9 +97,14 @@ export async function discoverProviderCatalog(opts, hooks = {}) {
92
97
  const parsed = parseModelPage(await res.json());
93
98
  for (const id of parsed.ids)
94
99
  ids.add(id);
95
- for (const [id, declared] of parsed.limits)
96
- if (ids.has(id))
97
- limits.set(id, declared);
100
+ // A repeated id keeps what an earlier page declared: merge per key so a
101
+ // later partial row cannot drop the other limit.
102
+ for (const [id, declared] of parsed.limits) {
103
+ if (!ids.has(id))
104
+ continue;
105
+ const earlier = limits.get(id);
106
+ limits.set(id, earlier ? { ...earlier, ...declared } : declared);
107
+ }
98
108
  hooks.onPage?.({ page, count: ids.size });
99
109
  if (!parsed.hasMore)
100
110
  break;
package/dist/metadata.js CHANGED
@@ -305,12 +305,12 @@ function mergeSource(spec, incoming, source, modelId, now, fetchedAt, supplement
305
305
  if (!primaryFits && typeof next === "number" && next <= context)
306
306
  retained = next;
307
307
  if (typeof retained === "number" && retained > context) {
308
- // The endpoint's own window is authoritative for its route: a retained
308
+ // The endpoint's own window is authoritative for its route: a *tracked*
309
309
  // limit it cannot hold is a catalog estimate that would otherwise pin
310
- // the window open, so the limit goes and the window wins. A weaker
311
- // source keeps the old outcome — the wider window stays, the proposal
312
- // is reported, because nothing here proves the retained limit wrong.
313
- if (source === "endpoint") {
310
+ // the window open, so the limit goes and the window wins. A hand-set
311
+ // limit keeps the old outcome — it stays, and the window proposal is
312
+ // withdrawn, because a manual value outranks every source.
313
+ if (source === "endpoint" && spec.metadata?.fields?.[field]) {
314
314
  conflict(field, retained, context, "contextWindow");
315
315
  setField(spec, field, undefined);
316
316
  if (spec.metadata?.fields)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentsw",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "description": "CLI provider switcher for coding agents: manage OpenAI/Anthropic-protocol providers in one place and sync them, with models.dev metadata, into Claude Code, Codex, omp, pi, prime-agent, opencode, Hermes, WorkBuddy and DeepSeek Harness",
5
5
  "type": "module",
6
6
  "repository": {