odant-work 1.0.93 → 1.0.95

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 (83) hide show
  1. package/#system/package-manifest.json +618 -649
  2. package/$server/$folder/$class/$ai/class.js +1 -0
  3. package/$server/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js +4 -1
  4. package/$server/$folder/$class/$data/$catalog/$virtual/class.js +1 -0
  5. package/$server/$folder/$class/$data/$catalog/class.js +1 -0
  6. package/$server/$folder/$class/$data/$operation/class.js +1 -0
  7. package/$server/$folder/$class/$data/$register/$account/class.js +1 -0
  8. package/$server/$folder/$class/$data/$register/class.js +1 -0
  9. package/$server/$folder/$class/$data/$struct/class.js +1 -0
  10. package/$server/$folder/$class/$domain/class.js +1 -0
  11. package/$server/$folder/$class/$module/$mcp/class.js +1 -0
  12. package/$server/$folder/$class/$module/$provider/class.js +1 -0
  13. package/$server/$folder/$class/$module/$provider/handlers/pages/form/system/ai/$handler/class.js +38 -6
  14. package/$server/$folder/$class/$module/class.js +1 -0
  15. package/$server/$folder/$class/$structure/$project/class.js +1 -0
  16. package/$server/$folder/$class/$structure/$server/class.js +1 -0
  17. package/$server/$folder/$class/$structure/$user/class.js +2 -0
  18. package/$server/$folder/$class/$structure/class.js +1 -0
  19. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat-task.js +20 -6
  20. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +23 -17
  21. package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +35 -3
  22. package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js +38 -3
  23. package/$server/$folder/$class/$users/class.js +1 -0
  24. package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +95 -24
  25. package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +22 -4
  26. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +4 -3
  27. package/$server/$folder/handlers/pages/form/$handler/class.js +167 -13
  28. package/$server/$folder/lib/explorer/explorer.js +2 -1
  29. package/$server/$folder/lib/icon/icon.js +2 -2
  30. package/$server/$folder/lib/node/node.js +3 -11
  31. package/$server/$folder/lib/prompt-bar/prompt-bar.js +4 -2
  32. package/$server/$folder/lib/tree/tree.js +12 -1
  33. package/MODULES//320/224/320/260/320/275/320/275/321/213/320/265/Geo/$module/class.js +1 -0
  34. package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/engine/$handler/class.js +445 -0
  35. package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/class.js" +1 -0
  36. package/package.json +1 -1
  37. package/run.mjs +11 -0
  38. package/scripts/agent-eval.mjs +1 -1
  39. package/scripts/migrate-tree.mjs +9 -438
  40. package/sources/client/class.js +1 -1
  41. package/sources/host/auth-methods.js +16 -2
  42. package/sources/host/auto-updater.js +34 -24
  43. package/sources/host/tree-migration.js +580 -0
  44. package/sources/host/tree-migration.json +85 -0
  45. package/sources/modules/agent/index.js +23 -10
  46. package/sources/modules/agent/session.js +22 -2
  47. package/sources/modules/agent/tools/meta.js +1 -1
  48. package/sources/modules/agent/voice.js +6 -2
  49. package/sources/modules/license/index.js +53 -0
  50. package/sources/modules/trainer/dataset.js +6 -4
  51. package/sources/modules/trainer/halogen.js +9 -9
  52. package/sources/modules/trainer/huggingface.js +1 -1
  53. package/sources/modules/trainer/index.js +25 -5
  54. package/sources/modules/trainer/local-engine.js +17 -11
  55. package/sources/modules/trainer/runner.js +32 -9
  56. package/sources/server/class/distro.js +1 -1
  57. package/sources/server/class.js +8 -0
  58. package/sources/server/folder.js +9 -2
  59. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/$virtual/class.js +0 -4
  60. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/class.js +0 -4
  61. package/$server/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +0 -4
  62. package/$server/$folder/$class/$data/$operation/$folder/$class/$data/$operation/class.js +0 -4
  63. package/$server/$folder/$class/$data/$register/$account/$folder/$class/$data/$register/$account/class.js +0 -4
  64. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/$account/class.js +0 -4
  65. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/class.js +0 -4
  66. package/$server/$folder/$class/$data/$struct/$folder/$class/$data/$struct/class.js +0 -4
  67. package/$server/$folder/$class/$domain/$folder/$class/$domain/class.js +0 -4
  68. package/$server/$folder/$class/$module/$folder/$class/$data/$catalog/class.js +0 -4
  69. package/$server/$folder/$class/$module/$folder/$class/$data/$operation/class.js +0 -4
  70. package/$server/$folder/$class/$module/$folder/$class/$data/$register/class.js +0 -4
  71. package/$server/$folder/$class/$module/$folder/$class/$data/$struct/class.js +0 -4
  72. package/$server/$folder/$class/$module/$folder/$class/$domain/class.js +0 -4
  73. package/$server/$folder/$class/$module/$folder/$class/$module/class.js +0 -4
  74. package/$server/$folder/$class/$structure/$folder/$class/$structure/class.js +0 -4
  75. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$catalog/class.js +0 -4
  76. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$operation/class.js +0 -4
  77. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$register/class.js +0 -4
  78. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$struct/class.js +0 -4
  79. package/$server/$folder/$class/$structure/$project/$folder/$class/$domain/class.js +0 -4
  80. package/$server/$folder/$class/$structure/$project/$folder/$class/$structure/$project/class.js +0 -4
  81. package/$server/$folder/$class/$structure/$project/$folder/$class/$structure/class.js +0 -4
  82. package/$server/$folder/$class/$structure/$server/$folder/$class/$domain/class.js +0 -4
  83. package/$server/$folder/$class/$users/$folder/$class/$structure/$user/class.js +0 -4
