Skip to content
Merged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ I don't come from a coding background. I'd been bouncing between the coding agen
## Features

- **Aiden Live (Beta)** - use the blue orb for an explicitly started voice session with visible listening, thinking, speaking, approval, and error states. First use walks through model access, microphone, and Screen & Accessibility permissions once; computer actions and scheduled tasks retain Aiden's existing approval boundaries.
- **Command palette and shortcuts** - `⌘K` searches commands, chats, models, providers, Settings, appearance actions, Bots, places, workspace tools, and the open chat's actions. Back/forward, stop, attach, model, and approval keys, `F6` between areas, arrow keys in the sidebar, `⌘F` find in chat, `↑` to fix and resend your last message, and `⇧F10` row menus keep everyday work keyboard-only; see [docs/keyboard.md](docs/keyboard.md). One typed command system also powers native menus, visible shortcut labels, transactional global hotkeys, and the searchable Keyboard Shortcuts editor.
- **Command palette and shortcuts** - `⌘K` searches commands, chats, models, providers, Settings, appearance actions, Bots, places, workspace tools, and the open chat's actions. Back/forward, stop, attach, model, and approval keys, `F6` between areas, arrow keys in the sidebar, `⌘F` find in chat, `↑` to fix and resend your last message, and `⇧F10` row menus keep everyday work keyboard-only; `⌘/` lists every key, and the View, Go and Chat menus show them too; see [docs/keyboard.md](docs/keyboard.md). One typed command system also powers native menus, visible shortcut labels, transactional global hotkeys, and the searchable Keyboard Shortcuts editor.
- **Commands and explicit skills** - type `/` at the start of the composer to search Aiden app commands, or `$` to search the active workspace's available skills. Commands reuse canonical app workflows; an explicitly selected skill is revalidated for the active workspace, applies to one accepted message, and persists only safe display provenance.
- **Native Subagents** - a foreground chat can delegate up to four fresh `scout`, `planner`, `reviewer`, or `implementer` tasks. Children inherit the approved workspace and model, stop with the parent, and appear as a collapsible group in the transcript plus an inspectable **Subagents** view in Environment. While any child works, a pill above the composer (`⌘⇧S` opens its tray of runs, with Stop, Show in chat and the Subagents panel) and a count badge in the chat's top bar keep them visible even with every panel closed. The implementer can edit files and run commands within the parent permission ceiling.

Expand Down
25 changes: 24 additions & 1 deletion docs/keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ the keys that exist today. Keys are shown with Mac symbols; on Linux and
Windows, `⌘` is `Ctrl`, `⌥` is `Alt` and `⇧` is `Shift`.

Every key in the tables below, except the fixed keys (the approval keys, `/`,
`F6`, the arrow keys and `↑` in the message box), lives in the
`F6`, the arrow keys and `↑` in the message box, listed in
`renderer/shared/built-in-keys.ts` and under **Built-in keys** in Settings), lives in the
one command catalog (`renderer/shared/keybindings.ts`), so it can be changed
or turned off in **Settings → Keyboard shortcuts**, and the native menus and button tooltips
show the current choice. Keys added in a later release never take a shortcut
Expand All @@ -17,6 +18,7 @@ one starts unassigned.
| Key | Does |
| --- | --- |
| `⌘K` | Command palette: commands, chats, models, providers, Settings, appearance, Bots |
| `⌘/` | Keyboard shortcuts: every key as set in Settings plus the built-in ones, searchable |
| `⌘N` / `⇧⌘N` | New chat / New chat in… |
| `⇧⌘F` | Search chats |
| `⌘1`–`⌘9` | Open the chat with that number (hold `⌘` to see the numbers); on the Bots page, the Bot on that row |
Expand Down Expand Up @@ -84,6 +86,27 @@ approval appears, screen readers announce it.
In the Browser panel, `⌘.` starts page markup instead of stopping the reply,
but only while focus is inside the browser.

## Keyboard list and menu bar

`⌘/` (or **Help → Keyboard Shortcuts**) opens a searchable list of every key,
grouped as General, Moving around, In a chat and Workspace. It shows the keys
as set in Settings, leaves out commands with no key, and includes the built-in
keys with when each one applies. **Change keys…** opens Settings → Keyboard
shortcuts, which lists the same built-in keys under **Built-in keys**, below
the ones you can change. `⌘/` also works from the message box.

The menu bar has **View** (sidebar, terminal, Environment, the Focus commands),
**Go** (back, forward, previous and next chat, Search chats, Bots, Scheduled,
Profile), **Chat** (model, attach, find, stop and the open chat's actions) and
**Help → Keyboard Shortcuts**, next to File, Edit and Window. Each item shows
its current key, and items that can't run right now (no chat open, nothing to
stop) are greyed out. These items only show their key: the key itself still
follows the rules on this page (for example, it doesn't act while you type in
the terminal). On Linux, `Alt` opens the menu bar.

