odant-work 1.0.102 → 1.0.104

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 (56) hide show
  1. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +11 -1
  2. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +11 -1
  3. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/settings/$handler/class.js +292 -0
  4. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js +11 -1
  5. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat-task.js +17 -6
  6. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +24 -2
  7. package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +14 -11
  8. package/$server/$folder/$file/$html/handlers/preview/$handler/preview.js +7 -0
  9. package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +11 -0
  10. package/$server/$folder/$file/$md/handlers/preview/$handler/preview.js +29 -8
  11. package/$server/$folder/$file/$office/handlers/preview/$handler/preview.js +6 -0
  12. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +65 -10
  13. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +14 -11
  14. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/util.js +32 -0
  15. package/$server/$folder/$file/$task/handlers/preview/$handler/preview.js +1 -0
  16. package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +9 -0
  17. package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +15 -0
  18. package/$server/$folder/handlers/pages/form/$handler/class.js +10 -2
  19. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +523 -25
  20. package/$server/$folder/lib/consultant/consultant.js +80 -3
  21. package/$server/$folder/lib/explorer/explorer.js +63 -0
  22. package/$server/$folder/lib/tree/tree.js +47 -16
  23. package/NODES/$node/handlers/pages/form/network/$handler/class.js +552 -36
  24. package/autostart.bat +28 -0
  25. package/autostart.sh +17 -0
  26. package/oda/components/icon/icon.js +20 -7
  27. package/package.json +1 -1
  28. package/run.mjs +19 -0
  29. package/scripts/autostart.mjs +281 -0
  30. package/scripts/watchdog.mjs +496 -0
  31. package/sources/client.js +146 -2
  32. package/sources/host/auth-methods.js +2 -0
  33. package/sources/host/auto-updater.js +23 -1
  34. package/sources/host/http-server.js +5 -3
  35. package/sources/host/push.js +43 -14
  36. package/sources/host/websocket.js +69 -3
  37. package/sources/modules/agent/index.js +50 -19
  38. package/sources/modules/agent/permissions.js +4 -2
  39. package/sources/modules/agent/scope.js +72 -5
  40. package/sources/modules/agent/session.js +97 -14
  41. package/sources/modules/agent/tools/work/classes.js +16 -1
  42. package/sources/modules/license/index.js +120 -0
  43. package/sources/modules/nodes/registry.js +57 -7
  44. package/sources/modules/trainer/local-engine.js +22 -9
  45. package/sources/modules/user-profile/user-tokens.js +426 -85
  46. package/sources/server/access/gateway.js +3 -1
  47. package/sources/server/class/feed.js +6 -0
  48. package/sources/server/folder.js +5 -1
  49. package/sources/server/node.js +16 -0
  50. package/sources/server/server.js +59 -1
  51. package/sources/server/user.js +48 -0
  52. package/start.bat +25 -0
  53. package/start.sh +27 -0
  54. package/stop.bat +25 -0
  55. package/stop.sh +16 -0
  56. package/sw.js +3 -11
@@ -152,6 +152,13 @@ function runtimeVenvPython(rootDir = process.cwd()) {
152
152
  : path.join(rt, 'venv', 'bin', 'python');
153
153
  }
154
154
 
