krnell 3.0.0 → 3.0.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/Instalar_Atalho_Windows.cmd +12 -12
- package/Painel.cmd +12 -12
- package/README.md +21 -9
- package/atualizador.py +148 -0
- package/bin/{nyxo.mjs → krnell.mjs} +47 -26
- package/bridge.py +105 -21
- package/config.example.json +2 -2
- package/contexto.py +59 -39
- package/ferramentas/install_windows.py +2 -2
- package/ferramentas/selecionar_provedor.py +7 -1
- package/iniciar.sh +15 -15
- package/kimi.py +89 -4
- package/opencode_sync.py +46 -20
- package/package.json +5 -6
- package/painel.py +5612 -5227
- package/provedores/kimi/bridge.mjs +93 -24
- package/provedores_catalogo.py +21 -149
- package/tls_proxy.py +1 -1
- package/tui_core.py +7 -3
package/opencode_sync.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Integração do
|
|
1
|
+
"""Integração do Krnell com o OpenCode (modelos + plugin system-prompt)."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import json
|
|
@@ -20,15 +20,15 @@ def candidatos_config_opencode() -> list[Path]:
|
|
|
20
20
|
return lista
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def
|
|
23
|
+
def _bloco_modelos_krnell(indent: str = ' ') -> str:
|
|
24
24
|
modelos = [
|
|
25
|
-
('kimi-k3.1-pro', 'Kimi K3.1 Pro (NVIDIA)', 400000, 65536, ['text'], ['low', 'medium', 'high', 'max'], 'max'),
|
|
26
|
-
('minimax-m3.1-flash', 'MiniMax M3.1 Flash (NVIDIA)', 400000, 65536, ['text'], ['low', 'medium', 'high', 'max'], 'max'),
|
|
27
|
-
('claude-opus-5-5', 'Claude Opus 5.5 (Antigravity)',
|
|
28
|
-
('claude-sonnet-5-5', 'Claude Sonnet 5.5 (Antigravity)',
|
|
29
|
-
('gemini-4-hydrogen', 'Gemini 4 Hydrogen (Antigravity)', 1000000,
|
|
30
|
-
('gemini-4-neon', 'Gemini 4 Neon (Antigravity)', 1000000,
|
|
31
|
-
('
|
|
25
|
+
('kimi-k3.1-pro', 'Kimi K3.1 Pro (NVIDIA)', 400000, 65536, ['text', 'image'], ['low', 'medium', 'high', 'max'], 'max'),
|
|
26
|
+
('minimax-m3.1-flash', 'MiniMax M3.1 Flash (NVIDIA)', 400000, 65536, ['text', 'image'], ['low', 'medium', 'high', 'max'], 'max'),
|
|
27
|
+
('claude-opus-5-5', 'Claude Opus 5.5 (Antigravity)', 1000000, 128000, ['text', 'image'], ['low', 'medium', 'high'], 'high'),
|
|
28
|
+
('claude-sonnet-5-5', 'Claude Sonnet 5.5 (Antigravity)', 1000000, 128000, ['text', 'image'], ['low', 'medium', 'high'], 'high'),
|
|
29
|
+
('gemini-4-hydrogen', 'Gemini 4 Hydrogen (Antigravity)', 1000000, 262144, ['text', 'image', 'audio', 'video', 'pdf'], ['low', 'medium', 'high', 'xhigh'], 'xhigh'),
|
|
30
|
+
('gemini-4-neon', 'Gemini 4 Neon (Antigravity)', 1000000, 262144, ['text', 'image', 'audio', 'video', 'pdf'], ['low', 'medium', 'high', 'xhigh'], 'xhigh'),
|
|
31
|
+
('krnell', 'Krnell Active (dynamic route)', 1000000, 65536, ['text', 'image'], ['low', 'medium', 'high', 'xhigh', 'max'], 'max'),
|
|
32
32
|
]
|
|
33
33
|
partes = []
|
|
34
34
|
for mid, nome, ctx, out, inp, efforts, default_eff in modelos:
|
|
@@ -148,8 +148,9 @@ def opencode_detectado() -> bool:
|
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
def opencode_ja_configurado(porta: int = 8765) -> bool:
|
|
151
|
-
"""True se opencode.json(c) já tem
|
|
151
|
+
"""True se opencode.json(c) já tem `krnell` atualizado na porta com visão NVIDIA."""
|
|
152
152
|
esperado = f'http://127.0.0.1:{int(porta)}/v1'
|
|
153
|
+
modelos_visao = ('kimi-k3.1-pro', 'minimax-m3.1-flash')
|
|
153
154
|
for arq in candidatos_config_opencode():
|
|
154
155
|
if not arq.is_file():
|
|
155
156
|
continue
|
|
@@ -157,13 +158,34 @@ def opencode_ja_configurado(porta: int = 8765) -> bool:
|
|
|
157
158
|
txt = arq.read_text(encoding='utf-8')
|
|
158
159
|
except OSError:
|
|
159
160
|
continue
|
|
160
|
-
if '"
|
|
161
|
+
if '"krnell"' not in txt or esperado not in txt:
|
|
162
|
+
continue
|
|
163
|
+
try:
|
|
164
|
+
import contexto
|
|
165
|
+
_, dados = contexto._jsonc(txt)
|
|
166
|
+
except Exception:
|
|
167
|
+
continue
|
|
168
|
+
bloco = ((dados.get('providers') or {}).get('krnell')
|
|
169
|
+
or (dados.get('provider') or {}).get('krnell'))
|
|
170
|
+
if not isinstance(bloco, dict):
|
|
171
|
+
continue
|
|
172
|
+
opts = bloco.get('settings') or bloco.get('options') or {}
|
|
173
|
+
if str((opts.get('baseURL') if isinstance(opts, dict) else '') or '').rstrip('/') != esperado:
|
|
174
|
+
continue
|
|
175
|
+
modelos = bloco.get('models')
|
|
176
|
+
if not isinstance(modelos, dict):
|
|
177
|
+
continue
|
|
178
|
+
if all(
|
|
179
|
+
isinstance(modelos.get(mid), dict)
|
|
180
|
+
and 'image' in ((modelos[mid].get('capabilities') or {}).get('input') or [])
|
|
181
|
+
for mid in modelos_visao
|
|
182
|
+
):
|
|
161
183
|
return True
|
|
162
184
|
return False
|
|
163
185
|
|
|
164
186
|
|
|
165
187
|
def configurar_opencode(raiz: Path, porta: int = 8765, api_key: str = '') -> dict:
|
|
166
|
-
"""Instala o plugin system-prompt e registra o provedor `
|
|
188
|
+
"""Instala o plugin system-prompt e registra o provedor `krnell` no OpenCode."""
|
|
167
189
|
raiz = Path(raiz).resolve()
|
|
168
190
|
cands = candidatos_config_opencode()
|
|
169
191
|
arq = next((p for p in cands if p.exists()), cands[0])
|
|
@@ -180,7 +202,7 @@ def configurar_opencode(raiz: Path, porta: int = 8765, api_key: str = '') -> dic
|
|
|
180
202
|
shutil.copy2(src_plugin, dst_plugin)
|
|
181
203
|
plugin_instalado = True
|
|
182
204
|
|
|
183
|
-
# 2) AGENTS.md se existir na raiz
|
|
205
|
+
# 2) AGENTS.md se existir na raiz e ainda nao existir no OpenCode
|
|
184
206
|
src_agents = raiz / 'AGENTS.md'
|
|
185
207
|
dst_agents = cfg_dir / 'AGENTS.md'
|
|
186
208
|
if src_agents.exists() and not dst_agents.exists():
|
|
@@ -188,16 +210,16 @@ def configurar_opencode(raiz: Path, porta: int = 8765, api_key: str = '') -> dic
|
|
|
188
210
|
|
|
189
211
|
base_url = f'http://127.0.0.1:{int(porta)}/v1'
|
|
190
212
|
key_val = (api_key or 'local').strip()
|
|
191
|
-
|
|
192
|
-
f' "
|
|
193
|
-
f' "name": "
|
|
213
|
+
bloco_krnell = (
|
|
214
|
+
f' "krnell": {{\n'
|
|
215
|
+
f' "name": "Krnell (local)",\n'
|
|
194
216
|
f' "package": "@opencode/ai/providers/openai-compatible",\n'
|
|
195
217
|
f' "settings": {{\n'
|
|
196
218
|
f' "baseURL": "{base_url}",\n'
|
|
197
219
|
f' "apiKey": "{key_val}"\n'
|
|
198
220
|
f' }},\n'
|
|
199
221
|
f' "models": {{\n'
|
|
200
|
-
f'{
|
|
222
|
+
f'{_bloco_modelos_krnell(" ")}\n'
|
|
201
223
|
f' }}\n'
|
|
202
224
|
f' }}'
|
|
203
225
|
)
|
|
@@ -209,7 +231,7 @@ def configurar_opencode(raiz: Path, porta: int = 8765, api_key: str = '') -> dic
|
|
|
209
231
|
' "$schema": "https://opencode.ai/config.json",'
|
|
210
232
|
f'{plugins_str}\n'
|
|
211
233
|
' "providers": {\n'
|
|
212
|
-
f'{
|
|
234
|
+
f'{bloco_krnell}\n'
|
|
213
235
|
' }\n'
|
|
214
236
|
'}\n'
|
|
215
237
|
)
|
|
@@ -218,8 +240,12 @@ def configurar_opencode(raiz: Path, porta: int = 8765, api_key: str = '') -> dic
|
|
|
218
240
|
texto = arq.read_text(encoding='utf-8')
|
|
219
241
|
if plugin_instalado or dst_plugin.exists():
|
|
220
242
|
texto, _ = _garantir_plugin_no_texto(texto, str(dst_plugin_dir))
|
|
221
|
-
|
|
222
|
-
|
|
243
|
+
# Se já havia o bloco antigo "nyxo", substitui in-place por "krnell"
|
|
244
|
+
if '"nyxo"' in texto and '"krnell"' not in texto:
|
|
245
|
+
texto, _ = _substituir_ou_inserir_provedor(texto, 'nyxo', bloco_krnell)
|
|
246
|
+
else:
|
|
247
|
+
texto, _ = _substituir_ou_inserir_provedor(texto, 'krnell', bloco_krnell)
|
|
248
|
+
# Atualiza tambem o baseURL e variants do kimibridge se existir, apontando pro krnell
|
|
223
249
|
if '"kimibridge"' in texto:
|
|
224
250
|
texto = re.sub(
|
|
225
251
|
r'("kimibridge"[\s\S]{0,600}?"baseURL"\s*:\s*")[^"]*(")',
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "krnell",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Krnell — proxy multi-provedor local (NVIDIA Playground, Antigravity OAuth, WorkBuddy, OpenCode, 20+ APIs) com TUI estilo OpenCode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"krnell": "bin/
|
|
8
|
-
"nyxo": "bin/nyxo.mjs"
|
|
7
|
+
"krnell": "bin/krnell.mjs"
|
|
9
8
|
},
|
|
10
9
|
"files": [
|
|
11
10
|
"bin/",
|
|
12
11
|
"bridge.py",
|
|
13
12
|
"painel.py",
|
|
13
|
+
"atualizador.py",
|
|
14
14
|
"painel_web.py",
|
|
15
15
|
"tui_core.py",
|
|
16
16
|
"opencode_sync.py",
|
|
@@ -36,14 +36,13 @@
|
|
|
36
36
|
"ferramentas/selecionar_provedor.py",
|
|
37
37
|
"ferramentas/Liberar_Firewall.ps1",
|
|
38
38
|
"ferramentas/firewall_linux.sh",
|
|
39
|
-
"README.md"
|
|
40
|
-
"README-NPM.md"
|
|
39
|
+
"README.md"
|
|
41
40
|
],
|
|
42
41
|
"engines": {
|
|
43
42
|
"node": ">=18.0.0"
|
|
44
43
|
},
|
|
45
44
|
"scripts": {
|
|
46
|
-
"start": "node bin/
|
|
45
|
+
"start": "node bin/krnell.mjs",
|
|
47
46
|
"build": "vite build --config vite.config.mjs",
|
|
48
47
|
"dev": "vite --config vite.config.mjs --host 127.0.0.1",
|
|
49
48
|
"lab": "node ferramentas/lab-dashboard.mjs",
|