When first-run setup finishes, the message box has focus, so you can start
typing straight away.

## From ⌘K

Besides the keyed commands above, the palette lists commands with no default
Expand Down
20 changes: 19 additions & 1 deletion main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import {
effectiveBindings,
migrateLegacyKeybindings,
} from "../renderer/shared/keybindings.js";
import { applicationMenuTemplate } from "./services/application-menu-core.js";
import { applicationMenuTemplate, parseMenuCommandIds } from "./services/application-menu-core.js";
import type { NotificationChannel } from "../renderer/preload-channels.js";
import type { AppSettings, Chat } from "./services/types.js";
import { ONBOARDING_COMPLETE_STORAGE_KEY } from "../renderer/shared/onboarding.js";
Expand Down Expand Up @@ -1685,10 +1685,27 @@ registerAppPathOpener(async (path) => {
await deliverMainWindowNotification("app:navigate", { path });
});

// The last settings the menu was built from, and the commands the renderer
// reports it can run now, so the menu can be rebuilt when either changes.
let applicationMenuInputs: { settings: AppSettings; acceleratorsEnabled: boolean } | null = null;
let applicationMenuAvailable: ReadonlySet<string> | null = null;

ipcMain.handle("app:setMenuCommands", (event, commandIds: unknown) => {
if (!mainWindow || mainWindow.isDestroyed() || event.sender.id !== mainWindow.webContents.id) return false;
const next = parseMenuCommandIds(commandIds);
if (!next) return false;
const current = applicationMenuAvailable;
if (current && current.size === next.size && [...next].every((id) => current.has(id))) return true;
applicationMenuAvailable = next;
if (applicationMenuInputs) setupApplicationMenu(applicationMenuInputs.settings, applicationMenuInputs.acceleratorsEnabled);
return true;
});

