@eduardo191labs/opencode-free-pi 0.7.33 → 0.7.34

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
@@ -222,12 +222,13 @@ Después de iniciar sesión, ejecuta `/reload` en OpenCode o reinícialo.
222
222
  forma perezosa: si falta, el redimensionado de imágenes cae a la ruta sin WASM
223
223
  en vez de romper el arranque.
224
224
  - **Aislamiento por proveedor**: todo lo que añade el plugin —herramientas,
225
- cabeceras, anuncios, reglas de prompt, compactación, reintentos, topes de
226
- tokens y ajustes— se aplica solo a `free-pi` y `free-pi-defense`. Los demás
227
- proveedores no reciben las herramientas en su lista (el plugin las quita de la
228
- petición), no ven las cabeceras free-pi y conservan sus propias imágenes y su
229
- propio uso. Si una sesión cambia de free-pi a otro modelo, pierde las
230
- herramientas en la siguiente petición y las llamadas directas se rechazan.
225
+ cabeceras, anuncios y el `x-session-id` del proveedor— se aplica solo a
226
+ `free-pi` y `free-pi-defense`. Los reintentos, la compactación, el uso y los
227
+ topes son de OpenCode para todos los proveedores. Los demás proveedores no
228
+ reciben las herramientas en su lista (el plugin las quita de la petición), no
229
+ ven las cabeceras free-pi y conservan sus propias imágenes y su propio uso.
230
+ Si una sesión cambia de free-pi a otro modelo, pierde las herramientas en la
231
+ siguiente petición y las llamadas directas se rechazan.
231
232
  - Compatible con rutas, credenciales y navegador de cada sistema operativo.
232
233
 
233
234
  ## Lectura de imágenes
@@ -500,15 +501,15 @@ src/
500
501
  catalog/ catálogo en vivo, models.dev y límites medidos
501
502
  errors/ parseo, mensajes y reescritura de límites
502
503
  integration/ integración y métodos de inicio de sesión
503
- session/ hooks, eventos, seguimiento y uso
504
+ session/ hooks, eventos, seguimiento y slots de proveedor
504
505
  utils/ helpers pequeños (directorio de datos y URLs)
505
506
  dist/ build ESM y tipos
506
507
  scripts/postinstall.mjs registro en opencode.json
507
508
  test/smoke.mjs prueba de humo del build
508
509
  test/registry.mjs models.dev en vivo y tolerancia a fallos
509
510
  test/models.mjs capacidades, variantes y límites
510
- test/live.mjs ventana medida y observaciones del gateway
511
- test/diet.mjs poda de resultados de herramientas antiguos
511
+ test/live.mjs observaciones de tráfico real y ventana aprendida
512
+ test/legacy.mjs limpieza de agentes y skills de versiones anteriores
512
513
  test/hooks.mjs hooks de sesión, anuncios, cuota y compactación
513
514
  ```
514
515
 
package/dist/api/quota.js CHANGED
@@ -17,8 +17,16 @@ export async function fetchQuota(deps, opts = {}) {
17
17
  (!opts.stats || current.stats)) {
18
18
  return current;
19
19
  }
20
- if (deps.state.quotaPromise)
21
- return deps.state.quotaPromise;
20
+ if (deps.state.quotaPromise) {
21
+ const pending = deps.state.quotaPromise;
22
+ if (!opts.stats)
23
+ return pending;
24
+ // A stats request cannot reuse an in-flight `/me`-only refresh: it would
25
+ // resolve without the very numbers the usage tool asked for.
26
+ const settled = await pending;
27
+ if (settled.stats)
28
+ return settled;
29
+ }
22
30
  const pending = (async () => {
23
31
  const token = await resolveToken(deps);
24
32
  if (!token) {
@@ -87,6 +87,10 @@ export function applyProvider(editor, providerID, name, models, token) {
87
87
  settings: {
88
88
  ...base.settings,
89
89
  ...(existing.provider?.settings ?? {}),
90
+ // The key belongs to the active sign-in, not to the stored provider
91
+ // record. Keeping the previous one here left the provider using the token
92
+ // from the first transform after the user signed in again.
93
+ apiKey: base.settings.apiKey,
90
94
  },
91
95
  };
92
96
  const merged = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eduardo191labs/opencode-free-pi",
3
- "version": "0.7.33",
3
+ "version": "0.7.34",
4
4
  "description": "Ad-supported free-pi provider plugin for OpenCode on Windows, Linux, macOS and Termux",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/api/quota.ts CHANGED
@@ -36,7 +36,14 @@ export async function fetchQuota(
36
36
  ) {
37
37
  return current;
38
38
  }
39
- if (deps.state.quotaPromise) return deps.state.quotaPromise;
39
+ if (deps.state.quotaPromise) {
40
+ const pending = deps.state.quotaPromise;
41
+ if (!opts.stats) return pending;
42
+ // A stats request cannot reuse an in-flight `/me`-only refresh: it would
43
+ // resolve without the very numbers the usage tool asked for.
44
+ const settled = await pending;
45
+ if (settled.stats) return settled;
46
+ }
40
47
 
41
48
  const pending = (async () => {
42
49
  const token = await resolveToken(deps);
package/src/catalog/v2.ts CHANGED
@@ -119,6 +119,10 @@ export function applyProvider(
119
119
  settings: {
120
120
  ...base.settings,
121
121
  ...(existing.provider?.settings ?? {}),
122
+ // The key belongs to the active sign-in, not to the stored provider
123
+ // record. Keeping the previous one here left the provider using the token
124
+ // from the first transform after the user signed in again.
125
+ apiKey: base.settings.apiKey,
122
126
  },
123
127
  };
124
128