odant-work 1.0.111 → 1.0.113
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/$server/$folder/$class/$ai/class.js +9 -6
- package/$server/$folder/$class/$structure/handlers/methods/invite/$handler/class.js +2 -3
- package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js +11 -3
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +8 -0
- package/oda/components/layouts/app-layout/app-layout.js +1 -1
- package/package.json +1 -1
- package/sources/modules/agent/index.js +1 -2
- package/sources/modules/agent/resources.js +2 -2
- package/sources/modules/trainer/halogen.js +9 -1
- package/sources/modules/trainer/local-engine.js +16 -3
- package/sources/server/folder.js +2 -0
|
@@ -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
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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(
|
|
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
|
-
|
|
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: '
|
|
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: '
|
|
21
|
+
TITLE: { label: 'Пригласить пользователя', icon: 'social:person-add' },
|
|
23
22
|
CANCEL: { label: 'Закрыть', icon: 'icons:close' },
|
|
24
23
|
});
|
|
25
24
|
}
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js
CHANGED
|
@@ -313,9 +313,10 @@ export default {
|
|
|
313
313
|
if (this.$item && this._onChanged)
|
|
314
314
|
this.$item.unlisten?.('changed', this._onChanged);
|
|
315
315
|
},
|
|
316
|
-
async reload() {
|
|
316
|
+
async reload({ force = false } = {}) {
|
|
317
317
|
const item = this.$item;
|
|
318
318
|
if (!item || typeof item.fetch !== 'function') {
|
|
319
|
+
this._layersSig = '';
|
|
319
320
|
this.aiRoot = null;
|
|
320
321
|
return;
|
|
321
322
|
}
|
|
@@ -333,9 +334,14 @@ export default {
|
|
|
333
334
|
return;
|
|
334
335
|
const valid = resolved.filter(Boolean);
|
|
335
336
|
if (!valid.length) {
|
|
337
|
+
this._layersSig = '';
|
|
336
338
|
this.aiRoot = null;
|
|
337
339
|
return;
|
|
338
340
|
}
|
|
341
|
+
const sig = valid.map(v => `${v.item.path}|${v.scope}|${v.isOwn}`).join(';');
|
|
342
|
+
if (!force && this.aiRoot && this._layersSig === sig)
|
|
343
|
+
return;
|
|
344
|
+
this._layersSig = sig;
|
|
339
345
|
const ownAiPath = (item.meta_folder?.path || item.path || '') + '/ai';
|
|
340
346
|
this.aiRoot = buildMergedLayerFolder(valid, {
|
|
341
347
|
id: 'ai',
|
|
@@ -343,8 +349,10 @@ export default {
|
|
|
343
349
|
path: ownAiPath,
|
|
344
350
|
});
|
|
345
351
|
} catch {
|
|
346
|
-
if (seq === this._reloadSeq)
|
|
352
|
+
if (seq === this._reloadSeq) {
|
|
353
|
+
this._layersSig = '';
|
|
347
354
|
this.aiRoot = null;
|
|
355
|
+
}
|
|
348
356
|
}
|
|
349
357
|
},
|
|
350
358
|
async openImportDialog() {
|
|
@@ -352,7 +360,7 @@ export default {
|
|
|
352
360
|
return;
|
|
353
361
|
const dlg = ODA.createComponent(SKILL_IMPORT_MODAL_TAG, {
|
|
354
362
|
$item: this.$item,
|
|
355
|
-
onInstalled: () => this.reload(),
|
|
363
|
+
onInstalled: () => this.reload({ force: true }),
|
|
356
364
|
});
|
|
357
365
|
try {
|
|
358
366
|
await WORK.showModal(dlg, {
|
|
@@ -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.
|
|
3
|
+
"version": "1.0.113",
|
|
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,
|
|
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)
|
|
@@ -60,7 +60,7 @@ export async function aiLayers(place) {
|
|
|
60
60
|
if (!dir || !key || seen.has(key))
|
|
61
61
|
continue;
|
|
62
62
|
seen.add(key);
|
|
63
|
-
dir.reset?.();
|
|
63
|
+
dir.reset?.(undefined, { localOnly: true });
|
|
64
64
|
out.push({ dir, scope: scopeOfAiDir(dir), owner: dir.$owner || null });
|
|
65
65
|
}
|
|
66
66
|
return out;
|
|
@@ -161,7 +161,7 @@ export async function loadDocs(place, sub) {
|
|
|
161
161
|
const folder = await safe(() => dir.get_item(sub));
|
|
162
162
|
if (!folder || Array.isArray(folder) || folder.inherit_source)
|
|
163
163
|
continue;
|
|
164
|
-
folder.reset?.();
|
|
164
|
+
folder.reset?.(undefined, { localOnly: true });
|
|
165
165
|
const kids = folder._collect_own()
|
|
166
166
|
.filter(f => f instanceof FS.$file)
|
|
167
167
|
.sort((a, b) => String(a.id || '').localeCompare(String(b.id || '')));
|
|
@@ -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
|
-
|
|
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:
|
|
1811
|
+
const be = await ensureHalogenBackendRunning({ rootDir, waitTimeoutMs: 240000 });
|
|
1799
1812
|
if (be?.ready)
|
|
1800
1813
|
_warmupState.warmed.push('Qwen3.8-Flash-Next');
|
|
1801
1814
|
}
|
package/sources/server/folder.js
CHANGED
|
@@ -2350,6 +2350,8 @@ export class $folder extends $item{
|
|
|
2350
2350
|
}
|
|
2351
2351
|
reset(initiator, opts){
|
|
2352
2352
|
this[R].cache = {};
|
|
2353
|
+
if (opts?.localOnly)
|
|
2354
|
+
return true;
|
|
2353
2355
|
let key = this.short;
|
|
2354
2356
|
for(let session of Object.values($server.sessions)){
|
|
2355
2357
|
for(let id in session.sockets){
|