function setupApplicationMenu(
settings: AppSettings,
acceleratorsEnabled = true,
): void {
applicationMenuInputs = { settings, acceleratorsEnabled };
if (!acceleratorsEnabled) {
Menu.setApplicationMenu(null);
return;
Expand All @@ -1701,6 +1718,7 @@ function setupApplicationMenu(
platform: process.platform,
appName: app.getName(),
bindings,
available: applicationMenuAvailable,
actions: {
checkForUpdates: () => void appUpdateService.checkNow(true),
deliverCommand: (commandId) =>
Expand Down
99 changes: 98 additions & 1 deletion main/services/application-menu-core.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import assert from "node:assert/strict";
import test from "node:test";

import type { MenuItemConstructorOptions } from "electron";
import {
applicationMenuTemplate,
parseMenuCommandIds,
platformMenuAccelerator,
} from "./application-menu-core.js";

Expand Down Expand Up @@ -39,7 +41,7 @@ test("Linux menu uses conventional File and Help ownership", () => {
});
assert.deepEqual(
menu.map((item) => item.label ?? item.role),
["File", "editMenu", "View", "windowMenu", "Help"],
["File", "editMenu", "View", "Go", "Chat", "windowMenu", "Help"],
);
const serialized = JSON.stringify(menu);
assert.equal(serialized.includes("Check for Updates"), false);
Expand All @@ -54,3 +56,98 @@ test("Linux native menus translate canonical Command bindings to Ctrl", () => {
assert.equal(platformMenuAccelerator("Command+Shift+N", "darwin"), "Command+Shift+N");
assert.equal(platformMenuAccelerator(null, "linux"), undefined);
});

function submenu(menu: MenuItemConstructorOptions[], name: string): MenuItemConstructorOptions[] {
const item = menu.find((entry) => entry.label === name || entry.role === name);
assert.ok(item && Array.isArray(item.submenu), `${name} menu`);
return item.submenu;
}

function item(items: MenuItemConstructorOptions[], label: string): MenuItemConstructorOptions {
const found = items.find((entry) => entry.label === label);
assert.ok(found, label);
return found;
}

test("macOS gets View, Go and Chat menus, and Help lists Keyboard Shortcuts", () => {
const menu = applicationMenuTemplate({
platform: "darwin",
appName: "Aiden Agent",
bindings: { "shortcuts.show": "Command+/", "sidebar.toggle": "Command+B", "chat.find": "Command+F" },
actions,
});
assert.deepEqual(
menu.map((entry) => entry.label ?? entry.role),
["Aiden Agent", "File", "editMenu", "View", "Go", "Chat", "windowMenu", "help"],
);
assert.equal(item(submenu(menu, "help"), "Keyboard Shortcuts").accelerator, "Command+/");
assert.equal(item(submenu(menu, "View"), "Toggle Sidebar").accelerator, "Command+B");
assert.equal(item(submenu(menu, "Chat"), "Find in Chat").accelerator, "Command+F");
assert.ok(item(submenu(menu, "Go"), "Back"));
});

test("menu items for in-app keys show the key as set, without taking it from the page", () => {
const delivered: string[] = [];
const menu = applicationMenuTemplate({
platform: "linux",
appName: "Aiden Agent",
// A key someone changed in Settings, and one they turned off.
bindings: { "chat.find": "Command+Shift+G", "chat.stop": null },
actions: { ...actions, deliverCommand: (commandId) => delivered.push(commandId) },
});
const chat = submenu(menu, "Chat");
const find = item(chat, "Find in Chat");
assert.equal(find.accelerator, "CommandOrControl+Shift+G");
assert.equal(find.registerAccelerator, false, "the page keeps the key");
assert.equal(item(chat, "Stop Reply").accelerator, undefined);
find.click?.({} as never, undefined, { triggeredByAccelerator: false } as never);
assert.deepEqual(delivered, ["chat.find"]);
});

test("on a Mac a menu item runs when chosen, by mouse or Return, but not when a shortcut fires it", () => {
const delivered: string[] = [];
const menu = applicationMenuTemplate({
platform: "darwin",
appName: "Aiden Agent",
bindings: { "chat.find": "Command+Shift+G", "model.change": null },
actions: { ...actions, deliverCommand: (commandId) => delivered.push(commandId) },
});
const chat = submenu(menu, "Chat");
const press = (label: string, event: Record<string, boolean>) =>
item(chat, label).click?.({} as never, undefined, event as never);
press("Find in Chat", { triggeredByAccelerator: false });
// Return in the open menu is also reported as not a mouse click.
press("Find in Chat", { triggeredByAccelerator: true });
press("Change Model…", { triggeredByAccelerator: true });
assert.deepEqual(delivered, ["chat.find", "chat.find", "model.change"]);
// ⇧⌘G that the page left alone (the terminal keeps it) or never saw (an
// artifact frame) comes back as the item's key, and runs nothing. So does a
// key given to an item in macOS System Settings, whatever Aiden has set.
press("Find in Chat", { triggeredByAccelerator: true, metaKey: true, shiftKey: true });
press("Find in Chat", { triggeredByAccelerator: true, metaKey: true, altKey: true });
press("Change Model…", { triggeredByAccelerator: true, metaKey: true, altKey: true });
assert.deepEqual(delivered, ["chat.find", "chat.find", "model.change"]);
});

test("menu items grey out while the app can't run them, once it has said what it can run", () => {
const build = (available: ReadonlySet<string> | null) =>
applicationMenuTemplate({ platform: "darwin", appName: "Aiden Agent", bindings: {}, actions, available });
const before = submenu(build(null), "Chat");
assert.equal(item(before, "Rename…").enabled, true, "everything works until the app reports");
const menu = build(new Set(["chat.find", "navigate.back"]));
assert.equal(item(submenu(menu, "Chat"), "Find in Chat").enabled, true);
assert.equal(item(submenu(menu, "Chat"), "Rename…").enabled, false);
assert.equal(item(submenu(menu, "Go"), "Back").enabled, true);
assert.equal(item(submenu(menu, "Go"), "Forward").enabled, false);
// Menu-owned commands stay on: their key always works.
assert.notEqual(item(submenu(menu, "File"), "New Chat").enabled, false);
});

test("the app's list of runnable commands keeps only known command ids", () => {
assert.deepEqual([...(parseMenuCommandIds(["chat.find", "nope", 3, null, "navigate.back"]) ?? [])], [
"chat.find",
"navigate.back",
]);
assert.equal(parseMenuCommandIds("chat.find"), null);
assert.equal(parseMenuCommandIds(undefined), null);
});
95 changes: 93 additions & 2 deletions main/services/application-menu-core.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
import type { MenuItemConstructorOptions } from "electron";
import { electronAcceleratorForPlatform } from "../../renderer/shared/keybindings.js";
import { COMMAND_IDS, electronAcceleratorForPlatform } from "../../renderer/shared/keybindings.js";

export interface ApplicationMenuActions {
checkForUpdates(): void;
deliverCommand(commandId: string): void;
reload(ignoreCache: boolean): void;
}

/** The command ids the renderer reports it can run now; anything else is dropped. */
export function parseMenuCommandIds(value: unknown): ReadonlySet<string> | null {
if (!Array.isArray(value)) return null;
const known = new Set<string>(COMMAND_IDS);
return new Set(value.filter((id): id is string => typeof id === "string" && known.has(id)));
}

type MenuClickEvent = Partial<
Record<"triggeredByAccelerator" | "metaKey" | "ctrlKey" | "altKey" | "shiftKey", boolean>
>;

/**
* Whether a menu item was fired by a shortcut rather than chosen. Electron
* marks every activation that isn't a mouse click as `triggeredByAccelerator`,
* Return in an open menu included, so a shortcut is told apart by the
* modifiers held. That covers Aiden's keys and ones assigned in macOS
* System Settings; choosing from a menu needs none.
*/
export function firedByShortcut(event: MenuClickEvent | undefined): boolean {
if (!event?.triggeredByAccelerator) return false;
return Boolean(event.metaKey || event.ctrlKey || event.altKey || event.shiftKey);
}

export function platformMenuAccelerator(
binding: string | null | undefined,
platform: NodeJS.Platform,
Expand All @@ -20,11 +43,14 @@ export function applicationMenuTemplate({
appName,
bindings,
actions,
available = null,
}: {
platform: NodeJS.Platform;
appName: string;
bindings: Readonly<Record<string, string | null | undefined>>;
actions: ApplicationMenuActions;
/** Commands the renderer can run now; null until it says, when all are enabled. */
available?: ReadonlySet<string> | null;
}): MenuItemConstructorOptions[] {
const commandItem = (
label: string,
Expand All @@ -34,6 +60,21 @@ export function applicationMenuTemplate({
accelerator: platformMenuAccelerator(bindings[commandId], platform),
click: () => actions.deliverCommand(commandId),
});
// The renderer owns these keys: whether they act depends on focus and on
// what is open (a text field, the terminal, the browser). So the menu shows
// the key without taking it. On Linux and Windows the key is not registered.
// macOS still fires the item for a key the page left alone (or never saw,
// from inside a frame), so that press is ignored (see `firedByShortcut`).
const shownItem = (label: string, commandId: string): MenuItemConstructorOptions => ({
label,
accelerator: platformMenuAccelerator(bindings[commandId], platform),
registerAccelerator: false,
enabled: !available || available.has(commandId),
click: (_item, _window, event) => {
if (firedByShortcut(event)) return;
actions.deliverCommand(commandId);
},
});
const fileItems: MenuItemConstructorOptions[] = [
commandItem("New Chat", "chat.new"),
commandItem("New Chat in…", "chat.newIn"),
Expand Down Expand Up @@ -84,6 +125,14 @@ export function applicationMenuTemplate({
{
label: "View",
submenu: [
shownItem("Toggle Sidebar", "sidebar.toggle"),
shownItem("Toggle Terminal", "terminal.toggle"),
shownItem("Toggle Environment", "environment.toggle"),
{ type: "separator" },
shownItem("Focus Sidebar", "focus.sidebar"),
shownItem("Focus Conversation", "focus.chat"),
shownItem("Focus Side Panel", "focus.panel"),
{ type: "separator" },
{
label: "Reload",
accelerator: "CmdOrCtrl+R",
Expand All @@ -103,12 +152,54 @@ export function applicationMenuTemplate({
{ role: "togglefullscreen" },
],
},
{
label: "Go",
submenu: [
shownItem("Back", "navigate.back"),
shownItem("Forward", "navigate.forward"),
{ type: "separator" },
shownItem("Previous Chat", "chat.previous"),
shownItem("Next Chat", "chat.next"),
shownItem("Search Chats…", "chat.search"),
{ type: "separator" },
shownItem("Bots", "bots.open"),
shownItem("Open a Bot…", "bots.search"),
shownItem("Scheduled", "scheduled.open"),
shownItem("Profile", "profile.open"),
],
},
{
label: "Chat",
submenu: [
shownItem("Change Model…", "model.change"),
shownItem("Attach Files…", "composer.attach"),
shownItem("Find in Chat", "chat.find"),
shownItem("Stop Reply", "chat.stop"),
{ type: "separator" },
shownItem("Rename…", "chat.rename"),
shownItem("Duplicate", "chat.duplicate"),
shownItem("Fork…", "chat.fork"),
shownItem("Compact", "chat.compact"),
shownItem("Export", "chat.export"),
shownItem("Copy Last Reply", "chat.copyLatest"),
shownItem("Chat Details", "chat.details"),
shownItem("Change Folder Access", "workspace.access"),
{ type: "separator" },
shownItem("Delete…", "chat.delete"),
],
},
{ role: "windowMenu" },
);
if (platform !== "darwin") {
if (platform === "darwin") {
template.push({
role: "help",
submenu: [shownItem("Keyboard Shortcuts", "shortcuts.show")],
});
} else {
template.push({
label: "Help",
submenu: [
shownItem("Keyboard Shortcuts", "shortcuts.show"),
commandItem("Command Palette…", "commandPalette.toggle"),
{ type: "separator" },
{ role: "about" },
Expand Down
Loading
Loading