Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: synchronize persistent mind dashboard actions

Adam Eivyeffe6dfdc41c
diff --git a/client/src/components/cos/PersistentMindContextPanel.jsx b/client/src/components/cos/PersistentMindContextPanel.jsx
index fcf467cb6f..59a412c909 100644
--- a/client/src/components/cos/PersistentMindContextPanel.jsx
+++ b/client/src/components/cos/PersistentMindContextPanel.jsx
@@ -18,7 +18,7 @@ const harnessTone = (recommendation) => recommendation === 'recommended'
? 'success'
: recommendation === 'not-recommended' ? 'warning' : 'info';
-export default function PersistentMindContextPanel({ view = 'all' }) {
+export default function PersistentMindContextPanel({ view = 'all', refreshKey = 0, onMemoriesChanged }) {
const [data, setData] = useState(null);
const [draft, setDraft] = useState(() => promptDraft(null));
const [loading, setLoading] = useState(true);
@@ -37,7 +37,12 @@ export default function PersistentMindContextPanel({ view = 'all' }) {
.finally(() => setLoading(false));
}, []);
- useEffect(() => { void load(); }, [load]);
+ useEffect(() => { void load(); }, [load, refreshKey]);
+
+ const refreshMemories = useCallback(async () => {
+ await load();
+ onMemoriesChanged?.();
+ }, [load, onMemoriesChanged]);
const savePrompt = async () => {
if (saving) return;
@@ -115,11 +120,11 @@ export default function PersistentMindContextPanel({ view = 'all' }) {
<h3 id="mind-memory-heading" className="flex items-center gap-2 text-sm font-semibold text-port-text"><Database size={16} aria-hidden="true" /> Curated memories</h3>
<p className="mt-1 text-xs text-port-text-muted">Memories created by the persistent mind and memories added here enter its bounded context automatically. You can edit them here at any time.</p>
</div>
- <MemoryCreator onCreated={load} />
+ <MemoryCreator onCreated={refreshMemories} />
<div className="mt-3 space-y-2">
{(data?.memories || []).length === 0 ? (
<p className="rounded border border-dashed border-port-border p-4 text-center text-xs text-port-text-muted">No curated memories yet.</p>
- ) : (data.memories || []).map((memory) => <MemoryEditor key={memory.id} memory={memory} onSaved={load} />)}
+ ) : (data.memories || []).map((memory) => <MemoryEditor key={memory.id} memory={memory} onSaved={refreshMemories} />)}
</div>
</section>}
diff --git a/client/src/components/cos/tabs/MindTab.jsx b/client/src/components/cos/tabs/MindTab.jsx
index 905e0425cc..6639cabb89 100644
--- a/client/src/components/cos/tabs/MindTab.jsx
+++ b/client/src/components/cos/tabs/MindTab.jsx
@@ -165,6 +165,7 @@ export default function MindTab() {
const [eventActionPending, setEventActionPending] = useState(null);
const [lifecycleError, setLifecycleError] = useState(null);
const [profileSaving, setProfileSaving] = useState(false);
+ const [contextRefreshKey, setContextRefreshKey] = useState(0);
const [showActivity, setShowActivity] = useState(false);
const [runtime, setRuntime] = useState(null);
const [runtimeError, setRuntimeError] = useState(null);
@@ -569,7 +570,7 @@ export default function MindTab() {
? runtime.inference.model
: mind?.profile?.model}
/>
- {!state?.started && <ActionButton label={profileReady ? 'Start' : 'Configure'} icon={profileReady ? CirclePlay : Settings2} disabled={loading} onClick={() => openPanel('settings')} />}
+ {!state?.started && <ActionButton label={profileReady ? 'Start' : 'Configure'} icon={profileReady ? CirclePlay : Settings2} pending={profileReady && lifecyclePending === 'start'} disabled={loading || profileSaving} onClick={() => (profileReady ? runLifecycle('start') : openPanel('settings'))} />}
{state?.started && !isPaused && <ActionButton label="Pause" icon={CirclePause} pending={lifecyclePending === 'pause'} onClick={() => runLifecycle('pause')} />}
{state?.started && isPaused && <ActionButton label="Resume" icon={CirclePlay} pending={lifecyclePending === 'resume'} onClick={() => runLifecycle('resume')} />}
{state?.started && <ActionButton label="Stop" icon={Square} pending={lifecyclePending === 'stop'} onClick={() => runLifecycle('stop')} />}
@@ -714,10 +715,10 @@ export default function MindTab() {
<div hidden={activePanel !== 'context'} className="space-y-4">
<PersistentMindRuntimePanel runtime={runtime} error={runtimeError} loading={runtimeLoading} />
<PersistentMindVisibilityPanel visibility={visibility} error={visibilityError} loading={visibilityLoading} onRefresh={() => loadVisibility({ refresh: true })} />
- <PersistentMindContextPanel view="context" />
+ <PersistentMindContextPanel view="context" refreshKey={contextRefreshKey} />
</div>
<div hidden={activePanel !== 'memories'}>
- <PersistentMindContextPanel view="memories" />
+ <PersistentMindContextPanel view="memories" onMemoriesChanged={() => setContextRefreshKey((current) => current + 1)} />
</div>
<div hidden={activePanel !== 'tools'}>
<PersistentMindTools onCapabilitiesChange={(capabilities) => setMind((current) => current ? { ...current, capabilities } : current)} />
diff --git a/client/src/components/cos/tabs/MindTab.test.jsx b/client/src/components/cos/tabs/MindTab.test.jsx
index e7bd1aedba..9969e435ae 100644
--- a/client/src/components/cos/tabs/MindTab.test.jsx
+++ b/client/src/components/cos/tabs/MindTab.test.jsx
@@ -269,6 +269,19 @@ describe('MindTab', () => {
await waitFor(() => expect(api.startPersistentMind).toHaveBeenCalledTimes(1));
});
+ it('starts a ready persistent mind directly from the dashboard header', async () => {
+ const user = userEvent.setup();
+ api.getPersistentMind.mockResolvedValue(response({
+ state: { enabled: true, started: false, status: 'idle', pauseReason: null },
+ }));
+ renderTab();
+
+ await user.click(await screen.findByRole('button', { name: 'Start' }));
+
+ await waitFor(() => expect(api.startPersistentMind).toHaveBeenCalledTimes(1));
+ expect(screen.queryByRole('dialog', { name: 'Mind workspace' })).not.toBeInTheDocument();
+ });
+
it('persists the separate opt-in task-creation grant', async () => {
const user = userEvent.setup();
renderTab('/cos/mind?panel=tools');
@@ -502,4 +515,28 @@ describe('MindTab', () => {
fireEvent.keyDown(window, { key: 'Escape' });
expect(screen.getByRole('heading', { name: 'Identity and operating prompt' })).toBeInTheDocument();
});
+
+ it('refreshes the effective context after a memory is created', async () => {
+ const user = userEvent.setup();
+ api.getPersistentMindContext.mockImplementation(() => Promise.resolve({
+ prompt: { schemaVersion: 1, identity: 'Resident mind', instructions: 'Stay grounded.' },
+ preview: {
+ text: api.getPersistentMindContext.mock.calls.length > 2 ? '# Context with new memory' : '# Original context',
+ chars: 24,
+ approximateTokens: 6,
+ summaryState: 'ready',
+ },
+ memories: [],
+ rollups: [],
+ harness: null,
+ }));
+ renderTab('/cos/mind?panel=memories');
+
+ await user.type(await screen.findByLabelText('Add a durable memory'), 'A newly curated fact');
+ await user.click(screen.getByRole('button', { name: 'Add memory' }));
+ await waitFor(() => expect(api.getPersistentMindContext.mock.calls.length).toBeGreaterThanOrEqual(4));
+ await user.click(screen.getByRole('tab', { name: 'Context' }));
+
+ expect(await screen.findByText('# Context with new memory')).toBeInTheDocument();
+ });
});