The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep Bot Mode routines docked
David Dudok de Wit00e9a3245430
diff --git a/apps/desktop/src/components/pane-shell/tree/dock-enforce.test.ts b/apps/desktop/src/components/pane-shell/tree/dock-enforce.test.tsindex 12280b799fb..5a1e2c269be 100644--- a/apps/desktop/src/components/pane-shell/tree/dock-enforce.test.ts+++ b/apps/desktop/src/components/pane-shell/tree/dock-enforce.test.ts@@ -44,8 +44,8 @@ describe('enforced dock (stacked Bots pane → sessions-zone tab, every boot)',vi.resetModules()})- async function setup() {- window.localStorage.setItem(TREE_KEY, JSON.stringify(stackedTree))+ async function setupTree(initialTree: object, options: { routines?: boolean } = {}) {+ window.localStorage.setItem(TREE_KEY, JSON.stringify(initialTree))const tree = await import('@/components/pane-shell/tree/store')const model = await import('@/components/pane-shell/tree/model')@@ -76,9 +76,23 @@ describe('enforced dock (stacked Bots pane → sessions-zone tab, every boot)',render: () => null})+ if (options.routines) {+ registry.register({+ id: 'hermes-bots:routines',+ area: 'panes',+ title: 'Cronjobs',+ data: { placement: 'main', dock: { pane: 'workspace', pos: 'right', enforce: true } },+ render: () => null+ })+ }+return { model, registry, tree }}+ async function setup() {+ return setupTree(stackedTree)+ }+it('re-homes a stacked bots pane into the sessions tab strip, keeping sessions active', async () => {const { model, tree } = await setup()@@ -188,33 +202,7 @@ describe('enforced dock (stacked Bots pane → sessions-zone tab, every boot)',]}- window.localStorage.setItem(TREE_KEY, JSON.stringify(hiddenStackedTree))-- const tree = await import('@/components/pane-shell/tree/store')- const model = await import('@/components/pane-shell/tree/model')- const { registry } = await import('@/contrib/registry')-- registry.register({- id: 'workspace',- area: 'panes',- title: 'chat',- data: { placement: 'main' },- render: () => null- })- registry.register({- id: 'sessions',- area: 'panes',- title: 'sessions',- data: { placement: 'left' },- render: () => null- })- registry.register({- id: 'hermes-bots:pane',- area: 'panes',- title: 'Bots',- data: { placement: 'left', dock: { pane: 'sessions', pos: 'center', enforce: true } },- render: () => null- })+ const { model, tree } = await setupTree(hiddenStackedTree)tree.watchContributedPanes()@@ -225,4 +213,64 @@ describe('enforced dock (stacked Bots pane → sessions-zone tab, every boot)',expect(group.panes).toEqual(['sessions', 'hermes-bots:pane'])expect(group.headerHidden).not.toBe(true)})++ it('re-homes an edge-enforced pane stranded in the sessions tab strip', async () => {+ const staleRoutinesTree = {+ type: 'split',+ id: 'root',+ orientation: 'row',+ weights: [1, 3],+ children: [+ {+ type: 'group',+ id: 'g-sessions',+ panes: ['sessions', 'hermes-bots:pane', 'hermes-bots:routines'],+ active: 'hermes-bots:pane'+ },+ { type: 'group', id: 'g-main', panes: ['workspace'], active: 'workspace' }+ ]+ }++ const { model, tree } = await setupTree(staleRoutinesTree, { routines: true })++ tree.watchContributedPanes()++ const botsGroup = model.findGroupOfPane(tree.$layoutTree.get()!, 'hermes-bots:pane')!+ const routinesGroup = model.findGroupOfPane(tree.$layoutTree.get()!, 'hermes-bots:routines')!++ expect(botsGroup.panes).toEqual(['sessions', 'hermes-bots:pane'])+ expect(botsGroup.active).toBe('hermes-bots:pane')+ expect(routinesGroup.panes).toEqual(['hermes-bots:routines'])+ expect(routinesGroup.id).not.toBe(botsGroup.id)+ })++ it('leaves an edge-enforced pane alone when it already occupies the declared split', async () => {+ const dockedRoutinesTree = {+ type: 'split',+ id: 'root',+ orientation: 'row',+ weights: [1, 3, 1],+ children: [+ {+ type: 'group',+ id: 'g-sessions',+ panes: ['sessions', 'hermes-bots:pane'],+ active: 'hermes-bots:pane'+ },+ { type: 'group', id: 'g-main', panes: ['workspace'], active: 'workspace' },+ {+ type: 'group',+ id: 'g-routines',+ panes: ['hermes-bots:routines'],+ active: 'hermes-bots:routines'+ }+ ]+ }++ const { tree } = await setupTree(dockedRoutinesTree, { routines: true })++ tree.watchContributedPanes()++ expect(tree.$layoutTree.get()).toEqual(dockedRoutinesTree)+ })})diff --git a/apps/desktop/src/components/pane-shell/tree/store.ts b/apps/desktop/src/components/pane-shell/tree/store.tsindex f1d4f35e974..de8b00395f6 100644--- a/apps/desktop/src/components/pane-shell/tree/store.ts+++ b/apps/desktop/src/components/pane-shell/tree/store.ts@@ -1202,8 +1202,8 @@ interface PaneDockHint {pos: DropPosition/** Center docks: stack BEFORE this pane id (the strip divider's slot). */before?: null | string- /** Enforced dock invariant: the pane is re-homed onto this hint's center- * anchor on EVERY boot when it isn't already stacked with the anchor —+ /** Enforced dock invariant: the pane is re-homed onto this hint's anchor+ * on EVERY boot when it isn't already in the declared relationship —* no one-time token, and user placement does not exempt it. Once per* adoption lifetime (per boot), so an intra-session drag sticks until the* next boot. See `enforceDockedPanes`. */@@ -1223,13 +1223,13 @@ const enforcedDocksThisBoot = new Set<string>()/*** A `panes` contribution whose dock hint carries `enforce: true` is re-homed- * onto the hint's center anchor at every boot's first adoption pass when it- * isn't already stacked there. Unlike the retired one-time heal, nothing+ * onto the hint's anchor at every boot's first adoption pass when it isn't+ * already docked there. Unlike the retired one-time heal, nothing* exempts the pane — not a burned token, not $userPlacedPanes — because the* hint is the owner's standing invariant about where the pane lives* (Bot Mode's Bots pane IS the SESSIONS | BOTS tab strip), not a one-shot- * migration. Center re-homes only: the invariant consolidates the pane into- * its anchor's tab strip, it never re-runs arbitrary splits.+ * migration. Center hints consolidate panes into their anchor's tab strip;+ * edge hints restore the declared split beside their anchor.** Silent like adoption — the anchor zone keeps its active tab. The center* insert pins the zone's header shown, which is the point: the strip is how@@ -1244,7 +1244,7 @@ function enforceDockedPanes(for (const pane of registry.getArea('panes')) {const dock = dataOf(pane.id)?.dock- if (!dock?.enforce || dock.pos !== 'center' || !allPaneIds(next).includes(pane.id)) {+ if (!dock?.enforce || !allPaneIds(next).includes(pane.id)) {continue}@@ -1261,7 +1261,7 @@ function enforceDockedPanes(continue}- if (from.id === anchor.id) {+ if (dock.pos === 'center' && from.id === anchor.id) {// Already stacked with its anchor — but an enforced tab must be// REACHABLE, not just co-located. Community regression (Aug 2026):// persisted trees where the enforced pane was center-stacked with the@@ -1275,6 +1275,20 @@ function enforceDockedPanes(continue}+ if (dock.pos !== 'center') {+ const moved = movePaneOp(next, pane.id, {+ groupId: anchor.id,+ pos: dock.pos,+ before: dock.before+ })++ if (moved !== next) {+ next = moved+ }++ continue+ }+const without = removePane(next, pane.id)const target = without ? findGroupOfPane(without, dock.pane)?.id : undefineddiff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.jsindex c39ab1a385c..332afd13733 100644--- a/apps/desktop/src/plugins/hermes-bots/plugin.js+++ b/apps/desktop/src/plugins/hermes-bots/plugin.js@@ -9944,7 +9944,8 @@ export default {title: 'Cronjobs',data: {placement: 'main',- dock: { pane: 'workspace', pos: 'right' },+ // Repair persisted layouts that stranded Cronjobs in the Bots tab strip.+ dock: { pane: 'workspace', pos: 'right', enforce: true },width: '250px'},render: () => jsx(RoutinesPane, {})diff --git a/apps/desktop/src/plugins/hermes-bots/tests/pane-dock-layout.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/pane-dock-layout.test.mjsindex f8b85d3d604..75c70cdf2e8 100644--- a/apps/desktop/src/plugins/hermes-bots/tests/pane-dock-layout.test.mjs+++ b/apps/desktop/src/plugins/hermes-bots/tests/pane-dock-layout.test.mjs@@ -25,6 +25,7 @@ test('the Bots pane center-docks into the sessions zone as an enforced invarianttest('routines registration is a reusable disposer-returning function', () => {assert.match(source, /const registerRoutinesPane = \(\) =>\s*\n\s*ctx\.register\(\{\s*\n\s*id: 'routines'/)+ assert.match(source, /dock: \{ pane: 'workspace', pos: 'right', enforce: true \}/)})test('routines pane rides Bots visibility via feature-detected host.paneVisibility', () => {