pi-bob 0.2.2 → 0.2.4

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/README.md CHANGED
@@ -13,7 +13,7 @@ Updated for the installed `bobshell@2.0.1` package (upgraded from 1.0.6; finding
13
13
 
14
14
  - Bob Shell 2.x moved stored SSO tokens to `~/.bob/settings/auth-secrets.json` (key `bob.auth.tokens-<gateway>`); `~/.bob/settings.json` keeps only non-secret settings. This extension still reads only `ibm.instanceId`/`ibm.teamId` from there and still ignores Bob's secrets.
15
15
  - Token endpoints are unchanged in practice: 2.x builds `${gateway}/authn` + `v1/auth/token|refresh`, which resolves to the same `/authn/v1/auth/token` and `/authn/v1/auth/refresh` routes used here. The web login URL is now assembled as `https://bob.ibm.com` + `/login`; the final URL is the same as the 1.x constant.
16
- - **Breaking:** 2.x `model/info` entries dropped `litellm_params` (the backend identifier) and now carry `max_output_tokens` and `supports_prompt_caching` alongside `max_tokens`. The parser accepts both shapes and falls back to the route name when the backend is missing.
16
+ - **Breaking:** 2.x `model/info` entries dropped `litellm_params` (the backend identifier) and now carry `max_output_tokens` and `supports_prompt_caching` alongside `max_tokens`. The parser accepts both shapes and falls back to the route name when the backend is missing. `max_output_tokens` is the enforced output cap under 2.x (verified 2026-08-31: `premium` accepted `max_tokens=50000` despite a catalog `max_tokens` of 12000) and is advertised when present.
17
17
  - **Breaking:** 2.x `model/info` requires `x-instance-id` (HTTP 400 without it); `x-team-id` stays optional. The extension already sends both from Bob settings or the JWT `instances` claim.
18
18
  - Model tiers were renamed: 1.x `premium`/`pro`/`flash`/`flash-lite` became 2.x tiers `fast`/`premium`/`ultra` (`explorer` exists but is hidden). Live catalog also exposes `premium-ide`, `premium-shell`, `sonnet-4.5`, `wxO-model` (1M ctx / 64k out), `gpt-oss-20b`, and granite/rnj code models. The `premium` alias still exists, so the fallback catalog stays valid.
19
19
  - **Breaking (entitlement):** under 2.0, the `anthropic-messages` and `openai-responses` routes return `403 Access denied` with a valid token (routes exist; access is denied for this instance). Only the default `openai-completions` adapter works; treat the alternates as unavailable until IBM grants access.
@@ -63,6 +63,16 @@ Model discovery is enabled by default:
63
63
 
64
64
  Discovered context limits, output limits, vision support, reasoning support, backend identifiers, and token prices are mapped into Pi model definitions. Bob reports prices per token; Pi displays prices per million tokens, so the extension performs that conversion.
65
65
 
66
+ ### How context/output limits are determined
67
+
68
+ Every advertised number comes from Bob's own `/model/info` catalog — the extension never hardcodes per-model values:
69
+
70
+ - **Context window** ← `model_info.max_input_tokens`.
71
+ - **Max output tokens** ← `model_info.max_output_tokens` when present (2.x), else `model_info.max_tokens` (the 1.x output cap).
72
+ - Models that report no limits (e.g. `granite-8b-code-instruct`, `rnj-1-*`) use the defaults: 200,000 context / 8,192 output, overridable via `IBM_BOB_CONTEXT_WINDOW` / `IBM_BOB_MAX_TOKENS`.
73
+
74
+ The 2.x precedence was determined empirically, not from documentation. The 2.x catalog reports *two* output fields for the same route (e.g. `premium`: `max_tokens: 12000`, `max_output_tokens: 64000`), so on 2026-08-31 the extension author probed the live endpoint: a `chat/completions` request for `premium` with `max_tokens=50000` — four times the catalog's `max_tokens` — returned HTTP `200` and completed normally. That proves `max_tokens` is no longer the enforced cap and `max_output_tokens` is the real limit, so the larger, newer field is advertised when present. 1.x payloads have no `max_output_tokens`, where `max_tokens` was verified to be the output cap, keeping that behavior unchanged.
75
+
66
76
  ## Quick start for the discovered Bob endpoint
67
77
 
68
78
  Use Bob SSO through Pi:
package/extensions/bob.ts CHANGED
@@ -365,10 +365,12 @@ export function parseBobModelCatalog(payload: unknown): BobDiscoveredModel[] {
365
365
  entry.model_info.supports_thinking === true,
366
366
  supportsVision: entry.model_info.supports_vision === true,
367
367
  contextWindow: positiveNumber(entry.model_info.max_input_tokens),
368
- // bobshell 2.x adds max_output_tokens; keep the conservative 1.x
369
- // max_tokens precedence and only use it as a fallback.
368
+ // bobshell 2.x: max_tokens is no longer the enforced output cap
369
+ // (verified 2026-08-31: premium accepts max_tokens=50000; its
370
+ // max_output_tokens=64000 is the real limit). 1.x payloads have no
371
+ // max_output_tokens and keep the old max_tokens behavior.
370
372
  maxTokens:
371
- positiveNumber(entry.model_info.max_tokens) ?? positiveNumber(entry.model_info.max_output_tokens),
373
+ positiveNumber(entry.model_info.max_output_tokens) ?? positiveNumber(entry.model_info.max_tokens),
372
374
  cost: {
373
375
  input: perMillionCost(entry.model_info.input_cost_per_token),
374
376
  output: perMillionCost(entry.model_info.output_cost_per_token),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bob",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "Pi provider extension for IBM Bob / IBM-approved compatible model endpoints.",
6
6
  "keywords": [