odant-work 1.0.86 → 1.0.88
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/#system/package-manifest.json +54 -60
- package/$server/$folder/$class/$module/class.js +2 -0
- package/$server/$folder/$class/$structure/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +123 -1
- package/$server/$folder/$class/handlers/pages/form/system/$handler/class.js +9 -0
- package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/system.js +82 -14
- package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-root.js +167 -0
- package/{SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler → $server/$folder/$class/handlers/pages/form/system/$handler/tabs}/mcp.js +2 -2
- package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/tabs/modules.js +51 -4
- package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/tabs/staff.js +13 -8
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +25 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +17 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/panel.js +7 -1
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/util.js +1 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-policy.js +6 -2
- package/$server/$folder/handlers/pages/form/$handler/form.js +21 -6
- package/$server/$folder/lib/chat-item/chat-item.js +4 -1
- package/$server/$folder/lib/tree/tree.js +77 -10
- package/MODELS/$ai/$folder/$class/$ai/class.js +2 -1
- package/MODELS/$ai/$folder/$class/$provider/class.js +2 -1
- package/MODELS/$ai/class.js +1 -1
- package/MODELS/GigaChat/$provider/class.js +1 -1
- package/MODELS/Local/$provider/class.js +2 -1
- package/MODELS/MTS-AI/$provider/class.js +1 -1
- package/MODELS/T-Bank/$provider/class.js +1 -1
- package/MODELS/Yandex/$provider/class.js +1 -1
- package/MODULES/$domain/$folder/$class/$module/class.js +2 -0
- package/ORGANIZATIONS/$domain/$folder/$class/$base/class.js +1 -0
- package/PROJECTS/$domain/$folder/$class/$project/class.js +1 -0
- package/SERVICES/$service/class.js +2 -1
- package/package.json +1 -1
- package/sources/client/folder.js +1 -1
- package/sources/client.js +12 -0
- package/sources/host/auto-updater.js +1 -1
- package/sources/modules/agent/index.js +5 -2
- package/sources/modules/agent/loop.js +65 -0
- package/sources/modules/agent/node-rules.js +9 -4
- package/sources/modules/agent/scope.js +387 -0
- package/sources/modules/agent/session.js +350 -15
- package/sources/modules/agent/tools/meta.js +60 -0
- package/sources/modules/trainer/providers.js +1 -1
- package/sources/server/chat-threads.js +12 -1
- package/sources/server/class.js +3 -0
- package/sources/server/folder.js +72 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/class.js +0 -10
- package/$server/$folder/$class/handlers/pages/form/editor/$handler/class.js +0 -24
- package/$server/$folder/$class/handlers/pages/form/editor/$handler/editor.js +0 -20
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +0 -10
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/folder.js +0 -16
- package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/class.js +0 -13
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/class.js +0 -13
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/class.js +0 -13
- package/SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/class.js +0 -12
- /package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/tabs/agent.js +0 -0
- /package/{MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js → $server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-local.js} +0 -0
- /package/{MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js → $server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-model.js} +0 -0
- /package/{MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/provider.js → $server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-provider.js} +0 -0
- /package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/tabs/database.js +0 -0
- /package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/tabs/license.js +0 -0
- /package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/tabs/messengers.js +0 -0
package/$server/$folder/$class/{$structure/handlers → handlers}/pages/form/system/$handler/system.js
RENAMED
|
@@ -4,6 +4,11 @@ import messengersProto from './tabs/messengers.js';
|
|
|
4
4
|
import databaseProto from './tabs/database.js';
|
|
5
5
|
import licenseProto from './tabs/license.js';
|
|
6
6
|
import agentProto from './tabs/agent.js';
|
|
7
|
+
import aiRootProto from './tabs/ai-root.js';
|
|
8
|
+
import aiProviderProto from './tabs/ai-provider.js';
|
|
9
|
+
import aiLocalProto from './tabs/ai-local.js';
|
|
10
|
+
import aiModelProto from './tabs/ai-model.js';
|
|
11
|
+
import './tabs/mcp.js';
|
|
7
12
|
|
|
8
13
|
function cloneProto(raw) {
|
|
9
14
|
const proto = Object.defineProperties(
|
|
@@ -31,6 +36,10 @@ regTab('system-tab-messengers', messengersProto);
|
|
|
31
36
|
regTab('system-tab-database', databaseProto);
|
|
32
37
|
regTab('system-tab-license', licenseProto);
|
|
33
38
|
regTab('system-tab-agent', agentProto);
|
|
39
|
+
regTab('system-tab-ai-root', aiRootProto);
|
|
40
|
+
regTab('system-tab-ai-provider', aiProviderProto);
|
|
41
|
+
regTab('system-tab-ai-local', aiLocalProto);
|
|
42
|
+
regTab('system-tab-ai-model', aiModelProto);
|
|
34
43
|
|
|
35
44
|
export default {
|
|
36
45
|
imports: 'oda//icon, oda//button, ~/lib//editor-form, ~/lib//tree.js',
|
|
@@ -181,6 +190,11 @@ export default {
|
|
|
181
190
|
</div>
|
|
182
191
|
|
|
183
192
|
<user-profile ~if="currentTabId === 'profile'" flex></user-profile>
|
|
193
|
+
<system-tab-ai-root ~if="currentTabId === 'ai' && aiMode === 'root'" flex :$item="$item"></system-tab-ai-root>
|
|
194
|
+
<system-tab-ai-local ~if="currentTabId === 'ai' && aiMode === 'local'" flex :$item="$item"></system-tab-ai-local>
|
|
195
|
+
<system-tab-ai-provider ~if="currentTabId === 'ai' && aiMode === 'provider'" flex :$item="$item"></system-tab-ai-provider>
|
|
196
|
+
<system-tab-ai-model ~if="currentTabId === 'ai' && aiMode === 'model'" flex :$item="$item"></system-tab-ai-model>
|
|
197
|
+
<work-mcp-manager ~if="currentTabId === 'mcp'" flex :$item="$item"></work-mcp-manager>
|
|
184
198
|
<system-tab-staff ~if="currentTabId === 'staff'" flex :$item="$item" :focused-trail="pendingPlace"></system-tab-staff>
|
|
185
199
|
<system-tab-modules ~if="currentTabId === 'modules'" flex :$item="$item"></system-tab-modules>
|
|
186
200
|
<item-tree ~if="currentTabId === 'files'" flex :$item="storageFolder" show-size hide-system items-selector="entries" hide-tops="1" hide-roots="1"></item-tree>
|
|
@@ -228,30 +242,83 @@ export default {
|
|
|
228
242
|
get storageFolder() {
|
|
229
243
|
return this.$item?.storage_folder;
|
|
230
244
|
},
|
|
245
|
+
get _itemNormPath() {
|
|
246
|
+
return String(this.$item?.path || this.$item?.short || '').replace(/\/+$/, '') || '/';
|
|
247
|
+
},
|
|
248
|
+
get aiMode() {
|
|
249
|
+
const t = this.$item?.type;
|
|
250
|
+
const p = this._itemNormPath;
|
|
251
|
+
if (t === '$ai')
|
|
252
|
+
return p === '/MODELS' ? 'root' : 'model';
|
|
253
|
+
if (t === '$provider') {
|
|
254
|
+
const proto = String(this.$item?.protocol || this.$item?.DATA?.protocol || '').toLowerCase();
|
|
255
|
+
if (p === '/MODELS/Local' || p.startsWith('/MODELS/Local/') || p === '/MODELS/Halogen' || p.startsWith('/MODELS/Halogen/') || proto === 'local' || proto === 'halogen')
|
|
256
|
+
return 'local';
|
|
257
|
+
return 'provider';
|
|
258
|
+
}
|
|
259
|
+
return '';
|
|
260
|
+
},
|
|
261
|
+
get isOrgGroup() {
|
|
262
|
+
const t = this.$item?.type;
|
|
263
|
+
return t === '$server' || t === '$base' || t === '$project' || t === '$structure' || t === '$user';
|
|
264
|
+
},
|
|
265
|
+
get isServiceNode() {
|
|
266
|
+
const t = this.$item?.type;
|
|
267
|
+
const p = this._itemNormPath;
|
|
268
|
+
return t === '$service' || p === '/SERVICES' || p.startsWith('/SERVICES/');
|
|
269
|
+
},
|
|
231
270
|
get mainTabs() {
|
|
232
271
|
const t = this.$item?.type;
|
|
233
272
|
const tabs = [];
|
|
273
|
+
if (this.aiMode) {
|
|
274
|
+
tabs.push({ id: 'ai', label: 'Модели ИИ', icon: 'carbon:chip' });
|
|
275
|
+
if (this.hasStaticFields)
|
|
276
|
+
tabs.push({ id: 'requisites', label: 'Реквизиты', icon: 'editor:mode-edit' });
|
|
277
|
+
tabs.push({ id: 'files', label: 'Файлы', icon: 'fontawesome:r-folder-open' });
|
|
278
|
+
return tabs;
|
|
279
|
+
}
|
|
280
|
+
if (this.isServiceNode) {
|
|
281
|
+
tabs.push({ id: 'mcp', label: 'Сервисы и MCP', icon: 'carbon:plug' });
|
|
282
|
+
if (this.hasStaticFields)
|
|
283
|
+
tabs.push({ id: 'requisites', label: 'Реквизиты', icon: 'editor:mode-edit' });
|
|
284
|
+
tabs.push({ id: 'files', label: 'Файлы', icon: 'fontawesome:r-folder-open' });
|
|
285
|
+
return tabs;
|
|
286
|
+
}
|
|
287
|
+
if (t === '$module') {
|
|
288
|
+
tabs.push({ id: 'modules', label: 'Классы', icon: 'odant:module' });
|
|
289
|
+
if (this.hasStaticFields)
|
|
290
|
+
tabs.push({ id: 'requisites', label: 'Реквизиты', icon: 'editor:mode-edit' });
|
|
291
|
+
tabs.push({ id: 'files', label: 'Файлы', icon: 'fontawesome:r-folder-open' });
|
|
292
|
+
return tabs;
|
|
293
|
+
}
|
|
234
294
|
if (this.hasStaticFields)
|
|
235
295
|
tabs.push({ id: 'requisites', label: 'Реквизиты', icon: 'editor:mode-edit' });
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
296
|
+
if (this.isOrgGroup) {
|
|
297
|
+
if (t === '$user')
|
|
298
|
+
tabs.push({ id: 'profile', label: 'Профиль и токены', icon: 'icons:account-circle' });
|
|
299
|
+
tabs.push({ id: 'staff', label: 'Пользователи', icon: 'icons:supervisor-account' });
|
|
300
|
+
if (t === '$base' || t === '$project')
|
|
301
|
+
tabs.push({ id: 'modules', label: 'Классы и модули', icon: 'odant:module' });
|
|
302
|
+
}
|
|
241
303
|
tabs.push({ id: 'files', label: 'Файлы', icon: 'fontawesome:r-folder-open' });
|
|
242
304
|
return tabs;
|
|
243
305
|
},
|
|
244
306
|
get infraTabs() {
|
|
245
307
|
const t = this.$item?.type;
|
|
246
308
|
const tabs = [];
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
|
|
309
|
+
if (this.isOrgGroup) {
|
|
310
|
+
if (t !== '$user')
|
|
311
|
+
tabs.push({ id: 'messengers', label: 'Мессенджеры', icon: 'communication:phonelink-ring' });
|
|
312
|
+
if (t !== '$user')
|
|
313
|
+
tabs.push({ id: 'agent', label: 'Агент и правила', icon: 'bootstrap:robot' });
|
|
314
|
+
if (t === '$server' || t === '$base' || t === '$project')
|
|
315
|
+
tabs.push({ id: 'database', label: 'База данных', icon: 'carbon:data-base' });
|
|
316
|
+
if (t === '$server')
|
|
317
|
+
tabs.push({ id: 'license', label: 'Лицензия', icon: 'carbon:certificate' });
|
|
318
|
+
return tabs;
|
|
319
|
+
}
|
|
320
|
+
if (t && t !== '$module' && t !== '$user')
|
|
250
321
|
tabs.push({ id: 'agent', label: 'Агент и правила', icon: 'bootstrap:robot' });
|
|
251
|
-
if (t === '$server' || t === '$base' || t === '$project')
|
|
252
|
-
tabs.push({ id: 'database', label: 'База данных', icon: 'carbon:data-base' });
|
|
253
|
-
if (t === '$server')
|
|
254
|
-
tabs.push({ id: 'license', label: 'Лицензия', icon: 'carbon:certificate' });
|
|
255
322
|
return tabs;
|
|
256
323
|
},
|
|
257
324
|
get availableTabs() {
|
|
@@ -261,7 +328,7 @@ export default {
|
|
|
261
328
|
const tabs = this.availableTabs;
|
|
262
329
|
if (tabs.some(t => t.id === this.activeTab))
|
|
263
330
|
return this.activeTab;
|
|
264
|
-
return tabs[0]?.id || '
|
|
331
|
+
return tabs[0]?.id || 'files';
|
|
265
332
|
},
|
|
266
333
|
selectTab(id) {
|
|
267
334
|
this.activeTab = id;
|
|
@@ -276,7 +343,8 @@ export default {
|
|
|
276
343
|
window.execute(this.$item, { view: 'search', ...(nav.q ? { q: nav.q } : {}) });
|
|
277
344
|
return;
|
|
278
345
|
}
|
|
279
|
-
const
|
|
346
|
+
const tabMap = { folder: 'files', editor: 'requisites', provider: 'ai', trainer: 'ai', mcp: 'mcp' };
|
|
347
|
+
const tabId = tabMap[nav.tab] || String(nav.tab);
|
|
280
348
|
this.selectTab(tabId);
|
|
281
349
|
}
|
|
282
350
|
},
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
imports: 'oda//icon, oda//button',
|
|
3
|
+
template: /*html*/`
|
|
4
|
+
<style>
|
|
5
|
+
:host {
|
|
6
|
+
@apply --vertical;
|
|
7
|
+
@apply --flex;
|
|
8
|
+
overflow-y: auto;
|
|
9
|
+
background: var(--content-background, #ffffff);
|
|
10
|
+
color: var(--content-color, #1e293b);
|
|
11
|
+
font-size: 13px;
|
|
12
|
+
padding: 16px 20px;
|
|
13
|
+
gap: 14px;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
.head {
|
|
17
|
+
@apply --horizontal;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
gap: 10px;
|
|
22
|
+
padding: 12px 16px;
|
|
23
|
+
border-radius: 10px;
|
|
24
|
+
border: 1px solid var(--subtle-border, var(--border-color));
|
|
25
|
+
background: var(--subtle-background, #f8fafc);
|
|
26
|
+
}
|
|
27
|
+
.title {
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
font-weight: 700;
|
|
30
|
+
}
|
|
31
|
+
.sub {
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
color: var(--muted-color);
|
|
34
|
+
margin-top: 2px;
|
|
35
|
+
}
|
|
36
|
+
.grid {
|
|
37
|
+
display: grid;
|
|
38
|
+
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
39
|
+
gap: 12px;
|
|
40
|
+
}
|
|
41
|
+
.card {
|
|
42
|
+
@apply --vertical;
|
|
43
|
+
gap: 8px;
|
|
44
|
+
padding: 12px 14px;
|
|
45
|
+
border-radius: 10px;
|
|
46
|
+
border: 1px solid var(--subtle-border, var(--border-color));
|
|
47
|
+
background: var(--content-background, #ffffff);
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
transition: border-color .12s ease, box-shadow .12s ease;
|
|
50
|
+
}
|
|
51
|
+
.card:hover {
|
|
52
|
+
border-color: var(--accent-color, #2563eb);
|
|
53
|
+
box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
|
|
54
|
+
}
|
|
55
|
+
.card-top {
|
|
56
|
+
@apply --horizontal;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: 10px;
|
|
59
|
+
}
|
|
60
|
+
.card-name {
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
font-size: 14px;
|
|
63
|
+
flex: 1;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
.badge {
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: 5px;
|
|
73
|
+
font-size: 11.5px;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
padding: 2px 8px;
|
|
76
|
+
border-radius: 999px;
|
|
77
|
+
background: var(--subtle-background);
|
|
78
|
+
color: var(--muted-color);
|
|
79
|
+
white-space: nowrap;
|
|
80
|
+
}
|
|
81
|
+
.badge.on {
|
|
82
|
+
background: light-dark(#dcfce7, #14532d);
|
|
83
|
+
color: light-dark(#166534, #bbf7d0);
|
|
84
|
+
}
|
|
85
|
+
.dot {
|
|
86
|
+
width: 7px;
|
|
87
|
+
height: 7px;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
background: #94a3b8;
|
|
90
|
+
}
|
|
91
|
+
.badge.on .dot {
|
|
92
|
+
background: #22c55e;
|
|
93
|
+
}
|
|
94
|
+
.reason {
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
color: var(--muted-color);
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
99
|
+
|
|
100
|
+
<div class="head">
|
|
101
|
+
<div>
|
|
102
|
+
<div class="title">Провайдеры и модели ИИ</div>
|
|
103
|
+
<div class="sub">Выберите провайдера для настройки API-ключей, локальных весов и дообучения.</div>
|
|
104
|
+
</div>
|
|
105
|
+
<oda-button icon="icons:refresh" @tap="reload()">Обновить</oda-button>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div ~if="error" style="color:var(--error-color, #dc2626);font-size:12.5px;">{{error}}</div>
|
|
109
|
+
|
|
110
|
+
<div class="grid">
|
|
111
|
+
<div class="card" ~for="providers" @tap="openProvider($for.item)">
|
|
112
|
+
<div class="card-top">
|
|
113
|
+
<oda-icon :icon="$for.item.icon" icon-size="24"></oda-icon>
|
|
114
|
+
<span class="card-name">{{$for.item.label}}</span>
|
|
115
|
+
<span class="badge" ~class="{ on: $for.item.active }">
|
|
116
|
+
<span class="dot"></span>
|
|
117
|
+
<span>{{$for.item.active ? 'Активен' : 'Не настроен'}}</span>
|
|
118
|
+
</span>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="reason">{{$for.item.reason}}</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
`,
|
|
124
|
+
$item: {
|
|
125
|
+
$def: null,
|
|
126
|
+
set(n) {
|
|
127
|
+
if (n)
|
|
128
|
+
this.reload();
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
providers: [],
|
|
132
|
+
error: '',
|
|
133
|
+
async attached() {
|
|
134
|
+
await this.reload();
|
|
135
|
+
},
|
|
136
|
+
async reload() {
|
|
137
|
+
this.error = '';
|
|
138
|
+
if (!this.$item)
|
|
139
|
+
return;
|
|
140
|
+
try {
|
|
141
|
+
const raw = await Promise.resolve(this.$item.items).catch(() => []) || [];
|
|
142
|
+
const list = [];
|
|
143
|
+
for (const it of raw) {
|
|
144
|
+
if (!it || it.id?.[0] === '$')
|
|
145
|
+
continue;
|
|
146
|
+
const active = Boolean(it.DATA?.aiActive ?? it.aiActive);
|
|
147
|
+
const reason = String(it.DATA?.aiStatusReason || it.aiStatusReason || it.DATA?.protocol || it.path || '');
|
|
148
|
+
list.push({
|
|
149
|
+
id: it.id,
|
|
150
|
+
label: it.DATA?.label || it.label || it.id,
|
|
151
|
+
icon: it.DATA?.icon || (typeof it.icon === 'string' ? it.icon : '') || 'carbon:api',
|
|
152
|
+
active,
|
|
153
|
+
reason,
|
|
154
|
+
item: it,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
this.providers = list;
|
|
158
|
+
}
|
|
159
|
+
catch (e) {
|
|
160
|
+
this.error = String(e?.message || e);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
openProvider(entry) {
|
|
164
|
+
if (entry?.item && typeof window?.execute === 'function')
|
|
165
|
+
window.execute(entry.item);
|
|
166
|
+
},
|
|
167
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
ODA({
|
|
2
2
|
is: 'work-mcp-manager',
|
|
3
|
-
imports: '
|
|
3
|
+
imports: 'oda//icon, oda//button, oda//tabs',
|
|
4
4
|
template: /*html*/`
|
|
5
5
|
<style>
|
|
6
6
|
:host {
|
|
@@ -610,7 +610,7 @@ ODA({
|
|
|
610
610
|
try {
|
|
611
611
|
const item = await WORK.get_item(srv.path);
|
|
612
612
|
if (item && typeof window?.execute === 'function')
|
|
613
|
-
window.execute(item, { view: '
|
|
613
|
+
window.execute(item, { view: 'system', tab: 'requisites' });
|
|
614
614
|
}
|
|
615
615
|
catch (e) {
|
|
616
616
|
this.showNotice(e?.message || String(e), true);
|
|
@@ -76,17 +76,19 @@ export default {
|
|
|
76
76
|
</style>
|
|
77
77
|
|
|
78
78
|
<div class="bar">
|
|
79
|
-
<span class="title"
|
|
80
|
-
<oda-button icon="icons:
|
|
79
|
+
<span class="title">{{barTitle}}</span>
|
|
80
|
+
<oda-button ~if="isModuleItem" :icon="isModuleEnabled ? 'icons:check-box' : 'icons:check-box-outline-blank'" @tap="toggleModuleEnabled()">{{isModuleEnabled ? 'Модуль активен' : 'Модуль заблокирован'}}</oda-button>
|
|
81
|
+
<oda-button ~if="!isModuleItem" icon="icons:add" @tap="openInstallModule($event)">Подключить модуль</oda-button>
|
|
81
82
|
<oda-button icon="icons:create-new-folder" @tap="openCreateClass($event)">Создать класс</oda-button>
|
|
83
|
+
<oda-button icon="icons:open-in-new" @tap="openFocusedClass()">Открыть</oda-button>
|
|
82
84
|
<oda-button icon="icons:refresh" @tap="reload()">Обновить</oda-button>
|
|
83
85
|
</div>
|
|
84
86
|
|
|
85
87
|
<div ~if="error" style="padding:8px 16px;color:var(--error-color, #dc2626);font-size:12.5px;">{{error}}</div>
|
|
86
88
|
|
|
87
89
|
<div class="tree-wrap">
|
|
88
|
-
<item-tree ~if="modulesRoot" id="modTree" flex :$item="modulesRoot" hide-roots="1" hide-tops="1" show-status allow-focus></item-tree>
|
|
89
|
-
<div ~if="!modulesRoot && !loading" class="muted"
|
|
90
|
+
<item-tree ~if="modulesRoot" id="modTree" flex :$item="modulesRoot" hide-roots="1" hide-tops="1" show-status allow-focus :execute="openTreeClass"></item-tree>
|
|
91
|
+
<div ~if="!modulesRoot && !loading" class="muted">{{emptyText}}</div>
|
|
90
92
|
</div>
|
|
91
93
|
`,
|
|
92
94
|
$item: {
|
|
@@ -101,16 +103,61 @@ export default {
|
|
|
101
103
|
modRootPath: '',
|
|
102
104
|
loading: false,
|
|
103
105
|
error: '',
|
|
106
|
+
get isModuleItem() {
|
|
107
|
+
return this.$item?.type === '$module';
|
|
108
|
+
},
|
|
109
|
+
get isModuleEnabled() {
|
|
110
|
+
this.$item?.__version;
|
|
111
|
+
return this.$item?.DATA?.enabled !== false && this.$item?.DATA?.blocked !== true && this.$item?.DATA?.systemBlocked !== true;
|
|
112
|
+
},
|
|
113
|
+
get barTitle() {
|
|
114
|
+
const name = this.$item?.DATA?.label || this.$item?.label || this.$item?.id || '';
|
|
115
|
+
return this.isModuleItem ? `Классы модуля (${name})` : `Классы и модули (${name})`;
|
|
116
|
+
},
|
|
117
|
+
get emptyText() {
|
|
118
|
+
return this.isModuleItem
|
|
119
|
+
? 'В модуле пока нет классов. Нажмите «Создать класс».'
|
|
120
|
+
: 'Раздел модулей ещё не создан. Нажмите «Подключить модуль».';
|
|
121
|
+
},
|
|
104
122
|
async attached() {
|
|
105
123
|
if (this.$item)
|
|
106
124
|
await this.reload();
|
|
107
125
|
},
|
|
126
|
+
openTreeClass(item) {
|
|
127
|
+
if (item && typeof window?.execute === 'function')
|
|
128
|
+
window.execute(item);
|
|
129
|
+
},
|
|
130
|
+
openFocusedClass() {
|
|
131
|
+
const focused = this.$('#modTree')?.focusedItem;
|
|
132
|
+
if (focused && typeof window?.execute === 'function')
|
|
133
|
+
window.execute(focused);
|
|
134
|
+
},
|
|
135
|
+
async toggleModuleEnabled() {
|
|
136
|
+
if (!this.isModuleItem || !this.$item?.fetch)
|
|
137
|
+
return;
|
|
138
|
+
this.error = '';
|
|
139
|
+
try {
|
|
140
|
+
await this.$item.fetch('set_enabled', { enabled: !this.isModuleEnabled });
|
|
141
|
+
this.$item.reset?.();
|
|
142
|
+
await this.reload();
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
this.error = String(e?.message || e);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
108
148
|
async reload() {
|
|
109
149
|
this.error = '';
|
|
110
150
|
if (!this.$item?.path)
|
|
111
151
|
return;
|
|
112
152
|
this.loading = true;
|
|
113
153
|
try {
|
|
154
|
+
if (this.isModuleItem) {
|
|
155
|
+
this.systemModules = [];
|
|
156
|
+
this.modRootPath = this.$item.path.replace(/\/+$/, '');
|
|
157
|
+
this.$item.reset?.();
|
|
158
|
+
this.modulesRoot = this.$item;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
114
161
|
const ctx = this.$item.fetch
|
|
115
162
|
? await this.$item.fetch('agent_staff_context').catch(() => null)
|
|
116
163
|
: null;
|
|
@@ -900,11 +900,11 @@ if (typeof ODA === 'function' && !customElements.get('staff-role-node')) {
|
|
|
900
900
|
@tap="controller?.openClass($for.item.id)">{{$for.item.label}}</span>
|
|
901
901
|
|
|
902
902
|
<div class="rwcd-wrap">
|
|
903
|
-
<button ~if="canEdit && $for.item.canResetInherit"
|
|
903
|
+
<button ~if="canEdit && setupMode && $for.item.canResetInherit"
|
|
904
904
|
type="button"
|
|
905
905
|
class="rwcd-reset"
|
|
906
906
|
title="Сбросить переопределение и наследовать от родителя"
|
|
907
|
-
@tap.stop="
|
|
907
|
+
@tap.stop="onResetAccess($for.item)">↩</button>
|
|
908
908
|
<div class="rwcd-slider"
|
|
909
909
|
~class="{ explicit: $for.item.isExplicit && !$for.item.isExplicitDenied, inherited: $for.item.isInherited, denied: $for.item.isExplicitDenied }"
|
|
910
910
|
:data-access="$for.item.effectiveAccess"
|
|
@@ -912,31 +912,31 @@ if (typeof ODA === 'function' && !customElements.get('staff-role-node')) {
|
|
|
912
912
|
<button type="button"
|
|
913
913
|
class="rwcd-seg seg-none"
|
|
914
914
|
~class="{ 'active-none': $for.item.effectiveRank === 0 }"
|
|
915
|
-
:disabled="!canEdit"
|
|
915
|
+
:disabled="!canEdit || !setupMode"
|
|
916
916
|
:title="$for.item.inheritedAccess ? 'Явно запретить доступ к этому классу (—)' : 'Нет доступа (—)'"
|
|
917
917
|
@tap.stop="onSelectAccess($for.item, 'none')">—</button>
|
|
918
918
|
<button type="button"
|
|
919
919
|
class="rwcd-seg seg-r"
|
|
920
920
|
~class="{ filled: $for.item.effectiveRank >= 1 }"
|
|
921
|
-
:disabled="!canEdit"
|
|
921
|
+
:disabled="!canEdit || !setupMode"
|
|
922
922
|
title="Чтение (R)"
|
|
923
923
|
@tap.stop="onSelectAccess($for.item, 'read')">R</button>
|
|
924
924
|
<button type="button"
|
|
925
925
|
class="rwcd-seg seg-w"
|
|
926
926
|
~class="{ filled: $for.item.effectiveRank >= 2 }"
|
|
927
|
-
:disabled="!canEdit"
|
|
927
|
+
:disabled="!canEdit || !setupMode"
|
|
928
928
|
title="Редактирование и проведение (W)"
|
|
929
929
|
@tap.stop="onSelectAccess($for.item, 'write')">W</button>
|
|
930
930
|
<button type="button"
|
|
931
931
|
class="rwcd-seg seg-c"
|
|
932
932
|
~class="{ filled: $for.item.effectiveRank >= 3 }"
|
|
933
|
-
:disabled="!canEdit"
|
|
933
|
+
:disabled="!canEdit || !setupMode"
|
|
934
934
|
title="Создание объектов и документов (C)"
|
|
935
935
|
@tap.stop="onSelectAccess($for.item, 'create')">C</button>
|
|
936
936
|
<button type="button"
|
|
937
937
|
class="rwcd-seg seg-d"
|
|
938
938
|
~class="{ filled: $for.item.effectiveRank >= 4 }"
|
|
939
|
-
:disabled="!canEdit"
|
|
939
|
+
:disabled="!canEdit || !setupMode"
|
|
940
940
|
title="Удаление и полный доступ к данным (D)"
|
|
941
941
|
@tap.stop="onSelectAccess($for.item, 'delete')">D</button>
|
|
942
942
|
</div>
|
|
@@ -1097,10 +1097,15 @@ if (typeof ODA === 'function' && !customElements.get('staff-role-node')) {
|
|
|
1097
1097
|
this.expandedClasses = { ...this.expandedClasses, [clsPath]: !cur };
|
|
1098
1098
|
},
|
|
1099
1099
|
onSelectAccess(row, level) {
|
|
1100
|
-
if (!this.canEdit || !row?.id)
|
|
1100
|
+
if (!this.canEdit || !this.setupMode || !row?.id)
|
|
1101
1101
|
return;
|
|
1102
1102
|
this.controller?.setClassAccess(this.trail, row.id, level, row.inheritedAccess || '');
|
|
1103
1103
|
},
|
|
1104
|
+
onResetAccess(row) {
|
|
1105
|
+
if (!this.canEdit || !this.setupMode || !row?.id)
|
|
1106
|
+
return;
|
|
1107
|
+
this.controller?.resetClassOverride(this.trail, row.id);
|
|
1108
|
+
},
|
|
1104
1109
|
onDragOver(e) {
|
|
1105
1110
|
if (!this.canEdit)
|
|
1106
1111
|
return;
|
|
@@ -146,6 +146,7 @@ export default {
|
|
|
146
146
|
this._lastDelta = Date.now();
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
|
+
'task.moved': e => this._handleTaskMoved(e.detail?.value || e.detail),
|
|
149
150
|
'chat.done': () => this._reload(),
|
|
150
151
|
};
|
|
151
152
|
for (const [k, fn] of Object.entries(this._h))
|
|
@@ -638,6 +639,8 @@ export default {
|
|
|
638
639
|
const res = await this.$item?.fetch('approve', {}, JSON.stringify({ call: callId, ...payload }));
|
|
639
640
|
if (res && res.ok === false)
|
|
640
641
|
this.toast(res.error || 'Не удалось отправить ответ');
|
|
642
|
+
else if (res?.moved)
|
|
643
|
+
await this._handleTaskMoved(res.moved);
|
|
641
644
|
else if (this.$item?.path && navigator.serviceWorker?.controller) {
|
|
642
645
|
try {
|
|
643
646
|
navigator.serviceWorker.controller.postMessage({ type: 'work:task-visible', task: this.$item.path });
|
|
@@ -645,6 +648,28 @@ export default {
|
|
|
645
648
|
catch { /* ignore */ }
|
|
646
649
|
}
|
|
647
650
|
},
|
|
651
|
+
async _handleTaskMoved(moved) {
|
|
652
|
+
if (!moved?.newPath || this._movedHandledPath === moved.newPath)
|
|
653
|
+
return;
|
|
654
|
+
this._movedHandledPath = moved.newPath;
|
|
655
|
+
let inChat = false;
|
|
656
|
+
for (let p = this.parentElement || this.getRootNode?.()?.host; p; p = p.parentElement || p.getRootNode?.()?.host) {
|
|
657
|
+
if (p.localName === 'chat-item' || p.localName === 'oda-chat' || p.localName === 'form-chat') {
|
|
658
|
+
inChat = true;
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (inChat) {
|
|
663
|
+
this.dispatchEvent(new CustomEvent('work-task-moved', {
|
|
664
|
+
bubbles: true,
|
|
665
|
+
composed: true,
|
|
666
|
+
detail: moved,
|
|
667
|
+
}));
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
if (typeof location !== 'undefined')
|
|
671
|
+
location.href = encodeURI(moved.newPath + '/~/handlers//form/index.html');
|
|
672
|
+
},
|
|
648
673
|
/** Кратко объяснить действие и последствия ожидающего подтверждения с помощью быстрой модели. */
|
|
649
674
|
async explainCall(callId) {
|
|
650
675
|
return this.$item?.fetch('explain_call', {}, JSON.stringify({ call: callId }));
|
|
@@ -395,6 +395,15 @@ ODA({ is: 'microchat-tool',
|
|
|
395
395
|
|
|
396
396
|
<div class="answer" ~if="answerText">↳ {{answerText}}</div>
|
|
397
397
|
|
|
398
|
+
<div class="ask" ~if="isMove">
|
|
399
|
+
<div class="q">Перенести задачу в «{{moveInfo.targetLabel}}» и продолжить?</div>
|
|
400
|
+
<div class="why" ~if="moveInfo.reason">{{moveInfo.targetPath}} — {{moveInfo.reason}}</div>
|
|
401
|
+
<div class="btns">
|
|
402
|
+
<oda-button hide-icon accent-invert label="Перенести и продолжить" @tap="approve(true)"></oda-button>
|
|
403
|
+
<oda-button hide-icon class="ghost danger" label="Отмена" @tap="approve(false)"></oda-button>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
398
407
|
<div class="ask" ~if="isApproval">
|
|
399
408
|
<div class="q">Разрешить «{{meta.label}}»{{target ? ': ' + target : ''}}?</div>
|
|
400
409
|
<div class="why" ~if="data?.reason">{{data.reason}}</div>
|
|
@@ -518,6 +527,14 @@ ODA({ is: 'microchat-tool',
|
|
|
518
527
|
},
|
|
519
528
|
get duration() { return fmtDuration(this.data?.durationMs); },
|
|
520
529
|
get isApproval() { return this.data?.status === 'approval'; },
|
|
530
|
+
get isMove() { return this.data?.status === 'waiting' && (!!this.data?.moveRequest || this.data?.name === 'move_task'); },
|
|
531
|
+
get moveInfo() {
|
|
532
|
+
const mr = this.data?.moveRequest || {};
|
|
533
|
+
const targetPath = String(mr.targetPath || this.data?.args?.target_path || '/');
|
|
534
|
+
const targetLabel = String(mr.targetLabel || (targetPath === '/' ? 'WORK' : targetPath.split('/').pop()) || 'WORK');
|
|
535
|
+
const reason = String(mr.reason || this.data?.args?.reason || '');
|
|
536
|
+
return { targetPath, targetLabel, reason };
|
|
537
|
+
},
|
|
521
538
|
get isQuestion() { return this.data?.status === 'waiting' && this.data?.name === 'ask_user'; },
|
|
522
539
|
get isConnect() { return this.data?.status === 'waiting' && this.data?.name === 'connect_service' && !!this.data?.connect; },
|
|
523
540
|
get isPage() { return !!this.data?.page?.url; },
|
|
@@ -45,6 +45,8 @@ ODA({ is: 'microchat-panel',
|
|
|
45
45
|
get placeholder() {
|
|
46
46
|
if (this.waiting?.kind === 'question')
|
|
47
47
|
return 'Ответьте выше или напишите свой ответ…';
|
|
48
|
+
if (this.waiting?.kind === 'move')
|
|
49
|
+
return 'Подтвердите перенос выше или напишите, что сделать иначе…';
|
|
48
50
|
if (this.waiting?.kind === 'approval')
|
|
49
51
|
return 'Напишите, что сделать иначе (действие будет отклонено)…';
|
|
50
52
|
if (this.status === 'needs_review')
|
|
@@ -56,7 +58,11 @@ ODA({ is: 'microchat-panel',
|
|
|
56
58
|
case 'running': return this.$pdp?.voiceOn
|
|
57
59
|
? 'Живой диалог · говорите или пишите, чтобы перебить ИИ · Esc — остановить'
|
|
58
60
|
: 'Агент работает · сообщение встанет в очередь · Esc — остановить';
|
|
59
|
-
case 'waiting': return this.waiting?.kind === 'approval'
|
|
61
|
+
case 'waiting': return this.waiting?.kind === 'approval'
|
|
62
|
+
? 'Нужно ваше разрешение — выше в ленте'
|
|
63
|
+
: this.waiting?.kind === 'move'
|
|
64
|
+
? 'Нужно подтвердить перенос задачи — выше в ленте'
|
|
65
|
+
: 'Агент ждёт ответа — выше в ленте';
|
|
60
66
|
case 'stopped': return 'Остановлено';
|
|
61
67
|
case 'error': return 'Работа прервана ошибкой';
|
|
62
68
|
case 'needs_review': return 'После перезапуска результат действия неизвестен — проверьте перед продолжением';
|
|
@@ -22,6 +22,7 @@ export const TOOL_META = {
|
|
|
22
22
|
web_fetch: { label: 'Страница', icon: 'carbon:link' },
|
|
23
23
|
todo_write: { label: 'План', icon: 'carbon:list-checked' },
|
|
24
24
|
ask_user: { label: 'Вопрос', icon: 'carbon:help' },
|
|
25
|
+
move_task: { label: 'Перенос задачи', icon: 'carbon:move' },
|
|
25
26
|
task: { label: 'Субагент', icon: 'carbon:bot' },
|
|
26
27
|
agent_start: { label: 'Продолжимый агент', icon: 'carbon:bot' },
|
|
27
28
|
agent_status: { label: 'Статус агента', icon: 'carbon:task' },
|
|
@@ -281,15 +281,19 @@ export function attentionText(tool, kind) {
|
|
|
281
281
|
const target = q(tool?.target, 80);
|
|
282
282
|
return 'Нужно ваше разрешение: ' + what + (target ? ', ' + target : '') + '. Подтвердите на экране.';
|
|
283
283
|
}
|
|
284
|
+
if (kind === 'move') {
|
|
285
|
+
const target = q(tool?.moveRequest?.targetLabel || tool?.moveRequest?.targetPath || tool?.args?.target_path || 'WORK', 80);
|
|
286
|
+
return 'Нужно перенести задачу в ' + target + ' и продолжить там. Подтвердите на экране.';
|
|
287
|
+
}
|
|
284
288
|
return 'Нужно ваше действие на экране.';
|
|
285
289
|
}
|
|
286
290
|
|
|
287
|
-
/** Что агент ждёт от человека сейчас: 'question' | 'approval' | 'connect' | '' (нет ожидания). */
|
|
291
|
+
/** Что агент ждёт от человека сейчас: 'question' | 'approval' | 'move' | 'connect' | '' (нет ожидания). */
|
|
288
292
|
export function waitingKind(data) {
|
|
289
293
|
if (data?.status !== 'waiting')
|
|
290
294
|
return '';
|
|
291
295
|
const k = data?.waiting?.kind;
|
|
292
|
-
return k === 'question' ? 'question' : k === 'approval' ? 'approval' : k ? 'connect' : 'approval';
|
|
296
|
+
return k === 'question' ? 'question' : k === 'approval' ? 'approval' : k === 'move' ? 'move' : k ? 'connect' : 'approval';
|
|
293
297
|
}
|
|
294
298
|
|
|
295
299
|
/**
|