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

feat: submit persistent mind chat with Enter

[._.]/ Adam Eivya8f579426a99
diff --git a/client/src/components/cos/tabs/MindTab.jsx b/client/src/components/cos/tabs/MindTab.jsx
index 5da31be37d..6fb54401b9 100644
--- a/client/src/components/cos/tabs/MindTab.jsx
+++ b/client/src/components/cos/tabs/MindTab.jsx
@@ -315,6 +315,11 @@ export default function MindTab() {
setMessageText(next);
};
+ const handleMessageKeyDown = (event) => {
+ if (event.key !== 'Enter' || event.altKey || event.nativeEvent.isComposing) return;
+ void submitMessage(event);
+ };
+
const changeAnnotationText = (next) => {
if (annotationError) {
annotationDraftIdRef.current = null;
@@ -525,7 +530,7 @@ export default function MindTab() {
{submitError && <p role="alert" className="mt-2 text-sm text-port-error">{submitError} — Retry uses the same id, so it will not duplicate the input.</p>}
<div className="flex items-end gap-2 rounded-[1.35rem] border border-port-border bg-port-bg p-1.5 pl-3 focus-within:border-port-accent/70 focus-within:ring-1 focus-within:ring-port-accent/30">
<label htmlFor="mind-input-text" className="sr-only">Message</label>
- <textarea id="mind-input-text" value={messageText} onChange={(event) => changeMessageText(event.target.value)} maxLength={8000} rows={1} className="min-h-[36px] max-h-32 flex-1 resize-y bg-transparent py-2 text-sm leading-5 text-port-text outline-none placeholder:text-port-text-muted" placeholder="Message Persistent Mind" />
+ <textarea id="mind-input-text" value={messageText} onChange={(event) => changeMessageText(event.target.value)} onKeyDown={handleMessageKeyDown} maxLength={8000} rows={1} className="min-h-[36px] max-h-32 flex-1 resize-y bg-transparent py-2 text-sm leading-5 text-port-text outline-none placeholder:text-port-text-muted" placeholder="Message Persistent Mind" />
<button type="submit" disabled={!messageText.trim() || submitting} aria-label={submitting ? 'Sending message' : submitError ? 'Retry' : 'Send message'} className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-port-accent text-white transition-colors hover:bg-port-accent/85 disabled:cursor-not-allowed disabled:bg-port-border disabled:text-port-text-muted">
{submitting ? <RefreshCw size={17} className="animate-spin" aria-hidden="true" /> : <ArrowUp size={19} strokeWidth={2.5} aria-hidden="true" />}
</button>
diff --git a/client/src/components/cos/tabs/MindTab.test.jsx b/client/src/components/cos/tabs/MindTab.test.jsx
index de26e19f76..bf3ea5f9a4 100644
--- a/client/src/components/cos/tabs/MindTab.test.jsx
+++ b/client/src/components/cos/tabs/MindTab.test.jsx
@@ -1,6 +1,6 @@
import { act } from 'react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { render, screen, waitFor, within } from '@testing-library/react';
+import { createEvent, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { MemoryRouter } from 'react-router';
@@ -260,6 +260,28 @@ describe('MindTab', () => {
expect(api.sendPersistentMindMessage.mock.calls[1][0].id).toBe(firstId);
});
+ it('sends on Enter while preserving a newline for Option+Enter', async () => {
+ const user = userEvent.setup();
+ renderTab();
+ await screen.findByText('Review the next bounded slice.');
+ const message = screen.getByLabelText('Message');
+
+ await user.type(message, 'First line');
+ const optionEnter = createEvent.keyDown(message, { key: 'Enter', altKey: true });
+ fireEvent(message, optionEnter);
+ expect(optionEnter.defaultPrevented).toBe(false);
+ expect(api.sendPersistentMindMessage).not.toHaveBeenCalled();
+
+ await user.clear(message);
+ await user.type(message, 'First line\nSecond line');
+ expect(message).toHaveValue('First line\nSecond line');
+ await user.keyboard('{Enter}');
+ await waitFor(() => expect(api.sendPersistentMindMessage).toHaveBeenCalledWith(
+ { id: expect.stringMatching(/^message-/), text: 'First line\nSecond line' },
+ { silent: true },
+ ));
+ });
+
it('mints a new id when failed text is edited into a different submission', async () => {
const user = userEvent.setup();
api.sendPersistentMindMessage.mockRejectedValueOnce(new Error('Connection lost'));