@narumitw/pi-btw 0.58.0 → 0.58.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-btw",
3
- "version": "0.58.0",
3
+ "version": "0.58.1",
4
4
  "description": "Pi extension that adds a /btw side-question command.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/btw.ts CHANGED
@@ -146,7 +146,12 @@ export async function resolveBtwModel({
146
146
  : `falling back to ${fallback}`;
147
147
  try {
148
148
  const auth = await modelRegistry.getApiKeyAndHeaders(configuredModel);
149
- if (auth.ok && hasRequestAuth(auth)) return { model: configuredModel, auth };
149
+ if (auth.ok && hasRequestAuth(auth)) {
150
+ return {
151
+ model: auth.baseUrl ? { ...configuredModel, baseUrl: auth.baseUrl } : configuredModel,
152
+ auth,
153
+ };
154
+ }
150
155
  const reason = auth.ok ? "has no request credentials" : auth.error;
151
156
  reportWarning(
152
157
  `pi-btw model ${settings.model} is unavailable (${reason}); ${fallbackAction}.`,
@@ -163,7 +168,13 @@ export async function resolveBtwModel({
163
168
  if (!currentModel) return undefined;
164
169
  try {
165
170
  const auth = await modelRegistry.getApiKeyAndHeaders(currentModel);
166
- if (auth.ok && hasRequestAuth(auth)) return { model: currentModel, auth };
171
+ if (auth.ok && hasRequestAuth(auth)) {
172
+ // Direct provider streams bypass Pi's request preparation, including OAuth routing.
173
+ return {
174
+ model: auth.baseUrl ? { ...currentModel, baseUrl: auth.baseUrl } : currentModel,
175
+ auth,
176
+ };
177
+ }
167
178
  } catch {
168
179
  // The caller reports the final lack of an available model.
169
180
  }