155
+ function isValidRuntimeVenv(rootDir = process.cwd()) {
156
+ const rt = runtimeRoot(rootDir);
157
+ const venvDir = path.join(rt, 'venv');
158
+ const venvPy = runtimeVenvPython(rootDir);
159
+ return fs.existsSync(venvPy) && fs.existsSync(path.join(venvDir, 'pyvenv.cfg'));
160
+ }
161
+
155
162
  function venvPythonCandidates(rootDir = process.cwd()) {
156
163
  const rel = os.platform() === 'win32'
157
164
  ? ['.venv/Scripts/python.exe', 'venv/Scripts/python.exe', 'MODULES/Модели/Local/.venv/Scripts/python.exe', 'MODELS/Local/.venv/Scripts/python.exe']
@@ -1311,13 +1318,17 @@ async function ensureUvBinary(rootDir = process.cwd()) {
1311
1318
  export async function ensureLocalPythonRuntime(rootDir = process.cwd()) {
1312
1319
  const existing = await resolvePythonCommandAsync(rootDir);
1313
1320
  const venvPy = runtimeVenvPython(rootDir);
1314
- if (existing && fs.existsSync(venvPy))
1321
+ if (existing && isValidRuntimeVenv(rootDir) && await probePython(venvPy, []))
1315
1322
  return { ok: true, python: venvPy, uv: fs.existsSync(path.join(runtimeRoot(rootDir), 'uv', 'uv.exe')) ? path.join(runtimeRoot(rootDir), 'uv', 'uv.exe') : '' };
1316
1323
 
1317
1324
  const rt = runtimeRoot(rootDir);
1318
1325
  const pyDir = path.join(rt, 'python');
1319
1326
  const venvDir = path.join(rt, 'venv');
1320
1327
  fs.mkdirSync(rt, { recursive: true });
1328
+ if (fs.existsSync(venvDir) && !isValidRuntimeVenv(rootDir)) {
1329
+ try { fs.rmSync(venvDir, { recursive: true, force: true }); }
1330
+ catch { /* ignore */ }
1331
+ }
1321
1332
  const { env: proxyEnv } = buildProxyEnv(rootDir);
1322
1333
 
1323
1334
  let uv = '';
@@ -1351,24 +1362,26 @@ export async function ensureLocalPythonRuntime(rootDir = process.cwd()) {
1351
1362
  let venvOk = false;
1352
1363
  if (managedOk) {
1353
1364
  const env = { ...proxyEnv, UV_PYTHON_INSTALL_DIR: pyDir };
1354
- const venvRes = await runSpawnCapture(uv, ['venv', venvDir, '--python', '3.11', '--python-preference', 'only-managed', '--seed', '--allow-existing'], 180000, env);
1355
- venvOk = venvRes.ok || fs.existsSync(venvPy);
1365
+ const venvRes = await runSpawnCapture(uv, ['venv', venvDir, '--python', '3.11', '--python-preference', 'only-managed', '--seed', '--clear'], 180000, env);
1366
+ venvOk = venvRes.ok && isValidRuntimeVenv(rootDir);
1356
1367
  if (!venvOk && !existing)
1357
1368
  throw new Error('uv venv: ' + (venvRes.err || venvRes.out || `код ${venvRes.code}`));
1358
1369
  }
1359
1370
  if (!venvOk && existing) {
1360
1371
  const realExe = (await execText(existing.cmd, [...existing.args, '-c', 'import sys; print(sys.executable)'], 5000)).trim() || existing.cmd;
1361
- const venvRes = await runSpawnCapture(uv, ['venv', venvDir, '--python', realExe, '--seed', '--allow-existing'], 180000, proxyEnv);
1362
- if (!venvRes.ok && !fs.existsSync(venvPy))
1372
+ const venvRes = await runSpawnCapture(uv, ['venv', venvDir, '--python', realExe, '--seed', '--clear'], 180000, proxyEnv);
1373
+ if ((!venvRes.ok || !isValidRuntimeVenv(rootDir)))
1363
1374
  throw new Error('uv venv: ' + (venvRes.err || venvRes.out || `код ${venvRes.code}`));
1364
1375
  }
1376
+ if (!isValidRuntimeVenv(rootDir))
1377
+ throw makePythonMissingError('Не удалось создать изолированное окружение Python (#runtime/venv)');
1365
1378
  resetPythonCache();
1366
1379
  return { ok: true, python: venvPy, uv };
1367
1380
  }
1368
1381
 
1369
1382
  if (existing) {
1370
1383
  const mk = await runSpawnCapture(existing.cmd, [...existing.args, '-m', 'venv', venvDir], 120000, proxyEnv);
1371
- if (mk.ok && fs.existsSync(venvPy)) {
1384
+ if (mk.ok && isValidRuntimeVenv(rootDir)) {
1372
1385
  resetPythonCache();
1373
1386
  return { ok: true, python: venvPy, uv: '' };
1374
1387
  }
@@ -1475,7 +1488,7 @@ export async function installLocalPythonDeps(packages = [], { rootDir = process.
1475
1488
  // Всегда разворачиваем изолированный #runtime/venv, чтобы не зависеть от системного Python и прав администратора
1476
1489
  let uv = '';
1477
1490
  const venvPy = runtimeVenvPython(rootDir);
1478
- if (!fs.existsSync(venvPy)) {
1491
+ if (!isValidRuntimeVenv(rootDir) || !(await probePython(venvPy, []))) {
1479
1492
  try {
1480
1493
  _pythonProvisionState = {
1481
1494
  active: true,
@@ -1581,9 +1594,9 @@ export async function installLocalPythonDeps(packages = [], { rootDir = process.
1581
1594
  };
1582
1595
 
1583
1596
  try {
1584
- if (uv && fs.existsSync(venvPy)) {
1597
+ if (uv && isValidRuntimeVenv(rootDir)) {
1585
1598
  const ovrArgs = fs.existsSync(ovrFile) ? ['--override', ovrFile] : [];
1586
- return await runSpawnCapture(uv, ['pip', 'install', '--python', venvPy, '--upgrade', '--verbose', ...ovrArgs, ...indexArgs, ...installList], 900000, proxyEnv, onLine);
1599
+ return await runSpawnCapture(uv, ['pip', 'install', '--python', venvPy, '--upgrade', ...ovrArgs, ...indexArgs, ...installList], 900000, proxyEnv, onLine);
1587
1600
  }
1588
1601
  const pipIndexArgs = useRocm ? ['--extra-index-url', AMD_ROCM_GFX1151_WHL_INDEX] : indexArgs;
1589
1602
  return await runSpawnCapture(py.cmd, [...py.args, '-m', 'pip', 'install', '--upgrade', '--progress-bar', 'off', ...pipIndexArgs, ...installList], 900000, proxyEnv, onLine);