odant-work 1.0.71 → 1.0.73
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 +30 -27
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +1004 -1011
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +51 -23
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +7 -90
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +913 -705
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/methods/refresh/$method/class.js +30 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +10 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/{system/$handler/tabs → search/$handler}/search.js +14 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/system.js +53 -30
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/staff.js +1 -1
- package/$server/$folder/$class/ai/skills/email-mailbox.md +10 -7
- package/$server/$folder/$class/ai/skills/meeting-minutes.md +1 -1
- package/$server/$folder/$file/$eml/triggers/on_save/$trigger/class.js +17 -1
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-ui.js +5 -5
- package/$server/$folder/lib/calendar-form/calendar-form.js +482 -296
- package/$server/$folder/lib/tree/tree.js +1 -1
- package/oda/oda.js +8 -4
- package/package.json +1 -1
- package/sources/client.js +42 -6
- package/sources/host/email-utils.js +25 -1
- package/sources/modules/agent/index.js +3 -1
- package/sources/modules/agent/node-rules.js +60 -3
- package/sources/modules/agent/scheduler.js +7 -0
- package/sources/modules/agent/tools/calendar-mail.js +273 -0
- package/sources/server/access/gateway.js +3 -0
- package/sources/server/chat-threads.js +77 -23
- package/sources/server/class/feed.js +46 -0
- package/sources/server/class/mail-calendar.js +867 -0
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from './chat-task.js';
|
|
10
10
|
|
|
11
11
|
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
|
12
|
+
const SORT_TIMES = new WeakMap();
|
|
12
13
|
/** localStorage.workChatDebug = 1 — журнал времён создания задачи в консоли. */
|
|
13
14
|
function chatDebug(...a) {
|
|
14
15
|
try {
|
|
@@ -309,11 +310,18 @@ ODA({is: 'oda-chat',
|
|
|
309
310
|
.mover>oda-button{
|
|
310
311
|
border-radius: 50%;
|
|
311
312
|
}
|
|
312
|
-
.feed-
|
|
313
|
-
position:
|
|
314
|
-
top: 8px;
|
|
315
|
-
right: 12px;
|
|
313
|
+
.feed-top-bar {
|
|
314
|
+
position: relative;
|
|
316
315
|
z-index: 8;
|
|
316
|
+
display: flex;
|
|
317
|
+
align-items: center;
|
|
318
|
+
justify-content: flex-end;
|
|
319
|
+
gap: 6px;
|
|
320
|
+
flex-wrap: wrap;
|
|
321
|
+
padding: 6px 12px 4px;
|
|
322
|
+
flex-shrink: 0;
|
|
323
|
+
}
|
|
324
|
+
.feed-mode-bar {
|
|
317
325
|
display: inline-flex;
|
|
318
326
|
align-items: center;
|
|
319
327
|
gap: 2px;
|
|
@@ -322,7 +330,7 @@ ODA({is: 'oda-chat',
|
|
|
322
330
|
background: var(--content-background, #ffffff);
|
|
323
331
|
border: 1px solid var(--border-color, #cbd5e1);
|
|
324
332
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
|
325
|
-
opacity: 0.
|
|
333
|
+
opacity: 0.94;
|
|
326
334
|
}
|
|
327
335
|
.feed-mode-bar:hover {
|
|
328
336
|
opacity: 1;
|
|
@@ -365,10 +373,15 @@ ODA({is: 'oda-chat',
|
|
|
365
373
|
}
|
|
366
374
|
</style>
|
|
367
375
|
<div class="back"></div>
|
|
368
|
-
<div class="feed-
|
|
369
|
-
<
|
|
370
|
-
|
|
371
|
-
|
|
376
|
+
<div class="feed-top-bar" ~if="showFeedModeToggle || ($item && $item.type !== '$user')">
|
|
377
|
+
<div class="feed-mode-bar" ~if="showFeedModeToggle">
|
|
378
|
+
<button type="button" class="feed-mode-btn" ~class="{ active: feedMode === 'dialog' }" @tap="setFeedMode('dialog')" title="Мой диалог и задачи с Агентом этого узла">Диалог</button>
|
|
379
|
+
<button type="button" class="feed-mode-btn" ~class="{ active: feedMode === 'local' }" @tap="setFeedMode('local')" title="Местный лог открытой точки (доступно только BOSS)">Местный лог</button>
|
|
380
|
+
<button type="button" class="feed-mode-btn" ~class="{ active: feedMode === 'audit' }" @tap="setFeedMode('audit')" title="Взаимодействия пользователей и клиентов с Агентом (доступно только BOSS)">Взаимодействия</button>
|
|
381
|
+
</div>
|
|
382
|
+
<div class="feed-mode-bar" ~if="$item && $item.type !== '$user'">
|
|
383
|
+
<button type="button" class="feed-mode-btn" ~class="{ active: showParticipants }" @tap="toggleParticipants()" title="Участники и рабочие места подразделения">Участники ({{participantsCount}})</button>
|
|
384
|
+
</div>
|
|
372
385
|
</div>
|
|
373
386
|
<div ~if="feedMode === 'audit' && showFeedModeToggle" style="position:absolute;inset:44px 12px 68px 12px;z-index:11;background:var(--content-background,#fff);border:1px solid var(--border-color,#cbd5e1);border-radius:10px;box-shadow:0 6px 24px rgba(0,0,0,0.14);display:flex;overflow:hidden;">
|
|
374
387
|
<div style="width:260px;border-right:1px solid var(--subtle-border,#e2e8f0);overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:4px;background:var(--subtle-background,#f8fafc);">
|
|
@@ -399,9 +412,6 @@ ODA({is: 'oda-chat',
|
|
|
399
412
|
</div>
|
|
400
413
|
</div>
|
|
401
414
|
</div>
|
|
402
|
-
<div class="feed-mode-bar" ~if="$item && $item.type !== '$user'" :style="showFeedModeToggle ? 'top: 42px;' : 'top: 8px;'">
|
|
403
|
-
<button type="button" class="feed-mode-btn" ~class="{ active: showParticipants }" @tap="toggleParticipants()" title="Участники и рабочие места подразделения">Участники ({{participantsCount}})</button>
|
|
404
|
-
</div>
|
|
405
415
|
<div ~if="showParticipants && $item && $item.type !== '$user'" style="position:absolute;top:44px;right:12px;z-index:12;width:280px;max-height:360px;overflow-y:auto;background:var(--content-background,#fff);border:1px solid var(--border-color,#cbd5e1);border-radius:10px;box-shadow:0 6px 20px rgba(0,0,0,0.16);padding:10px 12px;display:flex;flex-direction:column;gap:8px;font-size:12.5px;">
|
|
406
416
|
<div style="display:flex;align-items:center;justify-content:space-between;font-weight:700;">
|
|
407
417
|
<span>Участники ({{participantsCount}})</span>
|
|
@@ -623,8 +633,11 @@ ODA({is: 'oda-chat',
|
|
|
623
633
|
const hitThread = d.threadId && this.$('#ribbon')?._threadId === d.threadId;
|
|
624
634
|
if (hitTwin || hitDm || hitThread) {
|
|
625
635
|
this.$('#ribbon')?.refreshFeed?.();
|
|
626
|
-
if (d.threadId && ev.type === 'chat:message')
|
|
627
|
-
cur.fetch?.('chat_mark_read', { threadId: d.threadId })
|
|
636
|
+
if (d.threadId && ev.type === 'chat:message') {
|
|
637
|
+
cur.fetch?.('chat_mark_read', { threadId: d.threadId })
|
|
638
|
+
?.then?.(res => WORK.applyChatReadLocal?.(res || { threadId: d.threadId, kind: d.kind, nodePath: curPath, peerId: cur.type === '$user' ? cur.id : '' }))
|
|
639
|
+
?.catch?.(() => {});
|
|
640
|
+
}
|
|
628
641
|
}
|
|
629
642
|
};
|
|
630
643
|
globalThis.WORK.chatEvents.addEventListener('chat:message', this._onWsChatMsg);
|
|
@@ -1457,8 +1470,21 @@ ODA({is: 'chat-ribbon',
|
|
|
1457
1470
|
arr.push(msg);
|
|
1458
1471
|
}
|
|
1459
1472
|
this._threadMessagesByDay = byDay;
|
|
1460
|
-
|
|
1461
|
-
|
|
1473
|
+
const curPath = String(this.$item.path || '/').replace(/\/+$/, '') || '/';
|
|
1474
|
+
const localUnread = this.$item.type === '$user'
|
|
1475
|
+
? (Number(WORK.chatUnread?.byPeer?.[this.$item.id]) || 0)
|
|
1476
|
+
: (Number(WORK.chatUnread?.byNode?.[curPath]) || 0);
|
|
1477
|
+
if ((threadRes?.thread?.unreadCount > 0 || localUnread > 0) && threadRes?.thread?.id) {
|
|
1478
|
+
const fallbackInfo = {
|
|
1479
|
+
threadId: threadRes.thread.id,
|
|
1480
|
+
kind: this.$item.type === '$user' ? 'dm' : 'twin',
|
|
1481
|
+
nodePath: curPath,
|
|
1482
|
+
peerId: this.$item.type === '$user' ? this.$item.id : '',
|
|
1483
|
+
};
|
|
1484
|
+
this.$item.fetch?.('chat_mark_read', { threadId: threadRes.thread.id })
|
|
1485
|
+
?.then?.(res => WORK.applyChatReadLocal?.(res?.threadId ? res : fallbackInfo))
|
|
1486
|
+
?.catch?.(() => {});
|
|
1487
|
+
WORK.applyChatReadLocal?.(fallbackInfo);
|
|
1462
1488
|
}
|
|
1463
1489
|
let dates = [...dateSet].sort();
|
|
1464
1490
|
// Пока создаётся новая задача (awaitTask), не сбрасываем локально добавленный _openCreated день
|
|
@@ -1587,9 +1613,11 @@ ODA({is: 'chat-day',
|
|
|
1587
1613
|
_logItemTime(f) {
|
|
1588
1614
|
if (!f)
|
|
1589
1615
|
return 0;
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1616
|
+
const st = SORT_TIMES.get(f);
|
|
1617
|
+
if (Number.isFinite(st) && st > 0)
|
|
1618
|
+
return st;
|
|
1619
|
+
const isProxyItem = Boolean(typeof f.fetch === 'function' || f.short);
|
|
1620
|
+
const rowTime = !isProxyItem ? Number(f.logRow?.time || f.DATA?.logRow?.time || 0) : 0;
|
|
1593
1621
|
if (rowTime > 0)
|
|
1594
1622
|
return rowTime;
|
|
1595
1623
|
const idPrefix = parseInt(String(f.id || '').split('.')[0], 10);
|
|
@@ -1673,8 +1701,8 @@ ODA({is: 'chat-day',
|
|
|
1673
1701
|
if (this._logsInitPromise)
|
|
1674
1702
|
await Promise.race([this._logsInitPromise, sleep(400)]).catch(() => {});
|
|
1675
1703
|
const key = taskKeyOf(file.path) || String(file.id);
|
|
1676
|
-
if (!file
|
|
1677
|
-
file
|
|
1704
|
+
if (!SORT_TIMES.has(file))
|
|
1705
|
+
SORT_TIMES.set(file, this._logItemTime(file) || Date.now());
|
|
1678
1706
|
this._expandedTaskKey = key;
|
|
1679
1707
|
(this._adopted ??= new Map()).set(key, file);
|
|
1680
1708
|
const isSameTask = it => this._isMatchingTaskItem(it, key, file.id);
|
|
@@ -1755,7 +1783,7 @@ ODA({is: 'chat-day',
|
|
|
1755
1783
|
};
|
|
1756
1784
|
const existing = this._wrappedById.get(id);
|
|
1757
1785
|
if (existing) {
|
|
1758
|
-
existing
|
|
1786
|
+
SORT_TIMES.set(existing, rawRow.time);
|
|
1759
1787
|
existing.logRow = rawRow;
|
|
1760
1788
|
return existing;
|
|
1761
1789
|
}
|
|
@@ -1764,10 +1792,10 @@ ODA({is: 'chat-day',
|
|
|
1764
1792
|
name: id,
|
|
1765
1793
|
ext: 'msg',
|
|
1766
1794
|
path: '',
|
|
1767
|
-
_sortTime: rawRow.time,
|
|
1768
1795
|
logRow: rawRow,
|
|
1769
1796
|
load: async () => ({ ...(wrapped.logRow || rawRow) }),
|
|
1770
1797
|
};
|
|
1798
|
+
SORT_TIMES.set(wrapped, rawRow.time);
|
|
1771
1799
|
this._wrappedById.set(id, wrapped);
|
|
1772
1800
|
return wrapped;
|
|
1773
1801
|
},
|
|
@@ -1,90 +1,7 @@
|
|
|
1
|
-
/** Мета хендлера form/email. Визуалка — email.js. */
|
|
2
|
-
export default {
|
|
3
|
-
icon: 'enterprise:email',
|
|
4
|
-
label: 'Почта',
|
|
5
|
-
order: 4,
|
|
6
|
-
roles: ['BOSS', 'USER'],
|
|
7
|
-
|
|
8
|
-
return runEmailSettingsDialog(this);
|
|
9
|
-
},
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function runEmailSettingsDialog($item) {
|
|
13
|
-
if (runEmailSettingsDialog.opening)
|
|
14
|
-
return;
|
|
15
|
-
runEmailSettingsDialog.opening = true;
|
|
16
|
-
let el, settings, $context;
|
|
17
|
-
try {
|
|
18
|
-
$context = $item.$context;
|
|
19
|
-
settings = await $context.fetch('read_secret', { filename: 'email.json' });
|
|
20
|
-
el = ODA.createElement('oda-email-settings', {
|
|
21
|
-
accounts: mailboxesToAccounts(settings?.mailboxes),
|
|
22
|
-
});
|
|
23
|
-
if (!el.accounts.length) {
|
|
24
|
-
el.addAccount();
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
el.index = 0;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
ODA.showMessage(e.message)
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
runEmailSettingsDialog.opening = false;
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
await WORK.showDialog(el, {
|
|
39
|
-
TITLE: { label: 'Почтовые ящики', icon: 'enterprise:email' },
|
|
40
|
-
OK: { label: 'Сохранить', icon: 'icons:save' },
|
|
41
|
-
CANCEL: { label: 'Отмена', icon: 'icons:close' },
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
el.validate();
|
|
49
|
-
const mailboxes = accountsToMailboxes(el.accounts, settings?.mailboxes);
|
|
50
|
-
await $context.fetch(
|
|
51
|
-
'save_secret',
|
|
52
|
-
{ filename: 'email.json' },
|
|
53
|
-
JSON.stringify({ mailboxes }),
|
|
54
|
-
);
|
|
55
|
-
return mailboxes;
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
alert(e.message || e);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function mailboxesToAccounts(mailboxes = {}) {
|
|
64
|
-
return Object.entries(mailboxes).map(([address, box]) => ({
|
|
65
|
-
address,
|
|
66
|
-
smtp: { host: '', port: 465, secure: true, ...box.smtp },
|
|
67
|
-
imap: { host: '', port: 993, secure: true, ...box.imap },
|
|
68
|
-
auth: { user: address, pass: '', ...box.auth },
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function accountsToMailboxes(accounts = [], previousMailboxes = {}) {
|
|
73
|
-
const mailboxes = Object.create(null);
|
|
74
|
-
for (const acc of accounts) {
|
|
75
|
-
const address = String(acc.auth?.user || '').trim();
|
|
76
|
-
if (!address)
|
|
77
|
-
continue;
|
|
78
|
-
const prevPass = previousMailboxes[address]?.auth?.pass || '';
|
|
79
|
-
const nextPass = acc.auth?.pass || '';
|
|
80
|
-
mailboxes[address] = {
|
|
81
|
-
smtp: { ...acc.smtp },
|
|
82
|
-
imap: { ...acc.imap },
|
|
83
|
-
auth: {
|
|
84
|
-
user: address,
|
|
85
|
-
pass: nextPass || prevPass || '',
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
return mailboxes;
|
|
90
|
-
}
|
|
1
|
+
/** Мета хендлера form/email. Визуалка и настройки ящиков — внутри email.js. */
|
|
2
|
+
export default {
|
|
3
|
+
icon: 'enterprise:email',
|
|
4
|
+
label: 'Почта',
|
|
5
|
+
order: 4,
|
|
6
|
+
roles: ['BOSS', 'USER'],
|
|
7
|
+
}
|