odant-work 1.0.43 → 1.0.45

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.
Files changed (25) hide show
  1. package/#system/package-manifest.json +27 -27
  2. package/$server/$folder/$class/$structure/handlers/pages/form/database/$handler/database.js +18 -43
  3. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +21 -26
  4. package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +1 -1
  5. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +16 -8
  6. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/dock.js +17 -26
  7. package/$server/$folder/handlers/pages/form/$handler/form.js +199 -129
  8. package/$server/$folder/lib/explorer/explorer.js +104 -11
  9. package/$server/$folder/lib/local-models-transfer/local-models-transfer.js +17 -37
  10. package/$server/$folder/lib/tools/tools.js +24 -6
  11. package/MODELS/$ai/$folder/$class/$ai/class.js +16 -0
  12. package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js +31 -3
  13. package/SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/mcp.js +18 -43
  14. package/oda/components/layouts/app-layout/app-layout.js +4 -1
  15. package/oda/components/layouts/tabs/tabs.js +784 -395
  16. package/oda/components/packets/packets.js +25 -20
  17. package/oda/components/table/row.js +6 -4
  18. package/oda/components/table/table.js +2 -2
  19. package/package.json +1 -1
  20. package/sources/data/progress.md +14 -0
  21. package/sources/modules/trainer/huggingface.js +410 -13
  22. package/sources/modules/trainer/index.js +117 -12
  23. package/sources/modules/trainer/local-engine.js +55 -17
  24. package/sources/modules/trainer/paths.js +9 -3
  25. package/sources/modules/trainer/worker/local_infer_worker.py +95 -20
@@ -11,9 +11,9 @@ export default {
11
11
  gap: 6px;
12
12
  }
13
13
  .item {
14
- scale: .8;
14
+ scale: .84;
15
15
  border: none;
16
- border-radius: 4px;
16
+ border-radius: 8px;
17
17
  }
