@goodandready/dsh-cron 0.3.27 → 0.3.28
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/lib/channels.js +25 -1
- package/lib/client-src/00-open.js +1 -1
- package/lib/client-src/10-locales.js +2 -0
- package/lib/client-src/30-utils.js +14 -1
- package/lib/client-src/80-sidebar-jobs.js +2 -2
- package/lib/client-src/90-close.js +8 -5
- package/lib/client.js +24 -9
- package/lib/locales.json +8 -1
- package/lib/settings.js +5 -0
- package/lib/tui-settings.js +17 -0
- package/package.json +1 -1
package/lib/channels.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
1
2
|
/**
|
|
2
3
|
* Delivery channels and router (#26, #20, #21, #22, #47, #28).
|
|
3
4
|
*
|
|
@@ -11,7 +12,7 @@ import { formatTaskTelegramMessage, sendTelegramMessage, createTelegramTaskKeybo
|
|
|
11
12
|
import { createKanbanCard, shouldCreateKanbanCard } from './integrations.js';
|
|
12
13
|
import { resolveTemplateText, truncateText } from './templates.js';
|
|
13
14
|
|
|
14
|
-
export const CHANNEL_IDS = ['telegram', 'kanban', 'discord', 'slack', 'ntfy', 'bark', 'pushplus', 'tts', 'gitea'];
|
|
15
|
+
export const CHANNEL_IDS = ['feishu', 'telegram', 'kanban', 'discord', 'slack', 'ntfy', 'bark', 'pushplus', 'tts', 'gitea'];
|
|
15
16
|
|
|
16
17
|
// CHANNEL_LABELS removed (#155) — localized via lib/client.js
|
|
17
18
|
|
|
@@ -41,6 +42,8 @@ export function resolveChannels(task, settings = {}) {
|
|
|
41
42
|
if (explicit.length) return explicit;
|
|
42
43
|
}
|
|
43
44
|
const out = [];
|
|
45
|
+
const notifyFeishu = task.notifyFeishu !== undefined ? task.notifyFeishu : settings.notifyFeishu;
|
|
46
|
+
if (notifyFeishu) out.push('feishu');
|
|
44
47
|
const notify = task.notifyTelegram !== undefined ? task.notifyTelegram : settings.notifyTelegram;
|
|
45
48
|
if (notify) out.push('telegram');
|
|
46
49
|
if ((task.kanbanMode || 'none') !== 'none') out.push('kanban');
|
|
@@ -103,6 +106,14 @@ export function buildDiscordPayload({ text, task, runInfo }) {
|
|
|
103
106
|
};
|
|
104
107
|
}
|
|
105
108
|
|
|
109
|
+
export function buildFeishuPayload({ text }) {
|
|
110
|
+
return { msg_type: 'text', content: { text: truncateText(text, 4000) } };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function feishuSign(timestamp, secret) {
|
|
114
|
+
return createHmac('sha256', `${String(timestamp)}\n${String(secret)}`).update('').digest('base64');
|
|
115
|
+
}
|
|
116
|
+
|
|
106
117
|
export function buildSlackPayload({ text }) {
|
|
107
118
|
return { text: truncateText(text, 3000) };
|
|
108
119
|
}
|
|
@@ -299,6 +310,19 @@ async function postJson(http, url, headers, body, channelId, signal, timeoutMs)
|
|
|
299
310
|
* descriptive Error on failure; the router turns that into a failure entry.
|
|
300
311
|
*/
|
|
301
312
|
const CHANNEL_HANDLERS = {
|
|
313
|
+
async feishu({ task, runInfo, settings, http, signal, timeoutMs }) {
|
|
314
|
+
const url = String(settings.feishuWebhookUrl || '').trim();
|
|
315
|
+
if (!url) throw new Error('feishu: feishuWebhookUrl is not configured');
|
|
316
|
+
const payload = buildFeishuPayload({ text: messageTextFor('feishu', task, runInfo, settings) });
|
|
317
|
+
const secret = String(settings.feishuSecret || '').trim();
|
|
318
|
+
if (secret) {
|
|
319
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
320
|
+
payload.timestamp = String(timestamp);
|
|
321
|
+
payload.sign = feishuSign(timestamp, secret);
|
|
322
|
+
}
|
|
323
|
+
return sendHttp(http, { url, method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }, 'feishu', signal, timeoutMs);
|
|
324
|
+
},
|
|
325
|
+
|
|
302
326
|
async telegram({ task, runInfo, settings, secrets, http, signal, timeoutMs }) {
|
|
303
327
|
const botToken = secrets.botToken || '';
|
|
304
328
|
const chatId = String(settings.chatId || '').trim();
|
|
@@ -23,7 +23,7 @@ window.__ModuleLoader__.load({
|
|
|
23
23
|
let pendingTaskHighlight = null;
|
|
24
24
|
const VIEW_ATTR = 'data-dsh-cron-view';
|
|
25
25
|
const COLUMN_SELECTOR = '[data-pane=conversation], [class*=centerCol]';
|
|
26
|
-
const
|
|
26
|
+
const PANEL_OWNED_SELECTOR = '[' + VIEW_ATTR + '], [data-dsh-plugin="dsh-cron"]';
|
|
27
27
|
const SCRIPT_CONFIRM_HEADER = 'x-dsh-cron-confirm';
|
|
28
28
|
|
|
29
29
|
const BACK_ICON = '<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5"/></svg>';
|
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
'form.templateLabel': 'Message template (optional)',
|
|
129
129
|
'form.templatePlaceholder': '⏰ {title} — {status} in {duration}',
|
|
130
130
|
'form.templateHint': 'Variables: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}. Empty = built-in text.',
|
|
131
|
+
'form.channelFeishu': 'Feishu (Lark)', 'settings.feishuWebhookLabel': 'Feishu webhook URL', 'settings.feishuWebhookPlaceholder': 'https://open.feishu.cn/open-apis/bot/v2/hook/...', 'settings.feishuSecretLabel': 'Signing secret (optional)', 'settings.feishuSecretPlaceholder': 'SEC...', 'settings.feishuGlobalNotify': 'Deliver every run report to Feishu', 'settings.feishuHint': 'Feishu group notification: add a custom bot to the group and paste its webhook URL here. If the bot enables signature verification, paste the signing secret below as well.',
|
|
131
132
|
'form.channelTelegram': 'Telegram', 'form.channelKanban': 'dsh-kanban card',
|
|
132
133
|
'form.channelDiscord': 'Discord', 'form.channelSlack': 'Slack',
|
|
133
134
|
'form.channelNtfy': 'ntfy', 'form.channelBark': 'Bark',
|
|
@@ -360,6 +361,7 @@
|
|
|
360
361
|
'form.notifyOnlyFailure': '仅失败时发送(onlyOnFailure / 成功静默)', 'form.channelsTitle': '推送渠道',
|
|
361
362
|
'form.channelsHint': '任务执行完毕后推送报告的目标渠道。', 'form.templateLabel': '自定义消息模板',
|
|
362
363
|
'form.templatePlaceholder': '⏰ {title} — {status},耗时 {duration}', 'form.templateHint': '可用变量: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}。留空使用内置文案。',
|
|
364
|
+
'form.channelFeishu': 'Feishu (Lark)', 'settings.feishuWebhookLabel': 'Feishu webhook URL', 'settings.feishuWebhookPlaceholder': 'https://open.feishu.cn/open-apis/bot/v2/hook/...', 'settings.feishuSecretLabel': 'Signing secret (optional)', 'settings.feishuSecretPlaceholder': 'SEC...', 'settings.feishuGlobalNotify': 'Deliver every run report to Feishu', 'settings.feishuHint': 'Feishu group notification: add a custom bot to the group and paste its webhook URL here. If the bot enables signature verification, paste the signing secret below as well.',
|
|
363
365
|
'form.channelTelegram': 'Telegram', 'form.channelKanban': 'dsh-kanban 卡片',
|
|
364
366
|
'form.channelDiscord': 'Discord', 'form.channelSlack': 'Slack',
|
|
365
367
|
'form.channelNtfy': 'ntfy', 'form.channelBark': 'Bark',
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
const CODE_FORM_TYPES = ['script', 'node', 'python', 'ssh', 'docker'];
|
|
37
37
|
|
|
38
38
|
// Delivery channels (#26) — must stay in sync with lib/channels.js.
|
|
39
|
-
const DELIVERY_CHANNELS = ['telegram', 'kanban', 'discord', 'slack', 'ntfy', 'bark', 'pushplus', 'tts', 'gitea'];
|
|
39
|
+
const DELIVERY_CHANNELS = ['feishu', 'telegram', 'kanban', 'discord', 'slack', 'ntfy', 'bark', 'pushplus', 'tts', 'gitea'];
|
|
40
40
|
const CHANNEL_LABEL_KEYS = {
|
|
41
|
+
feishu: 'form.channelFeishu',
|
|
41
42
|
telegram: 'form.channelTelegram',
|
|
42
43
|
kanban: 'form.channelKanban',
|
|
43
44
|
discord: 'form.channelDiscord',
|
|
@@ -99,6 +100,18 @@
|
|
|
99
100
|
|
|
100
101
|
// Status colors: core semantic state tokens first (same set dsh-clinebot
|
|
101
102
|
// uses), plugin fallbacks as a single point of change (#105).
|
|
103
|
+
|
|
104
|
+
function shouldDismissPanel(target) {
|
|
105
|
+
if (target === null || target === undefined) return false;
|
|
106
|
+
if (typeof target.closest !== 'function') return false;
|
|
107
|
+
return target.closest(PANEL_OWNED_SELECTOR) === null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function sidebarJobsSeatIsCurrent(state, entry) {
|
|
111
|
+
const root = state && state.root;
|
|
112
|
+
return root !== undefined && root.isConnected && entry !== null && root.previousElementSibling === entry;
|
|
113
|
+
}
|
|
114
|
+
|
|
102
115
|
function createToggle() {
|
|
103
116
|
let open = false;
|
|
104
117
|
const listeners = new Set();
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
|
|
98
98
|
/** Keep the section mounted under the sidebar entry across re-renders. */
|
|
99
99
|
function placeSidebarJobs(state, label) {
|
|
100
|
-
if (state.root !== undefined && state.root.isConnected) return;
|
|
101
100
|
const entry = document.querySelector('[' + ENTRY_ATTR + ']');
|
|
101
|
+
if (sidebarJobsSeatIsCurrent(state, entry)) return;
|
|
102
102
|
if (entry === null || entry.parentElement === null) return;
|
|
103
103
|
if (state.root === undefined) {
|
|
104
104
|
entry.insertAdjacentElement('afterend', buildSidebarJobsRoot(state, label));
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
|
|
128
128
|
let rafPending = false;
|
|
129
129
|
const schedulePlace = () => {
|
|
130
|
-
if (state.
|
|
130
|
+
if (sidebarJobsSeatIsCurrent(state, document.querySelector('[' + ENTRY_ATTR + ']'))) return;
|
|
131
131
|
if (rafPending) return;
|
|
132
132
|
rafPending = true;
|
|
133
133
|
const scheduleFn = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : (cb) => setTimeout(cb, 16);
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
const onOtherActivate = (event) => {
|
|
52
52
|
if (event.detail !== PANEL && toggle.isOpen()) toggle.set(false);
|
|
53
53
|
};
|
|
54
|
-
const
|
|
54
|
+
const onOutsideClick = (event) => {
|
|
55
55
|
if (!toggle.isOpen()) return;
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
if (!shouldDismissPanel(event.target)) return;
|
|
57
|
+
toggle.set(false);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const waitObserver = new MutationObserver(ensure);
|
|
61
61
|
waitObserver.observe(document.body, { childList: true, subtree: true });
|
|
62
62
|
document.addEventListener(ACTIVATE_EVENT, onOtherActivate);
|
|
63
|
-
document.addEventListener('click',
|
|
63
|
+
document.addEventListener('click', onOutsideClick, true);
|
|
64
64
|
const unsubscribe = toggle.subscribe(applyActive);
|
|
65
65
|
applyActive();
|
|
66
66
|
ensure();
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
return () => {
|
|
69
69
|
waitObserver.disconnect();
|
|
70
70
|
document.removeEventListener(ACTIVATE_EVENT, onOtherActivate);
|
|
71
|
-
document.removeEventListener('click',
|
|
71
|
+
document.removeEventListener('click', onOutsideClick, true);
|
|
72
72
|
unsubscribe();
|
|
73
73
|
document.documentElement.removeAttribute(ACTIVE_ATTR);
|
|
74
74
|
teardownPanel();
|
|
@@ -174,6 +174,7 @@
|
|
|
174
174
|
const chipT = props.t || translate;
|
|
175
175
|
return React.createElement('button', {
|
|
176
176
|
type: 'button',
|
|
177
|
+
'data-dsh-plugin': 'dsh-cron',
|
|
177
178
|
style: { background: 'none', border: 'none', color: 'var(--dsw-alias-label-secondary, #999)', cursor: 'pointer', padding: '4px', display: 'inline-flex', alignItems: 'center' },
|
|
178
179
|
title: T_KEY(chipT, 'chip.title'),
|
|
179
180
|
'aria-label': T_KEY(chipT, 'chip.title'),
|
|
@@ -192,6 +193,8 @@
|
|
|
192
193
|
}, 'dsh-cron: client overlay');
|
|
193
194
|
|
|
194
195
|
exports.slots = { card: cardSlot, chip: chipSlot };
|
|
196
|
+
module.exports.panelDismissRule = shouldDismissPanel;
|
|
197
|
+
module.exports.sidebarJobsSeatIsCurrent = sidebarJobsSeatIsCurrent;
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
module.exports = { apply, inject: ['slots', 'locale'] };
|
package/lib/client.js
CHANGED
|
@@ -17,7 +17,7 @@ const ENTRY_ATTR = 'data-dsh-cron-entry';
|
|
|
17
17
|
let pendingTaskHighlight = null;
|
|
18
18
|
const VIEW_ATTR = 'data-dsh-cron-view';
|
|
19
19
|
const COLUMN_SELECTOR = '[data-pane=conversation], [class*=centerCol]';
|
|
20
|
-
const
|
|
20
|
+
const PANEL_OWNED_SELECTOR = '[' + VIEW_ATTR + '], [data-dsh-plugin="dsh-cron"]';
|
|
21
21
|
const SCRIPT_CONFIRM_HEADER = 'x-dsh-cron-confirm';
|
|
22
22
|
const BACK_ICON = '<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5"/></svg>';
|
|
23
23
|
const ICON_TIMER = '<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>';
|
|
@@ -174,6 +174,7 @@ en: {
|
|
|
174
174
|
'form.templateLabel': 'Message template (optional)',
|
|
175
175
|
'form.templatePlaceholder': '⏰ {title} — {status} in {duration}',
|
|
176
176
|
'form.templateHint': 'Variables: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}. Empty = built-in text.',
|
|
177
|
+
'form.channelFeishu': 'Feishu (Lark)', 'settings.feishuWebhookLabel': 'Feishu webhook URL', 'settings.feishuWebhookPlaceholder': 'https://open.feishu.cn/open-apis/bot/v2/hook/...', 'settings.feishuSecretLabel': 'Signing secret (optional)', 'settings.feishuSecretPlaceholder': 'SEC...', 'settings.feishuGlobalNotify': 'Deliver every run report to Feishu', 'settings.feishuHint': 'Feishu group notification: add a custom bot to the group and paste its webhook URL here. If the bot enables signature verification, paste the signing secret below as well.',
|
|
177
178
|
'form.channelTelegram': 'Telegram', 'form.channelKanban': 'dsh-kanban card',
|
|
178
179
|
'form.channelDiscord': 'Discord', 'form.channelSlack': 'Slack',
|
|
179
180
|
'form.channelNtfy': 'ntfy', 'form.channelBark': 'Bark',
|
|
@@ -405,6 +406,7 @@ zh: {
|
|
|
405
406
|
'form.notifyOnlyFailure': '仅失败时发送(onlyOnFailure / 成功静默)', 'form.channelsTitle': '推送渠道',
|
|
406
407
|
'form.channelsHint': '任务执行完毕后推送报告的目标渠道。', 'form.templateLabel': '自定义消息模板',
|
|
407
408
|
'form.templatePlaceholder': '⏰ {title} — {status},耗时 {duration}', 'form.templateHint': '可用变量: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}。留空使用内置文案。',
|
|
409
|
+
'form.channelFeishu': 'Feishu (Lark)', 'settings.feishuWebhookLabel': 'Feishu webhook URL', 'settings.feishuWebhookPlaceholder': 'https://open.feishu.cn/open-apis/bot/v2/hook/...', 'settings.feishuSecretLabel': 'Signing secret (optional)', 'settings.feishuSecretPlaceholder': 'SEC...', 'settings.feishuGlobalNotify': 'Deliver every run report to Feishu', 'settings.feishuHint': 'Feishu group notification: add a custom bot to the group and paste its webhook URL here. If the bot enables signature verification, paste the signing secret below as well.',
|
|
408
410
|
'form.channelTelegram': 'Telegram', 'form.channelKanban': 'dsh-kanban 卡片',
|
|
409
411
|
'form.channelDiscord': 'Discord', 'form.channelSlack': 'Slack',
|
|
410
412
|
'form.channelNtfy': 'ntfy', 'form.channelBark': 'Bark',
|
|
@@ -612,8 +614,9 @@ return (this.props && this.props.children) || null;
|
|
|
612
614
|
const ErrorBoundary = createErrorBoundary();
|
|
613
615
|
const AGENT_FORM_TYPES = ['llm', 'skill', 'workflow'];
|
|
614
616
|
const CODE_FORM_TYPES = ['script', 'node', 'python', 'ssh', 'docker'];
|
|
615
|
-
const DELIVERY_CHANNELS = ['telegram', 'kanban', 'discord', 'slack', 'ntfy', 'bark', 'pushplus', 'tts', 'gitea'];
|
|
617
|
+
const DELIVERY_CHANNELS = ['feishu', 'telegram', 'kanban', 'discord', 'slack', 'ntfy', 'bark', 'pushplus', 'tts', 'gitea'];
|
|
616
618
|
const CHANNEL_LABEL_KEYS = {
|
|
619
|
+
feishu: 'form.channelFeishu',
|
|
617
620
|
telegram: 'form.channelTelegram',
|
|
618
621
|
kanban: 'form.channelKanban',
|
|
619
622
|
discord: 'form.channelDiscord',
|
|
@@ -663,6 +666,15 @@ function formatEnvText(env) {
|
|
|
663
666
|
if (!env || typeof env !== 'object') return '';
|
|
664
667
|
return Object.entries(env).map(([k, v]) => `${k}=${v}`).join('\n');
|
|
665
668
|
}
|
|
669
|
+
function shouldDismissPanel(target) {
|
|
670
|
+
if (target === null || target === undefined) return false;
|
|
671
|
+
if (typeof target.closest !== 'function') return false;
|
|
672
|
+
return target.closest(PANEL_OWNED_SELECTOR) === null;
|
|
673
|
+
}
|
|
674
|
+
function sidebarJobsSeatIsCurrent(state, entry) {
|
|
675
|
+
const root = state && state.root;
|
|
676
|
+
return root !== undefined && root.isConnected && entry !== null && root.previousElementSibling === entry;
|
|
677
|
+
}
|
|
666
678
|
function createToggle() {
|
|
667
679
|
let open = false;
|
|
668
680
|
const listeners = new Set();
|
|
@@ -5096,8 +5108,8 @@ state.listEl = listEl;
|
|
|
5096
5108
|
return root;
|
|
5097
5109
|
}
|
|
5098
5110
|
function placeSidebarJobs(state, label) {
|
|
5099
|
-
if (state.root !== undefined && state.root.isConnected) return;
|
|
5100
5111
|
const entry = document.querySelector('[' + ENTRY_ATTR + ']');
|
|
5112
|
+
if (sidebarJobsSeatIsCurrent(state, entry)) return;
|
|
5101
5113
|
if (entry === null || entry.parentElement === null) return;
|
|
5102
5114
|
if (state.root === undefined) {
|
|
5103
5115
|
entry.insertAdjacentElement('afterend', buildSidebarJobsRoot(state, label));
|
|
@@ -5115,7 +5127,7 @@ const state = { toggle, openTaskSignal, root: undefined, listEl: undefined, head
|
|
|
5115
5127
|
try { state.open = window.localStorage.getItem(SIDEBAR_JOBS_KEY) === '1'; } catch (err) { /* localStorage read failed */ }
|
|
5116
5128
|
let rafPending = false;
|
|
5117
5129
|
const schedulePlace = () => {
|
|
5118
|
-
if (state.
|
|
5130
|
+
if (sidebarJobsSeatIsCurrent(state, document.querySelector('[' + ENTRY_ATTR + ']'))) return;
|
|
5119
5131
|
if (rafPending) return;
|
|
5120
5132
|
rafPending = true;
|
|
5121
5133
|
const scheduleFn = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : (cb) => setTimeout(cb, 16);
|
|
@@ -5225,22 +5237,22 @@ teardownPanel();
|
|
|
5225
5237
|
const onOtherActivate = (event) => {
|
|
5226
5238
|
if (event.detail !== PANEL && toggle.isOpen()) toggle.set(false);
|
|
5227
5239
|
};
|
|
5228
|
-
const
|
|
5240
|
+
const onOutsideClick = (event) => {
|
|
5229
5241
|
if (!toggle.isOpen()) return;
|
|
5230
|
-
|
|
5231
|
-
|
|
5242
|
+
if (!shouldDismissPanel(event.target)) return;
|
|
5243
|
+
toggle.set(false);
|
|
5232
5244
|
};
|
|
5233
5245
|
const waitObserver = new MutationObserver(ensure);
|
|
5234
5246
|
waitObserver.observe(document.body, { childList: true, subtree: true });
|
|
5235
5247
|
document.addEventListener(ACTIVATE_EVENT, onOtherActivate);
|
|
5236
|
-
document.addEventListener('click',
|
|
5248
|
+
document.addEventListener('click', onOutsideClick, true);
|
|
5237
5249
|
const unsubscribe = toggle.subscribe(applyActive);
|
|
5238
5250
|
applyActive();
|
|
5239
5251
|
ensure();
|
|
5240
5252
|
return () => {
|
|
5241
5253
|
waitObserver.disconnect();
|
|
5242
5254
|
document.removeEventListener(ACTIVATE_EVENT, onOtherActivate);
|
|
5243
|
-
document.removeEventListener('click',
|
|
5255
|
+
document.removeEventListener('click', onOutsideClick, true);
|
|
5244
5256
|
unsubscribe();
|
|
5245
5257
|
document.documentElement.removeAttribute(ACTIVE_ATTR);
|
|
5246
5258
|
teardownPanel();
|
|
@@ -5318,6 +5330,7 @@ function CronChip(props) {
|
|
|
5318
5330
|
const chipT = props.t || translate;
|
|
5319
5331
|
return _h('button', {
|
|
5320
5332
|
type: 'button',
|
|
5333
|
+
'data-dsh-plugin': 'dsh-cron',
|
|
5321
5334
|
style: { background: 'none', border: 'none', color: 'var(--dsw-alias-label-secondary, #999)', cursor: 'pointer', padding: '4px', display: 'inline-flex', alignItems: 'center' },
|
|
5322
5335
|
title: T_KEY(chipT, 'chip.title'),
|
|
5323
5336
|
'aria-label': T_KEY(chipT, 'chip.title'),
|
|
@@ -5334,6 +5347,8 @@ mountCronScreen(ctx, toggle)
|
|
|
5334
5347
|
return () => { for (const dispose of off) dispose(); stopStyleSelfHeal(); };
|
|
5335
5348
|
}, 'dsh-cron: client overlay');
|
|
5336
5349
|
exports.slots = { card: cardSlot, chip: chipSlot };
|
|
5350
|
+
module.exports.panelDismissRule = shouldDismissPanel;
|
|
5351
|
+
module.exports.sidebarJobsSeatIsCurrent = sidebarJobsSeatIsCurrent;
|
|
5337
5352
|
}
|
|
5338
5353
|
module.exports = { apply, inject: ['slots', 'locale'] };
|
|
5339
5354
|
return module.exports;
|
package/lib/locales.json
CHANGED
|
@@ -398,6 +398,13 @@
|
|
|
398
398
|
"settings.templateLabel": "默认消息模板",
|
|
399
399
|
"settings.templateHint": "作用于所有没有单独模板的渠道。留空用内置文案。",
|
|
400
400
|
"settings.deliveryTimeoutMsLabel": "每个渠道的推送超时(毫秒)",
|
|
401
|
-
"settings.automationSection": "自动化模型"
|
|
401
|
+
"settings.automationSection": "自动化模型",
|
|
402
|
+
"form.channelFeishu": "飞书 (Feishu)",
|
|
403
|
+
"settings.feishuWebhookLabel": "飞书 Webhook 地址",
|
|
404
|
+
"settings.feishuWebhookPlaceholder": "https://open.feishu.cn/open-apis/bot/v2/hook/…",
|
|
405
|
+
"settings.feishuSecretLabel": "签名密钥(可选)",
|
|
406
|
+
"settings.feishuSecretPlaceholder": "SEC…",
|
|
407
|
+
"settings.feishuGlobalNotify": "所有任务的运行结果都推送到飞书",
|
|
408
|
+
"settings.feishuHint": "飞书群通知:在目标群里添加「自定义机器人」,把它的 Webhook 地址粘贴到下面;如果机器人开启了「签名校验」,再把签名密钥一并填入。"
|
|
402
409
|
}
|
|
403
410
|
}
|
package/lib/settings.js
CHANGED
|
@@ -31,6 +31,10 @@ export const Config = z.object({
|
|
|
31
31
|
silentRuleModel: z.string().default('').description('Model used to evaluate a task silent rule (empty = the task model)').volatile(),
|
|
32
32
|
inspectorModel: z.string().default('').description('Model used to diagnose failed runs (empty = the task model)').volatile(),
|
|
33
33
|
deliveryTimeoutMs: z.number().min(MIN_DELIVERY_TIMEOUT_MS).default(15000).description('Per-channel delivery timeout in ms (minimum 1000); a slower endpoint is recorded as a failure and does not block other channels or the next tick').volatile(),
|
|
34
|
+
notifyFeishu: z.boolean().default(false).description('Deliver task reports to Feishu for every task').volatile(),
|
|
35
|
+
feishuWebhookUrl: z.string().default('').description('Feishu custom-bot webhook URL').volatile(),
|
|
36
|
+
feishuSecret: z.string().role('secret').default('').description('Feishu custom-bot signing secret').volatile(),
|
|
37
|
+
feishuSecretRef: z.string().default('').description('Credential name for Feishu signing secret').volatile(),
|
|
34
38
|
discordWebhookUrl: z.string().default('').description('Discord webhook URL').volatile(),
|
|
35
39
|
slackWebhookUrl: z.string().default('').description('Slack incoming webhook URL').volatile(),
|
|
36
40
|
ntfyUrl: z.string().default('https://ntfy.sh').description('ntfy server base URL').volatile(),
|
|
@@ -78,6 +82,7 @@ export const unwrapConfigValue = plainConfig;
|
|
|
78
82
|
export const unwrapConfig = plainConfig;
|
|
79
83
|
|
|
80
84
|
export const SETTINGS_SYNC_KEYS = [
|
|
85
|
+
'notifyFeishu', 'feishuWebhookUrl', 'feishuSecret', 'feishuSecretRef',
|
|
81
86
|
'botToken', 'botTokenRef', 'telegramWebhookSecret', 'chatId', 'notifyTelegram', 'onlyOnFailure', 'kanbanBaseUrl',
|
|
82
87
|
'defaultTimezone', 'maxConcurrent', 'heartbeatUrl', 'heartbeatIntervalSec', 'llmActionsEnabled',
|
|
83
88
|
'template', 'channelTemplates', 'deliveryTimeoutMs', 'silentRuleModel', 'inspectorModel',
|
package/lib/tui-settings.js
CHANGED
|
@@ -61,6 +61,23 @@ export function buildTuiSection({ live, store }) {
|
|
|
61
61
|
format: textFormat,
|
|
62
62
|
parse: textParse,
|
|
63
63
|
},
|
|
64
|
+
{
|
|
65
|
+
path: ['feishuWebhookUrl'],
|
|
66
|
+
group: 'delivery',
|
|
67
|
+
kind: 'text',
|
|
68
|
+
label: 'Feishu Webhook URL',
|
|
69
|
+
placeholder: 'https://open.feishu.cn/open-apis/bot/v2/hook/...',
|
|
70
|
+
format: textFormat,
|
|
71
|
+
parse: textParse,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
path: ['feishuSecret'],
|
|
75
|
+
group: 'delivery',
|
|
76
|
+
kind: 'text',
|
|
77
|
+
label: 'Feishu Signing Secret',
|
|
78
|
+
secret: { ref: current.feishuSecretRef || 'FEISHU_SECRET' },
|
|
79
|
+
hint: 'Signing secret for Feishu custom-bot verification.',
|
|
80
|
+
},
|
|
64
81
|
{
|
|
65
82
|
path: ['discordWebhookUrl'],
|
|
66
83
|
group: 'delivery',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-cron",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.28",
|
|
4
4
|
"description": "Background automation runner for DSH: isolated agent runs, script/HTTP/SSH/Docker runtimes, cost guard, notifications, heartbeats.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|