@goodandready/dsh-cron 0.3.49 โ†’ 0.3.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/client.js +1 -2881
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -1,2881 +1 @@
1
- window.__ModuleLoader__.load({id: '@goodandready/dsh-cron',factory: (require) => {var module = { exports: {} }
2
- var exports = module.exports
3
- const React = window.React || require('react');
4
- const _h = (...args) => (React && React.createElement ? React.createElement(...args) : null);
5
- const ReactDOM = window.ReactDOM || (function() {try { return require('react-dom/client'); } catch (_e) { void _e; }
6
- try { return require('react-dom'); } catch (_e) { void _e; }
7
- return null;
8
- })();
9
- const PLUGIN_ID = '@goodandready/dsh-cron';
10
- const NS = 'dsh-cron';
11
- const ROW_ID = 'dsh-cron';
12
- const ROW_CONFIG_KEY = PLUGIN_ID + '#' + ROW_ID;
13
- const PANEL = 'cron';
14
- const ACTIVATE_EVENT = 'dsh-panel-activate';
15
- const ACTIVE_ATTR = 'data-dsh-cron-active';
16
- const ENTRY_ATTR = 'data-dsh-cron-entry';
17
- let pendingTaskHighlight = null;
18
- let pendingTaskPreset = null;
19
- const VIEW_ATTR = 'data-dsh-cron-view';
20
- const COLUMN_SELECTOR = '[data-pane=conversation], [class*=centerCol]';
21
- const PANEL_OWNED_SELECTOR = '[' + VIEW_ATTR + '], [data-dsh-plugin="dsh-cron"]';
22
- const SCRIPT_CONFIRM_HEADER = 'x-dsh-cron-confirm';
23
- 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>';
24
- 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>';
25
- const ICON_PLAY = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="5 3 19 12 5 21 5 21"></polygon></svg>';
26
- const ICON_PAUSE = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="6" y="4" width="4" height="16"></rect><rect x="14" y="4" width="4" height="16"></rect></svg>';
27
- const ICON_TRASH = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>';
28
- const ICON_SEARCH = '<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="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';
29
- const ICON_CHEVRON_DOWN = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"></polyline></svg>';
30
- const ICON_BELL = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>';
31
- const ICON_CLIPBOARD = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>';
32
- const ICON_ACTIVITY = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>';
33
- const ICON_EDIT = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>';
34
- const ICON_SEND = '<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"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>';
35
- const ICON_COPY = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>';
36
- const ICON_TUNE = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="21" x2="4" y2="14"></line><line x1="4" y1="10" x2="4" y2="3"></line><line x1="12" y1="21" x2="12" y2="12"></line><line x1="12" y1="8" x2="12" y2="3"></line><line x1="20" y1="21" x2="20" y2="16"></line><line x1="20" y1="12" x2="20" y2="3"></line><line x1="1" y1="14" x2="7" y2="14"></line><line x1="9" y1="8" x2="15" y2="8"></line><line x1="17" y1="16" x2="23" y2="16"></line></svg>';
37
- const ICON_DOWNLOAD = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>';
38
- const ICON_UPLOAD = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>';
39
- const ICON_TELEGRAM = '<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.64 6.8-1.7 8.01c-.13.58-.47.72-.95.45l-2.6-1.92-1.25 1.21c-.14.14-.26.26-.53.26l.19-2.64 4.81-4.35c.21-.19-.05-.29-.32-.11L8.34 13.5 5.78 12.7c-.56-.17-.57-.56.12-.83l10-3.86c.46-.17.87.11.74.79z"/></svg>';
40
- let CoreChevron = null;
41
- try {
42
- const primitives = require('@deepseek-ai/dsh-client-ui-primitives');
43
- CoreChevron = primitives && primitives.IconChevronDownOutline14;
44
- } catch (e) {/* Optional core chevron primitive not available; SVG fallback used */
45
- }
46
- const chevronNode = () => (CoreChevron ? _h(CoreChevron) : _h('span', { style: { display: 'flex', alignItems: 'center' }, dangerouslySetInnerHTML: { __html: ICON_CHEVRON_DOWN } }));
47
- const STRINGS = {en: {'sidebar.label': 'Scheduled tasks', 'sidebar.jobsTitle': 'Active jobs','sidebar.noActiveJobs': 'No active jobs', 'sidebar.moreJobs': 'and {count} more','sessionBar.addRecurring': '+ Cron','sessionBar.addRecurringHint': 'Turn this session into a scheduled recurring task','sessionBar.run': 'Run',
48
- 'sessionBar.runNow': 'Trigger execution now','sessionBar.running': 'Running...','chip.title': 'Scheduled tasks (Cron)', 'panel.back': 'Back to chat','panel.title': 'Scheduled tasks','panel.subtitle': 'Ask DSH to plan tasks, set reminders or track updates','actions.create': 'Create', 'actions.createWithDsh': '๐Ÿ’ฌ Create with DSH',
49
- 'actions.setupManually': 'โœ๏ธ Set up manually', 'actions.runNow': 'Run now','actions.runNowShort': 'Run', 'actions.edit': 'Edit / Details','actions.duplicate': 'Duplicate task', 'actions.tuneWithDsh': 'Tune with DSH','tune.startFailed': 'Could not start the tuning dialogue: {error}','actions.delete': 'Delete task',
50
- 'duplicate.done': 'Copy created and paused: review its schedule before resuming it.','duplicate.oneShotHint': 'The copy is one-shot and paused โ€” its original time has likely passed, so set a new time before resuming.','duplicate.failed': 'Could not duplicate the task: {error}','transfer.exportTitle': 'Export tasks', 'transfer.importTitle': 'Import tasks',
51
- 'transfer.exported': 'Exported {count} task(s).','transfer.exportFailed': 'Export failed: {error}', 'transfer.importTitleModal': 'Import tasks',
52
- 'transfer.importHint': 'Exported task configuration only: no run history, no counters. Channel configurations reference credentials by name; note that raw exports retain custom env variables and HTTP request headers.','transfer.exportPrompt': 'Choose export mode:\nOK = Sanitized (removes custom env vars & headers)\nCancel = Full raw export',
53
- 'transfer.strategyAdd': 'Add as new tasks (new ids, existing ones stay untouched)','transfer.strategyReplace': 'Replace tasks with the same id','transfer.strategySkip': 'Skip tasks whose id already exists','transfer.summary': 'This file contains {total} task(s): {add} new, {replace} matching an existing id, {skip} already skipped.',
54
- 'transfer.confirm': 'Import', 'transfer.imported': 'Imported {count} task(s).','transfer.importFailed': 'Import failed: {error}','transfer.badFile': 'The selected file is not a valid JSON export: {error}','actions.pause': 'Pause', 'actions.resume': 'Resume','actions.settings': 'Notifications & channels', 'search.placeholder': 'Search scheduled tasks',
55
- 'filters.title': 'Filters', 'filters.type': 'Type','filters.model': 'Model', 'filters.channel': 'Channel','filters.any': 'Any', 'filters.reset': 'Reset filters','filters.empty': 'No task matches the current filters.','filters.showing': 'Showing {shown} of {total}', 'stats.activeTasks': 'Active tasks',
56
- 'stats.totalRuns': 'Total runs', 'stats.totalTokens': 'Tokens spent','stats.totalCost': 'Estimated cost', 'tabs.all': 'All','tabs.active': 'Active', 'tabs.paused': 'Paused','tabs.completed': 'Completed', 'banner.loadError': 'Failed to load tasks: {error}','banner.retry': 'Retry', 'list.loading': 'Loading scheduled tasks...',
57
- 'list.empty': 'No scheduled tasks yet', 'list.typeShell': 'Shell','list.typeLlm': 'LLM', 'list.oneShot': 'One-shot','list.configManaged': 'Config','list.configManagedHint': 'Declared in config.jobs in the profile config file; edit the file to change or remove it','list.next': ' ยท next: {time}', 'recs.title': 'Recommended tasks',
58
- 'recs.hint': 'Ready-to-use recipes. Clicking one opens the form with its fields filled in โ€” nothing is created until you save.','modal.editTitle': 'Edit task', 'modal.newTitle': 'New scheduled task','modal.statusActive': 'โ— Active', 'modal.statusPaused': 'โ—‹ Paused','modal.params': 'Parameters', 'modal.history': 'Run history ({count})',
59
- 'modal.cancel': 'Cancel', 'modal.confirmDiscard': 'Discard unsaved changes?','modal.save': 'Save changes', 'modal.create': 'Create task','modal.close': 'Close', 'history.loading': 'Loading history...','history.empty': 'No runs recorded yet', 'history.stoppedReasonTitle': 'Stopped reason:',
60
- 'history.retryDelivery': 'Retry delivery', 'history.retryingDelivery': 'Retrying...','history.statusValidationFailed': 'validation failed', 'history.stage_queue': 'Queue','history.stage_preflight': 'Preflight', 'history.stage_execution': 'Execution','history.stage_validation': 'Validation', 'history.stage_delivery': 'Delivery',
61
- 'history.refresh': 'Refresh history','history.statusSuccess': 'Success', 'history.statusUncertain': 'Uncertain','history.artifacts': 'Artifacts','history.resolveCompleted': 'Mark Completed', 'history.resolveFailed': 'Mark Failed','history.statusUncertainHint': 'Interrupted by restart โ€” verify outcome',
62
- 'history.statusSkipped': 'Skipped', 'history.statusMissed': 'Missed','history.statusTimeout': 'Timeout', 'history.statusFailed': 'Failed','form.nameLabel': 'Task name', 'form.namePlaceholder': 'For example: dsh-tags-watch','form.typeLabel': 'Execution type', 'form.typeLlm': 'LLM (AI agent)',
63
- 'form.typeScript': 'Shell command / script', 'form.typeNode': 'Node.js','form.typePython': 'Python', 'form.typeHttp': 'HTTP request / webhook','form.typeSsh': 'Remote SSH', 'form.typeDocker': 'Docker container','form.typeSkill': 'DSH Skill', 'form.typeWorkflow': 'DSH Workflow','form.typeDigest': 'Daily / Periodic Digest',
64
- 'form.envLabel': 'Environment variables (KEY=VALUE per line)','form.envPlaceholder': 'NODE_ENV=production\nTZ=Europe/Berlin','form.envHint': 'Applied to non-LLM runtimes only. Do not store secrets here.','form.cwdLabel': 'Working directory (optional)','form.workspaceLabel': 'Workspace id or path (optional)',
65
- 'form.worktreeLabel': 'Run in an isolated git worktree','form.keepWorktreeLabel': 'Keep the worktree after the run','form.httpMethodLabel': 'HTTP method', 'form.httpUrlLabel': 'URL','form.httpHeadersLabel': 'Headers (JSON, optional)', 'form.httpBodyLabel': 'Body (optional)','form.sshProfileLabel': 'dsh-remote-workspace profile id',
66
- 'form.sshProfileHint': 'Preferred: host and credentials stay in the remote-workspace plugin.','form.sshTargetLabel': 'Fallback target (user@host, optional)','form.sshKeyLabel': 'Private key path (fallback, optional)','form.dockerImageLabel': 'Container image', 'form.skillNameLabel': 'Skill name',
67
- 'form.workflowNameLabel': 'Workflow name', 'form.scheduleLabel': 'Schedule (cron or interval)','form.schedulePlaceholder': '0 */6 * * * or every 2h or in 30m or at: 2026-09-05T15:00:00Z','form.timeoutLabel': 'Execution timeout (seconds)', 'form.overlapLabel': 'Overlap policy','form.overlapSkip': 'Skip the new run (skip)',
68
- 'form.overlapQueue': 'Queue the next run (queue)','form.overlapReplace': 'Cancel current run and restart (replace)','form.kanbanLabel': 'Kanban card creation (dsh-kanban)','form.kanbanNone': 'Do not create cards (disabled)','form.kanbanOnFailure': 'Create a ticket on failure (into Backlog)',
69
- 'form.kanbanAlways': 'Create a card on every completion (Done / Backlog)','form.providerLabel': 'LLM provider', 'form.providerDefault': 'Default (DSH)','form.modelLabel': 'LLM model', 'form.modelDefault': 'Default','form.silentRuleLabel': 'Silent rule (optional)','form.silentRulePlaceholder': 'Stay silent when no filesystem is above 80%',
70
- 'form.silentRuleHint': 'For tasks with output: a cheap model judges the run against this rule and the report is skipped when it says to stay silent. If the model is unavailable or unsure, the report is delivered.','history.silentSkip': 'stayed silent:', 'history.diagnosis': 'Diagnosis','history.applySuggestion': 'Open the edit form with this suggestion',
71
- 'form.inspectOnFailureLabel': 'Diagnose failures with a model','form.inspectOnFailureHint': 'After a failed run a model reads the prompt, the error and the output, and the diagnosis with a proposed prompt change is stored with the run. Nothing is applied automatically.','settings.inspectorModelLabel': 'Model for failure diagnosis',
72
- 'form.fallbackModelLabel': 'Fallback model (optional)','form.fallbackModelPlaceholder': 'e.g. deepseek-reasoner','form.fallbackModelHint': 'If the run fails on the model above, it is retried once on this model. Both attempts are counted in the cost.','form.promptLabelScript': 'Shell command or script',
73
- 'form.promptLabelLlm': 'Instruction / Prompt for the agent','form.promptPlaceholderScript': 'curl -fsSL https://... || exit 1','form.promptPlaceholderLlm': 'Describe exactly what the agent should do...','form.timezoneLabel': 'Time zone (IANA, optional)','form.timezonePlaceholder': 'e.g. Europe/Berlin (empty = server local)',
74
- 'form.misfireLabel': 'On missed run (after downtime)','form.misfireSkip': 'Skip the missed run (skip)','form.misfireRunOnce': 'Run once late (runOnce)','form.misfireCatchUp': 'Run late once and record the gap (catchUpAll)','form.retriesLabel': 'Automatic retries on failure (0 = off)','form.permissionLabel': 'Session permissions',
75
- 'form.permissionDefault': 'Default (as configured in DSH)','form.permissionReadonly': 'Read-only', 'form.permissionWrite': 'Workspace write','form.permissionFull': 'Full', 'list.runningNow': 'Running now','history.openSession': 'Open session', 'form.notifyTitle': 'Telegram notifications','form.notifyTelegram': 'Send the run report to Telegram',
76
- 'form.notifyOnlyFailure': 'Only on failures (onlyOnFailure / silent on success)','form.channelsTitle': 'Delivery channels','form.channelsHint': 'Pick the channels for this task. An explicit selection overrides the Telegram switch above; leave everything unchecked to fall back to it.','form.templateLabel': 'Message template (optional)',
77
- 'form.templatePlaceholder': 'โฐ {title} โ€” {status} in {duration}','form.templateHint': 'Variables: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}. Empty = built-in text.',
78
- '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.',
79
- 'form.channelTelegram': 'Telegram', 'form.channelKanban': 'dsh-kanban card','form.channelDiscord': 'Discord', 'form.channelSlack': 'Slack','form.channelNtfy': 'ntfy', 'form.channelBark': 'Bark','form.channelPushplus': 'PushPlus', 'form.channelTts': 'Voice (dsh-tts)','form.channelGitea': 'Gitea issue', 'settings.deliverySection': 'Delivery channels',
80
- 'settings.secretsSection': 'Credentials (references)','settings.secretsHint': 'Enter the NAME of a DSH credential, not the secret itself. Secrets stay in the credentials store.','settings.telegramSection': 'Telegram', 'settings.templatesSection': 'Message templates','settings.channelTemplateLabel': 'Template for {channel}',
81
- 'settings.botTokenRefLabel': 'Bot token credential name','settings.botTokenRefPlaceholder': 'e.g. TELEGRAM_BOT_TOKEN','settings.apiTokenLabel': 'External API token','settings.apiTokenPlaceholder': 'Bearer token for /dsh-cron/api/* (empty = disabled)','settings.discordLabel': 'Discord webhook URL', 'settings.slackLabel': 'Slack webhook URL',
82
- 'settings.ntfyUrlLabel': 'ntfy server URL', 'settings.ntfyTopicLabel': 'ntfy topic','settings.ntfyTokenRefLabel': 'ntfy token credential name','settings.barkServerLabel': 'Bark server URL', 'settings.barkKeyLabel': 'Bark device key','settings.pushplusTokenRefLabel': 'PushPlus token credential name','settings.pushplusUrlLabel': 'PushPlus endpoint',
83
- 'settings.ttsBaseUrlLabel': 'dsh-tts base URL', 'settings.giteaBaseUrlLabel': 'Gitea base URL','settings.giteaRepoLabel': 'Gitea repository (owner/repo)','settings.giteaTokenRefLabel': 'Gitea token credential name','settings.templateLabel': 'Default message template',
84
- 'settings.templateHint': 'Applies to every channel without its own template. Empty = built-in text.','settings.deliveryTimeoutMsLabel': 'Delivery timeout per channel (ms)','settings.automationSection': 'Automation models',
85
- 'settings.automationHint': 'Models used for the small helper calls (rule evaluation, failure analysis). Leave empty to use the task model.','settings.silentRuleModelLabel': 'Model for silent rules','settings.secretsOnCard': 'Credentials referenced from the settings panel are shown masked and stored by name.',
86
- 'form.nextRunLabel': 'Next run: ', 'form.notScheduled': 'not scheduled','settings.loading': 'Loading settings...','settings.unavailable': 'Settings are unavailable right now.', 'settings.retry': 'Retry','settings.cardTitle': 'โฐ Task scheduler (Cron)',
87
- 'settings.cardDesc': 'Scheduled task execution (cron/intervals), background agent scenarios, and delivery of run reports to Telegram, Discord, Slack, ntfy, Bark, PushPlus, voice and Gitea.','settings.openPanel': 'Open task panel','settings.modalTitle': 'Notifications & delivery channels','settings.tokenLabel': 'Telegram Bot Token',
88
- 'settings.tokenPlaceholder': '123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ','settings.tokenPlaceholderDefault': 'Using the bot configured in DSH settings (or enter your own)','settings.defaultHint': 'โœ“ A configured bot was found in the DSH profile','settings.chatIdLabel': 'Telegram Chat ID','settings.chatIdPlaceholder': 'For example: 345678901',
89
- 'settings.kanbanUrlLabel': 'Kanban Base URL','settings.globalNotify': 'Deliver reports of all tasks to Telegram globally','settings.globalOnlyFailure': 'Global mode: only on failures (silent on success)','settings.dynamicCredentials': 'Dynamic Credentials Resolution (credential://...)',
90
- 'settings.dynamicCredentialsHint': 'Resolve credential://... in memory from harness credentials at runtime (#335)','settings.showChatHeaderButton': 'Show schedule button in chat header','settings.showChatHeaderActions': 'Show quick create action in chat header','settings.testTelegram': '๐Ÿ”” Test Telegram delivery', 'settings.testKanban': '๐Ÿ“‹ Test Kanban',
91
- 'settings.sending': 'Sending...', 'settings.checkingKanban': 'Checking Kanban...','settings.testOk': 'โœ… Test message delivered to Telegram!', 'settings.testFail': 'โŒ {error}','settings.kanbanOk': 'โœ… Kanban card created', 'settings.kanbanFail': 'โŒ {error}','settings.save': 'Save settings', 'settings.saved': 'โœ“ Saved',
92
- 'settings.saveError': 'Save failed: {error}', 'settings.saveErrorUnknown': 'unknown error','updater.title': 'Plugin Auto-Updater', 'updater.btnCheck': 'Check for updates','updater.checking': 'Checking...', 'updater.btnUpdate': 'Update to v{version}','updater.updating': 'Updating...',
93
- 'updater.desc': 'Check npm registry and install plugin updates in-place without SSH access.','updater.current': 'Current version: v{version}','updater.available': 'Update available: v{version}', 'updater.upToDate': 'Up to date','updater.success': 'Successfully updated to v{version}. Please restart DSH or reload profile to apply changes.',
94
- 'dsh.modalTitle': 'Schedule a task with the DSH agent','dsh.descLabel': 'Describe the task and the desired frequency:','dsh.placeholder': 'For example: check free disk space and failed systemd services every 2 hours, and alert only if something is wrong...','dsh.sendHint': 'Ctrl+Enter to send', 'dsh.sendTitle': 'Send to agent',
95
- 'dsh.startFailed': 'Failed to start the agent dialog: {error}','dsh.launchError': 'Launch failed: {error}', 'confirm.delete': 'Delete this task?','list.loadErrorPrefix': 'Failed to load tasks', 'actions.dryRun': 'Dry run','actions.dryRunTitle': 'Dry run (test execution without side effects or notifications)',
96
- 'actions.archive': 'Archive', 'actions.archiveTitle': 'Execution archive and logs','dryRun.title': '๐Ÿงช Dry Run Simulation', 'dryRun.task': 'Task','dryRun.status': 'Simulation Status', 'dryRun.duration': 'Duration','dryRun.output': 'Simulated Output', 'dryRun.preflight': 'Preflight Check','dryRun.close': 'Close', 'archive.title': '๐Ÿ“œ Execution Archive',
97
- 'archive.totalRuns': '{total} total runs recorded','archive.empty': 'No archived runs recorded for this task yet.','archive.loadMore': 'Load more ({shown} of {total})', 'archive.close': 'Close','form.reliabilityTitle': '๐Ÿ›ก๏ธ Reliability, Heartbeat & Self-Healing','form.preflightLabel': 'Pre-flight check', 'form.preflightNone': 'None',
98
- 'form.preflightHttp': 'HTTP (2xx probe)', 'form.preflightShell': 'Shell command (exit code 0)','form.preflightDisk': 'Disk space (path:minPercent)','form.preflightTargetLabel': 'Pre-flight target','form.preflightTargetPlaceholder': 'https://example.com/healthz OR ls /data OR /:10%','form.heartbeatIntervalLabel': 'Heartbeat deadline (seconds, 0 = disabled)',
99
- 'form.gracePeriodLabel': 'Heartbeat grace period (seconds)','form.priorityLabel': 'Queue priority (1-10, higher runs first)','form.concurrencyGroupLabel': 'Concurrency group','form.workWindowHoursLabel': 'Allowed work hours (e.g. 22:00-07:00)','form.workWindowHoursPlaceholder': 'e.g. 22:00-07:00 or 09:00-18:00',
100
- 'form.workWindowPolicyLabel': 'Outside window policy','form.workWindowPolicySkip': 'Skip execution (record skipped)','form.workWindowPolicyDefer': 'Defer until window opens','form.timeBoxMinutesLabel': 'Timebox deadline (minutes, 0 = unlimited)','form.wakeTriggerTypeLabel': 'Event wake trigger','form.wakeTriggerTypeNone': 'None (Schedule / Cron only)',
101
- 'form.wakeTriggerTypeFileCount': 'File count threshold (batch run)','form.wakeTriggerTypeMarkerFile': 'Marker file receipt (flag file)','form.wakeTriggerTypeProcessExit': 'Process exit watcher (PID / pidFile)','form.wakeTriggerPathLabel': 'Trigger target path (dir / marker / pidfile)',
102
- 'form.wakeTriggerPathPlaceholder': 'e.g. incoming/ or build.ready or run.pid','form.wakeTriggerMinCountLabel': 'Min file count','form.wakeTriggerConsumeLabel': 'Consume / delete marker after trigger','form.writeScopesLabel': 'Write scopes (Scope Locks, relative paths per line or comma)',
103
- 'form.writeScopesPlaceholder': 'e.g. src/, docs/ (prevents concurrent writes on overlapping scopes)','form.inputHashPathsLabel': 'Input hash paths (inputHashPaths)','form.inputHashPathsPlaceholder': 'e.g. src/, package.json (skip run if unchanged)','form.skipIfUnchangedLabel': 'Skip execution if inputs are unchanged (save tokens & budget)',
104
- 'form.selfHealingLabel': 'Self-healing runbook command (shell)','form.selfHealingPlaceholder': 'systemctl restart app || true','form.autoDiagnoseLabel': 'Auto-diagnose failures with AI agent','form.agentPresetLabel': 'Agent preset','form.agentPresetPlaceholder': 'standard (leave empty for configured default)',
105
- 'form.agentPresetHint': 'Agent preset from dsh-agent-presets (e.g. standard, minimal, cordis, ptc). Mounts workspace and coding tools.','form.sessionTitleLabel': 'Session Title Template','form.sessionTitlePlaceholder': 'e.g. {{date}} a-share-review (supports {{date}})',
106
- 'form.sessionTitleHint': 'Name given to agent sessions created by this task. Supports {{date}} for YYYY-MM-DD. Defaults to "<YYYY-MM-DD> <title>".','form.targetSessionIdLabel': 'Target persistent session ID','form.targetSessionIdPlaceholder': 'e.g. audit-chat or dev-summary (empty = isolated run)',
107
- 'form.targetSessionIdHint': 'When specified, scheduled runs resume this session to maintain conversation context across runs instead of creating a new isolated session.','form.targetSessionResetLabel': 'Session context rotation','form.targetSessionResetNever': 'Continuous (never reset)',
108
- 'form.targetSessionResetDaily': 'Daily rotation (new session each day)','form.targetSessionResetWeekly': 'Weekly rotation (new session each week)','form.targetSessionResetHint': 'Automatically rotates the session identifier to prevent context window explosion over long periods.','form.requireApprovalLabel': 'Require human approval before execution',
109
- 'form.requireApprovalHint': 'When enabled, the task will not execute until an authorized user approves the run proposal (#318).','actions.approve': 'Approve', 'actions.reject': 'Reject','approval.waiting': 'Awaiting human approval','approval.approved': 'Approved', 'approval.rejected': 'Rejected',
110
- 'chainGraph.modalTitle': 'Visual Chain & Checkpoint Graph', 'chainGraph.viewGraph': 'Chain Graph','chainGraph.noNodes': 'No chained steps found for this task or run.', 'chainGraph.retryStep': 'Retry Step',
111
- 'chainGraph.stepSuccess': 'Success', 'chainGraph.stepFailed': 'Failed', 'chainGraph.stepPending': 'Pending', 'chainGraph.close': 'Close', 'chainGraph.decisionNode': 'Decision Node', 'chainGraph.stepSkipped': 'Skipped', 'history.doctorDiagnosis': 'Doctor Diagnosis & Suggested Fix', 'history.doctorApply': '1-Click Apply Fix', 'history.doctorRevert': 'Revert to Previous Code', 'history.autoHealed': 'Auto-Healed by Doctor', 'form.autoHealLabel': 'Autonomous Self-Healing Doctor', 'form.autoHealHint': 'Automatically diagnose and apply safe fixes upon failure (max 1 auto-patch/day)', 'form.elseTaskLabel': 'Default Fallback Task (elseTask)', 'form.elseTaskHint': 'Target task to trigger if no conditional branch rules matched', 'form.elseTaskPlaceholder': 'e.g. task-fallback',
112
- 'adaptive.badge': 'Adaptive', 'adaptive.idle': 'idle', 'adaptive.backoff': 'backoff','form.adaptiveEnabled': 'Adaptive Polling', 'form.adaptiveHint': 'Exponential backoff when no changes are detected','liveLog.modalTitle': 'Real-Time Streaming Execution Logs', 'liveLog.viewLog': 'Live Stream',
113
- 'liveLog.autoScroll': 'Auto-scroll', 'liveLog.connecting': 'Connecting to log stream...', 'liveLog.waiting': 'Waiting for runner output...', 'liveLog.completed': 'Execution stream completed', 'liveLog.close': 'Close Stream','timeline.modalTitle': '24-Hour Schedule Timeline', 'timeline.buttonLabel': 'Timeline',
114
- 'timeline.buttonTitle': 'View 24-hour projected schedule and concurrency timeline','timeline.tabTimeline': 'Schedule Timeline', 'timeline.legendDesc': 'Projected run distribution across 24 hourly buckets:','timeline.peakWarning': 'Peak concurrency warning','heatmap.modalTitle': 'Cost & Token Burn Heatmap', 'heatmap.buttonLabel': 'Heatmap',
115
- 'heatmap.tabHeatmap': 'Cost Heatmap', 'heatmap.matrixDesc': 'Weekly hour-of-day cost concentration (7 days ร— 24 hours):','digest.modalTitle': 'Automation & Cost Digest', 'digest.buttonLabel': 'Digest','digest.buttonTitle': 'View 7-day or 30-day automation analytics and cost digest','digest.period7': 'Last 7 Days', 'digest.period30': 'Last 30 Days',
116
- 'digest.executions': 'Executions', 'digest.tokens': 'Tokens', 'digest.cost': 'Cost (USD)', 'digest.fleet': 'Automations','digest.unstableTitle': 'Top Unstable Automations', 'digest.expensiveTitle': 'Top Resource Consumers','digest.sendTelegram': 'Send to Telegram', 'digest.copyMarkdown': 'Copy Markdown', 'digest.copied': 'Copied!',
117
- 'digest.sentSuccess': 'Sent to Telegram successfully!','prompt.version': 'Prompt Version', 'prompt.rollback': 'Restore v', 'prompt.history': 'Prompt History', 'prompt.successRate': 'SR','form.chainingTitle': 'Chaining & DAG Orchestration', 'form.onSuccessLabel': 'On Success Trigger (Task IDs)',
118
- 'form.onSuccessHint': 'Comma-separated task IDs to execute upon success (Fan-Out)','form.onFailureLabel': 'On Failure Trigger (Task IDs)', 'form.onFailureHint': 'Comma-separated task IDs to execute upon failure','form.dependsOnLabel': 'Dependencies (dependsOn)', 'form.dependsOnHint': 'Wait for these task IDs before executing (Fan-In barrier)',
119
- 'form.joinPolicyLabel': 'Join Policy', 'form.joinPolicyAll': 'All Prerequisites (all_success)', 'form.joinPolicyAny': 'Any Prerequisite (any_success)','recipe.dependenciesMissing': 'Missing required integrations or credentials','form.previewSchedule': 'Preview next runs','form.previewScheduleTitle': 'Next 5 scheduled runs:',},zh: {
120
- 'sidebar.label': 'ๅฎšๆ—ถไปปๅŠก', 'sidebar.jobsTitle': '่ฟ่กŒไธญไปปๅŠก','sidebar.noActiveJobs': 'ๆ— ่ฟ่กŒไธญไปปๅŠก', 'sidebar.moreJobs': 'ๅŠๅฆๅค– {count} ไธช','sessionBar.addRecurring': '+ ๅฎšๆ—ถไปปๅŠก','sessionBar.addRecurringHint': 'ๅฐ†ๅฝ“ๅ‰ไผš่ฏ่ฝฌไธบๅฎšๆ—ถ่ฎกๅˆ’ไปปๅŠก','sessionBar.run': '่ฟ่กŒ','sessionBar.runNow': '็ซ‹ๅณๆ‰ง่กŒ','sessionBar.running': 'ๆ‰ง่กŒไธญ...','chip.title': 'ๅฎšๆ—ถไปปๅŠก (Cron)', 'panel.back': '่ฟ”ๅ›žๅฏน่ฏ',
121
- 'panel.title': 'ๅฎšๆ—ถไปปๅŠก', 'panel.subtitle': '่ฎฉ DSH ่ง„ๅˆ’ไปปๅŠกใ€่ฎพ็ฝฎๆ้†’ๆˆ–่ทŸ่ธช็Šถๆ€','actions.create': 'ๆ–ฐๅปบ', 'actions.createWithDsh': '๐Ÿ’ฌ ่ฎฉ DSH ๅˆ›ๅปบ','actions.setupManually': 'โœ๏ธ ๆ‰‹ๅŠจ้…็ฝฎ', 'actions.runNow': '็ซ‹ๅณ่ฟ่กŒ','actions.runNowShort': '่ฟ่กŒ', 'actions.edit': '็ผ–่พ‘ / ่ฏฆๆƒ…','actions.duplicate': 'ๅคๅˆถไปปๅŠก', 'actions.tuneWithDsh': '่ฎฉ DSH ไผ˜ๅŒ–',
122
- 'tune.startFailed': 'ๆ— ๆณ•ๅฏๅŠจไผ˜ๅŒ–ไผš่ฏ: {error}', 'actions.delete': 'ๅˆ ้™คไปปๅŠก','duplicate.done': 'ๅทฒๅˆ›ๅปบๅ‰ฏๆœฌๅนถๅค„ไบŽๆš‚ๅœ็Šถๆ€๏ผšๆขๅคๅ‰่ฏทๅ…ˆๆ ธๅฏน่ฐƒๅบฆๆ—ถ้—ดใ€‚', 'duplicate.oneShotHint': '่ฏฅๅ‰ฏๆœฌไธบไธ€ๆฌกๆ€งไปปๅŠกไธ”ๅทฒๆš‚ๅœ๏ผŒ่ฏท่ฎพๅฎšๆ–ฐ็š„ๆ‰ง่กŒๆ—ถ้—ดๅŽๅ†ๅฏ็”จใ€‚','duplicate.failed': 'ๅคๅˆถไปปๅŠกๅคฑ่ดฅ: {error}', 'transfer.exportTitle': 'ๅฏผๅ‡บไปปๅŠก','transfer.importTitle': 'ๅฏผๅ…ฅไปปๅŠก', 'transfer.exported': 'ๅทฒๆˆๅŠŸๅฏผๅ‡บ {count} ไธชไปปๅŠกใ€‚',
123
- 'transfer.exportFailed': 'ๅฏผๅ‡บๅคฑ่ดฅ: {error}', 'transfer.importTitleModal': 'ๅฏผๅ…ฅไปปๅŠก','transfer.importHint': 'ไป…ๅฏผๅ‡บไปปๅŠก้™ๆ€้…็ฝฎ๏ผšไธๅŒ…ๅซๅކๅฒ่ฎฐๅฝ•ไธŽ่ฎกๆ•ฐๅ™จใ€‚ๆธ ้“้€š่ฟ‡ๅ‡ญๆฎๅ็งฐๅผ•็”จ๏ผ›ๆณจๆ„ๅฎŒๆ•ดๅฏผๅ‡บไฟ็•™่‡ชๅฎšไน‰็Žฏๅขƒๅ˜้‡ๅ’Œ HTTP ่ฏทๆฑ‚ๅคดใ€‚', 'transfer.exportPrompt': '้€‰ๆ‹ฉๅฏผๅ‡บๆจกๅผ๏ผš\n็กฎๅฎš = ๅ‡€ๅŒ–ๅฏผๅ‡บ๏ผˆ็งป้™ค่‡ชๅฎšไน‰็Žฏๅขƒๅ˜้‡ไธŽ่ฏทๆฑ‚ๅคด๏ผ‰\nๅ–ๆถˆ = ๅฎŒๆ•ดๅŽŸๅง‹ๅฏผๅ‡บ','transfer.strategyAdd': 'ไฝœไธบๆ–ฐไปปๅŠกๅฏผๅ…ฅ๏ผˆๅˆ†้…ๆ–ฐ ID๏ผ‰', 'transfer.strategyReplace': '่ฆ†็›–ๅŒ ID ไปปๅŠก',
124
- 'transfer.strategySkip': '่ทณ่ฟ‡ๅทฒๅญ˜ๅœจ็š„ๅŒ ID ไปปๅŠก', 'transfer.summary': '่ฏฅๆ–‡ไปถๅŒ…ๅซ {total} ไธชไปปๅŠก๏ผš{add} ไธชๆ–ฐๅขž๏ผŒ{replace} ไธช่ฆ†็›–๏ผŒ{skip} ไธช่ทณ่ฟ‡ใ€‚','transfer.confirm': 'ๅผ€ๅง‹ๅฏผๅ…ฅ', 'transfer.imported': 'ๅทฒๆˆๅŠŸๅฏผๅ…ฅ {count} ไธชไปปๅŠกใ€‚','transfer.importFailed': 'ๅฏผๅ…ฅๅคฑ่ดฅ: {error}', 'transfer.badFile': 'ๆ‰€้€‰ๆ–‡ไปถไธๆ˜ฏๆœ‰ๆ•ˆ็š„ JSON ๅฏผๅ‡บๆ–‡ไปถ: {error}','actions.pause': 'ๆš‚ๅœ', 'actions.resume': 'ๆขๅค',
125
- 'actions.settings': '้€š็ŸฅไธŽๆธ ้“่ฎพ็ฝฎ', 'search.placeholder': 'ๆœ็ดขๅฎšๆ—ถไปปๅŠก','filters.title': '็ญ›้€‰', 'filters.type': '็ฑปๅž‹','filters.model': 'ๆจกๅž‹', 'filters.channel': 'ๆธ ้“','filters.any': 'ๅ…จ้ƒจ', 'filters.reset': '้‡็ฝฎ็ญ›้€‰','filters.empty': 'ๆฒกๆœ‰ๅŒน้…ๅฝ“ๅ‰็ญ›้€‰ๆกไปถ็š„ไปปๅŠกใ€‚', 'filters.showing': 'ๆ˜พ็คบ {shown} / ๅ…ฑ {total}','stats.activeTasks': 'ๆดป่ทƒไปปๅŠก', 'stats.totalRuns': 'ๆ€ป่ฟ่กŒๆฌกๆ•ฐ',
126
- 'stats.totalTokens': 'ๆถˆ่€— Token', 'stats.totalCost': '้ข„ไผฐๆˆๆœฌ','tabs.all': 'ๅ…จ้ƒจ', 'tabs.active': '่ฟ่กŒไธญ','tabs.paused': 'ๅทฒๆš‚ๅœ', 'tabs.completed': 'ๅทฒๅฎŒๆˆ','banner.loadError': 'ๅŠ ่ฝฝไปปๅŠกๅคฑ่ดฅ: {error}', 'banner.retry': '้‡่ฏ•','list.loading': 'ๆญฃๅœจๅŠ ่ฝฝๅฎšๆ—ถไปปๅŠก...', 'list.empty': 'ๆš‚ๆ— ๅฎšๆ—ถไปปๅŠก','list.typeShell': 'Shell ่„šๆœฌ', 'list.typeLlm': 'LLM ๆ™บ่ƒฝไฝ“',
127
- 'list.oneShot': 'ไธ€ๆฌกๆ€ง', 'list.configManaged': '้…็ฝฎๅช่ฏป','list.configManagedHint': '็”ฑ้…็ฝฎๆ–‡ไปถไธญ็š„ config.jobs ๅฃฐๆ˜Ž๏ผ›่ฆไฟฎๆ”นๆˆ–ๅˆ ้™ค่ฏท็ผ–่พ‘่ฏฅๆ–‡ไปถ', 'list.next': ' ยท ไธ‹ๆฌก: {time}','recs.title': 'ๆŽจ่ไปปๅŠก', 'recs.hint': 'ๅผ€็ฎฑๅณ็”จ็š„้…ๆ–นใ€‚็‚นไธ€ไธ‹ๅฐฑไผšๆŠŠ่กจๅ•ๅกซๅฅฝโ€”โ€”ไฟๅญ˜ไน‹ๅ‰ไธไผšๅˆ›ๅปบไปปไฝ•ไปปๅŠกใ€‚','modal.editTitle': '็ผ–่พ‘ไปปๅŠก', 'modal.newTitle': 'ๆ–ฐๅปบๅฎšๆ—ถไปปๅŠก','modal.statusActive': 'ๆดป่ทƒ', 'modal.statusPaused': 'ๅทฒๆš‚ๅœ',
128
- 'modal.params': '้…็ฝฎๅ‚ๆ•ฐ', 'modal.history': '่ฟ่กŒๅކๅฒ ({count})','modal.cancel': 'ๅ–ๆถˆ', 'modal.confirmDiscard': 'ๆ”พๅผƒๆœชไฟๅญ˜็š„ๅ†…ๅฎน๏ผŸ','modal.save': 'ไฟๅญ˜ไฟฎๆ”น', 'modal.create': 'ๅˆ›ๅปบไปปๅŠก','modal.close': 'ๅ…ณ้—ญ', 'history.loading': 'ๆญฃๅœจๅŠ ่ฝฝๅކๅฒ่ฎฐๅฝ•...','history.empty': 'ๆš‚ๆ— ่ฟ่กŒ่ฎฐๅฝ•', 'history.stoppedReasonTitle': 'ๅœๆญขๅŽŸๅ› :','history.retryDelivery': '้‡่ฏ•ๆŽจ้€', 'history.retryingDelivery': 'ๆญฃๅœจ้‡่ฏ•...',
129
- 'history.statusValidationFailed': 'ๆ ก้ชŒๅคฑ่ดฅ', 'history.stage_queue': 'ๆŽ’้˜Ÿ','history.stage_preflight': '้ข„ๆฃ€', 'history.stage_execution': 'ๆ‰ง่กŒ','history.stage_validation': 'ๆ ก้ชŒ', 'history.stage_delivery': 'ๆŽจ้€','history.refresh': 'ๅˆทๆ–ฐๅކๅฒ', 'history.statusSuccess': 'ๆˆๅŠŸ','history.statusUncertain': 'ไธ็กฎๅฎš', 'history.artifacts': 'ไบง็‰ฉๆ–‡ไปถ',
130
- 'history.resolveCompleted': 'ๆ ‡่ฎฐๅทฒๅฎŒๆˆ', 'history.resolveFailed': 'ๆ ‡่ฎฐๅคฑ่ดฅ','history.statusUncertainHint': 'ๆœๅŠก้‡ๅฏไธญๆ–ญ โ€” ่ฏท็กฎ่ฎค็ป“ๆžœ', 'history.statusSkipped': 'ๅทฒ่ทณ่ฟ‡','history.statusMissed': 'ๅทฒ้”™่ฟ‡', 'history.statusTimeout': '่ถ…ๆ—ถ','history.statusFailed': 'ๅคฑ่ดฅ', 'form.nameLabel': 'ไปปๅŠกๅ็งฐ','form.namePlaceholder': 'ไพ‹ๅฆ‚: dsh-tags-watch', 'form.typeLabel': 'ๆ‰ง่กŒ็ฑปๅž‹ *',
131
- 'form.typeLlm': 'LLM๏ผˆAI ๆ™บ่ƒฝไฝ“๏ผ‰', 'form.typeScript': 'Shell ๅ‘ฝไปค / ่„šๆœฌ','form.typeNode': 'Node.js', 'form.typePython': 'Python','form.typeHttp': 'HTTP ่ฏทๆฑ‚ / Webhook', 'form.typeSsh': '่ฟœ็จ‹ SSH','form.typeDocker': 'Docker ๅฎนๅ™จ', 'form.typeSkill': 'DSH ๆŠ€่ƒฝ','form.typeWorkflow': 'DSH ๅทฅไฝœๆต',
132
- 'form.typeDigest': 'ๆฏๆ—ฅ/ๅฎšๆœŸ็ฎ€ๆŠฅ (Daily Digest)', 'form.envLabel': '็Žฏๅขƒๅ˜้‡ (KEY=VALUE, ๆฏ่กŒไธ€ไธช)','form.envPlaceholder': 'NODE_ENV=production\nTZ=Europe/Berlin', 'form.envHint': 'ไป…ๅฏน้ž LLM ่ฟ่กŒๆ—ถ็”Ÿๆ•ˆใ€‚ไธ่ฆๅœจ่ฟ™้‡Œๅญ˜ๆ”พๅฏ†้’ฅใ€‚','form.cwdLabel': 'ๅทฅไฝœ็›ฎๅฝ• (็ปๅฏน่ทฏๅพ„)', 'form.workspaceLabel': 'ๅทฅไฝœๅŒบ ID ๆˆ–่ทฏๅพ„๏ผˆๅฏ้€‰๏ผ‰',
133
- 'form.worktreeLabel': 'ๅœจ็‹ฌ็ซ‹็š„ไธดๆ—ถ Git Worktree ไธญๆ‰ง่กŒ', 'form.keepWorktreeLabel': 'ๆ‰ง่กŒ็ป“ๆŸๅŽไฟ็•™ Git Worktree (ไธ่‡ชๅŠจๆธ…็†)','form.httpMethodLabel': 'HTTP ๆ–นๆณ•', 'form.httpUrlLabel': 'URL','form.httpHeadersLabel': '่ฏทๆฑ‚ๅคด๏ผˆJSON๏ผŒๅฏ้€‰๏ผ‰', 'form.httpBodyLabel': '่ฏทๆฑ‚ไฝ“๏ผˆๅฏ้€‰๏ผ‰','form.sshProfileLabel': 'dsh-remote-workspace ้…็ฝฎ ID', 'form.sshProfileHint': 'ๆŽจ่็”จๆณ•๏ผšไธปๆœบไธŽๅ‡ญๆฎ้ƒฝๆ”พๅœจ remote-workspace ๆ’ไปถ้‡Œใ€‚',
134
- 'form.sshTargetLabel': 'ๅค‡็”จ็›ฎๆ ‡๏ผˆuser@host๏ผŒๅฏ้€‰๏ผ‰', 'form.sshKeyLabel': '็ง้’ฅ่ทฏๅพ„๏ผˆๅค‡็”จ๏ผŒๅฏ้€‰๏ผ‰','form.dockerImageLabel': 'ๅฎนๅ™จ้•œๅƒ', 'form.skillNameLabel': 'ๆŠ€่ƒฝๅ็งฐ','form.workflowNameLabel': 'ๅทฅไฝœๆตๅ็งฐ', 'form.scheduleLabel': '่ฐƒๅบฆ่ฎกๅˆ’ (Cron ๆˆ–็›ธๅฏนๆ—ถ้—ด) *','form.schedulePlaceholder': 'ไพ‹ๅฆ‚: 0 9 * * 1-5 ๆˆ– 15m ๆˆ– in 2 hours', 'form.timeoutLabel': '่ถ…ๆ—ถๆ—ถ้—ด (็ง’)',
135
- 'form.overlapLabel': 'ๅนถๅ‘็ญ–็•ฅ', 'form.overlapSkip': '่ทณ่ฟ‡ (้ป˜่ฎค)','form.overlapQueue': 'ๆŽ’้˜Ÿ็ญ‰ๅพ…', 'form.overlapReplace': 'ๅ–ๆถˆๅฝ“ๅ‰่ฟ่กŒๅนถ้‡ๆ–ฐๅผ€ๅง‹ (replace)','form.kanbanLabel': '็œ‹ๆฟๅŒๆญฅๆจกๅผ', 'form.kanbanNone': 'ไธๅŒๆญฅๅˆฐ็œ‹ๆฟ','form.kanbanOnFailure': 'ๅคฑ่ดฅๆ—ถๅˆ›ๅปบๅทฅๅ•๏ผˆ่ฟ› Backlog๏ผ‰', 'form.kanbanAlways': 'ๆฏๆฌกๅฎŒๆˆ้ƒฝๅปบๅก็‰‡๏ผˆDone / Backlog๏ผ‰','form.providerLabel': 'LLM ๆœๅŠกๅ•†', 'form.providerDefault': '้ป˜่ฎค๏ผˆDSH๏ผ‰',
136
- 'form.modelLabel': 'AI ๆจกๅž‹', 'form.modelDefault': '้ป˜่ฎคๆจกๅž‹','form.silentRuleLabel': '้™้ป˜่ง„ๅˆ™ (ๅฏ้€‰)', 'form.silentRulePlaceholder': 'ไพ‹ๅฆ‚: ALL_OK ๆˆ– status == 200','form.silentRuleHint': '่‹ฅ่พ“ๅ‡บ็ฌฆๅˆๆญค่ง„ๅˆ™๏ผŒๅฐ†ไธๅ‘้€ไปปไฝ•้€š็Ÿฅใ€‚', 'history.silentSkip': 'ไฟๆŒ้™้ป˜:','history.diagnosis': '่ฏŠๆ–ญ', 'history.applySuggestion': '็”จ่ฟ™ๆกๅปบ่ฎฎๆ‰“ๅผ€็ผ–่พ‘่กจๅ•',
137
- 'form.inspectOnFailureLabel': '็”จๆจกๅž‹่ฏŠๆ–ญๅคฑ่ดฅๅŽŸๅ› ', 'form.inspectOnFailureHint': '่ฟ่กŒๅคฑ่ดฅๅŽ๏ผŒ็”ฑๆจกๅž‹่ฏปไธ€้ๆ็คบ่ฏใ€้”™่ฏฏๅ’Œ่พ“ๅ‡บ๏ผŒๆŠŠ่ฏŠๆ–ญ็ป“่ฎบๅ’Œไฟฎๆ”นๅปบ่ฎฎ้š่ฟ™ๆฌก่ฟ่กŒไธ€่ตทไฟๅญ˜ใ€‚ไธไผš่‡ชๅŠจๅบ”็”จไปปไฝ•ๆ”นๅŠจใ€‚','settings.inspectorModelLabel': 'ๅคฑ่ดฅ่ฏŠๆ–ญๆจกๅž‹', 'form.fallbackModelLabel': 'ๅค‡็”จๆจกๅž‹ (ไธปๆจกๅž‹ๅคฑ่ดฅๆ—ถไฝฟ็”จ)','form.fallbackModelPlaceholder': 'ไพ‹ๅฆ‚: deepseek-reasoner', 'form.fallbackModelHint': 'ไธปๆจกๅž‹่ฟ่กŒๅคฑ่ดฅๆ—ถ๏ผŒ็”จ่ฟ™ไธชๆจกๅž‹ๅ†่ฏ•ไธ€ๆฌกใ€‚ไธคๆฌกๅฐ่ฏ•้ƒฝ่ฎกๅ…ฅๆˆๆœฌใ€‚',
138
- 'form.promptLabelScript': 'Shell ๅ‘ฝไปคๆˆ–่„šๆœฌ', 'form.promptLabelLlm': '็ป™ๆ™บ่ƒฝไฝ“็š„ๆŒ‡ไปค / ๆ็คบ่ฏ','form.promptPlaceholderScript': 'curl -fsSL https://... || exit 1', 'form.promptPlaceholderLlm': '็ฒพ็กฎๆ่ฟฐๆ™บ่ƒฝไฝ“่ฆๅšไป€ไนˆ...','form.timezoneLabel': 'ๆ—ถๅŒบ (IANA ๆ—ถๅŒบๅ)', 'form.timezonePlaceholder': 'ไพ‹ๅฆ‚: Asia/Shanghai ๆˆ– UTC (็•™็ฉบไฝฟ็”จๆœๅŠกๅ™จๆ—ถๅŒบ)',
139
- 'form.misfireLabel': '้”™่ฟ‡ๆ‰ง่กŒ็ญ–็•ฅ (Misfire Policy)', 'form.misfireSkip': '่ทณ่ฟ‡ (้ป˜่ฎค)','form.misfireRunOnce': '่กฅ่ท‘ไธ€ๆฌก', 'form.misfireCatchUp': '่ฟŸๅˆฐๆ—ถ่กฅ่ท‘ไธ€ๆฌกๅนถ่ฎฐๅฝ•็ผบๅฃ (catchUpAll)','form.retriesLabel': 'ๅคฑ่ดฅ่‡ชๅŠจ้‡่ฏ•ๆฌกๆ•ฐ๏ผˆ0 = ๅ…ณ้—ญ๏ผ‰', 'form.permissionLabel': 'ไผš่ฏๆƒ้™','form.permissionDefault': '้ป˜่ฎค (็ปงๆ‰ฟไธป้…็ฝฎ)', 'form.permissionReadonly': 'ๅช่ฏป',
140
- 'form.permissionWrite': 'ๅทฅไฝœๅŒบๅ†™ๅ…ฅ', 'form.permissionFull': 'ๅฎŒๅ…จ่ฎฟ้—ฎๆƒ้™','list.runningNow': 'ๆญฃๅœจ่ฟ่กŒ', 'history.openSession': 'ๆ‰“ๅผ€ไผš่ฏ','form.notifyTitle': 'Telegram ้€š็Ÿฅ', 'form.notifyTelegram': 'ๆŠŠ่ฟ่กŒๆŠฅๅ‘Šๅ‘้€ๅˆฐ Telegram','form.notifyOnlyFailure': 'ไป…ๅคฑ่ดฅๆ—ถๅ‘้€๏ผˆonlyOnFailure / ๆˆๅŠŸ้™้ป˜๏ผ‰', 'form.channelsTitle': 'ๆŽจ้€ๆธ ้“',
141
- 'form.channelsHint': 'ไปปๅŠกๆ‰ง่กŒๅฎŒๆฏ•ๅŽๆŽจ้€ๆŠฅๅ‘Š็š„็›ฎๆ ‡ๆธ ้“ใ€‚', 'form.templateLabel': '่‡ชๅฎšไน‰ๆถˆๆฏๆจกๆฟ','form.templatePlaceholder': 'โฐ {title} โ€” {status}๏ผŒ่€—ๆ—ถ {duration}', 'form.templateHint': 'ๅฏ็”จๅ˜้‡: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}ใ€‚็•™็ฉบไฝฟ็”จๅ†…็ฝฎๆ–‡ๆกˆใ€‚',
142
- '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.',
143
- 'form.channelTelegram': 'Telegram', 'form.channelKanban': 'dsh-kanban ๅก็‰‡','form.channelDiscord': 'Discord', 'form.channelSlack': 'Slack','form.channelNtfy': 'ntfy', 'form.channelBark': 'Bark','form.channelPushplus': 'PushPlus', 'form.channelTts': '่ฏญ้Ÿณ๏ผˆdsh-tts๏ผ‰','form.channelGitea': 'Gitea Issue', 'settings.deliverySection': 'ๆŽจ้€ๆธ ้“',
144
- 'settings.secretsSection': 'ๅ‡ญๆฎ๏ผˆๅผ•็”จ๏ผ‰', 'settings.secretsHint': '่ฟ™้‡Œๅกซ DSH ๅ‡ญๆฎ็š„ใ€Œๅ็งฐใ€๏ผŒไธๆ˜ฏๅฏ†้’ฅๆœฌ่บซใ€‚ๅฏ†้’ฅไฟๅญ˜ๅœจๅ‡ญๆฎๆœๅŠก้‡Œใ€‚','settings.telegramSection': 'Telegram', 'settings.templatesSection': 'ๆถˆๆฏๆจกๆฟ','settings.channelTemplateLabel': '{channel} ็š„ๆถˆๆฏๆจกๆฟ', 'settings.botTokenRefLabel': 'Bot Token ๅ‡ญๆฎๅ็งฐ',
145
- 'settings.botTokenRefPlaceholder': 'ไพ‹ๅฆ‚: TELEGRAM_BOT_TOKEN', 'settings.apiTokenLabel': 'ๅค–้ƒจ API Token','settings.apiTokenPlaceholder': '็”จไบŽ /dsh-cron/api/* ็š„ Bearer token๏ผˆ็•™็ฉบ = ๅ…ณ้—ญ๏ผ‰', 'settings.discordLabel': 'Discord Webhook URL','settings.slackLabel': 'Slack Webhook URL', 'settings.ntfyUrlLabel': 'ntfy ๆœๅŠกๅ™จๅœฐๅ€',
146
- 'settings.ntfyTopicLabel': 'ntfy ไธป้ข˜', 'settings.ntfyTokenRefLabel': 'ntfy Token ๅ‡ญๆฎๅ็งฐ','settings.barkServerLabel': 'Bark ๆœๅŠกๅ™จๅœฐๅ€', 'settings.barkKeyLabel': 'Bark ่ฎพๅค‡ Key','settings.pushplusTokenRefLabel': 'PushPlus Token ๅ‡ญๆฎๅ็งฐ', 'settings.pushplusUrlLabel': 'PushPlus ๆŽฅๅฃๅœฐๅ€','settings.ttsBaseUrlLabel': 'dsh-tts ๆœๅŠกๅœฐๅ€', 'settings.giteaBaseUrlLabel': 'Gitea ๆœๅŠกๅœฐๅ€',
147
- 'settings.giteaRepoLabel': 'Gitea ไป“ๅบ“๏ผˆowner/repo๏ผ‰', 'settings.giteaTokenRefLabel': 'Gitea Token ๅ‡ญๆฎๅ็งฐ','settings.templateLabel': '้ป˜่ฎคๆถˆๆฏๆจกๆฟ', 'settings.templateHint': 'ไฝœ็”จไบŽๆ‰€ๆœ‰ๆฒกๆœ‰ๅ•็‹ฌๆจกๆฟ็š„ๆธ ้“ใ€‚็•™็ฉบ็”จๅ†…็ฝฎๆ–‡ๆกˆใ€‚','settings.deliveryTimeoutMsLabel': 'ๆฏไธชๆธ ้“็š„ๆŽจ้€่ถ…ๆ—ถ๏ผˆๆฏซ็ง’๏ผ‰', 'settings.automationSection': '่‡ชๅŠจๅŒ–ๆจกๅž‹',
148
- 'settings.automationHint': '็”จไบŽ้™้ป˜่ง„ๅˆ™็ ”ๅˆคๅ’Œๆ•…้šœ่ฏŠๆ–ญ็š„่พ…ๅŠฉๆจกๅž‹ใ€‚็•™็ฉบๆฒฟ็”จไปปๅŠก่‡ช่บซๆจกๅž‹ใ€‚', 'settings.silentRuleModelLabel': '้™้ป˜่ง„ๅˆ™็ ”ๅˆคๆจกๅž‹','settings.secretsOnCard': '่ฎพ็ฝฎไธญๅผ•็”จ็š„ๅ‡ญๆฎๅฐ†ๅœจๅ‰็ซฏ่„ฑๆ•ๅฑ•็คบ๏ผŒๅนถ้€š่ฟ‡ๅ็งฐๅผ•็”จใ€‚', 'form.nextRunLabel': 'ไธ‹ๆฌกๆ‰ง่กŒ: ','form.notScheduled': 'ๆœชๅฎ‰ๆŽ’่ฎกๅˆ’', 'settings.loading': 'ๆญฃๅœจๅŠ ่ฝฝ่ฎพ็ฝฎ...','settings.unavailable': '่ฎพ็ฝฎๅฝ“ๅ‰ไธๅฏ็”จใ€‚', 'settings.retry': '้‡่ฏ•',
149
- 'settings.cardTitle': 'โฐ ๅฎšๆ—ถไปปๅŠก่ฐƒๅบฆๅ™จ (Cron)', 'settings.cardDesc': 'ๅฎšๆ—ถ่ฎกๅˆ’ไปปๅŠก๏ผˆCron/้—ด้š”๏ผ‰ใ€ๅŽๅฐๆ™บ่ƒฝไฝ“ๅœบๆ™ฏไปฅๅŠๆ”ฏๆŒ Telegramใ€Discordใ€Slackใ€ntfyใ€Barkใ€PushPlusใ€่ฏญ้Ÿณๅ’Œ Gitea ็š„้€š็ŸฅๆŽจ้€ใ€‚','settings.openPanel': 'ๆ‰“ๅผ€ไปปๅŠก็ฎก็†็œ‹ๆฟ', 'settings.modalTitle': '้€š็ŸฅไธŽๆธ ้“่ฎพ็ฝฎ','settings.tokenLabel': 'Telegram Bot Token', 'settings.tokenPlaceholder': '123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ',
150
- 'settings.tokenPlaceholderDefault': 'ไฝฟ็”จ DSH ๅ…จๅฑ€้…็ฝฎ็š„ๆœบๅ™จไบบ (ๆˆ–ๅœจๆญค่พ“ๅ…ฅ่‡ชๅฎšไน‰ Token)', 'settings.defaultHint': 'โœ“ ๆฃ€ๆต‹ๅˆฐ DSH ็Žฏๅขƒๅทฒ้…็ฝฎ้ป˜่ฎค Bot','settings.chatIdLabel': 'Telegram Chat ID', 'settings.chatIdPlaceholder': 'ไพ‹ๅฆ‚: 345678901','settings.kanbanUrlLabel': 'Kanban ๆœๅŠกๅŸบ็ก€ๅœฐๅ€', 'settings.globalNotify': 'ๅ…จๅฑ€ๅผ€ๅฏๆ‰€ๆœ‰ไปปๅŠก็ป“ๆžœๆŽจ้€่‡ณ Telegram',
151
- 'settings.globalOnlyFailure': 'ๅ…จๅฑ€ๆจกๅผ๏ผšไป…ๅœจๅคฑ่ดฅๆ—ถๆŽจ้€ (ๆˆๅŠŸ้™้ป˜)', 'settings.dynamicCredentials': 'ๅŠจๆ€ๅ‡ญๆฎ่งฃๆž (credential://...)','settings.dynamicCredentialsHint': '่ฟ่กŒๆ—ถไปŽๅ‡ญๆฎๆœๅŠกๅŠจๆ€่งฃๆž credential://... ไธ”ไธๆณ„้œฒๅˆฐๅญ˜ๅ‚จ (#335)','settings.showChatHeaderButton': 'ๅœจ่Šๅคฉๆ ‡้ข˜ๆ ๆ˜พ็คบๅฎšๆ—ถไปปๅŠกๆŒ‰้’ฎ','settings.showChatHeaderActions': 'ๅœจ่Šๅคฉๆ ‡้ข˜ๆ ๆ˜พ็คบๅฟซ้€Ÿๅˆ›ๅปบๆ“ไฝœ', 'settings.testTelegram': '๐Ÿ”” ๆต‹่ฏ• Telegram ๅ‘้€',
152
- 'settings.testKanban': '๐Ÿ“‹ ๆต‹่ฏ• Kanban', 'settings.sending': 'ๆญฃๅœจๅ‘้€...','settings.checkingKanban': 'ๆญฃๅœจ่ฟžๆŽฅ Kanban...', 'settings.testOk': 'โœ… ๆต‹่ฏ•ๆถˆๆฏๅทฒๆˆๅŠŸๅ‘้€่‡ณ Telegram๏ผ','settings.testFail': 'โŒ ๅ‘้€ๅคฑ่ดฅ: {error}', 'settings.kanbanOk': 'โœ… Kanban ๅก็‰‡ๅˆ›ๅปบๆˆๅŠŸ','settings.kanbanFail': 'โŒ {error}', 'settings.save': 'ไฟๅญ˜่ฎพ็ฝฎ',
153
- 'settings.saved': 'โœ“ ๅทฒไฟๅญ˜', 'settings.saveError': 'ไฟๅญ˜ๅคฑ่ดฅ: {error}','settings.saveErrorUnknown': 'ๆœช็Ÿฅ้”™่ฏฏ', 'updater.title': 'ๆ’ไปถ่‡ชๆ›ดๆ–ฐ','updater.btnCheck': 'ๆฃ€ๆŸฅๆ›ดๆ–ฐ', 'updater.checking': 'ๆญฃๅœจๆฃ€ๆŸฅ...','updater.btnUpdate': 'ๅ‡็บง่‡ณ v{version}', 'updater.updating': 'ๆญฃๅœจๆ›ดๆ–ฐ...','updater.desc': '้€š่ฟ‡ npm ไป“ๅบ“ๅœจ็บฟๆฃ€ๆŸฅๅนถๅฐฑๅœฐๅ‡็บงๆ’ไปถ๏ผŒๆ— ้œ€ SSH ็ปˆ็ซฏๆ“ไฝœใ€‚', 'updater.current': 'ๅฝ“ๅ‰็‰ˆๆœฌ: v{version}',
154
- 'updater.available': 'ๅ‘็Žฐๆ–ฐ็‰ˆๆœฌ: v{version}', 'updater.upToDate': 'ๅทฒๆ˜ฏๆœ€ๆ–ฐ็‰ˆๆœฌ','updater.success': 'ๅทฒๆˆๅŠŸๅ‡็บง่‡ณ v{version}ใ€‚่ฏท้‡ๅฏ DSH ๆˆ–้‡่ฝฝ้…็ฝฎไปฅๅบ”็”จๆ›ดๆ–ฐใ€‚', 'dsh.modalTitle': '่ฎฉ DSH ๆ™บ่ƒฝไฝ“ๅˆ›ๅปบไปปๅŠก','dsh.descLabel': '่ฏทๆ่ฟฐไฝ ็š„ไปปๅŠก็›ฎๆ ‡ๅ’Œๆ‰ง่กŒ้ข‘็އ:', 'dsh.placeholder': 'ไพ‹ๅฆ‚: ๆฏไธคๅฐๆ—ถๆฃ€ๆŸฅไธ€ๆฌก็ฃ็›˜็ฉบ้—ดๅ’Œๅคฑ่ดฅ็š„ systemd ๅฎˆๆŠค่ฟ›็จ‹๏ผŒๅนถๅœจๅผ‚ๅธธๆ—ถๆŠฅ่ญฆ...','dsh.sendHint': 'ๆŒ‰ Ctrl+Enter ๅ‘้€', 'dsh.sendTitle': 'ๆไบค็ป™ๆ™บ่ƒฝไฝ“',
155
- 'dsh.startFailed': 'ๅฏๅŠจๆ™บ่ƒฝไฝ“ๅฏน่ฏๅคฑ่ดฅ: {error}', 'dsh.launchError': 'ๆ‰ง่กŒ้”™่ฏฏ: {error}','confirm.delete': '็กฎๅฎšๅˆ ้™ค่ฏฅไปปๅŠกๅ—๏ผŸ', 'list.loadErrorPrefix': 'ๅŠ ่ฝฝไปปๅŠกๅˆ—่กจๅคฑ่ดฅ','actions.dryRun': '็ฉบ่ท‘ๆต‹่ฏ•', 'actions.dryRunTitle': '็ฉบ่ท‘ๆต‹่ฏ•๏ผˆๆจกๆ‹Ÿๆ‰ง่กŒ๏ผŒไธไบง็”Ÿๅ‰ฏไฝœ็”จไธ”ไธๅ‘้€้€š็Ÿฅ๏ผ‰','actions.archive': 'ๅކๅฒๅฝ’ๆกฃ', 'actions.archiveTitle': 'ๆŸฅ็œ‹ๆ‰ง่กŒๅކๅฒไธŽๆ—ฅๅฟ—ๅฝ’ๆกฃ','dryRun.title': '๐Ÿงช ็ฉบ่ท‘ๆจกๆ‹Ÿ็ป“ๆžœ', 'dryRun.task': 'ไปปๅŠก',
156
- 'dryRun.status': 'ๆจกๆ‹Ÿ็Šถๆ€', 'dryRun.duration': '่€—ๆ—ถ','dryRun.output': 'ๆจกๆ‹Ÿ่พ“ๅ‡บ', 'dryRun.preflight': '้ข„ๆฃ€็ป“ๆžœ','dryRun.close': 'ๅ…ณ้—ญ', 'archive.title': '๐Ÿ“œ ่ฟ่กŒๅކๅฒๅฝ’ๆกฃ','archive.totalRuns': 'ๅ…ฑ่ฎฐๅฝ• {total} ๆฌก่ฟ่กŒ', 'archive.empty': '่ฏฅไปปๅŠกๆš‚ๆ— ๅކๅฒ่ฟ่กŒๅฝ’ๆกฃใ€‚','archive.loadMore': 'ๅŠ ่ฝฝๆ›ดๅคš ({shown} / {total})', 'archive.close': 'ๅ…ณ้—ญ',
157
- 'form.reliabilityTitle': '๐Ÿ›ก๏ธ ๅฏ้ ๆ€งใ€ๅฟƒ่ทณ็›‘ๅฌไธŽ่‡ชๆ„ˆ', 'form.preflightLabel': '้ข„ๆฃ€ๅฅๅบทๆŽขๆต‹','form.preflightNone': 'ๆ— ', 'form.preflightHttp': 'HTTP (2xx ๆŽขๆต‹)','form.preflightShell': 'Shell ๆŽขๆต‹ (้€€ๅ‡บ็  0)', 'form.preflightDisk': '็ฃ็›˜็ฉบ้—ดๆŽขๆต‹ (ๆŒ‚่ฝฝ็‚น:ๆœ€ๅฐ็™พๅˆ†ๆฏ”)','form.preflightTargetLabel': '้ข„ๆฃ€็›ฎๆ ‡ๅ‚ๆ•ฐ', 'form.preflightTargetPlaceholder': 'https://example.com/healthz ๆˆ– ls /data ๆˆ– /:10%',
158
- 'form.heartbeatIntervalLabel': 'ๅฟƒ่ทณๆ‰“ๅกๆ—ถ้™ (็ง’, 0 = ็ฆ็”จ)', 'form.gracePeriodLabel': 'ๅฟƒ่ทณๅฎฝ้™ๆœŸ (็ง’)','form.priorityLabel': '้˜Ÿๅˆ—ไผ˜ๅ…ˆ็บง (1-10๏ผŒๆ•ฐๅ€ผ่ถŠๅคง่ถŠๅ…ˆๆ‰ง่กŒ)', 'form.concurrencyGroupLabel': 'ๅนถๅ‘ๅˆ†็ป„ๅ็งฐ','form.workWindowHoursLabel': '่ฟ่กŒๆ—ถ้—ด็ช—ๅฃ (workWindow, ๅฆ‚ 22:00-07:00)','form.workWindowHoursPlaceholder': 'ไพ‹ๅฆ‚: 22:00-07:00 ๆˆ– 09:00-18:00','form.workWindowPolicyLabel': '็ช—ๅฃๅค–ๆ‰ง่กŒ็ญ–็•ฅ',
159
- 'form.workWindowPolicySkip': '่ทณ่ฟ‡ๆœฌๆฌกๆ‰ง่กŒ (record skipped)','form.workWindowPolicyDefer': 'ๅปถ่ฟŸ่‡ณ็ช—ๅฃๅผ€ๅฏๆ—ถๆ‰ง่กŒ (defer)','form.timeBoxMinutesLabel': 'Timebox ่ฟ่กŒไธŠ้™ (ๅˆ†้’Ÿ, 0 = ไธ้™ๅˆถ)','form.wakeTriggerTypeLabel': 'ไบ‹ไปถๅ”ค้†’่งฆๅ‘ๅ™จ (Wake Triggers)','form.wakeTriggerTypeNone': 'ๆ—  (ไป…ๅฎšๆ—ถ/้—ด้š”)','form.wakeTriggerTypeFileCount': 'ๆ–‡ไปถๆ•ฐ้‡้˜ˆๅ€ผ (ๆ‰น้‡่งฆๅ‘)','form.wakeTriggerTypeMarkerFile': 'ๆ ‡่ฎฐ/Flagๆ–‡ไปถๅˆฐ่พพ',
160
- 'form.wakeTriggerTypeProcessExit': '่ฟ›็จ‹้€€ๅ‡บ็›‘ๅฌ (PID / pidfile)','form.wakeTriggerPathLabel': '่งฆๅ‘็›ฎๆ ‡่ทฏๅพ„ (็›ฎๅฝ• / markerPath / pidFile)','form.wakeTriggerPathPlaceholder': 'ไพ‹ๅฆ‚: incoming/ ๆˆ– build.ready ๆˆ– run.pid','form.wakeTriggerMinCountLabel': 'ๆœ€ๅฐๆ–‡ไปถ้˜ˆๅ€ผ (minCount)','form.wakeTriggerConsumeLabel': '่งฆๅ‘ๅŽ่‡ชๅŠจๅˆ ้™คๆ ‡่ฎฐ/PIDๆ–‡ไปถ',
161
- 'form.writeScopesLabel': 'ๆ–‡ไปถๅ†™ๅ…ฅ่Œƒๅ›ด้” (writeScopes, ็›ธๅฏน่ทฏๅพ„)', 'form.writeScopesPlaceholder': 'ไพ‹ๅฆ‚: src/, docs/ (้˜ปๆญขไธŽๅŒๅทฅไฝœๅŒบ้‡ๅ ไปปๅŠกๅนถๅ‘ๆ‰ง่กŒ)','form.inputHashPathsLabel': '่พ“ๅ…ฅๆ–‡ไปถๅ“ˆๅธŒๅ˜ๅŠจ็›‘ๆŽง (inputHashPaths)', 'form.inputHashPathsPlaceholder': 'ไพ‹ๅฆ‚: src/, package.json (ๆ— ๅ˜ๅŠจๆ—ถ่ทณ่ฟ‡ๆ‰ง่กŒ)','form.skipIfUnchangedLabel': '่พ“ๅ…ฅๆ–‡ไปถๆ— ๅ˜ๅŠจๆ—ถ่ทณ่ฟ‡ๆ‰ง่กŒ (่Š‚็œ Token ไธŽ้ข„็ฎ—)',
162
- 'form.selfHealingLabel': 'ๆ•…้šœ่‡ชๆ„ˆ่„šๆœฌ (Shell)', 'form.selfHealingPlaceholder': 'systemctl restart app || true','form.autoDiagnoseLabel': 'ไปปๅŠกๅคฑ่ดฅๆ—ถๅฏ็”จ AI ๆ™บ่ƒฝๅˆ†ๆž่ฏŠๆ–ญ', 'form.agentPresetLabel': 'ๆ™บ่ƒฝไฝ“้ข„่ฎพ (Agent Preset)',
163
- 'form.agentPresetPlaceholder': 'standard (็•™็ฉบไฝฟ็”จๅ…จๅฑ€้ป˜่ฎค้ข„่ฎพ)', 'form.agentPresetHint': 'ๆฅ่‡ช dsh-agent-presets ็š„ๆ™บ่ƒฝไฝ“้ข„่ฎพ๏ผˆๅฆ‚ standard, minimal, cordis, ptc๏ผ‰๏ผŒๆŒ‚่ฝฝๅทฅไฝœๅŒบๅทฅๅ…ทไธŽๆ–‡ไปถ่ฏปๅ†™่ƒฝๅŠ›ใ€‚','form.sessionTitleLabel': 'ไผš่ฏๆ ‡้ข˜ๆจกๆฟ (Session Title)', 'form.sessionTitlePlaceholder': 'ๅฆ‚ {{date}} ๅธ‚ๅœบๆ—ฉๆŠฅ (ๆ”ฏๆŒ {{date}} ๅ˜้‡)',
164
- 'form.sessionTitleHint': 'ๆญคไปปๅŠก่ฟ่กŒ็”Ÿๆˆ็š„ไผš่ฏๆ ‡้ข˜ใ€‚ๆ”ฏๆŒ {{date}} (ๅนด-ๆœˆ-ๆ—ฅ)ใ€‚็•™็ฉบ้ป˜่ฎคไธบ "<YYYY-MM-DD> <ไปปๅŠกๅ>"ใ€‚', 'form.targetSessionIdLabel': '็›ฎๆ ‡ๅธธ้ฉปไผš่ฏ ID (Target Session ID)','form.targetSessionIdPlaceholder': 'ๅฆ‚ audit-chat ๆˆ– dev-summary๏ผˆ็•™็ฉบไธบๅ•ๆฌก้š”็ฆป่ฟ่กŒ๏ผ‰', 'form.targetSessionIdHint': '้…็ฝฎๅŽๅฎšๆ—ถไปปๅŠกๅฐ†ๅœจๆญคๅธธ้ฉปไผš่ฏไธญๆŒ็ปญไบคไบ’๏ผŒ่ทจๅ‘จๆœŸไฟ็•™ๅކๅฒไธŠไธ‹ๆ–‡ๅฏน่ฏ่ฎฐๅฟ†๏ผŒไธๅ†ๆฏๆฌกๆ–ฐๅปบๅญค็ซ‹ไผš่ฏใ€‚',
165
- 'form.targetSessionResetLabel': 'ไธŠไธ‹ๆ–‡่ฝฎ่ฝฌ็ญ–็•ฅ (Session Rotation)', 'form.targetSessionResetNever': 'ๆฐธไธ่ฝฎ่ฝฌ๏ผˆๅ•ไธ€ไผš่ฏๆŒ็ปญ็ดฏ็งฏ๏ผ‰','form.targetSessionResetDaily': 'ๆฏๆ—ฅ่ฝฎ่ฝฌ๏ผˆๆฏๆ—ฅ่‡ชๅŠจๅผ€ๅฏๆ–ฐไผš่ฏ๏ผ‰', 'form.targetSessionResetWeekly': 'ๆฏๅ‘จ่ฝฎ่ฝฌ๏ผˆๆฏๅ‘จ่‡ชๅŠจๅผ€ๅฏๆ–ฐไผš่ฏ๏ผ‰','form.targetSessionResetHint': '่‡ชๅŠจๆŒ‰ๅ‘จๆœŸๅŠ ๆณจๆ—ฅๆœŸๅŽ็ผ€่ฝฎ่ฝฌไผš่ฏ๏ผŒๆœ‰ๆ•ˆ้˜ฒๆญข้•ฟๆ—ถ้—ด่ฟ่กŒๅฏผ่‡ด็š„ๆจกๅž‹ไธŠไธ‹ๆ–‡็ช—ๅฃ่ถ…้™ไธŽ Token ๆตช่ดนใ€‚', 'form.requireApprovalLabel': 'ๆ‰ง่กŒๅ‰้œ€ไบบๅทฅ็กฎ่ฎคๅฎกๆ‰น',
166
- 'form.requireApprovalHint': 'ๅผ€ๅฏๅŽ๏ผŒไปปๅŠกๆ‰ง่กŒๅ‰ๅฐ†ๆŒ‚่ตทๅนถ็ญ‰ๅพ…ๆŽˆๆƒ็”จๆˆทๆ‰นๅ‡†ๆ่ฎฎ (#318)ใ€‚', 'actions.approve': 'ๆ‰นๅ‡†','actions.reject': 'ๆ‹’็ป', 'approval.waiting': '็ญ‰ๅพ…ไบบๅทฅๅฎกๆ‰น','approval.approved': 'ๅทฒๆ‰นๅ‡†', 'approval.rejected': 'ๅทฒๆ‹’็ป','chainGraph.modalTitle': 'ไปปๅŠก้“พไธŽๆฃ€ๆŸฅ็‚นไพ่ต–ๅ›พ', 'chainGraph.viewGraph': 'ไปปๅŠก้“พๅ›พ','chainGraph.noNodes': 'ๆœชๆ‰พๅˆฐ่ฏฅไปปๅŠกๆˆ–่ฟ่กŒ็š„ๅ…ณ่”ๆญฅ้ชคใ€‚', 'chainGraph.retryStep': '้‡่ฏ•ๆญคๆญฅ้ชค',
167
- 'chainGraph.stepSuccess': 'ๆˆๅŠŸ', 'chainGraph.stepFailed': 'ๅคฑ่ดฅ','chainGraph.stepPending': '็ญ‰ๅพ…ไธญ', 'chainGraph.close': 'ๅ…ณ้—ญ','chainGraph.decisionNode': 'ๆกไปถๅ†ณ็ญ–่Š‚็‚น', 'chainGraph.stepSkipped': 'ๅทฒ่ทณ่ฟ‡','history.doctorDiagnosis': 'Doctor ่ฏŠๆ–ญไธŽๅปบ่ฎฎไฟฎๅค', 'history.doctorApply': 'ไธ€้”ฎๅบ”็”จไฟฎๅค','history.doctorRevert': 'ๆขๅคไธŠไธ€็‰ˆๆœฌไปฃ็ ', 'history.autoHealed': 'ๅทฒ็”ฑ Doctor ่‡ชๅŠจไฟฎๅค',
168
- 'form.autoHealLabel': '่‡ชไธป Self-Healing Doctor ่‡ชๅŠจไฟฎๅค', 'form.autoHealHint': 'ๅฝ“ไปปๅŠกๅคฑ่ดฅๆ—ถ่‡ชๅŠจ่ฏŠๆ–ญๅนถๅฎ‰ๅ…จไฟฎๅค๏ผˆๆฏๅคฉไธŠ้™ 1 ๆฌก๏ผ‰','form.elseTaskLabel': '้ป˜่ฎคๅŽๅค‡ไปปๅŠก (elseTask)', 'form.elseTaskHint': 'ๅฝ“ๆฒกๆœ‰ๅˆ†ๆ”ฏๆกไปถๅŒน้…ๆ—ถ่งฆๅ‘็š„็›ฎๆ ‡ไปปๅŠก','form.elseTaskPlaceholder': 'ๅฆ‚ task-fallback', 'adaptive.badge': '่‡ช้€‚ๅบ”','adaptive.idle': '็ฉบ้—ฒ', 'adaptive.backoff': '้ฟ่ฎฉไธญ',
169
- 'form.adaptiveEnabled': '่‡ช้€‚ๅบ”่ฝฎ่ฏข (Adaptive Polling)', 'form.adaptiveHint': 'ๆ•ฐๆฎๆ— ๅ˜ๅŒ–ๆ—ถๆŒ‡ๆ•ฐ็บงๅปถ้•ฟๆ‰ง่กŒ้—ด้š”','liveLog.modalTitle': 'ๅฎžๆ—ถไปปๅŠกๆ‰ง่กŒๆ—ฅๅฟ—ๆต', 'liveLog.viewLog': 'ๅฎžๆ—ถๆ—ฅๅฟ—','liveLog.autoScroll': '่‡ชๅŠจๆปšๅŠจ', 'liveLog.connecting': 'ๆญฃๅœจ่ฟžๆŽฅๆ—ฅๅฟ—ๆต...','liveLog.waiting': '็ญ‰ๅพ…่ฟ่กŒๅ™จ่พ“ๅ‡บ...', 'liveLog.completed': 'ๆ—ฅๅฟ—ๆตๅทฒ็ป“ๆŸ','liveLog.close': 'ๅ…ณ้—ญๆ—ฅๅฟ—ๆต', 'timeline.modalTitle': '24ๅฐๆ—ถ่ฐƒๅบฆๆ—ถ้—ด็บฟ',
170
- 'timeline.buttonLabel': 'ๆ—ถ้—ด็บฟ', 'timeline.buttonTitle': 'ๆŸฅ็œ‹24ๅฐๆ—ถ้ข„ๆต‹ไปปๅŠก่ฐƒๅบฆไธŽๅนถๅ‘ๆ—ถ้—ด็บฟ','timeline.tabTimeline': '่ฐƒๅบฆๆ—ถ้—ด็บฟ', 'timeline.legendDesc': 'ๆœชๆฅ24ๅฐๆ—ถๅ„ๆ—ถๆฎตไปปๅŠก้ข„่ฎกๆ‰ง่กŒๅˆ†ๅธƒ๏ผš','timeline.peakWarning': 'ๅนถๅ‘ๅณฐๅ€ผ้ข„่ญฆ', 'heatmap.modalTitle': 'ๆˆๆœฌไธŽTokenๆถˆ่€—็ƒญๅŠ›ๅ›พ','heatmap.buttonLabel': '็ƒญๅŠ›ๅ›พ', 'heatmap.tabHeatmap': 'ๆˆๆœฌ็ƒญๅŠ›ๅ›พ',
171
- 'heatmap.matrixDesc': 'ๆฏๅ‘จๅ„ๆ—ถๆฎตๆˆๆœฌๅˆ†ๅธƒ็Ÿฉ้˜ต๏ผˆ7ๅคฉ ร— 24ๅฐๆ—ถ๏ผ‰๏ผš', 'digest.modalTitle': '่‡ชๅŠจๅŒ–ไธŽๆˆๆœฌๅˆ†ๆžๆ‘˜่ฆ','digest.buttonLabel': 'ๅˆ†ๆžๆ‘˜่ฆ', 'digest.buttonTitle': 'ๆŸฅ็œ‹ 7 ๅคฉๆˆ– 30 ๅคฉ่ฟ่กŒ็ปŸ่ฎกไธŽ่Šฑ่ดนๆ‘˜่ฆ','digest.period7': 'ๆœ€่ฟ‘ 7 ๅคฉ', 'digest.period30': 'ๆœ€่ฟ‘ 30 ๅคฉ','digest.executions': 'ๆ‰ง่กŒๆฌกๆ•ฐ', 'digest.tokens': 'Token ๆถˆ่€—','digest.cost': '่Šฑ่ดน (USD)', 'digest.fleet': 'ไปปๅŠกๆ€ป่งˆ',
172
- 'digest.unstableTitle': 'ๆœ€ไธ็จณๅฎšไปปๅŠกๆŽ’่กŒ', 'digest.expensiveTitle': '่ต„ๆบๆถˆ่€—ๆŽ’่กŒ','digest.sendTelegram': 'ๅ‘้€่‡ณ Telegram', 'digest.copyMarkdown': 'ๅคๅˆถ Markdown','digest.copied': 'ๅทฒๅคๅˆถ!', 'digest.sentSuccess': 'ๅทฒๆˆๅŠŸๅ‘้€่‡ณ Telegram!','prompt.version': 'ๆ็คบ่ฏ็‰ˆๆœฌ', 'prompt.rollback': 'ๅ›ž้€€่‡ณ v','prompt.history': 'ๆ็คบ่ฏๅކๅฒ', 'prompt.successRate': 'ๆˆๅŠŸ็އ',
173
- 'form.chainingTitle': 'ไปปๅŠก้“พไธŽ DAG ็ผ–ๆŽ’', 'form.onSuccessLabel': 'ๆˆๅŠŸๅŽ่งฆๅ‘ (ไปปๅŠก ID)','form.onSuccessHint': 'ๆˆๅŠŸๅŽๅนถๅ‘่งฆๅ‘็š„ไปปๅŠก ID๏ผŒ้€—ๅทๅˆ†้š” (Fan-Out)', 'form.onFailureLabel': 'ๅคฑ่ดฅๅŽ่งฆๅ‘ (ไปปๅŠก ID)','form.onFailureHint': 'ๅคฑ่ดฅๅŽ่งฆๅ‘็š„ไปปๅŠก ID๏ผŒ้€—ๅทๅˆ†้š”', 'form.dependsOnLabel': 'ไพ่ต–ไปปๅŠก (dependsOn)','form.dependsOnHint': 'ๆ‰ง่กŒๅ‰้œ€็ญ‰ๅพ…็š„ๅ‰็ฝฎไปปๅŠก ID๏ผŒ้€—ๅทๅˆ†้š” (Fan-In)', 'form.joinPolicyLabel': 'ๅˆๅนถ็ญ–็•ฅ',
174
- 'form.joinPolicyAll': 'ๆ‰€ๆœ‰ๅ‰็ฝฎๅ‡ๆˆๅŠŸ (all_success)', 'form.joinPolicyAny': 'ไปปไธ€ๅ‰็ฝฎๆˆๅŠŸๅณๅฏ (any_success)','recipe.dependenciesMissing': '็ผบๅฐ‘ๅฟ…่ฆ้›†ๆˆๆœๅŠกๆˆ–ๅ‡ญๆฎ', 'form.previewSchedule': '้ข„ๆต‹ไธ‹ๆฌก่ฟ่กŒๆ—ถ้—ด','form.previewScheduleTitle': 'ๆœชๆฅ 5 ๆฌก่ฎกๅˆ’่ฟ่กŒๆ—ถ้—ด:',}
175
- };
176
- let translate = (key, vars) => {
177
- let s = (STRINGS.en && STRINGS.en[key]) || key;
178
- if (vars) {for (const k of Object.keys(vars)) {s = s.split('{' + k + '}').join(String(vars[k]));
179
- }
180
- }
181
- return s;
182
- };
183
- const T = (key, vars) => translate(key, vars);
184
- const STYLE_ID = 'dsh-cron-styles';
185
- const CSS_HREF = '/dsh-cron/client.css';
186
- function ensureStyles() {if (typeof document === 'undefined') return null;
187
- let el = document.getElementById(STYLE_ID);
188
- if (el === null) {
189
- const head = document.head || document.documentElement;
190
- if (!head) return null;
191
- el = document.createElement('link');
192
- el.id = STYLE_ID;
193
- el.rel = 'stylesheet';
194
- el.href = CSS_HREF;
195
- el.dataset.dshPlugin = 'dsh-cron';
196
- head.appendChild(el);
197
- return el;
198
- }
199
- if (el.getAttribute('href') !== CSS_HREF) {el.setAttribute('href', CSS_HREF);
200
- el.href = CSS_HREF;
201
- }
202
- return el;
203
- }
204
- const STYLE_HEAL_KEY = '__dshCronStyleHeal';
205
- const STYLE_HEAL_INTERVAL_MS = 2000;
206
- function startStyleSelfHeal() {if (typeof document === 'undefined') return () => {};
207
- if (typeof window !== 'undefined' && typeof window[STYLE_HEAL_KEY] === 'function') {try { window[STYLE_HEAL_KEY](); } catch (_err) { void _err; }
208
- }
209
- const heal = () => { try { ensureStyles(); } catch (_err) { void _err; } };
210
- heal();
211
- let observer = null;
212
- try {if (typeof MutationObserver === 'function') {observer = new MutationObserver(heal);
213
- if (document.head) observer.observe(document.head, { childList: true });
214
- if (document.documentElement) observer.observe(document.documentElement, { childList: true });
215
- }
216
- } catch (_err) { observer = null; }
217
- let timer = null;
218
- try { timer = setInterval(heal, STYLE_HEAL_INTERVAL_MS); } catch (_err) { timer = null; }
219
- const onVisibility = () => { if (document.visibilityState !== 'hidden') heal(); };
220
- try { document.addEventListener('visibilitychange', onVisibility); } catch (_err) { void _err; }
221
- const stop = () => {try { if (observer) observer.disconnect(); } catch (_err) { void _err; }
222
- try { if (timer !== null) clearInterval(timer); } catch (_err) { void _err; }
223
- try { document.removeEventListener('visibilitychange', onVisibility); } catch (_err) { void _err; }
224
- if (typeof window !== 'undefined' && window[STYLE_HEAL_KEY] === stop) window[STYLE_HEAL_KEY] = undefined;
225
- };
226
- if (typeof window !== 'undefined') window[STYLE_HEAL_KEY] = stop;
227
- return stop;
228
- }
229
- function createErrorBoundary() {if (!React || typeof React.Component !== 'function') {
230
- return function NoopBoundary(props) { return (props && props.children) || null; };
231
- }
232
- return class ErrorBoundary extends React.Component {constructor(props) {super(props);
233
- this.state = { hasError: false, error: null };
234
- }
235
- static getDerivedStateFromError(error) {
236
- return { hasError: true, error };
237
- }
238
- componentDidCatch(error, errorInfo) {console.error('[dsh-cron] React error:', error, errorInfo);
239
- }
240
- render() {if (this.state.hasError) {
241
- return _h('div', { className: 'dsh-cron-status-banner', 'data-type': 'error', style: { margin: '12px 0' } },_h('div', { style: { fontWeight: 600, marginBottom: '6px' } }, 'โš ๏ธ Cron UI error:'),_h('div', { style: { fontSize: '12px', wordBreak: 'break-all' } }, String((this.state.error && this.state.error.message) || this.state.error)),_h('button', {
242
- type: 'button',className: 'dsh-cron-btn-secondary',style: { marginTop: '10px', fontSize: '12px', padding: '4px 10px' },onClick: () => this.setState({ hasError: false, error: null })
243
- }, 'Retry')
244
- );
245
- }
246
- return (this.props && this.props.children) || null;
247
- }
248
- };
249
- }
250
- const ErrorBoundary = createErrorBoundary();
251
- const AGENT_FORM_TYPES = ['llm', 'skill', 'workflow'];
252
- const CODE_FORM_TYPES = ['script', 'node', 'python', 'ssh', 'docker'];
253
- const DELIVERY_CHANNELS = ['feishu', 'telegram', 'kanban', 'discord', 'slack', 'ntfy', 'bark', 'pushplus', 'tts', 'gitea'];
254
- const CHANNEL_LABEL_KEYS = {feishu: 'form.channelFeishu',telegram: 'form.channelTelegram',kanban: 'form.channelKanban',discord: 'form.channelDiscord',slack: 'form.channelSlack',ntfy: 'form.channelNtfy',bark: 'form.channelBark',pushplus: 'form.channelPushplus',tts: 'form.channelTts',gitea: 'form.channelGitea',};
255
- const DELIVERY_SETTING_FIELDS = [
256
- { key: 'botTokenRef', labelKey: 'settings.botTokenRefLabel', placeholderKey: 'settings.botTokenRefPlaceholder', group: 'secrets' },{ key: 'ntfyTokenRef', labelKey: 'settings.ntfyTokenRefLabel', group: 'secrets' },{ key: 'pushplusTokenRef', labelKey: 'settings.pushplusTokenRefLabel', group: 'secrets' },
257
- { key: 'giteaTokenRef', labelKey: 'settings.giteaTokenRefLabel', group: 'secrets' },{ key: 'apiToken', labelKey: 'settings.apiTokenLabel', placeholderKey: 'settings.apiTokenPlaceholder', group: 'secrets' },{ key: 'discordWebhookUrl', labelKey: 'settings.discordLabel', group: 'channels' },
258
- { key: 'slackWebhookUrl', labelKey: 'settings.slackLabel', group: 'channels' },{ key: 'ntfyUrl', labelKey: 'settings.ntfyUrlLabel', group: 'channels' },{ key: 'ntfyTopic', labelKey: 'settings.ntfyTopicLabel', group: 'channels' },{ key: 'barkServerUrl', labelKey: 'settings.barkServerLabel', group: 'channels' },
259
- { key: 'barkKey', labelKey: 'settings.barkKeyLabel', group: 'channels' },{ key: 'pushplusUrl', labelKey: 'settings.pushplusUrlLabel', group: 'channels' },{ key: 'ttsBaseUrl', labelKey: 'settings.ttsBaseUrlLabel', group: 'channels' },{ key: 'giteaBaseUrl', labelKey: 'settings.giteaBaseUrlLabel', group: 'channels' },
260
- { key: 'giteaRepo', labelKey: 'settings.giteaRepoLabel', group: 'channels' },{ key: 'deliveryTimeoutMs', labelKey: 'settings.deliveryTimeoutMsLabel', group: 'channels', numeric: true, defaultValue: 15000, min: 1000 },{ key: 'silentRuleModel', labelKey: 'settings.silentRuleModelLabel', group: 'automation' },
261
- { key: 'inspectorModel', labelKey: 'settings.inspectorModelLabel', group: 'automation' },];
262
- const DELIVERY_SETTING_KEYS = DELIVERY_SETTING_FIELDS.map((f) => f.key);
263
- const TEMPLATE_SETTING_KEYS = ['template', 'channelTemplates'];
264
- function parseEnvText(text) {
265
- const env = {};
266
- for (const rawLine of String(text || '').split('\n')) {
267
- const line = rawLine.trim();
268
- if (!line || line.startsWith('#')) continue;
269
- const idx = line.indexOf('=');
270
- if (idx <= 0) continue;
271
- const key = line.slice(0, idx).trim();
272
- const value = line.slice(idx + 1).trim();
273
- if (key) env[key] = value;
274
- }
275
- return Object.keys(env).length ? env : undefined;
276
- }
277
- function formatEnvText(env) {if (!env || typeof env !== 'object') return '';
278
- return Object.entries(env).map(([k, v]) => `${k}=${v}`).join('\n');
279
- }
280
- function shouldDismissPanel(target) {if (target === null || target === undefined) return false;
281
- if (typeof target.closest !== 'function') return false;
282
- return target.closest(PANEL_OWNED_SELECTOR) === null;
283
- }
284
- function resolveSidebarAnchor() {if (typeof document === 'undefined') return null;
285
- const marker = document.querySelector('[' + ENTRY_ATTR + ']');
286
- if (!marker) return null;
287
- return marker.closest('div[class*="panelEntry"]') || marker.closest('button') || marker.parentElement || marker;
288
- }
289
- function sidebarJobsSeatIsCurrent(state, entry) {
290
- const root = state && state.root;
291
- const anchor = (entry && typeof entry.closest === 'function') ? (entry.closest('div[class*="panelEntry"]') || entry.closest('button') || entry.parentElement || entry) : entry;
292
- return root !== undefined && root.isConnected && anchor !== null && root.previousElementSibling === anchor;
293
- }
294
- function createToggle() {
295
- let open = false;
296
- const listeners = new Set();
297
- return {isOpen: () => open,set: (v) => {
298
- const next = !!v;
299
- if (open === next) {for (const fn of listeners) fn(open);
300
- return;
301
- }
302
- open = next;
303
- for (const fn of listeners) fn(open);
304
- },toggle: () => {open = !open;
305
- for (const fn of listeners) fn(open);
306
- },subscribe: (fn) => {listeners.add(fn);
307
- return () => listeners.delete(fn);
308
- }
309
- };
310
- }
311
- function optionalService(ctx, name) {try {if (ctx && typeof ctx.get === 'function') return ctx.get(name);
312
- } catch (err) {/* the host does not expose this optional service */
313
- }
314
- return undefined;
315
- }
316
- async function openSession(ctx, sessionId) {if (!sessionId) return false;
317
- const getSessions = () => (ctx && typeof ctx.get === 'function' ? ctx.get('sessions') : (ctx && ctx.sessions));
318
- let sessions = getSessions();
319
- if (sessions && typeof sessions.open === 'function') {try {sessions.open(sessionId);
320
- return true;
321
- } catch (err) {/* sessions.open threw synchronously */
322
- }
323
- }
324
- if (sessions && typeof sessions.refresh === 'function') {try {await sessions.refresh();
325
- sessions.open(sessionId);
326
- return true;
327
- } catch (err) {/* sessions.refresh threw */
328
- }
329
- }
330
- for (let i = 0; i < 15; i++) {await new Promise(resolve => setTimeout(resolve, 120));
331
- sessions = getSessions();
332
- if (sessions && typeof sessions.open === 'function') {try {sessions.open(sessionId);
333
- return true;
334
- } catch (err) {/* retry polling sessions.open threw */
335
- }
336
- }
337
- if (typeof document !== 'undefined') {
338
- const domItem = document.querySelector('[data-session-id="' + sessionId + '"], [role="treeitem"][data-id="' + sessionId + '"], [data-id="' + sessionId + '"]');
339
- if (domItem) {domItem.click();
340
- return true;
341
- }
342
- }
343
- }
344
- console.warn('[dsh-cron] could not open session in workspace:', sessionId);
345
- return false;
346
- }
347
- function statusLabel(t, status) {if (status === 'success') return T_KEY(t, 'history.statusSuccess');
348
- if (status === 'validation_failed') return T_KEY(t, 'history.statusValidationFailed');
349
- if (status === 'skipped') return T_KEY(t, 'history.statusSkipped');
350
- if (status === 'missed') return T_KEY(t, 'history.statusMissed');
351
- if (status === 'timeout') return T_KEY(t, 'history.statusTimeout');
352
- if (status === 'uncertain') return T_KEY(t, 'history.statusUncertain');
353
- return T_KEY(t, 'history.statusFailed');
354
- }
355
- function isConfigManaged(task) {
356
- return Boolean(task) && task.managedBy === 'config';
357
- }
358
- function T_KEY(t, key, vars) {
359
- return (typeof t === 'function' ? t : translate)(key, vars);
360
- }
361
- const fetchWithTimeout = async (url, options = {}, timeoutMs = 15000) => {
362
- const controller = typeof AbortController !== 'undefined' ? new AbortController() : null;
363
- const timer = controller ? setTimeout(() => controller.abort(), timeoutMs) : null;
364
- if (options && options.signal && controller) {if (options.signal.aborted) {controller.abort();
365
- } else {options.signal.addEventListener('abort', () => controller.abort(), { once: true });
366
- }
367
- }
368
- try {
369
- const res = await fetch(url, {credentials: 'same-origin',...options,signal: controller ? controller.signal : (options ? options.signal : undefined),});
370
- return res;
371
- } catch (err) {if (err && (err.name === 'AbortError' || controller?.signal?.aborted)) {
372
- const timeoutErr = new Error(`Request timed out after ${Math.round(timeoutMs / 1000)}s`);
373
- timeoutErr.isTimeout = true;
374
- throw timeoutErr;
375
- }
376
- throw err;
377
- } finally {if (timer) clearTimeout(timer);
378
- }
379
- };
380
- const fetchJsonWithTimeout = async (url, options = {}, timeoutMs = 15000) => {
381
- const res = await fetchWithTimeout(url, options, timeoutMs);
382
- let data = {};
383
- try {data = await res.json();
384
- } catch (jsonErr) {if (jsonErr && jsonErr.name === 'AbortError') {throw jsonErr;
385
- }
386
- }
387
- return { res, data };
388
- };
389
- const HEADER_SETTINGS_STORAGE_KEY = 'dsh-cron:header-settings';
390
- let currentHeaderSettings = (function initHeaderSettings() {try {if (typeof window !== 'undefined' && window.localStorage) {
391
- const raw = window.localStorage.getItem(HEADER_SETTINGS_STORAGE_KEY);
392
- if (raw) {
393
- const parsed = JSON.parse(raw);
394
- return {showChatHeaderButton: parsed.showChatHeaderButton !== false,showChatHeaderActions: parsed.showChatHeaderActions !== false,};
395
- }
396
- }
397
- } catch (_e) {void _e;
398
- }
399
- return {showChatHeaderButton: true,showChatHeaderActions: true,};
400
- })();
401
- const headerSettingsListeners = new Set();
402
- function updateHeaderSettings(patch) {if (!patch || typeof patch !== 'object') return currentHeaderSettings;
403
- let changed = false;
404
- const next = Object.assign({}, currentHeaderSettings);
405
- if (patch.showChatHeaderButton !== undefined) {
406
- const val = Boolean(patch.showChatHeaderButton);
407
- if (next.showChatHeaderButton !== val) {next.showChatHeaderButton = val;
408
- changed = true;
409
- }
410
- }
411
- if (patch.showChatHeaderActions !== undefined) {
412
- const val = Boolean(patch.showChatHeaderActions);
413
- if (next.showChatHeaderActions !== val) {next.showChatHeaderActions = val;
414
- changed = true;
415
- }
416
- }
417
- if (changed) {currentHeaderSettings = next;
418
- try {if (typeof window !== 'undefined' && window.localStorage) {window.localStorage.setItem(HEADER_SETTINGS_STORAGE_KEY, JSON.stringify(next));
419
- }
420
- } catch (_e) {void _e;
421
- }
422
- for (const fn of headerSettingsListeners) {try {fn(currentHeaderSettings);
423
- } catch (_err) {void _err;
424
- }
425
- }
426
- }
427
- return currentHeaderSettings;
428
- }
429
- let headerSettingsSynced = false;
430
- let headerSettingsSyncing = null;
431
- function syncHeaderSettingsFromServer() {if (headerSettingsSyncing) return headerSettingsSyncing;
432
- headerSettingsSyncing = fetchJsonWithTimeout('/dsh-cron/settings')
433
- .then(({ data }) => {headerSettingsSynced = true;
434
- if (data && data.ok && data.settings) {updateHeaderSettings({showChatHeaderButton: data.settings.showChatHeaderButton !== false,showChatHeaderActions: data.settings.showChatHeaderActions !== false,});
435
- }
436
- })
437
- .catch((_err) => {void _err;
438
- })
439
- .finally(() => {headerSettingsSyncing = null;
440
- });
441
- return headerSettingsSyncing;
442
- }
443
- function useHeaderVisibility(key) {if (typeof React === 'undefined' || typeof React.useState !== 'function') {
444
- return Boolean(currentHeaderSettings[key] !== false);
445
- }
446
- const [visible, setVisible] = React.useState(Boolean(currentHeaderSettings[key] !== false));
447
- if (typeof React.useEffect === 'function') {React.useEffect(() => {if (!headerSettingsSynced) {syncHeaderSettingsFromServer();
448
- }
449
- const listener = (newSettings) => {setVisible(Boolean(newSettings[key] !== false));
450
- };
451
- headerSettingsListeners.add(listener);
452
- return () => {headerSettingsListeners.delete(listener);
453
- };
454
- }, [key]);
455
- }
456
- return visible;
457
- }
458
- function pickDeliverySettings(source) {
459
- const out = {};
460
- for (const key of DELIVERY_SETTING_KEYS.concat(TEMPLATE_SETTING_KEYS)) {if (source && source[key] !== undefined && source[key] !== null) out[key] = source[key];
461
- }
462
- if (out.channelTemplates && typeof out.channelTemplates === 'object') {out.channelTemplates = Object.assign({}, out.channelTemplates);
463
- }
464
- return out;
465
- }
466
- function renderDeliverySettings({ T, values, onChange, onChannelTemplate, sections, onToggleSection }) {
467
- const val = (key) => (values[key] === undefined || values[key] === null ? '' : String(values[key]));
468
- const field = (f) => _h('div', { className: 'dsh-cron-form-group', key: f.key, style: { marginBottom: '10px' } },_h('label', null, T(f.labelKey)),_h('input', f.numeric ? {type: 'number',min: f.min !== undefined ? f.min : 1000,step: 1000,value: val(f.key),placeholder: String(f.defaultValue !== undefined ? f.defaultValue : 15000),
469
- onChange: (e) => onChange(f.key, e.target.value === ''
470
- ? (f.defaultValue !== undefined ? f.defaultValue : 15000)
471
- : Number(e.target.value)),} : {type: 'text',value: val(f.key),placeholder: f.placeholderKey ? T(f.placeholderKey) : '',onChange: (e) => onChange(f.key, e.target.value)
472
- })
473
- );
474
- const section = (key, titleKey, children) => {
475
- const open = Boolean(sections[key]);
476
- return _h('div', { className: 'dsh-cron-section', key },_h('button', {type: 'button',className: 'dsh-cron-section-head','aria-expanded': open ? 'true' : 'false',onClick: () => onToggleSection(key)
477
- },_h('span', null, T(titleKey)),_h('span', { className: 'dsh-cron-section-chevron', 'data-open': open ? 'true' : 'false' }, 'โ–พ')
478
- ),open && _h('div', { className: 'dsh-cron-section-body' }, children)
479
- );
480
- };
481
- return [
482
- section('secrets', 'settings.secretsSection', [
483
- _h('div', { className: 'dsh-cron-hint', key: 'hint', style: { marginBottom: '10px' } }, T('settings.secretsHint')),...DELIVERY_SETTING_FIELDS.filter((f) => f.group === 'secrets').map(field),]),section('channels', 'settings.deliverySection', [
484
- _h('div', { className: 'dsh-cron-form-row', key: 'row' },...DELIVERY_SETTING_FIELDS.filter((f) => f.group === 'channels').map(field)
485
- ),]),section('automation', 'settings.automationSection', [
486
- _h('div', { className: 'dsh-cron-hint', key: 'hint', style: { marginBottom: '10px' } }, T('settings.automationHint')),_h('div', { className: 'dsh-cron-form-row', key: 'row' },...DELIVERY_SETTING_FIELDS.filter((f) => f.group === 'automation').map(field)
487
- ),]),section('templates', 'settings.templatesSection', [
488
- _h('div', { className: 'dsh-cron-form-group', key: 'global', style: { marginBottom: '10px' } },_h('label', null, T('settings.templateLabel')),_h('input', {type: 'text',value: val('template'),onChange: (e) => onChange('template', e.target.value)
489
- }),_h('div', { className: 'dsh-cron-hint' }, T('settings.templateHint'))
490
- ),_h('div', { className: 'dsh-cron-form-row', key: 'perchannel' },...DELIVERY_CHANNELS.map((id) => _h('div', { className: 'dsh-cron-form-group', key: id, style: { marginBottom: '10px' } },_h('label', null, T('settings.channelTemplateLabel', { channel: T(CHANNEL_LABEL_KEYS[id]) })),_h('input', {type: 'text',
491
- value: (values.channelTemplates && values.channelTemplates[id]) || '',onChange: (e) => onChannelTemplate(id, e.target.value)
492
- })
493
- ))
494
- ),]),];
495
- }
496
- function parseChainTargets(raw) {if (!raw) return [];
497
- if (Array.isArray(raw)) return raw.filter((x) => typeof x === 'string' && x.trim().length > 0);
498
- if (typeof raw === 'string') return raw.split(',').map((s) => s.trim()).filter((s) => s.length > 0);
499
- return [];
500
- }
501
- const sanitizeDependsOn = parseChainTargets;
502
- const sanitizeJoinPolicy = (raw) => (raw === 'any_success' ? 'any_success' : 'all_success');
503
- function buildTaskGraphModel(tasks = [], snapshots = [], focusTaskId = null) {
504
- const taskMap = new Map();
505
- for (const t of tasks) if (t?.id) taskMap.set(t.id, t);
506
- const snapMap = new Map();
507
- for (const s of snapshots) if (s?.stepTaskId) snapMap.set(s.stepTaskId, s);
508
- const nodes = [], edges = [];
509
- let hasFailure = false;
510
- for (const [id, task] of taskMap.entries()) {
511
- const snap = snapMap.get(id);
512
- let nodeStatus = 'pending', durationMs = 0, outputSnippet = '', retryCount = 0;
513
- if (snap) {nodeStatus = snap.status === 'completed' || snap.status === 'success' ? 'success' : 'failed';
514
- durationMs = snap.durationMs || 0;
515
- retryCount = snap.retryCount || 0;
516
- if (snap.output) outputSnippet = String(snap.output).slice(0, 200);
517
- if (nodeStatus === 'failed') hasFailure = true;
518
- } else if (task.status === 'running') {nodeStatus = 'running';
519
- }
520
- const deps = sanitizeDependsOn(task.dependsOn);
521
- const hasBranches = Array.isArray(task.branchRules) && task.branchRules.length > 0;
522
- nodes.push({id,title: task.title || id,type: task.type || 'prompt',status: nodeStatus,durationMs,retryCount,outputSnippet,isFocus: Boolean(focusTaskId && id === focusTaskId),isRetryable: nodeStatus === 'failed',isDecisionNode: hasBranches,branchRulesCount: hasBranches ? task.branchRules.length : 0,elseTask: task.elseTask || null,dependsOn: deps,
523
- joinPolicy: sanitizeJoinPolicy(task.joinPolicy)
524
- });
525
- for (const d of deps) edges.push({ from: d, to: id, type: 'dependsOn', label: task.joinPolicy === 'any_success' ? 'join:any' : 'join:all' });
526
- if (hasBranches) {for (const rule of task.branchRules) {if (rule && rule.targetTask) {edges.push({from: id,to: String(rule.targetTask).trim(),type: 'branch',label: rule.label || ('[if: ' + rule.field + ' ' + rule.operator + ' ' + (rule.value != null ? rule.value : '') + ']').trim(),condition: { field: rule.field, operator: rule.operator, value: rule.value }
527
- });
528
- }
529
- }
530
- }
531
- if (task.elseTask) {edges.push({from: id,to: String(task.elseTask).trim(),type: 'branch_else',label: '[else]',isElse: true
532
- });
533
- }
534
- if (!hasBranches) {for (const t of parseChainTargets(task.onSuccess)) edges.push({ from: id, to: t, type: 'onSuccess', label: 'onSuccess' });
535
- }
536
- for (const f of parseChainTargets(task.onFailure)) edges.push({ from: id, to: f, type: 'onFailure', label: 'onFailure' });
537
- }
538
- return { nodes, edges, hasFailure };
539
- }
540
- function renderChainGraphModal({ isOpen, onClose, data, loading, onRetry, t }) {if (!isOpen) return null;
541
- const graph = data?.graph || { nodes: [], edges: [], hasFailure: false };
542
- const chainRunId = data?.chainRunId || '';
543
- const nodes = graph.nodes || [];
544
- return _h('div', {className: 'dsh-cron-modal-overlay',onClick: onClose
545
- },_h('div', {className: 'dsh-cron-modal',style: { maxWidth: '820px', width: '92vw', maxHeight: '88vh', display: 'flex', flexDirection: 'column' },role: 'dialog','aria-modal': 'true',onClick: (e) => e.stopPropagation()
546
- },_h('div', {className: 'dsh-cron-modal-head',style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', borderBottom: '1px solid var(--dsw-alias-border-l2)', paddingBottom: '12px' }
547
- },_h('div', null,_h('div', {className: 'dsh-cron-modal-title',style: { margin: 0, display: 'flex', alignItems: 'center', gap: '8px' }
548
- },_h('span', { style: { fontSize: '18px' } }, '๐Ÿ•ธ๏ธ'),T_KEY(t, 'chainGraph.modalTitle')
549
- ),chainRunId && _h('div', {style: { fontSize: '11px', color: 'var(--dsw-alias-label-secondary, #888)', marginTop: '4px', fontFamily: 'monospace' }
550
- }, 'Run ID: ' + chainRunId)
551
- ),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',onClick: onClose
552
- }, 'โœ•')
553
- ),_h('div', {style: { flex: 1, overflowY: 'auto', padding: '16px 0', minHeight: '260px' }
554
- },loading && _h('div', {className: 'dsh-cron-history-empty'
555
- }, T_KEY(t, 'history.loading')),!loading && nodes.length === 0 && _h('div', {className: 'dsh-cron-history-empty'
556
- }, T_KEY(t, 'chainGraph.noNodes')),!loading && nodes.length > 0 && _h('div', {style: { display: 'flex', flexDirection: 'column', gap: '16px' }
557
- },_h('div', {style: { display: 'flex', gap: '12px', fontSize: '11px', color: 'var(--dsw-alias-label-secondary, #888)', padding: '0 4px' }
558
- },_h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' } },_h('span', { style: { width: '8px', height: '8px', borderRadius: '50%', background: 'var(--dsh-cron-success)' } }),T_KEY(t, 'chainGraph.stepSuccess')
559
- ),_h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' } },_h('span', { style: { width: '8px', height: '8px', borderRadius: '50%', background: 'var(--dsh-cron-danger)' } }),T_KEY(t, 'chainGraph.stepFailed')
560
- ),_h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' } },_h('span', { style: { width: '8px', height: '8px', borderRadius: '50%', background: 'var(--dsw-alias-label-tertiary, #888)' } }),T_KEY(t, 'chainGraph.stepPending')
561
- )
562
- ),_h('div', {style: {display: 'flex',flexWrap: 'wrap',gap: '12px',alignItems: 'stretch',background: 'var(--dsw-alias-bg-layer-2)',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '8px',padding: '16px'
563
- }
564
- },nodes.map((n, idx) => {
565
- const isOk = n.status === 'success';
566
- const isFailed = n.status === 'failed';
567
- const borderColor = isOk
568
- ? 'var(--dsh-cron-success)'
569
- : isFailed
570
- ? 'var(--dsh-cron-danger)'
571
- : 'var(--dsw-alias-border-l2)';
572
- return _h('div', {key: n.id || idx,style: {flex: '1 1 220px',maxWidth: '260px',background: 'var(--dsw-alias-bg-layer-1)',border: '1px solid ' + borderColor,borderRadius: '6px',padding: '12px',display: 'flex',flexDirection: 'column',gap: '8px',boxShadow: isFailed ? '0 0 0 1px var(--dsh-cron-danger)' : 'none'
573
- }
574
- },_h('div', {style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: '6px' }
575
- },_h('div', {style: { fontWeight: '600', fontSize: '13px', color: 'var(--dsw-alias-label-primary)' }
576
- }, n.title || n.id),_h('span', {style: {fontSize: '10px',padding: '2px 6px',borderRadius: '10px',fontWeight: '600',background: isOk ? 'var(--dsh-cron-success-bg)' : isFailed ? 'var(--dsh-cron-danger-bg)' : 'var(--dsw-alias-bg-layer-3)',color: isOk ? 'var(--dsh-cron-success)' : isFailed ? 'var(--dsh-cron-danger)' : 'var(--dsw-alias-label-secondary)'
577
- }
578
- }, isOk ? 'โœ“ ' + T_KEY(t, 'chainGraph.stepSuccess') : isFailed ? 'โœ— ' + T_KEY(t, 'chainGraph.stepFailed') : 'โณ ' + T_KEY(t, 'chainGraph.stepPending'))
579
- ),_h('div', {style: { fontSize: '11px', color: 'var(--dsw-alias-label-secondary)', display: 'flex', gap: '8px', flexWrap: 'wrap' }
580
- },n.durationMs > 0 && _h('span', null, n.durationMs + 'ms'),n.retryCount > 0 && _h('span', { style: { color: 'var(--dsh-cron-warning)' } }, 'โ†ป ' + n.retryCount),n.joinPolicy && n.dependsOn?.length > 0 && _h('span', {style: { background: 'var(--dsw-alias-bg-layer-3)', padding: '1px 4px', borderRadius: '4px' }
581
- }, n.joinPolicy === 'any_success' ? 'join:any' : 'join:all')
582
- ),n.isDecisionNode && _h('div', {style: { fontSize: '11px', color: 'var(--dsh-cron-warning)', fontWeight: '600', display: 'flex', alignItems: 'center', gap: '4px' }
583
- }, '๐Ÿ”€ ' + T_KEY(t, 'chainGraph.decisionNode') + ' (' + n.branchRulesCount + ')'),n.dependsOn?.length > 0 && _h('div', {style: { fontSize: '11px', color: 'var(--dsw-alias-label-tertiary)' }
584
- }, 'โ† ' + n.dependsOn.join(', ')),n.outputSnippet && _h('div', {style: {background: 'var(--dsw-alias-bg-layer-2)',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '4px',padding: '6px',fontSize: '11px',color: 'var(--dsw-alias-label-secondary)',fontFamily: 'monospace',whiteSpace: 'pre-wrap',wordBreak: 'break-all',maxHeight: '60px',
585
- overflowY: 'auto'
586
- }
587
- }, n.outputSnippet),isFailed && chainRunId && _h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: {marginTop: 'auto',display: 'flex',alignItems: 'center',justifyContent: 'center',gap: '6px',fontSize: '12px',padding: '6px 10px',color: 'var(--dsh-cron-danger)',borderColor: 'var(--dsh-cron-danger)'
588
- },onClick: () => onRetry && onRetry(n.id)
589
- }, '๐Ÿ”„ ' + T_KEY(t, 'chainGraph.retryStep'))
590
- );
591
- })
592
- )
593
- )
594
- ),_h('div', {className: 'dsh-cron-modal-foot',style: { borderTop: '1px solid var(--dsw-alias-border-l2)', paddingTop: '12px', marginTop: 'auto' }
595
- },_h('button', {type: 'button',className: 'dsh-cron-btn-primary',onClick: onClose
596
- }, T_KEY(t, 'chainGraph.close'))
597
- )
598
- )
599
- );
600
- }
601
- function renderLiveLogsModal({ isOpen, onClose, taskId, taskTitle, logs, autoScroll, onToggleAutoScroll, completed, status, t }) {if (!isOpen) return null;
602
- const terminalRef = (el) => {if (el && autoScroll) {el.scrollTop = el.scrollHeight;
603
- }
604
- };
605
- const isLive = status === 'running' || status === 'connecting';
606
- const statusColor = isLive ? 'var(--dsh-cron-success, #2a2)' : (status === 'completed' ? 'var(--dsw-alias-label-secondary, #888)' : 'var(--dsh-cron-danger, #e33)');
607
- return _h('div', {className: 'dsh-cron-modal-overlay',onClick: onClose
608
- },_h('div', {className: 'dsh-cron-modal',style: { maxWidth: '860px', width: '92vw', height: '80vh', display: 'flex', flexDirection: 'column', background: 'var(--dsw-alias-bg-base, #111)', color: 'var(--dsw-alias-label-primary, #ddd)', border: '1px solid var(--dsw-alias-border-l2, #333)', borderRadius: '8px' },role: 'dialog','aria-modal': 'true',
609
- onClick: (e) => e.stopPropagation()
610
- },_h('div', {style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', borderBottom: '1px solid var(--dsw-alias-border-l2, #333)', background: 'var(--dsw-alias-bg-layer-2, #111)' }
611
- },_h('div', { style: { display: 'flex', alignItems: 'center', gap: '10px' } },_h('span', { style: { fontSize: '18px' } }, '๐Ÿ“บ'),_h('div', null,_h('div', { style: { fontWeight: '600', fontSize: '14px', color: 'var(--dsw-alias-label-primary, #fff)', display: 'flex', alignItems: 'center', gap: '8px' } },T_KEY(t, 'liveLog.modalTitle'),_h('span', {style: {
612
- display: 'inline-block',width: '8px',height: '8px',borderRadius: '50%',background: statusColor,boxShadow: isLive ? '0 0 8px ' + statusColor : 'none'
613
- }
614
- })
615
- ),_h('div', { style: { fontSize: '11px', color: 'var(--dsw-alias-label-secondary, #888)', marginTop: '2px', fontFamily: 'monospace' } },(taskTitle || taskId) + ' ยท ' + (isLive ? T_KEY(t, 'liveLog.connecting') : (completed ? T_KEY(t, 'liveLog.completed') : status))
616
- )
617
- )
618
- ),_h('div', { style: { display: 'flex', alignItems: 'center', gap: '12px' } },_h('label', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #888)', display: 'flex', alignItems: 'center', gap: '4px', cursor: 'pointer' } },_h('input', {type: 'checkbox',checked: Boolean(autoScroll),onChange: onToggleAutoScroll,style: { cursor: 'pointer' }
619
- }),T_KEY(t, 'liveLog.autoScroll')
620
- ),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',style: { color: 'var(--dsw-alias-label-secondary, #888)', background: 'transparent', border: 'none', cursor: 'pointer', fontSize: '16px' },onClick: onClose
621
- }, 'โœ•')
622
- )
623
- ),_h('div', {ref: terminalRef,style: { flex: 1, overflowY: 'auto', padding: '14px 16px', fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace', fontSize: '12px', lineHeight: '1.5', background: 'var(--dsw-alias-bg-base, #000)' }
624
- },(!logs || logs.length === 0) && _h('div', {style: { color: 'var(--dsw-alias-label-secondary, #888)', fontStyle: 'italic', padding: '20px 0', textAlign: 'center' }
625
- }, isLive ? T_KEY(t, 'liveLog.waiting') : 'No output captured for this run.'),logs && logs.length > 0 && logs.map((item, idx) => {
626
- const isErr = item.stream === 'stderr';
627
- const timeStr = item.ts ? new Date(item.ts).toLocaleTimeString() : '';
628
- return _h('div', {key: idx,style: { display: 'flex', gap: '8px', color: isErr ? 'var(--dsh-cron-danger, #f55)' : 'var(--dsh-cron-success, #5f5)', wordBreak: 'break-all', whiteSpace: 'pre-wrap' }
629
- },timeStr && _h('span', { style: { color: 'var(--dsw-alias-label-secondary, #555)', userSelect: 'none', flexShrink: 0 } }, '[' + timeStr + ']'),_h('span', { style: { flex: 1 } }, item.chunk || item.text || String(item))
630
- );
631
- })
632
- ),_h('div', {style: { display: 'flex', justifyContent: 'flex-end', padding: '10px 16px', borderTop: '1px solid var(--dsw-alias-border-l2, #333)', background: 'var(--dsw-alias-bg-layer-2, #111)' }
633
- },_h('button', {type: 'button',className: 'dsh-cron-btn dsh-cron-btn-secondary',style: { padding: '6px 14px', fontSize: '12px' },onClick: onClose
634
- }, T_KEY(t, 'liveLog.close'))
635
- )
636
- )
637
- );
638
- }
639
- function renderAnalyticsDigestModal({ isOpen, onClose, digestData, isLoading, periodDays, onSelectPeriod, onSendTelegram, sendStatus, t }) {if (!isOpen) return null;
640
- const digest = digestData || {totalRuns: 0,successfulRuns: 0,failedRuns: 0,successRate: 100,totalTokens: 0,totalCostUsd: 0,healedCount: 0,activeTasksCount: 0,pausedTasksCount: 0,topUnstableTasks: [],topExpensiveTasks: []
641
- };
642
- const copyMarkdown = () => {if (!digestData) return;
643
- const text = [
644
- '# ' + (T_KEY(t, 'digest.modalTitle')),'Period: Last ' + (periodDays || 7) + ' days','Total Runs: ' + digest.totalRuns + ' (' + digest.successRate + '% SR)','Tokens: ' + digest.totalTokens + ' (~$' + digest.totalCostUsd + ' USD)','Active Tasks: ' + digest.activeTasksCount + ' active / ' + digest.pausedTasksCount + ' paused'
645
- ].join(String.fromCharCode(10));
646
- navigator.clipboard.writeText(text).catch((err) => { console.debug?.("[dsh-cron] copy skipped", err); });
647
- };
648
- return _h('div', {className: 'dsh-cron-modal-overlay',onClick: onClose
649
- },_h('div', {className: 'dsh-cron-modal',style: { maxWidth: '780px', width: '92vw', maxHeight: '86vh', display: 'flex', flexDirection: 'column', background: 'var(--dsw-alias-bg-base, #111)', color: 'var(--dsw-alias-label-primary, #ddd)', border: '1px solid var(--dsw-alias-border-l2, #333)', borderRadius: '8px' },role: 'dialog','aria-modal': 'true',
650
- onClick: (e) => e.stopPropagation()
651
- },_h('div', {style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '14px 18px', borderBottom: '1px solid var(--dsw-alias-border-l2, #333)', background: 'var(--dsw-alias-bg-layer-2, #111)' }
652
- },_h('div', { style: { display: 'flex', alignItems: 'center', gap: '10px' } },_h('span', { style: { fontSize: '20px' } }, '๐Ÿ“Š'),_h('div', null,_h('div', { style: { fontWeight: '600', fontSize: '15px', color: 'var(--dsw-alias-label-primary, #fff)' } },T_KEY(t, 'digest.modalTitle')
653
- ),_h('div', { style: { fontSize: '11.5px', color: 'var(--dsw-alias-label-secondary, #888)', marginTop: '2px' } },(T_KEY(t, 'digest.buttonTitle')) + ' ยท ' + (periodDays || 7) + 'd'
654
- )
655
- )
656
- ),_h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '4px 10px', fontSize: '12px', fontWeight: periodDays === 7 ? '600' : '400', background: periodDays === 7 ? 'var(--dsw-alias-bg-layer-3, #222)' : 'transparent' },
657
- onClick: () => onSelectPeriod && onSelectPeriod(7)
658
- }, T_KEY(t, 'digest.period7')),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '4px 10px', fontSize: '12px', fontWeight: periodDays === 30 ? '600' : '400', background: periodDays === 30 ? 'var(--dsw-alias-bg-layer-3, #222)' : 'transparent' },onClick: () => onSelectPeriod && onSelectPeriod(30)
659
- }, T_KEY(t, 'digest.period30')),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',onClick: onClose,style: { marginLeft: '8px' }
660
- }, _h('span', null, 'โœ•'))
661
- )
662
- ),_h('div', {style: { padding: '16px 18px', overflowY: 'auto', flex: 1, display: 'flex', flexDirection: 'column', gap: '16px' }
663
- },isLoading ? _h('div', { style: { padding: '30px', textAlign: 'center', color: 'var(--dsw-alias-label-secondary, #888)' } }, 'Loading digest metrics...') : _h(React.Fragment, null,(() => {
664
- const renderKpi = (label, val, sub, subCol) => _h('div', { style: { background: 'var(--dsw-alias-bg-layer-2, #111)', border: '1px solid var(--dsw-alias-border-l2, #333)', borderRadius: '6px', padding: '10px 12px' } },_h('div', { style: { fontSize: '11px', color: 'var(--dsw-alias-label-secondary, #888)' } }, label),
665
- _h('div', { style: { fontSize: '18px', fontWeight: '700', color: 'var(--dsw-alias-label-primary, #fff)', marginTop: '4px' } }, val),_h('div', { style: { fontSize: '11px', color: subCol || 'var(--dsw-alias-label-secondary, #888)', marginTop: '2px' } }, sub)
666
- );
667
- return _h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '10px' } },renderKpi(T_KEY(t, 'digest.executions'), digest.totalRuns, digest.successRate + '% SR', digest.successRate >= 90 ? 'var(--dsh-cron-success, #2a2)' : 'var(--dsh-cron-warning, #fa0)'),
668
- renderKpi(T_KEY(t, 'digest.tokens'), Number(digest.totalTokens || 0).toLocaleString(), 'LLM prompt+out'),renderKpi(T_KEY(t, 'digest.cost'), '$' + Number(digest.totalCostUsd || 0).toFixed(4), 'USD estimated'),renderKpi(T_KEY(t, 'digest.fleet'), digest.activeTasksCount, digest.pausedTasksCount + ' paused')
669
- );
670
- })(),_h('div', { style: { background: 'var(--dsw-alias-bg-layer-2, #111)', border: '1px solid var(--dsw-alias-border-l2, #333)', borderRadius: '6px', padding: '12px' } },_h('div', { style: { fontWeight: '600', fontSize: '13px', color: 'var(--dsh-cron-warning, #fa0)', marginBottom: '8px' } },'โš ๏ธ ' + (T_KEY(t, 'digest.unstableTitle'))
671
- ),(digest.topUnstableTasks && digest.topUnstableTasks.length > 0) ? _h('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px' } },digest.topUnstableTasks.map((tItem, idx) => _h('div', {key: tItem.id || idx,
672
- style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: '12px', padding: '6px 8px', background: 'var(--dsw-alias-bg-base, #111)', borderRadius: '4px', border: '1px solid var(--dsw-alias-border-l2, #222)' }
673
- },_h('span', { style: { fontFamily: 'monospace' } }, (idx + 1) + '. ' + (tItem.name || tItem.id)),_h('span', { style: { color: 'var(--dsh-cron-danger, #e33)', fontWeight: '600' } },tItem.failures + ' fail (' + tItem.successRate + '% SR)'
674
- )
675
- ))
676
- ) : _h('div', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #888)' } }, 'โœ“ All tasks healthy โ€” 0 failures in window!')
677
- ),_h('div', { style: { background: 'var(--dsw-alias-bg-layer-2, #111)', border: '1px solid var(--dsw-alias-border-l2, #333)', borderRadius: '6px', padding: '12px' } },_h('div', { style: { fontWeight: '600', fontSize: '13px', color: 'var(--dsh-cron-info, #4af)', marginBottom: '8px' } },'๐Ÿ’ฐ ' + (T_KEY(t, 'digest.expensiveTitle'))
678
- ),(digest.topExpensiveTasks && digest.topExpensiveTasks.length > 0) ? _h('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px' } },digest.topExpensiveTasks.map((tItem, idx) => _h('div', {key: tItem.id || idx,
679
- style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: '12px', padding: '6px 8px', background: 'var(--dsw-alias-bg-base, #111)', borderRadius: '4px', border: '1px solid var(--dsw-alias-border-l2, #222)' }
680
- },_h('span', { style: { fontFamily: 'monospace' } }, (idx + 1) + '. ' + (tItem.name || tItem.id)),_h('span', { style: { color: 'var(--dsw-alias-label-primary, #ddd)' } },Number(tItem.tokens || 0).toLocaleString() + ' tok ($' + Number(tItem.costUsd || 0).toFixed(4) + ')'
681
- )
682
- ))
683
- ) : _h('div', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #888)' } }, 'No significant token consumption recorded.')
684
- )
685
- )
686
- ),_h('div', {style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 18px', borderTop: '1px solid var(--dsw-alias-border-l2, #333)', background: 'var(--dsw-alias-bg-layer-2, #111)' }
687
- },_h('div', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #888)' } },sendStatus || ''
688
- ),_h('div', { style: { display: 'flex', gap: '8px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: copyMarkdown,style: { padding: '6px 14px', fontSize: '12px' }
689
- }, T_KEY(t, 'digest.copyMarkdown')),_h('button', {type: 'button',className: 'dsh-cron-btn-primary',onClick: onSendTelegram,style: { padding: '6px 14px', fontSize: '12px' }
690
- }, T_KEY(t, 'digest.sendTelegram'))
691
- )
692
- )
693
- )
694
- );
695
- }
696
- function renderTimelineHeatmapModal({isOpen,onClose,activeTab,onSelectTab,timelineData,heatmapData,isLoading,t
697
- }) {if (!isOpen) return null;
698
- const tab = activeTab || 'timeline';
699
- const timeline = timelineData || { buckets: [], totalRuns: 0, peakHoursCount: 0, maxConcurrent: 3 };
700
- const heatmap = heatmapData || { matrix: [], dayLabels: [], hourLabels: [], totalCostUsd: 0, totalTokens: 0, maxCostHour: 0 };
701
- return _h('div', {className: 'dsh-cron-modal-overlay',onClick: onClose
702
- },_h('div', {className: 'dsh-cron-modal',style: { maxWidth: '960px', width: '94vw', maxHeight: '88vh', display: 'flex', flexDirection: 'column', background: 'var(--dsw-alias-bg-base, #111)', color: 'var(--dsw-alias-label-primary, #ddd)', border: '1px solid var(--dsw-alias-border-l2, #333)', borderRadius: '8px' },role: 'dialog','aria-modal': 'true',
703
- onClick: (e) => e.stopPropagation()
704
- },_h('div', {style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '14px 18px', borderBottom: '1px solid var(--dsw-alias-border-l2, #333)', background: 'var(--dsw-alias-bg-layer-2, #111)' }
705
- },_h('div', { style: { display: 'flex', alignItems: 'center', gap: '10px' } },_h('span', { style: { fontSize: '20px' } }, tab === 'timeline' ? 'โฑ' : '๐Ÿ”ฅ'),_h('div', null,_h('div', { style: { fontWeight: '600', fontSize: '15px', color: 'var(--dsw-alias-label-primary, #fff)' } },
706
- tab === 'timeline' ? (T_KEY(t, 'timeline.modalTitle')) : (T_KEY(t, 'heatmap.modalTitle'))
707
- ),_h('div', { style: { fontSize: '11.5px', color: 'var(--dsw-alias-label-secondary, #888)', marginTop: '2px' } },tab === 'timeline'
708
- ? (timeline.totalRuns + ' runs projected ยท ' + (timeline.peakHoursCount ? 'โš ๏ธ ' + timeline.peakHoursCount + ' peak hours' : 'โœ“ balanced concurrency'))
709
- : ('$' + Number(heatmap.totalCostUsd || 0).toFixed(4) + ' USD ยท ' + Number(heatmap.totalTokens || 0).toLocaleString() + ' tokens')
710
- )
711
- )
712
- ),_h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '4px 12px', fontSize: '12px', fontWeight: tab === 'timeline' ? '600' : '400', background: tab === 'timeline' ? 'var(--dsw-alias-bg-layer-3, #222)' : 'transparent' },
713
- onClick: () => onSelectTab && onSelectTab('timeline')
714
- }, 'โฑ ' + (T_KEY(t, 'timeline.tabTimeline'))),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '4px 12px', fontSize: '12px', fontWeight: tab === 'heatmap' ? '600' : '400', background: tab === 'heatmap' ? 'var(--dsw-alias-bg-layer-3, #222)' : 'transparent' },onClick: () => onSelectTab && onSelectTab('heatmap')
715
- }, '๐Ÿ”ฅ ' + (T_KEY(t, 'heatmap.tabHeatmap'))),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',onClick: onClose,style: { marginLeft: '8px' }
716
- }, _h('span', null, 'โœ•'))
717
- )
718
- ),_h('div', {style: { padding: '16px 18px', overflowY: 'auto', flex: 1, display: 'flex', flexDirection: 'column', gap: '14px' }
719
- },isLoading ? _h('div', { style: { padding: '40px', textAlign: 'center', color: 'var(--dsw-alias-label-secondary, #888)' } }, 'Loading visualization data...') : (tab === 'timeline' ? (_h('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
720
- _h('div', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #888)', display: 'flex', justifyContent: 'space-between' } },_h('span', null, T_KEY(t, 'timeline.legendDesc')),_h('span', { style: { color: 'var(--dsh-cron-warning, #fa0)' } }, 'โš ๏ธ ' + (T_KEY(t, 'timeline.peakWarning')) + ' (' + timeline.maxConcurrent + ')')
721
- ),_h('div', {style: { display: 'grid', gridTemplateColumns: 'repeat(12, 1fr)', gap: '8px', marginTop: '6px' }
722
- },(timeline.buckets || []).map((b) => {
723
- const isPeak = b.isPeak, hasRuns = b.count > 0;
724
- return _h('div', {key: b.index,style: {background: isPeak ? 'color-mix(in srgb, var(--dsh-cron-danger, #e33) 12%, var(--dsw-alias-bg-layer-2, #111))' : (hasRuns ? 'var(--dsw-alias-bg-layer-2, #111)' : 'var(--dsw-alias-bg-base, #111)'),
725
- border: isPeak ? '1px solid var(--dsh-cron-danger, #e33)' : (hasRuns ? '1px solid var(--dsw-alias-border-l2, #333)' : '1px dashed var(--dsw-alias-border-l2, #222)'),borderRadius: '6px', padding: '8px', minHeight: '75px', display: 'flex', flexDirection: 'column', justifyContent: 'space-between'
726
- }
727
- },_h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: '11px' } },_h('span', { style: { fontWeight: '600', color: isPeak ? 'var(--dsh-cron-danger, #e33)' : 'var(--dsw-alias-label-primary, #fff)' } }, b.label),
728
- hasRuns ? _h('span', { style: { fontSize: '10px', padding: '1px 5px', borderRadius: '8px', background: isPeak ? 'var(--dsh-cron-danger, #e33)' : 'var(--dsw-alias-bg-layer-3, #222)', color: '#fff' } }, b.count) : null
729
- ),_h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: '3px', marginTop: '4px' } },(b.runs || []).slice(0, 3).map((r, rIdx) => _h('span', {key: rIdx, title: (r.title || r.taskId) + ' (' + r.time + ')',
730
- style: { fontSize: '9.5px', fontFamily: 'monospace', padding: '1px 4px', borderRadius: '3px', background: 'var(--dsw-alias-bg-base, #111)', border: '1px solid var(--dsw-alias-border-l2, #333)', maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }
731
- }, r.title || r.taskId))
732
- )
733
- );
734
- })
735
- )
736
- )
737
- ) : (_h('div', { style: { display: 'flex', flexDirection: 'column', gap: '10px' } },_h('div', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #888)', display: 'flex', justifyContent: 'space-between' } },_h('span', null, T_KEY(t, 'heatmap.matrixDesc')),_h('span', null, 'Max hour spend: $' + Number(heatmap.maxCostHour || 0).toFixed(4))
738
- ),_h('div', {style: { overflowX: 'auto', paddingBottom: '8px' }
739
- },_h('table', {style: { borderCollapse: 'collapse', width: '100%', minWidth: '700px', fontSize: '10.5px' }
740
- },_h('thead', null,_h('tr', null,_h('th', { style: { padding: '4px 6px', textAlign: 'left', color: 'var(--dsw-alias-label-secondary, #888)' } }, 'Day'),Array.from({ length: 24 }, (_, hour) => _h('th', {key: hour,style: { padding: '4px 2px', textAlign: 'center', color: 'var(--dsw-alias-label-secondary, #888)', fontWeight: '400' }
741
- }, String(hour).padStart(2, '0')))
742
- )
743
- ),_h('tbody', null,(heatmap.matrix || []).map((row, dIdx) => _h('tr', { key: dIdx },_h('td', { style: { padding: '4px 6px', fontWeight: '600', color: 'var(--dsw-alias-label-primary, #ddd)' } }, (heatmap.dayLabels && heatmap.dayLabels[dIdx]) || 'Day'),row.map((cell, hIdx) => {
744
- const intensity = cell.costIntensity || 0;
745
- const hasSpend = cell.costUsd > 0;
746
- const bg = hasSpend
747
- ? 'color-mix(in srgb, var(--dsh-cron-primary, #4af) ' + Math.max(15, Math.round(intensity * 100)) + '%, transparent)'
748
- : 'transparent';
749
- return _h('td', {key: hIdx,title: cell.dayLabel + ' ' + cell.hourLabel + ': $' + cell.costUsd + ' (' + cell.tokens.toLocaleString() + ' tokens, ' + cell.runs + ' runs)',style: {padding: '3px',textAlign: 'center',background: bg,border: '1px solid var(--dsw-alias-border-l2, #222)',cursor: hasSpend ? 'pointer' : 'default'
750
- }
751
- }, hasSpend ? _h('span', { style: { fontSize: '9px', color: intensity > 0.5 ? '#fff' : 'var(--dsw-alias-label-primary, #ddd)' } }, '$' + (cell.costUsd >= 0.01 ? cell.costUsd.toFixed(2) : cell.costUsd.toFixed(3).slice(1))) : 'ยท');
752
- })
753
- ))
754
- )
755
- )
756
- )
757
- )
758
- )
759
- )
760
- ),_h('div', {style: { display: 'flex', justifyContent: 'flex-end', padding: '12px 18px', borderTop: '1px solid var(--dsw-alias-border-l2, #333)', background: 'var(--dsw-alias-bg-layer-2, #111)' }
761
- },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: onClose,style: { padding: '6px 16px', fontSize: '12px' }
762
- }, T_KEY(t, 'chainGraph.close'))
763
- )
764
- )
765
- );
766
- }
767
- function CronScreen(props) {
768
- const { ctx, toggle, onClose } = props;
769
- const t = props.t || translate;
770
- const [isOpen, setIsOpen] = React.useState(toggle && typeof toggle.isOpen === 'function' ? toggle.isOpen() : true);
771
- React.useEffect(() => {if (!toggle || typeof toggle.subscribe !== 'function') return;
772
- return toggle.subscribe((val) => setIsOpen(val));
773
- }, [toggle]);
774
- if (!isOpen && props.pinned !== true) return null;
775
- const [tab, setTab] = React.useState('all');
776
- const [query, setQuery] = React.useState('');
777
- const [filterType, setFilterType] = React.useState('');
778
- const [filterModel, setFilterModel] = React.useState('');
779
- const [filterChannel, setFilterChannel] = React.useState('');
780
- const [filtersOpen, setFiltersOpen] = React.useState(false);
781
- const [tasks, setTasks] = React.useState([]);
782
- const [recs, setRecs] = React.useState([]);
783
- const [loading, setLoading] = React.useState(false);
784
- const [fetchError, setFetchError] = React.useState(null);
785
- const [dropdownOpen, setDropdownOpen] = React.useState(false);
786
- const [transferBusy, setTransferBusy] = React.useState(false);
787
- const [importDoc, setImportDoc] = React.useState(null);
788
- const [importSummary, setImportSummary] = React.useState(null);
789
- const [importStrategy, setImportStrategy] = React.useState('skip');
790
- const importFileRef = React.useRef(null);
791
- const [manualModalOpen, setManualModalOpen] = React.useState(false);
792
- const [formId, setFormId] = React.useState(null);
793
- const [formTitle, setFormTitle] = React.useState('');
794
- const [formSchedule, setFormSchedule] = React.useState('');
795
- const [formType, setFormType] = React.useState('llm');
796
- const [formPrompt, setFormPrompt] = React.useState('');
797
- const [formProvider, setFormProvider] = React.useState('');
798
- const [formModel, setFormModel] = React.useState('');
799
- const [formFallbackModel, setFormFallbackModel] = React.useState('');
800
- const [formSilentRule, setFormSilentRule] = React.useState('');
801
- const [formInspectOnFailure, setFormInspectOnFailure] = React.useState(false);
802
- const [formRequireApproval, setFormRequireApproval] = React.useState(false);
803
- const [formDelivery, setFormDelivery] = React.useState('isolated');
804
- const [selectedTaskMeta, setSelectedTaskMeta] = React.useState(null);
805
- const [modalTab, setModalTab] = React.useState('params');
806
- const [taskHistory, setTaskHistory] = React.useState([]);
807
- const [historyLoading, setHistoryLoading] = React.useState(false);
808
- const [retryingDeliveryId, setRetryingDeliveryId] = React.useState(null);
809
- const [formNotifyTelegram, setFormNotifyTelegram] = React.useState(false);
810
- const [formChannels, setFormChannels] = React.useState([]);
811
- const [formTemplate, setFormTemplate] = React.useState('');
812
- const [formOnlyOnFailure, setFormOnlyOnFailure] = React.useState(false);
813
- const [formTimeoutSeconds, setFormTimeoutSeconds] = React.useState(1800);
814
- const [formOverlapPolicy, setFormOverlapPolicy] = React.useState('skip');
815
- const [formKanbanMode, setFormKanbanMode] = React.useState('none');
816
- const [formOnSuccess, setFormOnSuccess] = React.useState('');
817
- const [formOnFailure, setFormOnFailure] = React.useState('');
818
- const [formDependsOn, setFormDependsOn] = React.useState('');
819
- const [formJoinPolicy, setFormJoinPolicy] = React.useState('all_success');
820
- const [formElseTask, setFormElseTask] = React.useState('');
821
- const [formAutoHeal, setFormAutoHeal] = React.useState(false);
822
- const [formAdaptiveEnabled, setFormAdaptiveEnabled] = React.useState(false);
823
- const [formAdaptiveMinInterval, setFormAdaptiveMinInterval] = React.useState('5m');
824
- const [formAdaptiveMaxInterval, setFormAdaptiveMaxInterval] = React.useState('2h');
825
- const [formAdaptiveBackoffFactor, setFormAdaptiveBackoffFactor] = React.useState('1.5');
826
- const [formAdaptiveIdleThreshold, setFormAdaptiveIdleThreshold] = React.useState('3');
827
- const [liveLogsModalOpen, setLiveLogsModalOpen] = React.useState(false);
828
- const [liveLogsTaskId, setLiveLogsTaskId] = React.useState('');
829
- const [liveLogsTaskTitle, setLiveLogsTaskTitle] = React.useState('');
830
- const [liveLogsLines, setLiveLogsLines] = React.useState([]);
831
- const [liveLogsStatus, setLiveLogsStatus] = React.useState('idle');
832
- const [liveLogsCompleted, setLiveLogsCompleted] = React.useState(false);
833
- const [liveLogsAutoScroll, setLiveLogsAutoScroll] = React.useState(true);
834
- const [chainGraphModalOpen, setChainGraphModalOpen] = React.useState(false);
835
- const [chainGraphData, setChainGraphData] = React.useState(null);
836
- const [chainGraphLoading, setChainGraphLoading] = React.useState(false);
837
- const [chainGraphRunId, setChainGraphRunId] = React.useState(null);
838
- const [digestOpen, setDigestOpen] = React.useState(false);
839
- const [digestData, setDigestData] = React.useState(null);
840
- const [digestMarkdown, setDigestMarkdown] = React.useState('');
841
- const [digestLoading, setDigestLoading] = React.useState(false);
842
- const [periodDays, setPeriodDays] = React.useState(7);
843
- const [sendStatus, setSendStatus] = React.useState(null);
844
- const [timelineOpen, setTimelineOpen] = React.useState(false);
845
- const [timelineData, setTimelineData] = React.useState(null);
846
- const [heatmapData, setHeatmapData] = React.useState(null);
847
- const [timelineLoading, setTimelineLoading] = React.useState(false);
848
- const [timelineTab, setTimelineTab] = React.useState('timeline');
849
- const [formHeartbeatIntervalSeconds, setFormHeartbeatIntervalSeconds] = React.useState(0);
850
- const [formGracePeriodSeconds, setFormGracePeriodSeconds] = React.useState(300);
851
- const [formPreflightType, setFormPreflightType] = React.useState('none');
852
- const [formPreflightTarget, setFormPreflightTarget] = React.useState('');
853
- const [formPriority, setFormPriority] = React.useState(5);
854
- const [formConcurrencyGroup, setFormConcurrencyGroup] = React.useState('default');
855
- const [formWakeTriggerType, setFormWakeTriggerType] = React.useState('none');
856
- const [formWakeTriggerPath, setFormWakeTriggerPath] = React.useState('');
857
- const [formWakeTriggerMinCount, setFormWakeTriggerMinCount] = React.useState(1);
858
- const [formWakeTriggerConsume, setFormWakeTriggerConsume] = React.useState(true);
859
- const [formWorkWindowHours, setFormWorkWindowHours] = React.useState('');
860
- const [formWorkWindowPolicy, setFormWorkWindowPolicy] = React.useState('skip');
861
- const [formTimeBoxMinutes, setFormTimeBoxMinutes] = React.useState(0);
862
- const [formWriteScopes, setFormWriteScopes] = React.useState('');
863
- const [formInputHashPaths, setFormInputHashPaths] = React.useState('');
864
- const [formSkipIfUnchanged, setFormSkipIfUnchanged] = React.useState(false);
865
- const [formSelfHealingCommand, setFormSelfHealingCommand] = React.useState('');
866
- const [formAutoDiagnose, setFormAutoDiagnose] = React.useState(false);
867
- const [schedulePreviewRuns, setSchedulePreviewRuns] = React.useState(null);
868
- const [dryRunResult, setDryRunResult] = React.useState(null);
869
- const [archiveModalOpen, setArchiveModalOpen] = React.useState(false);
870
- const [archiveTask, setArchiveTask] = React.useState(null);
871
- const [archiveRuns, setArchiveRuns] = React.useState([]);
872
- const [archiveLoading, setArchiveLoading] = React.useState(false);
873
- const [archiveOffset, setArchiveOffset] = React.useState(0);
874
- const [archiveTotal, setArchiveTotal] = React.useState(0);
875
- const [formTimezone, setFormTimezone] = React.useState('');
876
- const [formMisfirePolicy, setFormMisfirePolicy] = React.useState('skip');
877
- const [formMaxRetries, setFormMaxRetries] = React.useState(0);
878
- const [formPermissionPreset, setFormPermissionPreset] = React.useState('default');
879
- const [formAgentPreset, setFormAgentPreset] = React.useState('');
880
- const [formSessionTitle, setFormSessionTitle] = React.useState('');
881
- const [formTargetSessionId, setFormTargetSessionId] = React.useState('');
882
- const [formTargetSessionReset, setFormTargetSessionReset] = React.useState('never');
883
- const [formEnv, setFormEnv] = React.useState('');
884
- const [formCwd, setFormCwd] = React.useState('');
885
- const [formWorkspaceId, setFormWorkspaceId] = React.useState('');
886
- const [formWorktree, setFormWorktree] = React.useState(false);
887
- const [formKeepWorktree, setFormKeepWorktree] = React.useState(false);
888
- const [formCaptureGitDiff, setFormCaptureGitDiff] = React.useState(false);
889
- const [formHttpMethod, setFormHttpMethod] = React.useState('GET');
890
- const [formHttpUrl, setFormHttpUrl] = React.useState('');
891
- const [formHttpHeaders, setFormHttpHeaders] = React.useState('');
892
- const [formHttpBody, setFormHttpBody] = React.useState('');
893
- const [formSshProfileId, setFormSshProfileId] = React.useState('');
894
- const [formSshTarget, setFormSshTarget] = React.useState('');
895
- const [formSshKeyPath, setFormSshKeyPath] = React.useState('');
896
- const [formDockerImage, setFormDockerImage] = React.useState('');
897
- const [formNodePath, setFormNodePath] = React.useState('');
898
- const [formPythonPath, setFormPythonPath] = React.useState('');
899
- const [formSkillName, setFormSkillName] = React.useState('');
900
- const [formWorkflowName, setFormWorkflowName] = React.useState('');
901
- const [stats, setStats] = React.useState(null);
902
- const initialFormSnapshotRef = React.useRef(null);
903
- const getFormSnapshot = () => JSON.stringify({title: String(formTitle || '').trim(),schedule: String(formSchedule || '').trim(),type: String(formType || 'llm'),prompt: String(formPrompt || '').trim(),provider: String(formProvider || ''),model: String(formModel || ''),fallbackModel: String(formFallbackModel || ''),silentRule: String(formSilentRule || ''),
904
- inspectOnFailure: Boolean(formInspectOnFailure),requireApproval: Boolean(formRequireApproval),delivery: String(formDelivery || 'isolated'),notifyTelegram: Boolean(formNotifyTelegram),channels: Array.isArray(formChannels) ? [...formChannels].sort() : [],template: String(formTemplate || '').trim(),onlyOnFailure: Boolean(formOnlyOnFailure),
905
- timeoutSeconds: Number(formTimeoutSeconds) || 1800,overlapPolicy: String(formOverlapPolicy || 'skip'),kanbanMode: String(formKanbanMode || 'none'),onSuccess: String(formOnSuccess || '').trim(),onFailure: String(formOnFailure || '').trim(),heartbeatIntervalSeconds: Number(formHeartbeatIntervalSeconds) || 0,
906
- gracePeriodSeconds: Number(formGracePeriodSeconds) || 300,preflightType: String(formPreflightType || 'none'),preflightTarget: String(formPreflightTarget || '').trim(),priority: Number(formPriority) || 5,concurrencyGroup: String(formConcurrencyGroup || 'default').trim(),selfHealingCommand: String(formSelfHealingCommand || '').trim(),
907
- autoDiagnose: Boolean(formAutoDiagnose),timezone: String(formTimezone || '').trim(),misfirePolicy: String(formMisfirePolicy || 'skip'),maxRetries: Number(formMaxRetries) || 0,permissionPreset: String(formPermissionPreset || 'default'),agentPreset: String(formAgentPreset || '').trim(),targetSessionId: String(formTargetSessionId || '').trim(),
908
- targetSessionReset: String(formTargetSessionReset || 'never'),env: String(formEnv || '').trim(),cwd: String(formCwd || '').trim(),workspaceId: String(formWorkspaceId || '').trim(),worktree: Boolean(formWorktree),keepWorktree: Boolean(formKeepWorktree),captureGitDiff: Boolean(formCaptureGitDiff),httpMethod: String(formHttpMethod || 'GET'),
909
- httpUrl: String(formHttpUrl || '').trim(),httpHttpHeaders: String(formHttpHeaders || '').trim(),httpBody: String(formHttpBody || '').trim(),sshProfileId: String(formSshProfileId || '').trim(),sshTarget: String(formSshTarget || '').trim(),sshKeyPath: String(formSshKeyPath || '').trim(),dockerImage: String(formDockerImage || '').trim(),
910
- nodePath: String(formNodePath || '').trim(),pythonPath: String(formPythonPath || '').trim(),skillName: String(formSkillName || '').trim(),workflowName: String(formWorkflowName || '').trim(),});
911
- const isFormDirty = () => {if (!manualModalOpen) return false;
912
- if (initialFormSnapshotRef.current !== null) {
913
- return getFormSnapshot() !== initialFormSnapshotRef.current;
914
- }
915
- return Boolean(formTitle.trim() || formPrompt.trim());
916
- };
917
- const closeManualModalWithConfirm = () => {if (isFormDirty()) {if (!confirm(T_KEY(t, 'modal.confirmDiscard') || 'Discard unsaved changes?')) {return;
918
- }
919
- }
920
- initialFormSnapshotRef.current = null;
921
- setManualModalOpen(false);
922
- };
923
- const tasksRef = React.useRef([]);
924
- const [nowTick, setNowTick] = React.useState(0);
925
- React.useEffect(() => {tasksRef.current = tasks;
926
- }, [tasks]);
927
- React.useEffect(() => {
928
- const tick = setInterval(() => {if (tasksRef.current.some((t2) => t2.running)) setNowTick((v) => v + 1);
929
- }, 1000);
930
- return () => clearInterval(tick);
931
- }, []);
932
- const [settingsModalOpen, setSettingsModalOpen] = React.useState(false);
933
- const [settingsBotToken, setSettingsBotToken] = React.useState('');
934
- const [settingsChatId, setSettingsChatId] = React.useState('');
935
- const [settingsNotifyGlobal, setSettingsNotifyGlobal] = React.useState(false);
936
- const [settingsOnlyOnFailureGlobal, setSettingsOnlyOnFailureGlobal] = React.useState(false);
937
- const [settingsKanbanUrl, setSettingsKanbanUrl] = React.useState('http://127.0.0.1:3000');
938
- const [settingsDelivery, setSettingsDelivery] = React.useState({});
939
- const [settingsSections, setSettingsSections] = React.useState({ channels: true });
940
- const [settingsHasDefault, setSettingsHasDefault] = React.useState(false);
941
- const [settingsHasCustomBotToken, setSettingsHasCustomBotToken] = React.useState(false);
942
- const [testStatus, setTestStatus] = React.useState(null);
943
- const [dshModalOpen, setDshModalOpen] = React.useState(false);
944
- const [dshPrompt, setDshPrompt] = React.useState('');
945
- const [dshLoading, setDshLoading] = React.useState(false);
946
- const [providers, setProviders] = React.useState([]);
947
- const [models, setModels] = React.useState([]);
948
- const [defaultModelInfo, setDefaultModelInfo] = React.useState(null);
949
- React.useEffect(() => {
950
- const onKey = (e) => {if (e.key === 'Escape') {if (dropdownOpen) { setDropdownOpen(false); return; }
951
- if (manualModalOpen) { closeManualModalWithConfirm(); return; }
952
- if (settingsModalOpen) { setSettingsModalOpen(false); return; }
953
- if (dshModalOpen && !dshLoading) { setDshModalOpen(false); return; }
954
- if (onClose) onClose();
955
- else toggle.set(false);
956
- }
957
- };
958
- window.addEventListener('keydown', onKey);
959
- return () => window.removeEventListener('keydown', onKey);
960
- }, [manualModalOpen, settingsModalOpen, dshModalOpen, dropdownOpen, onClose]);
961
- const visibleTasks = React.useMemo(() => { let list = tasks;
962
- if (filterType) list = list.filter((x) => (x.type || 'llm') === filterType);
963
- if (filterModel) list = list.filter((x) => String(x.model || '').split('/').pop() === filterModel);
964
- if (filterChannel) {list = list.filter((x) => {
965
- const channels = Array.isArray(x.channels) && x.channels.length
966
- ? x.channels
967
- : [x.notifyTelegram ? 'telegram' : null, (x.kanbanMode || 'none') !== 'none' ? 'kanban' : null].filter(Boolean);
968
- return channels.includes(filterChannel);
969
- });
970
- }
971
- return list;
972
- }, [tasks, filterType, filterModel, filterChannel]);
973
- const filterTypeOptions = React.useMemo(() => Array.from(new Set(tasks.map((x) => x.type || 'llm'))).sort(),[tasks]
974
- );
975
- const filterModelOptions = React.useMemo(() => Array.from(new Set(tasks.map((x) => String(x.model || '').split('/').pop()).filter(Boolean))).sort(),[tasks]
976
- );
977
- const resetFilters = () => {setFilterType('');
978
- setFilterModel('');
979
- setFilterChannel('');
980
- };
981
- React.useEffect(() => {if (!pendingTaskHighlight || tasks.length === 0) return;
982
- const id = pendingTaskHighlight;
983
- pendingTaskHighlight = null;
984
- const node = document.querySelector('[data-task-id="' + id + '"]');
985
- if (!node) return;
986
- if (typeof node.scrollIntoView === 'function') node.scrollIntoView({ block: 'center' });
987
- node.classList.add('dsh-cron-task-highlight');
988
- setTimeout(() => { try { node.classList.remove('dsh-cron-task-highlight'); } catch (err) { /* node unmounted */ } }, 2500);
989
- }, [tasks]);
990
- const fetchGenRef = React.useRef(0);
991
- const fetchTasks = async () => {
992
- const gen = ++fetchGenRef.current;
993
- setLoading(true);
994
- setFetchError(null);
995
- const controller = (typeof AbortController !== 'undefined') ? new AbortController() : null;
996
- const timer = controller ? setTimeout(() => controller.abort(), 15000) : null;
997
- try {
998
- const res = await fetch('/dsh-cron/tasks?status=' + encodeURIComponent(tab) + '&query=' + encodeURIComponent(query), {signal: controller ? controller.signal : undefined,});
999
- const data = await res.json();
1000
- if (gen !== fetchGenRef.current) return;
1001
- if (data && data.ok !== false) {setTasks(data.tasks || []);
1002
- setRecs(data.recommendations || []);
1003
- setStats(data.stats || null);
1004
- } else {setFetchError(data && data.error ? data.error : T_KEY(t, 'list.loadErrorPrefix'));
1005
- }
1006
- } catch (err) {if (gen !== fetchGenRef.current) return;
1007
- console.error('[dsh-cron] fetch tasks error:', err);
1008
- setFetchError(err.message || T_KEY(t, 'list.loadErrorPrefix'));
1009
- } finally {if (timer) clearTimeout(timer);
1010
- if (gen === fetchGenRef.current) {setLoading(false);
1011
- }
1012
- }
1013
- };
1014
- const loadModels = async (providerName) => {
1015
- const controller = (typeof AbortController !== 'undefined') ? new AbortController() : null;
1016
- const timer = controller ? setTimeout(() => controller.abort(), 15000) : null;
1017
- try {
1018
- const url = providerName ? '/dsh-cron/models?provider=' + encodeURIComponent(providerName) : '/dsh-cron/models';
1019
- const res = await fetch(url, { signal: controller ? controller.signal : undefined });
1020
- const data = await res.json();
1021
- if (data && data.ok) {if (!providerName) {setProviders(data.providers || []);
1022
- setDefaultModelInfo(data.defaultModel || data.current || null);
1023
- if (data.defaultModel?.models) {setModels(data.defaultModel.models);
1024
- }
1025
- } else {setModels(data.models || []);
1026
- }
1027
- }
1028
- } catch (err) {console.error('[dsh-cron] load models error:', err);
1029
- } finally {if (timer) clearTimeout(timer);
1030
- }
1031
- };
1032
- const lastEtagRef = React.useRef('');
1033
- React.useEffect(() => {fetchTasks();
1034
- let timerId = null;
1035
- let isDestroyed = false;
1036
- let pollController = null;
1037
- const doPoll = () => {if (isDestroyed) return;
1038
- const pollGen = ++fetchGenRef.current;
1039
- const headers = {};
1040
- if (lastEtagRef.current) headers['If-None-Match'] = lastEtagRef.current;
1041
- if (pollController) pollController.abort();
1042
- pollController = (typeof AbortController !== 'undefined') ? new AbortController() : null;
1043
- const fetchOpts = { headers };
1044
- if (pollController) fetchOpts.signal = pollController.signal;
1045
- const pollTimer = pollController ? setTimeout(() => { try { pollController.abort(); } catch (abortErr) { void abortErr; } }, 15000) : null;
1046
- fetch('/dsh-cron/tasks?status=' + encodeURIComponent(tab) + '&query=' + encodeURIComponent(query), fetchOpts)
1047
- .then(res => {if (isDestroyed || pollGen !== fetchGenRef.current) return null;
1048
- if (res.status === 304) {
1049
- return null;
1050
- }
1051
- const etag = res.headers.get('ETag');
1052
- if (etag) lastEtagRef.current = etag;
1053
- return res.json();
1054
- })
1055
- .then(data => {if (isDestroyed || pollGen !== fetchGenRef.current) return;
1056
- if (data && data.ok) {setTasks(data.tasks || []);
1057
- setRecs(data.recommendations || []);
1058
- setStats(data.stats || null);
1059
- }
1060
- })
1061
- .catch(err => {if (err && err.name === 'AbortError') return;
1062
- })
1063
- .finally(() => {if (pollTimer) clearTimeout(pollTimer);
1064
- if (isDestroyed) return;
1065
- const intervalMs = (typeof document !== 'undefined' && document.hidden) ? 30000 : 8000;
1066
- timerId = setTimeout(doPoll, intervalMs);
1067
- });
1068
- };
1069
- const onVisibilityChange = () => {if (typeof document !== 'undefined' && !document.hidden) {if (timerId) clearTimeout(timerId);
1070
- doPoll();
1071
- }
1072
- };
1073
- if (typeof document !== 'undefined') {document.addEventListener('visibilitychange', onVisibilityChange);
1074
- }
1075
- timerId = setTimeout(doPoll, 8000);
1076
- return () => {isDestroyed = true;
1077
- if (timerId) clearTimeout(timerId);
1078
- if (pollController) pollController.abort();
1079
- if (typeof document !== 'undefined') {document.removeEventListener('visibilitychange', onVisibilityChange);
1080
- }
1081
- };
1082
- }, [tab, query]);
1083
- React.useEffect(() => { loadModels(); }, []);
1084
- const actionInProgressRef = React.useRef(new Set());
1085
- const fetchJsonWithTimeout = async (url, options = {}, timeoutMs = 15000) => {
1086
- const controller = typeof AbortController !== 'undefined' ? new AbortController() : null;
1087
- const timer = controller ? setTimeout(() => controller.abort(), timeoutMs) : null;
1088
- if (options && options.signal && controller) {if (options.signal.aborted) {controller.abort();
1089
- } else {options.signal.addEventListener('abort', () => controller.abort(), { once: true });
1090
- }
1091
- }
1092
- try {
1093
- const res = await fetch(url, {...options,signal: controller ? controller.signal : (options ? options.signal : undefined),});
1094
- let data = {};
1095
- try {data = await res.json();
1096
- } catch (jsonErr) {if (jsonErr && (jsonErr.name === 'AbortError' || controller?.signal.aborted)) {throw jsonErr;
1097
- }
1098
- }
1099
- return { res, data };
1100
- } catch (err) {if (err && (err.name === 'AbortError' || controller?.signal.aborted)) {
1101
- const timeoutErr = new Error(`Request timed out after ${Math.round(timeoutMs / 1000)}s`);
1102
- timeoutErr.isTimeout = true;
1103
- throw timeoutErr;
1104
- }
1105
- throw err;
1106
- } finally {if (timer) clearTimeout(timer);
1107
- }
1108
- };
1109
- const fetchWithTimeout = fetchJsonWithTimeout;
1110
- const handleToggleTask = async (id) => {if (actionInProgressRef.current.has(id)) return;
1111
- actionInProgressRef.current.add(id);
1112
- try {
1113
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(id) + '/toggle', { method: 'POST' }, 15000);
1114
- if (!res.ok || (data && data.ok === false)) {
1115
- const msg = (data && data.error) || `Toggle failed (HTTP ${res.status})`;
1116
- alert(msg);
1117
- return;
1118
- }
1119
- await fetchTasks();
1120
- } catch (err) {console.error('[dsh-cron] toggle failed', err);
1121
- alert('Toggle request failed: ' + err.message);
1122
- } finally {actionInProgressRef.current.delete(id);
1123
- }
1124
- };
1125
- const handleRunNow = async (id) => {if (actionInProgressRef.current.has(id)) return;
1126
- actionInProgressRef.current.add(id);
1127
- const prevTask = tasks.find(t => t.id === id);
1128
- const prevStatus = prevTask ? prevTask.lastStatus : null;
1129
- setTasks(prev => prev.map(t2 => t2.id === id ? { ...t2, lastStatus: 'running' } : t2));
1130
- try {
1131
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(id) + '/run', { method: 'POST' }, 15000);
1132
- if (!res.ok || (data && data.ok === false)) {setTasks(prev => prev.map(t2 => t2.id === id ? { ...t2, lastStatus: prevStatus } : t2));
1133
- const msg = (data && data.error) || `Run failed (HTTP ${res.status})`;
1134
- alert(msg);
1135
- return;
1136
- }
1137
- setTimeout(() => fetchTasks(), 1500);
1138
- } catch (err) {console.error('[dsh-cron] run now error:', err);
1139
- setTasks(prev => prev.map(t2 => t2.id === id ? { ...t2, lastStatus: prevStatus } : t2));
1140
- alert('Run request failed: ' + err.message);
1141
- } finally {actionInProgressRef.current.delete(id);
1142
- }
1143
- };
1144
- const handleDryRun = async (taskId) => {try {
1145
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/dry-run', { method: 'POST' });
1146
- setDryRunResult(data);
1147
- } catch (err) {alert('Dry run error: ' + err.message);
1148
- }
1149
- };
1150
- const openArchiveModal = async (task, offset = 0) => {setArchiveTask(task);
1151
- setArchiveOffset(offset);
1152
- setArchiveLoading(true);
1153
- setArchiveModalOpen(true);
1154
- try {
1155
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(task.id) + '/archive?limit=15&offset=' + offset);
1156
- if (data.ok) {setArchiveRuns(prev => offset === 0 ? (data.runs || []) : [...prev, ...(data.runs || [])]);
1157
- setArchiveTotal(data.total || 0);
1158
- }
1159
- } catch (err) {console.error('[dsh-cron] archive load error:', err);
1160
- } finally {setArchiveLoading(false);
1161
- }
1162
- };
1163
- const handlePreviewSchedule = async (scheduleExpr) => {try {
1164
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/schedule/preview', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ schedule: scheduleExpr, timezone: formTimezone })
1165
- });
1166
- if (data.ok && data.runs) {setSchedulePreviewRuns(data.runs);
1167
- } else {setSchedulePreviewRuns([]);
1168
- }
1169
- } catch {setSchedulePreviewRuns([]);
1170
- }
1171
- };
1172
- const handleDuplicate = async (task) => {try {
1173
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(task.id) + '/duplicate', { method: 'POST' });
1174
- if (!data.ok) {alert(T_KEY(t, 'duplicate.failed', { error: (data && data.error) || '' }));
1175
- return;
1176
- }
1177
- await fetchTasks();
1178
- alert(task.oneShot ? T_KEY(t, 'duplicate.oneShotHint') : T_KEY(t, 'duplicate.done'));
1179
- } catch (err) {alert(T_KEY(t, 'duplicate.failed', { error: err.message }));
1180
- }
1181
- };
1182
- const RESERVED_TASK_IDS = ['export', 'import'];
1183
- const isCodeTaskForm = (x) => {if (!x || typeof x !== 'object') return false;
1184
- if (CODE_FORM_TYPES.includes(x.type)) return true;
1185
- if (x.command && String(x.command).trim()) return true;
1186
- if (x.preflightType === 'command' || (x.preflightCommand && String(x.preflightCommand).trim())) return true;
1187
- if (x.selfHealingCommand && String(x.selfHealingCommand).trim()) return true;
1188
- return false;
1189
- };
1190
- const importHeaders = (document_) => {
1191
- const headers = { 'Content-Type': 'application/json' };
1192
- const tasks = (document_ && Array.isArray(document_.tasks)) ? document_.tasks : [];
1193
- if (tasks.some(isCodeTaskForm)) headers[SCRIPT_CONFIRM_HEADER] = 'script';
1194
- return headers;
1195
- };
1196
- const handleExport = async () => {setTransferBusy(true);
1197
- try {
1198
- const promptMsg = T_KEY(t, 'transfer.exportPrompt') || 'Choose export mode:\nOK = Sanitized (removes custom env vars & headers)\nCancel = Full raw export';
1199
- const wantSanitized = confirm(promptMsg);
1200
- const exportUrl = '/dsh-cron/tasks/export' + (wantSanitized ? '?sanitize=true' : '');
1201
- const { res, data } = await fetchJsonWithTimeout(exportUrl);
1202
- if (!data.ok) {alert(T_KEY(t, 'transfer.exportFailed', { error: (data && data.error) || '' }));
1203
- return;
1204
- }
1205
- const blob = new Blob([JSON.stringify(data.document, null, 2)], { type: 'application/json' });
1206
- const url = URL.createObjectURL(blob);
1207
- const stamp = new Date().toISOString().slice(0, 19).replace(/[:T]/g, '-');
1208
- const anchor = document.createElement('a');
1209
- anchor.href = url;
1210
- anchor.download = `dsh-cron-tasks-${stamp}${data.sanitized ? '-sanitized' : ''}.json`;
1211
- document.body.appendChild(anchor);
1212
- anchor.click();
1213
- document.body.removeChild(anchor);
1214
- setTimeout(() => URL.revokeObjectURL(url), 1000);
1215
- alert(T_KEY(t, 'transfer.exported', { count: data.count }));
1216
- } catch (err) {alert(T_KEY(t, 'transfer.exportFailed', { error: err.message }));
1217
- } finally {setTransferBusy(false);
1218
- }
1219
- };
1220
- const handleImportFile = async (e) => {
1221
- const file = e.target.files && e.target.files[0];
1222
- e.target.value = '';
1223
- if (!file) return;
1224
- setTransferBusy(true);
1225
- try {
1226
- const text = await file.text();
1227
- let document_;
1228
- try {document_ = JSON.parse(text);
1229
- } catch (parseErr) {alert(T_KEY(t, 'transfer.badFile', { error: parseErr.message }));
1230
- return;
1231
- }
1232
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/import', {method: 'POST',headers: importHeaders(document_),body: JSON.stringify({ document: document_, dryRun: true, strategy: importStrategy })
1233
- });
1234
- if (!data.ok) {alert(T_KEY(t, 'transfer.importFailed', { error: (data && data.error) || '' }));
1235
- return;
1236
- }
1237
- setImportDoc(document_);
1238
- setImportSummary(data.summary);
1239
- } catch (err) {alert(T_KEY(t, 'transfer.importFailed', { error: err.message }));
1240
- } finally {setTransferBusy(false);
1241
- }
1242
- };
1243
- const handleImportConfirm = async () => {if (!importDoc) return;
1244
- setTransferBusy(true);
1245
- try {
1246
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/import', {method: 'POST',headers: importHeaders(importDoc),body: JSON.stringify({ document: importDoc, strategy: importStrategy })
1247
- });
1248
- if (!data.ok) {alert(T_KEY(t, 'transfer.importFailed', { error: (data && data.error) || '' }));
1249
- return;
1250
- }
1251
- setImportDoc(null);
1252
- setImportSummary(null);
1253
- await fetchTasks();
1254
- alert(T_KEY(t, 'transfer.imported', { count: data.imported }));
1255
- } catch (err) {alert(T_KEY(t, 'transfer.importFailed', { error: err.message }));
1256
- } finally {setTransferBusy(false);
1257
- }
1258
- };
1259
- const handleTuneWithDsh = async (task) => {
1260
- const lines = [
1261
- `Tune the existing scheduled task "${task.title}" (id: ${task.id}).`,'Its current configuration is:',`- type: ${task.type || 'llm'}`,`- schedule: ${task.scheduleText || task.schedule} (${task.schedule})`,`- status: ${task.status}`,task.model ? `- model: ${task.model}${task.fallbackModel ? `, fallback: ${task.fallbackModel}` : ''}` : null,
1262
- Array.isArray(task.channels) && task.channels.length ? `- channels: ${task.channels.join(', ')}` : null,`- prompt: ${String(task.prompt || '').slice(0, 400)}`,'','Ask what should change, then apply it with the cron tool (action: "update", or action: "get" if you need the full configuration).',
1263
- 'If the change makes the task execute code (script/node/python/ssh/docker), confirm it with me explicitly before applying it.',].filter(Boolean);
1264
- try {
1265
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/chat/start', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ prompt: lines.join(String.fromCharCode(10)) })
1266
- });
1267
- if (!data.ok || !data.sessionId) {alert(T_KEY(t, 'tune.startFailed', { error: (data && data.error) || '' }));
1268
- return;
1269
- }
1270
- if (onClose) onClose();
1271
- else toggle.set(false);
1272
- await openSession(ctx, data.sessionId);
1273
- } catch (err) {alert(T_KEY(t, 'tune.startFailed', { error: err.message }));
1274
- }
1275
- };
1276
- const handleApproveProposal = async (taskId, proposalId) => {try {
1277
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/approve', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ proposalId, decidedBy: 'web-user' })
1278
- });
1279
- if (data && data.ok) {alert(T_KEY(t, 'approval.approved') || 'Approved');
1280
- setTimeout(() => fetchTasks(), 1000);
1281
- } else {alert('Approval failed: ' + ((data && data.error) || ''));
1282
- }
1283
- } catch (err) {alert('Approval request failed: ' + err.message);
1284
- }
1285
- };
1286
- const handleRejectProposal = async (taskId, proposalId) => {try {
1287
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/reject', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ proposalId, decidedBy: 'web-user' })
1288
- });
1289
- if (data && data.ok) {alert(T_KEY(t, 'approval.rejected') || 'Rejected');
1290
- setTimeout(() => fetchTasks(), 1000);
1291
- } else {alert('Rejection failed: ' + ((data && data.error) || ''));
1292
- }
1293
- } catch (err) {alert('Rejection request failed: ' + err.message);
1294
- }
1295
- };
1296
- const handleDelete = async (id) => {if (!confirm(T_KEY(t, 'confirm.delete'))) return;
1297
- try {await fetchWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(id), { method: 'DELETE' });
1298
- fetchTasks();
1299
- } catch (err) {console.debug('[dsh-cron] delete failed', err);
1300
- }
1301
- };
1302
- const openSettingsModal = async () => {setTestStatus(null);
1303
- setSettingsModalOpen(true);
1304
- try {
1305
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/settings');
1306
- if (data && data.ok && data.settings) {setSettingsBotToken(data.settings.botToken || '');
1307
- setSettingsChatId(data.settings.chatId || '');
1308
- setSettingsNotifyGlobal(Boolean(data.settings.notifyTelegram));
1309
- setSettingsOnlyOnFailureGlobal(Boolean(data.settings.onlyOnFailure));
1310
- setSettingsKanbanUrl(data.settings.kanbanBaseUrl || 'http://127.0.0.1:3000');
1311
- setSettingsDelivery(pickDeliverySettings(data.settings));
1312
- setSettingsHasDefault(Boolean(data.settings.hasDefaultCredentials));
1313
- setSettingsHasCustomBotToken(Boolean(data.settings.hasCustomBotToken));
1314
- }
1315
- } catch (err) {console.debug('[dsh-cron] settings fetch failed', err);
1316
- }
1317
- };
1318
- const handleSaveSettings = async (e) => {e.preventDefault();
1319
- try {
1320
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/settings', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify(Object.assign({botToken: settingsBotToken,chatId: settingsChatId,notifyTelegram: settingsNotifyGlobal,onlyOnFailure: settingsOnlyOnFailureGlobal,kanbanBaseUrl: settingsKanbanUrl,}, settingsDelivery))
1321
- });
1322
- if (data && data.ok) {setSettingsModalOpen(false);
1323
- } else {alert(T_KEY(t, 'settings.saveError', { error: (data && data.error) || T_KEY(t, 'settings.saveErrorUnknown') }));
1324
- }
1325
- } catch (err) {alert(T_KEY(t, 'settings.saveError', { error: err.message }));
1326
- }
1327
- };
1328
- const updateDelivery = (key, value) => {setSettingsDelivery((prev) => {
1329
- const next = Object.assign({}, prev);
1330
- if (value === undefined) delete next[key];
1331
- else next[key] = value;
1332
- return next;
1333
- });
1334
- };
1335
- const updateChannelTemplate = (channelId, value) => {setSettingsDelivery((prev) => {
1336
- const templates = Object.assign({}, prev.channelTemplates || {});
1337
- if (value && value.trim()) templates[channelId] = value;
1338
- else delete templates[channelId];
1339
- return Object.assign({}, prev, { channelTemplates: templates });
1340
- });
1341
- };
1342
- const toggleDeliverySection = (key) => {setSettingsSections((prev) => Object.assign({}, prev, { [key]: !prev[key] }));
1343
- };
1344
- const handleTestTelegram = async () => { setTestStatus({ loading: true, message: T_KEY(t, 'settings.sending') });
1345
- try {
1346
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/telegram/test', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({botToken: settingsBotToken,chatId: settingsChatId
1347
- })
1348
- });
1349
- if (data && data.ok) {setTestStatus({ loading: false, success: true, message: T_KEY(t, 'settings.testOk') });
1350
- } else {setTestStatus({ loading: false, success: false, message: T_KEY(t, 'settings.testFail', { error: (data && data.error) || '' }) });
1351
- }
1352
- } catch (err) {setTestStatus({ loading: false, success: false, message: T_KEY(t, 'settings.testFail', { error: err.message }) });
1353
- }
1354
- };
1355
- const openManualModal = (preset) => {setDropdownOpen(false);
1356
- setFormId(null);
1357
- setSelectedTaskMeta(null);
1358
- setFormType('llm');
1359
- setFormDelivery('isolated');
1360
- setFormNotifyTelegram(false);
1361
- setFormChannels([]);
1362
- setFormTemplate('');
1363
- setFormOnlyOnFailure(false);
1364
- setFormTimeoutSeconds(1800);
1365
- setFormOverlapPolicy('skip');
1366
- setFormKanbanMode('none');
1367
- setFormTimezone('');
1368
- setFormMisfirePolicy('skip');
1369
- setFormMaxRetries(0);
1370
- setFormPermissionPreset('default');
1371
- setFormAgentPreset('');
1372
- setFormTargetSessionId('');
1373
- setFormTargetSessionReset('never');
1374
- setFormEnv('');
1375
- setFormCwd('');
1376
- setFormWorkspaceId('');
1377
- setFormWorktree(false);
1378
- setFormKeepWorktree(false);
1379
- setFormCaptureGitDiff(false);
1380
- setFormHttpMethod('GET');
1381
- setFormHttpUrl('');
1382
- setFormHttpHeaders('');
1383
- setFormHttpBody('');
1384
- setFormSshProfileId('');
1385
- setFormSshTarget('');
1386
- setFormSshKeyPath('');
1387
- setFormDockerImage('');
1388
- setFormNodePath('');
1389
- setFormPythonPath('');
1390
- setFormSkillName('');
1391
- setFormWorkflowName('');
1392
- setFormFallbackModel('');
1393
- setFormSilentRule('');
1394
- setFormInspectOnFailure(false);
1395
- setFormRequireApproval(false);
1396
- setFormDependsOn('');
1397
- setFormJoinPolicy('all_success');
1398
- setFormAdaptiveEnabled(false);
1399
- setFormAdaptiveMinInterval('5m');
1400
- setFormAdaptiveMaxInterval('2h');
1401
- setFormAdaptiveBackoffFactor('1.5');
1402
- setFormAdaptiveIdleThreshold('3');
1403
- if (preset) {setFormTitle(preset.title || '');
1404
- setFormSchedule(preset.schedule || '');
1405
- setFormPrompt(preset.prompt || '');
1406
- if (preset.type) setFormType(preset.type);
1407
- if (Array.isArray(preset.channels) && preset.channels.length) setFormChannels(preset.channels.filter((c) => DELIVERY_CHANNELS.includes(c)));
1408
- if (preset.silentRule !== undefined) setFormSilentRule(preset.silentRule || '');
1409
- if (preset.fallbackModel !== undefined) setFormFallbackModel(preset.fallbackModel || '');
1410
- if (preset.inspectOnFailure !== undefined) setFormInspectOnFailure(Boolean(preset.inspectOnFailure));
1411
- if (preset.requireApproval !== undefined) setFormRequireApproval(Boolean(preset.requireApproval));
1412
- setFormOnlyOnFailure(Boolean(preset.onlyOnFailure));
1413
- setFormProvider(defaultModelInfo?.provider || '');
1414
- setFormModel(defaultModelInfo?.model || '');
1415
- if (defaultModelInfo?.provider) loadModels(defaultModelInfo.provider);
1416
- } else {setFormTitle('');
1417
- setFormSchedule('0 9 * * 1-5');
1418
- setFormPrompt('');
1419
- setFormProvider(defaultModelInfo?.provider || '');
1420
- setFormModel(defaultModelInfo?.model || '');
1421
- if (defaultModelInfo?.provider) loadModels(defaultModelInfo.provider);
1422
- }
1423
- initialFormSnapshotRef.current = JSON.stringify({title: String((preset && preset.title) || '').trim(),schedule: String((preset && preset.schedule) || (preset ? '' : '0 9 * * 1-5')).trim(),type: String((preset && preset.type) || 'llm'),prompt: String((preset && preset.prompt) || '').trim(),provider: String(defaultModelInfo?.provider || ''),
1424
- model: String(defaultModelInfo?.model || ''),fallbackModel: String((preset && preset.fallbackModel) || '').trim(),silentRule: String((preset && preset.silentRule) || '').trim(),inspectOnFailure: Boolean(preset && preset.inspectOnFailure),requireApproval: Boolean(preset && preset.requireApproval),delivery: 'isolated',notifyTelegram: false,
1425
- channels: Array.isArray(preset && preset.channels) ? [...preset.channels].filter((c) => DELIVERY_CHANNELS.includes(c)).sort() : [],template: '',onlyOnFailure: Boolean(preset && preset.onlyOnFailure),timeoutSeconds: 1800,overlapPolicy: 'skip',kanbanMode: 'none',onSuccess: '',onFailure: '',heartbeatIntervalSeconds: 0,gracePeriodSeconds: 300,
1426
- preflightType: 'none',preflightTarget: '',priority: 5,concurrencyGroup: 'default',selfHealingCommand: '',autoDiagnose: false,timezone: '',misfirePolicy: 'skip',maxRetries: 0,permissionPreset: 'default',agentPreset: '',sessionTitle: '',targetSessionId: '',targetSessionReset: 'never',env: '',cwd: '',workspaceId: '',worktree: false,keepWorktree: false,
1427
- captureGitDiff: false,httpMethod: 'GET',httpUrl: '',httpHttpHeaders: '',httpBody: '',sshProfileId: '',sshTarget: '',sshKeyPath: '',dockerImage: '',nodePath: '',pythonPath: '',skillName: '',workflowName: '',});
1428
- setManualModalOpen(true);
1429
- };
1430
- React.useEffect(() => {
1431
- const checkPreset = () => {if (!pendingTaskPreset) return;
1432
- const p = pendingTaskPreset;
1433
- pendingTaskPreset = null;
1434
- openManualModal(p);
1435
- };
1436
- checkPreset();
1437
- const onPreset = (ev) => {if (ev && ev.detail) openManualModal(ev.detail);
1438
- else checkPreset();
1439
- };
1440
- if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') {window.addEventListener('dsh-cron:preset', onPreset);
1441
- return () => {try { window.removeEventListener('dsh-cron:preset', onPreset); } catch (_e) { void _e; }
1442
- };
1443
- }
1444
- }, [tasks]);
1445
- const handleRetryDelivery = async (taskId, runId) => {setRetryingDeliveryId(runId);
1446
- try {
1447
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/retry-delivery', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ runId }),});
1448
- if (data && data.ok) {await loadTaskHistory(taskId);
1449
- } else {alert(data?.error || 'Failed to retry delivery');
1450
- }
1451
- } catch (e) {alert(e.message || 'Error retrying delivery');
1452
- } finally {setRetryingDeliveryId(null);
1453
- }
1454
- };
1455
- const handleApplyDoctorFix = async (taskId, fix) => {try {
1456
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/doctor/apply', {method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ fix }),});
1457
- if (data && data.ok) { alert('Doctor fix applied successfully! Task code updated.'); await loadTaskHistory(taskId); await fetchTasks(); }
1458
- else { alert(data?.error || 'Failed to apply doctor fix'); }
1459
- } catch (e) { alert(e.message || 'Error applying doctor fix'); }
1460
- };
1461
- const handleRevertDoctorFix = async (taskId) => {try {
1462
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/doctor/revert', {method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({}),});
1463
- if (data && data.ok) { alert('Reverted to previous version successfully!'); await loadTaskHistory(taskId); await fetchTasks(); }
1464
- else { alert(data?.error || 'Failed to revert doctor fix'); }
1465
- } catch (e) { alert(e.message || 'Error reverting doctor fix'); }
1466
- };
1467
- const handleResolveUncertain = async (taskId, runId, resolution) => {try {
1468
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/resolve-uncertain', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ runId, resolution }),});
1469
- if (data && data.ok) {await loadTaskHistory(taskId);
1470
- } else {alert(data?.error || 'Failed to resolve uncertain run');
1471
- }
1472
- } catch (e) {alert(e.message || 'Error resolving uncertain run');
1473
- }
1474
- };
1475
- const loadTaskHistory = async (taskId) => {setHistoryLoading(true);
1476
- try {
1477
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(taskId) + '/history');
1478
- if (data.ok) {setTaskHistory(data.history || []);
1479
- }
1480
- } catch (e) {console.error('[dsh-cron] history load failed:', e);
1481
- } finally {setHistoryLoading(false);
1482
- }
1483
- };
1484
- const openEditModal = (task, overrides = {}) => {setDropdownOpen(false);
1485
- setFormId(task.id);
1486
- setSelectedTaskMeta(task);
1487
- setModalTab('params');
1488
- setFormTitle(task.title || '');
1489
- setFormSchedule(task.schedule || '');
1490
- setFormType(task.type || 'llm');
1491
- setFormPrompt(overrides.prompt !== undefined ? overrides.prompt : (task.prompt || ''));
1492
- setFormProvider(task.provider || '');
1493
- setFormModel(task.model || '');
1494
- setFormFallbackModel(task.fallbackModel || '');
1495
- setFormSilentRule(task.silentRule || '');
1496
- setFormInspectOnFailure(Boolean(task.inspectOnFailure));
1497
- setFormRequireApproval(Boolean(task.requireApproval));
1498
- setFormDelivery(task.delivery || 'isolated');
1499
- setFormNotifyTelegram(Boolean(task.notifyTelegram));
1500
- setFormChannels(Array.isArray(task.channels) ? task.channels.filter((c) => DELIVERY_CHANNELS.includes(c)) : []);
1501
- setFormTemplate(task.template || '');
1502
- setFormOnlyOnFailure(Boolean(task.onlyOnFailure));
1503
- setFormTimeoutSeconds(task.timeoutSeconds !== undefined ? task.timeoutSeconds : 1800);
1504
- setFormOverlapPolicy(task.overlapPolicy || 'skip');
1505
- setFormKanbanMode(task.kanbanMode || 'none');
1506
- setFormOnSuccess(task.onSuccess || '');
1507
- setFormOnFailure(task.onFailure || '');
1508
- setFormDependsOn(Array.isArray(task.dependsOn) ? task.dependsOn.join(', ') : (task.dependsOn || ''));
1509
- setFormJoinPolicy(task.joinPolicy || 'all_success');
1510
- setFormAdaptiveEnabled(Boolean(task.adaptive?.enabled));
1511
- setFormAdaptiveMinInterval(task.adaptive?.minInterval || '5m');
1512
- setFormAdaptiveMaxInterval(task.adaptive?.maxInterval || '2h');
1513
- setFormAdaptiveBackoffFactor(String(task.adaptive?.backoffFactor || '1.5'));
1514
- setFormAdaptiveIdleThreshold(String(task.adaptive?.idleRunsThreshold || '3'));
1515
- setFormHeartbeatIntervalSeconds(task.heartbeatIntervalSeconds || 0);
1516
- setFormGracePeriodSeconds(task.gracePeriodSeconds || 300);
1517
- setFormPreflightType(task.preflightType || 'none');
1518
- setFormPreflightTarget(task.preflightTarget || '');
1519
- setFormPriority(task.priority !== undefined ? task.priority : 5);
1520
- setFormConcurrencyGroup(task.concurrencyGroup || 'default');
1521
- const _ww = task.workWindow || {};
1522
- setFormWorkWindowHours(_ww.hours || '');
1523
- setFormWorkWindowPolicy(_ww.outsidePolicy || 'skip');
1524
- setFormTimeBoxMinutes(Number(task.timeBoxMinutes) || 0);
1525
- const _wt = task.wakeTrigger || {};
1526
- setFormWakeTriggerType(_wt.enabled && _wt.type ? _wt.type : 'none');
1527
- setFormWakeTriggerPath(_wt.markerPath || _wt.path || _wt.pidFile || '');
1528
- setFormWakeTriggerMinCount(_wt.minCount || 1);
1529
- setFormWakeTriggerConsume(_wt.consumeMarker !== false);
1530
- setFormWriteScopes(Array.isArray(task.writeScopes) ? task.writeScopes.join('\n') : (task.writeScopes || ''));
1531
- setFormInputHashPaths(Array.isArray(task.inputHashPaths) ? task.inputHashPaths.join('\n') : (task.inputHashPaths || ''));
1532
- setFormSkipIfUnchanged(Boolean(task.skipIfUnchanged));
1533
- setFormSelfHealingCommand(task.selfHealingCommand || '');
1534
- setFormAutoDiagnose(Boolean(task.autoDiagnose));
1535
- setSchedulePreviewRuns(null);
1536
- setFormTimezone(task.timezone || '');
1537
- setFormMisfirePolicy(task.misfirePolicy || 'skip');
1538
- setFormMaxRetries(task.maxRetries !== undefined ? task.maxRetries : 0);
1539
- setFormPermissionPreset(task.permissionPreset === 'full' ? 'danger-full-access' : (task.permissionPreset || 'default'));
1540
- setFormAgentPreset(task.agentPreset || '');
1541
- setFormSessionTitle(task.sessionTitle || '');
1542
- setFormTargetSessionId(task.targetSessionId || '');
1543
- setFormTargetSessionReset(task.targetSessionReset || 'never');
1544
- setFormEnv(formatEnvText(task.env));
1545
- setFormCwd(task.cwd || '');
1546
- setFormWorkspaceId(task.workspaceId || '');
1547
- setFormWorktree(Boolean(task.worktree));
1548
- setFormKeepWorktree(Boolean(task.keepWorktree));
1549
- setFormCaptureGitDiff(task.captureGitDiff !== undefined ? Boolean(task.captureGitDiff) : Boolean(task.worktree));
1550
- setFormHttpMethod(task.httpMethod || 'GET');
1551
- setFormHttpUrl(task.httpUrl || '');
1552
- setFormHttpHeaders(typeof task.httpHeaders === 'string' ? task.httpHeaders : (task.httpHeaders ? JSON.stringify(task.httpHeaders) : ''));
1553
- setFormHttpBody(task.httpBody || '');
1554
- setFormSshProfileId(task.sshProfileId || '');
1555
- setFormSshTarget(task.sshTarget || '');
1556
- setFormSshKeyPath(task.sshKeyPath || '');
1557
- setFormDockerImage(task.dockerImage || '');
1558
- setFormNodePath(task.nodePath || '');
1559
- setFormPythonPath(task.pythonPath || '');
1560
- setFormSkillName(task.skillName || '');
1561
- setFormWorkflowName(task.workflowName || '');
1562
- if (task.provider) loadModels(task.provider);
1563
- else if (defaultModelInfo?.provider) loadModels(defaultModelInfo.provider);
1564
- loadTaskHistory(task.id);
1565
- setManualModalOpen(true);
1566
- };
1567
- const handleProviderChange = (e) => {
1568
- const prov = e.target.value;
1569
- setFormProvider(prov);
1570
- setFormModel('');
1571
- loadModels(prov);
1572
- };
1573
- const handleSaveManual = async (e) => {e.preventDefault();
1574
- try {
1575
- const isAgentType = AGENT_FORM_TYPES.includes(formType);
1576
- const payload = {id: formId || undefined,status: selectedTaskMeta ? selectedTaskMeta.status : 'active',title: formTitle,schedule: formSchedule,prompt: formType === 'http' ? (formPrompt.trim() || formHttpUrl.trim()) : formPrompt,type: formType,delivery: formDelivery || 'isolated',provider: isAgentType ? (formProvider || undefined) : undefined,
1577
- model: isAgentType ? (formModel || undefined) : undefined,fallbackModel: isAgentType ? (formFallbackModel.trim() || undefined) : undefined,silentRule: isAgentType ? undefined : formSilentRule.trim(),inspectOnFailure: isAgentType ? Boolean(formInspectOnFailure) : false,notifyTelegram: formNotifyTelegram,channels: formChannels,template: formTemplate.trim(),
1578
- onlyOnFailure: formOnlyOnFailure,timeoutSeconds: Number(formTimeoutSeconds) || 1800,overlapPolicy: formOverlapPolicy,timezone: formTimezone.trim(),misfirePolicy: formMisfirePolicy,maxRetries: Number(formMaxRetries) || 0,permissionPreset: isAgentType ? formPermissionPreset : 'default',agentPreset: formAgentPreset.trim() || undefined,
1579
- sessionTitle: formSessionTitle.trim() || undefined,targetSessionId: formTargetSessionId.trim() || undefined,targetSessionReset: formTargetSessionReset || 'never',kanbanMode: formKanbanMode,onSuccess: formOnSuccess.trim() || undefined,onFailure: formOnFailure.trim() || undefined,
1580
- dependsOn: formDependsOn.trim() ? formDependsOn.split(/[,;\s]+/).map((s) => s.trim()).filter(Boolean) : undefined,joinPolicy: formJoinPolicy || 'all_success',
1581
- adaptive: formAdaptiveEnabled ? { enabled: true, minInterval: formAdaptiveMinInterval || '5m', maxInterval: formAdaptiveMaxInterval || '2h', backoffFactor: Number(formAdaptiveBackoffFactor) || 1.5, idleRunsThreshold: Number(formAdaptiveIdleThreshold) || 3 } : null,heartbeatIntervalSeconds: Number(formHeartbeatIntervalSeconds) || 0,
1582
- gracePeriodSeconds: Number(formGracePeriodSeconds) || 300,preflightType: formPreflightType || 'none',preflightTarget: formPreflightTarget.trim() || undefined,priority: Number(formPriority) || 5,concurrencyGroup: formConcurrencyGroup.trim() || 'default',workWindow: formWorkWindowHours.trim() ? {enabled: true,hours: formWorkWindowHours.trim(),
1583
- outsidePolicy: formWorkWindowPolicy,} : null,timeBoxMinutes: Number(formTimeBoxMinutes) > 0 ? Number(formTimeBoxMinutes) : undefined,wakeTrigger: formWakeTriggerType && formWakeTriggerType !== 'none' ? {enabled: true,type: formWakeTriggerType,path: formWakeTriggerType === 'file_count' ? formWakeTriggerPath.trim() : undefined,
1584
- minCount: formWakeTriggerType === 'file_count' ? (Number(formWakeTriggerMinCount) || 1) : undefined,markerPath: formWakeTriggerType === 'marker_file' ? formWakeTriggerPath.trim() : undefined,pidFile: formWakeTriggerType === 'process_exit' ? formWakeTriggerPath.trim() : undefined,consumeMarker: Boolean(formWakeTriggerConsume),} : null,
1585
- writeScopes: formWriteScopes ? formWriteScopes.split(/[\n,]+/).map((s) => s.trim()).filter(Boolean) : [],inputHashPaths: formInputHashPaths ? formInputHashPaths.split(/[\n,]+/).map((s) => s.trim()).filter(Boolean) : [],skipIfUnchanged: Boolean(formSkipIfUnchanged),selfHealingCommand: formSelfHealingCommand.trim() || undefined,
1586
- autoDiagnose: Boolean(formAutoDiagnose),requireApproval: Boolean(formRequireApproval),env: parseEnvText(formEnv),cwd: formCwd.trim(),workspaceId: formWorkspaceId.trim(),worktree: isAgentType ? Boolean(formWorktree) : false,keepWorktree: isAgentType ? Boolean(formKeepWorktree) : false,captureGitDiff: Boolean(formCaptureGitDiff),httpMethod: formHttpMethod,
1587
- httpUrl: formHttpUrl.trim(),httpHeaders: formHttpHeaders.trim() || undefined,httpBody: formHttpBody,sshProfileId: formSshProfileId.trim(),sshTarget: formSshTarget.trim(),sshKeyPath: formSshKeyPath.trim(),dockerImage: formDockerImage.trim(),nodePath: formNodePath.trim(),pythonPath: formPythonPath.trim(),skillName: formSkillName.trim(),
1588
- workflowName: formWorkflowName.trim(),};
1589
- const headers = { 'Content-Type': 'application/json' };
1590
- const hasCodeExec = CODE_FORM_TYPES.includes(formType) || Boolean(payload.command && payload.command.trim()) || payload.preflightType === 'command' || Boolean(payload.preflightCommand && payload.preflightCommand.trim()) || Boolean(payload.selfHealingCommand && payload.selfHealingCommand.trim());
1591
- if (hasCodeExec) headers[SCRIPT_CONFIRM_HEADER] = 'script';
1592
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks', {method: 'POST',headers,body: JSON.stringify(payload)
1593
- });
1594
- if (!data.ok) { alert(data.error || T_KEY(t, 'settings.saveError', { error: '' })); return; }
1595
- initialFormSnapshotRef.current = null;
1596
- setManualModalOpen(false);
1597
- fetchTasks();
1598
- } catch (err) { alert(err.message); }
1599
- };
1600
- const openDshModal = () => {setDropdownOpen(false);
1601
- setDshPrompt('');
1602
- setDshModalOpen(true);
1603
- };
1604
- const handleStartWithDSH = async () => {
1605
- const text = dshPrompt.trim();
1606
- if (!text) return;
1607
- setDshLoading(true);
1608
- try {
1609
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/chat/start', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ prompt: text })
1610
- });
1611
- if (!data.ok || !data.sessionId) {alert(T_KEY(t, 'dsh.startFailed', { error: data.error || '' }));
1612
- setDshLoading(false);
1613
- return;
1614
- }
1615
- setDshModalOpen(false);
1616
- if (onClose) onClose();
1617
- else toggle.set(false);
1618
- await openSession(ctx, data.sessionId);
1619
- } catch (err) {alert(T_KEY(t, 'dsh.launchError', { error: err.message }));
1620
- } finally {setDshLoading(false);
1621
- }
1622
- };
1623
- const openChainGraphModal = async (task, chainRunId = null) => {setChainGraphModalOpen(true);
1624
- setChainGraphLoading(true);
1625
- setChainGraphData(null);
1626
- setChainGraphRunId(chainRunId);
1627
- try {if (chainRunId) {
1628
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/chains/' + encodeURIComponent(chainRunId));
1629
- if (data && data.ok) {setChainGraphData(data);
1630
- }
1631
- } else if (task) {
1632
- const graph = buildTaskGraphModel(tasks || [], [], task.id);
1633
- setChainGraphData({ ok: true, graph, task });
1634
- }
1635
- } catch (err) {console.debug('[dsh-cron] chain graph fetch failed', err);
1636
- } finally {setChainGraphLoading(false);
1637
- }
1638
- };
1639
- const handleRetryChainStep = async (stepTaskId) => {if (!chainGraphRunId || !stepTaskId) return;
1640
- try {
1641
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/chains/' + encodeURIComponent(chainGraphRunId) + '/retry-from/' + encodeURIComponent(stepTaskId), {method: 'POST'
1642
- });
1643
- if (data && data.ok) {await openChainGraphModal(null, chainGraphRunId);
1644
- } else {alert(data?.error || 'Retry failed');
1645
- }
1646
- } catch (err) {alert('Retry failed: ' + err.message);
1647
- }
1648
- };
1649
- const iconHtml = (html) => ({ dangerouslySetInnerHTML: { __html: html } });
1650
- const svgProps = (html) => ({ style: { display: 'flex', alignItems: 'center' }, ...iconHtml(html) });
1651
- function handleOpenLiveLogs(task) {if (!task || !task.id) return;
1652
- if (window.__dshLiveLogsEvtSource) {try { window.__dshLiveLogsEvtSource.close(); } catch (e) { void e; }
1653
- window.__dshLiveLogsEvtSource = null;
1654
- }
1655
- if (window.__dshLiveLogsPollTimer) {clearInterval(window.__dshLiveLogsPollTimer);
1656
- window.__dshLiveLogsPollTimer = null;
1657
- }
1658
- setLiveLogsTaskId(task.id);
1659
- setLiveLogsTaskTitle(task.title || task.id);
1660
- setLiveLogsLines([]);
1661
- setLiveLogsStatus(task.running ? 'connecting' : 'idle');
1662
- setLiveLogsCompleted(false);
1663
- setLiveLogsModalOpen(true);
1664
- const startPollingFallback = () => {if (window.__dshLiveLogsPollTimer) return;
1665
- const pollFn = () => {fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(task.id) + '/history?limit=1')
1666
- .then(({ data } = {}) => {if (data && data.history && data.history.length > 0) {
1667
- const lastRun = data.history[0];
1668
- if (lastRun.output || lastRun.error) {
1669
- const text = lastRun.output || lastRun.error;
1670
- setLiveLogsLines([{ chunk: text, stream: lastRun.error ? 'stderr' : 'stdout', ts: lastRun.at }]);
1671
- }
1672
- if (lastRun.status) {setLiveLogsStatus(lastRun.status);
1673
- setLiveLogsCompleted(true);
1674
- if (window.__dshLiveLogsPollTimer) {clearInterval(window.__dshLiveLogsPollTimer);
1675
- window.__dshLiveLogsPollTimer = null;
1676
- }
1677
- }
1678
- }
1679
- })
1680
- .catch((err) => { console.debug?.("[dsh-cron] poll skipped", err); });
1681
- };
1682
- pollFn();
1683
- window.__dshLiveLogsPollTimer = setInterval(pollFn, 2000);
1684
- };
1685
- if (typeof EventSource !== 'undefined') {try {
1686
- const streamUrl = '/dsh-cron/tasks/' + encodeURIComponent(task.id) + '/logs/stream';
1687
- const es = new EventSource(streamUrl);
1688
- window.__dshLiveLogsEvtSource = es;
1689
- es.addEventListener('init', (e) => {try {
1690
- const d = JSON.parse(e.data);
1691
- if (Array.isArray(d.bufferedLogs)) setLiveLogsLines(d.bufferedLogs);
1692
- if (d.status) setLiveLogsStatus(d.status);
1693
- if (d.status === 'completed') setLiveLogsCompleted(true);
1694
- } catch (err) { void err; }
1695
- });
1696
- es.addEventListener('log', (e) => {try {
1697
- const item = JSON.parse(e.data);
1698
- setLiveLogsLines((prev) => [...prev, item]);
1699
- setLiveLogsStatus('running');
1700
- } catch (err) { void err; }
1701
- });
1702
- es.addEventListener('complete', () => {setLiveLogsCompleted(true);
1703
- setLiveLogsStatus('completed');
1704
- try { es.close(); } catch (e) { void e; }
1705
- window.__dshLiveLogsEvtSource = null;
1706
- });
1707
- es.onerror = () => {try { es.close(); } catch (e) { void e; }
1708
- window.__dshLiveLogsEvtSource = null;
1709
- setLiveLogsStatus((curr) => {if (curr === 'running' || curr === 'connecting') {startPollingFallback();
1710
- return curr;
1711
- }
1712
- return 'completed';
1713
- });
1714
- };
1715
- } catch (err) {startPollingFallback();
1716
- }
1717
- } else {startPollingFallback();
1718
- }
1719
- }
1720
- function handleCloseLiveLogs() {if (window.__dshLiveLogsEvtSource) {try { window.__dshLiveLogsEvtSource.close(); } catch (e) { void e; }
1721
- window.__dshLiveLogsEvtSource = null;
1722
- }
1723
- if (window.__dshLiveLogsPollTimer) {clearInterval(window.__dshLiveLogsPollTimer);
1724
- window.__dshLiveLogsPollTimer = null;
1725
- }
1726
- setLiveLogsModalOpen(false);
1727
- }
1728
- const openAnalyticsDigest = async (days = 7) => {setDigestOpen(true);
1729
- setDigestLoading(true);
1730
- setPeriodDays(days);
1731
- setSendStatus(null);
1732
- try {
1733
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/analytics?days=' + encodeURIComponent(days));
1734
- if (data && data.ok) {setDigestData(data.digest || null);
1735
- setDigestMarkdown(data.markdown || '');
1736
- }
1737
- } catch (err) {console.debug('[dsh-cron] analytics digest fetch failed', err);
1738
- } finally {setDigestLoading(false);
1739
- }
1740
- };
1741
- const onSelectPeriod = async (days) => {setPeriodDays(days);
1742
- await openAnalyticsDigest(days);
1743
- };
1744
- const onSendTelegram = async () => {setSendStatus('โณ ' + (T_KEY(t, 'digest.sending') || 'Sending...'));
1745
- try {
1746
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/analytics', {method: 'POST',body: JSON.stringify({ days: periodDays })
1747
- });
1748
- if (data && data.ok) {setSendStatus('โœ… ' + (T_KEY(t, 'digest.sent') || 'Sent!'));
1749
- } else {setSendStatus('โŒ ' + (data?.error || 'Failed'));
1750
- }
1751
- } catch (err) {setSendStatus('โŒ ' + (err.message || 'Error'));
1752
- }
1753
- };
1754
- const openTimelineModal = async (tab = 'timeline') => {setTimelineOpen(true);
1755
- setTimelineLoading(true);
1756
- setTimelineTab(tab);
1757
- try {
1758
- const [timelineRes, heatmapRes] = await Promise.all([
1759
- fetchJsonWithTimeout('/dsh-cron/schedule/timeline-24h?hours=24'),fetchJsonWithTimeout('/dsh-cron/analytics/heatmap')
1760
- ]);
1761
- if (timelineRes?.data?.ok && timelineRes?.data?.timeline) {setTimelineData(timelineRes.data.timeline);
1762
- }
1763
- if (heatmapRes?.data?.ok && heatmapRes?.data?.heatmap) {setHeatmapData(heatmapRes.data.heatmap);
1764
- }
1765
- } catch (err) {console.debug('[dsh-cron] timeline fetch failed', err);
1766
- } finally {setTimelineLoading(false);
1767
- }
1768
- };
1769
- const onSelectTimelineTab = (tab) => {setTimelineTab(tab);
1770
- };
1771
- return _h('div', { className: 'dsh-cron-overlay' },_h('div', { className: 'dsh-cron-container' },_h('div', { className: 'dsh-cron-top-bar' },_h('button', {type: 'button',className: 'dsh-cron-back-btn',title: T_KEY(t, 'panel.back'),onClick: () => { if (onClose) onClose(); else toggle.set(false); }
1772
- },_h('span', svgProps(BACK_ICON)),_h('span', null, T_KEY(t, 'panel.back'))
1773
- )
1774
- ),_h('div', { className: 'dsh-cron-header' },_h('div', null,_h('div', { className: 'dsh-cron-title' }, T_KEY(t, 'panel.title')),_h('div', { className: 'dsh-cron-subtitle' }, T_KEY(t, 'panel.subtitle'))
1775
- ),_h('div', { style: { display: 'flex', alignItems: 'center', gap: '10px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { display: 'flex', alignItems: 'center', gap: '6px', height: '36px', padding: '0 12px' },title: T_KEY(t, 'timeline.buttonTitle'),onClick: () => openTimelineModal('timeline')
1776
- },_h('span', { style: { fontSize: '14px' } }, 'โฑ'),T_KEY(t, 'timeline.buttonLabel')
1777
- ),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { display: 'flex', alignItems: 'center', gap: '6px', height: '36px', padding: '0 12px' },title: T_KEY(t, 'digest.buttonTitle'),onClick: openAnalyticsDigest
1778
- },_h('span', { style: { fontSize: '14px' } }, '๐Ÿ“Š'),T_KEY(t, 'digest.buttonLabel')
1779
- ),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { display: 'flex', alignItems: 'center', gap: '6px', height: '36px', padding: '0 14px' },title: T_KEY(t, 'actions.settings'),onClick: openSettingsModal
1780
- },_h('span', { style: { display: 'flex', alignItems: 'center', color: 'var(--dsh-cron-info)' }, ...iconHtml(ICON_TELEGRAM) }),T_KEY(t, 'actions.settings')
1781
- ),_h('div', { style: { position: 'relative' } },_h('button', { className: 'dsh-cron-create-btn', onClick: () => setDropdownOpen(!dropdownOpen) },T_KEY(t, 'actions.create'),_h('span', iconHtml(ICON_CHEVRON_DOWN))
1782
- ),dropdownOpen && _h('div', { className: 'dsh-cron-dropdown' },_h('button', { className: 'dsh-cron-dropdown-item', onClick: openDshModal }, T_KEY(t, 'actions.createWithDsh')),_h('button', { className: 'dsh-cron-dropdown-item', onClick: () => openManualModal(null) }, T_KEY(t, 'actions.setupManually'))
1783
- )
1784
- ),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'transfer.exportTitle'),'aria-label': T_KEY(t, 'transfer.exportTitle'),disabled: transferBusy,onClick: handleExport
1785
- }, _h('span', svgProps(ICON_DOWNLOAD))),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'transfer.importTitle'),'aria-label': T_KEY(t, 'transfer.importTitle'),disabled: transferBusy,onClick: () => { if (importFileRef.current) importFileRef.current.click(); }
1786
- }, _h('span', svgProps(ICON_UPLOAD))),_h('input', {type: 'file',accept: '.json,application/json',ref: importFileRef,style: { display: 'none' },onChange: handleImportFile
1787
- })
1788
- )
1789
- ),_h('div', { className: 'dsh-cron-search-bar' },_h('span', { className: 'dsh-cron-search-icon', ...iconHtml(ICON_SEARCH) }),_h('input', {className: 'dsh-cron-search-input',type: 'search','aria-label': T_KEY(t, 'search.placeholder'),placeholder: T_KEY(t, 'search.placeholder'),value: query,onChange: (e) => setQuery(e.target.value)
1790
- })
1791
- ),stats && _h('div', { className: 'dsh-cron-stats-bar' },_h('div', { className: 'dsh-cron-stat-card' },_h('div', { className: 'dsh-cron-stat-val' }, stats.activeTasks || 0),_h('div', { className: 'dsh-cron-stat-lbl' }, T_KEY(t, 'stats.activeTasks'))
1792
- ),_h('div', { className: 'dsh-cron-stat-card' },_h('div', { className: 'dsh-cron-stat-val' }, stats.totalRuns || 0),_h('div', { className: 'dsh-cron-stat-lbl' }, T_KEY(t, 'stats.totalRuns'))
1793
- ),_h('div', { className: 'dsh-cron-stat-card' },_h('div', { className: 'dsh-cron-stat-val' }, (stats.totalTokens || 0).toLocaleString()),_h('div', { className: 'dsh-cron-stat-lbl' }, T_KEY(t, 'stats.totalTokens'))
1794
- ),_h('div', { className: 'dsh-cron-stat-card' },_h('div', { className: 'dsh-cron-stat-val', style: { color: 'var(--dsh-cron-success)' } }, '$' + (stats.totalCostUsd || 0).toFixed(4)),_h('div', { className: 'dsh-cron-stat-lbl' }, T_KEY(t, 'stats.totalCost'))
1795
- )
1796
- ),_h('div', { className: 'dsh-cron-tabs' },['all', 'active', 'paused', 'completed'].map((tabName) => _h('button', {key: tabName,className: 'dsh-cron-tab','data-active': tab === tabName ? 'true' : undefined,onClick: () => setTab(tabName)
1797
- },tabName === 'all' ? T_KEY(t, 'tabs.all')
1798
- : tabName === 'active' ? T_KEY(t, 'tabs.active')
1799
- : tabName === 'paused' ? T_KEY(t, 'tabs.paused')
1800
- : T_KEY(t, 'tabs.completed'))
1801
- )
1802
- ),_h('div', { className: 'dsh-cron-filters' },_h('button', {type: 'button',className: 'dsh-cron-filter-toggle','aria-expanded': filtersOpen ? 'true' : 'false',onClick: () => setFiltersOpen(!filtersOpen)
1803
- },T_KEY(t, 'filters.title'),(filterType || filterModel || filterChannel) ? ' โ€ข' : ''
1804
- ),filtersOpen && _h('div', { className: 'dsh-cron-filter-panel' },_h('label', { className: 'dsh-cron-filter-field' },_h('span', null, T_KEY(t, 'filters.type')),_h('select', {value: filterType,onChange: (e) => setFilterType(e.target.value)
1805
- },_h('option', { value: '' }, T_KEY(t, 'filters.any')),...filterTypeOptions.map((value) => _h('option', { key: value, value }, value))
1806
- )
1807
- ),_h('label', { className: 'dsh-cron-filter-field' },_h('span', null, T_KEY(t, 'filters.model')),_h('select', {value: filterModel,onChange: (e) => setFilterModel(e.target.value)
1808
- },_h('option', { value: '' }, T_KEY(t, 'filters.any')),...filterModelOptions.map((value) => _h('option', { key: value, value }, value))
1809
- )
1810
- ),_h('label', { className: 'dsh-cron-filter-field' },_h('span', null, T_KEY(t, 'filters.channel')),_h('select', {value: filterChannel,onChange: (e) => setFilterChannel(e.target.value)
1811
- },_h('option', { value: '' }, T_KEY(t, 'filters.any')),...DELIVERY_CHANNELS.map((id) => _h('option', { key: id, value: id }, T_KEY(t, CHANNEL_LABEL_KEYS[id])))
1812
- )
1813
- )
1814
- )
1815
- ),fetchError ? _h('div', {className: 'dsh-cron-status-banner','data-type': 'error',style: { margin: '8px 0', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }
1816
- },_h('span', null, T_KEY(t, 'banner.loadError', { error: fetchError })),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { marginLeft: '8px', padding: '2px 8px', fontSize: '12px' },onClick: () => fetchTasks()
1817
- }, T_KEY(t, 'banner.retry'))
1818
- ) : null,(filterType || filterModel || filterChannel) ? _h('div', {className: 'dsh-cron-filter-summary',style: { fontSize: '12px', color: 'var(--dsw-alias-label-tertiary, #888)', marginBottom: '8px', display: 'flex', gap: '8px', alignItems: 'center' }
1819
- },_h('span', null, T_KEY(t, 'filters.showing', { shown: visibleTasks.length, total: tasks.length })),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '2px 8px', fontSize: '11px' },onClick: resetFilters
1820
- }, T_KEY(t, 'filters.reset'))
1821
- ) : null,_h('div', { className: 'dsh-cron-task-list' },loading && tasks.length === 0
1822
- ? _h('div', { style: { color: 'var(--dsw-alias-label-tertiary, #888)', padding: '16px 0', fontSize: '14px' } }, T_KEY(t, 'list.loading'))
1823
- : tasks.length === 0
1824
- ? _h('div', { style: { color: 'var(--dsw-alias-label-tertiary, #777)', padding: '16px 0', fontSize: '14px' } }, T_KEY(t, 'list.empty'))
1825
- : visibleTasks.length === 0
1826
- ? _h('div', { style: { color: 'var(--dsw-alias-label-tertiary, #777)', padding: '16px 0', fontSize: '14px', display: 'flex', gap: '10px', alignItems: 'center' } },_h('span', null, T_KEY(t, 'filters.empty')),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '2px 8px', fontSize: '12px' },onClick: resetFilters
1827
- }, T_KEY(t, 'filters.reset'))
1828
- )
1829
- : visibleTasks.map((task) => _h('div', {key: task.id,className: 'dsh-cron-task-item','data-task-id': task.id,role: isConfigManaged(task) ? undefined : 'button',tabIndex: isConfigManaged(task) ? undefined : 0,'aria-label': task.title,style: isConfigManaged(task) ? { cursor: 'default' } : undefined,
1830
- onClick: isConfigManaged(task) ? undefined : () => openEditModal(task),onKeyDown: isConfigManaged(task) ? undefined : (e) => {if (e.key === 'Enter' || e.key === ' ') {e.preventDefault();
1831
- openEditModal(task);
1832
- }
1833
- }
1834
- },isConfigManaged(task) ? null : _h('button', {type: 'button',className: 'dsh-cron-task-status-btn' + (task.running ? ' dsh-cron-pulse' : ''),'data-active': task.status === 'active' ? 'true' : undefined,title: task.status === 'active' ? T_KEY(t, 'actions.pause') : T_KEY(t, 'actions.resume'),
1835
- 'aria-label': task.status === 'active' ? T_KEY(t, 'actions.pause') : T_KEY(t, 'actions.resume'),onClick: (e) => { e.stopPropagation(); handleToggleTask(task.id); }
1836
- }, _h('span', svgProps(task.status === 'active' ? ICON_PAUSE : ICON_PLAY))),_h('div', { className: 'dsh-cron-task-info' },_h('div', { className: 'dsh-cron-task-title' },task.title,_h('span', {className: 'dsh-cron-type-tag',style: task.type === 'script'
1837
- ? { background: 'var(--dsh-cron-info-bg)', color: 'var(--dsh-cron-info)' }
1838
- : { background: 'var(--dsh-cron-success-bg)', color: 'var(--dsh-cron-success)' }
1839
- }, task.type === 'script' ? T_KEY(t, 'list.typeShell') : T_KEY(t, 'list.typeLlm')),task.model ? _h('span', { className: 'dsh-cron-task-model-tag' }, task.model.split('/').pop()) : null,task.oneShot ? _h('span', { className: 'dsh-cron-oneshot-tag' }, T_KEY(t, 'list.oneShot')) : null,isConfigManaged(task) ? _h('span', {className: 'dsh-cron-config-tag',
1840
- title: T_KEY(t, 'list.configManagedHint')
1841
- }, T_KEY(t, 'list.configManaged')) : null,task.lastDurationMs > 0 ? _h('span', { className: 'dsh-cron-cost-tag', title: 'Last execution duration' }, task.lastDurationMs + 'ms') : null,task.onSuccess ? _h('span', { className: 'dsh-cron-type-tag dsh-cron-tag-success', title: 'On success: triggers ' + task.onSuccess }, 'โžœ ' + task.onSuccess) : null,
1842
- task.onFailure ? _h('span', { className: 'dsh-cron-type-tag dsh-cron-tag-failure', title: 'On failure: triggers ' + task.onFailure }, 'โ†ณ ' + task.onFailure) : null,
1843
- (task.dependsOn && (Array.isArray(task.dependsOn) ? task.dependsOn.length > 0 : Boolean(task.dependsOn))) ? _h('span', { className: 'dsh-cron-type-tag dsh-cron-tag-heartbeat', title: 'Depends on: ' + (Array.isArray(task.dependsOn) ? task.dependsOn.join(', ') : task.dependsOn) }, 'โ›“๏ธ ' + (Array.isArray(task.dependsOn) ? task.dependsOn.join(', ') : task.dependsOn)) : null,
1844
- task.adaptive?.enabled ? _h('span', {className: 'dsh-cron-type-tag' + (task.adaptiveState?.backedOff ? ' dsh-cron-tag-failure' : ' dsh-cron-tag-success'),title: 'Adaptive: ' + (task.adaptiveState?.effectiveIntervalStr || task.adaptive.minInterval || '5m') + ' (idle: ' + (task.adaptiveState?.idleCount || 0) + ')'
1845
- }, (task.adaptiveState?.backedOff ? 'โณ ' : 'โšก ') + (task.adaptiveState?.effectiveIntervalStr || task.adaptive.minInterval || '5m')) : null,
1846
- task.heartbeatIntervalSeconds > 0 ? _h('span', { className: 'dsh-cron-type-tag dsh-cron-tag-heartbeat', title: 'Heartbeat: every ' + task.heartbeatIntervalSeconds + 's' }, '๐Ÿ’“ ' + task.heartbeatIntervalSeconds + 's') : null,
1847
- task.targetSessionId ? _h('span', { className: 'dsh-cron-type-tag dsh-cron-tag-session', title: 'Target session: ' + task.targetSessionId + (task.targetSessionReset && task.targetSessionReset !== 'never' ? ' (' + task.targetSessionReset + ')' : '') }, '๐Ÿงต ' + task.targetSessionId) : null,
1848
- task.preflightType && task.preflightType !== 'none' ? _h('span', { className: 'dsh-cron-type-tag dsh-cron-tag-preflight', title: 'Preflight: ' + task.preflightType }, '๐Ÿ›ก๏ธ ' + task.preflightType) : null,task.totalCostUsd > 0 ? _h('span', { className: 'dsh-cron-cost-tag' }, '$' + task.totalCostUsd.toFixed(4)) : null,
1849
- task.totalTokens > 0 ? _h('span', { className: 'dsh-cron-tokens-tag' }, (task.totalTokens > 1000 ? Math.round(task.totalTokens / 1000) + 'k' : task.totalTokens) + ' tok') : null,task.status === 'paused' && task.pausedReason ? _h('span', { className: 'dsh-cron-type-tag dsh-cron-tag-failure', title: task.pausedReason }, '๐Ÿ›‘ ' + task.pausedReason) : null
1850
- ),_h('div', { className: 'dsh-cron-task-sched' },task.scheduleText || task.schedule,task.nextRunAt ? T_KEY(t, 'list.next', { time: new Date(task.nextRunAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) }) : '',task.running && task.runningSince
1851
- ? ' ยท ' + T_KEY(t, 'list.runningNow') + ' ' + Math.max(0, Math.round((Date.now() - task.runningSince) / 1000)) + 's'
1852
- : ''
1853
- ),task.prompt ? _h('div', {className: 'dsh-cron-task-prompt-preview',title: task.prompt
1854
- }, task.prompt.slice(0, 140) + (task.prompt.length > 140 ? 'โ€ฆ' : '')) : null
1855
- ),_h('div', {className: 'dsh-cron-task-actions',onClick: (e) => e.stopPropagation()
1856
- },_h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'actions.dryRunTitle'),onClick: () => handleDryRun(task.id)
1857
- }, '๐Ÿงช'),_h('button', {type: 'button',className: 'dsh-cron-icon-btn' + (task.running ? ' dsh-cron-pulse' : ''),title: T_KEY(t, 'liveLog.viewLog'),onClick: () => handleOpenLiveLogs(task)
1858
- }, '๐Ÿ“บ'),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'actions.archiveTitle'),onClick: () => openArchiveModal(task, 0)
1859
- }, '๐Ÿ“œ'),(task.onSuccess || task.onFailure || (task.dependsOn && (Array.isArray(task.dependsOn) ? task.dependsOn.length > 0 : Boolean(task.dependsOn)))) ? _h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'chainGraph.viewGraph'),onClick: () => openChainGraphModal(task)
1860
- }, '๐Ÿ•ธ๏ธ') : null,_h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'actions.runNow'),onClick: () => handleRunNow(task.id)
1861
- }, T_KEY(t, 'actions.runNowShort')),isConfigManaged(task) ? null : _h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'actions.edit'),'aria-label': T_KEY(t, 'actions.edit'),onClick: () => openEditModal(task)
1862
- }, _h('span', svgProps(ICON_EDIT))),isConfigManaged(task) ? null : _h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'actions.tuneWithDsh'),'aria-label': T_KEY(t, 'actions.tuneWithDsh'),onClick: () => handleTuneWithDsh(task)
1863
- }, _h('span', svgProps(ICON_TUNE))),isConfigManaged(task) ? null : _h('button', {type: 'button',className: 'dsh-cron-icon-btn',title: T_KEY(t, 'actions.duplicate'),'aria-label': T_KEY(t, 'actions.duplicate'),onClick: () => handleDuplicate(task)
1864
- }, _h('span', svgProps(ICON_COPY))),isConfigManaged(task) ? null : _h('button', {type: 'button',className: 'dsh-cron-icon-btn dsh-cron-danger',title: T_KEY(t, 'actions.delete'),'aria-label': T_KEY(t, 'actions.delete'),onClick: () => handleDelete(task.id)
1865
- }, _h('span', svgProps(ICON_TRASH)))
1866
- )
1867
- )
1868
- )
1869
- ),_h('div', { className: 'dsh-cron-recs-title' }, T_KEY(t, 'recs.title')),_h('div', { className: 'dsh-cron-hint', style: { marginBottom: '8px' } }, T_KEY(t, 'recs.hint')),_h('div', { className: 'dsh-cron-recs-list' },recs.map((rec) => _h('div', {key: rec.id,className: 'dsh-cron-rec-card',role: 'button',tabIndex: 0,onClick: () => openManualModal(rec),
1870
- onKeyDown: (e) => {if (e.key === 'Enter' || e.key === ' ') {e.preventDefault();
1871
- openManualModal(rec);
1872
- }
1873
- }
1874
- },_h('div', { className: 'dsh-cron-rec-icon' },_h('span', iconHtml(rec.icon === 'bell' ? ICON_BELL : rec.icon === 'clipboard' ? ICON_CLIPBOARD : ICON_ACTIVITY))
1875
- ),_h('div', { className: 'dsh-cron-rec-content' },_h('div', { className: 'dsh-cron-rec-title' },rec.title,_h('span', { className: 'dsh-cron-rec-time' }, rec.scheduleText)
1876
- ),_h('div', { className: 'dsh-cron-rec-desc' }, rec.description)
1877
- )
1878
- )
1879
- )
1880
- )
1881
- ),manualModalOpen && _h('div', {className: 'dsh-cron-modal-overlay',onClick: (e) => {if (e.target === e.currentTarget) closeManualModalWithConfirm();
1882
- }
1883
- },_h('div', {className: 'dsh-cron-modal dsh-cron-modal-scroll',style: { maxWidth: '640px' },role: 'dialog','aria-modal': 'true',onClick: (e) => e.stopPropagation()
1884
- },_h('div', { className: 'dsh-cron-modal-head', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: formId ? '12px' : '18px' } },_h('div', { className: 'dsh-cron-modal-title', style: { margin: 0 } }, formId ? T_KEY(t, 'modal.editTitle') : T_KEY(t, 'modal.newTitle')),selectedTaskMeta && _h('span', {style: {
1885
- fontSize: '12px',padding: '3px 8px',borderRadius: '6px',background: selectedTaskMeta.status === 'active' ? 'var(--dsh-cron-success-bg)' : 'var(--dsh-cron-danger-bg)',color: selectedTaskMeta.status === 'active' ? 'var(--dsh-cron-success)' : 'var(--dsh-cron-danger)'
1886
- }
1887
- }, selectedTaskMeta.status === 'active' ? T_KEY(t, 'modal.statusActive') : T_KEY(t, 'modal.statusPaused'))
1888
- ),formId && _h('div', { className: 'dsh-cron-modal-nav' },_h('button', {type: 'button',className: 'dsh-cron-modal-tab','data-active': modalTab === 'params' ? 'true' : undefined,onClick: () => setModalTab('params')
1889
- }, T_KEY(t, 'modal.params')),_h('button', {type: 'button',className: 'dsh-cron-modal-tab','data-active': modalTab === 'history' ? 'true' : undefined,onClick: () => { setModalTab('history'); if (formId) loadTaskHistory(formId); }
1890
- }, T_KEY(t, 'modal.history', { count: taskHistory.length || 0 }))
1891
- ),modalTab === 'history' && formId ? _h('div', null,historyLoading ? _h('div', { className: 'dsh-cron-history-empty' }, T_KEY(t, 'history.loading')) :taskHistory.length === 0 ? _h('div', { className: 'dsh-cron-history-empty' }, T_KEY(t, 'history.empty')) :_h('div', { className: 'dsh-cron-history-list' },
1892
- taskHistory.map((run) => _h('div', { key: run.id, className: 'dsh-cron-history-item' },_h('div', { className: 'dsh-cron-history-head' },_h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px' } },_h('span', {className: 'dsh-cron-history-status','data-status': run.status
1893
- }, statusLabel(t, run.status)),_h('span', { className: 'dsh-cron-history-time' }, run.at ? new Date(run.at).toLocaleString() : '')
1894
- ),_h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px' } },run.costUsd > 0 && _h('span', { className: 'dsh-cron-cost-tag' }, '$' + run.costUsd.toFixed(5)),run.usage && (run.usage.inputTokens > 0 || run.usage.outputTokens > 0) && _h('span', { className: 'dsh-cron-tokens-tag' }, (run.usage.inputTokens + run.usage.outputTokens) + ' tok'),
1895
- _h('span', { style: { color: 'var(--dsw-alias-label-tertiary, #888)', fontSize: '11.5px' } }, (run.durationMs || 0) + ' ms')
1896
- )
1897
- ),run.stoppedReason && _h('div', {className: 'dsh-cron-hint',style: { display: 'flex', gap: '6px', alignItems: 'center', marginTop: '6px' }
1898
- },_h('span', { className: 'dsh-cron-badge-ref' }, T_KEY(t, 'history.stoppedReasonTitle')),_h('span', null, run.stoppedReason)
1899
- ),Array.isArray(run.stages) && run.stages.length > 0 && _h('div', {className: 'dsh-cron-stages-flow',style: { display: 'flex', gap: '6px', flexWrap: 'wrap', marginTop: '6px' }
1900
- },run.stages.map((st) => _h('span', {key: st.name,className: 'dsh-cron-stage-pill','data-status': st.status || 'unknown',title: st.error ? (st.name + ': ' + st.error) : (st.name + (st.durationMs !== undefined ? ' (' + st.durationMs + 'ms)' : ''))
1901
- }, (T_KEY(t, 'history.stage_' + st.name) || st.name) + (st.durationMs !== undefined ? ' ' + st.durationMs + 'ms' : '')))
1902
- ),run.delivery && _h('div', {style: { display: 'flex', alignItems: 'center', gap: '8px', marginTop: '6px' }
1903
- },_h('span', {className: 'dsh-cron-badge-ref','data-status': run.delivery.status
1904
- }, 'Delivery: ' + run.delivery.status),(run.delivery.status === 'failed' || run.delivery.status === 'partial') && _h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '2px 8px', fontSize: '11px' },disabled: retryingDeliveryId === run.id,onClick: () => handleRetryDelivery(formId, run.id)
1905
- }, retryingDeliveryId === run.id ? T_KEY(t, 'history.retryingDelivery') : T_KEY(t, 'history.retryDelivery'))
1906
- ),run.artifacts && run.artifacts.length > 0 && _h('div', {style: { display: 'flex', flexWrap: 'wrap', gap: '6px', marginTop: '6px', alignItems: 'center' }
1907
- },_h('span', { className: 'dsh-cron-hint', style: { fontSize: '11px' } }, '๐Ÿ“ฆ ' + T_KEY(t, 'history.artifacts') + ':'),run.artifacts.map((art) => _h('a', {key: art.name || art.id,href: '/dsh-cron/runs/' + encodeURIComponent(run.id) + '/artifacts/' + encodeURIComponent(art.name) + '/preview',target: '_blank',rel: 'noopener noreferrer',
1908
- className: 'dsh-cron-btn-secondary',style: { padding: '2px 8px', fontSize: '11px', textDecoration: 'none' },title: art.name + ' (' + Math.round((art.size || 0) / 1024 * 10) / 10 + ' KB)'
1909
- }, art.name))
1910
- ),run.status === 'uncertain' && _h('div', {className: 'dsh-cron-status-banner','data-type': 'warning',style: { marginTop: '8px', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '8px' }
1911
- },_h('span', null, 'โš ๏ธ ' + T_KEY(t, 'history.statusUncertainHint')),_h('div', { style: { display: 'flex', gap: '6px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '2px 8px', fontSize: '11px' },onClick: () => handleResolveUncertain(formId, run.id, 'completed')
1912
- }, 'โœ“ ' + T_KEY(t, 'history.resolveCompleted')),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '2px 8px', fontSize: '11px' },onClick: () => handleResolveUncertain(formId, run.id, 'failed')
1913
- }, 'โœ• ' + T_KEY(t, 'history.resolveFailed'))
1914
- )
1915
- ),(run.diagnosis || run.doctorReport) && _h('div', {className: 'dsh-cron-status-banner','data-type': 'info',style: { marginTop: '8px', display: 'flex', flexDirection: 'column', gap: '6px' }
1916
- },_h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },_h('strong', null, '๐Ÿฉบ ' + T_KEY(t, run.doctorReport ? 'history.doctorDiagnosis' : 'history.diagnosis')),_h('div', { style: { display: 'flex', gap: '6px', alignItems: 'center' } },(run.autoHealed || run.doctorReport?.autoHealed) && _h('span', {
1917
- style: { fontSize: '10px', background: 'var(--dsh-cron-success-bg)', color: 'var(--dsh-cron-success)', padding: '1px 6px', borderRadius: '8px', fontWeight: '600' }
1918
- }, 'โœจ ' + T_KEY(t, 'history.autoHealed')),(run.doctorReport?.category || run.category) && _h('span', {style: { fontSize: '10px', background: 'var(--dsw-alias-bg-layer-3)', padding: '1px 6px', borderRadius: '4px' }
1919
- }, run.doctorReport?.category || run.category),run.confidence ? _h('span', { style: { fontSize: '10px', color: 'var(--dsw-alias-label-secondary)' } }, '(' + run.confidence + ')') : null
1920
- )
1921
- ),_h('div', null, run.doctorReport?.cause || run.diagnosis),run.doctorReport?.diff && _h('div', {style: {background: 'var(--dsw-alias-bg-layer-2)',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '4px',padding: '6px',fontFamily: 'monospace',fontSize: '11px',maxHeight: '120px',overflowY: 'auto',whiteSpace: 'pre'
1922
- }
1923
- }, run.doctorReport.diff),(run.doctorReport?.suggestedFix || run.suggestion) && _h('div', { style: { display: 'flex', gap: '8px', marginTop: '4px' } },typeof handleApplyDoctorFix === 'function' && _h('button', {type: 'button',className: 'dsh-cron-btn-primary',style: { padding: '3px 10px', fontSize: '12px' },
1924
- onClick: () => handleApplyDoctorFix(formId, run.doctorReport || { suggestedFix: run.suggestion })
1925
- }, 'โšก ' + T_KEY(t, 'history.doctorApply')),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '3px 10px', fontSize: '12px' },onClick: () => openEditModal(selectedTaskMeta, { prompt: run.suggestion })
1926
- }, T_KEY(t, 'history.applySuggestion'))
1927
- )
1928
- ),run.subtaskRuns && Array.isArray(run.subtaskRuns) && run.subtaskRuns.length > 0 && _h('div', {style: { marginTop: '8px', padding: '8px', background: 'var(--dsw-alias-bg-layer-2)', borderRadius: '6px', fontSize: '12px' }
1929
- },_h('div', { style: { fontWeight: '600', marginBottom: '4px' } }, '๐Ÿ ' + T_KEY(t, 'history.swarmBadge') + ' (' + run.subtaskRuns.filter(r => r.status === 'success').length + '/' + run.subtaskRuns.length + ')'),_h('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } },run.subtaskRuns.map((st, sidx) => _h('div', {key: sidx,
1930
- style: { display: 'flex', justifyContent: 'space-between', padding: '2px 6px', background: 'var(--dsw-alias-bg-layer-3)', borderRadius: '4px' }
1931
- },_h('span', null, (st.status === 'success' ? 'โœ… ' : 'โŒ ') + st.title),_h('span', { style: { color: 'var(--dsw-alias-label-tertiary)', fontSize: '11px' } }, (st.durationMs || 0) + 'ms')
1932
- ))
1933
- )
1934
- ),run.gitDiff && run.gitDiff.hasChanges && _h('div', {className: 'dsh-cron-status-banner',style: { marginTop: '8px', display: 'flex', flexDirection: 'column', gap: '6px' }
1935
- },_h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },_h('strong', null, '๐Ÿ“ ' + T_KEY(t, 'history.gitDiff')),_h('span', { style: { fontSize: '11px', color: 'var(--dsw-alias-label-secondary)' } }, run.gitDiff.stat || '')
1936
- ),run.gitDiff.diff && _h('div', {style: {background: 'var(--dsw-alias-bg-layer-2)',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '4px',padding: '6px',fontFamily: 'monospace',fontSize: '11px',maxHeight: '140px',overflowY: 'auto',whiteSpace: 'pre'
1937
- }
1938
- }, run.gitDiff.diff),_h('div', { style: { display: 'flex', gap: '8px', marginTop: '4px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '2px 8px', fontSize: '12px' },onClick: async () => {if (!confirm('Discard all uncommitted changes in task directory?')) return;
1939
- const c = typeof AbortController !== 'undefined' ? new AbortController() : null;
1940
- const tId = c ? setTimeout(() => c.abort(), 15000) : null;
1941
- try {
1942
- const res = await fetch('/dsh-cron/tasks/' + encodeURIComponent(formId) + '/git-diff/discard', {method: 'POST',signal: c ? c.signal : undefined
1943
- });
1944
- const d = await res.json();
1945
- if (d.ok) { alert('Working directory reset successfully.'); if (formId) loadTaskHistory(formId); }
1946
- else alert(d.error || 'Failed to discard changes');
1947
- } catch (e) { alert(e.message); }
1948
- finally { if (tId) clearTimeout(tId); }
1949
- }
1950
- }, '๐Ÿ—‘๏ธ ' + T_KEY(t, 'history.discardDiff')),_h('button', {type: 'button',className: 'dsh-cron-btn-primary',style: { padding: '2px 8px', fontSize: '12px' },onClick: async () => {
1951
- const c = typeof AbortController !== 'undefined' ? new AbortController() : null;
1952
- const tId = c ? setTimeout(() => c.abort(), 15000) : null;
1953
- try {
1954
- const res = await fetch('/dsh-cron/tasks/' + encodeURIComponent(formId) + '/git-diff/apply', {method: 'POST',headers: { 'Content-Type': 'application/json' },signal: c ? c.signal : undefined,body: JSON.stringify({ diff: run.gitDiff.diff })
1955
- });
1956
- const d = await res.json();
1957
- if (d.ok) { alert('Patch applied successfully.'); if (formId) loadTaskHistory(formId); }
1958
- else alert(d.error || 'Failed to apply patch');
1959
- } catch (e) { alert(e.message); }
1960
- finally { if (tId) clearTimeout(tId); }
1961
- }
1962
- }, 'โœ… ' + T_KEY(t, 'history.applyDiff'))
1963
- )
1964
- ),run.silentSkip && _h('div', {className: 'dsh-cron-hint',style: { display: 'flex', gap: '6px', alignItems: 'center' }
1965
- },_h('span', { className: 'dsh-cron-badge-ref' }, T_KEY(t, 'history.silentSkip')),_h('span', null, run.silentReason || '')
1966
- ),run.output && _h('div', { className: 'dsh-cron-history-output' }, run.output),run.error && _h('div', { className: 'dsh-cron-history-output', style: { color: 'var(--dsh-cron-danger)', borderColor: 'var(--dsh-cron-danger-bg)' } }, run.error),run.sessionId && _h('button', {type: 'button',className: 'dsh-cron-btn-secondary',
1967
- style: { marginTop: '8px', fontSize: '12px', padding: '4px 10px' },onClick: () => openSession(ctx, run.sessionId)
1968
- }, T_KEY(t, 'history.openSession'))
1969
- ))
1970
- ),_h('div', { className: 'dsh-cron-modal-foot', style: { marginTop: '18px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: () => { if (formId) loadTaskHistory(formId); }
1971
- }, T_KEY(t, 'history.refresh')),_h('button', {type: 'button',className: 'dsh-cron-btn-primary',onClick: closeManualModalWithConfirm
1972
- }, T_KEY(t, 'modal.close'))
1973
- )
1974
- ) :_h('form', { onSubmit: handleSaveManual },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.nameLabel')),_h('input', {required: true,autoFocus: true,value: formTitle,placeholder: T_KEY(t, 'form.namePlaceholder'),onChange: (e) => setFormTitle(e.target.value)
1975
- })
1976
- ),_h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.typeLabel')),_h('select', {value: formType,onChange: (e) => setFormType(e.target.value)
1977
- },_h('option', { value: 'llm' }, T_KEY(t, 'form.typeLlm')),_h('option', { value: 'script' }, T_KEY(t, 'form.typeScript')),_h('option', { value: 'node' }, T_KEY(t, 'form.typeNode')),_h('option', { value: 'python' }, T_KEY(t, 'form.typePython')),_h('option', { value: 'http' }, T_KEY(t, 'form.typeHttp')),
1978
- _h('option', { value: 'ssh' }, T_KEY(t, 'form.typeSsh')),_h('option', { value: 'docker' }, T_KEY(t, 'form.typeDocker')),_h('option', { value: 'skill' }, T_KEY(t, 'form.typeSkill')),_h('option', { value: 'workflow' }, T_KEY(t, 'form.typeWorkflow')),_h('option', { value: 'digest' }, T_KEY(t, 'form.typeDigest'))
1979
- )
1980
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.scheduleLabel')),_h('input', {required: true,value: formSchedule,placeholder: T_KEY(t, 'form.schedulePlaceholder'),onChange: (e) => setFormSchedule(e.target.value)
1981
- }),_h('div', { style: { display: 'flex', gap: '5px', flexWrap: 'wrap', marginTop: '5px' } },[
1982
- { label: '15m', expr: '*/15 * * * *' },{ label: '1h', expr: '0 * * * *' },{ label: 'Daily 09:00', expr: '0 9 * * *' },{ label: 'Weekdays', expr: '0 9 * * 1-5' },{ label: 'Weekly Mon', expr: '0 9 * * 1' },].map((p) => _h('button', {key: p.label,type: 'button',className: 'dsh-cron-btn-secondary',
1983
- style: { padding: '2px 7px', fontSize: '11px', borderRadius: '4px' },onClick: () => { setFormSchedule(p.expr); handlePreviewSchedule(p.expr); }
1984
- }, p.label))
1985
- ),_h('div', { style: { display: 'flex', gap: '8px', alignItems: 'center', marginTop: '6px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '3px 8px', fontSize: '11.5px' },onClick: () => handlePreviewSchedule(formSchedule)
1986
- }, T_KEY(t, 'form.previewSchedule')),schedulePreviewRuns && schedulePreviewRuns.length > 0 && _h('div', { style: { fontSize: '11px', color: 'var(--dsw-alias-label-secondary, #999)' } },T_KEY(t, 'form.previewScheduleTitle') + ' ' + schedulePreviewRuns.slice(0, 3).map(r => new Date(r).toLocaleTimeString()).join(', ')
1987
- )
1988
- )
1989
- )
1990
- ),_h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.timeoutLabel')),_h('input', {type: 'number',min: 1,value: formTimeoutSeconds,placeholder: '1800',onChange: (e) => setFormTimeoutSeconds(e.target.value)
1991
- })
1992
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.overlapLabel')),_h('select', {value: formOverlapPolicy,onChange: (e) => setFormOverlapPolicy(e.target.value)
1993
- },_h('option', { value: 'skip' }, T_KEY(t, 'form.overlapSkip')),_h('option', { value: 'queue' }, T_KEY(t, 'form.overlapQueue')),_h('option', { value: 'replace' }, T_KEY(t, 'form.overlapReplace'))
1994
- )
1995
- )
1996
- ),_h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.timezoneLabel')),_h('input', {value: formTimezone,placeholder: T_KEY(t, 'form.timezonePlaceholder'),onChange: (e) => setFormTimezone(e.target.value)
1997
- })
1998
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.misfireLabel')),_h('select', {value: formMisfirePolicy,onChange: (e) => setFormMisfirePolicy(e.target.value)
1999
- },_h('option', { value: 'skip' }, T_KEY(t, 'form.misfireSkip')),_h('option', { value: 'runOnce' }, T_KEY(t, 'form.misfireRunOnce')),_h('option', { value: 'catchUpAll' }, T_KEY(t, 'form.misfireCatchUp'))
2000
- )
2001
- )
2002
- ),AGENT_FORM_TYPES.includes(formType) ? (_h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.retriesLabel')),_h('input', {type: 'number',min: 0,value: formMaxRetries,placeholder: '0',onChange: (e) => setFormMaxRetries(e.target.value)
2003
- })
2004
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.permissionLabel')),_h('select', {value: formPermissionPreset,onChange: (e) => setFormPermissionPreset(e.target.value)
2005
- },_h('option', { value: 'default' }, T_KEY(t, 'form.permissionDefault')),_h('option', { value: 'read-only' }, T_KEY(t, 'form.permissionReadonly')),_h('option', { value: 'workspace-write' }, T_KEY(t, 'form.permissionWrite')),_h('option', { value: 'danger-full-access' }, T_KEY(t, 'form.permissionFull'))
2006
- )
2007
- )
2008
- )
2009
- ) : (_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.retriesLabel')),_h('input', {type: 'number',min: 0,value: formMaxRetries,placeholder: '0',onChange: (e) => setFormMaxRetries(e.target.value)
2010
- })
2011
- )
2012
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.kanbanLabel')),_h('select', {value: formKanbanMode,onChange: (e) => setFormKanbanMode(e.target.value)
2013
- },_h('option', { value: 'none' }, T_KEY(t, 'form.kanbanNone')),_h('option', { value: 'on_failure' }, T_KEY(t, 'form.kanbanOnFailure')),_h('option', { value: 'always' }, T_KEY(t, 'form.kanbanAlways'))
2014
- )
2015
- ),AGENT_FORM_TYPES.includes(formType) && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.agentPresetLabel')),_h('input', {type: 'text',value: formAgentPreset,placeholder: T_KEY(t, 'form.agentPresetPlaceholder'),onChange: (e) => setFormAgentPreset(e.target.value)
2016
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.agentPresetHint'))
2017
- ),AGENT_FORM_TYPES.includes(formType) && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.sessionTitleLabel')),_h('input', {type: 'text',value: formSessionTitle,placeholder: T_KEY(t, 'form.sessionTitlePlaceholder'),onChange: (e) => setFormSessionTitle(e.target.value)
2018
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.sessionTitleHint'))
2019
- ),AGENT_FORM_TYPES.includes(formType) && _h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.targetSessionIdLabel')),_h('input', {type: 'text',value: formTargetSessionId,placeholder: T_KEY(t, 'form.targetSessionIdPlaceholder'),onChange: (e) => setFormTargetSessionId(e.target.value)
2020
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.targetSessionIdHint'))
2021
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.targetSessionResetLabel')),_h('select', {value: formTargetSessionReset,onChange: (e) => setFormTargetSessionReset(e.target.value)
2022
- },_h('option', { value: 'never' }, T_KEY(t, 'form.targetSessionResetNever')),_h('option', { value: 'daily' }, T_KEY(t, 'form.targetSessionResetDaily')),_h('option', { value: 'weekly' }, T_KEY(t, 'form.targetSessionResetWeekly'))
2023
- ),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.targetSessionResetHint'))
2024
- )
2025
- ),AGENT_FORM_TYPES.includes(formType) && _h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.providerLabel')),_h('select', {value: formProvider,onChange: handleProviderChange
2026
- },_h('option', { value: '' }, T_KEY(t, 'form.providerDefault')),providers.map((p) => _h('option', { key: p.id, value: p.id }, p.name || p.id))
2027
- )
2028
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.modelLabel')),_h('select', {value: formModel,onChange: (e) => setFormModel(e.target.value)
2029
- },_h('option', { value: '' }, T_KEY(t, 'form.modelDefault')),models.map((m) => _h('option', { key: m.id, value: m.id }, m.name || m.id))
2030
- )
2031
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.fallbackModelLabel')),_h('input', {type: 'text',value: formFallbackModel,placeholder: T_KEY(t, 'form.fallbackModelPlaceholder'),onChange: (e) => setFormFallbackModel(e.target.value)
2032
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.fallbackModelHint'))
2033
- ),_h('label', { className: 'dsh-cron-checkbox-row', style: { marginTop: '4px' } },_h('input', {type: 'checkbox',checked: formInspectOnFailure,onChange: (e) => setFormInspectOnFailure(e.target.checked)
2034
- }),_h('span', null, T_KEY(t, 'form.inspectOnFailureLabel'))
2035
- ),formInspectOnFailure && _h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.inspectOnFailureHint')),_h('label', { className: 'dsh-cron-checkbox-row', style: { marginTop: '8px' } },_h('input', {type: 'checkbox',checked: formRequireApproval,onChange: (e) => setFormRequireApproval(e.target.checked)
2036
- }),_h('span', null, T_KEY(t, 'form.requireApprovalLabel'))
2037
- ),formRequireApproval && _h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.requireApprovalHint'))
2038
- ),formType === 'http' && _h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.httpMethodLabel')),_h('select', {value: formHttpMethod,onChange: (e) => setFormHttpMethod(e.target.value)
2039
- },['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD'].map((m) => _h('option', { key: m, value: m }, m))
2040
- )
2041
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.httpUrlLabel')),_h('input', {required: true,value: formHttpUrl,placeholder: 'https://example.test/webhook',onChange: (e) => setFormHttpUrl(e.target.value)
2042
- })
2043
- )
2044
- ),formType === 'http' && _h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.httpHeadersLabel')),_h('input', {value: formHttpHeaders,placeholder: '{"Authorization":"Bearer ..."}',onChange: (e) => setFormHttpHeaders(e.target.value)
2045
- })
2046
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.httpBodyLabel')),_h('input', {value: formHttpBody,onChange: (e) => setFormHttpBody(e.target.value)
2047
- })
2048
- )
2049
- ),formType === 'ssh' && _h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.sshProfileLabel')),_h('input', {value: formSshProfileId,placeholder: 'prod-web',onChange: (e) => setFormSshProfileId(e.target.value)
2050
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.sshProfileHint'))
2051
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.sshTargetLabel')),_h('input', {value: formSshTarget,placeholder: 'user@example.com',onChange: (e) => setFormSshTarget(e.target.value)
2052
- }),_h('input', {style: { marginTop: '6px' },value: formSshKeyPath,placeholder: '~/.ssh/id_ed25519',onChange: (e) => setFormSshKeyPath(e.target.value)
2053
- })
2054
- )
2055
- ),formType === 'docker' && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.dockerImageLabel')),_h('input', {required: true,value: formDockerImage,placeholder: 'alpine:3.20',onChange: (e) => setFormDockerImage(e.target.value)
2056
- })
2057
- ),formType === 'skill' && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.skillNameLabel')),_h('input', {value: formSkillName,placeholder: 'gitea',onChange: (e) => setFormSkillName(e.target.value)
2058
- })
2059
- ),formType === 'workflow' && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.workflowNameLabel')),_h('input', {value: formWorkflowName,placeholder: 'nightly-release',onChange: (e) => setFormWorkflowName(e.target.value)
2060
- })
2061
- ),(formType === 'node' || formType === 'python') && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, formType === 'node' ? 'Node.js binary (optional)' : 'Python interpreter (optional)'),_h('input', {value: formType === 'node' ? formNodePath : formPythonPath,placeholder: formType === 'node' ? 'auto' : '.venv/bin/python',
2062
- onChange: (e) => (formType === 'node' ? setFormNodePath(e.target.value) : setFormPythonPath(e.target.value))
2063
- })
2064
- ),!AGENT_FORM_TYPES.includes(formType) && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.envLabel')),_h('textarea', {rows: 3,style: { fontFamily: 'monospace', fontSize: '12.5px' },value: formEnv,placeholder: T_KEY(t, 'form.envPlaceholder'),onChange: (e) => setFormEnv(e.target.value)
2065
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.envHint'))
2066
- ),_h('div', { className: 'dsh-cron-form-row' },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.cwdLabel')),_h('input', {value: formCwd,placeholder: '/srv/app',onChange: (e) => setFormCwd(e.target.value)
2067
- })
2068
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.workspaceLabel')),_h('input', {value: formWorkspaceId,onChange: (e) => setFormWorkspaceId(e.target.value)
2069
- })
2070
- )
2071
- ),AGENT_FORM_TYPES.includes(formType) && _h('div', { className: 'dsh-cron-form-group' },_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: formWorktree,onChange: (e) => setFormWorktree(e.target.checked)
2072
- }),_h('span', null, T_KEY(t, 'form.worktreeLabel'))
2073
- ),formWorktree && _h('label', { className: 'dsh-cron-checkbox-row', style: { marginLeft: '24px', marginTop: '6px' } },_h('input', {type: 'checkbox',checked: formKeepWorktree,onChange: (e) => setFormKeepWorktree(e.target.checked)
2074
- }),_h('span', null, T_KEY(t, 'form.keepWorktreeLabel'))
2075
- ),_h('label', { className: 'dsh-cron-checkbox-row', style: { marginLeft: formWorktree ? '24px' : '0px', marginTop: '6px' } },_h('input', {type: 'checkbox',checked: formCaptureGitDiff,onChange: (e) => setFormCaptureGitDiff(e.target.checked)
2076
- }),_h('span', null, T_KEY(t, 'form.captureGitDiffLabel'))
2077
- )
2078
- ),formType !== 'http' && _h('div', { className: 'dsh-cron-form-group' },_h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '4px' } },_h('label', { style: { margin: 0 } }, AGENT_FORM_TYPES.includes(formType) ? T_KEY(t, 'form.promptLabelLlm') : T_KEY(t, 'form.promptLabelScript')),
2079
- (selectedTaskMeta && selectedTaskMeta.promptHistory && selectedTaskMeta.promptHistory.length > 0) ? _h('div', { style: { display: 'flex', gap: '6px', alignItems: 'center' } },_h('span', {
2080
- style: { fontSize: '11px', padding: '1px 6px', borderRadius: '4px', background: 'var(--dsw-alias-bg-layer-3, #222)', color: 'var(--dsh-cron-info, #4af)', border: '1px solid var(--dsw-alias-border-l2, #333)' }
2081
- }, 'v' + (selectedTaskMeta.promptVersion || 1) + ' (' + (selectedTaskMeta.promptHistory[selectedTaskMeta.promptHistory.length - 1]?.successRate !== undefined ? Math.round(selectedTaskMeta.promptHistory[selectedTaskMeta.promptHistory.length - 1].successRate * 100) : 100) + '% SR)'),_h('select', {
2082
- style: { fontSize: '11px', padding: '1px 4px', background: 'var(--dsw-alias-bg-base, #111)', color: 'var(--dsw-alias-label-primary, #ddd)', border: '1px solid var(--dsw-alias-border-l2, #333)', borderRadius: '4px' },onChange: (e) => {
2083
- const targetV = Number(e.target.value);
2084
- const entry = selectedTaskMeta.promptHistory.find((rev) => rev.version === targetV);
2085
- if (entry && entry.prompt) {setFormPrompt(entry.prompt);
2086
- }
2087
- }
2088
- },selectedTaskMeta.promptHistory.map((rev) => _h('option', { key: rev.version, value: rev.version }, 'v' + rev.version + ' (' + Math.round((rev.successRate || 1) * 100) + '%)'))
2089
- )
2090
- ) : null
2091
- ),_h('textarea', {required: true,rows: 9,style: { fontFamily: 'monospace', fontSize: '12.5px', lineHeight: '1.45' },value: formPrompt,placeholder: AGENT_FORM_TYPES.includes(formType)
2092
- ? T_KEY(t, 'form.promptPlaceholderLlm')
2093
- : formType === 'docker'
2094
- ? 'python -V'
2095
- : formType === 'ssh'
2096
- ? 'uname -a'
2097
- : formType === 'node'
2098
- ? 'console.log("hello")'
2099
- : formType === 'python'
2100
- ? 'print("hello")'
2101
- : T_KEY(t, 'form.promptPlaceholderScript'),onChange: (e) => setFormPrompt(e.target.value)
2102
- })
2103
- ),_h('div', {style: {background: 'var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 2%, transparent))',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '8px',padding: '12px 14px',marginBottom: '16px'
2104
- }
2105
- },_h('div', { style: { fontWeight: 500, fontSize: '13px', color: 'var(--dsw-alias-label-primary, #eee)', marginBottom: '8px', display: 'flex', alignItems: 'center', gap: '6px' } },_h('span', { style: { display: 'flex', alignItems: 'center', color: 'var(--dsh-cron-info)' }, ...iconHtml(ICON_TELEGRAM) }),T_KEY(t, 'form.notifyTitle')
2106
- ),_h('label', { className: 'dsh-cron-checkbox-row', style: { marginBottom: formNotifyTelegram ? '8px' : '0' } },_h('input', {type: 'checkbox',checked: formNotifyTelegram,onChange: (e) => setFormNotifyTelegram(e.target.checked)
2107
- }),_h('span', null, T_KEY(t, 'form.notifyTelegram'))
2108
- ),(formNotifyTelegram || formChannels.length > 0) && _h('label', { className: 'dsh-cron-checkbox-row', style: { marginLeft: '24px', marginTop: '6px' } },_h('input', {type: 'checkbox',checked: formOnlyOnFailure,onChange: (e) => setFormOnlyOnFailure(e.target.checked)
2109
- }),_h('span', null, T_KEY(t, 'form.notifyOnlyFailure'))
2110
- ),_h('div', { style: { marginTop: '12px', paddingTop: '10px', borderTop: '1px solid var(--dsw-alias-border-l2)' } },_h('div', { style: { fontWeight: 500, fontSize: '12.5px', color: 'var(--dsw-alias-label-secondary, #aaa)', marginBottom: '8px' } }, T_KEY(t, 'form.channelsTitle')),_h('div', { className: 'dsh-cron-channel-grid' },
2111
- ...DELIVERY_CHANNELS.map((id) => _h('label', { key: id, className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: formChannels.indexOf(id) >= 0,onChange: (e) => {setFormChannels((prev) => {
2112
- const set = new Set(prev);
2113
- if (e.target.checked) set.add(id); else set.delete(id);
2114
- return DELIVERY_CHANNELS.filter((c) => set.has(c));
2115
- });
2116
- }
2117
- }),_h('span', null, T_KEY(t, CHANNEL_LABEL_KEYS[id]))
2118
- ))
2119
- ),_h('div', { className: 'dsh-cron-hint', style: { marginTop: '6px' } }, T_KEY(t, 'form.channelsHint'))
2120
- ),_h('div', { className: 'dsh-cron-form-group', style: { marginTop: '12px', marginBottom: 0 } },_h('label', null, T_KEY(t, 'form.templateLabel')),_h('input', {type: 'text',value: formTemplate,placeholder: T_KEY(t, 'form.templatePlaceholder'),onChange: (e) => setFormTemplate(e.target.value)
2121
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.templateHint'))
2122
- ),!AGENT_FORM_TYPES.includes(formType) && _h('div', { className: 'dsh-cron-form-group', style: { marginTop: '12px', marginBottom: 0 } },_h('label', null, T_KEY(t, 'form.silentRuleLabel')),_h('input', {type: 'text',value: formSilentRule,placeholder: T_KEY(t, 'form.silentRulePlaceholder'),onChange: (e) => setFormSilentRule(e.target.value)
2123
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.silentRuleHint'))
2124
- )
2125
- ),_h('div', {style: {marginTop: '16px',paddingTop: '14px',borderTop: '1px solid var(--dsw-alias-border-l2)'
2126
- }
2127
- },_h('div', { style: { fontWeight: '600', fontSize: '13px', marginBottom: '10px' } }, T_KEY(t, 'form.reliabilityTitle')),_h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '10px' } },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.preflightLabel')),_h('select', {value: formPreflightType,
2128
- onChange: (e) => setFormPreflightType(e.target.value)
2129
- },_h('option', { value: 'none' }, T_KEY(t, 'form.preflightNone')),_h('option', { value: 'http' }, T_KEY(t, 'form.preflightHttp')),_h('option', { value: 'shell' }, T_KEY(t, 'form.preflightShell')),_h('option', { value: 'disk' }, T_KEY(t, 'form.preflightDisk'))
2130
- )
2131
- ),formPreflightType !== 'none' && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.preflightTargetLabel')),_h('input', {type: 'text',value: formPreflightTarget,placeholder: T_KEY(t, 'form.preflightTargetPlaceholder'),onChange: (e) => setFormPreflightTarget(e.target.value)
2132
- })
2133
- )
2134
- ),_h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '10px' } },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.heartbeatIntervalLabel')),_h('input', {type: 'number',value: formHeartbeatIntervalSeconds,min: 0,onChange: (e) => setFormHeartbeatIntervalSeconds(Number(e.target.value))
2135
- })
2136
- ),formHeartbeatIntervalSeconds > 0 && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.gracePeriodLabel')),_h('input', {type: 'number',value: formGracePeriodSeconds,min: 1,onChange: (e) => setFormGracePeriodSeconds(Number(e.target.value))
2137
- })
2138
- )
2139
- ),_h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '10px' } },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.priorityLabel')),_h('input', {type: 'number',value: formPriority,min: 1,max: 10,onChange: (e) => setFormPriority(Number(e.target.value))
2140
- })
2141
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.concurrencyGroupLabel')),_h('input', {type: 'text',value: formConcurrencyGroup,onChange: (e) => setFormConcurrencyGroup(e.target.value)
2142
- })
2143
- )
2144
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.workWindowHoursLabel')),_h('input', {type: 'text',value: formWorkWindowHours,placeholder: T_KEY(t, 'form.workWindowHoursPlaceholder'),onChange: (e) => setFormWorkWindowHours(e.target.value)
2145
- })
2146
- ),formWorkWindowHours.trim() && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.workWindowPolicyLabel')),_h('select', {value: formWorkWindowPolicy,onChange: (e) => setFormWorkWindowPolicy(e.target.value)
2147
- },_h('option', { value: 'skip' }, T_KEY(t, 'form.workWindowPolicySkip')),_h('option', { value: 'defer' }, T_KEY(t, 'form.workWindowPolicyDefer'))
2148
- )
2149
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.timeBoxMinutesLabel')),_h('input', {type: 'number',min: 0,value: formTimeBoxMinutes,onChange: (e) => setFormTimeBoxMinutes(parseInt(e.target.value, 10) || 0)
2150
- })
2151
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.wakeTriggerTypeLabel')),_h('select', {value: formWakeTriggerType,onChange: (e) => setFormWakeTriggerType(e.target.value)
2152
- },_h('option', { value: 'none' }, T_KEY(t, 'form.wakeTriggerTypeNone')),_h('option', { value: 'file_count' }, T_KEY(t, 'form.wakeTriggerTypeFileCount')),_h('option', { value: 'marker_file' }, T_KEY(t, 'form.wakeTriggerTypeMarkerFile')),_h('option', { value: 'process_exit' }, T_KEY(t, 'form.wakeTriggerTypeProcessExit'))
2153
- )
2154
- ),formWakeTriggerType !== 'none' && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.wakeTriggerPathLabel')),_h('input', {type: 'text',value: formWakeTriggerPath,placeholder: T_KEY(t, 'form.wakeTriggerPathPlaceholder'),onChange: (e) => setFormWakeTriggerPath(e.target.value)
2155
- })
2156
- ),formWakeTriggerType === 'file_count' && _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.wakeTriggerMinCountLabel')),_h('input', {type: 'number',min: 1,value: formWakeTriggerMinCount,onChange: (e) => setFormWakeTriggerMinCount(parseInt(e.target.value, 10) || 1)
2157
- })
2158
- ),(formWakeTriggerType === 'marker_file' || formWakeTriggerType === 'process_exit') && _h('div', { className: 'dsh-cron-form-group dsh-cron-form-checkbox' },_h('label', null,_h('input', {type: 'checkbox',checked: formWakeTriggerConsume,onChange: (e) => setFormWakeTriggerConsume(e.target.checked)
2159
- }),_h('span', null, T_KEY(t, 'form.wakeTriggerConsumeLabel'))
2160
- )
2161
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.writeScopesLabel')),_h('input', {type: 'text',value: formWriteScopes,placeholder: T_KEY(t, 'form.writeScopesPlaceholder'),onChange: (e) => setFormWriteScopes(e.target.value)
2162
- })
2163
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.inputHashPathsLabel')),_h('input', {type: 'text',value: formInputHashPaths,placeholder: T_KEY(t, 'form.inputHashPathsPlaceholder'),onChange: (e) => setFormInputHashPaths(e.target.value)
2164
- })
2165
- ),_h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', marginTop: '6px' } },_h('input', {type: 'checkbox',id: 'formSkipIfUnchangedCheckbox',checked: formSkipIfUnchanged,onChange: (e) => setFormSkipIfUnchanged(e.target.checked)
2166
- }),_h('label', { htmlFor: 'formSkipIfUnchangedCheckbox', style: { margin: 0, cursor: 'pointer', fontSize: '13px' } },T_KEY(t, 'form.skipIfUnchangedLabel')
2167
- )
2168
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.selfHealingLabel')),_h('input', {type: 'text',value: formSelfHealingCommand,placeholder: T_KEY(t, 'form.selfHealingPlaceholder'),onChange: (e) => setFormSelfHealingCommand(e.target.value)
2169
- })
2170
- ),_h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', marginTop: '6px' } },_h('input', {type: 'checkbox',id: 'formAutoDiagnoseCheckbox',checked: formAutoDiagnose,onChange: (e) => setFormAutoDiagnose(e.target.checked)
2171
- }),_h('label', { htmlFor: 'formAutoDiagnoseCheckbox', style: { margin: 0, fontSize: '12.5px', cursor: 'pointer' } }, T_KEY(t, 'form.autoDiagnoseLabel'))
2172
- )
2173
- ),_h('div', {style: {marginTop: '16px',paddingTop: '14px',borderTop: '1px solid var(--dsw-alias-border-l2)'
2174
- }
2175
- },_h('div', { style: { fontWeight: '600', fontSize: '13px', marginBottom: '10px' } }, 'โ›“๏ธ ' + T_KEY(t, 'form.chainingTitle')),_h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '10px' } },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.onSuccessLabel')),_h('input', {type: 'text',value: formOnSuccess,
2176
- placeholder: 'task-build, task-test',onChange: (e) => setFormOnSuccess(e.target.value)
2177
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.onSuccessHint'))
2178
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.onFailureLabel')),_h('input', {type: 'text',value: formOnFailure,placeholder: 'task-alert',onChange: (e) => setFormOnFailure(e.target.value)
2179
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.onFailureHint'))
2180
- )
2181
- ),_h('div', { style: { display: 'grid', gridTemplateColumns: '2fr 1fr', gap: '10px', marginTop: '8px' } },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.dependsOnLabel')),_h('input', {type: 'text',value: formDependsOn,placeholder: 'task-build, task-lint',onChange: (e) => setFormDependsOn(e.target.value)
2182
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.dependsOnHint'))
2183
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'form.joinPolicyLabel')),_h('select', {value: formJoinPolicy,onChange: (e) => setFormJoinPolicy(e.target.value)
2184
- },_h('option', { value: 'all_success' }, T_KEY(t, 'form.joinPolicyAll')),_h('option', { value: 'any_success' }, T_KEY(t, 'form.joinPolicyAny'))
2185
- )
2186
- )
2187
- ),_h('div', { className: 'dsh-cron-form-group', style: { marginTop: '8px' } },_h('label', null, T_KEY(t, 'form.elseTaskLabel')),_h('input', {type: 'text',value: formElseTask || '',placeholder: T_KEY(t, 'form.elseTaskPlaceholder'),onChange: (e) => setFormElseTask(e.target.value)
2188
- }),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.elseTaskHint'))
2189
- ),_h('div', { className: 'dsh-cron-form-group', style: { marginTop: '8px' } },_h('label', { style: { display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer' } },_h('input', {type: 'checkbox',checked: Boolean(formAutoHeal),onChange: (e) => setFormAutoHeal(e.target.checked)
2190
- }),_h('span', { style: { fontWeight: '600' } }, '๐Ÿฉบ ' + T_KEY(t, 'form.autoHealLabel'))
2191
- ),_h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'form.autoHealHint'))
2192
- ),_h('div', { style: { marginTop: '12px', padding: '10px', background: 'var(--dsw-alias-bg-layer-2)', borderRadius: '6px' } },_h('label', { style: { display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer', fontWeight: '500' } },_h('input', {type: 'checkbox',checked: formAdaptiveEnabled,onChange: (e) => setFormAdaptiveEnabled(e.target.checked)
2193
- }),T_KEY(t, 'form.adaptiveEnabled')
2194
- ),_h('div', { className: 'dsh-cron-hint', style: { marginLeft: '24px' } }, T_KEY(t, 'form.adaptiveHint')),formAdaptiveEnabled && _h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr 1fr 1fr', gap: '8px', marginTop: '8px', marginLeft: '24px' } },_h('div', null,_h('label', { style: { fontSize: '11px' } }, 'Min'),
2195
- _h('input', { type: 'text', value: formAdaptiveMinInterval, placeholder: '5m', onChange: (e) => setFormAdaptiveMinInterval(e.target.value) })
2196
- ),_h('div', null,_h('label', { style: { fontSize: '11px' } }, 'Max'),_h('input', { type: 'text', value: formAdaptiveMaxInterval, placeholder: '2h', onChange: (e) => setFormAdaptiveMaxInterval(e.target.value) })
2197
- ),_h('div', null,_h('label', { style: { fontSize: '11px' } }, 'Factor'),_h('input', { type: 'number', step: '0.1', value: formAdaptiveBackoffFactor, placeholder: '1.5', onChange: (e) => setFormAdaptiveBackoffFactor(e.target.value) })
2198
- ),_h('div', null,_h('label', { style: { fontSize: '11px' } }, 'Idle Runs'),_h('input', { type: 'number', value: formAdaptiveIdleThreshold, placeholder: '3', onChange: (e) => setFormAdaptiveIdleThreshold(e.target.value) })
2199
- )
2200
- )
2201
- )
2202
- ),selectedTaskMeta && _h('div', {style: {background: 'var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent))',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '8px',padding: '10px 14px',fontSize: '12.5px',color: 'var(--dsw-alias-label-secondary, #999)',marginBottom: '16px',display: 'flex',
2203
- justifyContent: 'space-between',alignItems: 'center'
2204
- }
2205
- },_h('div', null,_h('span', null, T_KEY(t, 'form.nextRunLabel')),_h('strong', { style: { color: 'var(--dsw-alias-label-primary, #eee)' } }, selectedTaskMeta.nextRunAt ? new Date(selectedTaskMeta.nextRunAt).toLocaleString() : T_KEY(t, 'form.notScheduled'))
2206
- ),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '4px 10px', fontSize: '12px' },onClick: async () => {await handleRunNow(selectedTaskMeta.id);
2207
- if (formId) loadTaskHistory(formId);
2208
- }
2209
- }, T_KEY(t, 'actions.runNow'))
2210
- ),_h('div', { className: 'dsh-cron-modal-foot' },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: closeManualModalWithConfirm
2211
- }, T_KEY(t, 'modal.cancel')),_h('button', {type: 'submit',className: 'dsh-cron-btn-primary'
2212
- }, formId ? T_KEY(t, 'modal.save') : T_KEY(t, 'modal.create'))
2213
- )
2214
- )
2215
- )
2216
- ),dryRunResult && _h('div', { className: 'dsh-cron-modal-overlay', onClick: () => setDryRunResult(null) },_h('div', {className: 'dsh-cron-modal',style: { maxWidth: '580px' },role: 'dialog','aria-modal': 'true',onClick: (e) => e.stopPropagation()
2217
- },_h('div', { className: 'dsh-cron-modal-head', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },_h('div', { className: 'dsh-cron-modal-title', style: { margin: 0 } }, T_KEY(t, 'dryRun.title')),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',onClick: () => setDryRunResult(null)
2218
- }, 'โœ•')
2219
- ),_h('div', { style: { marginTop: '12px', display: 'flex', flexDirection: 'column', gap: '8px', fontSize: '13px' } },
2220
- _h('div', null, _h('strong', null, T_KEY(t, 'dryRun.status') + ': '), _h('span', { style: { color: dryRunResult.ok ? 'var(--dsh-cron-success)' : 'var(--dsh-cron-danger)' } }, dryRunResult.ok ? ((dryRunResult.result && dryRunResult.result.status) || dryRunResult.status || 'success') : 'failed')),
2221
- ((dryRunResult.result && dryRunResult.result.preflight) || dryRunResult.preflight) && _h('div', null, _h('strong', null, T_KEY(t, 'dryRun.preflight') + ': '), _h('span', null, (((dryRunResult.result && dryRunResult.result.preflight) || dryRunResult.preflight).passed) ? 'โœ“ Passed' : 'โœ— Failed (' + ((((dryRunResult.result && dryRunResult.result.preflight) || dryRunResult.preflight).reason) || '') + ')')),
2222
- _h('div', null, _h('strong', null, T_KEY(t, 'dryRun.duration') + ': '), _h('span', null, (((dryRunResult.result && dryRunResult.result.durationMs) !== undefined ? dryRunResult.result.durationMs : dryRunResult.durationMs) || 0) + 'ms')),_h('div', { style: { marginTop: '6px' } }, _h('strong', null, T_KEY(t, 'dryRun.output') + ':')),_h('pre', {style: {
2223
- background: 'var(--dsw-alias-bg-layer-2)',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '6px',padding: '10px',maxHeight: '220px',overflowY: 'auto',fontSize: '12px',whiteSpace: 'pre-wrap',wordBreak: 'break-word',color: 'var(--dsw-alias-label-primary)'
2224
- }
2225
- }, ((dryRunResult.result && dryRunResult.result.output) !== undefined ? dryRunResult.result.output : (dryRunResult.output !== undefined ? dryRunResult.output : ((dryRunResult.result && dryRunResult.result.error) || dryRunResult.error || '(no output)'))))
2226
- ),_h('div', { className: 'dsh-cron-modal-foot', style: { marginTop: '16px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-primary',onClick: () => setDryRunResult(null)
2227
- }, T_KEY(t, 'dryRun.close'))
2228
- )
2229
- )
2230
- ),archiveModalOpen && _h('div', { className: 'dsh-cron-modal-overlay', onClick: () => setArchiveModalOpen(false) },_h('div', {className: 'dsh-cron-modal',style: { maxWidth: '700px' },role: 'dialog','aria-modal': 'true',onClick: (e) => e.stopPropagation()
2231
- },_h('div', { className: 'dsh-cron-modal-head', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },_h('div', { className: 'dsh-cron-modal-title', style: { margin: 0 } }, T_KEY(t, 'archive.title') + (archiveTask ? ' - ' + archiveTask.title : '')),_h('button', {type: 'button',className: 'dsh-cron-icon-btn',
2232
- onClick: () => setArchiveModalOpen(false)
2233
- }, 'โœ•')
2234
- ),_h('div', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #999)', margin: '4px 0 12px 0' } },T_KEY(t, 'archive.totalRuns', { total: archiveTotal })
2235
- ),archiveLoading ? _h('div', { className: 'dsh-cron-history-empty' }, T_KEY(t, 'history.loading')) :archiveRuns.length === 0 ? _h('div', { className: 'dsh-cron-history-empty' }, T_KEY(t, 'archive.empty')) :_h('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px', maxHeight: '380px', overflowY: 'auto' } },
2236
- archiveRuns.map((r, idx) => _h('div', {key: idx,style: {background: 'var(--dsw-alias-bg-layer-2)',border: '1px solid var(--dsw-alias-border-l2)',borderRadius: '6px',padding: '8px 12px',fontSize: '12px'
2237
- }
2238
- },_h('div', { style: { display: 'flex', justifyContent: 'space-between', marginBottom: '4px' } },_h('span', { style: { fontWeight: '600', color: r.status === 'success' ? 'var(--dsh-cron-success)' : 'var(--dsh-cron-danger)' } }, (r.status || 'unknown').toUpperCase()),
2239
- _h('span', { style: { color: 'var(--dsw-alias-label-secondary, #888)' } }, (r.at || r.timestamp || r.startedAt) ? new Date(r.at || r.timestamp || r.startedAt).toLocaleString() : "")
2240
- ),r.durationMs > 0 && _h('div', { style: { color: 'var(--dsw-alias-label-secondary, #888)', marginBottom: '4px' } }, 'Duration: ' + r.durationMs + 'ms'),r.chainRunId && _h('div', { style: { marginBottom: '4px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',
2241
- style: { padding: '2px 8px', fontSize: '11px', display: 'inline-flex', alignItems: 'center', gap: '4px' },onClick: () => openChainGraphModal(null, r.chainRunId)
2242
- }, '๐Ÿ•ธ๏ธ ' + T_KEY(t, 'chainGraph.viewGraph'))
2243
- ),r.error && _h('div', { style: { color: 'var(--dsh-cron-danger)', marginBottom: '4px' } }, 'Error: ' + r.error),r.output && _h('div', {style: {color: 'var(--dsw-alias-label-primary, #ccc)',whiteSpace: 'pre-wrap',wordBreak: 'break-word',maxHeight: '80px',overflowY: 'auto'
2244
- }
2245
- }, r.output.slice(0, 300) + (r.output.length > 300 ? '...' : ''))
2246
- ))
2247
- ),_h('div', { className: 'dsh-cron-modal-foot', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginTop: '16px' } },archiveRuns.length < archiveTotal ? _h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: () => {
2248
- const nextOffset = archiveRuns.length;
2249
- if (archiveTask) openArchiveModal(archiveTask, nextOffset);
2250
- }
2251
- }, T_KEY(t, 'archive.loadMore', { shown: archiveRuns.length, total: archiveTotal })) : _h('div', null),_h('button', {type: 'button',className: 'dsh-cron-btn-primary',onClick: () => setArchiveModalOpen(false)
2252
- }, T_KEY(t, 'archive.close'))
2253
- )
2254
- )
2255
- ),settingsModalOpen && _h('div', { className: 'dsh-cron-modal-overlay', onClick: () => setSettingsModalOpen(false) },_h('div', { className: 'dsh-cron-modal dsh-cron-modal-scroll', role: 'dialog', 'aria-modal': 'true', onClick: (e) => e.stopPropagation() },
2256
- _h('div', { className: 'dsh-cron-modal-head', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '18px' } },_h('div', { className: 'dsh-cron-modal-title', style: { margin: 0, display: 'flex', alignItems: 'center', gap: '8px' } },
2257
- _h('span', { style: { display: 'flex', alignItems: 'center', color: 'var(--dsh-cron-info)' }, ...iconHtml(ICON_TELEGRAM) }),T_KEY(t, 'settings.modalTitle')
2258
- ),_h('button', {type: 'button',style: { background: 'none', border: 'none', color: 'var(--dsw-alias-label-tertiary, #888)', cursor: 'pointer', fontSize: '18px' },onClick: () => setSettingsModalOpen(false)
2259
- }, 'โœ•')
2260
- ),_h('form', { onSubmit: handleSaveSettings },_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'settings.tokenLabel')),_h('input', {type: 'password',value: settingsBotToken,placeholder: settingsHasDefault ? T_KEY(t, 'settings.tokenPlaceholderDefault') : T_KEY(t, 'settings.tokenPlaceholder'),
2261
- onChange: (e) => setSettingsBotToken(e.target.value)
2262
- }),settingsHasDefault && _h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'settings.defaultHint'))
2263
- ),_h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'settings.chatIdLabel')),_h('input', {value: settingsChatId,placeholder: T_KEY(t, 'settings.chatIdPlaceholder'),onChange: (e) => setSettingsChatId(e.target.value)
2264
- })
2265
- ),_h('div', { style: { background: 'var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 2%, transparent))', border: '1px solid var(--dsw-alias-border-l2)', borderRadius: '8px', padding: '12px 14px', marginBottom: '16px' } },_h('label', { className: 'dsh-cron-checkbox-row', style: { marginBottom: '8px' } },_h('input', {
2266
- type: 'checkbox',checked: settingsNotifyGlobal,onChange: (e) => setSettingsNotifyGlobal(e.target.checked)
2267
- }),_h('span', null, T_KEY(t, 'settings.globalNotify'))
2268
- ),_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: settingsOnlyOnFailureGlobal,onChange: (e) => setSettingsOnlyOnFailureGlobal(e.target.checked)
2269
- }),_h('span', null, T_KEY(t, 'settings.globalOnlyFailure'))
2270
- )
2271
- ),...renderDeliverySettings({T: (key, vars) => T_KEY(t, key, vars),values: settingsDelivery,onChange: updateDelivery,onChannelTemplate: updateChannelTemplate,sections: settingsSections,onToggleSection: toggleDeliverySection,}),_h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '14px' } },_h('button', {
2272
- type: 'button',className: 'dsh-cron-btn-secondary',style: { display: 'inline-flex', alignItems: 'center', gap: '6px' },disabled: testStatus?.loading,onClick: handleTestTelegram
2273
- }, testStatus?.loading ? T_KEY(t, 'settings.sending') : T_KEY(t, 'settings.testTelegram'))
2274
- ),testStatus && testStatus.message && _h('div', {className: 'dsh-cron-status-banner','data-type': testStatus.success ? 'success' : 'error'
2275
- }, testStatus.message),_h('div', { className: 'dsh-cron-modal-foot' },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: () => setSettingsModalOpen(false)
2276
- }, T_KEY(t, 'modal.cancel')),_h('button', {type: 'submit',className: 'dsh-cron-btn-primary'
2277
- }, T_KEY(t, 'settings.save'))
2278
- )
2279
- )
2280
- )
2281
- ),importDoc && _h('div', { className: 'dsh-cron-modal-overlay', onClick: () => !transferBusy && setImportDoc(null) },_h('div', { className: 'dsh-cron-modal', role: 'dialog', 'aria-modal': 'true', onClick: (e) => e.stopPropagation() },_h('div', { className: 'dsh-cron-modal-title' }, T_KEY(t, 'transfer.importTitleModal')),
2282
- _h('div', { className: 'dsh-cron-hint', style: { marginBottom: '10px' } }, T_KEY(t, 'transfer.importHint')),importSummary && _h('div', null,_h('div', { style: { fontSize: '13px', marginBottom: '12px' } },T_KEY(t, 'transfer.summary', {total: (importSummary.add || 0) + (importSummary.replace || 0) + (importSummary.skip || 0),add: importSummary.add || 0,
2283
- replace: importSummary.replace || 0,skip: importSummary.skip || 0
2284
- })
2285
- ),_h('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px', marginBottom: '14px' } },...['add', 'replace', 'skip'].map((mode) => _h('label', { key: mode, className: 'dsh-cron-checkbox-row' },_h('input', {type: 'radio',name: 'dsh-cron-import-strategy',checked: importStrategy === mode,onChange: () => setImportStrategy(mode)
2286
- }),_h('span', null, T_KEY(t, mode === 'add' ? 'transfer.strategyAdd' : mode === 'replace' ? 'transfer.strategyReplace' : 'transfer.strategySkip'))
2287
- ))
2288
- )
2289
- ),_h('div', { className: 'dsh-cron-modal-foot' },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',disabled: transferBusy,onClick: () => setImportDoc(null)
2290
- }, T_KEY(t, 'modal.cancel')),_h('button', {type: 'button',className: 'dsh-cron-btn-primary',disabled: transferBusy || !importSummary,onClick: handleImportConfirm
2291
- }, T_KEY(t, 'transfer.confirm'))
2292
- )
2293
- )
2294
- ),dshModalOpen && _h('div', { className: 'dsh-cron-modal-overlay', onClick: () => !dshLoading && setDshModalOpen(false) },_h('div', { className: 'dsh-cron-modal', role: 'dialog', 'aria-modal': 'true', onClick: (e) => e.stopPropagation() },_h('div', { className: 'dsh-cron-modal-title' }, T_KEY(t, 'dsh.modalTitle')),
2295
- _h('div', { className: 'dsh-cron-form-group' },_h('label', null, T_KEY(t, 'dsh.descLabel')),_h('div', { className: 'dsh-cron-chat-box' },_h('textarea', {className: 'dsh-cron-chat-input',rows: 4,autoFocus: true,disabled: dshLoading,placeholder: T_KEY(t, 'dsh.placeholder'),value: dshPrompt,onKeyDown: (e) => {
2296
- if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {e.preventDefault();
2297
- handleStartWithDSH();
2298
- }
2299
- },onChange: (e) => setDshPrompt(e.target.value)
2300
- }),_h('div', { className: 'dsh-cron-chat-foot' },_h('span', { className: 'dsh-cron-chat-hint' }, T_KEY(t, 'dsh.sendHint')),_h('button', {type: 'button',className: 'dsh-cron-send-btn',disabled: dshLoading || !dshPrompt.trim(),title: T_KEY(t, 'dsh.sendTitle'),onClick: handleStartWithDSH
2301
- },_h('span', svgProps(ICON_SEND))
2302
- )
2303
- )
2304
- )
2305
- ),_h('div', { className: 'dsh-cron-modal-foot' },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',disabled: dshLoading,onClick: () => setDshModalOpen(false)
2306
- }, T_KEY(t, 'modal.cancel'))
2307
- )
2308
- )
2309
- ),renderChainGraphModal({isOpen: chainGraphModalOpen,onClose: () => setChainGraphModalOpen(false),data: chainGraphData,loading: chainGraphLoading,onRetry: handleRetryChainStep,t
2310
- }),renderLiveLogsModal({isOpen: liveLogsModalOpen,onClose: handleCloseLiveLogs,taskId: liveLogsTaskId,taskTitle: liveLogsTaskTitle,logs: liveLogsLines,autoScroll: liveLogsAutoScroll,onToggleAutoScroll: () => setLiveLogsAutoScroll((v) => !v),completed: liveLogsCompleted,status: liveLogsStatus,t
2311
- }),renderAnalyticsDigestModal({isOpen: digestOpen,onClose: () => setDigestOpen(false),digestData,isLoading: digestLoading,periodDays,onSelectPeriod,onSendTelegram,sendStatus,t
2312
- }),renderTimelineHeatmapModal({isOpen: timelineOpen,onClose: () => setTimelineOpen(false),activeTab: timelineTab,onSelectTab: onSelectTimelineTab,timelineData,heatmapData,isLoading: timelineLoading,t
2313
- })
2314
- );
2315
- }
2316
- function CronSettingsCard(props) {
2317
- const { ctx, toggle } = props;
2318
- const t = props.t || translate;
2319
- const [token, setToken] = React.useState('');
2320
- const [chatId, setChatId] = React.useState('');
2321
- const [notify, setNotify] = React.useState(false);
2322
- const [onlyFailure, setOnlyFailure] = React.useState(false);
2323
- const [llmActionsEnabled, setLlmActionsEnabled] = React.useState(false);
2324
- const [enableDynamicCredentials, setEnableDynamicCredentials] = React.useState(false);
2325
- const [showChatHeaderButton, setShowChatHeaderButton] = React.useState(Boolean(currentHeaderSettings.showChatHeaderButton !== false));
2326
- const [showChatHeaderActions, setShowChatHeaderActions] = React.useState(Boolean(currentHeaderSettings.showChatHeaderActions !== false));
2327
- const [kanbanUrl, setKanbanUrl] = React.useState('http://127.0.0.1:3000');
2328
- const [delivery, setDelivery] = React.useState({});
2329
- const [sections, setSections] = React.useState({ channels: true });
2330
- const [hasDefault, setHasDefault] = React.useState(false);
2331
- const [saved, setSaved] = React.useState(false);
2332
- const [testInfo, setTestInfo] = React.useState(null);
2333
- const [cardOpen, setCardOpen] = React.useState(false);
2334
- const [updateState, setUpdateState] = React.useState({checking: false,updating: false,currentVersion: '',latestVersion: undefined,updateAvailable: false,notice: null,error: null
2335
- });
2336
- const checkUpdates = async () => {setUpdateState(prev => ({ ...prev, checking: true, error: null, notice: null }));
2337
- try {
2338
- const { res, data } = await fetchJsonWithTimeout('/api/dsh-cron/update');
2339
- if (data && data.currentVersion) {setUpdateState(prev => ({...prev,checking: false,currentVersion: data.currentVersion,latestVersion: data.latestVersion,updateAvailable: Boolean(data.updateAvailable),error: data.latestCheckFailed ? 'Registry check failed' : null
2340
- }));
2341
- } else {setUpdateState(prev => ({ ...prev, checking: false, error: data.error || 'Check failed' }));
2342
- }
2343
- } catch (err) {setUpdateState(prev => ({ ...prev, checking: false, error: err.message }));
2344
- }
2345
- };
2346
- const runUpdate = async () => {setUpdateState(prev => ({ ...prev, updating: true, error: null, notice: null }));
2347
- try {
2348
- const { res, data } = await fetchJsonWithTimeout('/api/dsh-cron/update', {method: 'POST',headers: { 'Content-Type': 'application/json', 'x-dsh-plugin-update': '1' }
2349
- });
2350
- if (data && data.updated) {setUpdateState(prev => ({...prev,updating: false,updateAvailable: false,currentVersion: data.updatedVersion || data.latestVersion,notice: T_KEY(t, 'updater.success', { version: data.updatedVersion || data.latestVersion })
2351
- }));
2352
- } else {setUpdateState(prev => ({...prev,updating: false,error: data.error || data.message || 'Update failed'
2353
- }));
2354
- }
2355
- } catch (err) {setUpdateState(prev => ({ ...prev, updating: false, error: err.message }));
2356
- }
2357
- };
2358
- const [loadState, setLoadState] = React.useState('loading');
2359
- const [reloadTick, setReloadTick] = React.useState(0);
2360
- React.useEffect(() => {
2361
- let active = true;
2362
- setLoadState('loading');
2363
- fetchJsonWithTimeout('/dsh-cron/settings')
2364
- .then(({ data }) => {if (!active) return;
2365
- if (data && data.ok && data.settings) {setToken(data.settings.botToken || '');
2366
- setChatId(data.settings.chatId || '');
2367
- setNotify(Boolean(data.settings.notifyTelegram));
2368
- setOnlyFailure(Boolean(data.settings.onlyOnFailure));
2369
- setLlmActionsEnabled(Boolean(data.settings.llmActionsEnabled));
2370
- setEnableDynamicCredentials(Boolean(data.settings.enableDynamicCredentials));
2371
- const btnVis = data.settings.showChatHeaderButton !== false;
2372
- const actVis = data.settings.showChatHeaderActions !== false;
2373
- setShowChatHeaderButton(btnVis);
2374
- setShowChatHeaderActions(actVis);
2375
- updateHeaderSettings({ showChatHeaderButton: btnVis, showChatHeaderActions: actVis });
2376
- setKanbanUrl(data.settings.kanbanBaseUrl || 'http://127.0.0.1:3000');
2377
- setDelivery(pickDeliverySettings(data.settings));
2378
- setHasDefault(Boolean(data.settings.hasDefaultCredentials));
2379
- if (data.settings.version) {setUpdateState(prev => ({ ...prev, currentVersion: data.settings.version }));
2380
- }
2381
- setLoadState('ready');
2382
- } else {setLoadState('error');
2383
- }
2384
- })
2385
- .catch(() => { if (active) setLoadState('error'); });
2386
- return () => { active = false; };
2387
- }, [reloadTick]);
2388
- const saveSettings = async (e) => {if (e) e.preventDefault();
2389
- try {
2390
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/settings', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify(Object.assign({botToken: token,chatId,notifyTelegram: notify,onlyOnFailure: onlyFailure,llmActionsEnabled: llmActionsEnabled,enableDynamicCredentials: enableDynamicCredentials,
2391
- showChatHeaderButton: showChatHeaderButton,showChatHeaderActions: showChatHeaderActions,kanbanBaseUrl: kanbanUrl
2392
- }, delivery))
2393
- });
2394
- if (data && data.ok) {setSaved(true);
2395
- setTimeout(() => setSaved(false), 2500);
2396
- }
2397
- } catch (err) {console.debug('[dsh-cron] save settings failed', err);
2398
- }
2399
- };
2400
- const testTelegram = async () => {setTestInfo({ loading: true, message: T_KEY(t, 'settings.sending') });
2401
- try {
2402
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/telegram/test', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ botToken: token, chatId })
2403
- });
2404
- if (data && data.ok) {setTestInfo({ success: true, message: T_KEY(t, 'settings.testOk') });
2405
- } else {setTestInfo({ success: false, message: T_KEY(t, 'settings.testFail', { error: (data && data.error) || '' }) });
2406
- }
2407
- } catch (err) {setTestInfo({ success: false, message: T_KEY(t, 'settings.testFail', { error: err.message }) });
2408
- }
2409
- };
2410
- const testKanban = async () => {setTestInfo({ loading: true, message: T_KEY(t, 'settings.checkingKanban') });
2411
- try {
2412
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/kanban/test', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ kanbanBaseUrl: kanbanUrl })
2413
- });
2414
- if (data && data.ok) {setTestInfo({ success: true, message: T_KEY(t, 'settings.kanbanOk') });
2415
- } else {setTestInfo({ success: false, message: T_KEY(t, 'settings.kanbanFail', { error: (data && data.error) || '' }) });
2416
- }
2417
- } catch (err) {setTestInfo({ success: false, message: T_KEY(t, 'settings.kanbanFail', { error: err.message }) });
2418
- }
2419
- };
2420
- if (loadState !== 'ready') {
2421
- return _h('div', { className: 'dsh-cron-card' },_h('div', { className: 'dsh-cron-card-title' }, T_KEY(t, 'settings.cardTitle')),_h('div', {className: 'dsh-cron-status-banner','data-type': loadState === 'error' ? 'error' : 'info',style: { marginTop: '10px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: '10px' }
2422
- },_h('span', null, loadState === 'error' ? T_KEY(t, 'settings.unavailable') : T_KEY(t, 'settings.loading')),loadState === 'error' && _h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: () => setReloadTick(x => x + 1)
2423
- }, T_KEY(t, 'settings.retry'))
2424
- )
2425
- );
2426
- }
2427
- if (props && props.view === 'summary') {
2428
- return _h('span', { className: 'dsh-cron-card-desc' }, T_KEY(t, 'settings.cardDesc'));
2429
- }
2430
- const page = !!(props && props.view === 'page');
2431
- return _h('div', { className: page ? 'dsh-cron-page' : 'dsh-cron-card' },_h('button', {type: 'button',className: 'dsh-cron-card-head-btn',style: page ? { display: 'none' } : undefined,'aria-expanded': (page || cardOpen) ? 'true' : 'false',onClick: () => setCardOpen(!cardOpen)
2432
- },_h('span', { className: 'dsh-cron-card-title' }, T_KEY(t, 'settings.cardTitle')),_h('span', { className: 'dsh-cron-chev' + (cardOpen ? ' dsh-cron-chev-open' : '') }, chevronNode())
2433
- ),(page || cardOpen) && _h('div', { className: 'dsh-cron-card-body' },_h('div', { className: 'dsh-cron-card-desc' }, T_KEY(t, 'settings.cardDesc')),_h('div', { style: { display: 'flex', justifyContent: 'flex-end', marginBottom: '12px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-primary',onClick: () => { if (toggle) toggle.set(true); }
2434
- }, T_KEY(t, 'settings.openPanel'))
2435
- ),_h('form', { onSubmit: saveSettings, style: { display: 'flex', flexDirection: 'column', gap: '12px' } },_h('div', { className: 'dsh-cron-form-group', style: { marginBottom: 0 } },_h('label', null, T_KEY(t, 'settings.tokenLabel')),_h('input', {type: 'password',value: token,
2436
- placeholder: hasDefault ? T_KEY(t, 'settings.tokenPlaceholderDefault') : T_KEY(t, 'settings.tokenPlaceholder'),onChange: (e) => setToken(e.target.value)
2437
- }),hasDefault && _h('div', { className: 'dsh-cron-hint' }, T_KEY(t, 'settings.defaultHint'))
2438
- ),_h('div', { className: 'dsh-cron-form-group', style: { marginBottom: 0 } },_h('label', null, T_KEY(t, 'settings.chatIdLabel')),_h('input', {value: chatId,placeholder: T_KEY(t, 'settings.chatIdPlaceholder'),onChange: (e) => setChatId(e.target.value)
2439
- })
2440
- ),_h('div', { className: 'dsh-cron-form-group', style: { marginBottom: 0 } },_h('label', null, T_KEY(t, 'settings.kanbanUrlLabel')),_h('input', {value: kanbanUrl,placeholder: 'http://127.0.0.1:3000',onChange: (e) => setKanbanUrl(e.target.value)
2441
- })
2442
- ),_h('div', { style: { background: 'var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 2%, transparent))', border: '1px solid var(--dsw-alias-border-l2)', borderRadius: '6px', padding: '10px 12px', display: 'flex', flexDirection: 'column', gap: '8px' } },_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {
2443
- type: 'checkbox',checked: notify,onChange: (e) => setNotify(e.target.checked)
2444
- }),_h('span', null, T_KEY(t, 'settings.globalNotify'))
2445
- ),_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: onlyFailure,onChange: (e) => setOnlyFailure(e.target.checked)
2446
- }),_h('span', null, T_KEY(t, 'settings.globalOnlyFailure'))
2447
- ),_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: llmActionsEnabled,onChange: (e) => setLlmActionsEnabled(e.target.checked)
2448
- }),_h('span', null, 'Enable Structured LLM Actions (trigger tasks, notify, create issues)')
2449
- ),_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: enableDynamicCredentials,onChange: (e) => setEnableDynamicCredentials(e.target.checked)
2450
- }),_h('span', null, T_KEY(t, 'settings.dynamicCredentials'))
2451
- ),_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: showChatHeaderButton,onChange: (e) => {
2452
- const val = e.target.checked;
2453
- setShowChatHeaderButton(val);
2454
- updateHeaderSettings({ showChatHeaderButton: val });
2455
- }
2456
- }),_h('span', null, T_KEY(t, 'settings.showChatHeaderButton'))
2457
- ),_h('label', { className: 'dsh-cron-checkbox-row' },_h('input', {type: 'checkbox',checked: showChatHeaderActions,onChange: (e) => {
2458
- const val = e.target.checked;
2459
- setShowChatHeaderActions(val);
2460
- updateHeaderSettings({ showChatHeaderActions: val });
2461
- }
2462
- }),_h('span', null, T_KEY(t, 'settings.showChatHeaderActions'))
2463
- )
2464
- ),...renderDeliverySettings({T: (key, vars) => T_KEY(t, key, vars),values: delivery,onChange: (key, value) => setDelivery((prev) => {
2465
- const next = Object.assign({}, prev);
2466
- if (value === undefined) delete next[key];
2467
- else next[key] = value;
2468
- return next;
2469
- }),onChannelTemplate: (channelId, value) => setDelivery((prev) => {
2470
- const templates = Object.assign({}, prev.channelTemplates || {});
2471
- if (value && value.trim()) templates[channelId] = value;
2472
- else delete templates[channelId];
2473
- return Object.assign({}, prev, { channelTemplates: templates });
2474
- }),sections,onToggleSection: (key) => setSections((prev) => Object.assign({}, prev, { [key]: !prev[key] })),}),testInfo && testInfo.message && _h('div', {className: 'dsh-cron-status-banner','data-type': testInfo.success ? 'success' : 'error',style: { margin: 0, padding: '8px 12px' }
2475
- }, testInfo.message),_h('div', {className: 'dsh-cron-form-group',style: {background: 'var(--dsw-alias-bg-layer-2, color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent))',border: '1px solid var(--dsw-alias-border-l2, color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent))',borderRadius: '8px',padding: '14px',marginBottom: '16px'
2476
- }
2477
- },_h('div', {style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '8px' }
2478
- },_h('div', { style: { fontWeight: '600', fontSize: '14px' } }, `๐Ÿš€ ${T_KEY(t, 'updater.title')}`),_h('div', { style: { display: 'flex', gap: '8px' } },_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',style: { padding: '4px 10px', fontSize: '12px' },disabled: updateState.checking || updateState.updating,onClick: checkUpdates
2479
- }, updateState.checking ? T_KEY(t, 'updater.checking') : T_KEY(t, 'updater.btnCheck')),updateState.updateAvailable ? _h('button', {type: 'button',className: 'dsh-cron-btn-primary',style: { padding: '4px 10px', fontSize: '12px' },disabled: updateState.updating,onClick: runUpdate
2480
- }, updateState.updating ? T_KEY(t, 'updater.updating') : T_KEY(t, 'updater.btnUpdate', { version: updateState.latestVersion })) : null
2481
- )
2482
- ),_h('div', {style: { fontSize: '12px', color: 'var(--dsw-alias-label-secondary, #999)', marginBottom: '8px' }
2483
- }, T_KEY(t, 'updater.desc')),_h('div', {style: { display: 'flex', alignItems: 'center', gap: '12px', fontSize: '13px' }
2484
- },_h('span', { style: { color: 'var(--dsw-alias-label-secondary, #aaa)' } },updateState.currentVersion ? T_KEY(t, 'updater.current', { version: updateState.currentVersion }) : ''
2485
- ),updateState.checking ? _h('span', { className: 'dsh-cron-badge dsh-cron-badge-info' }, T_KEY(t, 'updater.checking')) :updateState.updateAvailable ? _h('span', { className: 'dsh-cron-badge dsh-cron-badge-warn' }, T_KEY(t, 'updater.available', { version: updateState.latestVersion })) :
2486
- updateState.currentVersion && !updateState.error && !updateState.checking ? _h('span', { className: 'dsh-cron-badge dsh-cron-badge-ok' }, `โœ“ ${T_KEY(t, 'updater.upToDate')}`) : null
2487
- ),updateState.notice ? _h('div', {style: { marginTop: '8px', color: 'var(--dsw-alias-success)', fontSize: '12px' }
2488
- }, updateState.notice) : null,updateState.error ? _h('div', {style: { marginTop: '8px', color: 'var(--dsw-alias-error)', fontSize: '12px' }
2489
- }, updateState.error) : null
2490
- ),_h('div', { style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'wrap', marginTop: '4px' } },_h('button', {type: 'submit',className: 'dsh-cron-btn-primary',style: { minWidth: '140px' }
2491
- }, saved ? T_KEY(t, 'settings.saved') : T_KEY(t, 'settings.save')),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: testTelegram,disabled: testInfo?.loading
2492
- }, T_KEY(t, 'settings.testTelegram')),_h('button', {type: 'button',className: 'dsh-cron-btn-secondary',onClick: testKanban,disabled: testInfo?.loading
2493
- }, T_KEY(t, 'settings.testKanban'))
2494
- )
2495
- )
2496
- )
2497
- );
2498
- }
2499
- function sessionIdOf(ctx, props) {try {if (typeof props === 'string' && props) return props;
2500
- if (props && typeof props.sessionId === 'string' && props.sessionId) return props.sessionId;
2501
- if (props && props.session && props.session.id) return String(props.session.id);
2502
- if (props && props.session && props.session.sessionId) return String(props.session.sessionId);
2503
- if (props && props.input && props.input.sessionId) return String(props.input.sessionId);
2504
- if (ctx && ctx.scope && ctx.scope.session) return String(ctx.scope.session.id || ctx.scope.session.header?.id || '');
2505
- if (ctx && typeof ctx.scope?.id === 'string') return ctx.scope.id;
2506
- if (ctx && ctx.session) return String(ctx.session.id || ctx.session.header?.id || '');
2507
- } catch (_e) {void _e;
2508
- }
2509
- return '';
2510
- }
2511
- function SessionQuickActionBar(props) {
2512
- const visible = useHeaderVisibility('showChatHeaderActions');
2513
- const { ctx, toggle } = props;
2514
- const barT = props.t || translate;
2515
- const [tasks, setTasks] = React.useState([]);
2516
- const [isRunning, setIsRunning] = React.useState(false);
2517
- const [runSuccess, setRunSuccess] = React.useState(false);
2518
- const sessionId = sessionIdOf(ctx, props);
2519
- React.useEffect(() => {if (!visible) return;
2520
- let unmounted = false;
2521
- const fetchTasks = async () => {try {
2522
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks');
2523
- void res;
2524
- if (!unmounted && data && Array.isArray(data.tasks)) {setTasks(data.tasks);
2525
- }
2526
- } catch (_e) {void _e;
2527
- }
2528
- };
2529
- fetchTasks();
2530
- const timer = setInterval(fetchTasks, 15000);
2531
- return () => {unmounted = true;
2532
- clearInterval(timer);
2533
- };
2534
- }, [sessionId]);
2535
- const linkedTask = React.useMemo(() => {if (!sessionId || !tasks.length) return null;
2536
- return tasks.find((t) => t.lastSessionId === sessionId || t.targetSessionId === sessionId || t.id === sessionId);
2537
- }, [sessionId, tasks]);
2538
- const handleOpenLinked = (e) => {e.preventDefault();
2539
- e.stopPropagation();
2540
- if (linkedTask) {pendingTaskHighlight = linkedTask.id;
2541
- }
2542
- toggle.set(true);
2543
- };
2544
- const handleCreateRecurring = (e) => {e.preventDefault();
2545
- e.stopPropagation();
2546
- const sessionObj = props.session || (ctx && ctx.scope && ctx.scope.session);
2547
- const titleVal = (sessionObj && (sessionObj.title || sessionObj.name)) || '';
2548
- pendingTaskPreset = {title: titleVal ? titleVal + ' (Cron)' : '',targetSessionId: sessionId || '',type: 'llm',schedule: '0 9 * * 1-5',};
2549
- if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function') {try {window.dispatchEvent(new CustomEvent('dsh-cron:preset', { detail: pendingTaskPreset }));
2550
- } catch (_e) { void _e; }
2551
- }
2552
- toggle.set(true);
2553
- };
2554
- const handleQuickRun = async (e) => {e.preventDefault();
2555
- e.stopPropagation();
2556
- if (!linkedTask || isRunning) return;
2557
- setIsRunning(true);
2558
- setRunSuccess(false);
2559
- try {
2560
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks/' + encodeURIComponent(linkedTask.id) + '/run', {method: 'POST',});
2561
- void res;
2562
- if (data && data.ok) {setRunSuccess(true);
2563
- setTimeout(() => setRunSuccess(false), 3000);
2564
- }
2565
- } catch (_err) {void _err;
2566
- } finally {setIsRunning(false);
2567
- }
2568
- };
2569
- if (!visible) return null;
2570
- if (linkedTask) {
2571
- const running = linkedTask.running || isRunning;
2572
- return _h('div', {className: 'dsh-cron-session-bar','data-dsh-plugin': 'dsh-cron',}, [
2573
- _h('span', {key: 'icon',className: 'dsh-cron-session-bar-icon',dangerouslySetInnerHTML: { __html: ICON_TIMER }
2574
- }),_h('button', {key: 'badge',type: 'button',className: 'dsh-cron-session-badge' + (running ? ' dsh-cron-pulse' : ''),title: linkedTask.title || linkedTask.id,onClick: handleOpenLinked,}, linkedTask.title || linkedTask.id),_h('button', {key: 'run-btn',type: 'button',className: 'dsh-cron-session-run-btn',disabled: running,
2575
- title: T_KEY(barT, 'sessionBar.runNow'),onClick: handleQuickRun,}, running ? '...' : (runSuccess ? 'โœ”' : T_KEY(barT, 'sessionBar.run')))
2576
- ]);
2577
- }
2578
- return _h('button', {type: 'button',className: 'dsh-cron-session-add-btn','data-dsh-plugin': 'dsh-cron',title: T_KEY(barT, 'sessionBar.addRecurringHint'),'aria-label': T_KEY(barT, 'sessionBar.addRecurring'),onClick: handleCreateRecurring,}, [
2579
- _h('span', {key: 'icon',className: 'dsh-cron-session-bar-icon',dangerouslySetInnerHTML: { __html: ICON_TIMER },}),_h('span', { key: 'label' }, T_KEY(barT, 'sessionBar.addRecurring'))
2580
- ]);
2581
- }
2582
- const SIDEBAR_JOBS_KEY = 'dsh-cron-sidebar-open';
2583
- const SIDEBAR_JOBS_MAX_ROWS = 5;
2584
- function buildSidebarJobRow(state, task) {
2585
- const row = document.createElement('button');
2586
- row.type = 'button';
2587
- row.className = 'dsh-cron-sidebar-job';
2588
- row.setAttribute('data-sidebar-task-id', task.id);
2589
- row.setAttribute('aria-label', task.title || task.id);
2590
- const title = document.createElement('span');
2591
- title.className = 'dsh-cron-sidebar-job-title';
2592
- title.textContent = task.title || task.id;
2593
- row.appendChild(title);
2594
- const meta = document.createElement('span');
2595
- meta.className = 'dsh-cron-sidebar-job-meta';
2596
- if (task.running) meta.textContent = T('list.runningNow');
2597
- else if (task.nextRunAt) meta.textContent = new Date(task.nextRunAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
2598
- else meta.textContent = task.scheduleText || task.schedule || '';
2599
- row.appendChild(meta);
2600
- if (task.running) row.classList.add('dsh-cron-pulse');
2601
- row.addEventListener('click', (event) => {event.preventDefault();
2602
- event.stopPropagation();
2603
- state.openTaskSignal(task.id);
2604
- if (!state.toggle.isOpen()) state.toggle.toggle();
2605
- });
2606
- return row;
2607
- }
2608
- function renderSidebarJobs(state, tasks) {
2609
- const listEl = state.listEl;
2610
- if (!listEl) return;
2611
- listEl.innerHTML = '';
2612
- if (!tasks.length) {
2613
- const empty = document.createElement('div');
2614
- empty.className = 'dsh-cron-sidebar-empty';
2615
- empty.textContent = T('sidebar.noActiveJobs');
2616
- listEl.appendChild(empty);
2617
- return;
2618
- }
2619
- for (const task of tasks.slice(0, SIDEBAR_JOBS_MAX_ROWS)) listEl.appendChild(buildSidebarJobRow(state, task));
2620
- if (tasks.length > SIDEBAR_JOBS_MAX_ROWS) {
2621
- const more = document.createElement('div');
2622
- more.className = 'dsh-cron-sidebar-more';
2623
- more.textContent = T('sidebar.moreJobs', { count: tasks.length - SIDEBAR_JOBS_MAX_ROWS });
2624
- listEl.appendChild(more);
2625
- }
2626
- }
2627
- async function loadSidebarJobs(state) {try {
2628
- const { res, data } = await fetchJsonWithTimeout('/dsh-cron/tasks?status=active');
2629
- if (data && data.ok) renderSidebarJobs(state, data.tasks || []);
2630
- } catch (err) {console.debug('[dsh-cron] load sidebar jobs failed', err);
2631
- }
2632
- }
2633
- function applySidebarJobsOpen(state) {if (!state.root) return;
2634
- state.root.dataset.open = state.open ? 'true' : 'false';
2635
- if (state.headEl) state.headEl.setAttribute('aria-expanded', state.open ? 'true' : 'false');
2636
- if (state.open) loadSidebarJobs(state);
2637
- }
2638
- function buildSidebarJobsRoot(state, label) {
2639
- const root = document.createElement('div');
2640
- root.className = 'dsh-cron-sidebar-jobs';
2641
- root.setAttribute('data-dsh-plugin', 'dsh-cron');
2642
- root.setAttribute('data-dsh-part', 'sidebar-jobs');
2643
- const headEl = document.createElement('button');
2644
- headEl.type = 'button';
2645
- headEl.className = 'dsh-cron-sidebar-jobs-head';
2646
- headEl.setAttribute('aria-expanded', state.open ? 'true' : 'false');
2647
- headEl.textContent = label;
2648
- headEl.addEventListener('click', (event) => {event.preventDefault();
2649
- event.stopPropagation();
2650
- state.open = !state.open;
2651
- try { window.localStorage.setItem(SIDEBAR_JOBS_KEY, state.open ? '1' : '0'); } catch (err) { void err; }
2652
- applySidebarJobsOpen(state);
2653
- });
2654
- root.appendChild(headEl);
2655
- const listEl = document.createElement('div');
2656
- listEl.className = 'dsh-cron-sidebar-jobs-list';
2657
- root.appendChild(listEl);
2658
- state.root = root;
2659
- state.headEl = headEl;
2660
- state.listEl = listEl;
2661
- return root;
2662
- }
2663
- function placeSidebarJobs(state, label) {
2664
- const entry = resolveSidebarAnchor();
2665
- if (sidebarJobsSeatIsCurrent(state, entry)) return;
2666
- if (entry === null || entry.parentElement === null) return;
2667
- if (state.root === undefined) {entry.insertAdjacentElement('afterend', buildSidebarJobsRoot(state, label));
2668
- } else {entry.insertAdjacentElement('afterend', state.root);
2669
- state.root = document.querySelector('[data-dsh-part="sidebar-jobs"]') || state.root;
2670
- state.listEl = state.root.querySelector('.dsh-cron-sidebar-jobs-list');
2671
- state.headEl = state.root.querySelector('.dsh-cron-sidebar-jobs-head');
2672
- }
2673
- applySidebarJobsOpen(state);
2674
- }
2675
- function mountSidebarJobs(toggle, label, openTaskSignal) {if (typeof document === 'undefined') return () => {};
2676
- const state = { toggle, openTaskSignal, root: undefined, listEl: undefined, headEl: undefined, open: false };
2677
- try { state.open = window.localStorage.getItem(SIDEBAR_JOBS_KEY) === '1'; } catch (err) { void err; }
2678
- let rafPending = false;
2679
- const schedulePlace = () => {if (sidebarJobsSeatIsCurrent(state, resolveSidebarAnchor())) return;
2680
- if (rafPending) return;
2681
- rafPending = true;
2682
- const scheduleFn = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : (cb) => setTimeout(cb, 16);
2683
- scheduleFn(() => {rafPending = false;
2684
- placeSidebarJobs(state, label);
2685
- });
2686
- };
2687
- const observer = new MutationObserver(schedulePlace);
2688
- observer.observe(document.body, { childList: true, subtree: true });
2689
- placeSidebarJobs(state, label);
2690
- loadSidebarJobs(state);
2691
- const fetchTimer = setInterval(() => {
2692
- let isOpen = false;
2693
- try { isOpen = window.localStorage.getItem(SIDEBAR_JOBS_KEY) === '1'; } catch (err) { void err; }
2694
- if (isOpen) loadSidebarJobs(state);
2695
- }, 30000);
2696
- return () => {observer.disconnect();
2697
- clearInterval(fetchTimer);
2698
- if (state.root !== undefined && state.root.isConnected) state.root.remove();
2699
- state.root = undefined;
2700
- };
2701
- }
2702
- let shellOverlayActive = false;
2703
- function mountCronScreen(ctx, toggle) {if (typeof document === 'undefined') return () => {};
2704
- let root;
2705
- let container;
2706
- const teardownPanel = () => {if (root !== undefined) {try { root.unmount(); } catch (e) { /* ignore */ }
2707
- root = undefined;
2708
- }
2709
- if (container !== undefined) {try { container.remove(); } catch (e) { /* ignore */ }
2710
- container = undefined;
2711
- }
2712
- };
2713
- const ensure = () => {if (!toggle.isOpen()) {teardownPanel();
2714
- return;
2715
- }
2716
- if (shellOverlayActive) {teardownPanel();
2717
- return;
2718
- }
2719
- if (container !== undefined && container.isConnected) return;
2720
- const column = document.querySelector(COLUMN_SELECTOR);
2721
- if (column === null) return;
2722
- container = document.createElement('div');
2723
- container.setAttribute(VIEW_ATTR, '');
2724
- container.setAttribute('data-dsh-plugin', 'dsh-cron');
2725
- column.appendChild(container);
2726
- if (ReactDOM && typeof ReactDOM.createRoot === 'function') {root = ReactDOM.createRoot(container);
2727
- root.render(_h(ErrorBoundary, null, _h(CronScreen, { ctx, toggle, onClose: () => toggle.set(false), t: translate })));
2728
- } else if (ReactDOM && typeof ReactDOM.render === 'function') {ReactDOM.render(_h(CronScreen, { ctx, toggle, onClose: () => toggle.set(false), t: translate }), container);
2729
- }
2730
- };
2731
- const applyActive = () => {if (toggle.isOpen()) {ensureStyles();
2732
- document.documentElement.setAttribute(ACTIVE_ATTR, '');
2733
- document.dispatchEvent(new CustomEvent(ACTIVATE_EVENT, { detail: PANEL }));
2734
- ensure();
2735
- } else {document.documentElement.removeAttribute(ACTIVE_ATTR);
2736
- teardownPanel();
2737
- }
2738
- };
2739
- const onOtherActivate = (event) => {if (event.detail !== PANEL && toggle.isOpen()) toggle.set(false);
2740
- };
2741
- const onOutsideClick = (event) => {if (shellOverlayActive) return;
2742
- if (!toggle.isOpen()) return;
2743
- if (!shouldDismissPanel(event.target)) return;
2744
- toggle.set(false);
2745
- };
2746
- const waitObserver = new MutationObserver(ensure);
2747
- waitObserver.observe(document.body, { childList: true, subtree: true });
2748
- document.addEventListener(ACTIVATE_EVENT, onOtherActivate);
2749
- document.addEventListener('click', onOutsideClick, true);
2750
- const unsubscribe = toggle.subscribe(applyActive);
2751
- applyActive();
2752
- ensure();
2753
- return () => {waitObserver.disconnect();
2754
- document.removeEventListener(ACTIVATE_EVENT, onOtherActivate);
2755
- document.removeEventListener('click', onOutsideClick, true);
2756
- unsubscribe();
2757
- document.documentElement.removeAttribute(ACTIVE_ATTR);
2758
- teardownPanel();
2759
- };
2760
- }
2761
- function registerIntoMount(ctx, mountName, entry, component) {if (!ctx || !ctx.slots || typeof ctx.slots.inject !== 'function') return false;
2762
- try {
2763
- return !!ctx.slots.inject(mountName, () => {ctx.slots.register(entry, component);
2764
- });
2765
- } catch (err) {console.warn('[dsh-cron] slot injection skipped:', mountName, '-', err && err.message);
2766
- return false;
2767
- }
2768
- }
2769
- function apply(ctx) {
2770
- const stopStyleSelfHeal = startStyleSelfHeal();
2771
- try {if (ctx.locale && typeof ctx.locale.register === 'function' && typeof ctx.effect === 'function') {ctx.effect(() => ctx.locale.register(NS, STRINGS), 'dsh-cron: locale dictionaries');
2772
- } else if (ctx.locale && typeof ctx.locale.register === 'function') {ctx.locale.register(NS, STRINGS);
2773
- }
2774
- } catch (e) {void e;
2775
- }
2776
- try {if (ctx.locale && typeof ctx.locale.bind === 'function') {translate = ctx.locale.bind(NS);
2777
- }
2778
- } catch (err) {/* locale bind unavailable, fallback to default translate */
2779
- }
2780
- const toggle = createToggle();
2781
- function SettingsCardWithBoundary(props) {
2782
- return _h(ErrorBoundary, null, CronSettingsCard(props));
2783
- }
2784
- const itemOk = registerIntoMount(ctx, 'plugins.item', {name: 'plugins.item',id: ROW_ID,order: 60,label: () => 'Cron',locale: NS,inject: () => ({ ctx, toggle }),}, SettingsCardWithBoundary);
2785
- if (!itemOk) {console.warn('[dsh-cron] plugins.item slot unavailable โ€” plugin page card not registered');
2786
- }
2787
- const rowOk = registerIntoMount(ctx, 'plugins.row.config', {name: 'plugins.row.config',key: ROW_CONFIG_KEY,locale: NS,inject: () => ({ ctx, toggle }),}, SettingsCardWithBoundary);
2788
- const cardOk = registerIntoMount(ctx, 'settings.plugin.item', {name: 'settings.plugin.item',key: NS,locale: NS,inject: () => ({ ctx, toggle }),}, SettingsCardWithBoundary);
2789
- if (!cardOk) {console.warn('[dsh-cron] settings.plugin.item slot unavailable โ€” settings card not registered');
2790
- }
2791
- const chipOk = registerIntoMount(ctx, 'conversation.session.header.utilities', {name: 'conversation.session.header.utilities',id: PLUGIN_ID + '.chip',order: 27,locale: NS,inject: () => ({ ctx, toggle }),}, CronChip);
2792
- const cardSlot = cardOk ? 'settings.plugin.item' : undefined;
2793
- const chipSlot = chipOk ? 'conversation.session.header.utilities' : undefined;
2794
- function CronNavIcon(props) {
2795
- const size = (props && props.size) || 16;
2796
- return _h('span', {className: 'dsh-cron-nav-icon','data-dsh-cron-entry': '','data-dsh-plugin': 'dsh-cron',style: { width: size, height: size },onClick: () => toggle.set(true),dangerouslySetInnerHTML: { __html: ICON_TIMER }
2797
- });
2798
- }
2799
- const navOk = registerIntoMount(ctx, 'sidebar.panellist', {name: 'sidebar.panellist',id: 'dsh-cron',order: 12,label: () => translate('sidebar.label'),locale: NS,}, CronNavIcon);
2800
- function CronMainPage(props) {if (shellOverlayActive) return null;
2801
- return _h(ErrorBoundary, null, _h(CronScreen, {...props,ctx: props.ctx || ctx,toggle: props.toggle || toggle,t: translate,onClose: () => {
2802
- const layoutService = optionalService(ctx, 'layout');
2803
- if (layoutService && typeof layoutService.selectPanel === 'function') {layoutService.selectPanel(null);
2804
- }
2805
- toggle.set(false);
2806
- }
2807
- }));
2808
- }
2809
- const mainOk = registerIntoMount(ctx, 'main', {name: 'main',key: 'dsh-cron',locale: NS,inject: () => ({ ctx, toggle }),}, CronMainPage);
2810
- function CronShellOverlay() {
2811
- const [open, setOpen] = React.useState(toggle.isOpen());
2812
- React.useEffect(() => {shellOverlayActive = true;
2813
- const off = toggle.subscribe(setOpen);
2814
- setOpen(toggle.isOpen());
2815
- return () => {shellOverlayActive = false;
2816
- off();
2817
- };
2818
- }, []);
2819
- if (!open) return null;
2820
- return _h('div', {className: 'dsh-cron-shell-overlay','data-dsh-plugin': 'dsh-cron',[VIEW_ATTR]: '',}, _h('div', { className: 'dsh-cron-shell-overlay-inner' },_h(ErrorBoundary, null, _h(CronScreen, {ctx,toggle,pinned: true,t: translate,onClose: () => {
2821
- const layoutService = optionalService(ctx, 'layout');
2822
- if (layoutService && typeof layoutService.selectPanel === 'function') {layoutService.selectPanel(null);
2823
- }
2824
- toggle.set(false);
2825
- },}))));
2826
- }
2827
- const isDesktopShell = (() => {try {if (typeof location === 'undefined') return false;
2828
- if (location.protocol === 'dsh-app:') return true;
2829
- return String(location.host || '').toLowerCase() === 'app';
2830
- } catch (err) {
2831
- return false;
2832
- }
2833
- })();
2834
- if (isDesktopShell) {registerIntoMount(ctx, 'shell.overlay', {name: 'shell.overlay',id: PLUGIN_ID,order: 900,locale: NS,inject: () => ({ ctx, toggle }),}, CronShellOverlay);
2835
- }
2836
- const layout = optionalService(ctx, 'layout');
2837
- if (layout && typeof layout.selectPanel === 'function') {toggle.subscribe((isOpen) => {if (isOpen) {layout.selectPanel('dsh-cron');
2838
- } else if (layout.panelInfo && typeof layout.panelInfo.getSnapshot === 'function') {if (layout.panelInfo.getSnapshot()?.activePanelId === 'dsh-cron') {layout.selectPanel(null);
2839
- }
2840
- }
2841
- });
2842
- if (layout.panelInfo && typeof layout.panelInfo.subscribe === 'function') {layout.panelInfo.subscribe(() => {
2843
- const active = layout.panelInfo.getSnapshot()?.activePanelId === 'dsh-cron';
2844
- if (toggle.isOpen() !== active) {toggle.set(active);
2845
- }
2846
- });
2847
- }
2848
- }
2849
- const barOk = registerIntoMount(ctx, 'conversation.session.header.actions', {name: 'conversation.session.header.actions',id: PLUGIN_ID + '.sessionBar',order: 28,locale: NS,inject: (slotParam) => {
2850
- const sid = typeof slotParam === 'string' ? slotParam : (slotParam && (slotParam.sessionId || slotParam.id));
2851
- const extra = (typeof slotParam === 'object' && slotParam !== null) ? slotParam : {};
2852
- return { ctx, toggle, sessionId: sid, ...extra };
2853
- },}, function QuickBarBoundary(props) {
2854
- return _h(ErrorBoundary, null, _h(SessionQuickActionBar, props));
2855
- });
2856
- const barSlot = barOk ? 'conversation.session.header.actions' : undefined;
2857
- function CronChip(props) {
2858
- const visible = useHeaderVisibility('showChatHeaderButton');
2859
- if (!visible) return null;
2860
- const chipT = props.t || translate;
2861
- return _h('button', {type: 'button','data-dsh-plugin': 'dsh-cron',style: { background: 'none', border: 'none', color: 'var(--dsw-alias-label-secondary, #999)', cursor: 'pointer', padding: '4px', display: 'inline-flex', alignItems: 'center' },title: T_KEY(chipT, 'chip.title'),'aria-label': T_KEY(chipT, 'chip.title'),onClick: () => toggle.toggle(),
2862
- dangerouslySetInnerHTML: { __html: ICON_TIMER }
2863
- });
2864
- }
2865
- ctx.effect(() => {
2866
- const off = [
2867
- mountSidebarJobs(toggle, translate('sidebar.jobsTitle'), (taskId) => { pendingTaskHighlight = taskId; }),mountCronScreen(ctx, toggle)
2868
- ];
2869
- return () => { for (const dispose of off) dispose(); stopStyleSelfHeal(); };
2870
- }, 'dsh-cron: client overlay');
2871
- exports.slots = { card: cardSlot, chip: chipSlot, sessionBar: barSlot, nav: navOk ? 'sidebar.panellist' : undefined, main: mainOk ? 'main' : undefined };
2872
- module.exports.panelDismissRule = shouldDismissPanel;
2873
- module.exports.sidebarJobsSeatIsCurrent = sidebarJobsSeatIsCurrent;
2874
- module.exports.updateHeaderSettings = updateHeaderSettings;
2875
- module.exports.useHeaderVisibility = useHeaderVisibility;
2876
- module.exports.getHeaderSettings = () => currentHeaderSettings;
2877
- }
2878
- module.exports = { apply, inject: ['slots', 'locale'] };
2879
- return module.exports;
2880
- }
2881
- })
1
+ window.__ModuleLoader__.load({id:"@goodandready/dsh-cron",factory:require=>{var module={exports:{}};var exports=module.exports;const React=window.React||require("react");const _h=(...args)=>React&&React.createElement?React.createElement(...args):null;const ReactDOM=window.ReactDOM||(function(){try{return require("react-dom/client")}catch(_e){void _e}try{return require("react-dom")}catch(_e){void _e}return null})();const PLUGIN_ID="@goodandready/dsh-cron";const NS="dsh-cron";const ROW_ID="dsh-cron";const ROW_CONFIG_KEY=PLUGIN_ID+"#"+ROW_ID;const PANEL="cron";const ACTIVATE_EVENT="dsh-panel-activate";const ACTIVE_ATTR="data-dsh-cron-active";const ENTRY_ATTR="data-dsh-cron-entry";let pendingTaskHighlight=null;let pendingTaskPreset=null;const VIEW_ATTR="data-dsh-cron-view";const COLUMN_SELECTOR="[data-pane=conversation], [class*=centerCol]";const PANEL_OWNED_SELECTOR="["+VIEW_ATTR+'], [data-dsh-plugin="dsh-cron"]';const SCRIPT_CONFIRM_HEADER="x-dsh-cron-confirm";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>';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>';const ICON_PLAY='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="5 3 19 12 5 21 5 21"></polygon></svg>';const ICON_PAUSE='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="6" y="4" width="4" height="16"></rect><rect x="14" y="4" width="4" height="16"></rect></svg>';const ICON_TRASH='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>';const ICON_SEARCH='<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="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';const ICON_CHEVRON_DOWN='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"></polyline></svg>';const ICON_BELL='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>';const ICON_CLIPBOARD='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>';const ICON_ACTIVITY='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>';const ICON_EDIT='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>';const ICON_SEND='<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"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>';const ICON_COPY='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>';const ICON_TUNE='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="21" x2="4" y2="14"></line><line x1="4" y1="10" x2="4" y2="3"></line><line x1="12" y1="21" x2="12" y2="12"></line><line x1="12" y1="8" x2="12" y2="3"></line><line x1="20" y1="21" x2="20" y2="16"></line><line x1="20" y1="12" x2="20" y2="3"></line><line x1="1" y1="14" x2="7" y2="14"></line><line x1="9" y1="8" x2="15" y2="8"></line><line x1="17" y1="16" x2="23" y2="16"></line></svg>';const ICON_DOWNLOAD='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>';const ICON_UPLOAD='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>';const ICON_TELEGRAM='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.64 6.8-1.7 8.01c-.13.58-.47.72-.95.45l-2.6-1.92-1.25 1.21c-.14.14-.26.26-.53.26l.19-2.64 4.81-4.35c.21-.19-.05-.29-.32-.11L8.34 13.5 5.78 12.7c-.56-.17-.57-.56.12-.83l10-3.86c.46-.17.87.11.74.79z"/></svg>';let CoreChevron=null;try{const primitives=require("@deepseek-ai/dsh-client-ui-primitives");CoreChevron=primitives&&primitives.IconChevronDownOutline14}catch(e){void e}const chevronNode=()=>CoreChevron?_h(CoreChevron):_h("span",{style:{display:"flex",alignItems:"center"},dangerouslySetInnerHTML:{__html:ICON_CHEVRON_DOWN}});const STRINGS={en:{"sidebar.label":"Scheduled tasks","sidebar.jobsTitle":"Active jobs","sidebar.noActiveJobs":"No active jobs","sidebar.moreJobs":"and {count} more","sessionBar.addRecurring":"+ Cron","sessionBar.addRecurringHint":"Turn this session into a scheduled recurring task","sessionBar.run":"Run","sessionBar.runNow":"Trigger execution now","sessionBar.running":"Running...","chip.title":"Scheduled tasks (Cron)","panel.back":"Back to chat","panel.title":"Scheduled tasks","panel.subtitle":"Ask DSH to plan tasks, set reminders or track updates","actions.create":"Create","actions.createWithDsh":"\u{1F4AC} Create with DSH","actions.setupManually":"\u270F\uFE0F Set up manually","actions.runNow":"Run now","actions.runNowShort":"Run","actions.edit":"Edit / Details","actions.duplicate":"Duplicate task","actions.tuneWithDsh":"Tune with DSH","tune.startFailed":"Could not start the tuning dialogue: {error}","actions.delete":"Delete task","duplicate.done":"Copy created and paused: review its schedule before resuming it.","duplicate.oneShotHint":"The copy is one-shot and paused \u2014 its original time has likely passed, so set a new time before resuming.","duplicate.failed":"Could not duplicate the task: {error}","transfer.exportTitle":"Export tasks","transfer.importTitle":"Import tasks","transfer.exported":"Exported {count} task(s).","transfer.exportFailed":"Export failed: {error}","transfer.importTitleModal":"Import tasks","transfer.importHint":"Exported task configuration only: no run history, no counters. Channel configurations reference credentials by name; note that raw exports retain custom env variables and HTTP request headers.","transfer.exportPrompt":"Choose export mode:\nOK = Sanitized (removes custom env vars & headers)\nCancel = Full raw export","transfer.strategyAdd":"Add as new tasks (new ids, existing ones stay untouched)","transfer.strategyReplace":"Replace tasks with the same id","transfer.strategySkip":"Skip tasks whose id already exists","transfer.summary":"This file contains {total} task(s): {add} new, {replace} matching an existing id, {skip} already skipped.","transfer.confirm":"Import","transfer.imported":"Imported {count} task(s).","transfer.importFailed":"Import failed: {error}","transfer.badFile":"The selected file is not a valid JSON export: {error}","actions.pause":"Pause","actions.resume":"Resume","actions.settings":"Notifications & channels","search.placeholder":"Search scheduled tasks","filters.title":"Filters","filters.type":"Type","filters.model":"Model","filters.channel":"Channel","filters.any":"Any","filters.reset":"Reset filters","filters.empty":"No task matches the current filters.","filters.showing":"Showing {shown} of {total}","stats.activeTasks":"Active tasks","stats.totalRuns":"Total runs","stats.totalTokens":"Tokens spent","stats.totalCost":"Estimated cost","tabs.all":"All","tabs.active":"Active","tabs.paused":"Paused","tabs.completed":"Completed","banner.loadError":"Failed to load tasks: {error}","banner.retry":"Retry","list.loading":"Loading scheduled tasks...","list.empty":"No scheduled tasks yet","list.typeShell":"Shell","list.typeLlm":"LLM","list.oneShot":"One-shot","list.configManaged":"Config","list.configManagedHint":"Declared in config.jobs in the profile config file; edit the file to change or remove it","list.next":" \xB7 next: {time}","recs.title":"Recommended tasks","recs.hint":"Ready-to-use recipes. Clicking one opens the form with its fields filled in \u2014 nothing is created until you save.","modal.editTitle":"Edit task","modal.newTitle":"New scheduled task","modal.statusActive":"\u25CF Active","modal.statusPaused":"\u25CB Paused","modal.params":"Parameters","modal.history":"Run history ({count})","modal.cancel":"Cancel","modal.confirmDiscard":"Discard unsaved changes?","modal.save":"Save changes","modal.create":"Create task","modal.close":"Close","history.loading":"Loading history...","history.empty":"No runs recorded yet","history.stoppedReasonTitle":"Stopped reason:","history.retryDelivery":"Retry delivery","history.retryingDelivery":"Retrying...","history.statusValidationFailed":"validation failed","history.stage_queue":"Queue","history.stage_preflight":"Preflight","history.stage_execution":"Execution","history.stage_validation":"Validation","history.stage_delivery":"Delivery","history.refresh":"Refresh history","history.statusSuccess":"Success","history.statusUncertain":"Uncertain","history.artifacts":"Artifacts","history.resolveCompleted":"Mark Completed","history.resolveFailed":"Mark Failed","history.statusUncertainHint":"Interrupted by restart \u2014 verify outcome","history.statusSkipped":"Skipped","history.statusMissed":"Missed","history.statusTimeout":"Timeout","history.statusFailed":"Failed","form.nameLabel":"Task name","form.namePlaceholder":"For example: dsh-tags-watch","form.typeLabel":"Execution type","form.typeLlm":"LLM (AI agent)","form.typeScript":"Shell command / script","form.typeNode":"Node.js","form.typePython":"Python","form.typeHttp":"HTTP request / webhook","form.typeSsh":"Remote SSH","form.typeDocker":"Docker container","form.typeSkill":"DSH Skill","form.typeWorkflow":"DSH Workflow","form.typeDigest":"Daily / Periodic Digest","form.envLabel":"Environment variables (KEY=VALUE per line)","form.envPlaceholder":"NODE_ENV=production\nTZ=Europe/Berlin","form.envHint":"Applied to non-LLM runtimes only. Do not store secrets here.","form.cwdLabel":"Working directory (optional)","form.workspaceLabel":"Workspace id or path (optional)","form.worktreeLabel":"Run in an isolated git worktree","form.keepWorktreeLabel":"Keep the worktree after the run","form.httpMethodLabel":"HTTP method","form.httpUrlLabel":"URL","form.httpHeadersLabel":"Headers (JSON, optional)","form.httpBodyLabel":"Body (optional)","form.sshProfileLabel":"dsh-remote-workspace profile id","form.sshProfileHint":"Preferred: host and credentials stay in the remote-workspace plugin.","form.sshTargetLabel":"Fallback target (user@host, optional)","form.sshKeyLabel":"Private key path (fallback, optional)","form.dockerImageLabel":"Container image","form.skillNameLabel":"Skill name","form.workflowNameLabel":"Workflow name","form.scheduleLabel":"Schedule (cron or interval)","form.schedulePlaceholder":"0 */6 * * * or every 2h or in 30m or at: 2026-09-05T15:00:00Z","form.timeoutLabel":"Execution timeout (seconds)","form.overlapLabel":"Overlap policy","form.overlapSkip":"Skip the new run (skip)","form.overlapQueue":"Queue the next run (queue)","form.overlapReplace":"Cancel current run and restart (replace)","form.kanbanLabel":"Kanban card creation (dsh-kanban)","form.kanbanNone":"Do not create cards (disabled)","form.kanbanOnFailure":"Create a ticket on failure (into Backlog)","form.kanbanAlways":"Create a card on every completion (Done / Backlog)","form.providerLabel":"LLM provider","form.providerDefault":"Default (DSH)","form.modelLabel":"LLM model","form.modelDefault":"Default","form.silentRuleLabel":"Silent rule (optional)","form.silentRulePlaceholder":"Stay silent when no filesystem is above 80%","form.silentRuleHint":"For tasks with output: a cheap model judges the run against this rule and the report is skipped when it says to stay silent. If the model is unavailable or unsure, the report is delivered.","history.silentSkip":"stayed silent:","history.diagnosis":"Diagnosis","history.applySuggestion":"Open the edit form with this suggestion","form.inspectOnFailureLabel":"Diagnose failures with a model","form.inspectOnFailureHint":"After a failed run a model reads the prompt, the error and the output, and the diagnosis with a proposed prompt change is stored with the run. Nothing is applied automatically.","settings.inspectorModelLabel":"Model for failure diagnosis","form.fallbackModelLabel":"Fallback model (optional)","form.fallbackModelPlaceholder":"e.g. deepseek-reasoner","form.fallbackModelHint":"If the run fails on the model above, it is retried once on this model. Both attempts are counted in the cost.","form.promptLabelScript":"Shell command or script","form.promptLabelLlm":"Instruction / Prompt for the agent","form.promptPlaceholderScript":"curl -fsSL https://... || exit 1","form.promptPlaceholderLlm":"Describe exactly what the agent should do...","form.timezoneLabel":"Time zone (IANA, optional)","form.timezonePlaceholder":"e.g. Europe/Berlin (empty = server local)","form.misfireLabel":"On missed run (after downtime)","form.misfireSkip":"Skip the missed run (skip)","form.misfireRunOnce":"Run once late (runOnce)","form.misfireCatchUp":"Run late once and record the gap (catchUpAll)","form.retriesLabel":"Automatic retries on failure (0 = off)","form.permissionLabel":"Session permissions","form.permissionDefault":"Default (as configured in DSH)","form.permissionReadonly":"Read-only","form.permissionWrite":"Workspace write","form.permissionFull":"Full","list.runningNow":"Running now","history.openSession":"Open session","form.notifyTitle":"Telegram notifications","form.notifyTelegram":"Send the run report to Telegram","form.notifyOnlyFailure":"Only on failures (onlyOnFailure / silent on success)","form.channelsTitle":"Delivery channels","form.channelsHint":"Pick the channels for this task. An explicit selection overrides the Telegram switch above; leave everything unchecked to fall back to it.","form.templateLabel":"Message template (optional)","form.templatePlaceholder":"\u23F0 {title} \u2014 {status} in {duration}","form.templateHint":"Variables: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}. Empty = built-in text.","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.","form.channelTelegram":"Telegram","form.channelKanban":"dsh-kanban card","form.channelDiscord":"Discord","form.channelSlack":"Slack","form.channelNtfy":"ntfy","form.channelBark":"Bark","form.channelPushplus":"PushPlus","form.channelTts":"Voice (dsh-tts)","form.channelGitea":"Gitea issue","settings.deliverySection":"Delivery channels","settings.secretsSection":"Credentials (references)","settings.secretsHint":"Enter the NAME of a DSH credential, not the secret itself. Secrets stay in the credentials store.","settings.telegramSection":"Telegram","settings.templatesSection":"Message templates","settings.channelTemplateLabel":"Template for {channel}","settings.botTokenRefLabel":"Bot token credential name","settings.botTokenRefPlaceholder":"e.g. TELEGRAM_BOT_TOKEN","settings.apiTokenLabel":"External API token","settings.apiTokenPlaceholder":"Bearer token for /dsh-cron/api/* (empty = disabled)","settings.discordLabel":"Discord webhook URL","settings.slackLabel":"Slack webhook URL","settings.ntfyUrlLabel":"ntfy server URL","settings.ntfyTopicLabel":"ntfy topic","settings.ntfyTokenRefLabel":"ntfy token credential name","settings.barkServerLabel":"Bark server URL","settings.barkKeyLabel":"Bark device key","settings.pushplusTokenRefLabel":"PushPlus token credential name","settings.pushplusUrlLabel":"PushPlus endpoint","settings.ttsBaseUrlLabel":"dsh-tts base URL","settings.giteaBaseUrlLabel":"Gitea base URL","settings.giteaRepoLabel":"Gitea repository (owner/repo)","settings.giteaTokenRefLabel":"Gitea token credential name","settings.templateLabel":"Default message template","settings.templateHint":"Applies to every channel without its own template. Empty = built-in text.","settings.deliveryTimeoutMsLabel":"Delivery timeout per channel (ms)","settings.automationSection":"Automation models","settings.automationHint":"Models used for the small helper calls (rule evaluation, failure analysis). Leave empty to use the task model.","settings.silentRuleModelLabel":"Model for silent rules","settings.secretsOnCard":"Credentials referenced from the settings panel are shown masked and stored by name.","form.nextRunLabel":"Next run: ","form.notScheduled":"not scheduled","settings.loading":"Loading settings...","settings.unavailable":"Settings are unavailable right now.","settings.retry":"Retry","settings.cardTitle":"\u23F0 Task scheduler (Cron)","settings.cardDesc":"Scheduled task execution (cron/intervals), background agent scenarios, and delivery of run reports to Telegram, Discord, Slack, ntfy, Bark, PushPlus, voice and Gitea.","settings.openPanel":"Open task panel","settings.modalTitle":"Notifications & delivery channels","settings.tokenLabel":"Telegram Bot Token","settings.tokenPlaceholder":"123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ","settings.tokenPlaceholderDefault":"Using the bot configured in DSH settings (or enter your own)","settings.defaultHint":"\u2713 A configured bot was found in the DSH profile","settings.chatIdLabel":"Telegram Chat ID","settings.chatIdPlaceholder":"For example: 345678901","settings.kanbanUrlLabel":"Kanban Base URL","settings.globalNotify":"Deliver reports of all tasks to Telegram globally","settings.globalOnlyFailure":"Global mode: only on failures (silent on success)","settings.dynamicCredentials":"Dynamic Credentials Resolution (credential://...)","settings.dynamicCredentialsHint":"Resolve credential://... in memory from harness credentials at runtime (#335)","settings.showChatHeaderButton":"Show schedule button in chat header","settings.showChatHeaderActions":"Show quick create action in chat header","settings.testTelegram":"\u{1F514} Test Telegram delivery","settings.testKanban":"\u{1F4CB} Test Kanban","settings.sending":"Sending...","settings.checkingKanban":"Checking Kanban...","settings.testOk":"\u2705 Test message delivered to Telegram!","settings.testFail":"\u274C {error}","settings.kanbanOk":"\u2705 Kanban card created","settings.kanbanFail":"\u274C {error}","settings.save":"Save settings","settings.saved":"\u2713 Saved","settings.saveError":"Save failed: {error}","settings.saveErrorUnknown":"unknown error","updater.title":"Plugin Auto-Updater","updater.btnCheck":"Check for updates","updater.checking":"Checking...","updater.btnUpdate":"Update to v{version}","updater.updating":"Updating...","updater.desc":"Check npm registry and install plugin updates in-place without SSH access.","updater.current":"Current version: v{version}","updater.available":"Update available: v{version}","updater.upToDate":"Up to date","updater.success":"Successfully updated to v{version}. Please restart DSH or reload profile to apply changes.","dsh.modalTitle":"Schedule a task with the DSH agent","dsh.descLabel":"Describe the task and the desired frequency:","dsh.placeholder":"For example: check free disk space and failed systemd services every 2 hours, and alert only if something is wrong...","dsh.sendHint":"Ctrl+Enter to send","dsh.sendTitle":"Send to agent","dsh.startFailed":"Failed to start the agent dialog: {error}","dsh.launchError":"Launch failed: {error}","confirm.delete":"Delete this task?","list.loadErrorPrefix":"Failed to load tasks","actions.dryRun":"Dry run","actions.dryRunTitle":"Dry run (test execution without side effects or notifications)","actions.archive":"Archive","actions.archiveTitle":"Execution archive and logs","dryRun.title":"\u{1F9EA} Dry Run Simulation","dryRun.task":"Task","dryRun.status":"Simulation Status","dryRun.duration":"Duration","dryRun.output":"Simulated Output","dryRun.preflight":"Preflight Check","dryRun.close":"Close","archive.title":"\u{1F4DC} Execution Archive","archive.totalRuns":"{total} total runs recorded","archive.empty":"No archived runs recorded for this task yet.","archive.loadMore":"Load more ({shown} of {total})","archive.close":"Close","form.reliabilityTitle":"\u{1F6E1}\uFE0F Reliability, Heartbeat & Self-Healing","form.preflightLabel":"Pre-flight check","form.preflightNone":"None","form.preflightHttp":"HTTP (2xx probe)","form.preflightShell":"Shell command (exit code 0)","form.preflightDisk":"Disk space (path:minPercent)","form.preflightTargetLabel":"Pre-flight target","form.preflightTargetPlaceholder":"https://example.com/healthz OR ls /data OR /:10%","form.heartbeatIntervalLabel":"Heartbeat deadline (seconds, 0 = disabled)","form.gracePeriodLabel":"Heartbeat grace period (seconds)","form.priorityLabel":"Queue priority (1-10, higher runs first)","form.concurrencyGroupLabel":"Concurrency group","form.workWindowHoursLabel":"Allowed work hours (e.g. 22:00-07:00)","form.workWindowHoursPlaceholder":"e.g. 22:00-07:00 or 09:00-18:00","form.workWindowPolicyLabel":"Outside window policy","form.workWindowPolicySkip":"Skip execution (record skipped)","form.workWindowPolicyDefer":"Defer until window opens","form.timeBoxMinutesLabel":"Timebox deadline (minutes, 0 = unlimited)","form.wakeTriggerTypeLabel":"Event wake trigger","form.wakeTriggerTypeNone":"None (Schedule / Cron only)","form.wakeTriggerTypeFileCount":"File count threshold (batch run)","form.wakeTriggerTypeMarkerFile":"Marker file receipt (flag file)","form.wakeTriggerTypeProcessExit":"Process exit watcher (PID / pidFile)","form.wakeTriggerPathLabel":"Trigger target path (dir / marker / pidfile)","form.wakeTriggerPathPlaceholder":"e.g. incoming/ or build.ready or run.pid","form.wakeTriggerMinCountLabel":"Min file count","form.wakeTriggerConsumeLabel":"Consume / delete marker after trigger","form.writeScopesLabel":"Write scopes (Scope Locks, relative paths per line or comma)","form.writeScopesPlaceholder":"e.g. src/, docs/ (prevents concurrent writes on overlapping scopes)","form.inputHashPathsLabel":"Input hash paths (inputHashPaths)","form.inputHashPathsPlaceholder":"e.g. src/, package.json (skip run if unchanged)","form.skipIfUnchangedLabel":"Skip execution if inputs are unchanged (save tokens & budget)","form.selfHealingLabel":"Self-healing runbook command (shell)","form.selfHealingPlaceholder":"systemctl restart app || true","form.autoDiagnoseLabel":"Auto-diagnose failures with AI agent","form.agentPresetLabel":"Agent preset","form.agentPresetPlaceholder":"standard (leave empty for configured default)","form.agentPresetHint":"Agent preset from dsh-agent-presets (e.g. standard, minimal, cordis, ptc). Mounts workspace and coding tools.","form.sessionTitleLabel":"Session Title Template","form.sessionTitlePlaceholder":"e.g. {{date}} a-share-review (supports {{date}})","form.sessionTitleHint":'Name given to agent sessions created by this task. Supports {{date}} for YYYY-MM-DD. Defaults to "<YYYY-MM-DD> <title>".',"form.targetSessionIdLabel":"Target persistent session ID","form.targetSessionIdPlaceholder":"e.g. audit-chat or dev-summary (empty = isolated run)","form.targetSessionIdHint":"When specified, scheduled runs resume this session to maintain conversation context across runs instead of creating a new isolated session.","form.targetSessionResetLabel":"Session context rotation","form.targetSessionResetNever":"Continuous (never reset)","form.targetSessionResetDaily":"Daily rotation (new session each day)","form.targetSessionResetWeekly":"Weekly rotation (new session each week)","form.targetSessionResetHint":"Automatically rotates the session identifier to prevent context window explosion over long periods.","form.requireApprovalLabel":"Require human approval before execution","form.requireApprovalHint":"When enabled, the task will not execute until an authorized user approves the run proposal (#318).","actions.approve":"Approve","actions.reject":"Reject","approval.waiting":"Awaiting human approval","approval.approved":"Approved","approval.rejected":"Rejected","chainGraph.modalTitle":"Visual Chain & Checkpoint Graph","chainGraph.viewGraph":"Chain Graph","chainGraph.noNodes":"No chained steps found for this task or run.","chainGraph.retryStep":"Retry Step","chainGraph.stepSuccess":"Success","chainGraph.stepFailed":"Failed","chainGraph.stepPending":"Pending","chainGraph.close":"Close","chainGraph.decisionNode":"Decision Node","chainGraph.stepSkipped":"Skipped","history.doctorDiagnosis":"Doctor Diagnosis & Suggested Fix","history.doctorApply":"1-Click Apply Fix","history.doctorRevert":"Revert to Previous Code","history.autoHealed":"Auto-Healed by Doctor","form.autoHealLabel":"Autonomous Self-Healing Doctor","form.autoHealHint":"Automatically diagnose and apply safe fixes upon failure (max 1 auto-patch/day)","form.elseTaskLabel":"Default Fallback Task (elseTask)","form.elseTaskHint":"Target task to trigger if no conditional branch rules matched","form.elseTaskPlaceholder":"e.g. task-fallback","adaptive.badge":"Adaptive","adaptive.idle":"idle","adaptive.backoff":"backoff","form.adaptiveEnabled":"Adaptive Polling","form.adaptiveHint":"Exponential backoff when no changes are detected","liveLog.modalTitle":"Real-Time Streaming Execution Logs","liveLog.viewLog":"Live Stream","liveLog.autoScroll":"Auto-scroll","liveLog.connecting":"Connecting to log stream...","liveLog.waiting":"Waiting for runner output...","liveLog.completed":"Execution stream completed","liveLog.close":"Close Stream","timeline.modalTitle":"24-Hour Schedule Timeline","timeline.buttonLabel":"Timeline","timeline.buttonTitle":"View 24-hour projected schedule and concurrency timeline","timeline.tabTimeline":"Schedule Timeline","timeline.legendDesc":"Projected run distribution across 24 hourly buckets:","timeline.peakWarning":"Peak concurrency warning","heatmap.modalTitle":"Cost & Token Burn Heatmap","heatmap.buttonLabel":"Heatmap","heatmap.tabHeatmap":"Cost Heatmap","heatmap.matrixDesc":"Weekly hour-of-day cost concentration (7 days \xD7 24 hours):","digest.modalTitle":"Automation & Cost Digest","digest.buttonLabel":"Digest","digest.buttonTitle":"View 7-day or 30-day automation analytics and cost digest","digest.period7":"Last 7 Days","digest.period30":"Last 30 Days","digest.executions":"Executions","digest.tokens":"Tokens","digest.cost":"Cost (USD)","digest.fleet":"Automations","digest.unstableTitle":"Top Unstable Automations","digest.expensiveTitle":"Top Resource Consumers","digest.sendTelegram":"Send to Telegram","digest.copyMarkdown":"Copy Markdown","digest.copied":"Copied!","digest.sentSuccess":"Sent to Telegram successfully!","prompt.version":"Prompt Version","prompt.rollback":"Restore v","prompt.history":"Prompt History","prompt.successRate":"SR","form.chainingTitle":"Chaining & DAG Orchestration","form.onSuccessLabel":"On Success Trigger (Task IDs)","form.onSuccessHint":"Comma-separated task IDs to execute upon success (Fan-Out)","form.onFailureLabel":"On Failure Trigger (Task IDs)","form.onFailureHint":"Comma-separated task IDs to execute upon failure","form.dependsOnLabel":"Dependencies (dependsOn)","form.dependsOnHint":"Wait for these task IDs before executing (Fan-In barrier)","form.joinPolicyLabel":"Join Policy","form.joinPolicyAll":"All Prerequisites (all_success)","form.joinPolicyAny":"Any Prerequisite (any_success)","recipe.dependenciesMissing":"Missing required integrations or credentials","form.previewSchedule":"Preview next runs","form.previewScheduleTitle":"Next 5 scheduled runs:"},zh:{"sidebar.label":"\u5B9A\u65F6\u4EFB\u52A1","sidebar.jobsTitle":"\u8FD0\u884C\u4E2D\u4EFB\u52A1","sidebar.noActiveJobs":"\u65E0\u8FD0\u884C\u4E2D\u4EFB\u52A1","sidebar.moreJobs":"\u53CA\u53E6\u5916 {count} \u4E2A","sessionBar.addRecurring":"+ \u5B9A\u65F6\u4EFB\u52A1","sessionBar.addRecurringHint":"\u5C06\u5F53\u524D\u4F1A\u8BDD\u8F6C\u4E3A\u5B9A\u65F6\u8BA1\u5212\u4EFB\u52A1","sessionBar.run":"\u8FD0\u884C","sessionBar.runNow":"\u7ACB\u5373\u6267\u884C","sessionBar.running":"\u6267\u884C\u4E2D...","chip.title":"\u5B9A\u65F6\u4EFB\u52A1 (Cron)","panel.back":"\u8FD4\u56DE\u5BF9\u8BDD","panel.title":"\u5B9A\u65F6\u4EFB\u52A1","panel.subtitle":"\u8BA9 DSH \u89C4\u5212\u4EFB\u52A1\u3001\u8BBE\u7F6E\u63D0\u9192\u6216\u8DDF\u8E2A\u72B6\u6001","actions.create":"\u65B0\u5EFA","actions.createWithDsh":"\u{1F4AC} \u8BA9 DSH \u521B\u5EFA","actions.setupManually":"\u270F\uFE0F \u624B\u52A8\u914D\u7F6E","actions.runNow":"\u7ACB\u5373\u8FD0\u884C","actions.runNowShort":"\u8FD0\u884C","actions.edit":"\u7F16\u8F91 / \u8BE6\u60C5","actions.duplicate":"\u590D\u5236\u4EFB\u52A1","actions.tuneWithDsh":"\u8BA9 DSH \u4F18\u5316","tune.startFailed":"\u65E0\u6CD5\u542F\u52A8\u4F18\u5316\u4F1A\u8BDD: {error}","actions.delete":"\u5220\u9664\u4EFB\u52A1","duplicate.done":"\u5DF2\u521B\u5EFA\u526F\u672C\u5E76\u5904\u4E8E\u6682\u505C\u72B6\u6001\uFF1A\u6062\u590D\u524D\u8BF7\u5148\u6838\u5BF9\u8C03\u5EA6\u65F6\u95F4\u3002","duplicate.oneShotHint":"\u8BE5\u526F\u672C\u4E3A\u4E00\u6B21\u6027\u4EFB\u52A1\u4E14\u5DF2\u6682\u505C\uFF0C\u8BF7\u8BBE\u5B9A\u65B0\u7684\u6267\u884C\u65F6\u95F4\u540E\u518D\u542F\u7528\u3002","duplicate.failed":"\u590D\u5236\u4EFB\u52A1\u5931\u8D25: {error}","transfer.exportTitle":"\u5BFC\u51FA\u4EFB\u52A1","transfer.importTitle":"\u5BFC\u5165\u4EFB\u52A1","transfer.exported":"\u5DF2\u6210\u529F\u5BFC\u51FA {count} \u4E2A\u4EFB\u52A1\u3002","transfer.exportFailed":"\u5BFC\u51FA\u5931\u8D25: {error}","transfer.importTitleModal":"\u5BFC\u5165\u4EFB\u52A1","transfer.importHint":"\u4EC5\u5BFC\u51FA\u4EFB\u52A1\u9759\u6001\u914D\u7F6E\uFF1A\u4E0D\u5305\u542B\u5386\u53F2\u8BB0\u5F55\u4E0E\u8BA1\u6570\u5668\u3002\u6E20\u9053\u901A\u8FC7\u51ED\u636E\u540D\u79F0\u5F15\u7528\uFF1B\u6CE8\u610F\u5B8C\u6574\u5BFC\u51FA\u4FDD\u7559\u81EA\u5B9A\u4E49\u73AF\u5883\u53D8\u91CF\u548C HTTP \u8BF7\u6C42\u5934\u3002","transfer.exportPrompt":"\u9009\u62E9\u5BFC\u51FA\u6A21\u5F0F\uFF1A\n\u786E\u5B9A = \u51C0\u5316\u5BFC\u51FA\uFF08\u79FB\u9664\u81EA\u5B9A\u4E49\u73AF\u5883\u53D8\u91CF\u4E0E\u8BF7\u6C42\u5934\uFF09\n\u53D6\u6D88 = \u5B8C\u6574\u539F\u59CB\u5BFC\u51FA","transfer.strategyAdd":"\u4F5C\u4E3A\u65B0\u4EFB\u52A1\u5BFC\u5165\uFF08\u5206\u914D\u65B0 ID\uFF09","transfer.strategyReplace":"\u8986\u76D6\u540C ID \u4EFB\u52A1","transfer.strategySkip":"\u8DF3\u8FC7\u5DF2\u5B58\u5728\u7684\u540C ID \u4EFB\u52A1","transfer.summary":"\u8BE5\u6587\u4EF6\u5305\u542B {total} \u4E2A\u4EFB\u52A1\uFF1A{add} \u4E2A\u65B0\u589E\uFF0C{replace} \u4E2A\u8986\u76D6\uFF0C{skip} \u4E2A\u8DF3\u8FC7\u3002","transfer.confirm":"\u5F00\u59CB\u5BFC\u5165","transfer.imported":"\u5DF2\u6210\u529F\u5BFC\u5165 {count} \u4E2A\u4EFB\u52A1\u3002","transfer.importFailed":"\u5BFC\u5165\u5931\u8D25: {error}","transfer.badFile":"\u6240\u9009\u6587\u4EF6\u4E0D\u662F\u6709\u6548\u7684 JSON \u5BFC\u51FA\u6587\u4EF6: {error}","actions.pause":"\u6682\u505C","actions.resume":"\u6062\u590D","actions.settings":"\u901A\u77E5\u4E0E\u6E20\u9053\u8BBE\u7F6E","search.placeholder":"\u641C\u7D22\u5B9A\u65F6\u4EFB\u52A1","filters.title":"\u7B5B\u9009","filters.type":"\u7C7B\u578B","filters.model":"\u6A21\u578B","filters.channel":"\u6E20\u9053","filters.any":"\u5168\u90E8","filters.reset":"\u91CD\u7F6E\u7B5B\u9009","filters.empty":"\u6CA1\u6709\u5339\u914D\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u7684\u4EFB\u52A1\u3002","filters.showing":"\u663E\u793A {shown} / \u5171 {total}","stats.activeTasks":"\u6D3B\u8DC3\u4EFB\u52A1","stats.totalRuns":"\u603B\u8FD0\u884C\u6B21\u6570","stats.totalTokens":"\u6D88\u8017 Token","stats.totalCost":"\u9884\u4F30\u6210\u672C","tabs.all":"\u5168\u90E8","tabs.active":"\u8FD0\u884C\u4E2D","tabs.paused":"\u5DF2\u6682\u505C","tabs.completed":"\u5DF2\u5B8C\u6210","banner.loadError":"\u52A0\u8F7D\u4EFB\u52A1\u5931\u8D25: {error}","banner.retry":"\u91CD\u8BD5","list.loading":"\u6B63\u5728\u52A0\u8F7D\u5B9A\u65F6\u4EFB\u52A1...","list.empty":"\u6682\u65E0\u5B9A\u65F6\u4EFB\u52A1","list.typeShell":"Shell \u811A\u672C","list.typeLlm":"LLM \u667A\u80FD\u4F53","list.oneShot":"\u4E00\u6B21\u6027","list.configManaged":"\u914D\u7F6E\u53EA\u8BFB","list.configManagedHint":"\u7531\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684 config.jobs \u58F0\u660E\uFF1B\u8981\u4FEE\u6539\u6216\u5220\u9664\u8BF7\u7F16\u8F91\u8BE5\u6587\u4EF6","list.next":" \xB7 \u4E0B\u6B21: {time}","recs.title":"\u63A8\u8350\u4EFB\u52A1","recs.hint":"\u5F00\u7BB1\u5373\u7528\u7684\u914D\u65B9\u3002\u70B9\u4E00\u4E0B\u5C31\u4F1A\u628A\u8868\u5355\u586B\u597D\u2014\u2014\u4FDD\u5B58\u4E4B\u524D\u4E0D\u4F1A\u521B\u5EFA\u4EFB\u4F55\u4EFB\u52A1\u3002","modal.editTitle":"\u7F16\u8F91\u4EFB\u52A1","modal.newTitle":"\u65B0\u5EFA\u5B9A\u65F6\u4EFB\u52A1","modal.statusActive":"\u6D3B\u8DC3","modal.statusPaused":"\u5DF2\u6682\u505C","modal.params":"\u914D\u7F6E\u53C2\u6570","modal.history":"\u8FD0\u884C\u5386\u53F2 ({count})","modal.cancel":"\u53D6\u6D88","modal.confirmDiscard":"\u653E\u5F03\u672A\u4FDD\u5B58\u7684\u5185\u5BB9\uFF1F","modal.save":"\u4FDD\u5B58\u4FEE\u6539","modal.create":"\u521B\u5EFA\u4EFB\u52A1","modal.close":"\u5173\u95ED","history.loading":"\u6B63\u5728\u52A0\u8F7D\u5386\u53F2\u8BB0\u5F55...","history.empty":"\u6682\u65E0\u8FD0\u884C\u8BB0\u5F55","history.stoppedReasonTitle":"\u505C\u6B62\u539F\u56E0:","history.retryDelivery":"\u91CD\u8BD5\u63A8\u9001","history.retryingDelivery":"\u6B63\u5728\u91CD\u8BD5...","history.statusValidationFailed":"\u6821\u9A8C\u5931\u8D25","history.stage_queue":"\u6392\u961F","history.stage_preflight":"\u9884\u68C0","history.stage_execution":"\u6267\u884C","history.stage_validation":"\u6821\u9A8C","history.stage_delivery":"\u63A8\u9001","history.refresh":"\u5237\u65B0\u5386\u53F2","history.statusSuccess":"\u6210\u529F","history.statusUncertain":"\u4E0D\u786E\u5B9A","history.artifacts":"\u4EA7\u7269\u6587\u4EF6","history.resolveCompleted":"\u6807\u8BB0\u5DF2\u5B8C\u6210","history.resolveFailed":"\u6807\u8BB0\u5931\u8D25","history.statusUncertainHint":"\u670D\u52A1\u91CD\u542F\u4E2D\u65AD \u2014 \u8BF7\u786E\u8BA4\u7ED3\u679C","history.statusSkipped":"\u5DF2\u8DF3\u8FC7","history.statusMissed":"\u5DF2\u9519\u8FC7","history.statusTimeout":"\u8D85\u65F6","history.statusFailed":"\u5931\u8D25","form.nameLabel":"\u4EFB\u52A1\u540D\u79F0","form.namePlaceholder":"\u4F8B\u5982: dsh-tags-watch","form.typeLabel":"\u6267\u884C\u7C7B\u578B *","form.typeLlm":"LLM\uFF08AI \u667A\u80FD\u4F53\uFF09","form.typeScript":"Shell \u547D\u4EE4 / \u811A\u672C","form.typeNode":"Node.js","form.typePython":"Python","form.typeHttp":"HTTP \u8BF7\u6C42 / Webhook","form.typeSsh":"\u8FDC\u7A0B SSH","form.typeDocker":"Docker \u5BB9\u5668","form.typeSkill":"DSH \u6280\u80FD","form.typeWorkflow":"DSH \u5DE5\u4F5C\u6D41","form.typeDigest":"\u6BCF\u65E5/\u5B9A\u671F\u7B80\u62A5 (Daily Digest)","form.envLabel":"\u73AF\u5883\u53D8\u91CF (KEY=VALUE, \u6BCF\u884C\u4E00\u4E2A)","form.envPlaceholder":"NODE_ENV=production\nTZ=Europe/Berlin","form.envHint":"\u4EC5\u5BF9\u975E LLM \u8FD0\u884C\u65F6\u751F\u6548\u3002\u4E0D\u8981\u5728\u8FD9\u91CC\u5B58\u653E\u5BC6\u94A5\u3002","form.cwdLabel":"\u5DE5\u4F5C\u76EE\u5F55 (\u7EDD\u5BF9\u8DEF\u5F84)","form.workspaceLabel":"\u5DE5\u4F5C\u533A ID \u6216\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09","form.worktreeLabel":"\u5728\u72EC\u7ACB\u7684\u4E34\u65F6 Git Worktree \u4E2D\u6267\u884C","form.keepWorktreeLabel":"\u6267\u884C\u7ED3\u675F\u540E\u4FDD\u7559 Git Worktree (\u4E0D\u81EA\u52A8\u6E05\u7406)","form.httpMethodLabel":"HTTP \u65B9\u6CD5","form.httpUrlLabel":"URL","form.httpHeadersLabel":"\u8BF7\u6C42\u5934\uFF08JSON\uFF0C\u53EF\u9009\uFF09","form.httpBodyLabel":"\u8BF7\u6C42\u4F53\uFF08\u53EF\u9009\uFF09","form.sshProfileLabel":"dsh-remote-workspace \u914D\u7F6E ID","form.sshProfileHint":"\u63A8\u8350\u7528\u6CD5\uFF1A\u4E3B\u673A\u4E0E\u51ED\u636E\u90FD\u653E\u5728 remote-workspace \u63D2\u4EF6\u91CC\u3002","form.sshTargetLabel":"\u5907\u7528\u76EE\u6807\uFF08user@host\uFF0C\u53EF\u9009\uFF09","form.sshKeyLabel":"\u79C1\u94A5\u8DEF\u5F84\uFF08\u5907\u7528\uFF0C\u53EF\u9009\uFF09","form.dockerImageLabel":"\u5BB9\u5668\u955C\u50CF","form.skillNameLabel":"\u6280\u80FD\u540D\u79F0","form.workflowNameLabel":"\u5DE5\u4F5C\u6D41\u540D\u79F0","form.scheduleLabel":"\u8C03\u5EA6\u8BA1\u5212 (Cron \u6216\u76F8\u5BF9\u65F6\u95F4) *","form.schedulePlaceholder":"\u4F8B\u5982: 0 9 * * 1-5 \u6216 15m \u6216 in 2 hours","form.timeoutLabel":"\u8D85\u65F6\u65F6\u95F4 (\u79D2)","form.overlapLabel":"\u5E76\u53D1\u7B56\u7565","form.overlapSkip":"\u8DF3\u8FC7 (\u9ED8\u8BA4)","form.overlapQueue":"\u6392\u961F\u7B49\u5F85","form.overlapReplace":"\u53D6\u6D88\u5F53\u524D\u8FD0\u884C\u5E76\u91CD\u65B0\u5F00\u59CB (replace)","form.kanbanLabel":"\u770B\u677F\u540C\u6B65\u6A21\u5F0F","form.kanbanNone":"\u4E0D\u540C\u6B65\u5230\u770B\u677F","form.kanbanOnFailure":"\u5931\u8D25\u65F6\u521B\u5EFA\u5DE5\u5355\uFF08\u8FDB Backlog\uFF09","form.kanbanAlways":"\u6BCF\u6B21\u5B8C\u6210\u90FD\u5EFA\u5361\u7247\uFF08Done / Backlog\uFF09","form.providerLabel":"LLM \u670D\u52A1\u5546","form.providerDefault":"\u9ED8\u8BA4\uFF08DSH\uFF09","form.modelLabel":"AI \u6A21\u578B","form.modelDefault":"\u9ED8\u8BA4\u6A21\u578B","form.silentRuleLabel":"\u9759\u9ED8\u89C4\u5219 (\u53EF\u9009)","form.silentRulePlaceholder":"\u4F8B\u5982: ALL_OK \u6216 status == 200","form.silentRuleHint":"\u82E5\u8F93\u51FA\u7B26\u5408\u6B64\u89C4\u5219\uFF0C\u5C06\u4E0D\u53D1\u9001\u4EFB\u4F55\u901A\u77E5\u3002","history.silentSkip":"\u4FDD\u6301\u9759\u9ED8:","history.diagnosis":"\u8BCA\u65AD","history.applySuggestion":"\u7528\u8FD9\u6761\u5EFA\u8BAE\u6253\u5F00\u7F16\u8F91\u8868\u5355","form.inspectOnFailureLabel":"\u7528\u6A21\u578B\u8BCA\u65AD\u5931\u8D25\u539F\u56E0","form.inspectOnFailureHint":"\u8FD0\u884C\u5931\u8D25\u540E\uFF0C\u7531\u6A21\u578B\u8BFB\u4E00\u904D\u63D0\u793A\u8BCD\u3001\u9519\u8BEF\u548C\u8F93\u51FA\uFF0C\u628A\u8BCA\u65AD\u7ED3\u8BBA\u548C\u4FEE\u6539\u5EFA\u8BAE\u968F\u8FD9\u6B21\u8FD0\u884C\u4E00\u8D77\u4FDD\u5B58\u3002\u4E0D\u4F1A\u81EA\u52A8\u5E94\u7528\u4EFB\u4F55\u6539\u52A8\u3002","settings.inspectorModelLabel":"\u5931\u8D25\u8BCA\u65AD\u6A21\u578B","form.fallbackModelLabel":"\u5907\u7528\u6A21\u578B (\u4E3B\u6A21\u578B\u5931\u8D25\u65F6\u4F7F\u7528)","form.fallbackModelPlaceholder":"\u4F8B\u5982: deepseek-reasoner","form.fallbackModelHint":"\u4E3B\u6A21\u578B\u8FD0\u884C\u5931\u8D25\u65F6\uFF0C\u7528\u8FD9\u4E2A\u6A21\u578B\u518D\u8BD5\u4E00\u6B21\u3002\u4E24\u6B21\u5C1D\u8BD5\u90FD\u8BA1\u5165\u6210\u672C\u3002","form.promptLabelScript":"Shell \u547D\u4EE4\u6216\u811A\u672C","form.promptLabelLlm":"\u7ED9\u667A\u80FD\u4F53\u7684\u6307\u4EE4 / \u63D0\u793A\u8BCD","form.promptPlaceholderScript":"curl -fsSL https://... || exit 1","form.promptPlaceholderLlm":"\u7CBE\u786E\u63CF\u8FF0\u667A\u80FD\u4F53\u8981\u505A\u4EC0\u4E48...","form.timezoneLabel":"\u65F6\u533A (IANA \u65F6\u533A\u540D)","form.timezonePlaceholder":"\u4F8B\u5982: Asia/Shanghai \u6216 UTC (\u7559\u7A7A\u4F7F\u7528\u670D\u52A1\u5668\u65F6\u533A)","form.misfireLabel":"\u9519\u8FC7\u6267\u884C\u7B56\u7565 (Misfire Policy)","form.misfireSkip":"\u8DF3\u8FC7 (\u9ED8\u8BA4)","form.misfireRunOnce":"\u8865\u8DD1\u4E00\u6B21","form.misfireCatchUp":"\u8FDF\u5230\u65F6\u8865\u8DD1\u4E00\u6B21\u5E76\u8BB0\u5F55\u7F3A\u53E3 (catchUpAll)","form.retriesLabel":"\u5931\u8D25\u81EA\u52A8\u91CD\u8BD5\u6B21\u6570\uFF080 = \u5173\u95ED\uFF09","form.permissionLabel":"\u4F1A\u8BDD\u6743\u9650","form.permissionDefault":"\u9ED8\u8BA4 (\u7EE7\u627F\u4E3B\u914D\u7F6E)","form.permissionReadonly":"\u53EA\u8BFB","form.permissionWrite":"\u5DE5\u4F5C\u533A\u5199\u5165","form.permissionFull":"\u5B8C\u5168\u8BBF\u95EE\u6743\u9650","list.runningNow":"\u6B63\u5728\u8FD0\u884C","history.openSession":"\u6253\u5F00\u4F1A\u8BDD","form.notifyTitle":"Telegram \u901A\u77E5","form.notifyTelegram":"\u628A\u8FD0\u884C\u62A5\u544A\u53D1\u9001\u5230 Telegram","form.notifyOnlyFailure":"\u4EC5\u5931\u8D25\u65F6\u53D1\u9001\uFF08onlyOnFailure / \u6210\u529F\u9759\u9ED8\uFF09","form.channelsTitle":"\u63A8\u9001\u6E20\u9053","form.channelsHint":"\u4EFB\u52A1\u6267\u884C\u5B8C\u6BD5\u540E\u63A8\u9001\u62A5\u544A\u7684\u76EE\u6807\u6E20\u9053\u3002","form.templateLabel":"\u81EA\u5B9A\u4E49\u6D88\u606F\u6A21\u677F","form.templatePlaceholder":"\u23F0 {title} \u2014 {status}\uFF0C\u8017\u65F6 {duration}","form.templateHint":"\u53EF\u7528\u53D8\u91CF: {title} {id} {status} {output} {error} {duration} {schedule} {time} {tokens} {cost} {model}\u3002\u7559\u7A7A\u4F7F\u7528\u5185\u7F6E\u6587\u6848\u3002","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.","form.channelTelegram":"Telegram","form.channelKanban":"dsh-kanban \u5361\u7247","form.channelDiscord":"Discord","form.channelSlack":"Slack","form.channelNtfy":"ntfy","form.channelBark":"Bark","form.channelPushplus":"PushPlus","form.channelTts":"\u8BED\u97F3\uFF08dsh-tts\uFF09","form.channelGitea":"Gitea Issue","settings.deliverySection":"\u63A8\u9001\u6E20\u9053","settings.secretsSection":"\u51ED\u636E\uFF08\u5F15\u7528\uFF09","settings.secretsHint":"\u8FD9\u91CC\u586B DSH \u51ED\u636E\u7684\u300C\u540D\u79F0\u300D\uFF0C\u4E0D\u662F\u5BC6\u94A5\u672C\u8EAB\u3002\u5BC6\u94A5\u4FDD\u5B58\u5728\u51ED\u636E\u670D\u52A1\u91CC\u3002","settings.telegramSection":"Telegram","settings.templatesSection":"\u6D88\u606F\u6A21\u677F","settings.channelTemplateLabel":"{channel} \u7684\u6D88\u606F\u6A21\u677F","settings.botTokenRefLabel":"Bot Token \u51ED\u636E\u540D\u79F0","settings.botTokenRefPlaceholder":"\u4F8B\u5982: TELEGRAM_BOT_TOKEN","settings.apiTokenLabel":"\u5916\u90E8 API Token","settings.apiTokenPlaceholder":"\u7528\u4E8E /dsh-cron/api/* \u7684 Bearer token\uFF08\u7559\u7A7A = \u5173\u95ED\uFF09","settings.discordLabel":"Discord Webhook URL","settings.slackLabel":"Slack Webhook URL","settings.ntfyUrlLabel":"ntfy \u670D\u52A1\u5668\u5730\u5740","settings.ntfyTopicLabel":"ntfy \u4E3B\u9898","settings.ntfyTokenRefLabel":"ntfy Token \u51ED\u636E\u540D\u79F0","settings.barkServerLabel":"Bark \u670D\u52A1\u5668\u5730\u5740","settings.barkKeyLabel":"Bark \u8BBE\u5907 Key","settings.pushplusTokenRefLabel":"PushPlus Token \u51ED\u636E\u540D\u79F0","settings.pushplusUrlLabel":"PushPlus \u63A5\u53E3\u5730\u5740","settings.ttsBaseUrlLabel":"dsh-tts \u670D\u52A1\u5730\u5740","settings.giteaBaseUrlLabel":"Gitea \u670D\u52A1\u5730\u5740","settings.giteaRepoLabel":"Gitea \u4ED3\u5E93\uFF08owner/repo\uFF09","settings.giteaTokenRefLabel":"Gitea Token \u51ED\u636E\u540D\u79F0","settings.templateLabel":"\u9ED8\u8BA4\u6D88\u606F\u6A21\u677F","settings.templateHint":"\u4F5C\u7528\u4E8E\u6240\u6709\u6CA1\u6709\u5355\u72EC\u6A21\u677F\u7684\u6E20\u9053\u3002\u7559\u7A7A\u7528\u5185\u7F6E\u6587\u6848\u3002","settings.deliveryTimeoutMsLabel":"\u6BCF\u4E2A\u6E20\u9053\u7684\u63A8\u9001\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09","settings.automationSection":"\u81EA\u52A8\u5316\u6A21\u578B","settings.automationHint":"\u7528\u4E8E\u9759\u9ED8\u89C4\u5219\u7814\u5224\u548C\u6545\u969C\u8BCA\u65AD\u7684\u8F85\u52A9\u6A21\u578B\u3002\u7559\u7A7A\u6CBF\u7528\u4EFB\u52A1\u81EA\u8EAB\u6A21\u578B\u3002","settings.silentRuleModelLabel":"\u9759\u9ED8\u89C4\u5219\u7814\u5224\u6A21\u578B","settings.secretsOnCard":"\u8BBE\u7F6E\u4E2D\u5F15\u7528\u7684\u51ED\u636E\u5C06\u5728\u524D\u7AEF\u8131\u654F\u5C55\u793A\uFF0C\u5E76\u901A\u8FC7\u540D\u79F0\u5F15\u7528\u3002","form.nextRunLabel":"\u4E0B\u6B21\u6267\u884C: ","form.notScheduled":"\u672A\u5B89\u6392\u8BA1\u5212","settings.loading":"\u6B63\u5728\u52A0\u8F7D\u8BBE\u7F6E...","settings.unavailable":"\u8BBE\u7F6E\u5F53\u524D\u4E0D\u53EF\u7528\u3002","settings.retry":"\u91CD\u8BD5","settings.cardTitle":"\u23F0 \u5B9A\u65F6\u4EFB\u52A1\u8C03\u5EA6\u5668 (Cron)","settings.cardDesc":"\u5B9A\u65F6\u8BA1\u5212\u4EFB\u52A1\uFF08Cron/\u95F4\u9694\uFF09\u3001\u540E\u53F0\u667A\u80FD\u4F53\u573A\u666F\u4EE5\u53CA\u652F\u6301 Telegram\u3001Discord\u3001Slack\u3001ntfy\u3001Bark\u3001PushPlus\u3001\u8BED\u97F3\u548C Gitea \u7684\u901A\u77E5\u63A8\u9001\u3002","settings.openPanel":"\u6253\u5F00\u4EFB\u52A1\u7BA1\u7406\u770B\u677F","settings.modalTitle":"\u901A\u77E5\u4E0E\u6E20\u9053\u8BBE\u7F6E","settings.tokenLabel":"Telegram Bot Token","settings.tokenPlaceholder":"123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ","settings.tokenPlaceholderDefault":"\u4F7F\u7528 DSH \u5168\u5C40\u914D\u7F6E\u7684\u673A\u5668\u4EBA (\u6216\u5728\u6B64\u8F93\u5165\u81EA\u5B9A\u4E49 Token)","settings.defaultHint":"\u2713 \u68C0\u6D4B\u5230 DSH \u73AF\u5883\u5DF2\u914D\u7F6E\u9ED8\u8BA4 Bot","settings.chatIdLabel":"Telegram Chat ID","settings.chatIdPlaceholder":"\u4F8B\u5982: 345678901","settings.kanbanUrlLabel":"Kanban \u670D\u52A1\u57FA\u7840\u5730\u5740","settings.globalNotify":"\u5168\u5C40\u5F00\u542F\u6240\u6709\u4EFB\u52A1\u7ED3\u679C\u63A8\u9001\u81F3 Telegram","settings.globalOnlyFailure":"\u5168\u5C40\u6A21\u5F0F\uFF1A\u4EC5\u5728\u5931\u8D25\u65F6\u63A8\u9001 (\u6210\u529F\u9759\u9ED8)","settings.dynamicCredentials":"\u52A8\u6001\u51ED\u636E\u89E3\u6790 (credential://...)","settings.dynamicCredentialsHint":"\u8FD0\u884C\u65F6\u4ECE\u51ED\u636E\u670D\u52A1\u52A8\u6001\u89E3\u6790 credential://... \u4E14\u4E0D\u6CC4\u9732\u5230\u5B58\u50A8 (#335)","settings.showChatHeaderButton":"\u5728\u804A\u5929\u6807\u9898\u680F\u663E\u793A\u5B9A\u65F6\u4EFB\u52A1\u6309\u94AE","settings.showChatHeaderActions":"\u5728\u804A\u5929\u6807\u9898\u680F\u663E\u793A\u5FEB\u901F\u521B\u5EFA\u64CD\u4F5C","settings.testTelegram":"\u{1F514} \u6D4B\u8BD5 Telegram \u53D1\u9001","settings.testKanban":"\u{1F4CB} \u6D4B\u8BD5 Kanban","settings.sending":"\u6B63\u5728\u53D1\u9001...","settings.checkingKanban":"\u6B63\u5728\u8FDE\u63A5 Kanban...","settings.testOk":"\u2705 \u6D4B\u8BD5\u6D88\u606F\u5DF2\u6210\u529F\u53D1\u9001\u81F3 Telegram\uFF01","settings.testFail":"\u274C \u53D1\u9001\u5931\u8D25: {error}","settings.kanbanOk":"\u2705 Kanban \u5361\u7247\u521B\u5EFA\u6210\u529F","settings.kanbanFail":"\u274C {error}","settings.save":"\u4FDD\u5B58\u8BBE\u7F6E","settings.saved":"\u2713 \u5DF2\u4FDD\u5B58","settings.saveError":"\u4FDD\u5B58\u5931\u8D25: {error}","settings.saveErrorUnknown":"\u672A\u77E5\u9519\u8BEF","updater.title":"\u63D2\u4EF6\u81EA\u66F4\u65B0","updater.btnCheck":"\u68C0\u67E5\u66F4\u65B0","updater.checking":"\u6B63\u5728\u68C0\u67E5...","updater.btnUpdate":"\u5347\u7EA7\u81F3 v{version}","updater.updating":"\u6B63\u5728\u66F4\u65B0...","updater.desc":"\u901A\u8FC7 npm \u4ED3\u5E93\u5728\u7EBF\u68C0\u67E5\u5E76\u5C31\u5730\u5347\u7EA7\u63D2\u4EF6\uFF0C\u65E0\u9700 SSH \u7EC8\u7AEF\u64CD\u4F5C\u3002","updater.current":"\u5F53\u524D\u7248\u672C: v{version}","updater.available":"\u53D1\u73B0\u65B0\u7248\u672C: v{version}","updater.upToDate":"\u5DF2\u662F\u6700\u65B0\u7248\u672C","updater.success":"\u5DF2\u6210\u529F\u5347\u7EA7\u81F3 v{version}\u3002\u8BF7\u91CD\u542F DSH \u6216\u91CD\u8F7D\u914D\u7F6E\u4EE5\u5E94\u7528\u66F4\u65B0\u3002","dsh.modalTitle":"\u8BA9 DSH \u667A\u80FD\u4F53\u521B\u5EFA\u4EFB\u52A1","dsh.descLabel":"\u8BF7\u63CF\u8FF0\u4F60\u7684\u4EFB\u52A1\u76EE\u6807\u548C\u6267\u884C\u9891\u7387:","dsh.placeholder":"\u4F8B\u5982: \u6BCF\u4E24\u5C0F\u65F6\u68C0\u67E5\u4E00\u6B21\u78C1\u76D8\u7A7A\u95F4\u548C\u5931\u8D25\u7684 systemd \u5B88\u62A4\u8FDB\u7A0B\uFF0C\u5E76\u5728\u5F02\u5E38\u65F6\u62A5\u8B66...","dsh.sendHint":"\u6309 Ctrl+Enter \u53D1\u9001","dsh.sendTitle":"\u63D0\u4EA4\u7ED9\u667A\u80FD\u4F53","dsh.startFailed":"\u542F\u52A8\u667A\u80FD\u4F53\u5BF9\u8BDD\u5931\u8D25: {error}","dsh.launchError":"\u6267\u884C\u9519\u8BEF: {error}","confirm.delete":"\u786E\u5B9A\u5220\u9664\u8BE5\u4EFB\u52A1\u5417\uFF1F","list.loadErrorPrefix":"\u52A0\u8F7D\u4EFB\u52A1\u5217\u8868\u5931\u8D25","actions.dryRun":"\u7A7A\u8DD1\u6D4B\u8BD5","actions.dryRunTitle":"\u7A7A\u8DD1\u6D4B\u8BD5\uFF08\u6A21\u62DF\u6267\u884C\uFF0C\u4E0D\u4EA7\u751F\u526F\u4F5C\u7528\u4E14\u4E0D\u53D1\u9001\u901A\u77E5\uFF09","actions.archive":"\u5386\u53F2\u5F52\u6863","actions.archiveTitle":"\u67E5\u770B\u6267\u884C\u5386\u53F2\u4E0E\u65E5\u5FD7\u5F52\u6863","dryRun.title":"\u{1F9EA} \u7A7A\u8DD1\u6A21\u62DF\u7ED3\u679C","dryRun.task":"\u4EFB\u52A1","dryRun.status":"\u6A21\u62DF\u72B6\u6001","dryRun.duration":"\u8017\u65F6","dryRun.output":"\u6A21\u62DF\u8F93\u51FA","dryRun.preflight":"\u9884\u68C0\u7ED3\u679C","dryRun.close":"\u5173\u95ED","archive.title":"\u{1F4DC} \u8FD0\u884C\u5386\u53F2\u5F52\u6863","archive.totalRuns":"\u5171\u8BB0\u5F55 {total} \u6B21\u8FD0\u884C","archive.empty":"\u8BE5\u4EFB\u52A1\u6682\u65E0\u5386\u53F2\u8FD0\u884C\u5F52\u6863\u3002","archive.loadMore":"\u52A0\u8F7D\u66F4\u591A ({shown} / {total})","archive.close":"\u5173\u95ED","form.reliabilityTitle":"\u{1F6E1}\uFE0F \u53EF\u9760\u6027\u3001\u5FC3\u8DF3\u76D1\u542C\u4E0E\u81EA\u6108","form.preflightLabel":"\u9884\u68C0\u5065\u5EB7\u63A2\u6D4B","form.preflightNone":"\u65E0","form.preflightHttp":"HTTP (2xx \u63A2\u6D4B)","form.preflightShell":"Shell \u63A2\u6D4B (\u9000\u51FA\u7801 0)","form.preflightDisk":"\u78C1\u76D8\u7A7A\u95F4\u63A2\u6D4B (\u6302\u8F7D\u70B9:\u6700\u5C0F\u767E\u5206\u6BD4)","form.preflightTargetLabel":"\u9884\u68C0\u76EE\u6807\u53C2\u6570","form.preflightTargetPlaceholder":"https://example.com/healthz \u6216 ls /data \u6216 /:10%","form.heartbeatIntervalLabel":"\u5FC3\u8DF3\u6253\u5361\u65F6\u9650 (\u79D2, 0 = \u7981\u7528)","form.gracePeriodLabel":"\u5FC3\u8DF3\u5BBD\u9650\u671F (\u79D2)","form.priorityLabel":"\u961F\u5217\u4F18\u5148\u7EA7 (1-10\uFF0C\u6570\u503C\u8D8A\u5927\u8D8A\u5148\u6267\u884C)","form.concurrencyGroupLabel":"\u5E76\u53D1\u5206\u7EC4\u540D\u79F0","form.workWindowHoursLabel":"\u8FD0\u884C\u65F6\u95F4\u7A97\u53E3 (workWindow, \u5982 22:00-07:00)","form.workWindowHoursPlaceholder":"\u4F8B\u5982: 22:00-07:00 \u6216 09:00-18:00","form.workWindowPolicyLabel":"\u7A97\u53E3\u5916\u6267\u884C\u7B56\u7565","form.workWindowPolicySkip":"\u8DF3\u8FC7\u672C\u6B21\u6267\u884C (record skipped)","form.workWindowPolicyDefer":"\u5EF6\u8FDF\u81F3\u7A97\u53E3\u5F00\u542F\u65F6\u6267\u884C (defer)","form.timeBoxMinutesLabel":"Timebox \u8FD0\u884C\u4E0A\u9650 (\u5206\u949F, 0 = \u4E0D\u9650\u5236)","form.wakeTriggerTypeLabel":"\u4E8B\u4EF6\u5524\u9192\u89E6\u53D1\u5668 (Wake Triggers)","form.wakeTriggerTypeNone":"\u65E0 (\u4EC5\u5B9A\u65F6/\u95F4\u9694)","form.wakeTriggerTypeFileCount":"\u6587\u4EF6\u6570\u91CF\u9608\u503C (\u6279\u91CF\u89E6\u53D1)","form.wakeTriggerTypeMarkerFile":"\u6807\u8BB0/Flag\u6587\u4EF6\u5230\u8FBE","form.wakeTriggerTypeProcessExit":"\u8FDB\u7A0B\u9000\u51FA\u76D1\u542C (PID / pidfile)","form.wakeTriggerPathLabel":"\u89E6\u53D1\u76EE\u6807\u8DEF\u5F84 (\u76EE\u5F55 / markerPath / pidFile)","form.wakeTriggerPathPlaceholder":"\u4F8B\u5982: incoming/ \u6216 build.ready \u6216 run.pid","form.wakeTriggerMinCountLabel":"\u6700\u5C0F\u6587\u4EF6\u9608\u503C (minCount)","form.wakeTriggerConsumeLabel":"\u89E6\u53D1\u540E\u81EA\u52A8\u5220\u9664\u6807\u8BB0/PID\u6587\u4EF6","form.writeScopesLabel":"\u6587\u4EF6\u5199\u5165\u8303\u56F4\u9501 (writeScopes, \u76F8\u5BF9\u8DEF\u5F84)","form.writeScopesPlaceholder":"\u4F8B\u5982: src/, docs/ (\u963B\u6B62\u4E0E\u540C\u5DE5\u4F5C\u533A\u91CD\u53E0\u4EFB\u52A1\u5E76\u53D1\u6267\u884C)","form.inputHashPathsLabel":"\u8F93\u5165\u6587\u4EF6\u54C8\u5E0C\u53D8\u52A8\u76D1\u63A7 (inputHashPaths)","form.inputHashPathsPlaceholder":"\u4F8B\u5982: src/, package.json (\u65E0\u53D8\u52A8\u65F6\u8DF3\u8FC7\u6267\u884C)","form.skipIfUnchangedLabel":"\u8F93\u5165\u6587\u4EF6\u65E0\u53D8\u52A8\u65F6\u8DF3\u8FC7\u6267\u884C (\u8282\u7701 Token \u4E0E\u9884\u7B97)","form.selfHealingLabel":"\u6545\u969C\u81EA\u6108\u811A\u672C (Shell)","form.selfHealingPlaceholder":"systemctl restart app || true","form.autoDiagnoseLabel":"\u4EFB\u52A1\u5931\u8D25\u65F6\u542F\u7528 AI \u667A\u80FD\u5206\u6790\u8BCA\u65AD","form.agentPresetLabel":"\u667A\u80FD\u4F53\u9884\u8BBE (Agent Preset)","form.agentPresetPlaceholder":"standard (\u7559\u7A7A\u4F7F\u7528\u5168\u5C40\u9ED8\u8BA4\u9884\u8BBE)","form.agentPresetHint":"\u6765\u81EA dsh-agent-presets \u7684\u667A\u80FD\u4F53\u9884\u8BBE\uFF08\u5982 standard, minimal, cordis, ptc\uFF09\uFF0C\u6302\u8F7D\u5DE5\u4F5C\u533A\u5DE5\u5177\u4E0E\u6587\u4EF6\u8BFB\u5199\u80FD\u529B\u3002","form.sessionTitleLabel":"\u4F1A\u8BDD\u6807\u9898\u6A21\u677F (Session Title)","form.sessionTitlePlaceholder":"\u5982 {{date}} \u5E02\u573A\u65E9\u62A5 (\u652F\u6301 {{date}} \u53D8\u91CF)","form.sessionTitleHint":'\u6B64\u4EFB\u52A1\u8FD0\u884C\u751F\u6210\u7684\u4F1A\u8BDD\u6807\u9898\u3002\u652F\u6301 {{date}} (\u5E74-\u6708-\u65E5)\u3002\u7559\u7A7A\u9ED8\u8BA4\u4E3A "<YYYY-MM-DD> <\u4EFB\u52A1\u540D>"\u3002',"form.targetSessionIdLabel":"\u76EE\u6807\u5E38\u9A7B\u4F1A\u8BDD ID (Target Session ID)","form.targetSessionIdPlaceholder":"\u5982 audit-chat \u6216 dev-summary\uFF08\u7559\u7A7A\u4E3A\u5355\u6B21\u9694\u79BB\u8FD0\u884C\uFF09","form.targetSessionIdHint":"\u914D\u7F6E\u540E\u5B9A\u65F6\u4EFB\u52A1\u5C06\u5728\u6B64\u5E38\u9A7B\u4F1A\u8BDD\u4E2D\u6301\u7EED\u4EA4\u4E92\uFF0C\u8DE8\u5468\u671F\u4FDD\u7559\u5386\u53F2\u4E0A\u4E0B\u6587\u5BF9\u8BDD\u8BB0\u5FC6\uFF0C\u4E0D\u518D\u6BCF\u6B21\u65B0\u5EFA\u5B64\u7ACB\u4F1A\u8BDD\u3002","form.targetSessionResetLabel":"\u4E0A\u4E0B\u6587\u8F6E\u8F6C\u7B56\u7565 (Session Rotation)","form.targetSessionResetNever":"\u6C38\u4E0D\u8F6E\u8F6C\uFF08\u5355\u4E00\u4F1A\u8BDD\u6301\u7EED\u7D2F\u79EF\uFF09","form.targetSessionResetDaily":"\u6BCF\u65E5\u8F6E\u8F6C\uFF08\u6BCF\u65E5\u81EA\u52A8\u5F00\u542F\u65B0\u4F1A\u8BDD\uFF09","form.targetSessionResetWeekly":"\u6BCF\u5468\u8F6E\u8F6C\uFF08\u6BCF\u5468\u81EA\u52A8\u5F00\u542F\u65B0\u4F1A\u8BDD\uFF09","form.targetSessionResetHint":"\u81EA\u52A8\u6309\u5468\u671F\u52A0\u6CE8\u65E5\u671F\u540E\u7F00\u8F6E\u8F6C\u4F1A\u8BDD\uFF0C\u6709\u6548\u9632\u6B62\u957F\u65F6\u95F4\u8FD0\u884C\u5BFC\u81F4\u7684\u6A21\u578B\u4E0A\u4E0B\u6587\u7A97\u53E3\u8D85\u9650\u4E0E Token \u6D6A\u8D39\u3002","form.requireApprovalLabel":"\u6267\u884C\u524D\u9700\u4EBA\u5DE5\u786E\u8BA4\u5BA1\u6279","form.requireApprovalHint":"\u5F00\u542F\u540E\uFF0C\u4EFB\u52A1\u6267\u884C\u524D\u5C06\u6302\u8D77\u5E76\u7B49\u5F85\u6388\u6743\u7528\u6237\u6279\u51C6\u63D0\u8BAE (#318)\u3002","actions.approve":"\u6279\u51C6","actions.reject":"\u62D2\u7EDD","approval.waiting":"\u7B49\u5F85\u4EBA\u5DE5\u5BA1\u6279","approval.approved":"\u5DF2\u6279\u51C6","approval.rejected":"\u5DF2\u62D2\u7EDD","chainGraph.modalTitle":"\u4EFB\u52A1\u94FE\u4E0E\u68C0\u67E5\u70B9\u4F9D\u8D56\u56FE","chainGraph.viewGraph":"\u4EFB\u52A1\u94FE\u56FE","chainGraph.noNodes":"\u672A\u627E\u5230\u8BE5\u4EFB\u52A1\u6216\u8FD0\u884C\u7684\u5173\u8054\u6B65\u9AA4\u3002","chainGraph.retryStep":"\u91CD\u8BD5\u6B64\u6B65\u9AA4","chainGraph.stepSuccess":"\u6210\u529F","chainGraph.stepFailed":"\u5931\u8D25","chainGraph.stepPending":"\u7B49\u5F85\u4E2D","chainGraph.close":"\u5173\u95ED","chainGraph.decisionNode":"\u6761\u4EF6\u51B3\u7B56\u8282\u70B9","chainGraph.stepSkipped":"\u5DF2\u8DF3\u8FC7","history.doctorDiagnosis":"Doctor \u8BCA\u65AD\u4E0E\u5EFA\u8BAE\u4FEE\u590D","history.doctorApply":"\u4E00\u952E\u5E94\u7528\u4FEE\u590D","history.doctorRevert":"\u6062\u590D\u4E0A\u4E00\u7248\u672C\u4EE3\u7801","history.autoHealed":"\u5DF2\u7531 Doctor \u81EA\u52A8\u4FEE\u590D","form.autoHealLabel":"\u81EA\u4E3B Self-Healing Doctor \u81EA\u52A8\u4FEE\u590D","form.autoHealHint":"\u5F53\u4EFB\u52A1\u5931\u8D25\u65F6\u81EA\u52A8\u8BCA\u65AD\u5E76\u5B89\u5168\u4FEE\u590D\uFF08\u6BCF\u5929\u4E0A\u9650 1 \u6B21\uFF09","form.elseTaskLabel":"\u9ED8\u8BA4\u540E\u5907\u4EFB\u52A1 (elseTask)","form.elseTaskHint":"\u5F53\u6CA1\u6709\u5206\u652F\u6761\u4EF6\u5339\u914D\u65F6\u89E6\u53D1\u7684\u76EE\u6807\u4EFB\u52A1","form.elseTaskPlaceholder":"\u5982 task-fallback","adaptive.badge":"\u81EA\u9002\u5E94","adaptive.idle":"\u7A7A\u95F2","adaptive.backoff":"\u907F\u8BA9\u4E2D","form.adaptiveEnabled":"\u81EA\u9002\u5E94\u8F6E\u8BE2 (Adaptive Polling)","form.adaptiveHint":"\u6570\u636E\u65E0\u53D8\u5316\u65F6\u6307\u6570\u7EA7\u5EF6\u957F\u6267\u884C\u95F4\u9694","liveLog.modalTitle":"\u5B9E\u65F6\u4EFB\u52A1\u6267\u884C\u65E5\u5FD7\u6D41","liveLog.viewLog":"\u5B9E\u65F6\u65E5\u5FD7","liveLog.autoScroll":"\u81EA\u52A8\u6EDA\u52A8","liveLog.connecting":"\u6B63\u5728\u8FDE\u63A5\u65E5\u5FD7\u6D41...","liveLog.waiting":"\u7B49\u5F85\u8FD0\u884C\u5668\u8F93\u51FA...","liveLog.completed":"\u65E5\u5FD7\u6D41\u5DF2\u7ED3\u675F","liveLog.close":"\u5173\u95ED\u65E5\u5FD7\u6D41","timeline.modalTitle":"24\u5C0F\u65F6\u8C03\u5EA6\u65F6\u95F4\u7EBF","timeline.buttonLabel":"\u65F6\u95F4\u7EBF","timeline.buttonTitle":"\u67E5\u770B24\u5C0F\u65F6\u9884\u6D4B\u4EFB\u52A1\u8C03\u5EA6\u4E0E\u5E76\u53D1\u65F6\u95F4\u7EBF","timeline.tabTimeline":"\u8C03\u5EA6\u65F6\u95F4\u7EBF","timeline.legendDesc":"\u672A\u676524\u5C0F\u65F6\u5404\u65F6\u6BB5\u4EFB\u52A1\u9884\u8BA1\u6267\u884C\u5206\u5E03\uFF1A","timeline.peakWarning":"\u5E76\u53D1\u5CF0\u503C\u9884\u8B66","heatmap.modalTitle":"\u6210\u672C\u4E0EToken\u6D88\u8017\u70ED\u529B\u56FE","heatmap.buttonLabel":"\u70ED\u529B\u56FE","heatmap.tabHeatmap":"\u6210\u672C\u70ED\u529B\u56FE","heatmap.matrixDesc":"\u6BCF\u5468\u5404\u65F6\u6BB5\u6210\u672C\u5206\u5E03\u77E9\u9635\uFF087\u5929 \xD7 24\u5C0F\u65F6\uFF09\uFF1A","digest.modalTitle":"\u81EA\u52A8\u5316\u4E0E\u6210\u672C\u5206\u6790\u6458\u8981","digest.buttonLabel":"\u5206\u6790\u6458\u8981","digest.buttonTitle":"\u67E5\u770B 7 \u5929\u6216 30 \u5929\u8FD0\u884C\u7EDF\u8BA1\u4E0E\u82B1\u8D39\u6458\u8981","digest.period7":"\u6700\u8FD1 7 \u5929","digest.period30":"\u6700\u8FD1 30 \u5929","digest.executions":"\u6267\u884C\u6B21\u6570","digest.tokens":"Token \u6D88\u8017","digest.cost":"\u82B1\u8D39 (USD)","digest.fleet":"\u4EFB\u52A1\u603B\u89C8","digest.unstableTitle":"\u6700\u4E0D\u7A33\u5B9A\u4EFB\u52A1\u6392\u884C","digest.expensiveTitle":"\u8D44\u6E90\u6D88\u8017\u6392\u884C","digest.sendTelegram":"\u53D1\u9001\u81F3 Telegram","digest.copyMarkdown":"\u590D\u5236 Markdown","digest.copied":"\u5DF2\u590D\u5236!","digest.sentSuccess":"\u5DF2\u6210\u529F\u53D1\u9001\u81F3 Telegram!","prompt.version":"\u63D0\u793A\u8BCD\u7248\u672C","prompt.rollback":"\u56DE\u9000\u81F3 v","prompt.history":"\u63D0\u793A\u8BCD\u5386\u53F2","prompt.successRate":"\u6210\u529F\u7387","form.chainingTitle":"\u4EFB\u52A1\u94FE\u4E0E DAG \u7F16\u6392","form.onSuccessLabel":"\u6210\u529F\u540E\u89E6\u53D1 (\u4EFB\u52A1 ID)","form.onSuccessHint":"\u6210\u529F\u540E\u5E76\u53D1\u89E6\u53D1\u7684\u4EFB\u52A1 ID\uFF0C\u9017\u53F7\u5206\u9694 (Fan-Out)","form.onFailureLabel":"\u5931\u8D25\u540E\u89E6\u53D1 (\u4EFB\u52A1 ID)","form.onFailureHint":"\u5931\u8D25\u540E\u89E6\u53D1\u7684\u4EFB\u52A1 ID\uFF0C\u9017\u53F7\u5206\u9694","form.dependsOnLabel":"\u4F9D\u8D56\u4EFB\u52A1 (dependsOn)","form.dependsOnHint":"\u6267\u884C\u524D\u9700\u7B49\u5F85\u7684\u524D\u7F6E\u4EFB\u52A1 ID\uFF0C\u9017\u53F7\u5206\u9694 (Fan-In)","form.joinPolicyLabel":"\u5408\u5E76\u7B56\u7565","form.joinPolicyAll":"\u6240\u6709\u524D\u7F6E\u5747\u6210\u529F (all_success)","form.joinPolicyAny":"\u4EFB\u4E00\u524D\u7F6E\u6210\u529F\u5373\u53EF (any_success)","recipe.dependenciesMissing":"\u7F3A\u5C11\u5FC5\u8981\u96C6\u6210\u670D\u52A1\u6216\u51ED\u636E","form.previewSchedule":"\u9884\u6D4B\u4E0B\u6B21\u8FD0\u884C\u65F6\u95F4","form.previewScheduleTitle":"\u672A\u6765 5 \u6B21\u8BA1\u5212\u8FD0\u884C\u65F6\u95F4:"}};let translate=(key,vars)=>{let s=STRINGS.en&&STRINGS.en[key]||key;if(vars){for(const k of Object.keys(vars)){s=s.split("{"+k+"}").join(String(vars[k]))}}return s};const T=(key,vars)=>translate(key,vars);const STYLE_ID="dsh-cron-styles";const CSS_HREF="/dsh-cron/client.css";function ensureStyles(){if(typeof document==="undefined")return null;let el=document.getElementById(STYLE_ID);if(el===null){const head=document.head||document.documentElement;if(!head)return null;el=document.createElement("link");el.id=STYLE_ID;el.rel="stylesheet";el.href=CSS_HREF;el.dataset.dshPlugin="dsh-cron";head.appendChild(el);return el}if(el.getAttribute("href")!==CSS_HREF){el.setAttribute("href",CSS_HREF);el.href=CSS_HREF}return el}const STYLE_HEAL_KEY="__dshCronStyleHeal";const STYLE_HEAL_INTERVAL_MS=2e3;function startStyleSelfHeal(){if(typeof document==="undefined")return()=>{};if(typeof window!=="undefined"&&typeof window[STYLE_HEAL_KEY]==="function"){try{window[STYLE_HEAL_KEY]()}catch(_err){void _err}}const heal=()=>{try{ensureStyles()}catch(_err){void _err}};heal();let observer=null;try{if(typeof MutationObserver==="function"){observer=new MutationObserver(heal);if(document.head)observer.observe(document.head,{childList:true});if(document.documentElement)observer.observe(document.documentElement,{childList:true})}}catch(_err){observer=null}let timer=null;try{timer=setInterval(heal,STYLE_HEAL_INTERVAL_MS)}catch(_err){timer=null}const onVisibility=()=>{if(document.visibilityState!=="hidden")heal()};try{document.addEventListener("visibilitychange",onVisibility)}catch(_err){void _err}const stop=()=>{try{if(observer)observer.disconnect()}catch(_err){void _err}try{if(timer!==null)clearInterval(timer)}catch(_err){void _err}try{document.removeEventListener("visibilitychange",onVisibility)}catch(_err){void _err}if(typeof window!=="undefined"&&window[STYLE_HEAL_KEY]===stop)window[STYLE_HEAL_KEY]=void 0};if(typeof window!=="undefined")window[STYLE_HEAL_KEY]=stop;return stop}function createErrorBoundary(){if(!React||typeof React.Component!=="function"){return function NoopBoundary(props){return props&&props.children||null}}return class ErrorBoundary extends React.Component{constructor(props){super(props);this.state={hasError:false,error:null}}static getDerivedStateFromError(error){return{hasError:true,error}}componentDidCatch(error,errorInfo){console.error("[dsh-cron] React error:",error,errorInfo)}render(){if(this.state.hasError){return _h("div",{className:"dsh-cron-status-banner","data-type":"error",style:{margin:"12px 0"}},_h("div",{style:{fontWeight:600,marginBottom:"6px"}},"\u26A0\uFE0F Cron UI error:"),_h("div",{style:{fontSize:"12px",wordBreak:"break-all"}},String(this.state.error&&this.state.error.message||this.state.error)),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{marginTop:"10px",fontSize:"12px",padding:"4px 10px"},onClick:()=>this.setState({hasError:false,error:null})},"Retry"))}return this.props&&this.props.children||null}}}const ErrorBoundary=createErrorBoundary();const AGENT_FORM_TYPES=["llm","skill","workflow"];const CODE_FORM_TYPES=["script","node","python","ssh","docker"];const DELIVERY_CHANNELS=["feishu","telegram","kanban","discord","slack","ntfy","bark","pushplus","tts","gitea"];const CHANNEL_LABEL_KEYS={feishu:"form.channelFeishu",telegram:"form.channelTelegram",kanban:"form.channelKanban",discord:"form.channelDiscord",slack:"form.channelSlack",ntfy:"form.channelNtfy",bark:"form.channelBark",pushplus:"form.channelPushplus",tts:"form.channelTts",gitea:"form.channelGitea"};const DELIVERY_SETTING_FIELDS=[{key:"botTokenRef",labelKey:"settings.botTokenRefLabel",placeholderKey:"settings.botTokenRefPlaceholder",group:"secrets"},{key:"ntfyTokenRef",labelKey:"settings.ntfyTokenRefLabel",group:"secrets"},{key:"pushplusTokenRef",labelKey:"settings.pushplusTokenRefLabel",group:"secrets"},{key:"giteaTokenRef",labelKey:"settings.giteaTokenRefLabel",group:"secrets"},{key:"apiToken",labelKey:"settings.apiTokenLabel",placeholderKey:"settings.apiTokenPlaceholder",group:"secrets"},{key:"discordWebhookUrl",labelKey:"settings.discordLabel",group:"channels"},{key:"slackWebhookUrl",labelKey:"settings.slackLabel",group:"channels"},{key:"ntfyUrl",labelKey:"settings.ntfyUrlLabel",group:"channels"},{key:"ntfyTopic",labelKey:"settings.ntfyTopicLabel",group:"channels"},{key:"barkServerUrl",labelKey:"settings.barkServerLabel",group:"channels"},{key:"barkKey",labelKey:"settings.barkKeyLabel",group:"channels"},{key:"pushplusUrl",labelKey:"settings.pushplusUrlLabel",group:"channels"},{key:"ttsBaseUrl",labelKey:"settings.ttsBaseUrlLabel",group:"channels"},{key:"giteaBaseUrl",labelKey:"settings.giteaBaseUrlLabel",group:"channels"},{key:"giteaRepo",labelKey:"settings.giteaRepoLabel",group:"channels"},{key:"deliveryTimeoutMs",labelKey:"settings.deliveryTimeoutMsLabel",group:"channels",numeric:true,defaultValue:15e3,min:1e3},{key:"silentRuleModel",labelKey:"settings.silentRuleModelLabel",group:"automation"},{key:"inspectorModel",labelKey:"settings.inspectorModelLabel",group:"automation"}];const DELIVERY_SETTING_KEYS=DELIVERY_SETTING_FIELDS.map(f=>f.key);const TEMPLATE_SETTING_KEYS=["template","channelTemplates"];function parseEnvText(text){const env={};for(const rawLine of String(text||"").split("\n")){const line=rawLine.trim();if(!line||line.startsWith("#"))continue;const idx=line.indexOf("=");if(idx<=0)continue;const key=line.slice(0,idx).trim();const value=line.slice(idx+1).trim();if(key)env[key]=value}return Object.keys(env).length?env:void 0}function formatEnvText(env){if(!env||typeof env!=="object")return"";return Object.entries(env).map(([k,v])=>`${k}=${v}`).join("\n")}function shouldDismissPanel(target){if(target===null||target===void 0)return false;if(typeof target.closest!=="function")return false;return target.closest(PANEL_OWNED_SELECTOR)===null}function resolveSidebarAnchor(){if(typeof document==="undefined")return null;const marker=document.querySelector("["+ENTRY_ATTR+"]");if(!marker)return null;return marker.closest('div[class*="panelEntry"]')||marker.closest("button")||marker.parentElement||marker}function sidebarJobsSeatIsCurrent(state,entry){const root=state&&state.root;const anchor=entry&&typeof entry.closest==="function"?entry.closest('div[class*="panelEntry"]')||entry.closest("button")||entry.parentElement||entry:entry;return root!==void 0&&root.isConnected&&anchor!==null&&root.previousElementSibling===anchor}function createToggle(){let open=false;const listeners=new Set;return{isOpen:()=>open,set:v=>{const next=!!v;if(open===next){for(const fn of listeners)fn(open);return}open=next;for(const fn of listeners)fn(open)},toggle:()=>{open=!open;for(const fn of listeners)fn(open)},subscribe:fn=>{listeners.add(fn);return()=>listeners.delete(fn)}}}function optionalService(ctx,name){try{if(ctx&&typeof ctx.get==="function")return ctx.get(name)}catch(err){void err}return void 0}async function openSession(ctx,sessionId){if(!sessionId)return false;const getSessions=()=>ctx&&typeof ctx.get==="function"?ctx.get("sessions"):ctx&&ctx.sessions;let sessions=getSessions();if(sessions&&typeof sessions.open==="function"){try{sessions.open(sessionId);return true}catch(err){void err}}if(sessions&&typeof sessions.refresh==="function"){try{await sessions.refresh();sessions.open(sessionId);return true}catch(err){void err}}for(let i=0;i<15;i++){await new Promise(resolve=>setTimeout(resolve,120));sessions=getSessions();if(sessions&&typeof sessions.open==="function"){try{sessions.open(sessionId);return true}catch(err){void err}}if(typeof document!=="undefined"){const domItem=document.querySelector('[data-session-id="'+sessionId+'"], [role="treeitem"][data-id="'+sessionId+'"], [data-id="'+sessionId+'"]');if(domItem){domItem.click();return true}}}console.warn("[dsh-cron] could not open session in workspace:",sessionId);return false}function statusLabel(t,status){if(status==="success")return T_KEY(t,"history.statusSuccess");if(status==="validation_failed")return T_KEY(t,"history.statusValidationFailed");if(status==="skipped")return T_KEY(t,"history.statusSkipped");if(status==="missed")return T_KEY(t,"history.statusMissed");if(status==="timeout")return T_KEY(t,"history.statusTimeout");if(status==="uncertain")return T_KEY(t,"history.statusUncertain");return T_KEY(t,"history.statusFailed")}function isConfigManaged(task){return Boolean(task)&&task.managedBy==="config"}function T_KEY(t,key,vars){return(typeof t==="function"?t:translate)(key,vars)}const fetchWithTimeout=async(url,options={},timeoutMs=15e3)=>{const controller=typeof AbortController!=="undefined"?new AbortController:null;const timer=controller?setTimeout(()=>controller.abort(),timeoutMs):null;if(options&&options.signal&&controller){if(options.signal.aborted){controller.abort()}else{options.signal.addEventListener("abort",()=>controller.abort(),{once:true})}}try{const res=await fetch(url,{credentials:"same-origin",...options,signal:controller?controller.signal:options?options.signal:void 0});return res}catch(err){if(err&&(err.name==="AbortError"||controller?.signal?.aborted)){const timeoutErr=new Error(`Request timed out after ${Math.round(timeoutMs/1e3)}s`);timeoutErr.isTimeout=true;throw timeoutErr}throw err}finally{if(timer)clearTimeout(timer)}};const fetchJsonWithTimeout=async(url,options={},timeoutMs=15e3)=>{const res=await fetchWithTimeout(url,options,timeoutMs);let data={};try{data=await res.json()}catch(jsonErr){if(jsonErr&&jsonErr.name==="AbortError"){throw jsonErr}}return{res,data}};const HEADER_SETTINGS_STORAGE_KEY="dsh-cron:header-settings";let currentHeaderSettings=(function initHeaderSettings(){try{if(typeof window!=="undefined"&&window.localStorage){const raw=window.localStorage.getItem(HEADER_SETTINGS_STORAGE_KEY);if(raw){const parsed=JSON.parse(raw);return{showChatHeaderButton:parsed.showChatHeaderButton!==false,showChatHeaderActions:parsed.showChatHeaderActions!==false}}}}catch(_e){void _e}return{showChatHeaderButton:true,showChatHeaderActions:true}})();const headerSettingsListeners=new Set;function updateHeaderSettings(patch){if(!patch||typeof patch!=="object")return currentHeaderSettings;let changed=false;const next=Object.assign({},currentHeaderSettings);if(patch.showChatHeaderButton!==void 0){const val=Boolean(patch.showChatHeaderButton);if(next.showChatHeaderButton!==val){next.showChatHeaderButton=val;changed=true}}if(patch.showChatHeaderActions!==void 0){const val=Boolean(patch.showChatHeaderActions);if(next.showChatHeaderActions!==val){next.showChatHeaderActions=val;changed=true}}if(changed){currentHeaderSettings=next;try{if(typeof window!=="undefined"&&window.localStorage){window.localStorage.setItem(HEADER_SETTINGS_STORAGE_KEY,JSON.stringify(next))}}catch(_e){void _e}for(const fn of headerSettingsListeners){try{fn(currentHeaderSettings)}catch(_err){void _err}}}return currentHeaderSettings}let headerSettingsSynced=false;let headerSettingsSyncing=null;function syncHeaderSettingsFromServer(){if(headerSettingsSyncing)return headerSettingsSyncing;headerSettingsSyncing=fetchJsonWithTimeout("/dsh-cron/settings").then(({data})=>{headerSettingsSynced=true;if(data&&data.ok&&data.settings){updateHeaderSettings({showChatHeaderButton:data.settings.showChatHeaderButton!==false,showChatHeaderActions:data.settings.showChatHeaderActions!==false})}}).catch(_err=>{void _err}).finally(()=>{headerSettingsSyncing=null});return headerSettingsSyncing}function useHeaderVisibility(key){if(typeof React==="undefined"||typeof React.useState!=="function"){return Boolean(currentHeaderSettings[key]!==false)}const[visible,setVisible]=React.useState(Boolean(currentHeaderSettings[key]!==false));if(typeof React.useEffect==="function"){React.useEffect(()=>{if(!headerSettingsSynced){syncHeaderSettingsFromServer()}const listener=newSettings=>{setVisible(Boolean(newSettings[key]!==false))};headerSettingsListeners.add(listener);return()=>{headerSettingsListeners.delete(listener)}},[key])}return visible}function pickDeliverySettings(source){const out={};for(const key of DELIVERY_SETTING_KEYS.concat(TEMPLATE_SETTING_KEYS)){if(source&&source[key]!==void 0&&source[key]!==null)out[key]=source[key]}if(out.channelTemplates&&typeof out.channelTemplates==="object"){out.channelTemplates=Object.assign({},out.channelTemplates)}return out}function renderDeliverySettings({T:T2,values,onChange,onChannelTemplate,sections,onToggleSection}){const val=key=>values[key]===void 0||values[key]===null?"":String(values[key]);const field=f=>_h("div",{className:"dsh-cron-form-group",key:f.key,style:{marginBottom:"10px"}},_h("label",null,T2(f.labelKey)),_h("input",f.numeric?{type:"number",min:f.min!==void 0?f.min:1e3,step:1e3,value:val(f.key),placeholder:String(f.defaultValue!==void 0?f.defaultValue:15e3),onChange:e=>onChange(f.key,e.target.value===""?f.defaultValue!==void 0?f.defaultValue:15e3:Number(e.target.value))}:{type:"text",value:val(f.key),placeholder:f.placeholderKey?T2(f.placeholderKey):"",onChange:e=>onChange(f.key,e.target.value)}));const section=(key,titleKey,children)=>{const open=Boolean(sections[key]);return _h("div",{className:"dsh-cron-section",key},_h("button",{type:"button",className:"dsh-cron-section-head","aria-expanded":open?"true":"false",onClick:()=>onToggleSection(key)},_h("span",null,T2(titleKey)),_h("span",{className:"dsh-cron-section-chevron","data-open":open?"true":"false"},"\u25BE")),open&&_h("div",{className:"dsh-cron-section-body"},children))};return[section("secrets","settings.secretsSection",[_h("div",{className:"dsh-cron-hint",key:"hint",style:{marginBottom:"10px"}},T2("settings.secretsHint")),...DELIVERY_SETTING_FIELDS.filter(f=>f.group==="secrets").map(field)]),section("channels","settings.deliverySection",[_h("div",{className:"dsh-cron-form-row",key:"row"},...DELIVERY_SETTING_FIELDS.filter(f=>f.group==="channels").map(field))]),section("automation","settings.automationSection",[_h("div",{className:"dsh-cron-hint",key:"hint",style:{marginBottom:"10px"}},T2("settings.automationHint")),_h("div",{className:"dsh-cron-form-row",key:"row"},...DELIVERY_SETTING_FIELDS.filter(f=>f.group==="automation").map(field))]),section("templates","settings.templatesSection",[_h("div",{className:"dsh-cron-form-group",key:"global",style:{marginBottom:"10px"}},_h("label",null,T2("settings.templateLabel")),_h("input",{type:"text",value:val("template"),onChange:e=>onChange("template",e.target.value)}),_h("div",{className:"dsh-cron-hint"},T2("settings.templateHint"))),_h("div",{className:"dsh-cron-form-row",key:"perchannel"},...DELIVERY_CHANNELS.map(id=>_h("div",{className:"dsh-cron-form-group",key:id,style:{marginBottom:"10px"}},_h("label",null,T2("settings.channelTemplateLabel",{channel:T2(CHANNEL_LABEL_KEYS[id])})),_h("input",{type:"text",value:values.channelTemplates&&values.channelTemplates[id]||"",onChange:e=>onChannelTemplate(id,e.target.value)}))))])]}function parseChainTargets(raw){if(!raw)return[];if(Array.isArray(raw))return raw.filter(x=>typeof x==="string"&&x.trim().length>0);if(typeof raw==="string")return raw.split(",").map(s=>s.trim()).filter(s=>s.length>0);return[]}const sanitizeDependsOn=parseChainTargets;const sanitizeJoinPolicy=raw=>raw==="any_success"?"any_success":"all_success";function buildTaskGraphModel(tasks=[],snapshots=[],focusTaskId=null){const taskMap=new Map;for(const t of tasks)if(t?.id)taskMap.set(t.id,t);const snapMap=new Map;for(const s of snapshots)if(s?.stepTaskId)snapMap.set(s.stepTaskId,s);const nodes=[],edges=[];let hasFailure=false;for(const[id,task]of taskMap.entries()){const snap=snapMap.get(id);let nodeStatus="pending",durationMs=0,outputSnippet="",retryCount=0;if(snap){nodeStatus=snap.status==="completed"||snap.status==="success"?"success":"failed";durationMs=snap.durationMs||0;retryCount=snap.retryCount||0;if(snap.output)outputSnippet=String(snap.output).slice(0,200);if(nodeStatus==="failed")hasFailure=true}else if(task.status==="running"){nodeStatus="running"}const deps=sanitizeDependsOn(task.dependsOn);const hasBranches=Array.isArray(task.branchRules)&&task.branchRules.length>0;nodes.push({id,title:task.title||id,type:task.type||"prompt",status:nodeStatus,durationMs,retryCount,outputSnippet,isFocus:Boolean(focusTaskId&&id===focusTaskId),isRetryable:nodeStatus==="failed",isDecisionNode:hasBranches,branchRulesCount:hasBranches?task.branchRules.length:0,elseTask:task.elseTask||null,dependsOn:deps,joinPolicy:sanitizeJoinPolicy(task.joinPolicy)});for(const d of deps)edges.push({from:d,to:id,type:"dependsOn",label:task.joinPolicy==="any_success"?"join:any":"join:all"});if(hasBranches){for(const rule of task.branchRules){if(rule&&rule.targetTask){edges.push({from:id,to:String(rule.targetTask).trim(),type:"branch",label:rule.label||("[if: "+rule.field+" "+rule.operator+" "+(rule.value!=null?rule.value:"")+"]").trim(),condition:{field:rule.field,operator:rule.operator,value:rule.value}})}}}if(task.elseTask){edges.push({from:id,to:String(task.elseTask).trim(),type:"branch_else",label:"[else]",isElse:true})}if(!hasBranches){for(const t of parseChainTargets(task.onSuccess))edges.push({from:id,to:t,type:"onSuccess",label:"onSuccess"})}for(const f of parseChainTargets(task.onFailure))edges.push({from:id,to:f,type:"onFailure",label:"onFailure"})}return{nodes,edges,hasFailure}}function renderChainGraphModal({isOpen,onClose,data,loading,onRetry,t}){if(!isOpen)return null;const graph=data?.graph||{nodes:[],edges:[],hasFailure:false};const chainRunId=data?.chainRunId||"";const nodes=graph.nodes||[];return _h("div",{className:"dsh-cron-modal-overlay",onClick:onClose},_h("div",{className:"dsh-cron-modal",style:{maxWidth:"820px",width:"92vw",maxHeight:"88vh",display:"flex",flexDirection:"column"},role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{className:"dsh-cron-modal-head",style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid var(--dsw-alias-border-l2)",paddingBottom:"12px"}},_h("div",null,_h("div",{className:"dsh-cron-modal-title",style:{margin:0,display:"flex",alignItems:"center",gap:"8px"}},_h("span",{style:{fontSize:"18px"}},"\u{1F578}\uFE0F"),T_KEY(t,"chainGraph.modalTitle")),chainRunId&&_h("div",{style:{fontSize:"11px",color:"var(--dsw-alias-label-secondary, #888)",marginTop:"4px",fontFamily:"monospace"}},"Run ID: "+chainRunId)),_h("button",{type:"button",className:"dsh-cron-icon-btn",onClick:onClose},"\u2715")),_h("div",{style:{flex:1,overflowY:"auto",padding:"16px 0",minHeight:"260px"}},loading&&_h("div",{className:"dsh-cron-history-empty"},T_KEY(t,"history.loading")),!loading&&nodes.length===0&&_h("div",{className:"dsh-cron-history-empty"},T_KEY(t,"chainGraph.noNodes")),!loading&&nodes.length>0&&_h("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},_h("div",{style:{display:"flex",gap:"12px",fontSize:"11px",color:"var(--dsw-alias-label-secondary, #888)",padding:"0 4px"}},_h("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"}},_h("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--dsh-cron-success)"}}),T_KEY(t,"chainGraph.stepSuccess")),_h("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"}},_h("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--dsh-cron-danger)"}}),T_KEY(t,"chainGraph.stepFailed")),_h("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"}},_h("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--dsw-alias-label-tertiary, #888)"}}),T_KEY(t,"chainGraph.stepPending"))),_h("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px",alignItems:"stretch",background:"var(--dsw-alias-bg-layer-2)",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"8px",padding:"16px"}},nodes.map((n,idx)=>{const isOk=n.status==="success";const isFailed=n.status==="failed";const borderColor=isOk?"var(--dsh-cron-success)":isFailed?"var(--dsh-cron-danger)":"var(--dsw-alias-border-l2)";return _h("div",{key:n.id||idx,style:{flex:"1 1 220px",maxWidth:"260px",background:"var(--dsw-alias-bg-layer-1)",border:"1px solid "+borderColor,borderRadius:"6px",padding:"12px",display:"flex",flexDirection:"column",gap:"8px",boxShadow:isFailed?"0 0 0 1px var(--dsh-cron-danger)":"none"}},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"6px"}},_h("div",{style:{fontWeight:"600",fontSize:"13px",color:"var(--dsw-alias-label-primary)"}},n.title||n.id),_h("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"10px",fontWeight:"600",background:isOk?"var(--dsh-cron-success-bg)":isFailed?"var(--dsh-cron-danger-bg)":"var(--dsw-alias-bg-layer-3)",color:isOk?"var(--dsh-cron-success)":isFailed?"var(--dsh-cron-danger)":"var(--dsw-alias-label-secondary)"}},isOk?"\u2713 "+T_KEY(t,"chainGraph.stepSuccess"):isFailed?"\u2717 "+T_KEY(t,"chainGraph.stepFailed"):"\u23F3 "+T_KEY(t,"chainGraph.stepPending"))),_h("div",{style:{fontSize:"11px",color:"var(--dsw-alias-label-secondary)",display:"flex",gap:"8px",flexWrap:"wrap"}},n.durationMs>0&&_h("span",null,n.durationMs+"ms"),n.retryCount>0&&_h("span",{style:{color:"var(--dsh-cron-warning)"}},"\u21BB "+n.retryCount),n.joinPolicy&&n.dependsOn?.length>0&&_h("span",{style:{background:"var(--dsw-alias-bg-layer-3)",padding:"1px 4px",borderRadius:"4px"}},n.joinPolicy==="any_success"?"join:any":"join:all")),n.isDecisionNode&&_h("div",{style:{fontSize:"11px",color:"var(--dsh-cron-warning)",fontWeight:"600",display:"flex",alignItems:"center",gap:"4px"}},"\u{1F500} "+T_KEY(t,"chainGraph.decisionNode")+" ("+n.branchRulesCount+")"),n.dependsOn?.length>0&&_h("div",{style:{fontSize:"11px",color:"var(--dsw-alias-label-tertiary)"}},"\u2190 "+n.dependsOn.join(", ")),n.outputSnippet&&_h("div",{style:{background:"var(--dsw-alias-bg-layer-2)",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"4px",padding:"6px",fontSize:"11px",color:"var(--dsw-alias-label-secondary)",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60px",overflowY:"auto"}},n.outputSnippet),isFailed&&chainRunId&&_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{marginTop:"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",fontSize:"12px",padding:"6px 10px",color:"var(--dsh-cron-danger)",borderColor:"var(--dsh-cron-danger)"},onClick:()=>onRetry&&onRetry(n.id)},"\u{1F504} "+T_KEY(t,"chainGraph.retryStep")))})))),_h("div",{className:"dsh-cron-modal-foot",style:{borderTop:"1px solid var(--dsw-alias-border-l2)",paddingTop:"12px",marginTop:"auto"}},_h("button",{type:"button",className:"dsh-cron-btn-primary",onClick:onClose},T_KEY(t,"chainGraph.close")))))}function renderLiveLogsModal({isOpen,onClose,taskId,taskTitle,logs,autoScroll,onToggleAutoScroll,completed,status,t}){if(!isOpen)return null;const terminalRef=el=>{if(el&&autoScroll){el.scrollTop=el.scrollHeight}};const isLive=status==="running"||status==="connecting";const statusColor=isLive?"var(--dsh-cron-success, #2a2)":status==="completed"?"var(--dsw-alias-label-secondary, #888)":"var(--dsh-cron-danger, #e33)";return _h("div",{className:"dsh-cron-modal-overlay",onClick:onClose},_h("div",{className:"dsh-cron-modal",style:{maxWidth:"860px",width:"92vw",height:"80vh",display:"flex",flexDirection:"column",background:"var(--dsw-alias-bg-base, #111)",color:"var(--dsw-alias-label-primary, #ddd)",border:"1px solid var(--dsw-alias-border-l2, #333)",borderRadius:"8px"},role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--dsw-alias-border-l2, #333)",background:"var(--dsw-alias-bg-layer-2, #111)"}},_h("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},_h("span",{style:{fontSize:"18px"}},"\u{1F4FA}"),_h("div",null,_h("div",{style:{fontWeight:"600",fontSize:"14px",color:"var(--dsw-alias-label-primary, #fff)",display:"flex",alignItems:"center",gap:"8px"}},T_KEY(t,"liveLog.modalTitle"),_h("span",{style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",background:statusColor,boxShadow:isLive?"0 0 8px "+statusColor:"none"}})),_h("div",{style:{fontSize:"11px",color:"var(--dsw-alias-label-secondary, #888)",marginTop:"2px",fontFamily:"monospace"}},(taskTitle||taskId)+" \xB7 "+(isLive?T_KEY(t,"liveLog.connecting"):completed?T_KEY(t,"liveLog.completed"):status)))),_h("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},_h("label",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #888)",display:"flex",alignItems:"center",gap:"4px",cursor:"pointer"}},_h("input",{type:"checkbox",checked:Boolean(autoScroll),onChange:onToggleAutoScroll,style:{cursor:"pointer"}}),T_KEY(t,"liveLog.autoScroll")),_h("button",{type:"button",className:"dsh-cron-icon-btn",style:{color:"var(--dsw-alias-label-secondary, #888)",background:"transparent",border:"none",cursor:"pointer",fontSize:"16px"},onClick:onClose},"\u2715"))),_h("div",{ref:terminalRef,style:{flex:1,overflowY:"auto",padding:"14px 16px",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"12px",lineHeight:"1.5",background:"var(--dsw-alias-bg-base, #000)"}},(!logs||logs.length===0)&&_h("div",{style:{color:"var(--dsw-alias-label-secondary, #888)",fontStyle:"italic",padding:"20px 0",textAlign:"center"}},isLive?T_KEY(t,"liveLog.waiting"):"No output captured for this run."),logs&&logs.length>0&&logs.map((item,idx)=>{const isErr=item.stream==="stderr";const timeStr=item.ts?new Date(item.ts).toLocaleTimeString():"";return _h("div",{key:idx,style:{display:"flex",gap:"8px",color:isErr?"var(--dsh-cron-danger, #f55)":"var(--dsh-cron-success, #5f5)",wordBreak:"break-all",whiteSpace:"pre-wrap"}},timeStr&&_h("span",{style:{color:"var(--dsw-alias-label-secondary, #555)",userSelect:"none",flexShrink:0}},"["+timeStr+"]"),_h("span",{style:{flex:1}},item.chunk||item.text||String(item)))})),_h("div",{style:{display:"flex",justifyContent:"flex-end",padding:"10px 16px",borderTop:"1px solid var(--dsw-alias-border-l2, #333)",background:"var(--dsw-alias-bg-layer-2, #111)"}},_h("button",{type:"button",className:"dsh-cron-btn dsh-cron-btn-secondary",style:{padding:"6px 14px",fontSize:"12px"},onClick:onClose},T_KEY(t,"liveLog.close")))))}function renderAnalyticsDigestModal({isOpen,onClose,digestData,isLoading,periodDays,onSelectPeriod,onSendTelegram,sendStatus,t}){if(!isOpen)return null;const digest=digestData||{totalRuns:0,successfulRuns:0,failedRuns:0,successRate:100,totalTokens:0,totalCostUsd:0,healedCount:0,activeTasksCount:0,pausedTasksCount:0,topUnstableTasks:[],topExpensiveTasks:[]};const copyMarkdown=()=>{if(!digestData)return;const text=["# "+T_KEY(t,"digest.modalTitle"),"Period: Last "+(periodDays||7)+" days","Total Runs: "+digest.totalRuns+" ("+digest.successRate+"% SR)","Tokens: "+digest.totalTokens+" (~$"+digest.totalCostUsd+" USD)","Active Tasks: "+digest.activeTasksCount+" active / "+digest.pausedTasksCount+" paused"].join(String.fromCharCode(10));navigator.clipboard.writeText(text).catch(err=>{console.debug?.("[dsh-cron] copy skipped",err)})};return _h("div",{className:"dsh-cron-modal-overlay",onClick:onClose},_h("div",{className:"dsh-cron-modal",style:{maxWidth:"780px",width:"92vw",maxHeight:"86vh",display:"flex",flexDirection:"column",background:"var(--dsw-alias-bg-base, #111)",color:"var(--dsw-alias-label-primary, #ddd)",border:"1px solid var(--dsw-alias-border-l2, #333)",borderRadius:"8px"},role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"14px 18px",borderBottom:"1px solid var(--dsw-alias-border-l2, #333)",background:"var(--dsw-alias-bg-layer-2, #111)"}},_h("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},_h("span",{style:{fontSize:"20px"}},"\u{1F4CA}"),_h("div",null,_h("div",{style:{fontWeight:"600",fontSize:"15px",color:"var(--dsw-alias-label-primary, #fff)"}},T_KEY(t,"digest.modalTitle")),_h("div",{style:{fontSize:"11.5px",color:"var(--dsw-alias-label-secondary, #888)",marginTop:"2px"}},T_KEY(t,"digest.buttonTitle")+" \xB7 "+(periodDays||7)+"d"))),_h("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"4px 10px",fontSize:"12px",fontWeight:periodDays===7?"600":"400",background:periodDays===7?"var(--dsw-alias-bg-layer-3, #222)":"transparent"},onClick:()=>onSelectPeriod&&onSelectPeriod(7)},T_KEY(t,"digest.period7")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"4px 10px",fontSize:"12px",fontWeight:periodDays===30?"600":"400",background:periodDays===30?"var(--dsw-alias-bg-layer-3, #222)":"transparent"},onClick:()=>onSelectPeriod&&onSelectPeriod(30)},T_KEY(t,"digest.period30")),_h("button",{type:"button",className:"dsh-cron-icon-btn",onClick:onClose,style:{marginLeft:"8px"}},_h("span",null,"\u2715")))),_h("div",{style:{padding:"16px 18px",overflowY:"auto",flex:1,display:"flex",flexDirection:"column",gap:"16px"}},isLoading?_h("div",{style:{padding:"30px",textAlign:"center",color:"var(--dsw-alias-label-secondary, #888)"}},"Loading digest metrics..."):_h(React.Fragment,null,(()=>{const renderKpi=(label,val,sub,subCol)=>_h("div",{style:{background:"var(--dsw-alias-bg-layer-2, #111)",border:"1px solid var(--dsw-alias-border-l2, #333)",borderRadius:"6px",padding:"10px 12px"}},_h("div",{style:{fontSize:"11px",color:"var(--dsw-alias-label-secondary, #888)"}},label),_h("div",{style:{fontSize:"18px",fontWeight:"700",color:"var(--dsw-alias-label-primary, #fff)",marginTop:"4px"}},val),_h("div",{style:{fontSize:"11px",color:subCol||"var(--dsw-alias-label-secondary, #888)",marginTop:"2px"}},sub));return _h("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"10px"}},renderKpi(T_KEY(t,"digest.executions"),digest.totalRuns,digest.successRate+"% SR",digest.successRate>=90?"var(--dsh-cron-success, #2a2)":"var(--dsh-cron-warning, #fa0)"),renderKpi(T_KEY(t,"digest.tokens"),Number(digest.totalTokens||0).toLocaleString(),"LLM prompt+out"),renderKpi(T_KEY(t,"digest.cost"),"$"+Number(digest.totalCostUsd||0).toFixed(4),"USD estimated"),renderKpi(T_KEY(t,"digest.fleet"),digest.activeTasksCount,digest.pausedTasksCount+" paused"))})(),_h("div",{style:{background:"var(--dsw-alias-bg-layer-2, #111)",border:"1px solid var(--dsw-alias-border-l2, #333)",borderRadius:"6px",padding:"12px"}},_h("div",{style:{fontWeight:"600",fontSize:"13px",color:"var(--dsh-cron-warning, #fa0)",marginBottom:"8px"}},"\u26A0\uFE0F "+T_KEY(t,"digest.unstableTitle")),digest.topUnstableTasks&&digest.topUnstableTasks.length>0?_h("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},digest.topUnstableTasks.map((tItem,idx)=>_h("div",{key:tItem.id||idx,style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",padding:"6px 8px",background:"var(--dsw-alias-bg-base, #111)",borderRadius:"4px",border:"1px solid var(--dsw-alias-border-l2, #222)"}},_h("span",{style:{fontFamily:"monospace"}},idx+1+". "+(tItem.name||tItem.id)),_h("span",{style:{color:"var(--dsh-cron-danger, #e33)",fontWeight:"600"}},tItem.failures+" fail ("+tItem.successRate+"% SR)")))):_h("div",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #888)"}},"\u2713 All tasks healthy \u2014 0 failures in window!")),_h("div",{style:{background:"var(--dsw-alias-bg-layer-2, #111)",border:"1px solid var(--dsw-alias-border-l2, #333)",borderRadius:"6px",padding:"12px"}},_h("div",{style:{fontWeight:"600",fontSize:"13px",color:"var(--dsh-cron-info, #4af)",marginBottom:"8px"}},"\u{1F4B0} "+T_KEY(t,"digest.expensiveTitle")),digest.topExpensiveTasks&&digest.topExpensiveTasks.length>0?_h("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},digest.topExpensiveTasks.map((tItem,idx)=>_h("div",{key:tItem.id||idx,style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",padding:"6px 8px",background:"var(--dsw-alias-bg-base, #111)",borderRadius:"4px",border:"1px solid var(--dsw-alias-border-l2, #222)"}},_h("span",{style:{fontFamily:"monospace"}},idx+1+". "+(tItem.name||tItem.id)),_h("span",{style:{color:"var(--dsw-alias-label-primary, #ddd)"}},Number(tItem.tokens||0).toLocaleString()+" tok ($"+Number(tItem.costUsd||0).toFixed(4)+")")))):_h("div",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #888)"}},"No significant token consumption recorded.")))),_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 18px",borderTop:"1px solid var(--dsw-alias-border-l2, #333)",background:"var(--dsw-alias-bg-layer-2, #111)"}},_h("div",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #888)"}},sendStatus||""),_h("div",{style:{display:"flex",gap:"8px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:copyMarkdown,style:{padding:"6px 14px",fontSize:"12px"}},T_KEY(t,"digest.copyMarkdown")),_h("button",{type:"button",className:"dsh-cron-btn-primary",onClick:onSendTelegram,style:{padding:"6px 14px",fontSize:"12px"}},T_KEY(t,"digest.sendTelegram"))))))}function renderTimelineHeatmapModal({isOpen,onClose,activeTab,onSelectTab,timelineData,heatmapData,isLoading,t}){if(!isOpen)return null;const tab=activeTab||"timeline";const timeline=timelineData||{buckets:[],totalRuns:0,peakHoursCount:0,maxConcurrent:3};const heatmap=heatmapData||{matrix:[],dayLabels:[],hourLabels:[],totalCostUsd:0,totalTokens:0,maxCostHour:0};return _h("div",{className:"dsh-cron-modal-overlay",onClick:onClose},_h("div",{className:"dsh-cron-modal",style:{maxWidth:"960px",width:"94vw",maxHeight:"88vh",display:"flex",flexDirection:"column",background:"var(--dsw-alias-bg-base, #111)",color:"var(--dsw-alias-label-primary, #ddd)",border:"1px solid var(--dsw-alias-border-l2, #333)",borderRadius:"8px"},role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"14px 18px",borderBottom:"1px solid var(--dsw-alias-border-l2, #333)",background:"var(--dsw-alias-bg-layer-2, #111)"}},_h("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},_h("span",{style:{fontSize:"20px"}},tab==="timeline"?"\u23F1":"\u{1F525}"),_h("div",null,_h("div",{style:{fontWeight:"600",fontSize:"15px",color:"var(--dsw-alias-label-primary, #fff)"}},tab==="timeline"?T_KEY(t,"timeline.modalTitle"):T_KEY(t,"heatmap.modalTitle")),_h("div",{style:{fontSize:"11.5px",color:"var(--dsw-alias-label-secondary, #888)",marginTop:"2px"}},tab==="timeline"?timeline.totalRuns+" runs projected \xB7 "+(timeline.peakHoursCount?"\u26A0\uFE0F "+timeline.peakHoursCount+" peak hours":"\u2713 balanced concurrency"):"$"+Number(heatmap.totalCostUsd||0).toFixed(4)+" USD \xB7 "+Number(heatmap.totalTokens||0).toLocaleString()+" tokens"))),_h("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"4px 12px",fontSize:"12px",fontWeight:tab==="timeline"?"600":"400",background:tab==="timeline"?"var(--dsw-alias-bg-layer-3, #222)":"transparent"},onClick:()=>onSelectTab&&onSelectTab("timeline")},"\u23F1 "+T_KEY(t,"timeline.tabTimeline")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"4px 12px",fontSize:"12px",fontWeight:tab==="heatmap"?"600":"400",background:tab==="heatmap"?"var(--dsw-alias-bg-layer-3, #222)":"transparent"},onClick:()=>onSelectTab&&onSelectTab("heatmap")},"\u{1F525} "+T_KEY(t,"heatmap.tabHeatmap")),_h("button",{type:"button",className:"dsh-cron-icon-btn",onClick:onClose,style:{marginLeft:"8px"}},_h("span",null,"\u2715")))),_h("div",{style:{padding:"16px 18px",overflowY:"auto",flex:1,display:"flex",flexDirection:"column",gap:"14px"}},isLoading?_h("div",{style:{padding:"40px",textAlign:"center",color:"var(--dsw-alias-label-secondary, #888)"}},"Loading visualization data..."):tab==="timeline"?_h("div",{style:{display:"flex",flexDirection:"column",gap:"8px"}},_h("div",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #888)",display:"flex",justifyContent:"space-between"}},_h("span",null,T_KEY(t,"timeline.legendDesc")),_h("span",{style:{color:"var(--dsh-cron-warning, #fa0)"}},"\u26A0\uFE0F "+T_KEY(t,"timeline.peakWarning")+" ("+timeline.maxConcurrent+")")),_h("div",{style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gap:"8px",marginTop:"6px"}},(timeline.buckets||[]).map(b=>{const isPeak=b.isPeak,hasRuns=b.count>0;return _h("div",{key:b.index,style:{background:isPeak?"color-mix(in srgb, var(--dsh-cron-danger, #e33) 12%, var(--dsw-alias-bg-layer-2, #111))":hasRuns?"var(--dsw-alias-bg-layer-2, #111)":"var(--dsw-alias-bg-base, #111)",border:isPeak?"1px solid var(--dsh-cron-danger, #e33)":hasRuns?"1px solid var(--dsw-alias-border-l2, #333)":"1px dashed var(--dsw-alias-border-l2, #222)",borderRadius:"6px",padding:"8px",minHeight:"75px",display:"flex",flexDirection:"column",justifyContent:"space-between"}},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"11px"}},_h("span",{style:{fontWeight:"600",color:isPeak?"var(--dsh-cron-danger, #e33)":"var(--dsw-alias-label-primary, #fff)"}},b.label),hasRuns?_h("span",{style:{fontSize:"10px",padding:"1px 5px",borderRadius:"8px",background:isPeak?"var(--dsh-cron-danger, #e33)":"var(--dsw-alias-bg-layer-3, #222)",color:"#fff"}},b.count):null),_h("div",{style:{display:"flex",flexWrap:"wrap",gap:"3px",marginTop:"4px"}},(b.runs||[]).slice(0,3).map((r,rIdx)=>_h("span",{key:rIdx,title:(r.title||r.taskId)+" ("+r.time+")",style:{fontSize:"9.5px",fontFamily:"monospace",padding:"1px 4px",borderRadius:"3px",background:"var(--dsw-alias-bg-base, #111)",border:"1px solid var(--dsw-alias-border-l2, #333)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.title||r.taskId))))}))):_h("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},_h("div",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #888)",display:"flex",justifyContent:"space-between"}},_h("span",null,T_KEY(t,"heatmap.matrixDesc")),_h("span",null,"Max hour spend: $"+Number(heatmap.maxCostHour||0).toFixed(4))),_h("div",{style:{overflowX:"auto",paddingBottom:"8px"}},_h("table",{style:{borderCollapse:"collapse",width:"100%",minWidth:"700px",fontSize:"10.5px"}},_h("thead",null,_h("tr",null,_h("th",{style:{padding:"4px 6px",textAlign:"left",color:"var(--dsw-alias-label-secondary, #888)"}},"Day"),Array.from({length:24},(_,hour)=>_h("th",{key:hour,style:{padding:"4px 2px",textAlign:"center",color:"var(--dsw-alias-label-secondary, #888)",fontWeight:"400"}},String(hour).padStart(2,"0"))))),_h("tbody",null,(heatmap.matrix||[]).map((row,dIdx)=>_h("tr",{key:dIdx},_h("td",{style:{padding:"4px 6px",fontWeight:"600",color:"var(--dsw-alias-label-primary, #ddd)"}},heatmap.dayLabels&&heatmap.dayLabels[dIdx]||"Day"),row.map((cell,hIdx)=>{const intensity=cell.costIntensity||0;const hasSpend=cell.costUsd>0;const bg=hasSpend?"color-mix(in srgb, var(--dsh-cron-primary, #4af) "+Math.max(15,Math.round(intensity*100))+"%, transparent)":"transparent";return _h("td",{key:hIdx,title:cell.dayLabel+" "+cell.hourLabel+": $"+cell.costUsd+" ("+cell.tokens.toLocaleString()+" tokens, "+cell.runs+" runs)",style:{padding:"3px",textAlign:"center",background:bg,border:"1px solid var(--dsw-alias-border-l2, #222)",cursor:hasSpend?"pointer":"default"}},hasSpend?_h("span",{style:{fontSize:"9px",color:intensity>.5?"#fff":"var(--dsw-alias-label-primary, #ddd)"}},"$"+(cell.costUsd>=.01?cell.costUsd.toFixed(2):cell.costUsd.toFixed(3).slice(1))):"\xB7")})))))))),_h("div",{style:{display:"flex",justifyContent:"flex-end",padding:"12px 18px",borderTop:"1px solid var(--dsw-alias-border-l2, #333)",background:"var(--dsw-alias-bg-layer-2, #111)"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:onClose,style:{padding:"6px 16px",fontSize:"12px"}},T_KEY(t,"chainGraph.close")))))}function CronScreen(props){const{ctx,toggle,onClose}=props;const t=props.t||translate;const[isOpen,setIsOpen]=React.useState(toggle&&typeof toggle.isOpen==="function"?toggle.isOpen():true);React.useEffect(()=>{if(!toggle||typeof toggle.subscribe!=="function")return;return toggle.subscribe(val=>setIsOpen(val))},[toggle]);if(!isOpen&&props.pinned!==true)return null;const[tab,setTab]=React.useState("all");const[query,setQuery]=React.useState("");const[filterType,setFilterType]=React.useState("");const[filterModel,setFilterModel]=React.useState("");const[filterChannel,setFilterChannel]=React.useState("");const[filtersOpen,setFiltersOpen]=React.useState(false);const[tasks,setTasks]=React.useState([]);const[recs,setRecs]=React.useState([]);const[loading,setLoading]=React.useState(false);const[fetchError,setFetchError]=React.useState(null);const[dropdownOpen,setDropdownOpen]=React.useState(false);const[transferBusy,setTransferBusy]=React.useState(false);const[importDoc,setImportDoc]=React.useState(null);const[importSummary,setImportSummary]=React.useState(null);const[importStrategy,setImportStrategy]=React.useState("skip");const importFileRef=React.useRef(null);const[manualModalOpen,setManualModalOpen]=React.useState(false);const[formId,setFormId]=React.useState(null);const[formTitle,setFormTitle]=React.useState("");const[formSchedule,setFormSchedule]=React.useState("");const[formType,setFormType]=React.useState("llm");const[formPrompt,setFormPrompt]=React.useState("");const[formProvider,setFormProvider]=React.useState("");const[formModel,setFormModel]=React.useState("");const[formFallbackModel,setFormFallbackModel]=React.useState("");const[formSilentRule,setFormSilentRule]=React.useState("");const[formInspectOnFailure,setFormInspectOnFailure]=React.useState(false);const[formRequireApproval,setFormRequireApproval]=React.useState(false);const[formDelivery,setFormDelivery]=React.useState("isolated");const[selectedTaskMeta,setSelectedTaskMeta]=React.useState(null);const[modalTab,setModalTab]=React.useState("params");const[taskHistory,setTaskHistory]=React.useState([]);const[historyLoading,setHistoryLoading]=React.useState(false);const[retryingDeliveryId,setRetryingDeliveryId]=React.useState(null);const[formNotifyTelegram,setFormNotifyTelegram]=React.useState(false);const[formChannels,setFormChannels]=React.useState([]);const[formTemplate,setFormTemplate]=React.useState("");const[formOnlyOnFailure,setFormOnlyOnFailure]=React.useState(false);const[formTimeoutSeconds,setFormTimeoutSeconds]=React.useState(1800);const[formOverlapPolicy,setFormOverlapPolicy]=React.useState("skip");const[formKanbanMode,setFormKanbanMode]=React.useState("none");const[formOnSuccess,setFormOnSuccess]=React.useState("");const[formOnFailure,setFormOnFailure]=React.useState("");const[formDependsOn,setFormDependsOn]=React.useState("");const[formJoinPolicy,setFormJoinPolicy]=React.useState("all_success");const[formElseTask,setFormElseTask]=React.useState("");const[formAutoHeal,setFormAutoHeal]=React.useState(false);const[formAdaptiveEnabled,setFormAdaptiveEnabled]=React.useState(false);const[formAdaptiveMinInterval,setFormAdaptiveMinInterval]=React.useState("5m");const[formAdaptiveMaxInterval,setFormAdaptiveMaxInterval]=React.useState("2h");const[formAdaptiveBackoffFactor,setFormAdaptiveBackoffFactor]=React.useState("1.5");const[formAdaptiveIdleThreshold,setFormAdaptiveIdleThreshold]=React.useState("3");const[liveLogsModalOpen,setLiveLogsModalOpen]=React.useState(false);const[liveLogsTaskId,setLiveLogsTaskId]=React.useState("");const[liveLogsTaskTitle,setLiveLogsTaskTitle]=React.useState("");const[liveLogsLines,setLiveLogsLines]=React.useState([]);const[liveLogsStatus,setLiveLogsStatus]=React.useState("idle");const[liveLogsCompleted,setLiveLogsCompleted]=React.useState(false);const[liveLogsAutoScroll,setLiveLogsAutoScroll]=React.useState(true);const[chainGraphModalOpen,setChainGraphModalOpen]=React.useState(false);const[chainGraphData,setChainGraphData]=React.useState(null);const[chainGraphLoading,setChainGraphLoading]=React.useState(false);const[chainGraphRunId,setChainGraphRunId]=React.useState(null);const[digestOpen,setDigestOpen]=React.useState(false);const[digestData,setDigestData]=React.useState(null);const[digestMarkdown,setDigestMarkdown]=React.useState("");const[digestLoading,setDigestLoading]=React.useState(false);const[periodDays,setPeriodDays]=React.useState(7);const[sendStatus,setSendStatus]=React.useState(null);const[timelineOpen,setTimelineOpen]=React.useState(false);const[timelineData,setTimelineData]=React.useState(null);const[heatmapData,setHeatmapData]=React.useState(null);const[timelineLoading,setTimelineLoading]=React.useState(false);const[timelineTab,setTimelineTab]=React.useState("timeline");const[formHeartbeatIntervalSeconds,setFormHeartbeatIntervalSeconds]=React.useState(0);const[formGracePeriodSeconds,setFormGracePeriodSeconds]=React.useState(300);const[formPreflightType,setFormPreflightType]=React.useState("none");const[formPreflightTarget,setFormPreflightTarget]=React.useState("");const[formPriority,setFormPriority]=React.useState(5);const[formConcurrencyGroup,setFormConcurrencyGroup]=React.useState("default");const[formWakeTriggerType,setFormWakeTriggerType]=React.useState("none");const[formWakeTriggerPath,setFormWakeTriggerPath]=React.useState("");const[formWakeTriggerMinCount,setFormWakeTriggerMinCount]=React.useState(1);const[formWakeTriggerConsume,setFormWakeTriggerConsume]=React.useState(true);const[formWorkWindowHours,setFormWorkWindowHours]=React.useState("");const[formWorkWindowPolicy,setFormWorkWindowPolicy]=React.useState("skip");const[formTimeBoxMinutes,setFormTimeBoxMinutes]=React.useState(0);const[formWriteScopes,setFormWriteScopes]=React.useState("");const[formInputHashPaths,setFormInputHashPaths]=React.useState("");const[formSkipIfUnchanged,setFormSkipIfUnchanged]=React.useState(false);const[formSelfHealingCommand,setFormSelfHealingCommand]=React.useState("");const[formAutoDiagnose,setFormAutoDiagnose]=React.useState(false);const[schedulePreviewRuns,setSchedulePreviewRuns]=React.useState(null);const[dryRunResult,setDryRunResult]=React.useState(null);const[archiveModalOpen,setArchiveModalOpen]=React.useState(false);const[archiveTask,setArchiveTask]=React.useState(null);const[archiveRuns,setArchiveRuns]=React.useState([]);const[archiveLoading,setArchiveLoading]=React.useState(false);const[archiveOffset,setArchiveOffset]=React.useState(0);const[archiveTotal,setArchiveTotal]=React.useState(0);const[formTimezone,setFormTimezone]=React.useState("");const[formMisfirePolicy,setFormMisfirePolicy]=React.useState("skip");const[formMaxRetries,setFormMaxRetries]=React.useState(0);const[formPermissionPreset,setFormPermissionPreset]=React.useState("default");const[formAgentPreset,setFormAgentPreset]=React.useState("");const[formSessionTitle,setFormSessionTitle]=React.useState("");const[formTargetSessionId,setFormTargetSessionId]=React.useState("");const[formTargetSessionReset,setFormTargetSessionReset]=React.useState("never");const[formEnv,setFormEnv]=React.useState("");const[formCwd,setFormCwd]=React.useState("");const[formWorkspaceId,setFormWorkspaceId]=React.useState("");const[formWorktree,setFormWorktree]=React.useState(false);const[formKeepWorktree,setFormKeepWorktree]=React.useState(false);const[formCaptureGitDiff,setFormCaptureGitDiff]=React.useState(false);const[formHttpMethod,setFormHttpMethod]=React.useState("GET");const[formHttpUrl,setFormHttpUrl]=React.useState("");const[formHttpHeaders,setFormHttpHeaders]=React.useState("");const[formHttpBody,setFormHttpBody]=React.useState("");const[formSshProfileId,setFormSshProfileId]=React.useState("");const[formSshTarget,setFormSshTarget]=React.useState("");const[formSshKeyPath,setFormSshKeyPath]=React.useState("");const[formDockerImage,setFormDockerImage]=React.useState("");const[formNodePath,setFormNodePath]=React.useState("");const[formPythonPath,setFormPythonPath]=React.useState("");const[formSkillName,setFormSkillName]=React.useState("");const[formWorkflowName,setFormWorkflowName]=React.useState("");const[stats,setStats]=React.useState(null);const initialFormSnapshotRef=React.useRef(null);const getFormSnapshot=()=>JSON.stringify({title:String(formTitle||"").trim(),schedule:String(formSchedule||"").trim(),type:String(formType||"llm"),prompt:String(formPrompt||"").trim(),provider:String(formProvider||""),model:String(formModel||""),fallbackModel:String(formFallbackModel||""),silentRule:String(formSilentRule||""),inspectOnFailure:Boolean(formInspectOnFailure),requireApproval:Boolean(formRequireApproval),delivery:String(formDelivery||"isolated"),notifyTelegram:Boolean(formNotifyTelegram),channels:Array.isArray(formChannels)?[...formChannels].sort():[],template:String(formTemplate||"").trim(),onlyOnFailure:Boolean(formOnlyOnFailure),timeoutSeconds:Number(formTimeoutSeconds)||1800,overlapPolicy:String(formOverlapPolicy||"skip"),kanbanMode:String(formKanbanMode||"none"),onSuccess:String(formOnSuccess||"").trim(),onFailure:String(formOnFailure||"").trim(),heartbeatIntervalSeconds:Number(formHeartbeatIntervalSeconds)||0,gracePeriodSeconds:Number(formGracePeriodSeconds)||300,preflightType:String(formPreflightType||"none"),preflightTarget:String(formPreflightTarget||"").trim(),priority:Number(formPriority)||5,concurrencyGroup:String(formConcurrencyGroup||"default").trim(),selfHealingCommand:String(formSelfHealingCommand||"").trim(),autoDiagnose:Boolean(formAutoDiagnose),timezone:String(formTimezone||"").trim(),misfirePolicy:String(formMisfirePolicy||"skip"),maxRetries:Number(formMaxRetries)||0,permissionPreset:String(formPermissionPreset||"default"),agentPreset:String(formAgentPreset||"").trim(),targetSessionId:String(formTargetSessionId||"").trim(),targetSessionReset:String(formTargetSessionReset||"never"),env:String(formEnv||"").trim(),cwd:String(formCwd||"").trim(),workspaceId:String(formWorkspaceId||"").trim(),worktree:Boolean(formWorktree),keepWorktree:Boolean(formKeepWorktree),captureGitDiff:Boolean(formCaptureGitDiff),httpMethod:String(formHttpMethod||"GET"),httpUrl:String(formHttpUrl||"").trim(),httpHttpHeaders:String(formHttpHeaders||"").trim(),httpBody:String(formHttpBody||"").trim(),sshProfileId:String(formSshProfileId||"").trim(),sshTarget:String(formSshTarget||"").trim(),sshKeyPath:String(formSshKeyPath||"").trim(),dockerImage:String(formDockerImage||"").trim(),nodePath:String(formNodePath||"").trim(),pythonPath:String(formPythonPath||"").trim(),skillName:String(formSkillName||"").trim(),workflowName:String(formWorkflowName||"").trim()});const isFormDirty=()=>{if(!manualModalOpen)return false;if(initialFormSnapshotRef.current!==null){return getFormSnapshot()!==initialFormSnapshotRef.current}return Boolean(formTitle.trim()||formPrompt.trim())};const closeManualModalWithConfirm=()=>{if(isFormDirty()){if(!confirm(T_KEY(t,"modal.confirmDiscard")||"Discard unsaved changes?")){return}}initialFormSnapshotRef.current=null;setManualModalOpen(false)};const tasksRef=React.useRef([]);const[nowTick,setNowTick]=React.useState(0);React.useEffect(()=>{tasksRef.current=tasks},[tasks]);React.useEffect(()=>{const tick=setInterval(()=>{if(tasksRef.current.some(t2=>t2.running))setNowTick(v=>v+1)},1e3);return()=>clearInterval(tick)},[]);const[settingsModalOpen,setSettingsModalOpen]=React.useState(false);const[settingsBotToken,setSettingsBotToken]=React.useState("");const[settingsChatId,setSettingsChatId]=React.useState("");const[settingsNotifyGlobal,setSettingsNotifyGlobal]=React.useState(false);const[settingsOnlyOnFailureGlobal,setSettingsOnlyOnFailureGlobal]=React.useState(false);const[settingsKanbanUrl,setSettingsKanbanUrl]=React.useState("http://127.0.0.1:3000");const[settingsDelivery,setSettingsDelivery]=React.useState({});const[settingsSections,setSettingsSections]=React.useState({channels:true});const[settingsHasDefault,setSettingsHasDefault]=React.useState(false);const[settingsHasCustomBotToken,setSettingsHasCustomBotToken]=React.useState(false);const[testStatus,setTestStatus]=React.useState(null);const[dshModalOpen,setDshModalOpen]=React.useState(false);const[dshPrompt,setDshPrompt]=React.useState("");const[dshLoading,setDshLoading]=React.useState(false);const[providers,setProviders]=React.useState([]);const[models,setModels]=React.useState([]);const[defaultModelInfo,setDefaultModelInfo]=React.useState(null);React.useEffect(()=>{const onKey=e=>{if(e.key==="Escape"){if(dropdownOpen){setDropdownOpen(false);return}if(manualModalOpen){closeManualModalWithConfirm();return}if(settingsModalOpen){setSettingsModalOpen(false);return}if(dshModalOpen&&!dshLoading){setDshModalOpen(false);return}if(onClose)onClose();else toggle.set(false)}};window.addEventListener("keydown",onKey);return()=>window.removeEventListener("keydown",onKey)},[manualModalOpen,settingsModalOpen,dshModalOpen,dropdownOpen,onClose]);const visibleTasks=React.useMemo(()=>{let list=tasks;if(filterType)list=list.filter(x=>(x.type||"llm")===filterType);if(filterModel)list=list.filter(x=>String(x.model||"").split("/").pop()===filterModel);if(filterChannel){list=list.filter(x=>{const channels=Array.isArray(x.channels)&&x.channels.length?x.channels:[x.notifyTelegram?"telegram":null,(x.kanbanMode||"none")!=="none"?"kanban":null].filter(Boolean);return channels.includes(filterChannel)})}return list},[tasks,filterType,filterModel,filterChannel]);const filterTypeOptions=React.useMemo(()=>Array.from(new Set(tasks.map(x=>x.type||"llm"))).sort(),[tasks]);const filterModelOptions=React.useMemo(()=>Array.from(new Set(tasks.map(x=>String(x.model||"").split("/").pop()).filter(Boolean))).sort(),[tasks]);const resetFilters=()=>{setFilterType("");setFilterModel("");setFilterChannel("")};React.useEffect(()=>{if(!pendingTaskHighlight||tasks.length===0)return;const id=pendingTaskHighlight;pendingTaskHighlight=null;const node=document.querySelector('[data-task-id="'+id+'"]');if(!node)return;if(typeof node.scrollIntoView==="function")node.scrollIntoView({block:"center"});node.classList.add("dsh-cron-task-highlight");setTimeout(()=>{try{node.classList.remove("dsh-cron-task-highlight")}catch(err){void err}},2500)},[tasks]);const fetchGenRef=React.useRef(0);const fetchTasks=async()=>{const gen=++fetchGenRef.current;setLoading(true);setFetchError(null);const controller=typeof AbortController!=="undefined"?new AbortController:null;const timer=controller?setTimeout(()=>controller.abort(),15e3):null;try{const res=await fetch("/dsh-cron/tasks?status="+encodeURIComponent(tab)+"&query="+encodeURIComponent(query),{signal:controller?controller.signal:void 0});const data=await res.json();if(gen!==fetchGenRef.current)return;if(data&&data.ok!==false){setTasks(data.tasks||[]);setRecs(data.recommendations||[]);setStats(data.stats||null)}else{setFetchError(data&&data.error?data.error:T_KEY(t,"list.loadErrorPrefix"))}}catch(err){if(gen!==fetchGenRef.current)return;console.error("[dsh-cron] fetch tasks error:",err);setFetchError(err.message||T_KEY(t,"list.loadErrorPrefix"))}finally{if(timer)clearTimeout(timer);if(gen===fetchGenRef.current){setLoading(false)}}};const loadModels=async providerName=>{const controller=typeof AbortController!=="undefined"?new AbortController:null;const timer=controller?setTimeout(()=>controller.abort(),15e3):null;try{const url=providerName?"/dsh-cron/models?provider="+encodeURIComponent(providerName):"/dsh-cron/models";const res=await fetch(url,{signal:controller?controller.signal:void 0});const data=await res.json();if(data&&data.ok){if(!providerName){setProviders(data.providers||[]);setDefaultModelInfo(data.defaultModel||data.current||null);if(data.defaultModel?.models){setModels(data.defaultModel.models)}}else{setModels(data.models||[])}}}catch(err){console.error("[dsh-cron] load models error:",err)}finally{if(timer)clearTimeout(timer)}};const lastEtagRef=React.useRef("");React.useEffect(()=>{fetchTasks();let timerId=null;let isDestroyed=false;let pollController=null;const doPoll=()=>{if(isDestroyed)return;const pollGen=++fetchGenRef.current;const headers={};if(lastEtagRef.current)headers["If-None-Match"]=lastEtagRef.current;if(pollController)pollController.abort();pollController=typeof AbortController!=="undefined"?new AbortController:null;const fetchOpts={headers};if(pollController)fetchOpts.signal=pollController.signal;const pollTimer=pollController?setTimeout(()=>{try{pollController.abort()}catch(abortErr){void abortErr}},15e3):null;fetch("/dsh-cron/tasks?status="+encodeURIComponent(tab)+"&query="+encodeURIComponent(query),fetchOpts).then(res=>{if(isDestroyed||pollGen!==fetchGenRef.current)return null;if(res.status===304){return null}const etag=res.headers.get("ETag");if(etag)lastEtagRef.current=etag;return res.json()}).then(data=>{if(isDestroyed||pollGen!==fetchGenRef.current)return;if(data&&data.ok){setTasks(data.tasks||[]);setRecs(data.recommendations||[]);setStats(data.stats||null)}}).catch(err=>{if(err&&err.name==="AbortError")return}).finally(()=>{if(pollTimer)clearTimeout(pollTimer);if(isDestroyed)return;const intervalMs=typeof document!=="undefined"&&document.hidden?3e4:8e3;timerId=setTimeout(doPoll,intervalMs)})};const onVisibilityChange=()=>{if(typeof document!=="undefined"&&!document.hidden){if(timerId)clearTimeout(timerId);doPoll()}};if(typeof document!=="undefined"){document.addEventListener("visibilitychange",onVisibilityChange)}timerId=setTimeout(doPoll,8e3);return()=>{isDestroyed=true;if(timerId)clearTimeout(timerId);if(pollController)pollController.abort();if(typeof document!=="undefined"){document.removeEventListener("visibilitychange",onVisibilityChange)}}},[tab,query]);React.useEffect(()=>{loadModels()},[]);const actionInProgressRef=React.useRef(new Set);const fetchJsonWithTimeout2=async(url,options={},timeoutMs=15e3)=>{const controller=typeof AbortController!=="undefined"?new AbortController:null;const timer=controller?setTimeout(()=>controller.abort(),timeoutMs):null;if(options&&options.signal&&controller){if(options.signal.aborted){controller.abort()}else{options.signal.addEventListener("abort",()=>controller.abort(),{once:true})}}try{const res=await fetch(url,{...options,signal:controller?controller.signal:options?options.signal:void 0});let data={};try{data=await res.json()}catch(jsonErr){if(jsonErr&&(jsonErr.name==="AbortError"||controller?.signal.aborted)){throw jsonErr}}return{res,data}}catch(err){if(err&&(err.name==="AbortError"||controller?.signal.aborted)){const timeoutErr=new Error(`Request timed out after ${Math.round(timeoutMs/1e3)}s`);timeoutErr.isTimeout=true;throw timeoutErr}throw err}finally{if(timer)clearTimeout(timer)}};const fetchWithTimeout2=fetchJsonWithTimeout2;const handleToggleTask=async id=>{if(actionInProgressRef.current.has(id))return;actionInProgressRef.current.add(id);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(id)+"/toggle",{method:"POST"},15e3);if(!res.ok||data&&data.ok===false){const msg=data&&data.error||`Toggle failed (HTTP ${res.status})`;alert(msg);return}await fetchTasks()}catch(err){console.error("[dsh-cron] toggle failed",err);alert("Toggle request failed: "+err.message)}finally{actionInProgressRef.current.delete(id)}};const handleRunNow=async id=>{if(actionInProgressRef.current.has(id))return;actionInProgressRef.current.add(id);const prevTask=tasks.find(t2=>t2.id===id);const prevStatus=prevTask?prevTask.lastStatus:null;setTasks(prev=>prev.map(t2=>t2.id===id?{...t2,lastStatus:"running"}:t2));try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(id)+"/run",{method:"POST"},15e3);if(!res.ok||data&&data.ok===false){setTasks(prev=>prev.map(t2=>t2.id===id?{...t2,lastStatus:prevStatus}:t2));const msg=data&&data.error||`Run failed (HTTP ${res.status})`;alert(msg);return}setTimeout(()=>fetchTasks(),1500)}catch(err){console.error("[dsh-cron] run now error:",err);setTasks(prev=>prev.map(t2=>t2.id===id?{...t2,lastStatus:prevStatus}:t2));alert("Run request failed: "+err.message)}finally{actionInProgressRef.current.delete(id)}};const handleDryRun=async taskId=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/dry-run",{method:"POST"});setDryRunResult(data)}catch(err){alert("Dry run error: "+err.message)}};const openArchiveModal=async(task,offset=0)=>{setArchiveTask(task);setArchiveOffset(offset);setArchiveLoading(true);setArchiveModalOpen(true);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(task.id)+"/archive?limit=15&offset="+offset);if(data.ok){setArchiveRuns(prev=>offset===0?data.runs||[]:[...prev,...data.runs||[]]);setArchiveTotal(data.total||0)}}catch(err){console.error("[dsh-cron] archive load error:",err)}finally{setArchiveLoading(false)}};const handlePreviewSchedule=async scheduleExpr=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/schedule/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schedule:scheduleExpr,timezone:formTimezone})});if(data.ok&&data.runs){setSchedulePreviewRuns(data.runs)}else{setSchedulePreviewRuns([])}}catch{setSchedulePreviewRuns([])}};const handleDuplicate=async task=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(task.id)+"/duplicate",{method:"POST"});if(!data.ok){alert(T_KEY(t,"duplicate.failed",{error:data&&data.error||""}));return}await fetchTasks();alert(task.oneShot?T_KEY(t,"duplicate.oneShotHint"):T_KEY(t,"duplicate.done"))}catch(err){alert(T_KEY(t,"duplicate.failed",{error:err.message}))}};const RESERVED_TASK_IDS=["export","import"];const isCodeTaskForm=x=>{if(!x||typeof x!=="object")return false;if(CODE_FORM_TYPES.includes(x.type))return true;if(x.command&&String(x.command).trim())return true;if(x.preflightType==="command"||x.preflightCommand&&String(x.preflightCommand).trim())return true;if(x.selfHealingCommand&&String(x.selfHealingCommand).trim())return true;return false};const importHeaders=document_=>{const headers={"Content-Type":"application/json"};const tasks2=document_&&Array.isArray(document_.tasks)?document_.tasks:[];if(tasks2.some(isCodeTaskForm))headers[SCRIPT_CONFIRM_HEADER]="script";return headers};const handleExport=async()=>{setTransferBusy(true);try{const promptMsg=T_KEY(t,"transfer.exportPrompt")||"Choose export mode:\nOK = Sanitized (removes custom env vars & headers)\nCancel = Full raw export";const wantSanitized=confirm(promptMsg);const exportUrl="/dsh-cron/tasks/export"+(wantSanitized?"?sanitize=true":"");const{res,data}=await fetchJsonWithTimeout2(exportUrl);if(!data.ok){alert(T_KEY(t,"transfer.exportFailed",{error:data&&data.error||""}));return}const blob=new Blob([JSON.stringify(data.document,null,2)],{type:"application/json"});const url=URL.createObjectURL(blob);const stamp=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");const anchor=document.createElement("a");anchor.href=url;anchor.download=`dsh-cron-tasks-${stamp}${data.sanitized?"-sanitized":""}.json`;document.body.appendChild(anchor);anchor.click();document.body.removeChild(anchor);setTimeout(()=>URL.revokeObjectURL(url),1e3);alert(T_KEY(t,"transfer.exported",{count:data.count}))}catch(err){alert(T_KEY(t,"transfer.exportFailed",{error:err.message}))}finally{setTransferBusy(false)}};const handleImportFile=async e=>{const file=e.target.files&&e.target.files[0];e.target.value="";if(!file)return;setTransferBusy(true);try{const text=await file.text();let document_;try{document_=JSON.parse(text)}catch(parseErr){alert(T_KEY(t,"transfer.badFile",{error:parseErr.message}));return}const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/import",{method:"POST",headers:importHeaders(document_),body:JSON.stringify({document:document_,dryRun:true,strategy:importStrategy})});if(!data.ok){alert(T_KEY(t,"transfer.importFailed",{error:data&&data.error||""}));return}setImportDoc(document_);setImportSummary(data.summary)}catch(err){alert(T_KEY(t,"transfer.importFailed",{error:err.message}))}finally{setTransferBusy(false)}};const handleImportConfirm=async()=>{if(!importDoc)return;setTransferBusy(true);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/import",{method:"POST",headers:importHeaders(importDoc),body:JSON.stringify({document:importDoc,strategy:importStrategy})});if(!data.ok){alert(T_KEY(t,"transfer.importFailed",{error:data&&data.error||""}));return}setImportDoc(null);setImportSummary(null);await fetchTasks();alert(T_KEY(t,"transfer.imported",{count:data.imported}))}catch(err){alert(T_KEY(t,"transfer.importFailed",{error:err.message}))}finally{setTransferBusy(false)}};const handleTuneWithDsh=async task=>{const lines=[`Tune the existing scheduled task "${task.title}" (id: ${task.id}).`,"Its current configuration is:",`- type: ${task.type||"llm"}`,`- schedule: ${task.scheduleText||task.schedule} (${task.schedule})`,`- status: ${task.status}`,task.model?`- model: ${task.model}${task.fallbackModel?`, fallback: ${task.fallbackModel}`:""}`:null,Array.isArray(task.channels)&&task.channels.length?`- channels: ${task.channels.join(", ")}`:null,`- prompt: ${String(task.prompt||"").slice(0,400)}`,"",'Ask what should change, then apply it with the cron tool (action: "update", or action: "get" if you need the full configuration).',"If the change makes the task execute code (script/node/python/ssh/docker), confirm it with me explicitly before applying it."].filter(Boolean);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/chat/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:lines.join(String.fromCharCode(10))})});if(!data.ok||!data.sessionId){alert(T_KEY(t,"tune.startFailed",{error:data&&data.error||""}));return}if(onClose)onClose();else toggle.set(false);await openSession(ctx,data.sessionId)}catch(err){alert(T_KEY(t,"tune.startFailed",{error:err.message}))}};const handleApproveProposal=async(taskId,proposalId)=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proposalId,decidedBy:"web-user"})});if(data&&data.ok){alert(T_KEY(t,"approval.approved")||"Approved");setTimeout(()=>fetchTasks(),1e3)}else{alert("Approval failed: "+(data&&data.error||""))}}catch(err){alert("Approval request failed: "+err.message)}};const handleRejectProposal=async(taskId,proposalId)=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proposalId,decidedBy:"web-user"})});if(data&&data.ok){alert(T_KEY(t,"approval.rejected")||"Rejected");setTimeout(()=>fetchTasks(),1e3)}else{alert("Rejection failed: "+(data&&data.error||""))}}catch(err){alert("Rejection request failed: "+err.message)}};const handleDelete=async id=>{if(!confirm(T_KEY(t,"confirm.delete")))return;try{await fetchWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(id),{method:"DELETE"});fetchTasks()}catch(err){console.debug("[dsh-cron] delete failed",err)}};const openSettingsModal=async()=>{setTestStatus(null);setSettingsModalOpen(true);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/settings");if(data&&data.ok&&data.settings){setSettingsBotToken(data.settings.botToken||"");setSettingsChatId(data.settings.chatId||"");setSettingsNotifyGlobal(Boolean(data.settings.notifyTelegram));setSettingsOnlyOnFailureGlobal(Boolean(data.settings.onlyOnFailure));setSettingsKanbanUrl(data.settings.kanbanBaseUrl||"http://127.0.0.1:3000");setSettingsDelivery(pickDeliverySettings(data.settings));setSettingsHasDefault(Boolean(data.settings.hasDefaultCredentials));setSettingsHasCustomBotToken(Boolean(data.settings.hasCustomBotToken))}}catch(err){console.debug("[dsh-cron] settings fetch failed",err)}};const handleSaveSettings=async e=>{e.preventDefault();try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({botToken:settingsBotToken,chatId:settingsChatId,notifyTelegram:settingsNotifyGlobal,onlyOnFailure:settingsOnlyOnFailureGlobal,kanbanBaseUrl:settingsKanbanUrl},settingsDelivery))});if(data&&data.ok){setSettingsModalOpen(false)}else{alert(T_KEY(t,"settings.saveError",{error:data&&data.error||T_KEY(t,"settings.saveErrorUnknown")}))}}catch(err){alert(T_KEY(t,"settings.saveError",{error:err.message}))}};const updateDelivery=(key,value)=>{setSettingsDelivery(prev=>{const next=Object.assign({},prev);if(value===void 0)delete next[key];else next[key]=value;return next})};const updateChannelTemplate=(channelId,value)=>{setSettingsDelivery(prev=>{const templates=Object.assign({},prev.channelTemplates||{});if(value&&value.trim())templates[channelId]=value;else delete templates[channelId];return Object.assign({},prev,{channelTemplates:templates})})};const toggleDeliverySection=key=>{setSettingsSections(prev=>Object.assign({},prev,{[key]:!prev[key]}))};const handleTestTelegram=async()=>{setTestStatus({loading:true,message:T_KEY(t,"settings.sending")});try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/telegram/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:settingsBotToken,chatId:settingsChatId})});if(data&&data.ok){setTestStatus({loading:false,success:true,message:T_KEY(t,"settings.testOk")})}else{setTestStatus({loading:false,success:false,message:T_KEY(t,"settings.testFail",{error:data&&data.error||""})})}}catch(err){setTestStatus({loading:false,success:false,message:T_KEY(t,"settings.testFail",{error:err.message})})}};const openManualModal=preset=>{setDropdownOpen(false);setFormId(null);setSelectedTaskMeta(null);setFormType("llm");setFormDelivery("isolated");setFormNotifyTelegram(false);setFormChannels([]);setFormTemplate("");setFormOnlyOnFailure(false);setFormTimeoutSeconds(1800);setFormOverlapPolicy("skip");setFormKanbanMode("none");setFormTimezone("");setFormMisfirePolicy("skip");setFormMaxRetries(0);setFormPermissionPreset("default");setFormAgentPreset("");setFormTargetSessionId("");setFormTargetSessionReset("never");setFormEnv("");setFormCwd("");setFormWorkspaceId("");setFormWorktree(false);setFormKeepWorktree(false);setFormCaptureGitDiff(false);setFormHttpMethod("GET");setFormHttpUrl("");setFormHttpHeaders("");setFormHttpBody("");setFormSshProfileId("");setFormSshTarget("");setFormSshKeyPath("");setFormDockerImage("");setFormNodePath("");setFormPythonPath("");setFormSkillName("");setFormWorkflowName("");setFormFallbackModel("");setFormSilentRule("");setFormInspectOnFailure(false);setFormRequireApproval(false);setFormDependsOn("");setFormJoinPolicy("all_success");setFormAdaptiveEnabled(false);setFormAdaptiveMinInterval("5m");setFormAdaptiveMaxInterval("2h");setFormAdaptiveBackoffFactor("1.5");setFormAdaptiveIdleThreshold("3");if(preset){setFormTitle(preset.title||"");setFormSchedule(preset.schedule||"");setFormPrompt(preset.prompt||"");if(preset.type)setFormType(preset.type);if(Array.isArray(preset.channels)&&preset.channels.length)setFormChannels(preset.channels.filter(c=>DELIVERY_CHANNELS.includes(c)));if(preset.silentRule!==void 0)setFormSilentRule(preset.silentRule||"");if(preset.fallbackModel!==void 0)setFormFallbackModel(preset.fallbackModel||"");if(preset.inspectOnFailure!==void 0)setFormInspectOnFailure(Boolean(preset.inspectOnFailure));if(preset.requireApproval!==void 0)setFormRequireApproval(Boolean(preset.requireApproval));setFormOnlyOnFailure(Boolean(preset.onlyOnFailure));setFormProvider(defaultModelInfo?.provider||"");setFormModel(defaultModelInfo?.model||"");if(defaultModelInfo?.provider)loadModels(defaultModelInfo.provider)}else{setFormTitle("");setFormSchedule("0 9 * * 1-5");setFormPrompt("");setFormProvider(defaultModelInfo?.provider||"");setFormModel(defaultModelInfo?.model||"");if(defaultModelInfo?.provider)loadModels(defaultModelInfo.provider)}initialFormSnapshotRef.current=JSON.stringify({title:String(preset&&preset.title||"").trim(),schedule:String(preset&&preset.schedule||(preset?"":"0 9 * * 1-5")).trim(),type:String(preset&&preset.type||"llm"),prompt:String(preset&&preset.prompt||"").trim(),provider:String(defaultModelInfo?.provider||""),model:String(defaultModelInfo?.model||""),fallbackModel:String(preset&&preset.fallbackModel||"").trim(),silentRule:String(preset&&preset.silentRule||"").trim(),inspectOnFailure:Boolean(preset&&preset.inspectOnFailure),requireApproval:Boolean(preset&&preset.requireApproval),delivery:"isolated",notifyTelegram:false,channels:Array.isArray(preset&&preset.channels)?[...preset.channels].filter(c=>DELIVERY_CHANNELS.includes(c)).sort():[],template:"",onlyOnFailure:Boolean(preset&&preset.onlyOnFailure),timeoutSeconds:1800,overlapPolicy:"skip",kanbanMode:"none",onSuccess:"",onFailure:"",heartbeatIntervalSeconds:0,gracePeriodSeconds:300,preflightType:"none",preflightTarget:"",priority:5,concurrencyGroup:"default",selfHealingCommand:"",autoDiagnose:false,timezone:"",misfirePolicy:"skip",maxRetries:0,permissionPreset:"default",agentPreset:"",sessionTitle:"",targetSessionId:"",targetSessionReset:"never",env:"",cwd:"",workspaceId:"",worktree:false,keepWorktree:false,captureGitDiff:false,httpMethod:"GET",httpUrl:"",httpHttpHeaders:"",httpBody:"",sshProfileId:"",sshTarget:"",sshKeyPath:"",dockerImage:"",nodePath:"",pythonPath:"",skillName:"",workflowName:""});setManualModalOpen(true)};React.useEffect(()=>{const checkPreset=()=>{if(!pendingTaskPreset)return;const p=pendingTaskPreset;pendingTaskPreset=null;openManualModal(p)};checkPreset();const onPreset=ev=>{if(ev&&ev.detail)openManualModal(ev.detail);else checkPreset()};if(typeof window!=="undefined"&&typeof window.addEventListener==="function"){window.addEventListener("dsh-cron:preset",onPreset);return()=>{try{window.removeEventListener("dsh-cron:preset",onPreset)}catch(_e){void _e}}}},[tasks]);const handleRetryDelivery=async(taskId,runId)=>{setRetryingDeliveryId(runId);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/retry-delivery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId})});if(data&&data.ok){await loadTaskHistory(taskId)}else{alert(data?.error||"Failed to retry delivery")}}catch(e){alert(e.message||"Error retrying delivery")}finally{setRetryingDeliveryId(null)}};const handleApplyDoctorFix=async(taskId,fix)=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/doctor/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fix})});if(data&&data.ok){alert("Doctor fix applied successfully! Task code updated.");await loadTaskHistory(taskId);await fetchTasks()}else{alert(data?.error||"Failed to apply doctor fix")}}catch(e){alert(e.message||"Error applying doctor fix")}};const handleRevertDoctorFix=async taskId=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/doctor/revert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(data&&data.ok){alert("Reverted to previous version successfully!");await loadTaskHistory(taskId);await fetchTasks()}else{alert(data?.error||"Failed to revert doctor fix")}}catch(e){alert(e.message||"Error reverting doctor fix")}};const handleResolveUncertain=async(taskId,runId,resolution)=>{try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/resolve-uncertain",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId,resolution})});if(data&&data.ok){await loadTaskHistory(taskId)}else{alert(data?.error||"Failed to resolve uncertain run")}}catch(e){alert(e.message||"Error resolving uncertain run")}};const loadTaskHistory=async taskId=>{setHistoryLoading(true);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(taskId)+"/history");if(data.ok){setTaskHistory(data.history||[])}}catch(e){console.error("[dsh-cron] history load failed:",e)}finally{setHistoryLoading(false)}};const openEditModal=(task,overrides={})=>{setDropdownOpen(false);setFormId(task.id);setSelectedTaskMeta(task);setModalTab("params");setFormTitle(task.title||"");setFormSchedule(task.schedule||"");setFormType(task.type||"llm");setFormPrompt(overrides.prompt!==void 0?overrides.prompt:task.prompt||"");setFormProvider(task.provider||"");setFormModel(task.model||"");setFormFallbackModel(task.fallbackModel||"");setFormSilentRule(task.silentRule||"");setFormInspectOnFailure(Boolean(task.inspectOnFailure));setFormRequireApproval(Boolean(task.requireApproval));setFormDelivery(task.delivery||"isolated");setFormNotifyTelegram(Boolean(task.notifyTelegram));setFormChannels(Array.isArray(task.channels)?task.channels.filter(c=>DELIVERY_CHANNELS.includes(c)):[]);setFormTemplate(task.template||"");setFormOnlyOnFailure(Boolean(task.onlyOnFailure));setFormTimeoutSeconds(task.timeoutSeconds!==void 0?task.timeoutSeconds:1800);setFormOverlapPolicy(task.overlapPolicy||"skip");setFormKanbanMode(task.kanbanMode||"none");setFormOnSuccess(task.onSuccess||"");setFormOnFailure(task.onFailure||"");setFormDependsOn(Array.isArray(task.dependsOn)?task.dependsOn.join(", "):task.dependsOn||"");setFormJoinPolicy(task.joinPolicy||"all_success");setFormAdaptiveEnabled(Boolean(task.adaptive?.enabled));setFormAdaptiveMinInterval(task.adaptive?.minInterval||"5m");setFormAdaptiveMaxInterval(task.adaptive?.maxInterval||"2h");setFormAdaptiveBackoffFactor(String(task.adaptive?.backoffFactor||"1.5"));setFormAdaptiveIdleThreshold(String(task.adaptive?.idleRunsThreshold||"3"));setFormHeartbeatIntervalSeconds(task.heartbeatIntervalSeconds||0);setFormGracePeriodSeconds(task.gracePeriodSeconds||300);setFormPreflightType(task.preflightType||"none");setFormPreflightTarget(task.preflightTarget||"");setFormPriority(task.priority!==void 0?task.priority:5);setFormConcurrencyGroup(task.concurrencyGroup||"default");const _ww=task.workWindow||{};setFormWorkWindowHours(_ww.hours||"");setFormWorkWindowPolicy(_ww.outsidePolicy||"skip");setFormTimeBoxMinutes(Number(task.timeBoxMinutes)||0);const _wt=task.wakeTrigger||{};setFormWakeTriggerType(_wt.enabled&&_wt.type?_wt.type:"none");setFormWakeTriggerPath(_wt.markerPath||_wt.path||_wt.pidFile||"");setFormWakeTriggerMinCount(_wt.minCount||1);setFormWakeTriggerConsume(_wt.consumeMarker!==false);setFormWriteScopes(Array.isArray(task.writeScopes)?task.writeScopes.join("\n"):task.writeScopes||"");setFormInputHashPaths(Array.isArray(task.inputHashPaths)?task.inputHashPaths.join("\n"):task.inputHashPaths||"");setFormSkipIfUnchanged(Boolean(task.skipIfUnchanged));setFormSelfHealingCommand(task.selfHealingCommand||"");setFormAutoDiagnose(Boolean(task.autoDiagnose));setSchedulePreviewRuns(null);setFormTimezone(task.timezone||"");setFormMisfirePolicy(task.misfirePolicy||"skip");setFormMaxRetries(task.maxRetries!==void 0?task.maxRetries:0);setFormPermissionPreset(task.permissionPreset==="full"?"danger-full-access":task.permissionPreset||"default");setFormAgentPreset(task.agentPreset||"");setFormSessionTitle(task.sessionTitle||"");setFormTargetSessionId(task.targetSessionId||"");setFormTargetSessionReset(task.targetSessionReset||"never");setFormEnv(formatEnvText(task.env));setFormCwd(task.cwd||"");setFormWorkspaceId(task.workspaceId||"");setFormWorktree(Boolean(task.worktree));setFormKeepWorktree(Boolean(task.keepWorktree));setFormCaptureGitDiff(task.captureGitDiff!==void 0?Boolean(task.captureGitDiff):Boolean(task.worktree));setFormHttpMethod(task.httpMethod||"GET");setFormHttpUrl(task.httpUrl||"");setFormHttpHeaders(typeof task.httpHeaders==="string"?task.httpHeaders:task.httpHeaders?JSON.stringify(task.httpHeaders):"");setFormHttpBody(task.httpBody||"");setFormSshProfileId(task.sshProfileId||"");setFormSshTarget(task.sshTarget||"");setFormSshKeyPath(task.sshKeyPath||"");setFormDockerImage(task.dockerImage||"");setFormNodePath(task.nodePath||"");setFormPythonPath(task.pythonPath||"");setFormSkillName(task.skillName||"");setFormWorkflowName(task.workflowName||"");if(task.provider)loadModels(task.provider);else if(defaultModelInfo?.provider)loadModels(defaultModelInfo.provider);loadTaskHistory(task.id);setManualModalOpen(true)};const handleProviderChange=e=>{const prov=e.target.value;setFormProvider(prov);setFormModel("");loadModels(prov)};const handleSaveManual=async e=>{e.preventDefault();try{const isAgentType=AGENT_FORM_TYPES.includes(formType);const payload={id:formId||void 0,status:selectedTaskMeta?selectedTaskMeta.status:"active",title:formTitle,schedule:formSchedule,prompt:formType==="http"?formPrompt.trim()||formHttpUrl.trim():formPrompt,type:formType,delivery:formDelivery||"isolated",provider:isAgentType?formProvider||void 0:void 0,model:isAgentType?formModel||void 0:void 0,fallbackModel:isAgentType?formFallbackModel.trim()||void 0:void 0,silentRule:isAgentType?void 0:formSilentRule.trim(),inspectOnFailure:isAgentType?Boolean(formInspectOnFailure):false,notifyTelegram:formNotifyTelegram,channels:formChannels,template:formTemplate.trim(),onlyOnFailure:formOnlyOnFailure,timeoutSeconds:Number(formTimeoutSeconds)||1800,overlapPolicy:formOverlapPolicy,timezone:formTimezone.trim(),misfirePolicy:formMisfirePolicy,maxRetries:Number(formMaxRetries)||0,permissionPreset:isAgentType?formPermissionPreset:"default",agentPreset:formAgentPreset.trim()||void 0,sessionTitle:formSessionTitle.trim()||void 0,targetSessionId:formTargetSessionId.trim()||void 0,targetSessionReset:formTargetSessionReset||"never",kanbanMode:formKanbanMode,onSuccess:formOnSuccess.trim()||void 0,onFailure:formOnFailure.trim()||void 0,dependsOn:formDependsOn.trim()?formDependsOn.split(/[,;\s]+/).map(s=>s.trim()).filter(Boolean):void 0,joinPolicy:formJoinPolicy||"all_success",adaptive:formAdaptiveEnabled?{enabled:true,minInterval:formAdaptiveMinInterval||"5m",maxInterval:formAdaptiveMaxInterval||"2h",backoffFactor:Number(formAdaptiveBackoffFactor)||1.5,idleRunsThreshold:Number(formAdaptiveIdleThreshold)||3}:null,heartbeatIntervalSeconds:Number(formHeartbeatIntervalSeconds)||0,gracePeriodSeconds:Number(formGracePeriodSeconds)||300,preflightType:formPreflightType||"none",preflightTarget:formPreflightTarget.trim()||void 0,priority:Number(formPriority)||5,concurrencyGroup:formConcurrencyGroup.trim()||"default",workWindow:formWorkWindowHours.trim()?{enabled:true,hours:formWorkWindowHours.trim(),outsidePolicy:formWorkWindowPolicy}:null,timeBoxMinutes:Number(formTimeBoxMinutes)>0?Number(formTimeBoxMinutes):void 0,wakeTrigger:formWakeTriggerType&&formWakeTriggerType!=="none"?{enabled:true,type:formWakeTriggerType,path:formWakeTriggerType==="file_count"?formWakeTriggerPath.trim():void 0,minCount:formWakeTriggerType==="file_count"?Number(formWakeTriggerMinCount)||1:void 0,markerPath:formWakeTriggerType==="marker_file"?formWakeTriggerPath.trim():void 0,pidFile:formWakeTriggerType==="process_exit"?formWakeTriggerPath.trim():void 0,consumeMarker:Boolean(formWakeTriggerConsume)}:null,writeScopes:formWriteScopes?formWriteScopes.split(/[\n,]+/).map(s=>s.trim()).filter(Boolean):[],inputHashPaths:formInputHashPaths?formInputHashPaths.split(/[\n,]+/).map(s=>s.trim()).filter(Boolean):[],skipIfUnchanged:Boolean(formSkipIfUnchanged),selfHealingCommand:formSelfHealingCommand.trim()||void 0,autoDiagnose:Boolean(formAutoDiagnose),requireApproval:Boolean(formRequireApproval),env:parseEnvText(formEnv),cwd:formCwd.trim(),workspaceId:formWorkspaceId.trim(),worktree:isAgentType?Boolean(formWorktree):false,keepWorktree:isAgentType?Boolean(formKeepWorktree):false,captureGitDiff:Boolean(formCaptureGitDiff),httpMethod:formHttpMethod,httpUrl:formHttpUrl.trim(),httpHeaders:formHttpHeaders.trim()||void 0,httpBody:formHttpBody,sshProfileId:formSshProfileId.trim(),sshTarget:formSshTarget.trim(),sshKeyPath:formSshKeyPath.trim(),dockerImage:formDockerImage.trim(),nodePath:formNodePath.trim(),pythonPath:formPythonPath.trim(),skillName:formSkillName.trim(),workflowName:formWorkflowName.trim()};const headers={"Content-Type":"application/json"};const hasCodeExec=CODE_FORM_TYPES.includes(formType)||Boolean(payload.command&&payload.command.trim())||payload.preflightType==="command"||Boolean(payload.preflightCommand&&payload.preflightCommand.trim())||Boolean(payload.selfHealingCommand&&payload.selfHealingCommand.trim());if(hasCodeExec)headers[SCRIPT_CONFIRM_HEADER]="script";const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/tasks",{method:"POST",headers,body:JSON.stringify(payload)});if(!data.ok){alert(data.error||T_KEY(t,"settings.saveError",{error:""}));return}initialFormSnapshotRef.current=null;setManualModalOpen(false);fetchTasks()}catch(err){alert(err.message)}};const openDshModal=()=>{setDropdownOpen(false);setDshPrompt("");setDshModalOpen(true)};const handleStartWithDSH=async()=>{const text=dshPrompt.trim();if(!text)return;setDshLoading(true);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/chat/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:text})});if(!data.ok||!data.sessionId){alert(T_KEY(t,"dsh.startFailed",{error:data.error||""}));setDshLoading(false);return}setDshModalOpen(false);if(onClose)onClose();else toggle.set(false);await openSession(ctx,data.sessionId)}catch(err){alert(T_KEY(t,"dsh.launchError",{error:err.message}))}finally{setDshLoading(false)}};const openChainGraphModal=async(task,chainRunId=null)=>{setChainGraphModalOpen(true);setChainGraphLoading(true);setChainGraphData(null);setChainGraphRunId(chainRunId);try{if(chainRunId){const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/chains/"+encodeURIComponent(chainRunId));if(data&&data.ok){setChainGraphData(data)}}else if(task){const graph=buildTaskGraphModel(tasks||[],[],task.id);setChainGraphData({ok:true,graph,task})}}catch(err){console.debug("[dsh-cron] chain graph fetch failed",err)}finally{setChainGraphLoading(false)}};const handleRetryChainStep=async stepTaskId=>{if(!chainGraphRunId||!stepTaskId)return;try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/chains/"+encodeURIComponent(chainGraphRunId)+"/retry-from/"+encodeURIComponent(stepTaskId),{method:"POST"});if(data&&data.ok){await openChainGraphModal(null,chainGraphRunId)}else{alert(data?.error||"Retry failed")}}catch(err){alert("Retry failed: "+err.message)}};const iconHtml=html=>({dangerouslySetInnerHTML:{__html:html}});const svgProps=html=>({style:{display:"flex",alignItems:"center"},...iconHtml(html)});function handleOpenLiveLogs(task){if(!task||!task.id)return;if(window.__dshLiveLogsEvtSource){try{window.__dshLiveLogsEvtSource.close()}catch(e){void e}window.__dshLiveLogsEvtSource=null}if(window.__dshLiveLogsPollTimer){clearInterval(window.__dshLiveLogsPollTimer);window.__dshLiveLogsPollTimer=null}setLiveLogsTaskId(task.id);setLiveLogsTaskTitle(task.title||task.id);setLiveLogsLines([]);setLiveLogsStatus(task.running?"connecting":"idle");setLiveLogsCompleted(false);setLiveLogsModalOpen(true);const startPollingFallback=()=>{if(window.__dshLiveLogsPollTimer)return;const pollFn=()=>{fetchJsonWithTimeout2("/dsh-cron/tasks/"+encodeURIComponent(task.id)+"/history?limit=1").then(({data}={})=>{if(data&&data.history&&data.history.length>0){const lastRun=data.history[0];if(lastRun.output||lastRun.error){const text=lastRun.output||lastRun.error;setLiveLogsLines([{chunk:text,stream:lastRun.error?"stderr":"stdout",ts:lastRun.at}])}if(lastRun.status){setLiveLogsStatus(lastRun.status);setLiveLogsCompleted(true);if(window.__dshLiveLogsPollTimer){clearInterval(window.__dshLiveLogsPollTimer);window.__dshLiveLogsPollTimer=null}}}}).catch(err=>{console.debug?.("[dsh-cron] poll skipped",err)})};pollFn();window.__dshLiveLogsPollTimer=setInterval(pollFn,2e3)};if(typeof EventSource!=="undefined"){try{const streamUrl="/dsh-cron/tasks/"+encodeURIComponent(task.id)+"/logs/stream";const es=new EventSource(streamUrl);window.__dshLiveLogsEvtSource=es;es.addEventListener("init",e=>{try{const d=JSON.parse(e.data);if(Array.isArray(d.bufferedLogs))setLiveLogsLines(d.bufferedLogs);if(d.status)setLiveLogsStatus(d.status);if(d.status==="completed")setLiveLogsCompleted(true)}catch(err){void err}});es.addEventListener("log",e=>{try{const item=JSON.parse(e.data);setLiveLogsLines(prev=>[...prev,item]);setLiveLogsStatus("running")}catch(err){void err}});es.addEventListener("complete",()=>{setLiveLogsCompleted(true);setLiveLogsStatus("completed");try{es.close()}catch(e){void e}window.__dshLiveLogsEvtSource=null});es.onerror=()=>{try{es.close()}catch(e){void e}window.__dshLiveLogsEvtSource=null;setLiveLogsStatus(curr=>{if(curr==="running"||curr==="connecting"){startPollingFallback();return curr}return"completed"})}}catch(err){startPollingFallback()}}else{startPollingFallback()}}function handleCloseLiveLogs(){if(window.__dshLiveLogsEvtSource){try{window.__dshLiveLogsEvtSource.close()}catch(e){void e}window.__dshLiveLogsEvtSource=null}if(window.__dshLiveLogsPollTimer){clearInterval(window.__dshLiveLogsPollTimer);window.__dshLiveLogsPollTimer=null}setLiveLogsModalOpen(false)}const openAnalyticsDigest=async(days=7)=>{setDigestOpen(true);setDigestLoading(true);setPeriodDays(days);setSendStatus(null);try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/analytics?days="+encodeURIComponent(days));if(data&&data.ok){setDigestData(data.digest||null);setDigestMarkdown(data.markdown||"")}}catch(err){console.debug("[dsh-cron] analytics digest fetch failed",err)}finally{setDigestLoading(false)}};const onSelectPeriod=async days=>{setPeriodDays(days);await openAnalyticsDigest(days)};const onSendTelegram=async()=>{setSendStatus("\u23F3 "+(T_KEY(t,"digest.sending")||"Sending..."));try{const{res,data}=await fetchJsonWithTimeout2("/dsh-cron/analytics",{method:"POST",body:JSON.stringify({days:periodDays})});if(data&&data.ok){setSendStatus("\u2705 "+(T_KEY(t,"digest.sent")||"Sent!"))}else{setSendStatus("\u274C "+(data?.error||"Failed"))}}catch(err){setSendStatus("\u274C "+(err.message||"Error"))}};const openTimelineModal=async(tab2="timeline")=>{setTimelineOpen(true);setTimelineLoading(true);setTimelineTab(tab2);try{const[timelineRes,heatmapRes]=await Promise.all([fetchJsonWithTimeout2("/dsh-cron/schedule/timeline-24h?hours=24"),fetchJsonWithTimeout2("/dsh-cron/analytics/heatmap")]);if(timelineRes?.data?.ok&&timelineRes?.data?.timeline){setTimelineData(timelineRes.data.timeline)}if(heatmapRes?.data?.ok&&heatmapRes?.data?.heatmap){setHeatmapData(heatmapRes.data.heatmap)}}catch(err){console.debug("[dsh-cron] timeline fetch failed",err)}finally{setTimelineLoading(false)}};const onSelectTimelineTab=tab2=>{setTimelineTab(tab2)};return _h("div",{className:"dsh-cron-overlay"},_h("div",{className:"dsh-cron-container"},_h("div",{className:"dsh-cron-top-bar"},_h("button",{type:"button",className:"dsh-cron-back-btn",title:T_KEY(t,"panel.back"),onClick:()=>{if(onClose)onClose();else toggle.set(false)}},_h("span",svgProps(BACK_ICON)),_h("span",null,T_KEY(t,"panel.back")))),_h("div",{className:"dsh-cron-header"},_h("div",null,_h("div",{className:"dsh-cron-title"},T_KEY(t,"panel.title")),_h("div",{className:"dsh-cron-subtitle"},T_KEY(t,"panel.subtitle"))),_h("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{display:"flex",alignItems:"center",gap:"6px",height:"36px",padding:"0 12px"},title:T_KEY(t,"timeline.buttonTitle"),onClick:()=>openTimelineModal("timeline")},_h("span",{style:{fontSize:"14px"}},"\u23F1"),T_KEY(t,"timeline.buttonLabel")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{display:"flex",alignItems:"center",gap:"6px",height:"36px",padding:"0 12px"},title:T_KEY(t,"digest.buttonTitle"),onClick:openAnalyticsDigest},_h("span",{style:{fontSize:"14px"}},"\u{1F4CA}"),T_KEY(t,"digest.buttonLabel")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{display:"flex",alignItems:"center",gap:"6px",height:"36px",padding:"0 14px"},title:T_KEY(t,"actions.settings"),onClick:openSettingsModal},_h("span",{style:{display:"flex",alignItems:"center",color:"var(--dsh-cron-info)"},...iconHtml(ICON_TELEGRAM)}),T_KEY(t,"actions.settings")),_h("div",{style:{position:"relative"}},_h("button",{className:"dsh-cron-create-btn",onClick:()=>setDropdownOpen(!dropdownOpen)},T_KEY(t,"actions.create"),_h("span",iconHtml(ICON_CHEVRON_DOWN))),dropdownOpen&&_h("div",{className:"dsh-cron-dropdown"},_h("button",{className:"dsh-cron-dropdown-item",onClick:openDshModal},T_KEY(t,"actions.createWithDsh")),_h("button",{className:"dsh-cron-dropdown-item",onClick:()=>openManualModal(null)},T_KEY(t,"actions.setupManually")))),_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"transfer.exportTitle"),"aria-label":T_KEY(t,"transfer.exportTitle"),disabled:transferBusy,onClick:handleExport},_h("span",svgProps(ICON_DOWNLOAD))),_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"transfer.importTitle"),"aria-label":T_KEY(t,"transfer.importTitle"),disabled:transferBusy,onClick:()=>{if(importFileRef.current)importFileRef.current.click()}},_h("span",svgProps(ICON_UPLOAD))),_h("input",{type:"file",accept:".json,application/json",ref:importFileRef,style:{display:"none"},onChange:handleImportFile}))),_h("div",{className:"dsh-cron-search-bar"},_h("span",{className:"dsh-cron-search-icon",...iconHtml(ICON_SEARCH)}),_h("input",{className:"dsh-cron-search-input",type:"search","aria-label":T_KEY(t,"search.placeholder"),placeholder:T_KEY(t,"search.placeholder"),value:query,onChange:e=>setQuery(e.target.value)})),stats&&_h("div",{className:"dsh-cron-stats-bar"},_h("div",{className:"dsh-cron-stat-card"},_h("div",{className:"dsh-cron-stat-val"},stats.activeTasks||0),_h("div",{className:"dsh-cron-stat-lbl"},T_KEY(t,"stats.activeTasks"))),_h("div",{className:"dsh-cron-stat-card"},_h("div",{className:"dsh-cron-stat-val"},stats.totalRuns||0),_h("div",{className:"dsh-cron-stat-lbl"},T_KEY(t,"stats.totalRuns"))),_h("div",{className:"dsh-cron-stat-card"},_h("div",{className:"dsh-cron-stat-val"},(stats.totalTokens||0).toLocaleString()),_h("div",{className:"dsh-cron-stat-lbl"},T_KEY(t,"stats.totalTokens"))),_h("div",{className:"dsh-cron-stat-card"},_h("div",{className:"dsh-cron-stat-val",style:{color:"var(--dsh-cron-success)"}},"$"+(stats.totalCostUsd||0).toFixed(4)),_h("div",{className:"dsh-cron-stat-lbl"},T_KEY(t,"stats.totalCost")))),_h("div",{className:"dsh-cron-tabs"},["all","active","paused","completed"].map(tabName=>_h("button",{key:tabName,className:"dsh-cron-tab","data-active":tab===tabName?"true":void 0,onClick:()=>setTab(tabName)},tabName==="all"?T_KEY(t,"tabs.all"):tabName==="active"?T_KEY(t,"tabs.active"):tabName==="paused"?T_KEY(t,"tabs.paused"):T_KEY(t,"tabs.completed")))),_h("div",{className:"dsh-cron-filters"},_h("button",{type:"button",className:"dsh-cron-filter-toggle","aria-expanded":filtersOpen?"true":"false",onClick:()=>setFiltersOpen(!filtersOpen)},T_KEY(t,"filters.title"),filterType||filterModel||filterChannel?" \u2022":""),filtersOpen&&_h("div",{className:"dsh-cron-filter-panel"},_h("label",{className:"dsh-cron-filter-field"},_h("span",null,T_KEY(t,"filters.type")),_h("select",{value:filterType,onChange:e=>setFilterType(e.target.value)},_h("option",{value:""},T_KEY(t,"filters.any")),...filterTypeOptions.map(value=>_h("option",{key:value,value},value)))),_h("label",{className:"dsh-cron-filter-field"},_h("span",null,T_KEY(t,"filters.model")),_h("select",{value:filterModel,onChange:e=>setFilterModel(e.target.value)},_h("option",{value:""},T_KEY(t,"filters.any")),...filterModelOptions.map(value=>_h("option",{key:value,value},value)))),_h("label",{className:"dsh-cron-filter-field"},_h("span",null,T_KEY(t,"filters.channel")),_h("select",{value:filterChannel,onChange:e=>setFilterChannel(e.target.value)},_h("option",{value:""},T_KEY(t,"filters.any")),...DELIVERY_CHANNELS.map(id=>_h("option",{key:id,value:id},T_KEY(t,CHANNEL_LABEL_KEYS[id]))))))),fetchError?_h("div",{className:"dsh-cron-status-banner","data-type":"error",style:{margin:"8px 0",display:"flex",alignItems:"center",justifyContent:"space-between"}},_h("span",null,T_KEY(t,"banner.loadError",{error:fetchError})),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{marginLeft:"8px",padding:"2px 8px",fontSize:"12px"},onClick:()=>fetchTasks()},T_KEY(t,"banner.retry"))):null,filterType||filterModel||filterChannel?_h("div",{className:"dsh-cron-filter-summary",style:{fontSize:"12px",color:"var(--dsw-alias-label-tertiary, #888)",marginBottom:"8px",display:"flex",gap:"8px",alignItems:"center"}},_h("span",null,T_KEY(t,"filters.showing",{shown:visibleTasks.length,total:tasks.length})),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"11px"},onClick:resetFilters},T_KEY(t,"filters.reset"))):null,_h("div",{className:"dsh-cron-task-list"},loading&&tasks.length===0?_h("div",{style:{color:"var(--dsw-alias-label-tertiary, #888)",padding:"16px 0",fontSize:"14px"}},T_KEY(t,"list.loading")):tasks.length===0?_h("div",{style:{color:"var(--dsw-alias-label-tertiary, #777)",padding:"16px 0",fontSize:"14px"}},T_KEY(t,"list.empty")):visibleTasks.length===0?_h("div",{style:{color:"var(--dsw-alias-label-tertiary, #777)",padding:"16px 0",fontSize:"14px",display:"flex",gap:"10px",alignItems:"center"}},_h("span",null,T_KEY(t,"filters.empty")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"12px"},onClick:resetFilters},T_KEY(t,"filters.reset"))):visibleTasks.map(task=>_h("div",{key:task.id,className:"dsh-cron-task-item","data-task-id":task.id,role:isConfigManaged(task)?void 0:"button",tabIndex:isConfigManaged(task)?void 0:0,"aria-label":task.title,style:isConfigManaged(task)?{cursor:"default"}:void 0,onClick:isConfigManaged(task)?void 0:()=>openEditModal(task),onKeyDown:isConfigManaged(task)?void 0:e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();openEditModal(task)}}},isConfigManaged(task)?null:_h("button",{type:"button",className:"dsh-cron-task-status-btn"+(task.running?" dsh-cron-pulse":""),"data-active":task.status==="active"?"true":void 0,title:task.status==="active"?T_KEY(t,"actions.pause"):T_KEY(t,"actions.resume"),"aria-label":task.status==="active"?T_KEY(t,"actions.pause"):T_KEY(t,"actions.resume"),onClick:e=>{e.stopPropagation();handleToggleTask(task.id)}},_h("span",svgProps(task.status==="active"?ICON_PAUSE:ICON_PLAY))),_h("div",{className:"dsh-cron-task-info"},_h("div",{className:"dsh-cron-task-title"},task.title,_h("span",{className:"dsh-cron-type-tag",style:task.type==="script"?{background:"var(--dsh-cron-info-bg)",color:"var(--dsh-cron-info)"}:{background:"var(--dsh-cron-success-bg)",color:"var(--dsh-cron-success)"}},task.type==="script"?T_KEY(t,"list.typeShell"):T_KEY(t,"list.typeLlm")),task.model?_h("span",{className:"dsh-cron-task-model-tag"},task.model.split("/").pop()):null,task.oneShot?_h("span",{className:"dsh-cron-oneshot-tag"},T_KEY(t,"list.oneShot")):null,isConfigManaged(task)?_h("span",{className:"dsh-cron-config-tag",title:T_KEY(t,"list.configManagedHint")},T_KEY(t,"list.configManaged")):null,task.lastDurationMs>0?_h("span",{className:"dsh-cron-cost-tag",title:"Last execution duration"},task.lastDurationMs+"ms"):null,task.onSuccess?_h("span",{className:"dsh-cron-type-tag dsh-cron-tag-success",title:"On success: triggers "+task.onSuccess},"\u279C "+task.onSuccess):null,task.onFailure?_h("span",{className:"dsh-cron-type-tag dsh-cron-tag-failure",title:"On failure: triggers "+task.onFailure},"\u21B3 "+task.onFailure):null,task.dependsOn&&(Array.isArray(task.dependsOn)?task.dependsOn.length>0:Boolean(task.dependsOn))?_h("span",{className:"dsh-cron-type-tag dsh-cron-tag-heartbeat",title:"Depends on: "+(Array.isArray(task.dependsOn)?task.dependsOn.join(", "):task.dependsOn)},"\u26D3\uFE0F "+(Array.isArray(task.dependsOn)?task.dependsOn.join(", "):task.dependsOn)):null,task.adaptive?.enabled?_h("span",{className:"dsh-cron-type-tag"+(task.adaptiveState?.backedOff?" dsh-cron-tag-failure":" dsh-cron-tag-success"),title:"Adaptive: "+(task.adaptiveState?.effectiveIntervalStr||task.adaptive.minInterval||"5m")+" (idle: "+(task.adaptiveState?.idleCount||0)+")"},(task.adaptiveState?.backedOff?"\u23F3 ":"\u26A1 ")+(task.adaptiveState?.effectiveIntervalStr||task.adaptive.minInterval||"5m")):null,task.heartbeatIntervalSeconds>0?_h("span",{className:"dsh-cron-type-tag dsh-cron-tag-heartbeat",title:"Heartbeat: every "+task.heartbeatIntervalSeconds+"s"},"\u{1F493} "+task.heartbeatIntervalSeconds+"s"):null,task.targetSessionId?_h("span",{className:"dsh-cron-type-tag dsh-cron-tag-session",title:"Target session: "+task.targetSessionId+(task.targetSessionReset&&task.targetSessionReset!=="never"?" ("+task.targetSessionReset+")":"")},"\u{1F9F5} "+task.targetSessionId):null,task.preflightType&&task.preflightType!=="none"?_h("span",{className:"dsh-cron-type-tag dsh-cron-tag-preflight",title:"Preflight: "+task.preflightType},"\u{1F6E1}\uFE0F "+task.preflightType):null,task.totalCostUsd>0?_h("span",{className:"dsh-cron-cost-tag"},"$"+task.totalCostUsd.toFixed(4)):null,task.totalTokens>0?_h("span",{className:"dsh-cron-tokens-tag"},(task.totalTokens>1e3?Math.round(task.totalTokens/1e3)+"k":task.totalTokens)+" tok"):null,task.status==="paused"&&task.pausedReason?_h("span",{className:"dsh-cron-type-tag dsh-cron-tag-failure",title:task.pausedReason},"\u{1F6D1} "+task.pausedReason):null),_h("div",{className:"dsh-cron-task-sched"},task.scheduleText||task.schedule,task.nextRunAt?T_KEY(t,"list.next",{time:new Date(task.nextRunAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}):"",task.running&&task.runningSince?" \xB7 "+T_KEY(t,"list.runningNow")+" "+Math.max(0,Math.round((Date.now()-task.runningSince)/1e3))+"s":""),task.prompt?_h("div",{className:"dsh-cron-task-prompt-preview",title:task.prompt},task.prompt.slice(0,140)+(task.prompt.length>140?"\u2026":"")):null),_h("div",{className:"dsh-cron-task-actions",onClick:e=>e.stopPropagation()},_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"actions.dryRunTitle"),onClick:()=>handleDryRun(task.id)},"\u{1F9EA}"),_h("button",{type:"button",className:"dsh-cron-icon-btn"+(task.running?" dsh-cron-pulse":""),title:T_KEY(t,"liveLog.viewLog"),onClick:()=>handleOpenLiveLogs(task)},"\u{1F4FA}"),_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"actions.archiveTitle"),onClick:()=>openArchiveModal(task,0)},"\u{1F4DC}"),task.onSuccess||task.onFailure||task.dependsOn&&(Array.isArray(task.dependsOn)?task.dependsOn.length>0:Boolean(task.dependsOn))?_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"chainGraph.viewGraph"),onClick:()=>openChainGraphModal(task)},"\u{1F578}\uFE0F"):null,_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"actions.runNow"),onClick:()=>handleRunNow(task.id)},T_KEY(t,"actions.runNowShort")),isConfigManaged(task)?null:_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"actions.edit"),"aria-label":T_KEY(t,"actions.edit"),onClick:()=>openEditModal(task)},_h("span",svgProps(ICON_EDIT))),isConfigManaged(task)?null:_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"actions.tuneWithDsh"),"aria-label":T_KEY(t,"actions.tuneWithDsh"),onClick:()=>handleTuneWithDsh(task)},_h("span",svgProps(ICON_TUNE))),isConfigManaged(task)?null:_h("button",{type:"button",className:"dsh-cron-icon-btn",title:T_KEY(t,"actions.duplicate"),"aria-label":T_KEY(t,"actions.duplicate"),onClick:()=>handleDuplicate(task)},_h("span",svgProps(ICON_COPY))),isConfigManaged(task)?null:_h("button",{type:"button",className:"dsh-cron-icon-btn dsh-cron-danger",title:T_KEY(t,"actions.delete"),"aria-label":T_KEY(t,"actions.delete"),onClick:()=>handleDelete(task.id)},_h("span",svgProps(ICON_TRASH))))))),_h("div",{className:"dsh-cron-recs-title"},T_KEY(t,"recs.title")),_h("div",{className:"dsh-cron-hint",style:{marginBottom:"8px"}},T_KEY(t,"recs.hint")),_h("div",{className:"dsh-cron-recs-list"},recs.map(rec=>_h("div",{key:rec.id,className:"dsh-cron-rec-card",role:"button",tabIndex:0,onClick:()=>openManualModal(rec),onKeyDown:e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();openManualModal(rec)}}},_h("div",{className:"dsh-cron-rec-icon"},_h("span",iconHtml(rec.icon==="bell"?ICON_BELL:rec.icon==="clipboard"?ICON_CLIPBOARD:ICON_ACTIVITY))),_h("div",{className:"dsh-cron-rec-content"},_h("div",{className:"dsh-cron-rec-title"},rec.title,_h("span",{className:"dsh-cron-rec-time"},rec.scheduleText)),_h("div",{className:"dsh-cron-rec-desc"},rec.description)))))),manualModalOpen&&_h("div",{className:"dsh-cron-modal-overlay",onClick:e=>{if(e.target===e.currentTarget)closeManualModalWithConfirm()}},_h("div",{className:"dsh-cron-modal dsh-cron-modal-scroll",style:{maxWidth:"640px"},role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{className:"dsh-cron-modal-head",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:formId?"12px":"18px"}},_h("div",{className:"dsh-cron-modal-title",style:{margin:0}},formId?T_KEY(t,"modal.editTitle"):T_KEY(t,"modal.newTitle")),selectedTaskMeta&&_h("span",{style:{fontSize:"12px",padding:"3px 8px",borderRadius:"6px",background:selectedTaskMeta.status==="active"?"var(--dsh-cron-success-bg)":"var(--dsh-cron-danger-bg)",color:selectedTaskMeta.status==="active"?"var(--dsh-cron-success)":"var(--dsh-cron-danger)"}},selectedTaskMeta.status==="active"?T_KEY(t,"modal.statusActive"):T_KEY(t,"modal.statusPaused"))),formId&&_h("div",{className:"dsh-cron-modal-nav"},_h("button",{type:"button",className:"dsh-cron-modal-tab","data-active":modalTab==="params"?"true":void 0,onClick:()=>setModalTab("params")},T_KEY(t,"modal.params")),_h("button",{type:"button",className:"dsh-cron-modal-tab","data-active":modalTab==="history"?"true":void 0,onClick:()=>{setModalTab("history");if(formId)loadTaskHistory(formId)}},T_KEY(t,"modal.history",{count:taskHistory.length||0}))),modalTab==="history"&&formId?_h("div",null,historyLoading?_h("div",{className:"dsh-cron-history-empty"},T_KEY(t,"history.loading")):taskHistory.length===0?_h("div",{className:"dsh-cron-history-empty"},T_KEY(t,"history.empty")):_h("div",{className:"dsh-cron-history-list"},taskHistory.map(run=>_h("div",{key:run.id,className:"dsh-cron-history-item"},_h("div",{className:"dsh-cron-history-head"},_h("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},_h("span",{className:"dsh-cron-history-status","data-status":run.status},statusLabel(t,run.status)),_h("span",{className:"dsh-cron-history-time"},run.at?new Date(run.at).toLocaleString():"")),_h("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},run.costUsd>0&&_h("span",{className:"dsh-cron-cost-tag"},"$"+run.costUsd.toFixed(5)),run.usage&&(run.usage.inputTokens>0||run.usage.outputTokens>0)&&_h("span",{className:"dsh-cron-tokens-tag"},run.usage.inputTokens+run.usage.outputTokens+" tok"),_h("span",{style:{color:"var(--dsw-alias-label-tertiary, #888)",fontSize:"11.5px"}},(run.durationMs||0)+" ms"))),run.stoppedReason&&_h("div",{className:"dsh-cron-hint",style:{display:"flex",gap:"6px",alignItems:"center",marginTop:"6px"}},_h("span",{className:"dsh-cron-badge-ref"},T_KEY(t,"history.stoppedReasonTitle")),_h("span",null,run.stoppedReason)),Array.isArray(run.stages)&&run.stages.length>0&&_h("div",{className:"dsh-cron-stages-flow",style:{display:"flex",gap:"6px",flexWrap:"wrap",marginTop:"6px"}},run.stages.map(st=>_h("span",{key:st.name,className:"dsh-cron-stage-pill","data-status":st.status||"unknown",title:st.error?st.name+": "+st.error:st.name+(st.durationMs!==void 0?" ("+st.durationMs+"ms)":"")},(T_KEY(t,"history.stage_"+st.name)||st.name)+(st.durationMs!==void 0?" "+st.durationMs+"ms":"")))),run.delivery&&_h("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},_h("span",{className:"dsh-cron-badge-ref","data-status":run.delivery.status},"Delivery: "+run.delivery.status),(run.delivery.status==="failed"||run.delivery.status==="partial")&&_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"11px"},disabled:retryingDeliveryId===run.id,onClick:()=>handleRetryDelivery(formId,run.id)},retryingDeliveryId===run.id?T_KEY(t,"history.retryingDelivery"):T_KEY(t,"history.retryDelivery"))),run.artifacts&&run.artifacts.length>0&&_h("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"6px",alignItems:"center"}},_h("span",{className:"dsh-cron-hint",style:{fontSize:"11px"}},"\u{1F4E6} "+T_KEY(t,"history.artifacts")+":"),run.artifacts.map(art=>_h("a",{key:art.name||art.id,href:"/dsh-cron/runs/"+encodeURIComponent(run.id)+"/artifacts/"+encodeURIComponent(art.name)+"/preview",target:"_blank",rel:"noopener noreferrer",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"11px",textDecoration:"none"},title:art.name+" ("+Math.round((art.size||0)/1024*10)/10+" KB)"},art.name))),run.status==="uncertain"&&_h("div",{className:"dsh-cron-status-banner","data-type":"warning",style:{marginTop:"8px",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}},_h("span",null,"\u26A0\uFE0F "+T_KEY(t,"history.statusUncertainHint")),_h("div",{style:{display:"flex",gap:"6px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"11px"},onClick:()=>handleResolveUncertain(formId,run.id,"completed")},"\u2713 "+T_KEY(t,"history.resolveCompleted")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"11px"},onClick:()=>handleResolveUncertain(formId,run.id,"failed")},"\u2715 "+T_KEY(t,"history.resolveFailed")))),(run.diagnosis||run.doctorReport)&&_h("div",{className:"dsh-cron-status-banner","data-type":"info",style:{marginTop:"8px",display:"flex",flexDirection:"column",gap:"6px"}},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},_h("strong",null,"\u{1FA7A} "+T_KEY(t,run.doctorReport?"history.doctorDiagnosis":"history.diagnosis")),_h("div",{style:{display:"flex",gap:"6px",alignItems:"center"}},(run.autoHealed||run.doctorReport?.autoHealed)&&_h("span",{style:{fontSize:"10px",background:"var(--dsh-cron-success-bg)",color:"var(--dsh-cron-success)",padding:"1px 6px",borderRadius:"8px",fontWeight:"600"}},"\u2728 "+T_KEY(t,"history.autoHealed")),(run.doctorReport?.category||run.category)&&_h("span",{style:{fontSize:"10px",background:"var(--dsw-alias-bg-layer-3)",padding:"1px 6px",borderRadius:"4px"}},run.doctorReport?.category||run.category),run.confidence?_h("span",{style:{fontSize:"10px",color:"var(--dsw-alias-label-secondary)"}},"("+run.confidence+")"):null)),_h("div",null,run.doctorReport?.cause||run.diagnosis),run.doctorReport?.diff&&_h("div",{style:{background:"var(--dsw-alias-bg-layer-2)",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"4px",padding:"6px",fontFamily:"monospace",fontSize:"11px",maxHeight:"120px",overflowY:"auto",whiteSpace:"pre"}},run.doctorReport.diff),(run.doctorReport?.suggestedFix||run.suggestion)&&_h("div",{style:{display:"flex",gap:"8px",marginTop:"4px"}},typeof handleApplyDoctorFix==="function"&&_h("button",{type:"button",className:"dsh-cron-btn-primary",style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>handleApplyDoctorFix(formId,run.doctorReport||{suggestedFix:run.suggestion})},"\u26A1 "+T_KEY(t,"history.doctorApply")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>openEditModal(selectedTaskMeta,{prompt:run.suggestion})},T_KEY(t,"history.applySuggestion")))),run.subtaskRuns&&Array.isArray(run.subtaskRuns)&&run.subtaskRuns.length>0&&_h("div",{style:{marginTop:"8px",padding:"8px",background:"var(--dsw-alias-bg-layer-2)",borderRadius:"6px",fontSize:"12px"}},_h("div",{style:{fontWeight:"600",marginBottom:"4px"}},"\u{1F41D} "+T_KEY(t,"history.swarmBadge")+" ("+run.subtaskRuns.filter(r=>r.status==="success").length+"/"+run.subtaskRuns.length+")"),_h("div",{style:{display:"flex",flexDirection:"column",gap:"4px"}},run.subtaskRuns.map((st,sidx)=>_h("div",{key:sidx,style:{display:"flex",justifyContent:"space-between",padding:"2px 6px",background:"var(--dsw-alias-bg-layer-3)",borderRadius:"4px"}},_h("span",null,(st.status==="success"?"\u2705 ":"\u274C ")+st.title),_h("span",{style:{color:"var(--dsw-alias-label-tertiary)",fontSize:"11px"}},(st.durationMs||0)+"ms"))))),run.gitDiff&&run.gitDiff.hasChanges&&_h("div",{className:"dsh-cron-status-banner",style:{marginTop:"8px",display:"flex",flexDirection:"column",gap:"6px"}},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},_h("strong",null,"\u{1F4DD} "+T_KEY(t,"history.gitDiff")),_h("span",{style:{fontSize:"11px",color:"var(--dsw-alias-label-secondary)"}},run.gitDiff.stat||"")),run.gitDiff.diff&&_h("div",{style:{background:"var(--dsw-alias-bg-layer-2)",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"4px",padding:"6px",fontFamily:"monospace",fontSize:"11px",maxHeight:"140px",overflowY:"auto",whiteSpace:"pre"}},run.gitDiff.diff),_h("div",{style:{display:"flex",gap:"8px",marginTop:"4px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"12px"},onClick:async()=>{if(!confirm("Discard all uncommitted changes in task directory?"))return;const c=typeof AbortController!=="undefined"?new AbortController:null;const tId=c?setTimeout(()=>c.abort(),15e3):null;try{const res=await fetch("/dsh-cron/tasks/"+encodeURIComponent(formId)+"/git-diff/discard",{method:"POST",signal:c?c.signal:void 0});const d=await res.json();if(d.ok){alert("Working directory reset successfully.");if(formId)loadTaskHistory(formId)}else alert(d.error||"Failed to discard changes")}catch(e){alert(e.message)}finally{if(tId)clearTimeout(tId)}}},"\u{1F5D1}\uFE0F "+T_KEY(t,"history.discardDiff")),_h("button",{type:"button",className:"dsh-cron-btn-primary",style:{padding:"2px 8px",fontSize:"12px"},onClick:async()=>{const c=typeof AbortController!=="undefined"?new AbortController:null;const tId=c?setTimeout(()=>c.abort(),15e3):null;try{const res=await fetch("/dsh-cron/tasks/"+encodeURIComponent(formId)+"/git-diff/apply",{method:"POST",headers:{"Content-Type":"application/json"},signal:c?c.signal:void 0,body:JSON.stringify({diff:run.gitDiff.diff})});const d=await res.json();if(d.ok){alert("Patch applied successfully.");if(formId)loadTaskHistory(formId)}else alert(d.error||"Failed to apply patch")}catch(e){alert(e.message)}finally{if(tId)clearTimeout(tId)}}},"\u2705 "+T_KEY(t,"history.applyDiff")))),run.silentSkip&&_h("div",{className:"dsh-cron-hint",style:{display:"flex",gap:"6px",alignItems:"center"}},_h("span",{className:"dsh-cron-badge-ref"},T_KEY(t,"history.silentSkip")),_h("span",null,run.silentReason||"")),run.output&&_h("div",{className:"dsh-cron-history-output"},run.output),run.error&&_h("div",{className:"dsh-cron-history-output",style:{color:"var(--dsh-cron-danger)",borderColor:"var(--dsh-cron-danger-bg)"}},run.error),run.sessionId&&_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{marginTop:"8px",fontSize:"12px",padding:"4px 10px"},onClick:()=>openSession(ctx,run.sessionId)},T_KEY(t,"history.openSession"))))),_h("div",{className:"dsh-cron-modal-foot",style:{marginTop:"18px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:()=>{if(formId)loadTaskHistory(formId)}},T_KEY(t,"history.refresh")),_h("button",{type:"button",className:"dsh-cron-btn-primary",onClick:closeManualModalWithConfirm},T_KEY(t,"modal.close")))):_h("form",{onSubmit:handleSaveManual},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.nameLabel")),_h("input",{required:true,autoFocus:true,value:formTitle,placeholder:T_KEY(t,"form.namePlaceholder"),onChange:e=>setFormTitle(e.target.value)})),_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.typeLabel")),_h("select",{value:formType,onChange:e=>setFormType(e.target.value)},_h("option",{value:"llm"},T_KEY(t,"form.typeLlm")),_h("option",{value:"script"},T_KEY(t,"form.typeScript")),_h("option",{value:"node"},T_KEY(t,"form.typeNode")),_h("option",{value:"python"},T_KEY(t,"form.typePython")),_h("option",{value:"http"},T_KEY(t,"form.typeHttp")),_h("option",{value:"ssh"},T_KEY(t,"form.typeSsh")),_h("option",{value:"docker"},T_KEY(t,"form.typeDocker")),_h("option",{value:"skill"},T_KEY(t,"form.typeSkill")),_h("option",{value:"workflow"},T_KEY(t,"form.typeWorkflow")),_h("option",{value:"digest"},T_KEY(t,"form.typeDigest")))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.scheduleLabel")),_h("input",{required:true,value:formSchedule,placeholder:T_KEY(t,"form.schedulePlaceholder"),onChange:e=>setFormSchedule(e.target.value)}),_h("div",{style:{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"5px"}},[{label:"15m",expr:"*/15 * * * *"},{label:"1h",expr:"0 * * * *"},{label:"Daily 09:00",expr:"0 9 * * *"},{label:"Weekdays",expr:"0 9 * * 1-5"},{label:"Weekly Mon",expr:"0 9 * * 1"}].map(p=>_h("button",{key:p.label,type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 7px",fontSize:"11px",borderRadius:"4px"},onClick:()=>{setFormSchedule(p.expr);handlePreviewSchedule(p.expr)}},p.label))),_h("div",{style:{display:"flex",gap:"8px",alignItems:"center",marginTop:"6px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"3px 8px",fontSize:"11.5px"},onClick:()=>handlePreviewSchedule(formSchedule)},T_KEY(t,"form.previewSchedule")),schedulePreviewRuns&&schedulePreviewRuns.length>0&&_h("div",{style:{fontSize:"11px",color:"var(--dsw-alias-label-secondary, #999)"}},T_KEY(t,"form.previewScheduleTitle")+" "+schedulePreviewRuns.slice(0,3).map(r=>new Date(r).toLocaleTimeString()).join(", "))))),_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.timeoutLabel")),_h("input",{type:"number",min:1,value:formTimeoutSeconds,placeholder:"1800",onChange:e=>setFormTimeoutSeconds(e.target.value)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.overlapLabel")),_h("select",{value:formOverlapPolicy,onChange:e=>setFormOverlapPolicy(e.target.value)},_h("option",{value:"skip"},T_KEY(t,"form.overlapSkip")),_h("option",{value:"queue"},T_KEY(t,"form.overlapQueue")),_h("option",{value:"replace"},T_KEY(t,"form.overlapReplace"))))),_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.timezoneLabel")),_h("input",{value:formTimezone,placeholder:T_KEY(t,"form.timezonePlaceholder"),onChange:e=>setFormTimezone(e.target.value)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.misfireLabel")),_h("select",{value:formMisfirePolicy,onChange:e=>setFormMisfirePolicy(e.target.value)},_h("option",{value:"skip"},T_KEY(t,"form.misfireSkip")),_h("option",{value:"runOnce"},T_KEY(t,"form.misfireRunOnce")),_h("option",{value:"catchUpAll"},T_KEY(t,"form.misfireCatchUp"))))),AGENT_FORM_TYPES.includes(formType)?_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.retriesLabel")),_h("input",{type:"number",min:0,value:formMaxRetries,placeholder:"0",onChange:e=>setFormMaxRetries(e.target.value)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.permissionLabel")),_h("select",{value:formPermissionPreset,onChange:e=>setFormPermissionPreset(e.target.value)},_h("option",{value:"default"},T_KEY(t,"form.permissionDefault")),_h("option",{value:"read-only"},T_KEY(t,"form.permissionReadonly")),_h("option",{value:"workspace-write"},T_KEY(t,"form.permissionWrite")),_h("option",{value:"danger-full-access"},T_KEY(t,"form.permissionFull"))))):_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.retriesLabel")),_h("input",{type:"number",min:0,value:formMaxRetries,placeholder:"0",onChange:e=>setFormMaxRetries(e.target.value)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.kanbanLabel")),_h("select",{value:formKanbanMode,onChange:e=>setFormKanbanMode(e.target.value)},_h("option",{value:"none"},T_KEY(t,"form.kanbanNone")),_h("option",{value:"on_failure"},T_KEY(t,"form.kanbanOnFailure")),_h("option",{value:"always"},T_KEY(t,"form.kanbanAlways")))),AGENT_FORM_TYPES.includes(formType)&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.agentPresetLabel")),_h("input",{type:"text",value:formAgentPreset,placeholder:T_KEY(t,"form.agentPresetPlaceholder"),onChange:e=>setFormAgentPreset(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.agentPresetHint"))),AGENT_FORM_TYPES.includes(formType)&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.sessionTitleLabel")),_h("input",{type:"text",value:formSessionTitle,placeholder:T_KEY(t,"form.sessionTitlePlaceholder"),onChange:e=>setFormSessionTitle(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.sessionTitleHint"))),AGENT_FORM_TYPES.includes(formType)&&_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.targetSessionIdLabel")),_h("input",{type:"text",value:formTargetSessionId,placeholder:T_KEY(t,"form.targetSessionIdPlaceholder"),onChange:e=>setFormTargetSessionId(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.targetSessionIdHint"))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.targetSessionResetLabel")),_h("select",{value:formTargetSessionReset,onChange:e=>setFormTargetSessionReset(e.target.value)},_h("option",{value:"never"},T_KEY(t,"form.targetSessionResetNever")),_h("option",{value:"daily"},T_KEY(t,"form.targetSessionResetDaily")),_h("option",{value:"weekly"},T_KEY(t,"form.targetSessionResetWeekly"))),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.targetSessionResetHint")))),AGENT_FORM_TYPES.includes(formType)&&_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.providerLabel")),_h("select",{value:formProvider,onChange:handleProviderChange},_h("option",{value:""},T_KEY(t,"form.providerDefault")),providers.map(p=>_h("option",{key:p.id,value:p.id},p.name||p.id)))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.modelLabel")),_h("select",{value:formModel,onChange:e=>setFormModel(e.target.value)},_h("option",{value:""},T_KEY(t,"form.modelDefault")),models.map(m=>_h("option",{key:m.id,value:m.id},m.name||m.id)))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.fallbackModelLabel")),_h("input",{type:"text",value:formFallbackModel,placeholder:T_KEY(t,"form.fallbackModelPlaceholder"),onChange:e=>setFormFallbackModel(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.fallbackModelHint"))),_h("label",{className:"dsh-cron-checkbox-row",style:{marginTop:"4px"}},_h("input",{type:"checkbox",checked:formInspectOnFailure,onChange:e=>setFormInspectOnFailure(e.target.checked)}),_h("span",null,T_KEY(t,"form.inspectOnFailureLabel"))),formInspectOnFailure&&_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.inspectOnFailureHint")),_h("label",{className:"dsh-cron-checkbox-row",style:{marginTop:"8px"}},_h("input",{type:"checkbox",checked:formRequireApproval,onChange:e=>setFormRequireApproval(e.target.checked)}),_h("span",null,T_KEY(t,"form.requireApprovalLabel"))),formRequireApproval&&_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.requireApprovalHint"))),formType==="http"&&_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.httpMethodLabel")),_h("select",{value:formHttpMethod,onChange:e=>setFormHttpMethod(e.target.value)},["GET","POST","PUT","PATCH","DELETE","HEAD"].map(m=>_h("option",{key:m,value:m},m)))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.httpUrlLabel")),_h("input",{required:true,value:formHttpUrl,placeholder:"https://example.test/webhook",onChange:e=>setFormHttpUrl(e.target.value)}))),formType==="http"&&_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.httpHeadersLabel")),_h("input",{value:formHttpHeaders,placeholder:'{"Authorization":"Bearer ..."}',onChange:e=>setFormHttpHeaders(e.target.value)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.httpBodyLabel")),_h("input",{value:formHttpBody,onChange:e=>setFormHttpBody(e.target.value)}))),formType==="ssh"&&_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.sshProfileLabel")),_h("input",{value:formSshProfileId,placeholder:"prod-web",onChange:e=>setFormSshProfileId(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.sshProfileHint"))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.sshTargetLabel")),_h("input",{value:formSshTarget,placeholder:"user@example.com",onChange:e=>setFormSshTarget(e.target.value)}),_h("input",{style:{marginTop:"6px"},value:formSshKeyPath,placeholder:"~/.ssh/id_ed25519",onChange:e=>setFormSshKeyPath(e.target.value)}))),formType==="docker"&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.dockerImageLabel")),_h("input",{required:true,value:formDockerImage,placeholder:"alpine:3.20",onChange:e=>setFormDockerImage(e.target.value)})),formType==="skill"&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.skillNameLabel")),_h("input",{value:formSkillName,placeholder:"gitea",onChange:e=>setFormSkillName(e.target.value)})),formType==="workflow"&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.workflowNameLabel")),_h("input",{value:formWorkflowName,placeholder:"nightly-release",onChange:e=>setFormWorkflowName(e.target.value)})),(formType==="node"||formType==="python")&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,formType==="node"?"Node.js binary (optional)":"Python interpreter (optional)"),_h("input",{value:formType==="node"?formNodePath:formPythonPath,placeholder:formType==="node"?"auto":".venv/bin/python",onChange:e=>formType==="node"?setFormNodePath(e.target.value):setFormPythonPath(e.target.value)})),!AGENT_FORM_TYPES.includes(formType)&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.envLabel")),_h("textarea",{rows:3,style:{fontFamily:"monospace",fontSize:"12.5px"},value:formEnv,placeholder:T_KEY(t,"form.envPlaceholder"),onChange:e=>setFormEnv(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.envHint"))),_h("div",{className:"dsh-cron-form-row"},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.cwdLabel")),_h("input",{value:formCwd,placeholder:"/srv/app",onChange:e=>setFormCwd(e.target.value)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.workspaceLabel")),_h("input",{value:formWorkspaceId,onChange:e=>setFormWorkspaceId(e.target.value)}))),AGENT_FORM_TYPES.includes(formType)&&_h("div",{className:"dsh-cron-form-group"},_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:formWorktree,onChange:e=>setFormWorktree(e.target.checked)}),_h("span",null,T_KEY(t,"form.worktreeLabel"))),formWorktree&&_h("label",{className:"dsh-cron-checkbox-row",style:{marginLeft:"24px",marginTop:"6px"}},_h("input",{type:"checkbox",checked:formKeepWorktree,onChange:e=>setFormKeepWorktree(e.target.checked)}),_h("span",null,T_KEY(t,"form.keepWorktreeLabel"))),_h("label",{className:"dsh-cron-checkbox-row",style:{marginLeft:formWorktree?"24px":"0px",marginTop:"6px"}},_h("input",{type:"checkbox",checked:formCaptureGitDiff,onChange:e=>setFormCaptureGitDiff(e.target.checked)}),_h("span",null,T_KEY(t,"form.captureGitDiffLabel")))),formType!=="http"&&_h("div",{className:"dsh-cron-form-group"},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"4px"}},_h("label",{style:{margin:0}},AGENT_FORM_TYPES.includes(formType)?T_KEY(t,"form.promptLabelLlm"):T_KEY(t,"form.promptLabelScript")),selectedTaskMeta&&selectedTaskMeta.promptHistory&&selectedTaskMeta.promptHistory.length>0?_h("div",{style:{display:"flex",gap:"6px",alignItems:"center"}},_h("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"4px",background:"var(--dsw-alias-bg-layer-3, #222)",color:"var(--dsh-cron-info, #4af)",border:"1px solid var(--dsw-alias-border-l2, #333)"}},"v"+(selectedTaskMeta.promptVersion||1)+" ("+(selectedTaskMeta.promptHistory[selectedTaskMeta.promptHistory.length-1]?.successRate!==void 0?Math.round(selectedTaskMeta.promptHistory[selectedTaskMeta.promptHistory.length-1].successRate*100):100)+"% SR)"),_h("select",{style:{fontSize:"11px",padding:"1px 4px",background:"var(--dsw-alias-bg-base, #111)",color:"var(--dsw-alias-label-primary, #ddd)",border:"1px solid var(--dsw-alias-border-l2, #333)",borderRadius:"4px"},onChange:e=>{const targetV=Number(e.target.value);const entry=selectedTaskMeta.promptHistory.find(rev=>rev.version===targetV);if(entry&&entry.prompt){setFormPrompt(entry.prompt)}}},selectedTaskMeta.promptHistory.map(rev=>_h("option",{key:rev.version,value:rev.version},"v"+rev.version+" ("+Math.round((rev.successRate||1)*100)+"%)")))):null),_h("textarea",{required:true,rows:9,style:{fontFamily:"monospace",fontSize:"12.5px",lineHeight:"1.45"},value:formPrompt,placeholder:AGENT_FORM_TYPES.includes(formType)?T_KEY(t,"form.promptPlaceholderLlm"):formType==="docker"?"python -V":formType==="ssh"?"uname -a":formType==="node"?'console.log("hello")':formType==="python"?'print("hello")':T_KEY(t,"form.promptPlaceholderScript"),onChange:e=>setFormPrompt(e.target.value)})),_h("div",{style:{background:"var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 2%, transparent))",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"8px",padding:"12px 14px",marginBottom:"16px"}},_h("div",{style:{fontWeight:500,fontSize:"13px",color:"var(--dsw-alias-label-primary, #eee)",marginBottom:"8px",display:"flex",alignItems:"center",gap:"6px"}},_h("span",{style:{display:"flex",alignItems:"center",color:"var(--dsh-cron-info)"},...iconHtml(ICON_TELEGRAM)}),T_KEY(t,"form.notifyTitle")),_h("label",{className:"dsh-cron-checkbox-row",style:{marginBottom:formNotifyTelegram?"8px":"0"}},_h("input",{type:"checkbox",checked:formNotifyTelegram,onChange:e=>setFormNotifyTelegram(e.target.checked)}),_h("span",null,T_KEY(t,"form.notifyTelegram"))),(formNotifyTelegram||formChannels.length>0)&&_h("label",{className:"dsh-cron-checkbox-row",style:{marginLeft:"24px",marginTop:"6px"}},_h("input",{type:"checkbox",checked:formOnlyOnFailure,onChange:e=>setFormOnlyOnFailure(e.target.checked)}),_h("span",null,T_KEY(t,"form.notifyOnlyFailure"))),_h("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid var(--dsw-alias-border-l2)"}},_h("div",{style:{fontWeight:500,fontSize:"12.5px",color:"var(--dsw-alias-label-secondary, #aaa)",marginBottom:"8px"}},T_KEY(t,"form.channelsTitle")),_h("div",{className:"dsh-cron-channel-grid"},...DELIVERY_CHANNELS.map(id=>_h("label",{key:id,className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:formChannels.indexOf(id)>=0,onChange:e=>{setFormChannels(prev=>{const set=new Set(prev);if(e.target.checked)set.add(id);else set.delete(id);return DELIVERY_CHANNELS.filter(c=>set.has(c))})}}),_h("span",null,T_KEY(t,CHANNEL_LABEL_KEYS[id]))))),_h("div",{className:"dsh-cron-hint",style:{marginTop:"6px"}},T_KEY(t,"form.channelsHint"))),_h("div",{className:"dsh-cron-form-group",style:{marginTop:"12px",marginBottom:0}},_h("label",null,T_KEY(t,"form.templateLabel")),_h("input",{type:"text",value:formTemplate,placeholder:T_KEY(t,"form.templatePlaceholder"),onChange:e=>setFormTemplate(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.templateHint"))),!AGENT_FORM_TYPES.includes(formType)&&_h("div",{className:"dsh-cron-form-group",style:{marginTop:"12px",marginBottom:0}},_h("label",null,T_KEY(t,"form.silentRuleLabel")),_h("input",{type:"text",value:formSilentRule,placeholder:T_KEY(t,"form.silentRulePlaceholder"),onChange:e=>setFormSilentRule(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.silentRuleHint")))),_h("div",{style:{marginTop:"16px",paddingTop:"14px",borderTop:"1px solid var(--dsw-alias-border-l2)"}},_h("div",{style:{fontWeight:"600",fontSize:"13px",marginBottom:"10px"}},T_KEY(t,"form.reliabilityTitle")),_h("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"}},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.preflightLabel")),_h("select",{value:formPreflightType,onChange:e=>setFormPreflightType(e.target.value)},_h("option",{value:"none"},T_KEY(t,"form.preflightNone")),_h("option",{value:"http"},T_KEY(t,"form.preflightHttp")),_h("option",{value:"shell"},T_KEY(t,"form.preflightShell")),_h("option",{value:"disk"},T_KEY(t,"form.preflightDisk")))),formPreflightType!=="none"&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.preflightTargetLabel")),_h("input",{type:"text",value:formPreflightTarget,placeholder:T_KEY(t,"form.preflightTargetPlaceholder"),onChange:e=>setFormPreflightTarget(e.target.value)}))),_h("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"}},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.heartbeatIntervalLabel")),_h("input",{type:"number",value:formHeartbeatIntervalSeconds,min:0,onChange:e=>setFormHeartbeatIntervalSeconds(Number(e.target.value))})),formHeartbeatIntervalSeconds>0&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.gracePeriodLabel")),_h("input",{type:"number",value:formGracePeriodSeconds,min:1,onChange:e=>setFormGracePeriodSeconds(Number(e.target.value))}))),_h("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"}},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.priorityLabel")),_h("input",{type:"number",value:formPriority,min:1,max:10,onChange:e=>setFormPriority(Number(e.target.value))})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.concurrencyGroupLabel")),_h("input",{type:"text",value:formConcurrencyGroup,onChange:e=>setFormConcurrencyGroup(e.target.value)}))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.workWindowHoursLabel")),_h("input",{type:"text",value:formWorkWindowHours,placeholder:T_KEY(t,"form.workWindowHoursPlaceholder"),onChange:e=>setFormWorkWindowHours(e.target.value)})),formWorkWindowHours.trim()&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.workWindowPolicyLabel")),_h("select",{value:formWorkWindowPolicy,onChange:e=>setFormWorkWindowPolicy(e.target.value)},_h("option",{value:"skip"},T_KEY(t,"form.workWindowPolicySkip")),_h("option",{value:"defer"},T_KEY(t,"form.workWindowPolicyDefer")))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.timeBoxMinutesLabel")),_h("input",{type:"number",min:0,value:formTimeBoxMinutes,onChange:e=>setFormTimeBoxMinutes(parseInt(e.target.value,10)||0)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.wakeTriggerTypeLabel")),_h("select",{value:formWakeTriggerType,onChange:e=>setFormWakeTriggerType(e.target.value)},_h("option",{value:"none"},T_KEY(t,"form.wakeTriggerTypeNone")),_h("option",{value:"file_count"},T_KEY(t,"form.wakeTriggerTypeFileCount")),_h("option",{value:"marker_file"},T_KEY(t,"form.wakeTriggerTypeMarkerFile")),_h("option",{value:"process_exit"},T_KEY(t,"form.wakeTriggerTypeProcessExit")))),formWakeTriggerType!=="none"&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.wakeTriggerPathLabel")),_h("input",{type:"text",value:formWakeTriggerPath,placeholder:T_KEY(t,"form.wakeTriggerPathPlaceholder"),onChange:e=>setFormWakeTriggerPath(e.target.value)})),formWakeTriggerType==="file_count"&&_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.wakeTriggerMinCountLabel")),_h("input",{type:"number",min:1,value:formWakeTriggerMinCount,onChange:e=>setFormWakeTriggerMinCount(parseInt(e.target.value,10)||1)})),(formWakeTriggerType==="marker_file"||formWakeTriggerType==="process_exit")&&_h("div",{className:"dsh-cron-form-group dsh-cron-form-checkbox"},_h("label",null,_h("input",{type:"checkbox",checked:formWakeTriggerConsume,onChange:e=>setFormWakeTriggerConsume(e.target.checked)}),_h("span",null,T_KEY(t,"form.wakeTriggerConsumeLabel")))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.writeScopesLabel")),_h("input",{type:"text",value:formWriteScopes,placeholder:T_KEY(t,"form.writeScopesPlaceholder"),onChange:e=>setFormWriteScopes(e.target.value)})),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.inputHashPathsLabel")),_h("input",{type:"text",value:formInputHashPaths,placeholder:T_KEY(t,"form.inputHashPathsPlaceholder"),onChange:e=>setFormInputHashPaths(e.target.value)})),_h("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},_h("input",{type:"checkbox",id:"formSkipIfUnchangedCheckbox",checked:formSkipIfUnchanged,onChange:e=>setFormSkipIfUnchanged(e.target.checked)}),_h("label",{htmlFor:"formSkipIfUnchangedCheckbox",style:{margin:0,cursor:"pointer",fontSize:"13px"}},T_KEY(t,"form.skipIfUnchangedLabel"))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.selfHealingLabel")),_h("input",{type:"text",value:formSelfHealingCommand,placeholder:T_KEY(t,"form.selfHealingPlaceholder"),onChange:e=>setFormSelfHealingCommand(e.target.value)})),_h("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},_h("input",{type:"checkbox",id:"formAutoDiagnoseCheckbox",checked:formAutoDiagnose,onChange:e=>setFormAutoDiagnose(e.target.checked)}),_h("label",{htmlFor:"formAutoDiagnoseCheckbox",style:{margin:0,fontSize:"12.5px",cursor:"pointer"}},T_KEY(t,"form.autoDiagnoseLabel")))),_h("div",{style:{marginTop:"16px",paddingTop:"14px",borderTop:"1px solid var(--dsw-alias-border-l2)"}},_h("div",{style:{fontWeight:"600",fontSize:"13px",marginBottom:"10px"}},"\u26D3\uFE0F "+T_KEY(t,"form.chainingTitle")),_h("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"}},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.onSuccessLabel")),_h("input",{type:"text",value:formOnSuccess,placeholder:"task-build, task-test",onChange:e=>setFormOnSuccess(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.onSuccessHint"))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.onFailureLabel")),_h("input",{type:"text",value:formOnFailure,placeholder:"task-alert",onChange:e=>setFormOnFailure(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.onFailureHint")))),_h("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:"10px",marginTop:"8px"}},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.dependsOnLabel")),_h("input",{type:"text",value:formDependsOn,placeholder:"task-build, task-lint",onChange:e=>setFormDependsOn(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.dependsOnHint"))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"form.joinPolicyLabel")),_h("select",{value:formJoinPolicy,onChange:e=>setFormJoinPolicy(e.target.value)},_h("option",{value:"all_success"},T_KEY(t,"form.joinPolicyAll")),_h("option",{value:"any_success"},T_KEY(t,"form.joinPolicyAny"))))),_h("div",{className:"dsh-cron-form-group",style:{marginTop:"8px"}},_h("label",null,T_KEY(t,"form.elseTaskLabel")),_h("input",{type:"text",value:formElseTask||"",placeholder:T_KEY(t,"form.elseTaskPlaceholder"),onChange:e=>setFormElseTask(e.target.value)}),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.elseTaskHint"))),_h("div",{className:"dsh-cron-form-group",style:{marginTop:"8px"}},_h("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"}},_h("input",{type:"checkbox",checked:Boolean(formAutoHeal),onChange:e=>setFormAutoHeal(e.target.checked)}),_h("span",{style:{fontWeight:"600"}},"\u{1FA7A} "+T_KEY(t,"form.autoHealLabel"))),_h("div",{className:"dsh-cron-hint"},T_KEY(t,"form.autoHealHint"))),_h("div",{style:{marginTop:"12px",padding:"10px",background:"var(--dsw-alias-bg-layer-2)",borderRadius:"6px"}},_h("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontWeight:"500"}},_h("input",{type:"checkbox",checked:formAdaptiveEnabled,onChange:e=>setFormAdaptiveEnabled(e.target.checked)}),T_KEY(t,"form.adaptiveEnabled")),_h("div",{className:"dsh-cron-hint",style:{marginLeft:"24px"}},T_KEY(t,"form.adaptiveHint")),formAdaptiveEnabled&&_h("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:"8px",marginTop:"8px",marginLeft:"24px"}},_h("div",null,_h("label",{style:{fontSize:"11px"}},"Min"),_h("input",{type:"text",value:formAdaptiveMinInterval,placeholder:"5m",onChange:e=>setFormAdaptiveMinInterval(e.target.value)})),_h("div",null,_h("label",{style:{fontSize:"11px"}},"Max"),_h("input",{type:"text",value:formAdaptiveMaxInterval,placeholder:"2h",onChange:e=>setFormAdaptiveMaxInterval(e.target.value)})),_h("div",null,_h("label",{style:{fontSize:"11px"}},"Factor"),_h("input",{type:"number",step:"0.1",value:formAdaptiveBackoffFactor,placeholder:"1.5",onChange:e=>setFormAdaptiveBackoffFactor(e.target.value)})),_h("div",null,_h("label",{style:{fontSize:"11px"}},"Idle Runs"),_h("input",{type:"number",value:formAdaptiveIdleThreshold,placeholder:"3",onChange:e=>setFormAdaptiveIdleThreshold(e.target.value)}))))),selectedTaskMeta&&_h("div",{style:{background:"var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent))",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"8px",padding:"10px 14px",fontSize:"12.5px",color:"var(--dsw-alias-label-secondary, #999)",marginBottom:"16px",display:"flex",justifyContent:"space-between",alignItems:"center"}},_h("div",null,_h("span",null,T_KEY(t,"form.nextRunLabel")),_h("strong",{style:{color:"var(--dsw-alias-label-primary, #eee)"}},selectedTaskMeta.nextRunAt?new Date(selectedTaskMeta.nextRunAt).toLocaleString():T_KEY(t,"form.notScheduled"))),_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"4px 10px",fontSize:"12px"},onClick:async()=>{await handleRunNow(selectedTaskMeta.id);if(formId)loadTaskHistory(formId)}},T_KEY(t,"actions.runNow"))),_h("div",{className:"dsh-cron-modal-foot"},_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:closeManualModalWithConfirm},T_KEY(t,"modal.cancel")),_h("button",{type:"submit",className:"dsh-cron-btn-primary"},formId?T_KEY(t,"modal.save"):T_KEY(t,"modal.create")))))),dryRunResult&&_h("div",{className:"dsh-cron-modal-overlay",onClick:()=>setDryRunResult(null)},_h("div",{className:"dsh-cron-modal",style:{maxWidth:"580px"},role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{className:"dsh-cron-modal-head",style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},_h("div",{className:"dsh-cron-modal-title",style:{margin:0}},T_KEY(t,"dryRun.title")),_h("button",{type:"button",className:"dsh-cron-icon-btn",onClick:()=>setDryRunResult(null)},"\u2715")),_h("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"8px",fontSize:"13px"}},_h("div",null,_h("strong",null,T_KEY(t,"dryRun.status")+": "),_h("span",{style:{color:dryRunResult.ok?"var(--dsh-cron-success)":"var(--dsh-cron-danger)"}},dryRunResult.ok?dryRunResult.result&&dryRunResult.result.status||dryRunResult.status||"success":"failed")),(dryRunResult.result&&dryRunResult.result.preflight||dryRunResult.preflight)&&_h("div",null,_h("strong",null,T_KEY(t,"dryRun.preflight")+": "),_h("span",null,(dryRunResult.result&&dryRunResult.result.preflight||dryRunResult.preflight).passed?"\u2713 Passed":"\u2717 Failed ("+((dryRunResult.result&&dryRunResult.result.preflight||dryRunResult.preflight).reason||"")+")")),_h("div",null,_h("strong",null,T_KEY(t,"dryRun.duration")+": "),_h("span",null,(((dryRunResult.result&&dryRunResult.result.durationMs)!==void 0?dryRunResult.result.durationMs:dryRunResult.durationMs)||0)+"ms")),_h("div",{style:{marginTop:"6px"}},_h("strong",null,T_KEY(t,"dryRun.output")+":")),_h("pre",{style:{background:"var(--dsw-alias-bg-layer-2)",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"6px",padding:"10px",maxHeight:"220px",overflowY:"auto",fontSize:"12px",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--dsw-alias-label-primary)"}},(dryRunResult.result&&dryRunResult.result.output)!==void 0?dryRunResult.result.output:dryRunResult.output!==void 0?dryRunResult.output:dryRunResult.result&&dryRunResult.result.error||dryRunResult.error||"(no output)")),_h("div",{className:"dsh-cron-modal-foot",style:{marginTop:"16px"}},_h("button",{type:"button",className:"dsh-cron-btn-primary",onClick:()=>setDryRunResult(null)},T_KEY(t,"dryRun.close"))))),archiveModalOpen&&_h("div",{className:"dsh-cron-modal-overlay",onClick:()=>setArchiveModalOpen(false)},_h("div",{className:"dsh-cron-modal",style:{maxWidth:"700px"},role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{className:"dsh-cron-modal-head",style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},_h("div",{className:"dsh-cron-modal-title",style:{margin:0}},T_KEY(t,"archive.title")+(archiveTask?" - "+archiveTask.title:"")),_h("button",{type:"button",className:"dsh-cron-icon-btn",onClick:()=>setArchiveModalOpen(false)},"\u2715")),_h("div",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #999)",margin:"4px 0 12px 0"}},T_KEY(t,"archive.totalRuns",{total:archiveTotal})),archiveLoading?_h("div",{className:"dsh-cron-history-empty"},T_KEY(t,"history.loading")):archiveRuns.length===0?_h("div",{className:"dsh-cron-history-empty"},T_KEY(t,"archive.empty")):_h("div",{style:{display:"flex",flexDirection:"column",gap:"8px",maxHeight:"380px",overflowY:"auto"}},archiveRuns.map((r,idx)=>_h("div",{key:idx,style:{background:"var(--dsw-alias-bg-layer-2)",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"6px",padding:"8px 12px",fontSize:"12px"}},_h("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"}},_h("span",{style:{fontWeight:"600",color:r.status==="success"?"var(--dsh-cron-success)":"var(--dsh-cron-danger)"}},(r.status||"unknown").toUpperCase()),_h("span",{style:{color:"var(--dsw-alias-label-secondary, #888)"}},r.at||r.timestamp||r.startedAt?new Date(r.at||r.timestamp||r.startedAt).toLocaleString():"")),r.durationMs>0&&_h("div",{style:{color:"var(--dsw-alias-label-secondary, #888)",marginBottom:"4px"}},"Duration: "+r.durationMs+"ms"),r.chainRunId&&_h("div",{style:{marginBottom:"4px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"2px 8px",fontSize:"11px",display:"inline-flex",alignItems:"center",gap:"4px"},onClick:()=>openChainGraphModal(null,r.chainRunId)},"\u{1F578}\uFE0F "+T_KEY(t,"chainGraph.viewGraph"))),r.error&&_h("div",{style:{color:"var(--dsh-cron-danger)",marginBottom:"4px"}},"Error: "+r.error),r.output&&_h("div",{style:{color:"var(--dsw-alias-label-primary, #ccc)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"80px",overflowY:"auto"}},r.output.slice(0,300)+(r.output.length>300?"...":""))))),_h("div",{className:"dsh-cron-modal-foot",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"16px"}},archiveRuns.length<archiveTotal?_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:()=>{const nextOffset=archiveRuns.length;if(archiveTask)openArchiveModal(archiveTask,nextOffset)}},T_KEY(t,"archive.loadMore",{shown:archiveRuns.length,total:archiveTotal})):_h("div",null),_h("button",{type:"button",className:"dsh-cron-btn-primary",onClick:()=>setArchiveModalOpen(false)},T_KEY(t,"archive.close"))))),settingsModalOpen&&_h("div",{className:"dsh-cron-modal-overlay",onClick:()=>setSettingsModalOpen(false)},_h("div",{className:"dsh-cron-modal dsh-cron-modal-scroll",role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{className:"dsh-cron-modal-head",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"18px"}},_h("div",{className:"dsh-cron-modal-title",style:{margin:0,display:"flex",alignItems:"center",gap:"8px"}},_h("span",{style:{display:"flex",alignItems:"center",color:"var(--dsh-cron-info)"},...iconHtml(ICON_TELEGRAM)}),T_KEY(t,"settings.modalTitle")),_h("button",{type:"button",style:{background:"none",border:"none",color:"var(--dsw-alias-label-tertiary, #888)",cursor:"pointer",fontSize:"18px"},onClick:()=>setSettingsModalOpen(false)},"\u2715")),_h("form",{onSubmit:handleSaveSettings},_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"settings.tokenLabel")),_h("input",{type:"password",value:settingsBotToken,placeholder:settingsHasDefault?T_KEY(t,"settings.tokenPlaceholderDefault"):T_KEY(t,"settings.tokenPlaceholder"),onChange:e=>setSettingsBotToken(e.target.value)}),settingsHasDefault&&_h("div",{className:"dsh-cron-hint"},T_KEY(t,"settings.defaultHint"))),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"settings.chatIdLabel")),_h("input",{value:settingsChatId,placeholder:T_KEY(t,"settings.chatIdPlaceholder"),onChange:e=>setSettingsChatId(e.target.value)})),_h("div",{style:{background:"var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 2%, transparent))",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"8px",padding:"12px 14px",marginBottom:"16px"}},_h("label",{className:"dsh-cron-checkbox-row",style:{marginBottom:"8px"}},_h("input",{type:"checkbox",checked:settingsNotifyGlobal,onChange:e=>setSettingsNotifyGlobal(e.target.checked)}),_h("span",null,T_KEY(t,"settings.globalNotify"))),_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:settingsOnlyOnFailureGlobal,onChange:e=>setSettingsOnlyOnFailureGlobal(e.target.checked)}),_h("span",null,T_KEY(t,"settings.globalOnlyFailure")))),...renderDeliverySettings({T:(key,vars)=>T_KEY(t,key,vars),values:settingsDelivery,onChange:updateDelivery,onChannelTemplate:updateChannelTemplate,sections:settingsSections,onToggleSection:toggleDeliverySection}),_h("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},disabled:testStatus?.loading,onClick:handleTestTelegram},testStatus?.loading?T_KEY(t,"settings.sending"):T_KEY(t,"settings.testTelegram"))),testStatus&&testStatus.message&&_h("div",{className:"dsh-cron-status-banner","data-type":testStatus.success?"success":"error"},testStatus.message),_h("div",{className:"dsh-cron-modal-foot"},_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:()=>setSettingsModalOpen(false)},T_KEY(t,"modal.cancel")),_h("button",{type:"submit",className:"dsh-cron-btn-primary"},T_KEY(t,"settings.save")))))),importDoc&&_h("div",{className:"dsh-cron-modal-overlay",onClick:()=>!transferBusy&&setImportDoc(null)},_h("div",{className:"dsh-cron-modal",role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{className:"dsh-cron-modal-title"},T_KEY(t,"transfer.importTitleModal")),_h("div",{className:"dsh-cron-hint",style:{marginBottom:"10px"}},T_KEY(t,"transfer.importHint")),importSummary&&_h("div",null,_h("div",{style:{fontSize:"13px",marginBottom:"12px"}},T_KEY(t,"transfer.summary",{total:(importSummary.add||0)+(importSummary.replace||0)+(importSummary.skip||0),add:importSummary.add||0,replace:importSummary.replace||0,skip:importSummary.skip||0})),_h("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"14px"}},...["add","replace","skip"].map(mode=>_h("label",{key:mode,className:"dsh-cron-checkbox-row"},_h("input",{type:"radio",name:"dsh-cron-import-strategy",checked:importStrategy===mode,onChange:()=>setImportStrategy(mode)}),_h("span",null,T_KEY(t,mode==="add"?"transfer.strategyAdd":mode==="replace"?"transfer.strategyReplace":"transfer.strategySkip")))))),_h("div",{className:"dsh-cron-modal-foot"},_h("button",{type:"button",className:"dsh-cron-btn-secondary",disabled:transferBusy,onClick:()=>setImportDoc(null)},T_KEY(t,"modal.cancel")),_h("button",{type:"button",className:"dsh-cron-btn-primary",disabled:transferBusy||!importSummary,onClick:handleImportConfirm},T_KEY(t,"transfer.confirm"))))),dshModalOpen&&_h("div",{className:"dsh-cron-modal-overlay",onClick:()=>!dshLoading&&setDshModalOpen(false)},_h("div",{className:"dsh-cron-modal",role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation()},_h("div",{className:"dsh-cron-modal-title"},T_KEY(t,"dsh.modalTitle")),_h("div",{className:"dsh-cron-form-group"},_h("label",null,T_KEY(t,"dsh.descLabel")),_h("div",{className:"dsh-cron-chat-box"},_h("textarea",{className:"dsh-cron-chat-input",rows:4,autoFocus:true,disabled:dshLoading,placeholder:T_KEY(t,"dsh.placeholder"),value:dshPrompt,onKeyDown:e=>{if(e.key==="Enter"&&(e.metaKey||e.ctrlKey)){e.preventDefault();handleStartWithDSH()}},onChange:e=>setDshPrompt(e.target.value)}),_h("div",{className:"dsh-cron-chat-foot"},_h("span",{className:"dsh-cron-chat-hint"},T_KEY(t,"dsh.sendHint")),_h("button",{type:"button",className:"dsh-cron-send-btn",disabled:dshLoading||!dshPrompt.trim(),title:T_KEY(t,"dsh.sendTitle"),onClick:handleStartWithDSH},_h("span",svgProps(ICON_SEND)))))),_h("div",{className:"dsh-cron-modal-foot"},_h("button",{type:"button",className:"dsh-cron-btn-secondary",disabled:dshLoading,onClick:()=>setDshModalOpen(false)},T_KEY(t,"modal.cancel"))))),renderChainGraphModal({isOpen:chainGraphModalOpen,onClose:()=>setChainGraphModalOpen(false),data:chainGraphData,loading:chainGraphLoading,onRetry:handleRetryChainStep,t}),renderLiveLogsModal({isOpen:liveLogsModalOpen,onClose:handleCloseLiveLogs,taskId:liveLogsTaskId,taskTitle:liveLogsTaskTitle,logs:liveLogsLines,autoScroll:liveLogsAutoScroll,onToggleAutoScroll:()=>setLiveLogsAutoScroll(v=>!v),completed:liveLogsCompleted,status:liveLogsStatus,t}),renderAnalyticsDigestModal({isOpen:digestOpen,onClose:()=>setDigestOpen(false),digestData,isLoading:digestLoading,periodDays,onSelectPeriod,onSendTelegram,sendStatus,t}),renderTimelineHeatmapModal({isOpen:timelineOpen,onClose:()=>setTimelineOpen(false),activeTab:timelineTab,onSelectTab:onSelectTimelineTab,timelineData,heatmapData,isLoading:timelineLoading,t}))}function CronSettingsCard(props){const{ctx,toggle}=props;const t=props.t||translate;const[token,setToken]=React.useState("");const[chatId,setChatId]=React.useState("");const[notify,setNotify]=React.useState(false);const[onlyFailure,setOnlyFailure]=React.useState(false);const[llmActionsEnabled,setLlmActionsEnabled]=React.useState(false);const[enableDynamicCredentials,setEnableDynamicCredentials]=React.useState(false);const[showChatHeaderButton,setShowChatHeaderButton]=React.useState(Boolean(currentHeaderSettings.showChatHeaderButton!==false));const[showChatHeaderActions,setShowChatHeaderActions]=React.useState(Boolean(currentHeaderSettings.showChatHeaderActions!==false));const[kanbanUrl,setKanbanUrl]=React.useState("http://127.0.0.1:3000");const[delivery,setDelivery]=React.useState({});const[sections,setSections]=React.useState({channels:true});const[hasDefault,setHasDefault]=React.useState(false);const[saved,setSaved]=React.useState(false);const[testInfo,setTestInfo]=React.useState(null);const[cardOpen,setCardOpen]=React.useState(false);const[updateState,setUpdateState]=React.useState({checking:false,updating:false,currentVersion:"",latestVersion:void 0,updateAvailable:false,notice:null,error:null});const checkUpdates=async()=>{setUpdateState(prev=>({...prev,checking:true,error:null,notice:null}));try{const{res,data}=await fetchJsonWithTimeout("/api/dsh-cron/update");if(data&&data.currentVersion){setUpdateState(prev=>({...prev,checking:false,currentVersion:data.currentVersion,latestVersion:data.latestVersion,updateAvailable:Boolean(data.updateAvailable),error:data.latestCheckFailed?"Registry check failed":null}))}else{setUpdateState(prev=>({...prev,checking:false,error:data.error||"Check failed"}))}}catch(err){setUpdateState(prev=>({...prev,checking:false,error:err.message}))}};const runUpdate=async()=>{setUpdateState(prev=>({...prev,updating:true,error:null,notice:null}));try{const{res,data}=await fetchJsonWithTimeout("/api/dsh-cron/update",{method:"POST",headers:{"Content-Type":"application/json","x-dsh-plugin-update":"1"}});if(data&&data.updated){setUpdateState(prev=>({...prev,updating:false,updateAvailable:false,currentVersion:data.updatedVersion||data.latestVersion,notice:T_KEY(t,"updater.success",{version:data.updatedVersion||data.latestVersion})}))}else{setUpdateState(prev=>({...prev,updating:false,error:data.error||data.message||"Update failed"}))}}catch(err){setUpdateState(prev=>({...prev,updating:false,error:err.message}))}};const[loadState,setLoadState]=React.useState("loading");const[reloadTick,setReloadTick]=React.useState(0);React.useEffect(()=>{let active=true;setLoadState("loading");fetchJsonWithTimeout("/dsh-cron/settings").then(({data})=>{if(!active)return;if(data&&data.ok&&data.settings){setToken(data.settings.botToken||"");setChatId(data.settings.chatId||"");setNotify(Boolean(data.settings.notifyTelegram));setOnlyFailure(Boolean(data.settings.onlyOnFailure));setLlmActionsEnabled(Boolean(data.settings.llmActionsEnabled));setEnableDynamicCredentials(Boolean(data.settings.enableDynamicCredentials));const btnVis=data.settings.showChatHeaderButton!==false;const actVis=data.settings.showChatHeaderActions!==false;setShowChatHeaderButton(btnVis);setShowChatHeaderActions(actVis);updateHeaderSettings({showChatHeaderButton:btnVis,showChatHeaderActions:actVis});setKanbanUrl(data.settings.kanbanBaseUrl||"http://127.0.0.1:3000");setDelivery(pickDeliverySettings(data.settings));setHasDefault(Boolean(data.settings.hasDefaultCredentials));if(data.settings.version){setUpdateState(prev=>({...prev,currentVersion:data.settings.version}))}setLoadState("ready")}else{setLoadState("error")}}).catch(()=>{if(active)setLoadState("error")});return()=>{active=false}},[reloadTick]);const saveSettings=async e=>{if(e)e.preventDefault();try{const{res,data}=await fetchJsonWithTimeout("/dsh-cron/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({botToken:token,chatId,notifyTelegram:notify,onlyOnFailure:onlyFailure,llmActionsEnabled,enableDynamicCredentials,showChatHeaderButton,showChatHeaderActions,kanbanBaseUrl:kanbanUrl},delivery))});if(data&&data.ok){setSaved(true);setTimeout(()=>setSaved(false),2500)}}catch(err){console.debug("[dsh-cron] save settings failed",err)}};const testTelegram=async()=>{setTestInfo({loading:true,message:T_KEY(t,"settings.sending")});try{const{res,data}=await fetchJsonWithTimeout("/dsh-cron/telegram/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:token,chatId})});if(data&&data.ok){setTestInfo({success:true,message:T_KEY(t,"settings.testOk")})}else{setTestInfo({success:false,message:T_KEY(t,"settings.testFail",{error:data&&data.error||""})})}}catch(err){setTestInfo({success:false,message:T_KEY(t,"settings.testFail",{error:err.message})})}};const testKanban=async()=>{setTestInfo({loading:true,message:T_KEY(t,"settings.checkingKanban")});try{const{res,data}=await fetchJsonWithTimeout("/dsh-cron/kanban/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kanbanBaseUrl:kanbanUrl})});if(data&&data.ok){setTestInfo({success:true,message:T_KEY(t,"settings.kanbanOk")})}else{setTestInfo({success:false,message:T_KEY(t,"settings.kanbanFail",{error:data&&data.error||""})})}}catch(err){setTestInfo({success:false,message:T_KEY(t,"settings.kanbanFail",{error:err.message})})}};if(loadState!=="ready"){return _h("div",{className:"dsh-cron-card"},_h("div",{className:"dsh-cron-card-title"},T_KEY(t,"settings.cardTitle")),_h("div",{className:"dsh-cron-status-banner","data-type":loadState==="error"?"error":"info",style:{marginTop:"10px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"10px"}},_h("span",null,loadState==="error"?T_KEY(t,"settings.unavailable"):T_KEY(t,"settings.loading")),loadState==="error"&&_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:()=>setReloadTick(x=>x+1)},T_KEY(t,"settings.retry"))))}if(props&&props.view==="summary"){return _h("span",{className:"dsh-cron-card-desc"},T_KEY(t,"settings.cardDesc"))}const page=!!(props&&props.view==="page");return _h("div",{className:page?"dsh-cron-page":"dsh-cron-card"},_h("button",{type:"button",className:"dsh-cron-card-head-btn",style:page?{display:"none"}:void 0,"aria-expanded":page||cardOpen?"true":"false",onClick:()=>setCardOpen(!cardOpen)},_h("span",{className:"dsh-cron-card-title"},T_KEY(t,"settings.cardTitle")),_h("span",{className:"dsh-cron-chev"+(cardOpen?" dsh-cron-chev-open":"")},chevronNode())),(page||cardOpen)&&_h("div",{className:"dsh-cron-card-body"},_h("div",{className:"dsh-cron-card-desc"},T_KEY(t,"settings.cardDesc")),_h("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"12px"}},_h("button",{type:"button",className:"dsh-cron-btn-primary",onClick:()=>{if(toggle)toggle.set(true)}},T_KEY(t,"settings.openPanel"))),_h("form",{onSubmit:saveSettings,style:{display:"flex",flexDirection:"column",gap:"12px"}},_h("div",{className:"dsh-cron-form-group",style:{marginBottom:0}},_h("label",null,T_KEY(t,"settings.tokenLabel")),_h("input",{type:"password",value:token,placeholder:hasDefault?T_KEY(t,"settings.tokenPlaceholderDefault"):T_KEY(t,"settings.tokenPlaceholder"),onChange:e=>setToken(e.target.value)}),hasDefault&&_h("div",{className:"dsh-cron-hint"},T_KEY(t,"settings.defaultHint"))),_h("div",{className:"dsh-cron-form-group",style:{marginBottom:0}},_h("label",null,T_KEY(t,"settings.chatIdLabel")),_h("input",{value:chatId,placeholder:T_KEY(t,"settings.chatIdPlaceholder"),onChange:e=>setChatId(e.target.value)})),_h("div",{className:"dsh-cron-form-group",style:{marginBottom:0}},_h("label",null,T_KEY(t,"settings.kanbanUrlLabel")),_h("input",{value:kanbanUrl,placeholder:"http://127.0.0.1:3000",onChange:e=>setKanbanUrl(e.target.value)})),_h("div",{style:{background:"var(--dsw-alias-bg-layer-3, color-mix(in srgb, var(--dsw-alias-label-primary) 2%, transparent))",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:"6px",padding:"10px 12px",display:"flex",flexDirection:"column",gap:"8px"}},_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:notify,onChange:e=>setNotify(e.target.checked)}),_h("span",null,T_KEY(t,"settings.globalNotify"))),_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:onlyFailure,onChange:e=>setOnlyFailure(e.target.checked)}),_h("span",null,T_KEY(t,"settings.globalOnlyFailure"))),_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:llmActionsEnabled,onChange:e=>setLlmActionsEnabled(e.target.checked)}),_h("span",null,"Enable Structured LLM Actions (trigger tasks, notify, create issues)")),_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:enableDynamicCredentials,onChange:e=>setEnableDynamicCredentials(e.target.checked)}),_h("span",null,T_KEY(t,"settings.dynamicCredentials"))),_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:showChatHeaderButton,onChange:e=>{const val=e.target.checked;setShowChatHeaderButton(val);updateHeaderSettings({showChatHeaderButton:val})}}),_h("span",null,T_KEY(t,"settings.showChatHeaderButton"))),_h("label",{className:"dsh-cron-checkbox-row"},_h("input",{type:"checkbox",checked:showChatHeaderActions,onChange:e=>{const val=e.target.checked;setShowChatHeaderActions(val);updateHeaderSettings({showChatHeaderActions:val})}}),_h("span",null,T_KEY(t,"settings.showChatHeaderActions")))),...renderDeliverySettings({T:(key,vars)=>T_KEY(t,key,vars),values:delivery,onChange:(key,value)=>setDelivery(prev=>{const next=Object.assign({},prev);if(value===void 0)delete next[key];else next[key]=value;return next}),onChannelTemplate:(channelId,value)=>setDelivery(prev=>{const templates=Object.assign({},prev.channelTemplates||{});if(value&&value.trim())templates[channelId]=value;else delete templates[channelId];return Object.assign({},prev,{channelTemplates:templates})}),sections,onToggleSection:key=>setSections(prev=>Object.assign({},prev,{[key]:!prev[key]}))}),testInfo&&testInfo.message&&_h("div",{className:"dsh-cron-status-banner","data-type":testInfo.success?"success":"error",style:{margin:0,padding:"8px 12px"}},testInfo.message),_h("div",{className:"dsh-cron-form-group",style:{background:"var(--dsw-alias-bg-layer-2, color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent))",border:"1px solid var(--dsw-alias-border-l2, color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent))",borderRadius:"8px",padding:"14px",marginBottom:"16px"}},_h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},_h("div",{style:{fontWeight:"600",fontSize:"14px"}},`\u{1F680} ${T_KEY(t,"updater.title")}`),_h("div",{style:{display:"flex",gap:"8px"}},_h("button",{type:"button",className:"dsh-cron-btn-secondary",style:{padding:"4px 10px",fontSize:"12px"},disabled:updateState.checking||updateState.updating,onClick:checkUpdates},updateState.checking?T_KEY(t,"updater.checking"):T_KEY(t,"updater.btnCheck")),updateState.updateAvailable?_h("button",{type:"button",className:"dsh-cron-btn-primary",style:{padding:"4px 10px",fontSize:"12px"},disabled:updateState.updating,onClick:runUpdate},updateState.updating?T_KEY(t,"updater.updating"):T_KEY(t,"updater.btnUpdate",{version:updateState.latestVersion})):null)),_h("div",{style:{fontSize:"12px",color:"var(--dsw-alias-label-secondary, #999)",marginBottom:"8px"}},T_KEY(t,"updater.desc")),_h("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"13px"}},_h("span",{style:{color:"var(--dsw-alias-label-secondary, #aaa)"}},updateState.currentVersion?T_KEY(t,"updater.current",{version:updateState.currentVersion}):""),updateState.checking?_h("span",{className:"dsh-cron-badge dsh-cron-badge-info"},T_KEY(t,"updater.checking")):updateState.updateAvailable?_h("span",{className:"dsh-cron-badge dsh-cron-badge-warn"},T_KEY(t,"updater.available",{version:updateState.latestVersion})):updateState.currentVersion&&!updateState.error&&!updateState.checking?_h("span",{className:"dsh-cron-badge dsh-cron-badge-ok"},`\u2713 ${T_KEY(t,"updater.upToDate")}`):null),updateState.notice?_h("div",{style:{marginTop:"8px",color:"var(--dsw-alias-success)",fontSize:"12px"}},updateState.notice):null,updateState.error?_h("div",{style:{marginTop:"8px",color:"var(--dsw-alias-error)",fontSize:"12px"}},updateState.error):null),_h("div",{style:{display:"flex",gap:"8px",alignItems:"center",flexWrap:"wrap",marginTop:"4px"}},_h("button",{type:"submit",className:"dsh-cron-btn-primary",style:{minWidth:"140px"}},saved?T_KEY(t,"settings.saved"):T_KEY(t,"settings.save")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:testTelegram,disabled:testInfo?.loading},T_KEY(t,"settings.testTelegram")),_h("button",{type:"button",className:"dsh-cron-btn-secondary",onClick:testKanban,disabled:testInfo?.loading},T_KEY(t,"settings.testKanban"))))))}function sessionIdOf(ctx,props){try{if(typeof props==="string"&&props)return props;if(props&&typeof props.sessionId==="string"&&props.sessionId)return props.sessionId;if(props&&props.session&&props.session.id)return String(props.session.id);if(props&&props.session&&props.session.sessionId)return String(props.session.sessionId);if(props&&props.input&&props.input.sessionId)return String(props.input.sessionId);if(ctx&&ctx.scope&&ctx.scope.session)return String(ctx.scope.session.id||ctx.scope.session.header?.id||"");if(ctx&&typeof ctx.scope?.id==="string")return ctx.scope.id;if(ctx&&ctx.session)return String(ctx.session.id||ctx.session.header?.id||"")}catch(_e){void _e}return""}function SessionQuickActionBar(props){const visible=useHeaderVisibility("showChatHeaderActions");const{ctx,toggle}=props;const barT=props.t||translate;const[tasks,setTasks]=React.useState([]);const[isRunning,setIsRunning]=React.useState(false);const[runSuccess,setRunSuccess]=React.useState(false);const sessionId=sessionIdOf(ctx,props);React.useEffect(()=>{if(!visible)return;let unmounted=false;const fetchTasks=async()=>{try{const{res,data}=await fetchJsonWithTimeout("/dsh-cron/tasks");void res;if(!unmounted&&data&&Array.isArray(data.tasks)){setTasks(data.tasks)}}catch(_e){void _e}};fetchTasks();const timer=setInterval(fetchTasks,15e3);return()=>{unmounted=true;clearInterval(timer)}},[sessionId]);const linkedTask=React.useMemo(()=>{if(!sessionId||!tasks.length)return null;return tasks.find(t=>t.lastSessionId===sessionId||t.targetSessionId===sessionId||t.id===sessionId)},[sessionId,tasks]);const handleOpenLinked=e=>{e.preventDefault();e.stopPropagation();if(linkedTask){pendingTaskHighlight=linkedTask.id}toggle.set(true)};const handleCreateRecurring=e=>{e.preventDefault();e.stopPropagation();const sessionObj=props.session||ctx&&ctx.scope&&ctx.scope.session;const titleVal=sessionObj&&(sessionObj.title||sessionObj.name)||"";pendingTaskPreset={title:titleVal?titleVal+" (Cron)":"",targetSessionId:sessionId||"",type:"llm",schedule:"0 9 * * 1-5"};if(typeof window!=="undefined"&&typeof window.dispatchEvent==="function"){try{window.dispatchEvent(new CustomEvent("dsh-cron:preset",{detail:pendingTaskPreset}))}catch(_e){void _e}}toggle.set(true)};const handleQuickRun=async e=>{e.preventDefault();e.stopPropagation();if(!linkedTask||isRunning)return;setIsRunning(true);setRunSuccess(false);try{const{res,data}=await fetchJsonWithTimeout("/dsh-cron/tasks/"+encodeURIComponent(linkedTask.id)+"/run",{method:"POST"});void res;if(data&&data.ok){setRunSuccess(true);setTimeout(()=>setRunSuccess(false),3e3)}}catch(_err){void _err}finally{setIsRunning(false)}};if(!visible)return null;if(linkedTask){const running=linkedTask.running||isRunning;return _h("div",{className:"dsh-cron-session-bar","data-dsh-plugin":"dsh-cron"},[_h("span",{key:"icon",className:"dsh-cron-session-bar-icon",dangerouslySetInnerHTML:{__html:ICON_TIMER}}),_h("button",{key:"badge",type:"button",className:"dsh-cron-session-badge"+(running?" dsh-cron-pulse":""),title:linkedTask.title||linkedTask.id,onClick:handleOpenLinked},linkedTask.title||linkedTask.id),_h("button",{key:"run-btn",type:"button",className:"dsh-cron-session-run-btn",disabled:running,title:T_KEY(barT,"sessionBar.runNow"),onClick:handleQuickRun},running?"...":runSuccess?"\u2714":T_KEY(barT,"sessionBar.run"))])}return _h("button",{type:"button",className:"dsh-cron-session-add-btn","data-dsh-plugin":"dsh-cron",title:T_KEY(barT,"sessionBar.addRecurringHint"),"aria-label":T_KEY(barT,"sessionBar.addRecurring"),onClick:handleCreateRecurring},[_h("span",{key:"icon",className:"dsh-cron-session-bar-icon",dangerouslySetInnerHTML:{__html:ICON_TIMER}}),_h("span",{key:"label"},T_KEY(barT,"sessionBar.addRecurring"))])}const SIDEBAR_JOBS_KEY="dsh-cron-sidebar-open";const SIDEBAR_JOBS_MAX_ROWS=5;function buildSidebarJobRow(state,task){const row=document.createElement("button");row.type="button";row.className="dsh-cron-sidebar-job";row.setAttribute("data-sidebar-task-id",task.id);row.setAttribute("aria-label",task.title||task.id);const title=document.createElement("span");title.className="dsh-cron-sidebar-job-title";title.textContent=task.title||task.id;row.appendChild(title);const meta=document.createElement("span");meta.className="dsh-cron-sidebar-job-meta";if(task.running)meta.textContent=T("list.runningNow");else if(task.nextRunAt)meta.textContent=new Date(task.nextRunAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});else meta.textContent=task.scheduleText||task.schedule||"";row.appendChild(meta);if(task.running)row.classList.add("dsh-cron-pulse");row.addEventListener("click",event=>{event.preventDefault();event.stopPropagation();state.openTaskSignal(task.id);if(!state.toggle.isOpen())state.toggle.toggle()});return row}function renderSidebarJobs(state,tasks){const listEl=state.listEl;if(!listEl)return;listEl.innerHTML="";if(!tasks.length){const empty=document.createElement("div");empty.className="dsh-cron-sidebar-empty";empty.textContent=T("sidebar.noActiveJobs");listEl.appendChild(empty);return}for(const task of tasks.slice(0,SIDEBAR_JOBS_MAX_ROWS))listEl.appendChild(buildSidebarJobRow(state,task));if(tasks.length>SIDEBAR_JOBS_MAX_ROWS){const more=document.createElement("div");more.className="dsh-cron-sidebar-more";more.textContent=T("sidebar.moreJobs",{count:tasks.length-SIDEBAR_JOBS_MAX_ROWS});listEl.appendChild(more)}}async function loadSidebarJobs(state){try{const{res,data}=await fetchJsonWithTimeout("/dsh-cron/tasks?status=active");if(data&&data.ok)renderSidebarJobs(state,data.tasks||[])}catch(err){console.debug("[dsh-cron] load sidebar jobs failed",err)}}function applySidebarJobsOpen(state){if(!state.root)return;state.root.dataset.open=state.open?"true":"false";if(state.headEl)state.headEl.setAttribute("aria-expanded",state.open?"true":"false");if(state.open)loadSidebarJobs(state)}function buildSidebarJobsRoot(state,label){const root=document.createElement("div");root.className="dsh-cron-sidebar-jobs";root.setAttribute("data-dsh-plugin","dsh-cron");root.setAttribute("data-dsh-part","sidebar-jobs");const headEl=document.createElement("button");headEl.type="button";headEl.className="dsh-cron-sidebar-jobs-head";headEl.setAttribute("aria-expanded",state.open?"true":"false");headEl.textContent=label;headEl.addEventListener("click",event=>{event.preventDefault();event.stopPropagation();state.open=!state.open;try{window.localStorage.setItem(SIDEBAR_JOBS_KEY,state.open?"1":"0")}catch(err){void err}applySidebarJobsOpen(state)});root.appendChild(headEl);const listEl=document.createElement("div");listEl.className="dsh-cron-sidebar-jobs-list";root.appendChild(listEl);state.root=root;state.headEl=headEl;state.listEl=listEl;return root}function placeSidebarJobs(state,label){const entry=resolveSidebarAnchor();if(sidebarJobsSeatIsCurrent(state,entry))return;if(entry===null||entry.parentElement===null)return;if(state.root===void 0){entry.insertAdjacentElement("afterend",buildSidebarJobsRoot(state,label))}else{entry.insertAdjacentElement("afterend",state.root);state.root=document.querySelector('[data-dsh-part="sidebar-jobs"]')||state.root;state.listEl=state.root.querySelector(".dsh-cron-sidebar-jobs-list");state.headEl=state.root.querySelector(".dsh-cron-sidebar-jobs-head")}applySidebarJobsOpen(state)}function mountSidebarJobs(toggle,label,openTaskSignal){if(typeof document==="undefined")return()=>{};const state={toggle,openTaskSignal,root:void 0,listEl:void 0,headEl:void 0,open:false};try{state.open=window.localStorage.getItem(SIDEBAR_JOBS_KEY)==="1"}catch(err){void err}let rafPending=false;const schedulePlace=()=>{if(sidebarJobsSeatIsCurrent(state,resolveSidebarAnchor()))return;if(rafPending)return;rafPending=true;const scheduleFn=typeof requestAnimationFrame==="function"?requestAnimationFrame:cb=>setTimeout(cb,16);scheduleFn(()=>{rafPending=false;placeSidebarJobs(state,label)})};const observer=new MutationObserver(schedulePlace);observer.observe(document.body,{childList:true,subtree:true});placeSidebarJobs(state,label);loadSidebarJobs(state);const fetchTimer=setInterval(()=>{let isOpen=false;try{isOpen=window.localStorage.getItem(SIDEBAR_JOBS_KEY)==="1"}catch(err){void err}if(isOpen)loadSidebarJobs(state)},3e4);return()=>{observer.disconnect();clearInterval(fetchTimer);if(state.root!==void 0&&state.root.isConnected)state.root.remove();state.root=void 0}}let shellOverlayActive=false;function mountCronScreen(ctx,toggle){if(typeof document==="undefined")return()=>{};let root;let container;const teardownPanel=()=>{if(root!==void 0){try{root.unmount()}catch(e){void e}root=void 0}if(container!==void 0){try{container.remove()}catch(e){void e}container=void 0}};const ensure=()=>{if(!toggle.isOpen()){teardownPanel();return}if(shellOverlayActive){teardownPanel();return}if(container!==void 0&&container.isConnected)return;const column=document.querySelector(COLUMN_SELECTOR);if(column===null)return;container=document.createElement("div");container.setAttribute(VIEW_ATTR,"");container.setAttribute("data-dsh-plugin","dsh-cron");column.appendChild(container);if(ReactDOM&&typeof ReactDOM.createRoot==="function"){root=ReactDOM.createRoot(container);root.render(_h(ErrorBoundary,null,_h(CronScreen,{ctx,toggle,onClose:()=>toggle.set(false),t:translate})))}else if(ReactDOM&&typeof ReactDOM.render==="function"){ReactDOM.render(_h(CronScreen,{ctx,toggle,onClose:()=>toggle.set(false),t:translate}),container)}};const applyActive=()=>{if(toggle.isOpen()){ensureStyles();document.documentElement.setAttribute(ACTIVE_ATTR,"");document.dispatchEvent(new CustomEvent(ACTIVATE_EVENT,{detail:PANEL}));ensure()}else{document.documentElement.removeAttribute(ACTIVE_ATTR);teardownPanel()}};const onOtherActivate=event=>{if(event.detail!==PANEL&&toggle.isOpen())toggle.set(false)};const onOutsideClick=event=>{if(shellOverlayActive)return;if(!toggle.isOpen())return;if(!shouldDismissPanel(event.target))return;toggle.set(false)};const waitObserver=new MutationObserver(ensure);waitObserver.observe(document.body,{childList:true,subtree:true});document.addEventListener(ACTIVATE_EVENT,onOtherActivate);document.addEventListener("click",onOutsideClick,true);const unsubscribe=toggle.subscribe(applyActive);applyActive();ensure();return()=>{waitObserver.disconnect();document.removeEventListener(ACTIVATE_EVENT,onOtherActivate);document.removeEventListener("click",onOutsideClick,true);unsubscribe();document.documentElement.removeAttribute(ACTIVE_ATTR);teardownPanel()}}function registerIntoMount(ctx,mountName,entry,component){if(!ctx||!ctx.slots||typeof ctx.slots.inject!=="function")return false;try{return!!ctx.slots.inject(mountName,()=>{ctx.slots.register(entry,component)})}catch(err){console.warn("[dsh-cron] slot injection skipped:",mountName,"-",err&&err.message);return false}}function apply(ctx){const stopStyleSelfHeal=startStyleSelfHeal();try{if(ctx.locale&&typeof ctx.locale.register==="function"&&typeof ctx.effect==="function"){ctx.effect(()=>ctx.locale.register(NS,STRINGS),"dsh-cron: locale dictionaries")}else if(ctx.locale&&typeof ctx.locale.register==="function"){ctx.locale.register(NS,STRINGS)}}catch(e){void e}try{if(ctx.locale&&typeof ctx.locale.bind==="function"){translate=ctx.locale.bind(NS)}}catch(err){void err}const toggle=createToggle();function SettingsCardWithBoundary(props){return _h(ErrorBoundary,null,CronSettingsCard(props))}const itemOk=registerIntoMount(ctx,"plugins.item",{name:"plugins.item",id:ROW_ID,order:60,label:()=>"Cron",locale:NS,inject:()=>({ctx,toggle})},SettingsCardWithBoundary);if(!itemOk){console.warn("[dsh-cron] plugins.item slot unavailable \u2014 plugin page card not registered")}const rowOk=registerIntoMount(ctx,"plugins.row.config",{name:"plugins.row.config",key:ROW_CONFIG_KEY,locale:NS,inject:()=>({ctx,toggle})},SettingsCardWithBoundary);const cardOk=registerIntoMount(ctx,"settings.plugin.item",{name:"settings.plugin.item",key:NS,locale:NS,inject:()=>({ctx,toggle})},SettingsCardWithBoundary);if(!cardOk){console.warn("[dsh-cron] settings.plugin.item slot unavailable \u2014 settings card not registered")}const chipOk=registerIntoMount(ctx,"conversation.session.header.utilities",{name:"conversation.session.header.utilities",id:PLUGIN_ID+".chip",order:27,locale:NS,inject:()=>({ctx,toggle})},CronChip);const cardSlot=cardOk?"settings.plugin.item":void 0;const chipSlot=chipOk?"conversation.session.header.utilities":void 0;function CronNavIcon(props){const size=props&&props.size||16;return _h("span",{className:"dsh-cron-nav-icon","data-dsh-cron-entry":"","data-dsh-plugin":"dsh-cron",style:{width:size,height:size},onClick:()=>toggle.set(true),dangerouslySetInnerHTML:{__html:ICON_TIMER}})}const navOk=registerIntoMount(ctx,"sidebar.panellist",{name:"sidebar.panellist",id:"dsh-cron",order:12,label:()=>translate("sidebar.label"),locale:NS},CronNavIcon);function CronMainPage(props){if(shellOverlayActive)return null;return _h(ErrorBoundary,null,_h(CronScreen,{...props,ctx:props.ctx||ctx,toggle:props.toggle||toggle,t:translate,onClose:()=>{const layoutService=optionalService(ctx,"layout");if(layoutService&&typeof layoutService.selectPanel==="function"){layoutService.selectPanel(null)}toggle.set(false)}}))}const mainOk=registerIntoMount(ctx,"main",{name:"main",key:"dsh-cron",locale:NS,inject:()=>({ctx,toggle})},CronMainPage);function CronShellOverlay(){const[open,setOpen]=React.useState(toggle.isOpen());React.useEffect(()=>{shellOverlayActive=true;const off=toggle.subscribe(setOpen);setOpen(toggle.isOpen());return()=>{shellOverlayActive=false;off()}},[]);if(!open)return null;return _h("div",{className:"dsh-cron-shell-overlay","data-dsh-plugin":"dsh-cron",[VIEW_ATTR]:""},_h("div",{className:"dsh-cron-shell-overlay-inner"},_h(ErrorBoundary,null,_h(CronScreen,{ctx,toggle,pinned:true,t:translate,onClose:()=>{const layoutService=optionalService(ctx,"layout");if(layoutService&&typeof layoutService.selectPanel==="function"){layoutService.selectPanel(null)}toggle.set(false)}}))))}const isDesktopShell=(()=>{try{if(typeof location==="undefined")return false;if(location.protocol==="dsh-app:")return true;return String(location.host||"").toLowerCase()==="app"}catch(err){return false}})();if(isDesktopShell){registerIntoMount(ctx,"shell.overlay",{name:"shell.overlay",id:PLUGIN_ID,order:900,locale:NS,inject:()=>({ctx,toggle})},CronShellOverlay)}const layout=optionalService(ctx,"layout");if(layout&&typeof layout.selectPanel==="function"){toggle.subscribe(isOpen=>{if(isOpen){layout.selectPanel("dsh-cron")}else if(layout.panelInfo&&typeof layout.panelInfo.getSnapshot==="function"){if(layout.panelInfo.getSnapshot()?.activePanelId==="dsh-cron"){layout.selectPanel(null)}}});if(layout.panelInfo&&typeof layout.panelInfo.subscribe==="function"){layout.panelInfo.subscribe(()=>{const active=layout.panelInfo.getSnapshot()?.activePanelId==="dsh-cron";if(toggle.isOpen()!==active){toggle.set(active)}})}}const barOk=registerIntoMount(ctx,"conversation.session.header.actions",{name:"conversation.session.header.actions",id:PLUGIN_ID+".sessionBar",order:28,locale:NS,inject:slotParam=>{const sid=typeof slotParam==="string"?slotParam:slotParam&&(slotParam.sessionId||slotParam.id);const extra=typeof slotParam==="object"&&slotParam!==null?slotParam:{};return{ctx,toggle,sessionId:sid,...extra}}},function QuickBarBoundary(props){return _h(ErrorBoundary,null,_h(SessionQuickActionBar,props))});const barSlot=barOk?"conversation.session.header.actions":void 0;function CronChip(props){const visible=useHeaderVisibility("showChatHeaderButton");if(!visible)return null;const chipT=props.t||translate;return _h("button",{type:"button","data-dsh-plugin":"dsh-cron",style:{background:"none",border:"none",color:"var(--dsw-alias-label-secondary, #999)",cursor:"pointer",padding:"4px",display:"inline-flex",alignItems:"center"},title:T_KEY(chipT,"chip.title"),"aria-label":T_KEY(chipT,"chip.title"),onClick:()=>toggle.toggle(),dangerouslySetInnerHTML:{__html:ICON_TIMER}})}ctx.effect(()=>{const off=[mountSidebarJobs(toggle,translate("sidebar.jobsTitle"),taskId=>{pendingTaskHighlight=taskId}),mountCronScreen(ctx,toggle)];return()=>{for(const dispose of off)dispose();stopStyleSelfHeal()}},"dsh-cron: client overlay");exports.slots={card:cardSlot,chip:chipSlot,sessionBar:barSlot,nav:navOk?"sidebar.panellist":void 0,main:mainOk?"main":void 0};module.exports.panelDismissRule=shouldDismissPanel;module.exports.sidebarJobsSeatIsCurrent=sidebarJobsSeatIsCurrent;module.exports.updateHeaderSettings=updateHeaderSettings;module.exports.useHeaderVisibility=useHeaderVisibility;module.exports.getHeaderSettings=()=>currentHeaderSettings}module.exports={apply,inject:["slots","locale"]};return module.exports}});