18
18
  .service-wrap {
19
19
  @apply --horizontal-center;
@@ -24,18 +24,36 @@ export default {
24
24
  min-height: 28px;
25
25
  padding: 4px 12px;
26
26
  gap: 6px;
27
- font-size: 13px;
27
+ font-size: 12.5px;
28
28
  font-weight: 500;
29
- border-radius: var(--radius-xs, 4px);
30
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
29
+ border-radius: 8px;
30
+ border: 1px solid var(--subtle-border);
31
+ background: var(--content-background);
32
+ color: var(--content-color);
33
+ fill: var(--content-color);
34
+ box-shadow: var(--elevation-1);
31
35
  box-sizing: border-box;
36
+ transition: background-color var(--duration-fast) var(--easing),
37
+ border-color var(--duration-fast) var(--easing),
38
+ color var(--duration-fast) var(--easing),
39
+ box-shadow var(--duration-fast) var(--easing),
40
+ opacity var(--duration-fast) var(--easing);
32
41
  }
33
42
  oda-button.service-btn:hover:not([disabled]) {
43
+ background: var(--accent-soft);
34
44
  border-color: var(--accent-color);
45
+ color: var(--accent-color);
46
+ fill: var(--accent-color);
47
+ }
48
+ oda-button.service-btn[disabled] {
49
+ opacity: 0.45;
50
+ box-shadow: none;
51
+ background: transparent;
52
+ border-color: var(--subtle-border);
35
53
  }
36
54
  </style>
37
55
  <div class="service-wrap" ~show="showLabels && toolItems?.length">
38
- <oda-button class="service-btn" content border hoverable ~for="toolItems"
56
+ <oda-button class="service-btn" hoverable ~for="toolItems"
39
57
  :icon="$for.item?.icon || ''"
40
58
  :icon-size="18"
41
59
  :label="$for.item?.label || $for.item?.id"
@@ -20,6 +20,10 @@ const JSON_BODY_MAX = 16 * 1024 * 1024; // F28: JSON-ответ (картинк
20
20
 
21
21
  const REMOTE_BODY_MAX = 32 * 1024 * 1024; // R7 (8.35): бинарный ответ провайдера (WAV речи/распознавания)
22
22
 
23
+ // Один раз на процесс проверяем сигнатуру запущенного движка Halogen (:8731) —
24
+ // если висит старый bubo.exe с прежними флагами, он будет перезапущен с актуальными.
25
+ const _engineEnsurePromises = new Map();
26
+
23
27
  export default {
24
28
  icon: 'carbon:machine-learning-model',
25
29
  form: 'trainer',
@@ -229,6 +233,18 @@ export default {
229
233
  headers['X-Halogen-Guard'] = typeof options.halogenGuard === 'string' ? options.halogenGuard : 'watch';
230
234
  const url = new URL(isAnthropic ? anthropicUrl(ai.baseUrl) : ai.baseUrl);
231
235
  const transport = transportFor(url);
236
+ // Перед первым обращением к локальному движку сверяем сигнатуру запуска:
237
+ // старый bubo.exe (профиль subagents / latin-словарь) иначе тихо тормозит кириллицу.
238
+ if (isHalogenNode && typeof WORK?.ensureHalogenBackendRunning === 'function'
239
+ && /^(https?:\/\/)?(127\.0\.0\.1|localhost|\[::1\])(:\d+)?(\/|$)/i.test(String(ai.baseUrl || ''))) {
240
+ const key = url.origin + '::' + String(ai?.model || '');
241
+ if (!_engineEnsurePromises.has(key)) {
242
+ _engineEnsurePromises.set(key, Promise.resolve()
243
+ .then(() => WORK.ensureHalogenBackendRunning({ baseUrl: ai.baseUrl, ai }))
244
+ .catch(() => null));
245
+ }
246
+ await _engineEnsurePromises.get(key);
247
+ }
232
248
  // Явный Content-Length (без Transfer-Encoding: chunked) — нативные локальные серверы вроде bubo.exe отклоняют chunked POST с 400 malformed request
233
249
  const payload = JSON.stringify(body);
234
250
  const reqHeaders = { ...headers, 'Content-Length': Buffer.byteLength(payload) };
@@ -224,6 +224,7 @@ export default {
224
224
  <div class="msg ok" ~if="notice">{{notice}}</div>
225
225
  <div class="msg err" ~if="error">{{error}}</div>
226
226
  <div class="msg info" ~if="provisionBanner">{{provisionBanner}}</div>
227
+ <div class="msg warn" ~if="weightsRepairLine">{{weightsRepairLine}}</div>
227
228
 
228
229
  <div class="grid-2" ~if="info">
229
230
  <div class="card">
@@ -312,6 +313,7 @@ export default {
312
313
  modelEnabled: true,
313
314
  testNoThinking: true,
314
315
  provisionBanner: '',
316
+ weightsRepair: null,
315
317
  testPrompt: 'Привет! Коротко в 3–4 предложениях расскажи, чем ты умеешь помогать в работе с документами, таблицами и кодом.',
316
318
  testTtsText: 'Привет! Локальный синтез речи платформы WORK работает.',
317
319
  testImagePrompt: 'Минималистичная светлая 3D-иконка офисного здания в стиле современного UI',
@@ -402,12 +404,32 @@ export default {
402
404
  return `Запущен (профиль ${prof}${npu})`;
403
405
  return `Автозапуск по первому запросу (профиль ${prof}${npu})`;
404
406
  },
407
+ get weightsRepairLine() {
408
+ const r = this.weightsRepair || this.info?.weightsRepair;
409
+ if (!r)
410
+ return '';
411
+ const reasons = Array.isArray(r.reasons) && r.reasons.length ? ` (${r.reasons.join('; ')})` : '';
412
+ if (r.active)
413
+ return `Автоматическая докачка недостающих файлов модели: ${Number(r.progress) || 0}%${reasons}`;
414
+ if (r.broken && r.status !== 'repaired')
415
+ return `Нарушена структура файлов модели${reasons}. Починка выполняется автоматически при первом обращении.`;
416
+ return '';
417
+ },
405
418
  get halogenSpeculationLine() {
406
419
  const setup = this.info?.engineSetup;
407
- const plan = setup?.plan || this.info?.speculation;
420
+ const plan = setup?.plan || setup?.running?.speculation || this.info?.speculation;
408
421
  if (!plan)
409
422
  return '';
410
- return plan.summary || (plan.enabled ? 'Активна (MTP + Draft Head)' : 'Отключена');
423
+ if (plan.summary)
424
+ return plan.summary;
425
+ if (plan.enabled || plan.mode === 'explicit' || plan.mode === 'weights-only') {
426
+ const parts = [
427
+ plan.mode === 'explicit' ? 'MTP включён' : 'MTP (по весам)',
428
+ plan.promptLookup ? 'Prompt Lookup вкл.' : 'Prompt Lookup выкл.',
429
+ ];
430
+ return parts.filter(Boolean).join(' · ');
431
+ }
432
+ return 'Отключена';
411
433
  },
412
434
  async attached() {
413
435
  await this.reload();
@@ -424,6 +446,8 @@ export default {
424
446
  inf = await this.$item.fetch('info');
425
447
  }
426
448
  this.info = inf;
449
+ if (inf?.weightsRepair)
450
+ this.weightsRepair = inf.weightsRepair;
427
451
  this.modelEnabled = inf?.enabled !== false && inf?.DATA?.enabled !== false;
428
452
  if (inf?.pythonProvision?.active && inf.pythonProvision.stage) {
429
453
  this.provisionBanner = inf.pythonProvision.stage + ' (выполняется один раз автоматически)';
@@ -540,6 +564,8 @@ export default {
540
564
  else if (st?.buboPrepare?.status === 'running' && st.buboPrepare.message) {
541
565
  this.provisionBanner = st.buboPrepare.message;
542
566
  }
567
+ if (st?.weightsRepair)
568
+ this.weightsRepair = st.weightsRepair;
543
569
  }
544
570
  catch { /* ignore */ }
545
571
  }, 1200);
@@ -571,8 +597,10 @@ export default {
571
597
  return;
572
598
  }
573
599
  const parts = [];
600
+ if (res.engineStartMs > 500)
601
+ parts.push(`Старт движка: ${(res.engineStartMs / 1000).toFixed(1)} с`);
574
602
  if (res.durationMs)
575
- parts.push(`Время: ${(res.durationMs / 1000).toFixed(2)} с`);
603
+ parts.push(`${res.engineStartMs > 500 ? 'Генерация' : 'Время'}: ${(res.durationMs / 1000).toFixed(2)} с`);
576
604
  if (res.ttftMs)
577
605
  parts.push(`TTFT: ${(res.ttftMs / 1000).toFixed(2)} с`);
578
606
  if (res.tokPerSec)
@@ -1,6 +1,6 @@
1
1
  ODA({
2
2
  is: 'work-mcp-manager',
3
- imports: '@oda/icon, @oda/button',
3
+ imports: '@oda/icon, @oda/button, oda//tabs',
4
4
  template: /*html*/`
5
5
  <style>
6
6
  :host {
@@ -52,40 +52,7 @@ ODA({
52
52
  display: flex;
53
53
  align-items: center;
54
54
  gap: 8px;
55
- background: var(--subtle-background, #f8fafc);
56
- padding: 4px;
57
- border-radius: 9px;
58
- border: 1px solid var(--border-color, #e2e8f0);
59
- }
60
- .tab-btn {
61
- border: none;
62
- background: transparent;
63
- color: inherit;
64
- font-size: 13px;
65
- font-weight: 600;
66
- padding: 7px 14px;
67
- border-radius: 6px;
68
- cursor: pointer;
69
- display: inline-flex;
70
- align-items: center;
71
- gap: 6px;
72
- }
73
- .tab-btn[active] {
74
- background: var(--accent-color, #2563eb);
75
- color: #ffffff;
76
- }
77
- .badge {
78
- display: inline-flex;
79
- align-items: center;
80
- padding: 2px 8px;
81
- border-radius: 999px;
82
- font-size: 11px;
83
- font-weight: 600;
84
- background: rgba(100, 116, 139, 0.14);
85
- }
86
- .tab-btn[active] .badge {
87
- background: rgba(255, 255, 255, 0.22);
88
- color: #fff;
55
+ flex-wrap: wrap;
89
56
  }
90
57
  .info-banner {
91
58
  display: grid;
@@ -306,14 +273,7 @@ ODA({
306
273
  </div>
307
274
  </div>
308
275
  <div class="tabs-row">
309
- <button class="tab-btn" :active="activeTab === 'mcp'" @tap="setTab('mcp')">
310
- <span>🔌 MCP-серверы и Сервисы</span>
311
- <span class="badge">{{mcpServers.length}}</span>
312
- </button>
313
- <button class="tab-btn" :active="activeTab === 'skills'" @tap="setTab('skills')">
314
- <span>🧠 Навыки ИИ (Skills)</span>
315
- <span class="badge">{{skills.length}}</span>
316
- </button>
276
+ <oda-tabs variant="pills" :allow-list="false" :items="mcpTabItems" :focused-index="mcpTabIndex" @tab-select="onMcpTabSelect($event)"></oda-tabs>
317
277
  <button class="btn" @tap="reload" title="Обновить список">↻ Обновить</button>
318
278
  </div>
319
279
  </div>
@@ -632,6 +592,21 @@ ODA({
632
592
  attached() {
633
593
  this.reload();
634
594
  },
595
+ get mcpTabItems() {
596
+ return [
597
+ { id: 'mcp', label: 'MCP-серверы и Сервисы', icon: 'carbon:plug', count: this.mcpServers?.length || 0, showZeroCount: true },
598
+ { id: 'skills', label: 'Навыки ИИ (Skills)', icon: 'carbon:skill-level', count: this.skills?.length || 0, showZeroCount: true },
599
+ ];
600
+ },
601
+ get mcpTabIndex() {
602
+ const idx = this.mcpTabItems.findIndex(t => t.id === this.activeTab);
603
+ return idx >= 0 ? idx : 0;
604
+ },
605
+ onMcpTabSelect(e) {
606
+ const id = e?.detail?.item?.id;
607
+ if (id)
608
+ this.setTab(id);
609
+ },
635
610
  setTab(tab) {
636
611
  this.activeTab = tab;
637
612
  this.noticeText = '';
@@ -406,9 +406,12 @@ ODA({is: 'app-tabs',
406
406
  box-sizing: border-box;
407
407
  transition: background 140ms ease, transform 120ms ease, box-shadow 140ms ease;
408
408
  }
409
+ .nav-list oda-button:not([light]):hover {
410
+ background: color-mix(in oklch, var(--accent-back) 14%, transparent);
411
+ }
409
412
  .nav-list oda-button[light] {
410
413
  font-weight: 700;
411
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
414
+ box-shadow: 0 2px 6px var(--shadow-color);
412
415
  }
413
416
  </style>
414
417
  <div class="nav-list" :horizontal="mobile">