odant-work 1.0.111 → 1.0.112

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.
@@ -241,15 +241,17 @@ export default {
241
241
  const transport = transportFor(url);
242
242
  // Перед первым обращением к локальному движку сверяем сигнатуру запуска:
243
243
  // старый bubo.exe (профиль subagents / latin-словарь) иначе тихо тормозит кириллицу.
244
+ const ensureKey = url.origin + '::' + String(ai?.model || '');
244
245
  if (isHalogenNode && typeof WORK?.ensureHalogenBackendRunning === 'function'
245
246
  && /^(https?:\/\/)?(127\.0\.0\.1|localhost|\[::1\])(:\d+)?(\/|$)/i.test(String(ai.baseUrl || ''))) {
246
- const key = url.origin + '::' + String(ai?.model || '');
247
- if (!_engineEnsurePromises.has(key)) {
248
- _engineEnsurePromises.set(key, Promise.resolve()
249
- .then(() => WORK.ensureHalogenBackendRunning({ baseUrl: ai.baseUrl, ai }))
247
+ if (!_engineEnsurePromises.has(ensureKey)) {
248
+ _engineEnsurePromises.set(ensureKey, Promise.resolve()
249
+ .then(() => WORK.ensureHalogenBackendRunning({ baseUrl: ai.baseUrl, ai, waitTimeoutMs: 240000 }))
250
250
  .catch(() => null));
251
251
  }
252
- await _engineEnsurePromises.get(key);
252
+ const ensured = await _engineEnsurePromises.get(ensureKey);
253
+ if (ensured && ensured.ready === false)
254
+ _engineEnsurePromises.delete(ensureKey);
253
255
  }
254
256
  // Явный Content-Length (без Transfer-Encoding: chunked) — нативные локальные серверы вроде bubo.exe отклоняют chunked POST с 400 malformed request
255
257
  const payload = JSON.stringify(body);
@@ -323,7 +325,8 @@ export default {
323
325
 
324
326
  let res = await doRequest();
325
327
  if (res?.__localFallback && typeof WORK?.ensureHalogenBackendRunning === 'function') {
326
- const backend = await WORK.ensureHalogenBackendRunning({ baseUrl: ai.baseUrl, ai });
328
+ _engineEnsurePromises.delete(ensureKey);
329
+ const backend = await WORK.ensureHalogenBackendRunning({ baseUrl: ai.baseUrl, ai, waitTimeoutMs: 240000 });
327
330
  if (backend?.ready) {
328
331
  res = await doRequest();
329
332
  }
@@ -2,10 +2,9 @@
2
2
  * Приглашение нового или существующего пользователя на рабочее место активной структуры ($structure) для BOSS.
3
3
  */
4
4
  export default {
5
- icon: 'icons:person-add',
5
+ icon: 'social:person-add',
6
6
  label: 'Пригласить',
7
7
  roles: ['BOSS'],
8
- isButton: true,
9
8
  order: 5,
10
9
  allowUse($context) {
11
10
  return Boolean($context && !$context.DATA?.isUser && !$context.DATA?.usersContainer);
@@ -19,7 +18,7 @@ export default {
19
18
  try {
20
19
  await WORK.showDialog(el, {
21
20
  allowClose: true,
22
- TITLE: { label: 'Пригласить пользователя', icon: 'icons:person-add' },
21
+ TITLE: { label: 'Пригласить пользователя', icon: 'social:person-add' },
23
22
  CANCEL: { label: 'Закрыть', icon: 'icons:close' },
24
23
  });
25
24
  }
@@ -625,6 +625,12 @@ export default {
625
625
  const before = this._docKeys;
626
626
  const prevComputerUsed = Boolean(this._cu?.used);
627
627
  this.data = data;
628
+ if (this.optimistic) {
629
+ const o = this.optimistic;
630
+ const confirmed = (data.items || []).some(i => i?.type === 'user' && i.content === o.content && i.time >= o.time - 5000);
631
+ if (confirmed)
632
+ this.optimistic = null;
633
+ }
628
634
  const hasAssistant = (data.items || []).some(i => i.type === 'assistant');
629
635
  const recentStart = Boolean(data.created && (Date.now() - (+data.created || 0) < 15000) && !hasAssistant);
630
636
  this.status = isRunning
@@ -773,6 +779,8 @@ export default {
773
779
  this.pinned = true;
774
780
  this.status = 'running';
775
781
  this._hasActiveRun = true;
782
+ globalThis.WORK?._subscribeWsPath?.(this.$item?.short || this.$item?.path);
783
+ this._ensureRunPoll();
776
784
  this._stick();
777
785
  },
778
786
  toast(text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odant-work",
3
- "version": "1.0.111",
3
+ "version": "1.0.112",
4
4
  "description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
5
5
  "type": "module",
6
6
  "main": "sources/work.js",
@@ -197,11 +197,10 @@ export async function llmFor(modelPath) {
197
197
  // 9.2: тарифы модели ($ за миллион токенов) — карточка модели pricing: { input, output }
198
198
  pricing: item.pricing && typeof item.pricing === 'object' ? item.pricing : null,
199
199
  stream({ messages, tools, signal, effort, halogenKeep, halogenFrom, continueFinalMessage }) {
200
- /** @type {{ messages: any, temperature?: number, presence_penalty?: number, signal?: AbortSignal, tools?: any, maxOutput?: number, effort?: string, halogenKeep?: string, halogenFrom?: string, continueFinalMessage?: boolean }} */
200
+ /** @type {{ messages: any, temperature?: number, signal?: AbortSignal, tools?: any, maxOutput?: number, effort?: string, halogenKeep?: string, halogenFrom?: string, continueFinalMessage?: boolean }} */
201
201
  const req = {
202
202
  messages,
203
203
  temperature: isLocalOrHalogen ? 0.6 : 0.3,
204
- ...(isLocalOrHalogen ? { presence_penalty: 0.5 } : {}),
205
204
  signal,
206
205
  };
207
206
  if (tools?.length)
@@ -1135,13 +1135,20 @@ export async function probeHalogenServer(baseUrl = HALOGEN_DEFAULT_BASE_URL, { f
1135
1135
  fetchJson(`${origin}/halogen/handles`),
1136
1136
  ]);
1137
1137
 
1138
- const online = healthRes.status === 'fulfilled' || readyRes.status === 'fulfilled' || modelsRes.status === 'fulfilled';
1139
1138
  const health = healthRes.status === 'fulfilled' ? healthRes.value : null;
1140
1139
  const ready = readyRes.status === 'fulfilled' ? readyRes.value : null;
1141
1140
  const cache = cacheRes.status === 'fulfilled' ? cacheRes.value : null;
1142
1141
  const modelsRaw = modelsRes.status === 'fulfilled' ? modelsRes.value : null;
1143
1142
  const handlesRaw = handlesRes.status === 'fulfilled' ? handlesRes.value : null;
1144
1143
 
1144
+ const readyErrMsg = readyRes.status === 'rejected' ? String(readyRes.reason?.message || '') : '';
1145
+ const healthStatus = String(health?.status || '').toLowerCase();
1146
+ const loading = /\bHTTP 503\b/.test(readyErrMsg)
1147
+ || healthStatus === 'loading'
1148
+ || healthStatus === 'starting'
1149
+ || health?.loading === true;
1150
+ const online = !loading && (healthRes.status === 'fulfilled' || readyRes.status === 'fulfilled' || modelsRes.status === 'fulfilled');
1151
+
1145
1152
  const remoteModels = Array.isArray(modelsRaw?.data)
1146
1153
  ? modelsRaw.data.map(m => m?.id || m?.name).filter(Boolean)
1147
1154
  : Array.isArray(modelsRaw?.models)
@@ -1186,6 +1193,7 @@ export async function probeHalogenServer(baseUrl = HALOGEN_DEFAULT_BASE_URL, { f
1186
1193
 
1187
1194
  return {
1188
1195
  online,
1196
+ loading,
1189
1197
  origin,
1190
1198
  mode,
1191
1199
  modeLabel: modeLabels[mode] || modeLabels['work-embedded-fallback'],
@@ -31,9 +31,22 @@ export const LOCAL_IDLE_TIMEOUT_MS = Number(process.env.WORK_LOCAL_AI_IDLE_MS) |
31
31
  let _lastActivityAt = 0;
32
32
  let _idleTimer = null;
33
33
 
34
- function isHaloHighMemHost(totalRamGb) {
34
+ function isHaloHighMemHost(totalRamGb, rootDir = process.cwd()) {
35
35
  const ram = Number(totalRamGb) || (os.totalmem() / (1024 ** 3));
36
- return ram >= 120;
36
+ if (ram >= 120)
37
+ return true;
38
+ // На Windows Strix Halo UMA (например, 160 ГБ GPU + 32 ГБ ОС) os.totalmem() видит только CPU-часть (31.7 ГБ).
39
+ // Если процессор Ryzen AI Max / Strix Halo или на диске развёрнута Flash-модель (>40 ГБ) — не выгружаем основную модель.
40
+ try {
41
+ const cpuModel = String(os.cpus()?.[0]?.model || '');
42
+ if (/Ryzen\s+AI\s+Max|Strix\s+Halo/i.test(cpuModel))
43
+ return true;
44
+ const { hasFlash } = detectInstalledHotModelsForWarmup(rootDir);
45
+ if (hasFlash)
46
+ return true;
47
+ }
48
+ catch { /* ignore */ }
49
+ return false;
37
50
  }
38
51
 
39
52
  export function touchLocalEngineActivity(totalRamGb) {
@@ -1795,7 +1808,7 @@ export async function warmupLocalAiSuite({ rootDir = process.cwd() } = {}) {
1795
1808
  const { hasFlash, hot } = detectInstalledHotModelsForWarmup(rootDir);
1796
1809
  if (hasFlash) {
1797
1810
  try {
1798
- const be = await ensureHalogenBackendRunning({ rootDir, waitTimeoutMs: 120000 });
1811
+ const be = await ensureHalogenBackendRunning({ rootDir, waitTimeoutMs: 240000 });
1799
1812
  if (be?.ready)
1800
1813
  _warmupState.warmed.push('Qwen3.8-Flash-Next');
1801
1814
  }