krnell 3.0.2 → 3.0.3

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/atualizador.py CHANGED
@@ -93,7 +93,12 @@ class MonitorAtualizacao:
93
93
  self._estado = 'checking'
94
94
  pedido = urllib.request.Request(
95
95
  self._url,
96
- headers={'Accept': 'application/json', 'User-Agent': f'krnell/{self.versao_atual}'},
96
+ headers={
97
+ 'Accept': 'application/json',
98
+ 'Cache-Control': 'no-cache',
99
+ 'Pragma': 'no-cache',
100
+ 'User-Agent': f'krnell/{self.versao_atual}',
101
+ },
97
102
  )
98
103
  try:
99
104
  with self._abrir(pedido, timeout=2.0) as resposta:
@@ -129,7 +134,7 @@ def instalar_e_localizar_cli(versao: str, *, executar=subprocess.run) -> list[st
129
134
  raise RuntimeError('Node.js e npm precisam estar no PATH para atualizar')
130
135
  ambiente = dict(os.environ, NO_UPDATE_NOTIFIER='1', NPM_CONFIG_FUND='false', NPM_CONFIG_AUDIT='false')
131
136
  instalado = executar(
132
- [npm, 'install', '-g', f'krnell@{versao}', '--no-audit', '--no-fund'],
137
+ [npm, 'install', '-g', f'krnell@{versao}', '--prefer-online', '--no-audit', '--no-fund'],
133
138
  capture_output=True, text=True, errors='replace', timeout=240,
134
139
  check=False, shell=False, env=ambiente,
135
140
  )
package/bin/krnell.mjs CHANGED
@@ -77,9 +77,9 @@ prepararPastaUsuario();
77
77
  function lerVersao() {
78
78
  try {
79
79
  const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
80
- return pkg.version || '3.0.2';
80
+ return pkg.version || '3.0.3';
81
81
  } catch {
82
- return '3.0.2';
82
+ return '3.0.3';
83
83
  }
84
84
  }
85
85
 
@@ -104,6 +104,33 @@ Uso:
104
104
  process.exit(0);
105
105
  }
106
106
 
107
+ async function resolverUltimaVersao(pkgName) {
108
+ const url = process.env.KRNELL_UPDATE_URL
109
+ || `https://registry.npmjs.org/${encodeURIComponent(pkgName)}/latest`;
110
+ const ac = new AbortController();
111
+ const timer = setTimeout(() => ac.abort(), 5000);
112
+ try {
113
+ const res = await fetch(url, {
114
+ signal: ac.signal,
115
+ headers: {
116
+ Accept: 'application/json',
117
+ 'Cache-Control': 'no-cache',
118
+ Pragma: 'no-cache',
119
+ },
120
+ });
121
+ if (!res.ok) return '';
122
+ const dados = await res.json();
123
+ const v = String(dados?.version || '').trim();
124
+ return /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(v)
125
+ ? v
126
+ : '';
127
+ } catch {
128
+ return '';
129
+ } finally {
130
+ clearTimeout(timer);
131
+ }
132
+ }
133
+
107
134
  if (args[0] === 'upgrade' || args[0] === 'update') {
108
135
  const pkgName = (() => {
109
136
  try {
@@ -112,9 +139,18 @@ if (args[0] === 'upgrade' || args[0] === 'update') {
112
139
  return 'krnell';
113
140
  }
114
141
  })();
115
- console.log(`◈ krnell: atualizando ${pkgName}@latest via npm...`);
142
+ const resolvida = await resolverUltimaVersao(pkgName);
143
+ const spec = resolvida ? `${pkgName}@${resolvida}` : `${pkgName}@latest`;
144
+ console.log(`◈ krnell: atualizando ${spec} via npm (chaves, provedores e contas serão preservados)...`);
116
145
  const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
117
- const r = spawnSync(npmCmd, ['install', '-g', `${pkgName}@latest`], { stdio: 'inherit' });
146
+ const r = spawnSync(
147
+ npmCmd,
148
+ ['install', '-g', spec, '--prefer-online', '--no-audit', '--no-fund'],
149
+ {
150
+ stdio: 'inherit',
151
+ env: { ...process.env, NO_UPDATE_NOTIFIER: '1', NPM_CONFIG_FUND: 'false', NPM_CONFIG_AUDIT: 'false' },
152
+ },
153
+ );
118
154
  process.exit(r.status ?? 1);
119
155
  }
120
156
 
package/bridge.py CHANGED
@@ -59,7 +59,7 @@ OPENCODE_CONTEXT_TOKENS = 300000
59
59
  OPENCODE_OUTPUT_TOKENS = 64000
60
60
  MODEL_CONTEXT_ANUNCIADO = 0 # 0 = nao ha limite de descoberta configurado
61
61
  MODEL_OUTPUT_ANUNCIADO = 0 # limite nativo conhecido; independente do contexto escolhido
62
- BRIDGE_VERSION = '3.0.2'
62
+ BRIDGE_VERSION = '3.0.3'
63
63
  PROVIDER_URLS = {'unorouter': 'https://api.unorouter.com/v1',
64
64
  'tokenharbor': 'https://tokenharbor.ai/v1',
65
65
  # Contas do app WorkBuddy: o fluxo real (login, headers de
package/iniciar.sh CHANGED
@@ -27,7 +27,7 @@ case "${1:-}" in
27
27
  --once) MODO="once" ;;
28
28
  --repl) MODO="repl" ;;
29
29
  -v|--version)
30
- echo "krnell v3.0.2"
30
+ echo "krnell v3.0.3"
31
31
  exit 0
32
32
  ;;
33
33
  upgrade|update)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "krnell",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
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": {