kingkont 0.7.15 → 0.7.17

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/index.html CHANGED
@@ -3576,6 +3576,21 @@ async function renderNodeBody(node, body) {
3576
3576
  const wrap = document.createElement('div');
3577
3577
  wrap.className = 'gen-error';
3578
3578
  wrap.textContent = node.error || 'Ошибка генерации';
3579
+ // Если ошибка указывает на отсутствующую авторизацию KingKont — показываем
3580
+ // кнопку «Войти», открывающую окно настроек (там Chatium login flow).
3581
+ const errStr = String(node.error || '');
3582
+ if (/[KК](?:ing|инг)?[Kк]ont|войдите/i.test(errStr) && /KingKont/i.test(errStr)) {
3583
+ const loginBtn = document.createElement('button');
3584
+ loginBtn.textContent = '🔑 Войти';
3585
+ loginBtn.style.marginRight = '6px';
3586
+ loginBtn.addEventListener('click', e => {
3587
+ e.stopPropagation();
3588
+ if (window.appSettings?.openSettingsWindow) {
3589
+ window.appSettings.openSettingsWindow();
3590
+ }
3591
+ });
3592
+ wrap.appendChild(loginBtn);
3593
+ }
3579
3594
  if (node.generated?.prompt) {
3580
3595
  const retry = document.createElement('button');
3581
3596
  retry.textContent = 'Повторить';
package/main.js CHANGED
@@ -422,7 +422,10 @@ ipcMain.handle('updates:install', async (e, target = 'latest') => {
422
422
  // --prefer-online принуждает npm рефрешить metadata из registry, минуя
423
423
  // локальный stale-cache (иначе ETARGET для свежеопубликованных версий —
424
424
  // npm packument.json кэшируется на 5-10 минут).
425
- const cmd = `npm i -g --prefer-online kingkont@${target}`;
425
+ // --loglevel=error подавляет deprecation-warnings (типа boolean@3.2.0
426
+ // от global-agent) и funding-сообщения — в окне install видны только
427
+ // реальные ошибки.
428
+ const cmd = `npm i -g --prefer-online --loglevel=error kingkont@${target}`;
426
429
  const proc = spawn(shell, ['-lc', cmd]);
427
430
  let stderr = '';
428
431
  proc.stdout.on('data', d => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kingkont",
3
- "version": "0.7.15",
3
+ "version": "0.7.17",
4
4
  "description": "KingKont \u00b7 Chatium \u2014 \u043d\u043e\u0434-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0441\u0446\u0435\u043d \u0441 AI-\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438/\u0432\u0438\u0434\u0435\u043e/\u0433\u043e\u043b\u043e\u0441/SFX/\u043c\u0443\u0437\u044b\u043a\u0430/\u0442\u0435\u043a\u0441\u0442)",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -104,6 +104,29 @@ function ensureIcon(bundle) {
104
104
  try { fs.copyFileSync(src, dst); } catch {}
105
105
  }
106
106
 
107
+ // global-agent + его deps (boolean, roarr) приходят через @electron/get.
108
+ // global-agent.bootstrap() в @electron/get вызывается ТОЛЬКО при наличии
109
+ // GLOBAL_AGENT_HTTPS_PROXY env (proxy для скачивания Electron-дистрибутива).
110
+ // У 99% юзеров это пусто. Удаляем после install — `overrides` в package.json
111
+ // не работает для global-install (известный баг npm), а боолеан@3.2.0
112
+ // deprecated warning раздражает.
113
+ function pruneDeprecatedDeps() {
114
+ try {
115
+ const pkgRoot = path.dirname(require.resolve('../package.json'));
116
+ const candidates = ['global-agent', 'boolean', 'roarr', 'es6-error',
117
+ 'json-stringify-safe', 'matcher', 'serialize-error',
118
+ 'sprintf-js', 'detect-node', 'fast-url-parser',
119
+ 'semver-compare'];
120
+ for (const name of candidates) {
121
+ const dir = path.join(pkgRoot, 'node_modules', name);
122
+ if (fs.existsSync(dir)) {
123
+ try { fs.rmSync(dir, { recursive: true, force: true }); }
124
+ catch {}
125
+ }
126
+ }
127
+ } catch {}
128
+ }
129
+
107
130
  module.exports = patchElectronName;
108
131
 
109
132
  // Если запущен как entry-point (postinstall) — выполняем сразу.
@@ -111,4 +134,5 @@ if (require.main === module) {
111
134
  try { patchElectronName(); } catch (e) {
112
135
  console.warn('[kingkont postinstall] failed:', e.message);
113
136
  }
137
+ try { pruneDeprecatedDeps(); } catch {}
114
138
  }