The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(bot-mode): explain hidden cronjobs in the Routines pane empty state
BkashJEE6c84c3354601
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.jsindex 75f58c1796a..25af806b04d 100644--- a/apps/desktop/src/plugins/hermes-bots/plugin.js+++ b/apps/desktop/src/plugins/hermes-bots/plugin.js@@ -6012,6 +6012,24 @@ function selectRoutineJobs(data, error, lastJobs, bot) {}}+/**+ * Why the Routines pane can be empty while the bot's cron store has jobs.+ *+ * On older gateways the pane only shows jobs namespaced `[bot:<name>]` for the+ * active bot (plus untagged legacy jobs on the default bot). When jobs exist in+ * the store but none surface for this bot, the user is left staring at the+ * generic empty state with no hint that cronjobs are present but hidden.+ * Return a short explanation string in that case, or null when the store is+ * genuinely empty (or the active bot's jobs are already shown).+ */+function routineFilterHint(all, jobs) {+ if (jobs.length !== 0 || !Array.isArray(all) || all.length === 0) {+ return null+ }+ return 'Cronjobs exist in this profile but none are tagged for this bot. ' ++ 'Name a job "[bot:<name>] …" to show it here, or see them in Cron below.'+}+function normalizedProfileName(profile) {return typeof profile === 'string' ? profile.trim().toLowerCase() : ''}@@ -6557,6 +6575,7 @@ function RoutinesPane() {const staleNotice = error && !view.live && view.all.length? 'Could not refresh cronjobs. Showing the last list we had.': null+ const filterHint = routineFilterHint(view.all, jobs)return jsxs('div', {className: 'flex h-full flex-col',@@ -6637,13 +6656,15 @@ function RoutinesPane() {jsx(Codicon, { name: 'calendar', className: 'text-[1.6rem] text-(--ui-text-quaternary)' }),jsx('div', {className: 'text-xs leading-5 text-(--ui-text-tertiary)',- children: 'Cronjobs are recurring tasks this agent runs on a schedule.'+ children: filterHint+ ? filterHint+ : 'Cronjobs are recurring tasks this agent runs on a schedule.'}),jsx(Button, {variant: 'secondary',size: 'sm',onClick: openCreate,- children: 'Create Cronjob'+ children: filterHint ? 'Create a cronjob for this bot' : 'Create Cronjob'})]})diff --git a/apps/desktop/src/plugins/hermes-bots/tests/routines-filter-hint.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/routines-filter-hint.test.mjsnew file mode 100644index 00000000000..1df7adacc8c--- /dev/null+++ b/apps/desktop/src/plugins/hermes-bots/tests/routines-filter-hint.test.mjs@@ -0,0 +1,56 @@+import assert from 'node:assert/strict'+import { readFileSync } from 'node:fs'+import test from 'node:test'+import vm from 'node:vm'++// UX improvement: when a bot's cron store HAS jobs but none are namespaced+// `[bot:<name>]` for the active bot, the Routines pane now explains why it's+// empty instead of showing the generic empty state with no hint.++const pluginSource = readFileSync(new URL('../plugin.js', import.meta.url), 'utf8')++function load() {+ const values = new Map()+ const atom = initial => {+ const slot = { get: () => values.get(slot), set: value => values.set(slot, value) }+ values.set(slot, initial)+ return slot+ }+ const context = {+ atom,+ PALETTE_AREA: 'palette',+ COMPOSER_AREAS: { middleware: 'middleware' },+ document: { getElementById: () => null, createElement: () => ({}), head: { appendChild: () => undefined } },+ host: { state: { profile: { listen: () => undefined } } }+ }+ const source = pluginSource+ .replace(/^import\s+\*\s+as\s+sdk\s+from '@hermes\/plugin-sdk'\r?\n/m, '')+ .replace(/^import\s+\{[\s\S]*?\}\s+from '@hermes\/plugin-sdk'\r?\n/m, '')+ .replace(/^const \{ McpTab, ToolsetConfigPanel \} = sdk\r?\n/m, '')+ .replace(/^import .* from 'react'\r?\n/m, '')+ .replace(/^import .* from 'react\/jsx-runtime'\r?\n/m, '')+ .replace('export default {', 'globalThis.plugin = {')+ .concat('\nglobalThis.__api = { routineFilterHint };\n')+ vm.runInNewContext(source, context, { filename: 'plugin.js' })+ return context+}++test('hint: null when the active bot already has tagged jobs', () => {+ const all = [{ name: '[bot:ops] Morning', job_id: '1' }]+ assert.equal(load().__api.routineFilterHint(all, all), null)+})++test('hint: null when the store is genuinely empty', () => {+ assert.equal(load().__api.routineFilterHint([], []), null)+ assert.equal(load().__api.routineFilterHint(undefined, []), null)+})++test('hint: explains hidden jobs when store has jobs but none match the bot', () => {+ const all = [+ { name: '[bot:research] Digest', job_id: '2' },+ { name: 'untagged job', job_id: '3' }+ ]+ const hint = load().__api.routineFilterHint(all, [])+ assert.ok(hint)+ assert.match(hint, /tagged for this bot/)+})