Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(command): raise universal input limit, restore Shift+Enter split (#9352)

Peter Chinman93ffd432f061
diff --git a/apps/web/src/features/command/CommandMenu.tsx b/apps/web/src/features/command/CommandMenu.tsx
index 84c4074a76..047435371f 100644
--- a/apps/web/src/features/command/CommandMenu.tsx
+++ b/apps/web/src/features/command/CommandMenu.tsx
@@ -443,6 +443,8 @@ function CommandSearchMenu(
: CommandState.categoryFilter();
const { popoverSplit } = useSplitLayout();
+ const canOpenInNewSplit = () =>
+ globalSplitManager()?.canAppendSplit() ?? false;
const [attachHotkeys, hotkeyScope] = useHotkeyDOMScope('command-menu');
@@ -673,6 +675,24 @@ function CommandSearchMenu(
runWithInputFocused: true,
});
+ // Universal Input mounts its own menu and scope, so there Shift+Enter
+ // stays a newline in its editor.
+ const confirmSplitHotkey = registerHotkey({
+ hotkey: 'shift+enter',
+ scopeId: hotkeyScope,
+ description: () => t('commandMenu.openInNewSplit'),
+ keyDownHandler: (event) => {
+ if (event?.isComposing) return false;
+ const item = selectedItem();
+ if (item) {
+ handleItemAction(item, true);
+ return true;
+ }
+ return false;
+ },
+ runWithInputFocused: true,
+ });
+
const escapeHotkey = registerHotkey({
hotkey: 'escape',
scopeId: hotkeyScope,
@@ -934,6 +954,12 @@ function CommandSearchMenu(
command={confirmHotkey}
label={t('commandMenu.hintSearch')}
/>
+ <Show when={canOpenInNewSplit()}>
+ <HotkeyHint
+ command={confirmSplitHotkey}
+ label={t('commandMenu.hintSearchInNewSplit')}
+ />
+ </Show>
</Match>
<Match when={selectedIsAskAi()}>
<HotkeyHint
@@ -946,6 +972,12 @@ function CommandSearchMenu(
command={confirmHotkey}
label={t('commandMenu.hintOpen')}
/>
+ <Show when={canOpenInNewSplit()}>
+ <HotkeyHint
+ command={confirmSplitHotkey}
+ label={t('commandMenu.openInNewSplit')}
+ />
+ </Show>
</Match>
</Switch>
diff --git a/apps/web/src/features/command/core/universal-input-mode.test.ts b/apps/web/src/features/command/core/universal-input-mode.test.ts
index c63d6b222f..b6402505ec 100644
--- a/apps/web/src/features/command/core/universal-input-mode.test.ts
+++ b/apps/web/src/features/command/core/universal-input-mode.test.ts
@@ -3,11 +3,13 @@ import { shouldUseUniversalInput } from './universal-input-mode';
it.each([
['investor update', false],
- ['email julia tomorrow', true],
- ['dinner with julia tomorrow at 9pm', true],
- ['a'.repeat(23), false],
- ['a'.repeat(24), true],
- [' one two\nthree ', true],
+ ['email julia tomorrow', false],
+ ['a b c d e f g h i j k l m n', false],
+ ['dinner with julia tomorrow at 9pm', false],
+ ['dinner with julia tomorrow at 9:30pm', true],
+ ['a'.repeat(33), false],
+ ['a'.repeat(34), true],
+ [` ${'a'.repeat(33)} `, false],
[' investor update ', false],
])('chooses the input mode for %s', (text, expected) => {
expect(shouldUseUniversalInput(text)).toBe(expected);
diff --git a/apps/web/src/features/command/core/universal-input-mode.ts b/apps/web/src/features/command/core/universal-input-mode.ts
index bb62fed594..2d838f09c6 100644
--- a/apps/web/src/features/command/core/universal-input-mode.ts
+++ b/apps/web/src/features/command/core/universal-input-mode.ts
@@ -1,13 +1,8 @@
-const UNIVERSAL_INPUT_WORDS = 3;
-const UNIVERSAL_INPUT_CHARACTERS = 24;
+const UNIVERSAL_INPUT_CHARACTERS = 34;
/** Keep a promoted draft in composer mode until it is cleared. */
export function shouldUseUniversalInput(text: string, active = false): boolean {
const query = text.trim();
if (!query) return false;
- return (
- active ||
- query.length >= UNIVERSAL_INPUT_CHARACTERS ||
- query.split(/\s+/).length >= UNIVERSAL_INPUT_WORDS
- );
+ return active || query.length >= UNIVERSAL_INPUT_CHARACTERS;
}
diff --git a/apps/web/src/features/command/mobile/mobileSearchState.test.ts b/apps/web/src/features/command/mobile/mobileSearchState.test.ts
index 732cfaaf90..1c62f3a8ad 100644
--- a/apps/web/src/features/command/mobile/mobileSearchState.test.ts
+++ b/apps/web/src/features/command/mobile/mobileSearchState.test.ts
@@ -12,7 +12,7 @@ describe('mobile search session', () => {
const session = state.session();
state.setQuery('short search');
expect(session.universalInputActive()).toBe(false);
- state.setQuery('create a task');
+ state.setQuery('create a task for the big launch plan');
expect(session.universalInputActive()).toBe(true);
state.setQuery('short');
expect(session.universalInputActive()).toBe(true);
diff --git a/apps/web/src/features/universal-input/browser-test/command-input.browser.e2e.ts b/apps/web/src/features/universal-input/browser-test/command-input.browser.e2e.ts
index e8a0b3ffda..01dfb8828a 100644
--- a/apps/web/src/features/universal-input/browser-test/command-input.browser.e2e.ts
+++ b/apps/web/src/features/universal-input/browser-test/command-input.browser.e2e.ts
@@ -86,7 +86,7 @@ test('Command K keeps the composer for shorter edits, clears back to search, and
const dialog = await openMenu(page);
await dialog
.getByPlaceholder('Search...', { exact: true })
- .fill('dinner with julia tomorrow at 7pm');
+ .fill('dinner with julia tomorrow at 7:30pm');
const input = dialog.getByRole('textbox', {
name: 'Your input',
exact: true,
@@ -145,7 +145,7 @@ test('Command K waits for composition to finish before promotion', async ({
input.dispatchEvent(
new CompositionEvent('compositionstart', { bubbles: true })
);
- input.value = 'dinner with julia tomorrow at 7pm';
+ input.value = 'dinner with julia tomorrow at 7:30pm';
input.dispatchEvent(
new InputEvent('input', { bubbles: true, isComposing: true })
);
@@ -210,7 +210,7 @@ test('the Macro logo hides for explicit newlines and wrapping, then returns for
const dialog = await openMenu(page);
await dialog
.getByPlaceholder('Search...', { exact: true })
- .fill('Email Julia that I will be late');
+ .fill('Email Julia that I will be late today');
const input = dialog.getByRole('textbox', {
name: 'Your input',
exact: true,
@@ -221,7 +221,7 @@ test('the Macro logo hides for explicit newlines and wrapping, then returns for
await input.fill('Email Julia\nI will be late');
await expect(logo).toBeHidden();
expect((await input.boundingBox())!.x).toBe(originalLeft - 32);
- await input.fill('Email Julia that I will be late');
+ await input.fill('Email Julia that I will be late today');
await expect(logo).toBeVisible();
await input.fill(
'Email Julia that I will send the revised presentation after our meeting tomorrow'
@@ -233,7 +233,7 @@ test('the Macro logo hides for explicit newlines and wrapping, then returns for
});
for (const eligible of [false, true]) {
- test(`Shift+Enter inserts a newline in normal search (Universal Input access: ${eligible})`, async ({
+ test(`Shift+Enter opens the selected result in a new split from normal search (Universal Input access: ${eligible})`, async ({
page,
}) => {
const dialog = await openMenu(page, eligible);
@@ -242,22 +242,11 @@ for (const eligible of [false, true]) {
await expect(
dialog.getByRole('option', { name: 'Investor update', exact: true })
).toBeVisible();
- await search.press('End');
await search.press('Shift+Enter');
- await expect(search).toHaveValue('investor\n');
- await expect(search).toBeFocused();
- await expect(dialog).toBeVisible();
- await expect(page.getByTestId('opened-search-result')).toHaveText('');
- await expect(dialog.getByTestId('command-input-logo')).toBeHidden();
- await page.keyboard.type('update');
- await expect(search).toHaveValue('investor\nupdate');
- await page.keyboard.down('Shift');
- await page.keyboard.down('Enter');
- await page.keyboard.up('Shift');
- await page.keyboard.up('Enter');
- await expect(search).toHaveValue('investor\nupdate\n');
- await expect(dialog).toBeVisible();
- await expect(page.getByTestId('opened-search-result')).toHaveText('');
+ await expect(dialog).not.toBeVisible();
+ const opened = page.getByTestId('opened-search-result');
+ await expect(opened).toContainText('search-document-0');
+ await expect(opened).toContainText('"preferNewSplit":true');
});
}
@@ -267,7 +256,7 @@ test('Shift+Enter keeps Universal Input search open while browsing a result', as
const dialog = await openMenu(page);
await dialog
.getByPlaceholder('Search...', { exact: true })
- .fill('find how blowholes work');
+ .fill('find my notes on how blowholes work');
const input = dialog.getByRole('textbox', {
name: 'Your input',
exact: true,
@@ -287,7 +276,7 @@ test('Shift+Enter keeps Universal Input search open while browsing a result', as
await expect(page.getByTestId('opened-search-result')).toHaveText('');
await page.keyboard.type('in the ocean');
await expect(input.locator('p')).toHaveText([
- 'find how blowholes work',
+ 'find my notes on how blowholes work',
'in the ocean',
]);
await input.press('ArrowDown');
@@ -306,7 +295,7 @@ test('the type selector uses the shared dropdown and Escape leaves Command K ope
const dialog = await openMenu(page);
await dialog
.getByPlaceholder('Search...', { exact: true })
- .fill('find how blowholes work');
+ .fill('find my notes on how blowholes work');
const type = dialog.getByLabel('Content type');
await expect(type).toHaveText('Auto · Search');
await type.click();
@@ -317,7 +306,7 @@ test('the type selector uses the shared dropdown and Escape leaves Command K ope
await expect(type).toHaveText('Task');
await expect(
dialog.getByRole('textbox', { name: 'Your input', exact: true })
- ).toHaveText('find how blowholes work');
+ ).toHaveText('find my notes on how blowholes work');
await type.click();
await expect(
page.getByRole('option', { name: 'Task', exact: true })
@@ -339,7 +328,7 @@ test('Escape closes the calendar date picker before the Command K composer', asy
const dialog = await openMenu(page);
await dialog
.getByPlaceholder('Search...', { exact: true })
- .fill('Call John at 3pm tomorrow');
+ .fill('Call John at 3pm tomorrow afternoon');
const startDate = page.getByRole('button', {
name: 'Edit event start date',
exact: true,
diff --git a/apps/web/src/features/universal-input/browser-test/composer.browser.e2e.ts b/apps/web/src/features/universal-input/browser-test/composer.browser.e2e.ts
index 9a31c9316a..c7fe72d71f 100644
--- a/apps/web/src/features/universal-input/browser-test/composer.browser.e2e.ts
+++ b/apps/web/src/features/universal-input/browser-test/composer.browser.e2e.ts
@@ -597,7 +597,7 @@ test('keeps Command K open while searching and choosing an AI model', async ({
await page
.getByRole('button', { name: 'Open Command K', exact: true })
.click();
- const text = 'Help me plan the launch';
+ const text = 'Help me plan the next product launch';
await page.getByPlaceholder('Search...', { exact: true }).fill(text);
const dialog = page.getByRole('dialog');
const input = dialog.getByRole('textbox', {
diff --git a/apps/web/src/features/universal-input/browser-test/feature-gate.browser.e2e.ts b/apps/web/src/features/universal-input/browser-test/feature-gate.browser.e2e.ts
index 5d77a9223d..e0e706bef0 100644
--- a/apps/web/src/features/universal-input/browser-test/feature-gate.browser.e2e.ts
+++ b/apps/web/src/features/universal-input/browser-test/feature-gate.browser.e2e.ts
@@ -16,7 +16,7 @@ test('enables the composer from its rollout flag without a local preference or e
const dialog = page.getByRole('dialog');
await dialog
.getByPlaceholder('Search...', { exact: true })
- .fill('notification clicks are broken');
+ .fill('notification clicks are broken on iOS');
await expect(
dialog.getByRole('button', { name: 'Create task', exact: true })
).toBeEnabled();
@@ -31,8 +31,8 @@ test('keeps ordinary Command K search when the rollout flag is off', async ({
.click();
const dialog = page.getByRole('dialog');
const input = dialog.getByPlaceholder('Search...', { exact: true });
- await input.fill('notification clicks are broken');
- await expect(input).toHaveValue('notification clicks are broken');
+ await input.fill('notification clicks are broken on iOS');
+ await expect(input).toHaveValue('notification clicks are broken on iOS');
await expect(
dialog.getByRole('textbox', { name: 'Your input', exact: true })
).not.toBeVisible();
diff --git a/apps/web/src/features/universal-input/browser-test/global-search.browser.e2e.ts b/apps/web/src/features/universal-input/browser-test/global-search.browser.e2e.ts
index b91adc4d55..3488914814 100644
--- a/apps/web/src/features/universal-input/browser-test/global-search.browser.e2e.ts
+++ b/apps/web/src/features/universal-input/browser-test/global-search.browser.e2e.ts
@@ -15,7 +15,7 @@ async function compose(page: Page, text: string) {
test('search messages from Julia prepopulates the global Channels and From facets, including a filter-only search', async ({
page,
}) => {
- const dialog = await compose(page, 'search messages from julia');
+ const dialog = await compose(page, 'search all recent messages from julia');
await expect(
dialog.getByLabel('Search filters').getByText('Channels', { exact: true })
).toBeVisible();
@@ -159,7 +159,7 @@ test('unresolved people do not issue an unfiltered search and can be corrected w
test('formatted main-input queries keep updating and search DMs use the full channel directory', async ({
page,
}) => {
- const dialog = await compose(page, 'search messages about __budget__');
+ const dialog = await compose(page, 'search all messages about __budget__');
const input = dialog.getByRole('textbox', {
name: 'Your input',
exact: true,
@@ -185,7 +185,7 @@ test('formatted main-input queries keep updating and search DMs use the full cha
test('the Documents filter rejects task hits from a full-text response', async ({
page,
}) => {
- const dialog = await compose(page, 'search documents about Scope');
+ const dialog = await compose(page, 'search all my documents about Scope');
const results = dialog.getByRole('listbox', {
name: 'Search results',
exact: true,
diff --git a/apps/web/src/features/universal-input/browser-test/mobile-input.browser.e2e.ts b/apps/web/src/features/universal-input/browser-test/mobile-input.browser.e2e.ts
index 3d16984ab3..9470e0753b 100644
--- a/apps/web/src/features/universal-input/browser-test/mobile-input.browser.e2e.ts
+++ b/apps/web/src/features/universal-input/browser-test/mobile-input.browser.e2e.ts
@@ -12,7 +12,7 @@ test('keeps the mobile editor focused as forms appear above it and Enter adds a
exact: true,
});
const original = await input.elementHandle();
- await input.fill('notification clicks are broken');
+ await input.fill('notification clicks are broken on iOS');
const title = page.getByRole('textbox', { name: 'Title', exact: true });
await expect(title).toBeVisible();
await expect(input).toBeFocused();
@@ -21,14 +21,14 @@ test('keeps the mobile editor focused as forms appear above it and Enter adds a
await input.press('Enter');
await input.pressSequentially('priority urgent');
await expect(input).toHaveValue(
- 'notification clicks are broken\npriority urgent'
+ 'notification clicks are broken on iOS\npriority urgent'
);
expect(
await original?.evaluate((element) => element === document.activeElement)
).toBe(true);
await title.fill('Fix mobile notification routing');
await input.fill(
- 'notification clicks are broken\npriority urgent\nInclude Android\nInclude iOS\nInclude tablets\nCheck navigation\nAdd regression coverage'
+ 'notification clicks are broken on iOS\npriority urgent\nInclude Android\nInclude iOS\nInclude tablets\nCheck navigation\nAdd regression coverage'
);
await expect(title).toHaveText('Fix mobile notification routing');
const description = page.getByRole('textbox', {
@@ -99,7 +99,7 @@ test('replaces the normal results and filter tabs with the card until the input
await expect(filters).toBeVisible();
await expect(results).toBeVisible();
const original = await input.elementHandle();
- await input.fill('notification clicks are broken');
+ await input.fill('notification clicks are broken on iOS');
await expect(
page.getByRole('button', { name: 'Create task', exact: true })
).toBeEnabled();
@@ -131,7 +131,7 @@ test('keeps mobile email unsent until Send and submits the visible draft once',
name: 'Search or create',
exact: true,
});
- await input.fill('Email John that I’ll be late');
+ await input.fill('Email John that I’ll be late today');
const send = page.getByRole('button', { name: 'Send email', exact: true });
await expect(send).toBeEnabled();
await expect(page.getByTestId('command-submission-count')).toHaveText('0');
@@ -165,7 +165,7 @@ test('waits for IME composition before predicting from the mobile editor', async
textarea.dispatchEvent(
new CompositionEvent('compositionstart', { bubbles: true })
);
- textarea.value = 'notification clicks are broken';
+ textarea.value = 'notification clicks are broken on iOS';
textarea.dispatchEvent(
new InputEvent('input', { bubbles: true, isComposing: true })
);
@@ -176,7 +176,7 @@ test('waits for IME composition before predicting from the mobile editor', async
).not.toBeVisible();
await input.dispatchEvent('compositionend');
await expect(page.getByTestId('mobile-query')).toHaveText(
- 'notification clicks are broken'
+ 'notification clicks are broken on iOS'
);
await expect(
page.getByRole('button', { name: 'Create task', exact: true })
@@ -233,12 +233,12 @@ test('keeps ordinary mobile search when the rollout flag is off and closes clean
.getByRole('button', { name: 'Open mobile search', exact: true })
.tap();
const input = page.getByRole('textbox', { name: 'Search', exact: true });
- await input.fill('notification clicks are broken');
+ await input.fill('notification clicks are broken on iOS');
await input.press('End');
await input.press('Enter');
await input.pressSequentially('priority urgent');
await expect(input).toHaveValue(
- 'notification clicks are broken\npriority urgent'
+ 'notification clicks are broken on iOS\npriority urgent'
);
await expect(input).toBeFocused();
await expect(
diff --git a/apps/web/src/features/universal-input/browser-test/search-extractions-fixture.ts b/apps/web/src/features/universal-input/browser-test/search-extractions-fixture.ts
index 296796d509..320bc83a72 100644
--- a/apps/web/src/features/universal-input/browser-test/search-extractions-fixture.ts
+++ b/apps/web/src/features/universal-input/browser-test/search-extractions-fixture.ts
@@ -16,12 +16,15 @@ const answers: Record<string, SearchExtraction> = {
},
'find hiring': { type: 'all', query: 'hiring' },
'find hiring plan': { type: 'all', query: 'hiring plan' },
- 'find how blowholes work': { type: 'all', query: 'how blowholes work' },
+ 'find my notes on how blowholes work': {
+ type: 'all',
+ query: 'how blowholes work',
+ },
'find how blowholes work in the ocean': {
type: 'all',
query: 'how blowholes work in the ocean',
},
- 'search messages from julia': {
+ 'search all recent messages from julia': {
query: null,
type: 'channels',
from: ['Julia'],
@@ -51,13 +54,13 @@ const answers: Record<string, SearchExtraction> = {
from: ['Pat'],
in: [],
},
- 'search messages about __budget__': {
+ 'search all messages about __budget__': {
query: '__budget__',
type: 'channels',
from: [],
in: [],
},
- 'search messages about **budget**': {
+ 'search all messages about **budget**': {
query: '**budget**',
type: 'channels',
from: [],
@@ -75,7 +78,10 @@ const answers: Record<string, SearchExtraction> = {
in: ['Julia direct message'],
from: [],
},
- 'search documents about Scope': { query: 'Scope', type: 'document-or-file' },
+ 'search all my documents about Scope': {
+ query: 'Scope',
+ type: 'document-or-file',
+ },
};
export function fixtureSearchFields(text: string) {
diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.md
index ef2654f601..6ce5f359e9 100644
--- a/docs/agent-guide/navigation.md
+++ b/docs/agent-guide/navigation.md
@@ -752,9 +752,10 @@ edited, so a provider failure cannot silently broaden the search.
Click a result or message snippet to open its actual location, or use **Up/Down**
and then **Enter**. Keyboard selection scrolls into view while the editor keeps
-focus. **Shift+Enter** always inserts a newline in the Command K main input,
-including before Universal Input activates and when Shift is released before
-Enter; neither key release opens the selected result. Multiline input hides the
+focus. **Shift+Enter** inserts a newline in the composer's main input, including
+when Shift is released before Enter; neither key release opens the selected
+result. Before Universal Input activates, Shift+Enter in the Command K search
+input opens the selected result in a new split. Multiline input hides the
Macro logo and removes its reserved spacing so text uses the full width. **Escape** exits
result navigation; a second Escape closes the menu. The content type selector
uses the shared styled dropdown with a selection checkmark and platform-specific
@@ -1265,19 +1266,21 @@ Opens a dialog with a focused `Search...` textbox and bubble-style category radi
the top hit. Also exposes commands: `Create`, `Change theme`, `MCP setup`. Keys: Tab cycles
category, Esc closes. The category strip and footer have transparent backgrounds.
-With PostHog **enable-universal-input** enabled, typing at least **3 words or 24
-characters** turns the menu into the shared Universal Input composer. The current
+With PostHog **enable-universal-input** enabled, typing at least **34 characters**
+(word count does not matter) turns the menu into the shared Universal Input composer. The current
text and insertion point transfer to its rich input in the same header row, with
the same type size and padding. There is no additional title. The Macro logo hides
when the rich input wraps or contains multiple lines, then returns on one line;
its reserved space is removed so text uses the full input width. Classification and field
extraction run while typing continues. For example, “dinner with julia tomorrow
-at 9pm” reveals an event; users can change the type and edit fields before acting.
+at 9:30pm” reveals an event; users can change the type and edit fields before acting.
Shorter edits keep the composer open; clearing the input returns to ordinary
Command K search. IME composition finishes before the transition. This applies to
ordinary search, including a selected category; nested command scopes, entity
actions, and the onboarding sandbox retain their existing behavior.
-In composer mode, Enter inserts a newline and Cmd/Ctrl+Enter performs the displayed
+Before the composer opens, Shift+Enter opens the selected result in a new split
+(the footer shows the hint when a split fits). In composer mode, Enter and
+Shift+Enter insert a newline and Cmd/Ctrl+Enter performs the displayed
action; Tab moves through form controls. Escape closes the menu (or first leaves
active inline search navigation). Successful actions close the menu and open their
result when available; errors keep the form available for correction. Command K
@@ -1383,7 +1386,7 @@ still order results within each group; other result types keep their positions.
Verify this in both People and All with a recent CRM contact and a matching DM last
viewed more than 30 days ago, including when server contacts arrive after the DM.
Other contacts show their email and open the contact page; Enter and
-click open in place; Shift+Enter inserts a newline in the query. A server match that arrives after
+click open in place, Shift+Enter in a new split. A server match that arrives after
typing takes the default selection from the Search for… row. Global Search does not
list CRM contacts; Search for… from People still opens the Channels search. Verify
a contact outside the cached rows, an email-only query, rapid query changes (rows
diff --git a/docs/agent-guide/search.md b/docs/agent-guide/search.md
index 0d74100ce6..6ce8e6fa15 100644
--- a/docs/agent-guide/search.md
+++ b/docs/agent-guide/search.md
@@ -60,7 +60,7 @@ the build-time `VITE_ENABLE_GRAPHQL_SOUP=true` override; see the
Category/mode changes keep the same input mounted and focused. Return inserts
a newline and keeps the keyboard open; the Search bar expands with the text.
-When **enable-universal-input** is on, three words or 24 characters reveal
+When **enable-universal-input** is on, 34 characters (regardless of word count) reveal
Universal Input's suggested form above the bar. The editor stays mounted while
classification and extraction update the form. Shorter edits keep the form until
the input is cleared. While the card is active, the normal search results and top