@@ -2,6 +2,8 @@ export default {
2
2
  label: 'Свойства',
3
3
  icon: 'editor:mode-edit',
4
4
  order: 10,
5
+ allowSave: true,
6
+ hasSettings: true,
5
7
  async allowUse($context) {
6
8
  try {
7
9
  const md = await $context?.METADATA;
@@ -13,7 +15,7 @@ export default {
13
15
  }
14
16
  },
15
17
  component: {
16
- imports: 'oda//icon, oda//button, ~/lib//editor-form',
18
+ imports: 'oda//icon, oda//button, /oda/components/layouts/editor-form/editor-form.js',
17
19
  template: /* html */`
18
20
  <style>
19
21
  :host {
@@ -23,13 +25,13 @@ export default {
23
25
  background: var(--content-background);
24
26
  color: var(--content-color);
25
27
  }
26
- .req-bar {
28
+ .req-head {
27
29
  @apply --horizontal;
28
30
  align-items: center;
29
31
  justify-content: space-between;
30
32
  flex-wrap: wrap;
31
- gap: 10px;
32
- padding: 10px 16px;
33
+ gap: 8px;
34
+ padding: 8px 14px;
33
35
  border-bottom: 1px solid var(--subtle-border, var(--border-color));
34
36
  background: var(--content-background);
35
37
  flex-shrink: 0;
@@ -38,25 +40,58 @@ export default {
38
40
  font-size: 12.5px;
39
41
  color: var(--muted-color);
40
42
  }
41
- @media (max-width: 768px) {
42
- .req-bar {
43
- padding: 8px 12px;
44
- }
43
+ .design-btn {
44
+ display: inline-flex;
45
+ align-items: center;
46
+ gap: 5px;
47
+ padding: 4px 10px;
48
+ border: 1px solid var(--border-color);
49
+ border-radius: 6px;
50
+ background: var(--content-background);
51
+ color: var(--content-color);
52
+ font-size: 12px;
53
+ font-weight: 600;
54
+ cursor: pointer;
55
+ }
56
+ .design-btn.active {
57
+ background: var(--accent-soft);
58
+ border-color: var(--accent-color);
59
+ color: var(--accent-color);
60
+ }
61
+ .req-scroll {
62
+ @apply --flex;
63
+ overflow: auto;
64
+ min-height: 0;
65
+ }
66
+ oda-editor-form {
67
+ max-width: 980px;
45
68
  }
46
69
  </style>
47
- <div class="req-bar">
70
+ <div class="req-head" ~if="schema">
48
71
  <span style="font-weight:700;font-size:14px;">{{tabTitle}}</span>
49
72
  <div class="horizontal" style="gap:8px;align-items:center;">
50
73
  <span ~if="reqStatus" class="req-status">{{reqStatus}}</span>
51
- <oda-button ~if="dataAccessNode" icon="icons:save" info-invert @tap="saveRequisites()">Сохранить</oda-button>
74
+ <button type="button" class="design-btn" ~class="{ active: designMode }" title="Дизайн расположения и кастомизация полей формы" @tap="toggleDesignMode()">
75
+ <oda-icon icon="icons:settings" icon-size="14"></oda-icon>
76
+ <span>{{designMode ? 'Готово' : 'Поля'}}</span>
77
+ </button>
52
78
  </div>
53
79
  </div>
54
- <item-editor-form ~if="dataAccessNode" flex :data-access-node="dataAccessNode"></item-editor-form>
55
- <div ~if="!dataAccessNode" style="padding:20px;color:var(--muted-color);">Для этого узла статические поля не объявлены.</div>
80
+ <div class="req-scroll" ~if="schema && editing">
81
+ <oda-editor-form hide-title ::design-mode="designMode" :layout-key="layoutKey"
82
+ :metadata="schema" :data="editing"
83
+ @input="onFormInput" @change="onFormInput" @cell-changed="onFormInput"></oda-editor-form>
84
+ </div>
85
+ <div ~if="!schema" style="padding:20px;color:var(--muted-color);">Для этого узла статические поля не объявлены.</div>
56
86
  `,
57
87
  $handler: null,
58
- dataAccessNode: null,
59
- requisitesBody: null,
88
+ $form: null,
89
+ allowSave: true,
90
+ hasSettings: true,
91
+ designMode: false,
92
+ schema: null,
93
+ editing: null,
94
+ _dirty: false,
60
95
  reqStatus: '',
61
96
  $item: {
62
97
  $def: null,
@@ -67,33 +102,69 @@ export default {
67
102
  get tabTitle() {
68
103
  return this.$handler?.DATA?.label || this.$handler?.label || 'Свойства';
69
104
  },
105
+ get layoutKey() {
106
+ const p = this.$item?.short || this.$item?.path || this.$item?.id || '';
107
+ return p ? `class-static:${p}` : '';
108
+ },
109
+ get isChanged() {
110
+ return Boolean(this._dirty);
111
+ },
112
+ isDirty() {
113
+ return Boolean(this._dirty);
114
+ },
115
+ showSettings() {
116
+ this.toggleDesignMode();
117
+ },
118
+ toggleDesignMode() {
119
+ this.designMode = !this.designMode;
120
+ },
121
+ _notifyForm() {
122
+ this.$form?.syncFromView?.(this);
123
+ },
70
124
  async attached() {
71
125
  if (this.$item) await this._syncRequisites(this.$item);
72
126
  },
73
127
  async _syncRequisites(item) {
74
128
  this.reqStatus = '';
75
- this.dataAccessNode = null;
76
- this.requisitesBody = null;
129
+ this.schema = null;
130
+ this.editing = null;
131
+ this._dirty = false;
132
+ this._notifyForm();
77
133
  try {
78
- const md = await item.METADATA;
134
+ const md = await item.metadata;
79
135
  const raw = md?.STATIC?.length ? md.STATIC : md?.FIELDS;
80
136
  const list = Array.isArray(raw) ? raw : Array.isArray(raw?.fields) ? raw.fields : [];
81
137
  if (!list.length) return;
82
- const node = await item.dataAccessRoot;
83
- this.dataAccessNode = node?.children?.find(n => n.field.id === 'STATIC') || node?.children?.find(n => n.field.id === 'FIELDS') || null;
84
- this.requisitesBody = node ? await node.getDataRoot() : null;
138
+ const body = await item.body;
139
+ this.schema = {
140
+ path: item.path || '',
141
+ title: item.label || item.id || '',
142
+ FIELDS: list,
143
+ LAYOUT: md?.STATIC_LAYOUT || md?.LAYOUT || null,
144
+ };
145
+ this.editing = body && typeof body === 'object' ? body : {};
85
146
  } catch {
86
- this.dataAccessNode = null;
147
+ this.schema = null;
148
+ this.editing = null;
87
149
  }
88
150
  },
89
- async saveRequisites() {
90
- if (!this.$item?.save || !this.requisitesBody) return;
151
+ onFormInput() {
152
+ this._dirty = true;
153
+ this.reqStatus = '';
154
+ this._notifyForm();
155
+ },
156
+ async save() {
157
+ if (!this.$item?.save || !this.editing) return;
91
158
  this.reqStatus = 'Сохранение…';
92
159
  try {
93
- await this.$item.save(this.requisitesBody);
160
+ await this.$item.save(this.editing);
161
+ this._dirty = false;
94
162
  this.reqStatus = 'Сохранено';
163
+ this._notifyForm();
95
164
  } catch (e) {
96
165
  this.reqStatus = String(e?.message || e);
166
+ this._notifyForm();
167
+ throw e;
97
168
  }
98
169
  }
99
170
  }
@@ -8,12 +8,30 @@ export default {
8
8
  hideTops: 0,
9
9
  hideRoots: 1,
10
10
  showSize: true,
11
+ cleanStructure: false,
11
12
  itemsSelector: 'entries',
13
+ _resolvedStorageFolder: null,
12
14
  async ready() {
13
- if (this.$item) {
14
- this.$context = this.$item;
15
- this.$item = undefined;
16
- this.$item = await this.$context.storage_folder;
15
+ await this._switchToStorageFolder();
16
+ },
17
+ async attached() {
18
+ await this._switchToStorageFolder();
19
+ },
20
+ $observers: {
21
+ async _itemChanged($item) {
22
+ if ($item && $item !== this._resolvedStorageFolder) {
23
+ await this._switchToStorageFolder();
24
+ }
25
+ }
26
+ },
27
+ async _switchToStorageFolder() {
28
+ const src = this.$item;
29
+ if (!src || src === this._resolvedStorageFolder) return;
30
+ this.$context = src;
31
+ const sf = await src.storage_folder;
32
+ if (sf && this.$item === src) {
33
+ this._resolvedStorageFolder = sf;
34
+ this.$item = sf;
17
35
  }
18
36
  },
19
37
  $public: {
@@ -225,8 +225,9 @@ export default {
225
225
  },
226
226
  $listeners: {
227
227
  resize() {
228
- if (this._lastMobile !== ODA.states.mobileMode) {
229
- this._lastMobile = ODA.states.mobileMode;
228
+ const mode = globalThis.ODA?.states?.mobileMode;
229
+ if (this._lastMobile !== mode) {
230
+ this._lastMobile = mode;
230
231
  this.invalidate('mobile');
231
232
  }
232
233
  },
@@ -280,7 +281,7 @@ export default {
280
281
  this._stopPcPoll();
281
282
  },
282
283
  get mobile() {
283
- return ODA.states.mobileMode;
284
+ return Boolean(globalThis.ODA?.states?.mobileMode);
284
285
  },
285
286
  get showMain() {
286
287
  return !(this.dockOpen && this.mobile);
@@ -170,6 +170,17 @@ ODA({
170
170
  height: 22px;
171
171
  margin: 0 2px;
172
172
  }
173
+ .sub-row {
174
+ display: flex;
175
+ flex-direction: column;
176
+ width: 100%;
177
+ flex-shrink: 0;
178
+ }
179
+ :host([layout="tabs"]) .sub-row {
180
+ width: auto;
181
+ flex-direction: row;
182
+ align-items: center;
183
+ }
173
184
  .sub-btn {
174
185
  @apply --horizontal;
175
186
  align-items: center;
@@ -197,7 +208,8 @@ ODA({
197
208
  .sub-btn:hover {
198
209
  background: color-mix(in srgb, var(--accent-color, #2563eb) 6%, transparent);
199
210
  }
200
- .sub-btn.active {
211
+ .sub-btn.active,
212
+ .sub-btn[data-active="1"] {
201
213
  background: color-mix(in srgb, var(--accent-color, #2563eb) 10%, var(--content-background, #ffffff));
202
214
  color: var(--accent-color, #2563eb);
203
215
  border-color: color-mix(in srgb, var(--accent-color, #2563eb) 55%, transparent);
@@ -230,6 +242,11 @@ ODA({
230
242
  height: 22px;
231
243
  margin: 0 2px;
232
244
  }
245
+ .sub-row {
246
+ width: auto;
247
+ flex-direction: row;
248
+ align-items: center;
249
+ }
233
250
  .sub-btn {
234
251
  width: auto;
235
252
  white-space: nowrap;
@@ -239,10 +256,11 @@ ODA({
239
256
  }
240
257
  </style>
241
258
  <nav ~if="groupedItems.length" class="sub-nav" aria-label="Разделы">
242
- <div ~for="groupedItems" style="display:contents;">
259
+ <div ~for="groupedItems" class="sub-row">
243
260
  <div ~if="$for.item.isSep" class="sub-sep"></div>
244
261
  <button ~if="!$for.item.isSep" type="button" class="sub-btn"
245
- ~class="{ active: activeId === $for.item.id }"
262
+ :data-active="$for.item.active ? '1' : ''"
263
+ ~class="{ active: $for.item.active }"
246
264
  @tap="selectTab($for.item.id)">
247
265
  <oda-icon :icon="$for.item.icon" icon-size="18"></oda-icon>
248
266
  <span>{{$for.item.label}}</span>
@@ -266,15 +284,78 @@ ODA({
266
284
  _mountSeq: 0,
267
285
  _loadSeq: 0,
268
286
  _attachedDone: false,
269
- $handler: null,
287
+ _pendingSubView: '',
288
+ _pendingMountTabId: '',
289
+ _loadingFor: null,
290
+ _loadingHandler: null,
291
+ _loadingPromise: null,
292
+ _loadedFor: null,
293
+ _loadedHandler: null,
294
+ _attemptedMountIds: null,
295
+ $handler: {
296
+ $def: null,
297
+ set(n) {
298
+ if (n && this.$item)
299
+ this._loadTabs(this.$item);
300
+ }
301
+ },
270
302
  $item: {
271
303
  $def: null,
272
304
  set(n) {
273
- if (n)
305
+ if (n && this.$handler)
274
306
  this._loadTabs(n);
275
307
  }
276
308
  },
309
+ get activeTab() {
310
+ return (this.tabs || []).find(t => t.id === this.activeId) || null;
311
+ },
312
+ get activeControl() {
313
+ return this.activeId && this._controls ? (this._controls[this.activeId] || null) : null;
314
+ },
315
+ get allowSave() {
316
+ const c = this.activeControl;
317
+ if (c && typeof c.allowSave === 'boolean')
318
+ return c.allowSave;
319
+ const t = this.activeTab;
320
+ if (t && typeof t.DATA?.allowSave === 'boolean')
321
+ return t.DATA.allowSave;
322
+ return false;
323
+ },
324
+ get isChanged() {
325
+ const c = this.activeControl;
326
+ if (!c)
327
+ return false;
328
+ if (typeof c.isChanged === 'boolean')
329
+ return c.isChanged;
330
+ if (typeof c.isDirty === 'function')
331
+ return Boolean(c.canSave !== false && c.isDirty());
332
+ return false;
333
+ },
334
+ isDirty() {
335
+ return this.isChanged;
336
+ },
337
+ get hasSettings() {
338
+ const c = this.activeControl;
339
+ const t = this.activeTab;
340
+ return Boolean(c?.hasSettings || t?.hasSettings || t?.DATA?.hasSettings);
341
+ },
342
+ showSettings() {
343
+ const c = this.activeControl;
344
+ if (typeof c?.showSettings === 'function')
345
+ return c.showSettings();
346
+ const t = this.activeTab;
347
+ return t?.showSettings?.();
348
+ },
349
+ async save() {
350
+ const c = this.activeControl;
351
+ if (typeof c?.save === 'function') {
352
+ const res = await c.save();
353
+ this.$form?.syncFromView?.(this);
354
+ return res;
355
+ }
356
+ },
277
357
  get groupedItems() {
358
+ const cur = this.activeId;
278
359
  const list = Array.isArray(this.tabs) ? this.tabs : [];
279
360
  const visible = list.filter(t => !(t.hidden || t.DATA?.hidden));
280
361
  // Группируем по group (порядок групп: 'main' первой, затем остальные по порядку появления).
@@ -288,6 +369,7 @@ ODA({
288
369
  groups.get(g).push({
289
370
  isSep: false,
290
371
  id: t.id,
372
+ active: cur === t.id,
291
373
  label: t.DATA?.label || t.label || t.id,
292
374
  icon: t.DATA?.icon || t.icon || '',
293
375
  });
@@ -302,7 +384,7 @@ ODA({
302
384
  const out = [];
303
385
  orderedGroups.forEach((arr, idx) => {
304
386
  if (idx > 0 && out.length)
305
- out.push({ isSep: true, id: `sep-${idx}`, label: '', icon: '' });
387
+ out.push({ isSep: true, id: `sep-${idx}`, active: false, label: '', icon: '' });
306
388
  for (const entry of arr)
307
389
  out.push(entry);
308
390
  });
@@ -310,8 +392,34 @@ ODA({
310
392
  },
311
393
  attached() {
312
394
  this._attachedDone = true;
313
- if (this.$item && (!this.tabs || !this.tabs.length))
395
+ if (this.$item && !this.tabs?.length && !this._loadingPromise) {
314
396
  this._loadTabs(this.$item);
397
+ }
398
+ else if (this.activeId) {
399
+ const body = this.$?.('#subBody');
400
+ if (!body) {
401
+ this._pendingMountTabId = this.activeId;
402
+ this.render?.(true);
403
+ }
404
+ else if (!body.children?.length && !this._controls?.[this.activeId] && !this._attemptedMountIds?.has(this.activeId)) {
405
+ const tab = (this.tabs || []).find(t => t.id === this.activeId);
406
+ if (tab)
407
+ this._mountTab(tab, this._pendingSubView || '');
408
+ }
409
+ }
410
+ },
411
+ onRender() {
412
+ const body = this.$?.('#subBody');
413
+ if (!body)
414
+ return;
415
+ const targetId = this._pendingMountTabId
416
+ || (!body.children?.length && this.activeId && !this._controls?.[this.activeId] ? this.activeId : '');
417
+ if (targetId && !this._attemptedMountIds?.has(targetId)) {
418
+ this._pendingMountTabId = '';
419
+ const tab = (this.tabs || []).find(t => t.id === targetId);
420
+ if (tab)
421
+ this._mountTab(tab, this._pendingSubView || '');
422
+ }
315
423
  },
316
424
  _handlerRelativePath() {
317
425
  const raw = String(this.$handler?.path || this.$handler?.short || '');
@@ -322,7 +430,27 @@ ODA({
322
430
  }
323
431
  return this.$handler?.id ? `/pages/form/${this.$handler.id}` : '/pages/form';
324
432
  },
325
- async _loadTabs(item) {
433
+ _loadTabs(item) {
434
+ const handler = this.$handler || null;
435
+ if (item && this._loadingPromise && this._loadingFor === item && this._loadingHandler === handler)
436
+ return this._loadingPromise;
437
+ if (item && this._loadedFor === item && this._loadedHandler === handler && this.tabs?.length)
438
+ return Promise.resolve();
439
+ this._loadingFor = item || null;
440
+ this._loadingHandler = handler;
441
+ const p = this._doLoadTabs(item).then(() => {
442
+ if (this._loadingFor === item && this._loadingHandler === handler) {
443
+ this._loadedFor = item || null;
444
+ this._loadedHandler = handler;
445
+ }
446
+ }).finally(() => {
447
+ if (this._loadingPromise === p)
448
+ this._loadingPromise = null;
449
+ });
450
+ this._loadingPromise = p;
451
+ return p;
452
+ },
453
+ async _doLoadTabs(item) {
326
454
  const seq = ++this._loadSeq;
327
455
  if (!item) {
328
456
  this.tabs = [];
@@ -349,6 +477,8 @@ ODA({
349
477
  t.$context = item;
350
478
  this.tabs = list;
351
479
  this._controls = {};
480
+ this._attemptedMountIds = new Set();
481
+ this._pendingMountTabId = '';
352
482
  const body = this.$?.('#subBody');
353
483
  if (body)
354
484
  body.innerHTML = '';
@@ -370,14 +500,26 @@ ODA({
370
500
  if (!tab)
371
501
  return;
372
502
  this.activeId = id;
503
+ this.render?.(true);
373
504
  await this._mountTab(tab, nestedSubView);
505
+ this.$form?.syncFromView?.(this);
374
506
  },
375
507
  async _mountTab(tab, nestedSubView = '') {
508
+ if (!tab)
509
+ return;
376
510
  const seq = ++this._mountSeq;
377
511
  const body = this.$?.('#subBody');
378
- if (!body)
512
+ if (!body) {
513
+ this._pendingMountTabId = tab.id;
514
+ this._pendingSubView = nestedSubView || '';
515
+ this.render?.(true);
379
516
  return;
517
+ }
518
+ this._pendingMountTabId = '';
519
+ this._pendingSubView = '';
380
520
  this._controls ||= {};
521
+ this._attemptedMountIds ||= new Set();
522
+ this._attemptedMountIds.add(tab.id);
381
523
  let el = this._controls[tab.id];
382
524
  if (!el) {
383
525
  const mod = await tab.importView();
@@ -392,9 +534,9 @@ ODA({
392
534
  }
393
535
  else if (this.depth < 6 && (tab.layout || tab.DATA?.layout || (Array.isArray(tab.DATA?.items) && tab.DATA.items.length))) {
394
536
  el = ODA.createComponent('work-subview-container', {
537
+ $handler: tab,
395
538
  $item: this.$item,
396
539
  $context: this.$item,
397
- $handler: tab,
398
540
  layout: tab.layout || tab.DATA?.layout || 'sidebar',
399
541
  role: this.role,
400
542
  subViewPath: nestedSubView,
@@ -413,8 +555,12 @@ ODA({
413
555
  ch.hidden = ch !== el;
414
556
  ch.style.display = ch === el ? '' : 'none';
415
557
  }
558
+ if (el[R]?.states)
559
+ el[R].states.sleep = false;
560
+ el.render?.(true);
416
561
  if (nestedSubView && typeof el.applyNav === 'function')
417
562
  await el.applyNav({ subView: nestedSubView });
563
+ this.$form?.syncFromView?.(this);
418
564
  },
419
565
  async applyNav(nav) {
420
566
  if (!nav || typeof nav !== 'object')
@@ -638,7 +784,7 @@ ODA({is: 'work-form',
638
784
  @tap.stop="switchView($for.item, $event)"
639
785
  @pointerdown.stop="view?.id === $for.item.id && openView($event)"
640
786
  >
641
- <oda-button ~if="view?.id === $for.item.id && (view?.hasSettings || view?.DATA?.hasSettings || view_control?.hasSettings)" icon="icons:settings" @pointerdown.stop.prevent="(view_control?.showSettings ? view_control.showSettings() : view?.showSettings?.())" style="padding: 0;"></oda-button>
787
+ <oda-button ~if="view?.id === $for.item.id && activeHasSettings" icon="icons:settings" @pointerdown.stop.prevent="(view_control?.showSettings ? view_control.showSettings() : view?.showSettings?.())" style="padding: 0;"></oda-button>
642
788
  </item-node>
643
789
  </div>
644
790
  </div>
@@ -1723,6 +1869,10 @@ ODA({is: 'work-form',
1723
1869
  hasSlottedToolbar: false,
1724
1870
  focusedStateVersion: 0,
1725
1871
  fallbackFocusedItem: null,
1872
+ get activeHasSettings() {
1873
+ void this.focusedStateVersion;
1874
+ return Boolean(this.view?.hasSettings || this.view?.DATA?.hasSettings || this.view_control?.hasSettings);
1875
+ },
1726
1876
  get isObjectViewActive() {
1727
1877
  return Boolean(this.view?.id === 'object' || this.view_control?.isObjectView);
1728
1878
  },
@@ -1782,7 +1932,9 @@ ODA({is: 'work-form',
1782
1932
  }
1783
1933
  },
1784
1934
  syncFromView(vc = this.view_control) {
1785
- if (!vc || (this.view_control && vc !== this.view_control))
1935
+ if (!vc)
1936
+ return;
1937
+ if (this.view_control && vc !== this.view_control && vc !== this.view_control?.activeControl)
1786
1938
  return;
1787
1939
  this.fallbackFocusedItem = vc.fallbackFocusedItem || null;
1788
1940
  this.focusedItem = vc.$focusedItem !== undefined ? vc.$focusedItem : (vc.focusedItem || null);
@@ -1915,6 +2067,8 @@ ODA({is: 'work-form',
1915
2067
  }
1916
2068
  finally {
1917
2069
  this.saving = false;
2070
+ this.syncFromView?.();
2071
+ this._wakeBars?.();
1918
2072
  }
1919
2073
  }, 100)
1920
2074
  },
@@ -2265,10 +2419,10 @@ ODA({is: 'work-form',
2265
2419
  }
2266
2420
  else if (n.layout || n.DATA?.layout || (Array.isArray(n.DATA?.items) && n.DATA.items.length)) {
2267
2421
  el = ODA.createComponent('work-subview-container', {
2422
+ $handler: n,
2268
2423
  $item: tabItem,
2269
2424
  $context: tabItem,
2270
2425
  slot: 'main',
2271
- $handler: n,
2272
2426
  layout: n.layout || n.DATA?.layout || 'sidebar',
2273
2427
  role: this.activeRole,
2274
2428
  subViewPath: nav?.subView || '',
@@ -3,7 +3,7 @@ export default {
3
3
  imports: 'oda//app-layout.js, oda//tabs.js, oda//icon, oda//button, ~/lib//tree.js, ~/lib//node-explorer.js, ~/lib//consultant.js, ~/lib//class-picker.js, ~/lib//support.js',
4
4
  extends: 'oda-app-layout',
5
5
  template: /*html*/`
6
- <item-tree order="0" slot='left-panel' allow-search clean-structure :items-selector :show-size show-status show-users allow-focus :hide-roots :hide-tops :$item style="height: 0"></item-tree>
6
+ <item-tree order="0" slot='left-panel' allow-search :clean-structure="cleanStructure" :items-selector :show-size show-status show-users allow-focus :hide-roots :hide-tops :$item style="height: 0"></item-tree>
7
7
  <item-consultant order="3" slot='left-panel' id="consultant" label="ИИ" icon="bootstrap:robot" :$item hidden style="height: 0"></item-consultant>
8
8
  <div flex vertical slot='main' style="overflow: hidden; position: relative;">
9
9
  <call-form ~if="showCall" id="callForm"></call-form>
@@ -26,6 +26,7 @@ export default {
26
26
  </oda-tabs>
27
27
  `,
28
28
  visibleMode: 'main',
29
+ cleanStructure: true,
29
30
  showSize: false,
30
31
  pages: [],
31
32
  bookmarks: [],
@@ -56,7 +56,7 @@ export default {
56
56
  if (!it || this.isUser || isLinkNode(it) || ('isPlace' in Object(it) && it.isPlace))
57
57
  return null;
58
58
  const t = it.type;
59
- if (t !== '$project' && t !== '$project' && t !== '$structure' && t !== '$server')
59
+ if (t !== '$project' && t !== '$structure' && t !== '$server')
60
60
  return null;
61
61
  it.__version;
62
62
  const bossIds = it.DATA?.roleIds?.BOSS;
@@ -163,7 +163,7 @@ export default {
163
163
  $type: Boolean,
164
164
  get() {
165
165
  const it = this.$item;
166
- if (!it || it.id === 'MODELS' || (it.type !== '$ai' && it.type !== '$provider'))
166
+ if (!it || (it.type !== '$ai' && it.type !== '$provider'))
167
167
  return false;
168
168
  return (it.aiActive ?? it.DATA?.aiActive) === false;
169
169
  }
@@ -433,17 +433,9 @@ export default {
433
433
  const isNetServer = t === '$node' && this.$item?.id !== 'NODES';
434
434
  if(this.isUser || t === '$user' || t === '$project' || t === '$structure' || t === '$server' || isNetServer)
435
435
  return 48;
436
- if(this.isStructureLike)
437
- return 28;
438
- if(!this.showStatus)
439
- return 24;
440
- if(this.$item){
441
- if(this.$item instanceof CORE.$handler)
442
- return 26;
443
- if(this.$item instanceof CORE.$class)
444
- return 24;
445
- return 24;
446
- }
436
+ if(t === '$module' || t === '$provider' || t === '$mcp')
437
+ return 32;
438
+ return 24;
447
439
  },
448
440
  showStatus: false,
449
441
  isExplorer: false,
@@ -535,7 +535,7 @@ ODA({ is: 'work-prompt-bar',
535
535
  get modelName() {
536
536
  return String(this.model || '').split('/').pop() || 'Модель';
537
537
  },
538
- /** Иконка выбранной модели — её собственная (наследуется от провайдера), как в дереве /MODELS. */
538
+ /** Иконка выбранной модели — её собственная (наследуется от провайдера), как в дереве /MODULES/Модели. */
539
539
  get modelIcon() {
540
540
  const fallback = 'carbon:machine-learning-model';
541
541
  if (!this.model)
@@ -547,7 +547,9 @@ ODA({ is: 'work-prompt-bar',
547
547
  /** Подсказка: провайдер и модель (одинаковые имена у разных провайдеров различимы). */
548
548
  get modelTitle() {
549
549
  const parts = String(this.model || '').split('/').filter(Boolean);
550
- return parts.length >= 3 ? 'Модель: ' + parts.slice(1).join(' / ') : 'Выбрать модель';
550
+ const modIdx = parts.indexOf('Модели');
551
+ const short = modIdx >= 0 ? parts.slice(modIdx + 1) : (parts[0]?.toUpperCase() === 'MODELS' ? parts.slice(1) : parts);
552
+ return short.length >= 2 ? 'Модель: ' + short.join(' / ') : 'Выбрать модель';
551
553
  },
552
554
  get modeMeta() {
553
555
  return (this.modes || []).find(m => m.id === this.mode) || this.modes?.[0];