@eduardo191labs/opencode-free-pi 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 eduardo191-star
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,187 @@
1
- # Temporary Holding Version
1
+ # @eduardo191labs/opencode-free-pi
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Proveedor **free-pi** para [OpenCode](https://opencode.ai): modelos gratuitos
4
+ financiados con anuncios, sin claves de API. Funciona en **Windows, Linux, macOS
5
+ y Termux**.
6
+
7
+ ## Instalación desde npm
8
+
9
+ ```bash
10
+ npm i -g @eduardo191labs/opencode-free-pi
11
+ opencode plugin add @eduardo191labs/opencode-free-pi
12
+ ```
13
+
14
+ El primer comando instala el paquete y sus dependencias. El segundo registra
15
+ el plugin en OpenCode y es la forma recomendada, porque npm 12 bloquea los
16
+ scripts de instalación por defecto.
17
+
18
+ El `postinstall` del paquete copia el plugin a
19
+ `~/.config/opencode/plugins/opencode-free-pi.ts` (en Windows,
20
+ `%USERPROFILE%\.config\opencode\plugins\opencode-free-pi.ts`) para que
21
+ OpenCode lo descubra automáticamente. Si tu npm bloquea scripts, ejecuta
22
+ también `opencode plugin add @eduardo191labs/opencode-free-pi`.
23
+
24
+ Para una instalación local sin `-g`, fuerza el registro con
25
+ `FREEPI_CONFIGURE=1 npm install`.
26
+
27
+ ## Instalación rápida con script
28
+
29
+ > Pasa el cursor por el bloque de comandos y usa el icono de copiar de GitHub.
30
+ > No necesitas definir variables de entorno para instalar.
31
+
32
+ ### Windows (PowerShell + curl)
33
+
34
+ ```powershell
35
+ curl.exe -fsSL "https://raw.githubusercontent.com/eduardo191-star/opencode-free-pi/main/install.ps1" | powershell -NoProfile -ExecutionPolicy Bypass -Command -
36
+ ```
37
+
38
+ Si tu terminal no acepta la tubería, descarga y ejecuta el `.ps1`:
39
+
40
+ ```powershell
41
+ curl.exe -fsSL -o "$env:TEMP\install-free-pi.ps1" "https://raw.githubusercontent.com/eduardo191-star/opencode-free-pi/main/install.ps1"; powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\install-free-pi.ps1"
42
+ ```
43
+
44
+ Alternativa si `curl.exe` no está disponible:
45
+
46
+ ```powershell
47
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "irm 'https://raw.githubusercontent.com/eduardo191-star/opencode-free-pi/main/install.ps1' | iex"
48
+ ```
49
+
50
+ ### Linux, macOS y Termux
51
+
52
+ ```bash
53
+ curl -fsSL "https://raw.githubusercontent.com/eduardo191-star/opencode-free-pi/main/install.sh" | bash
54
+ ```
55
+
56
+ En Termux, si falta `curl`:
57
+
58
+ ```bash
59
+ pkg install curl
60
+ ```
61
+
62
+ ## Después de instalar
63
+
64
+ ```bash
65
+ opencode auth login -p free-pi
66
+ opencode
67
+ ```
68
+
69
+ El plugin se registra como proveedor `free-pi`, elige un modelo gratuito por
70
+ defecto y desactiva el agente `title` para no gastar una petición extra.
71
+
72
+ ## Qué hace
73
+
74
+ - Catálogo de modelos free-pi y free-pi-defense en vivo.
75
+ - Inicio de sesión con GitHub, dispositivo o JWT existente.
76
+ - Cuota diaria, créditos premium y límites con mensajes claros.
77
+ - Anuncios e impresiones asociados al turno correcto.
78
+ - Herramientas: `free_pi_usage`, `free_pi_buy_credits`, `free_pi_redeem`,
79
+ `free_pi_invite`, `free_pi_feedback`, `free_pi_dashboard`, `web_search`,
80
+ `docs_lookup`, `look_at_image`, `generate_image` y más.
81
+ - Recuperación automática del límite de sesiones concurrentes.
82
+ - Compatible con rutas, credenciales y navegador de cada sistema operativo.
83
+
84
+ ## Rutas por plataforma
85
+
86
+ | Elemento | Windows | Linux / macOS / Termux |
87
+ | --------------- | ------------------------------------------------------------ | ------------------------------------------------ |
88
+ | Plugin | `%USERPROFILE%\.config\opencode\plugins\opencode-free-pi.ts` | `~/.config/opencode/plugins/opencode-free-pi.ts` |
89
+ | Credenciales | `%USERPROFILE%\.free-pi\agent\credentials.json` | `~/.free-pi/agent/credentials.json` |
90
+ | Config OpenCode | `%USERPROFILE%\.config\opencode\opencode.json[c]` | `~/.config/opencode/opencode.json[c]` |
91
+
92
+ Si `XDG_CONFIG_HOME` o `OPENCODE_CONFIG_DIR` están definidos, el instalador los
93
+ respeta.
94
+
95
+ ## Variables de entorno (opcionales)
96
+
97
+ | Variable | Uso |
98
+ | ------------------------- | ---------------------------------------------------- |
99
+ | `FREEPI_JWT` | Token JWT directamente, sin archivo de credenciales. |
100
+ | `FREEPI_CREDENTIALS_PATH` | Ruta alternativa a `credentials.json`. |
101
+ | `FREEPI_BASE_URL` | Cambiar la URL base de la API. |
102
+ | `FREEPI_MODELS_URL` | Cambiar el registro de modelos. |
103
+ | `FREEPI_NO_BROWSER=1` | No abrir el navegador. |
104
+ | `FREEPI_DEVICE_LOGIN=1` | Forzar inicio de sesión por dispositivo. |
105
+ | `OPENCODE_CONFIG_DIR` | Directorio de configuración de OpenCode. |
106
+
107
+ No hay variables obligatorias. El plugin usa el entorno nativo de cada sistema
108
+ para `HOME`, `USERPROFILE`, `XDG_CONFIG_HOME`, `APPDATA` cuando aplica, Termux y
109
+ Windows.
110
+
111
+ ## Paquete npm
112
+
113
+ El paquete incluye `dist/index.js` ya compilado y tipos TypeScript:
114
+
115
+ ```bash
116
+ npm pack
117
+ npm install -g ./eduardo191labs-opencode-free-pi-0.2.0.tgz
118
+ ```
119
+
120
+ También puedes declararlo en OpenCode como plugin npm:
121
+
122
+ ```json
123
+ {
124
+ "plugins": ["@eduardo191labs/opencode-free-pi"]
125
+ }
126
+ ```
127
+
128
+ La instalación recomendada sigue siendo el script, porque coloca el archivo en
129
+ la carpeta de plugins y funciona sin publicación en npm.
130
+
131
+ ## Publicación automática
132
+
133
+ Cada push a `main` ejecuta `.github/workflows/publish.yml`, comprueba la última
134
+ versión en npm, sube un patch si ya existe, publica el paquete y crea el commit
135
+ `chore(release): vX.Y.Z [skip ci]` con el tag `vX.Y.Z`.
136
+
137
+ El workflow usa el secret `NPM_TOKEN` del repositorio. Para una prueba sin
138
+ publicar, ejecuta el workflow manualmente con `publish = false`.
139
+
140
+ Después de un push, haz `git pull` para recibir el commit de versión que crea el
141
+ workflow.
142
+
143
+ ## Desarrollo
144
+
145
+ ```bash
146
+ npm install
147
+ npm run typecheck
148
+ npm run build
149
+ npm pack
150
+ ```
151
+
152
+ Estructura:
153
+
154
+ ```text
155
+ src/index.ts código fuente del plugin
156
+ dist/index.js build ESM listo para OpenCode
157
+ dist/index.d.ts tipos
158
+ install.sh instalador Linux/macOS/Termux
159
+ install.ps1 instalador Windows PowerShell
160
+ ```
161
+
162
+ ## Desinstalar
163
+
164
+ Windows:
165
+
166
+ ```powershell
167
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "$p=Join-Path $env:TEMP 'install-free-pi.ps1'; irm 'https://raw.githubusercontent.com/eduardo191-star/opencode-free-pi/main/install.ps1' -OutFile $p; & $p -Uninstall"
168
+ ```
169
+
170
+ Linux/macOS/Termux:
171
+
172
+ ```bash
173
+ curl -fsSL "https://raw.githubusercontent.com/eduardo191-star/opencode-free-pi/main/install.sh" | bash -s -- --uninstall
174
+ ```
175
+
176
+ O borra manualmente `opencode-free-pi.ts` de la carpeta de plugins y reinicia
177
+ OpenCode.
178
+
179
+ ## Privacidad
180
+
181
+ El plugin se comunica con `https://api.freepi.ai` para autenticación, cuota,
182
+ anuncios y completions. El contexto de anuncios no se envía al modelo. No
183
+ incluye claves ni tokens en el repositorio.
184
+
185
+ ## Licencia
186
+
187
+ MIT
@@ -0,0 +1,7 @@
1
+ import { type Plugin } from "@opencode-ai/plugin";
2
+ export declare const FreePiPlugin: Plugin;
3
+ declare const _default: {
4
+ id: string;
5
+ server: Plugin;
6
+ };
7
+ export default _default;