odant-work 1.0.103 → 1.0.105
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/handlers/pages/form/system/ai/$handler/class.js +15 -12
- package/$server/$folder/$class/$module/$mcp/handlers/pages/form/system/mcp/$handler/class.js +17 -24
- package/$server/$folder/$class/$module/$provider/handlers/pages/form/system/ai/$handler/class.js +15 -12
- package/$server/$folder/$class/$structure/$project/class.js +39 -5
- package/$server/$folder/$class/$structure/$project/handlers/pages/form/system/modules/$handler/class.js +40 -25
- package/$server/$folder/$class/$structure/$project/handlers/pages/form/system/requisites/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/license/$handler/class.js +13 -12
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +11 -1
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +11 -1
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/profile/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/requisites/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/settings/$handler/class.js +261 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js +11 -1
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/tokens/$handler/class.js +2 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/users/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/class.js +15 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +17 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +19 -40
- package/$server/$folder/$class/$structure/handlers/pages/form/system/database/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js +276 -179
- package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +1 -0
- package/$server/$folder/$class/ai/system.md +2 -2
- package/$server/$folder/$class/class.js +5 -1
- package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +39 -45
- package/$server/$folder/$file/$html/handlers/preview/$handler/preview.js +7 -0
- package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +11 -0
- package/$server/$folder/$file/$md/handlers/preview/$handler/preview.js +29 -8
- package/$server/$folder/$file/$office/handlers/preview/$handler/preview.js +6 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +34 -2
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +14 -11
- package/$server/$folder/$file/$task/handlers/preview/$handler/preview.js +1 -0
- package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +9 -0
- package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +15 -0
- package/$server/$folder/handlers/pages/form/$handler/class.js +187 -3
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +3 -114
- package/$server/$folder/lib/explorer/explorer.js +63 -0
- package/$server/$folder/lib/folder-browser/folder-browser.js +793 -0
- package/$server/$folder/lib/folder-browser/readme.md +5 -0
- package/$server/$folder/lib/tree/tree.js +61 -20
- package/AGENTS.md +2 -2
- package/MODULES/$domain/handlers/pages/form/system/mcp/$handler/class.js +10 -21
- package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/engine/$handler/class.js +1 -0
- package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/models/$handler/class.js +5 -10
- package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/training/$handler/class.js +1 -0
- 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/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/241/321/207/321/221/321/202 /320/275/320/260 /320/276/320/277/320/273/320/260/321/202/321/203.html" +5 -1
- 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/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/242/320/276/320/262/320/260/321/200/320/275/320/260/321/217 /320/275/320/260/320/272/320/273/320/260/320/264/320/275/320/260/321/217.html" +1 -1
- package/NODES/$node/handlers/pages/form/network/$handler/class.js +552 -36
- package/oda/components/icon/icon.js +20 -7
- package/oda/components/layouts/editor-form/editor-form.js +54 -9
- package/package.json +1 -1
- package/sources/client.js +24 -0
- package/sources/data/print.js +27 -3
- package/sources/host/websocket.js +28 -1
- package/sources/modules/agent/index.js +25 -6
- package/sources/modules/agent/permissions.js +4 -2
- package/sources/modules/agent/scope.js +72 -5
- package/sources/modules/agent/session.js +59 -6
- package/sources/modules/agent/tools/work/classes.js +16 -1
- package/sources/modules/license/index.js +120 -0
- package/sources/modules/nodes/registry.js +57 -7
- package/sources/modules/trainer/local-engine.js +22 -9
- package/sources/modules/user-profile/user-profile.js +0 -129
- package/sources/modules/user-profile/user-tokens.js +381 -86
- package/sources/server/access/gateway.js +32 -5
- package/sources/server/class/base-template.js +18 -18
- package/sources/server/class.js +9 -0
- package/sources/server/folder.js +5 -1
- package/sources/server/handler.js +6 -0
- package/sources/server/node.js +16 -0
- package/sources/server/server.js +14 -5
- package/sources/server/user.js +3 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
label: 'Настройки',
|
|
3
|
+
title: 'Личные настройки',
|
|
4
|
+
description: 'Индивидуальные параметры интерфейса и работы ИИ-ассистента',
|
|
5
|
+
icon: 'image:tune',
|
|
6
|
+
order: 16,
|
|
7
|
+
async allowUse($context, params) {
|
|
8
|
+
if (!$context?.id || $context?.DATA?.usersContainer)
|
|
9
|
+
return false;
|
|
10
|
+
const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
|
|
11
|
+
if (uid && $context.id === uid)
|
|
12
|
+
return true;
|
|
13
|
+
if (globalThis.WORK?.DEV_MODE)
|
|
14
|
+
return true;
|
|
15
|
+
const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
|
|
16
|
+
return Array.isArray(roles) && roles.includes('BOSS');
|
|
17
|
+
},
|
|
18
|
+
component: {
|
|
19
|
+
imports: 'oda//icon, oda//button',
|
|
20
|
+
template: /* html */`
|
|
21
|
+
<style>
|
|
22
|
+
:host {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
flex: 1;
|
|
26
|
+
min-height: 0;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
padding: 20px 24px 32px;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
background: var(--content-background, #ffffff);
|
|
31
|
+
color: var(--content-color, #1f2937);
|
|
32
|
+
font-family: var(--font-family, system-ui, -apple-system, sans-serif);
|
|
33
|
+
}
|
|
34
|
+
.page {
|
|
35
|
+
width: min(760px, 100%);
|
|
36
|
+
margin: 0 auto;
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 16px;
|
|
40
|
+
}
|
|
41
|
+
.card {
|
|
42
|
+
border: 1px solid var(--subtle-border, var(--border-color, rgba(128, 128, 128, 0.25)));
|
|
43
|
+
border-radius: 12px;
|
|
44
|
+
background: var(--subtle-background, rgba(128, 128, 128, 0.03));
|
|
45
|
+
padding: 16px 18px;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 14px;
|
|
49
|
+
}
|
|
50
|
+
.card-title {
|
|
51
|
+
font-size: 15px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
}
|
|
54
|
+
.field {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: 6px;
|
|
58
|
+
}
|
|
59
|
+
.field-label {
|
|
60
|
+
font-size: 13.5px;
|
|
61
|
+
font-weight: 600;
|
|
62
|
+
}
|
|
63
|
+
.field-hint {
|
|
64
|
+
font-size: 12.5px;
|
|
65
|
+
opacity: 0.72;
|
|
66
|
+
line-height: 1.4;
|
|
67
|
+
}
|
|
68
|
+
.select {
|
|
69
|
+
width: 100%;
|
|
70
|
+
padding: 9px 12px;
|
|
71
|
+
border-radius: 8px;
|
|
72
|
+
border: 1px solid var(--control-border-color, var(--border-color, #cbd5e1));
|
|
73
|
+
background: var(--content-background, #ffffff);
|
|
74
|
+
color: var(--content-color, #1f2937);
|
|
75
|
+
font: inherit;
|
|
76
|
+
font-size: 13.5px;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
.toggle-row {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: flex-start;
|
|
82
|
+
gap: 12px;
|
|
83
|
+
padding: 12px 14px;
|
|
84
|
+
border-radius: 10px;
|
|
85
|
+
border: 1px solid var(--subtle-border, var(--border-color, rgba(128, 128, 128, 0.22)));
|
|
86
|
+
background: var(--content-background, #ffffff);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
.toggle-row input {
|
|
90
|
+
width: 18px;
|
|
91
|
+
height: 18px;
|
|
92
|
+
margin: 2px 0 0;
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
.status {
|
|
97
|
+
font-size: 13px;
|
|
98
|
+
font-weight: 500;
|
|
99
|
+
color: #059669;
|
|
100
|
+
}
|
|
101
|
+
.status[error] {
|
|
102
|
+
color: var(--error-color, #dc2626);
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
105
|
+
|
|
106
|
+
<div class="page">
|
|
107
|
+
<div class="card">
|
|
108
|
+
<div class="card-title">Искусственный интеллект</div>
|
|
109
|
+
<div class="field">
|
|
110
|
+
<label class="field-label" for="aiModelSelect">Главная модель ИИ</label>
|
|
111
|
+
<select id="aiModelSelect" class="select" @change="_onModelChange($event)">
|
|
112
|
+
<option value="" :selected="!settingModel">{{defaultOptionLabel}}</option>
|
|
113
|
+
<option ~for="chatModels" :value="$for.item.path" :selected="$for.item.path === settingModel">{{$for.item.label}}</option>
|
|
114
|
+
</select>
|
|
115
|
+
<div class="field-hint">
|
|
116
|
+
Используется по умолчанию во всех новых чатах на любом устройстве и синхронизируется при смене модели в строке чата.
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div class="card">
|
|
122
|
+
<div class="card-title">Интерфейс и уведомления</div>
|
|
123
|
+
<label class="toggle-row">
|
|
124
|
+
<input type="checkbox" :checked="settingChatSound" @change="_onSoundChange($event)">
|
|
125
|
+
<div>
|
|
126
|
+
<div class="field-label">Звуковой щелчок по завершении ответа</div>
|
|
127
|
+
<div class="field-hint">Короткий тихий сигнал, когда открытый на экране чат завершил ответ или ждёт вашего подтверждения.</div>
|
|
128
|
+
</div>
|
|
129
|
+
</label>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<div class="status" ~if="statusText" :error="!!statusError">{{statusText}}</div>
|
|
133
|
+
</div>
|
|
134
|
+
`,
|
|
135
|
+
$item: {
|
|
136
|
+
$def: null,
|
|
137
|
+
set(n) {
|
|
138
|
+
if (n) this.reload();
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
chatModels: [],
|
|
142
|
+
systemDefaultModel: '',
|
|
143
|
+
settingModel: '',
|
|
144
|
+
settingChatSound: true,
|
|
145
|
+
statusText: '',
|
|
146
|
+
statusError: false,
|
|
147
|
+
get headerDescription() {
|
|
148
|
+
return `${this.targetTitle} · Индивидуальные параметры интерфейса и работы ИИ-ассистента.`;
|
|
149
|
+
},
|
|
150
|
+
get targetUid() {
|
|
151
|
+
return this.$item?.id || WORK?.uid || '';
|
|
152
|
+
},
|
|
153
|
+
get isSelf() {
|
|
154
|
+
return Boolean(WORK?.uid && this.targetUid === WORK.uid);
|
|
155
|
+
},
|
|
156
|
+
get targetTitle() {
|
|
157
|
+
return this.$item?.DATA?.label || this.$item?.label || this.targetUid || 'Пользователь';
|
|
158
|
+
},
|
|
159
|
+
get defaultOptionLabel() {
|
|
160
|
+
const defItem = (this.chatModels || []).find(m => m.path === this.systemDefaultModel);
|
|
161
|
+
if (defItem)
|
|
162
|
+
return `По умолчанию системы (${defItem.label})`;
|
|
163
|
+
return 'По умолчанию системы';
|
|
164
|
+
},
|
|
165
|
+
attached() {
|
|
166
|
+
this._onUserSettings = () => {
|
|
167
|
+
if (this.isSelf) {
|
|
168
|
+
const s = WORK.userSettings || {};
|
|
169
|
+
this.settingModel = typeof s.aiModel === 'string' ? s.aiModel : '';
|
|
170
|
+
this.settingChatSound = s.chatSound !== false;
|
|
171
|
+
this._syncSelectDom();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
WORK.authEvents?.addEventListener?.('user-settings', this._onUserSettings);
|
|
175
|
+
this.reload();
|
|
176
|
+
},
|
|
177
|
+
detached() {
|
|
178
|
+
if (this._onUserSettings)
|
|
179
|
+
WORK.authEvents?.removeEventListener?.('user-settings', this._onUserSettings);
|
|
180
|
+
},
|
|
181
|
+
_syncSelectDom() {
|
|
182
|
+
this.async(() => {
|
|
183
|
+
const sel = this.$?.('#aiModelSelect');
|
|
184
|
+
if (sel && sel.value !== this.settingModel)
|
|
185
|
+
sel.value = this.settingModel || '';
|
|
186
|
+
}, 20);
|
|
187
|
+
},
|
|
188
|
+
async reload() {
|
|
189
|
+
if (!WORK?.uid || typeof WORK?.fetch !== 'function')
|
|
190
|
+
return;
|
|
191
|
+
const uid = this.targetUid;
|
|
192
|
+
try {
|
|
193
|
+
const [settings, models, defPath] = await Promise.all([
|
|
194
|
+
WORK.fetch('/', 'user_settings_get', uid ? { uid } : {}),
|
|
195
|
+
WORK.fetch('/', 'agent_chat_models').catch(() => []),
|
|
196
|
+
WORK.fetch('/', 'agent_default_model', { nodePath: this.$item?.path || '/' }).catch(() => ''),
|
|
197
|
+
]);
|
|
198
|
+
if (Array.isArray(models))
|
|
199
|
+
this.chatModels = models;
|
|
200
|
+
this.systemDefaultModel = typeof defPath === 'string' ? defPath : '';
|
|
201
|
+
if (settings && typeof settings === 'object') {
|
|
202
|
+
this.settingModel = typeof settings.aiModel === 'string' ? settings.aiModel : '';
|
|
203
|
+
this.settingChatSound = settings.chatSound !== false;
|
|
204
|
+
if (this.isSelf)
|
|
205
|
+
WORK._applyUserSettings?.(settings, { broadcast: false });
|
|
206
|
+
}
|
|
207
|
+
this._syncSelectDom();
|
|
208
|
+
}
|
|
209
|
+
catch (e) {
|
|
210
|
+
this.statusError = true;
|
|
211
|
+
this.statusText = e?.message || 'Не удалось загрузить настройки';
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
async _savePatch(patch) {
|
|
215
|
+
this.statusError = false;
|
|
216
|
+
this.statusText = '';
|
|
217
|
+
try {
|
|
218
|
+
const payload = { ...patch, ...(!this.isSelf && this.targetUid ? { uid: this.targetUid } : {}) };
|
|
219
|
+
let saved;
|
|
220
|
+
if (this.isSelf && typeof WORK.saveUserSettings === 'function') {
|
|
221
|
+
saved = await WORK.saveUserSettings(patch);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
saved = await WORK.fetch('/', 'user_settings_save', {}, payload);
|
|
225
|
+
}
|
|
226
|
+
if (saved && typeof saved === 'object') {
|
|
227
|
+
this.settingModel = typeof saved.aiModel === 'string' ? saved.aiModel : '';
|
|
228
|
+
this.settingChatSound = saved.chatSound !== false;
|
|
229
|
+
}
|
|
230
|
+
if (this.isSelf && 'aiModel' in patch && patch.aiModel && typeof BroadcastChannel !== 'undefined') {
|
|
231
|
+
try { new BroadcastChannel('work-user-ai-model').postMessage({ model: patch.aiModel }); } catch {}
|
|
232
|
+
}
|
|
233
|
+
this._syncSelectDom();
|
|
234
|
+
this.statusText = 'Сохранено';
|
|
235
|
+
clearTimeout(this._stTimer);
|
|
236
|
+
this._stTimer = setTimeout(() => { this.statusText = ''; }, 2000);
|
|
237
|
+
}
|
|
238
|
+
catch (e) {
|
|
239
|
+
this.statusError = true;
|
|
240
|
+
this.statusText = e?.message || 'Ошибка сохранения';
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
_onModelChange(e) {
|
|
244
|
+
const val = String(e?.target?.value || '');
|
|
245
|
+
this.settingModel = val;
|
|
246
|
+
if (this.isSelf && !val && typeof localStorage !== 'undefined') {
|
|
247
|
+
try {
|
|
248
|
+
const uid = WORK.uid || this.targetUid || 'default';
|
|
249
|
+
localStorage.removeItem('work.user.ai:' + uid + ':model');
|
|
250
|
+
localStorage.removeItem('work.user.ai:default:model');
|
|
251
|
+
} catch {}
|
|
252
|
+
}
|
|
253
|
+
this._savePatch({ aiModel: val });
|
|
254
|
+
},
|
|
255
|
+
_onSoundChange(e) {
|
|
256
|
+
const checked = Boolean(e?.target?.checked);
|
|
257
|
+
this.settingChatSound = checked;
|
|
258
|
+
this._savePatch({ chatSound: checked });
|
|
259
|
+
},
|
|
260
|
+
}
|
|
261
|
+
};
|
package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
2
|
+
async allowUse($context, params) {
|
|
3
|
+
if (!$context?.id || $context?.DATA?.usersContainer)
|
|
4
|
+
return false;
|
|
5
|
+
const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
|
|
6
|
+
if (uid && $context.id === uid)
|
|
7
|
+
return true;
|
|
8
|
+
if (globalThis.WORK?.DEV_MODE)
|
|
9
|
+
return true;
|
|
10
|
+
const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
|
|
11
|
+
return Array.isArray(roles) && roles.includes('BOSS');
|
|
12
|
+
},
|
|
3
13
|
};
|
package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/tokens/$handler/class.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import '/sources/modules/user-profile/user-tokens.js';
|
|
2
2
|
export default {
|
|
3
3
|
label: 'Токены',
|
|
4
|
+
title: 'Токены подключений',
|
|
5
|
+
description: 'Персональные токены для расширения WORK Chrome Bridge и внешних ИИ-клиентов (MCP: OpenCode, Claude Code, Cursor).',
|
|
4
6
|
icon: 'communication:vpn-key',
|
|
5
7
|
order: 18,
|
|
6
8
|
allowUse($context, params) {
|
|
@@ -11,6 +11,7 @@ export default {
|
|
|
11
11
|
sql_insert_row: 'admin',
|
|
12
12
|
sql_delete_row: 'admin',
|
|
13
13
|
delete_log_entry: 'write',
|
|
14
|
+
ai_layers: 'read',
|
|
14
15
|
skills_catalog: 'read',
|
|
15
16
|
skill_install: 'write',
|
|
16
17
|
skill_remove: 'write',
|
|
@@ -74,6 +75,20 @@ export default {
|
|
|
74
75
|
await ensureMailboxFolders(this, mailboxes);
|
|
75
76
|
},
|
|
76
77
|
|
|
78
|
+
/** Слои папки ai/ текущего узла по цепочке ~ (от базового слоя к локальному). */
|
|
79
|
+
async ai_layers(params = {}) {
|
|
80
|
+
const { pathToFileURL } = await import('node:url');
|
|
81
|
+
const path = await import('node:path');
|
|
82
|
+
const res = await import(pathToFileURL(path.join(process.cwd(), 'sources/modules/agent/resources.js')).href);
|
|
83
|
+
const layers = await res.aiLayers(this);
|
|
84
|
+
const ownMetaPath = (this.meta_folder?.path || '') + '/ai';
|
|
85
|
+
return layers.map(l => ({
|
|
86
|
+
path: l.dir?.path || '',
|
|
87
|
+
scope: l.scope || '/',
|
|
88
|
+
isOwn: Boolean(ownMetaPath && l.dir?.path === ownMetaPath),
|
|
89
|
+
})).filter(l => l.path);
|
|
90
|
+
},
|
|
91
|
+
|
|
77
92
|
/** Каталог навыков ИИ (ai/skills/) текущего слоя и хост-системы. */
|
|
78
93
|
async skills_catalog(params = {}) {
|
|
79
94
|
const ext = await WORK_EXTENSIONS();
|
|
@@ -904,10 +904,23 @@ ODA({
|
|
|
904
904
|
},
|
|
905
905
|
async _runWithCabinetFallback(fn) {
|
|
906
906
|
const primary = this.$pdp?.$item || this.$item;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
907
|
+
try {
|
|
908
|
+
return {
|
|
909
|
+
target: primary,
|
|
910
|
+
result: await fn(primary)
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
catch (err) {
|
|
914
|
+
if (this.feedMode !== 'dialog' || primary?.DATA?.isUser || !this._isAccessError(err))
|
|
915
|
+
throw err;
|
|
916
|
+
const cab = await this._ownCabinet();
|
|
917
|
+
if (!cab)
|
|
918
|
+
throw err;
|
|
919
|
+
return {
|
|
920
|
+
target: cab,
|
|
921
|
+
result: await fn(cab)
|
|
922
|
+
};
|
|
923
|
+
}
|
|
911
924
|
},
|
|
912
925
|
$item: {
|
|
913
926
|
$def: null,
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js
CHANGED
|
@@ -64,10 +64,11 @@ function slugRuleName(text) {
|
|
|
64
64
|
}
|
|
65
65
|
export default {
|
|
66
66
|
label: 'Агент и правила',
|
|
67
|
+
description: 'Автоответ, тихая сводка, автономный ночной аудит, расписание и триггеры-правила',
|
|
67
68
|
icon: 'bootstrap:robot',
|
|
68
69
|
order: 70,
|
|
69
70
|
group: 'infra',
|
|
70
|
-
allowSave:
|
|
71
|
+
allowSave: false,
|
|
71
72
|
component: {
|
|
72
73
|
imports: 'oda//icon, oda//button',
|
|
73
74
|
template: /* html */`
|
|
@@ -170,6 +171,11 @@ export default {
|
|
|
170
171
|
color: var(--accent-color, #2563eb);
|
|
171
172
|
font-weight: 600;
|
|
172
173
|
}
|
|
174
|
+
oda-button[label] {
|
|
175
|
+
padding: 5px 12px;
|
|
176
|
+
gap: 6px;
|
|
177
|
+
border-radius: 6px;
|
|
178
|
+
}
|
|
173
179
|
.inherited-box {
|
|
174
180
|
@apply --vertical;
|
|
175
181
|
gap: 6px;
|
|
@@ -192,11 +198,11 @@ export default {
|
|
|
192
198
|
}
|
|
193
199
|
</style>
|
|
194
200
|
|
|
195
|
-
<!-- 1.
|
|
201
|
+
<!-- 1. Поведение агента -->
|
|
196
202
|
<div class="card">
|
|
197
203
|
<div class="card-head">
|
|
198
204
|
<oda-icon icon="bootstrap:robot" icon-size="20"></oda-icon>
|
|
199
|
-
<span
|
|
205
|
+
<span>Поведение агента</span>
|
|
200
206
|
<div class="row" style="margin-left:auto;gap:12px;">
|
|
201
207
|
<label class="row" style="gap:5px;cursor:pointer;font-weight:400;font-size:12.5px;">
|
|
202
208
|
<input type="checkbox" :checked="proactivity.autoReply" @change="toggleProactivity('autoReply', $event.target.checked)">
|
|
@@ -208,32 +214,7 @@ export default {
|
|
|
208
214
|
</label>
|
|
209
215
|
</div>
|
|
210
216
|
</div>
|
|
211
|
-
|
|
212
|
-
<div class="rule-item">
|
|
213
|
-
<div class="row" style="justify-content:space-between;">
|
|
214
|
-
<span class="field-label">Системная инструкция для агента этого подразделения</span>
|
|
215
|
-
<div class="row">
|
|
216
|
-
<button type="button" class="preset-btn" ~class="{ active: !systemReplace }" @tap="systemReplace = false">Дополнять</button>
|
|
217
|
-
<button type="button" class="preset-btn" ~class="{ active: systemReplace }" @tap="systemReplace = true">Заменить</button>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
<textarea placeholder="Роль и правила работы агента подразделения…" ::value="systemText" style="min-height:84px;"></textarea>
|
|
221
|
-
<div class="row" style="justify-content:space-between;">
|
|
222
|
-
<button type="button" class="preset-btn" ~if="inheritedLayers.length" @tap="showInherited = !showInherited">
|
|
223
|
-
{{showInherited ? 'Скрыть унаследованную' : 'Унаследованная (' + inheritedLayers.length + ')'}}
|
|
224
|
-
</button>
|
|
225
|
-
<span ~if="!inheritedLayers.length"></span>
|
|
226
|
-
<div class="row" ~if="systemStatus">
|
|
227
|
-
<span class="muted">{{systemStatus}}</span>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
<div ~if="showInherited && inheritedLayers.length" class="inherited-box">
|
|
231
|
-
<div ~for="inheritedLayers">
|
|
232
|
-
<div style="font-weight:600;">{{$for.item.scope}}</div>
|
|
233
|
-
<div class="inherited-layer">{{$for.item.text}}</div>
|
|
234
|
-
</div>
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
217
|
+
<div class="muted">Системные инструкции (<code>system.md</code>), навыки и субагенты управляются в разделе <b>«Навыки и агенты»</b> (<code>ai/</code>).</div>
|
|
237
218
|
</div>
|
|
238
219
|
|
|
239
220
|
<!-- 1б. Автономный ночной аудит -->
|
|
@@ -246,9 +227,7 @@ export default {
|
|
|
246
227
|
<input type="checkbox" :checked="auditEnabled" @change="saveAuditSettings({ enabled: $event.target.checked })">
|
|
247
228
|
<span>Включён</span>
|
|
248
229
|
</label>
|
|
249
|
-
<oda-button icon="
|
|
250
|
-
{{auditRunning ? 'Проверяю…' : 'Запустить аудит сейчас'}}
|
|
251
|
-
</oda-button>
|
|
230
|
+
<oda-button icon="av:play-arrow" info-invert :disabled="auditRunning" :label="auditRunning ? 'Проверяю…' : 'Запустить аудит сейчас'" @tap="runAuditNow()"></oda-button>
|
|
252
231
|
</div>
|
|
253
232
|
</div>
|
|
254
233
|
<div class="row">
|
|
@@ -274,17 +253,17 @@ export default {
|
|
|
274
253
|
</div>
|
|
275
254
|
<div class="row" style="justify-content:space-between;" ~if="auditLastText || auditResultText">
|
|
276
255
|
<span class="muted">{{auditResultText || auditLastText}}</span>
|
|
277
|
-
<oda-button ~if="auditLastTask" icon="icons:open-in-new" @tap="openAuditTask()"
|
|
256
|
+
<oda-button ~if="auditLastTask" icon="icons:open-in-new" label="Открыть задачу" @tap="openAuditTask()"></oda-button>
|
|
278
257
|
</div>
|
|
279
258
|
</div>
|
|
280
259
|
|
|
281
260
|
<!-- 2. Автоматические реакции на события -->
|
|
282
261
|
<div class="card">
|
|
283
262
|
<div class="card-head">
|
|
284
|
-
<oda-icon icon="
|
|
263
|
+
<oda-icon icon="social:notifications-active" icon-size="20"></oda-icon>
|
|
285
264
|
<span>Автоматические реакции ({{triggerCards.length}})</span>
|
|
286
265
|
<div class="row" style="margin-left:auto;">
|
|
287
|
-
<oda-button icon="icons:add" @tap="openNewRule()"
|
|
266
|
+
<oda-button icon="icons:add" label="Добавить" @tap="openNewRule()"></oda-button>
|
|
288
267
|
</div>
|
|
289
268
|
</div>
|
|
290
269
|
|
|
@@ -381,8 +360,8 @@ export default {
|
|
|
381
360
|
</div>
|
|
382
361
|
|
|
383
362
|
<div class="row" style="justify-content:flex-end;">
|
|
384
|
-
<oda-button icon="icons:check" info-invert :disabled="!canSaveRule" @tap="saveRule()"
|
|
385
|
-
<oda-button icon="icons:close" @tap="editing = false"
|
|
363
|
+
<oda-button icon="icons:check" info-invert :disabled="!canSaveRule" label="Сохранить" @tap="saveRule()"></oda-button>
|
|
364
|
+
<oda-button icon="icons:close" label="Отмена" @tap="editing = false"></oda-button>
|
|
386
365
|
</div>
|
|
387
366
|
</div>
|
|
388
367
|
|
|
@@ -396,7 +375,7 @@ export default {
|
|
|
396
375
|
<span ~if="$for.item.approval" class="badge">подтверждение</span>
|
|
397
376
|
<span class="badge" ~class="{ off: !$for.item.enabled }">{{$for.item.enabled ? 'вкл' : 'выкл'}}</span>
|
|
398
377
|
<div class="row" style="margin-left:auto;">
|
|
399
|
-
<oda-button icon="editor:mode-edit" @tap="editRule($for.item.raw)"
|
|
378
|
+
<oda-button icon="editor:mode-edit" label="Изменить" @tap="editRule($for.item.raw)"></oda-button>
|
|
400
379
|
<oda-button ~if="$for.item.own" icon="icons:delete" @tap="deleteRule($for.item.name)"></oda-button>
|
|
401
380
|
</div>
|
|
402
381
|
</div>
|
|
@@ -460,7 +439,7 @@ export default {
|
|
|
460
439
|
::value="schedPrompt" style="min-height:52px;"></textarea>
|
|
461
440
|
|
|
462
441
|
<div class="row" style="justify-content:flex-end;">
|
|
463
|
-
<oda-button icon="icons:add" info-invert @tap="addSchedule()"
|
|
442
|
+
<oda-button icon="icons:add" info-invert label="Добавить" @tap="addSchedule()"></oda-button>
|
|
464
443
|
</div>
|
|
465
444
|
</div>
|
|
466
445
|
|
|
@@ -472,7 +451,7 @@ export default {
|
|
|
472
451
|
<span ~if="$for.item.rule?.mask" class="muted" style="font-family:monospace;">{{$for.item.rule.mask}}</span>
|
|
473
452
|
<span class="badge" ~class="{ off: !$for.item.enabled }">{{$for.item.enabled ? 'активно' : 'пауза'}}</span>
|
|
474
453
|
<div class="row" style="margin-left:auto;">
|
|
475
|
-
<oda-button
|
|
454
|
+
<oda-button :label="$for.item.enabled ? 'Пауза' : 'Включить'" @tap="toggleSched($for.item)"></oda-button>
|
|
476
455
|
<oda-button icon="icons:delete" @tap="deleteSched($for.item)"></oda-button>
|
|
477
456
|
</div>
|
|
478
457
|
</div>
|