Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(ok): shortcut for file a bug, capturing state at the keypress (PRD-8284) (#3931)

Andrew Mikofalvy526a4cdaae89
diff --git a/.changeset/bug-report-shortcut-capture.md b/.changeset/bug-report-shortcut-capture.md
new file mode 100644
index 000000000..7088f576c
--- /dev/null
+++ b/.changeset/bug-report-shortcut-capture.md
@@ -0,0 +1,9 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Filing a bug no longer destroys the thing you were trying to report. In the desktop app, press Cmd+Shift+D (Ctrl+Shift+D on Windows and Linux) and the report opens straight away, without you having to move the mouse or hunt through a menu. That matters more than the convenience: a lot of what goes wrong in an app only exists for a moment. A dropdown showing the wrong item, a hover state on the wrong row, a toast with a confusing message. Reaching the Help menu made all of it disappear before the screenshot was taken, so the picture attached to your report showed the app after the problem had already gone.
+
+Two changes behind the shortcut are what make it actually work. The screenshot is now taken at the instant you press the keys, rather than waiting for menus and tooltips to fade out first, so whatever was on screen is what gets captured. And because a screenshot never includes the mouse cursor, a marker is now drawn at the pointer's last position, so a report about a hovered row shows which row you were pointing at instead of leaving the reader to guess.
+
+Filing from the Help menu gets the same treatment, and so does the Report this error button on a crash screen: they no longer wait either, and they draw the same pointer marker. Opening the report from the command palette, the Help popover, or the Windows and Linux menu bar still waits for that menu to close first, which is the reason the delay existed in the first place, and those reports carry no pointer marker because the row it would mark has already gone.
diff --git a/docs/content/features/editor.mdx b/docs/content/features/editor.mdx
index c39b378aa..158470553 100644
--- a/docs/content/features/editor.mdx
+++ b/docs/content/features/editor.mdx
@@ -253,6 +253,7 @@ Keyboard shortcuts (on Windows / Linux, use `Ctrl` in place of `Cmd` and `Alt` i
| `Cmd+Shift+J` / `Ctrl+Shift+J` | Open an additional terminal tab (macOS / Linux desktop app). With text selected, stages the passage into the new tab's AI CLI input. |
| `Cmd+P` | Open the [command palette](#command-palette) from anywhere — unlike `Cmd+K`, it opens the palette even while text is selected in the visual editor. |
| `Cmd+L` | Open and focus the [Ask AI](#ask-ai) composer (desktop app). |
+| `Cmd+Shift+D` / `Ctrl+Shift+D` | Start a bug report (desktop app). The screenshot it attaches is the screen exactly as it looks when you press the chord — open menus, tooltips and hover states included — plus a marker drawn where your pointer was, since a screenshot never includes the cursor. No marker appears if the pointer has not moved since the window loaded, or has since left the window. Nothing is sent until you press Send. |
| `Cmd+Shift+M` | [Comment](/docs/features/comments) on the selected text (visual editor). |
| `Cmd+Shift+Enter` | Send the checked comments the open **Comments** tab is showing to an agent. Does nothing while that tab is closed. |
| `Cmd+F` | Find in the visual editor. |
diff --git a/docs/content/reference/what-open-knowledge-writes.mdx b/docs/content/reference/what-open-knowledge-writes.mdx
index e765a9821..85d764716 100644
--- a/docs/content/reference/what-open-knowledge-writes.mdx
+++ b/docs/content/reference/what-open-knowledge-writes.mdx
@@ -298,7 +298,7 @@ None of your content, by default. Everything above is written to your own disk.
| What | When | Where it goes |
| --- | --- | --- |
| Diagnostic bundle | Only when you run `ok diagnose bundle` (you can inspect it first) | Wherever you send it |
-| In-app bug report | Only when you click **Send** in the desktop app's **Help → Report a bug…** dialog — it builds a secret-redacted zip you can reveal and inspect first, and nothing is sent without that explicit click. After a crash, the same dialog adds an **off-by-default** "Include crash dump" checkbox: a crash dump is a memory snapshot that can contain document content and can't be redacted, and it is only ever attached when you check that box. On macOS the zip also carries the update helper's install log (listed above), which is machine-wide rather than project-scoped; the zip's own README names it and says where it came from. The zip also carries a short send history of the bug reports previously generated on this machine — when each was generated and whether sending it succeeded — which is what makes a report that failed to send diagnosable at all. That history is machine-wide too, so it names the other projects you have filed reports from; it carries no document content, and the README names it the same way | By default, Send makes no network request — it opens a prefilled email draft to [email protected] that you send yourself, naming the zip to attach. Only when an operator has configured a bug-report intake endpoint ([`OK_BUG_REPORT_INTAKE_URL`](./configuration.mdx#environment-variables)) does Send upload the zip there, falling back to the same email draft if the upload fails |
+| In-app bug report | Only when you click **Send** in the desktop app's **Help → Report a bug…** dialog, or the `Cmd+Shift+D` / `Ctrl+Shift+D` shortcut that opens the same dialog — it builds a secret-redacted zip you can reveal and inspect first, and nothing is sent without that explicit click. The zip carries a picture of the app window unless you uncheck **Screenshot** in that dialog, and the preview there is the picture that would be sent. A report reached through a surface you opened only to get to the reporter — the command palette, the Help popover, or the Windows and Linux menu bar — waits for that surface to close first, and carries no marker, because the row it would point at has already gone. Every other report you start yourself photographs the screen as it is, so an open menu or another person's document visible at the time is in the picture, and carries a marker drawn where your pointer was, since a screenshot never includes the cursor. No marker is drawn either if the pointer has not moved since the window loaded, or has since left the window. The invitation that appears on its own after a crash is the exception to all of this: it carries no picture at all. After a crash, the same dialog adds an **off-by-default** "Include crash dump" checkbox: a crash dump is a memory snapshot that can contain document content and can't be redacted, and it is only ever attached when you check that box. On macOS the zip also carries the update helper's install log (listed above), which is machine-wide rather than project-scoped; the zip's own README names it and says where it came from. The zip also carries a short send history of the bug reports previously generated on this machine — when each was generated and whether sending it succeeded — which is what makes a report that failed to send diagnosable at all. That history is machine-wide too, so it names the other projects you have filed reports from; it carries no document content, and the README names it the same way | By default, Send makes no network request — it opens a prefilled email draft to [email protected] that you send yourself, naming the zip to attach. Only when an operator has configured a bug-report intake endpoint ([`OK_BUG_REPORT_INTAKE_URL`](./configuration.mdx#environment-variables)) does Send upload the zip there, falling back to the same email draft if the upload fails |
| Uninstall feedback | Only after an uninstall has already succeeded, and only if you pick a reason, type a note, or give an email address on the optional "Before you go" screen (desktop app) or prompt (`ok uninstall`). Skipping it, `--yes`, `--json`, and any non-interactive run send nothing | `openknowledge.ai/api/feedback` — the reason you picked, your note, your email address if you gave one, plus the app version and platform. It files one ticket for the team; nothing from your notes is included |
| Semantic search embeddings | Only when you enable [semantic search](./configuration.mdx#semantic-search) **and** set a key — off by default | Your configured embeddings provider (OpenAI by default) |
| GitHub sync / share | When you sync, clone, publish, or share | GitHub |
diff --git a/knip.config.ts b/knip.config.ts
index b61debe5e..8ad68f996 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -124,7 +124,9 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: ['@types/shell-quote'],
+ ignoreDependencies: [
+ '@types/shell-quote',
+ ],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
diff --git a/packages/app/src/components/AppMenubar.dom.test.tsx b/packages/app/src/components/AppMenubar.dom.test.tsx
index 1521cc300..d40b67576 100644
--- a/packages/app/src/components/AppMenubar.dom.test.tsx
+++ b/packages/app/src/components/AppMenubar.dom.test.tsx
@@ -95,7 +95,10 @@ describe('AppMenubar Help menu', () => {
const dispatch = installBridge('win32');
await openHelpMenu();
- await userEvent.click(screen.getByRole('menuitem', { name: 'Report a bug…' }));
+ // Anchored rather than exact: the item renders a MenubarShortcut, whose
+ // text joins the accessible name. Matching the label only keeps this test
+ // about dispatch and stops the chord from breaking it when it changes.
+ await userEvent.click(screen.getByRole('menuitem', { name: /^Report a bug…/ }));
expect(dispatch).toHaveBeenCalledWith({ kind: 'menu-action', action: 'report-bug' });
});
@@ -106,7 +109,7 @@ describe('AppMenubar Help menu', () => {
// Sentence case + the ellipsis on the two entries that open a form rather
// than acting on click. Drift here means the two Help surfaces disagree.
- expect(screen.getByRole('menuitem', { name: 'Report a bug…' })).not.toBeNull();
+ expect(screen.getByRole('menuitem', { name: /^Report a bug…/ })).not.toBeNull();
expect(screen.getByRole('menuitem', { name: 'Send feedback…' })).not.toBeNull();
expect(screen.getByRole('menuitem', { name: 'OpenKnowledge on GitHub' })).not.toBeNull();
});
diff --git a/packages/app/src/components/AppMenubar.tsx b/packages/app/src/components/AppMenubar.tsx
index 4cad6030e..ffcde540f 100644
--- a/packages/app/src/components/AppMenubar.tsx
+++ b/packages/app/src/components/AppMenubar.tsx
@@ -378,6 +378,7 @@ export function AppMenubar() {
</MenubarItem>
<MenubarItem onSelect={() => dispatch({ kind: 'menu-action', action: 'report-bug' })}>
{t`Report a bug…`}
+ <MenubarShortcut>Ctrl+Shift+D</MenubarShortcut>
</MenubarItem>
<MenubarItem onSelect={() => dispatch({ kind: 'menu-action', action: 'send-feedback' })}>
{t`Send feedback…`}
diff --git a/packages/app/src/components/CommandPalette.dom.test.tsx b/packages/app/src/components/CommandPalette.dom.test.tsx
index 0e8bfff3a..030e61145 100644
--- a/packages/app/src/components/CommandPalette.dom.test.tsx
+++ b/packages/app/src/components/CommandPalette.dom.test.tsx
@@ -38,7 +38,7 @@ let requestDocPanelTabCalls: string[] = [];
let seedDialogProps: Array<{ open: boolean }> = [];
let newItemDialogProps: Array<{ open: boolean; kind: string; initialDir: string }> = [];
let createProjectDialogProps: Array<{ open: boolean; bridge: unknown }> = [];
-let reportBugDialogProps: Array<{ open: boolean }> = [];
+let reportBugDialogProps: Array<{ open: boolean; launcherBorne?: boolean }> = [];
let feedbackDialogProps: Array<{ open: boolean; source?: string }> = [];
let commandDialogProps: CommandDialogProps[] = [];
let refreshInstallStatesCalls = 0;
@@ -156,12 +156,22 @@ vi.doMock('@/components/CreateProjectDialog', () => ({
}));
vi.doMock('@/components/ReportBugDialog', () => ({
- ReportBugDialog: (props: { open: boolean }) => {
+ ReportBugDialog: (props: { open: boolean; launcherBorne?: boolean }) => {
reportBugDialogProps.push(props);
return <div data-open={String(props.open)} data-testid="report-bug-dialog" />;
},
}));
+// `lazy()`-loaded in CommandPalette, so the mock must expose a `default`.
+vi.doMock('@/components/BugReportHistoryDialog', () => ({
+ default: (props: { open: boolean; onReportABug: () => void }) =>
+ props.open ? (
+ <button data-testid="history-report-cta" onClick={props.onReportABug} type="button">
+ history-cta
+ </button>
+ ) : null,
+}));
+
vi.doMock('@/components/FeedbackFormDialog', () => ({
FeedbackFormDialog: (props: { open: boolean; source?: string }) => {
feedbackDialogProps.push(props);
@@ -441,6 +451,20 @@ describe('CommandPalette DOM behavior', () => {
);
});
+ test('report-bug row shows its chord on the desktop host', async () => {
+ await renderPalette({ bridge: createBridge() });
+
+ expect(screen.getByTestId('command-palette-report-bug').textContent).toMatch(
+ /⇧⌘ D|Ctrl Shift D/,
+ );
+ });
+
+ test('report-bug row is absent on the web host, so its desktop-only chord never shows there', async () => {
+ await renderPalette({ bridge: null });
+
+ expect(screen.queryByTestId('command-palette-report-bug')).toBeNull();
+ });
+
test('new-file command closes the palette and opens the New Item dialog with kind file', async () => {
const { onOpenChange } = await renderPalette({ bridge: null });
@@ -530,6 +554,31 @@ describe('CommandPalette DOM behavior', () => {
expect(screen.getByTestId('report-bug-dialog').getAttribute('data-open')).toBe('true');
});
expect(reportBugDialogProps.at(-1)?.open).toBe(true);
+ // The palette closes on select and is still animating out as the dialog
+ // opens, so its screenshot must wait for the cmdk root to unmount rather
+ // than photograph the surface the user only passed through.
+ expect(reportBugDialogProps.at(-1)?.launcherBorne).toBe(true);
+ });
+
+ test('the bug-report-history CTA opens the compose dialog launcher-free', async () => {
+ // The negative image of the assertion above, and the branch this route
+ // exists for. By the time the user clicks this button they have read a list
+ // of past reports, so the palette is long gone and there is nothing to wait
+ // on — waiting anyway is what cost this route its pointer marker.
+ const bridge = createBridge();
+ await renderPalette({ bridge });
+
+ await setQuery('bug report history');
+ fireEvent.click(screen.getByTestId('command-palette-bug-report-history'));
+
+ const cta = await screen.findByTestId('history-report-cta');
+ fireEvent.click(cta);
+
+ await waitFor(() => {
+ expect(screen.getByTestId('report-bug-dialog').getAttribute('data-open')).toBe('true');
+ });
+ expect(reportBugDialogProps.at(-1)?.open).toBe(true);
+ expect(reportBugDialogProps.at(-1)?.launcherBorne).toBe(false);
});
test('send-feedback command renders on both hosts and opens FeedbackFormDialog', async () => {
diff --git a/packages/app/src/components/CommandPalette.tsx b/packages/app/src/components/CommandPalette.tsx
index cc816a309..62816d654 100644
--- a/packages/app/src/components/CommandPalette.tsx
+++ b/packages/app/src/components/CommandPalette.tsx
@@ -86,7 +86,12 @@ import { useCreateBlankSkill } from '@/hooks/use-create-blank-skill';
import { useIsEmbedded } from '@/hooks/use-is-embedded';
import { useSemanticSearchStatus } from '@/hooks/use-semantic-search-status';
import { useWorktrees } from '@/hooks/use-worktrees';
-import type { OkDesktopBridge, OkMenuAction, RecentProjectEntry } from '@/lib/desktop-bridge-types';
+import type {
+ OkDesktopBridge,
+ OkMenuAction,
+ OkMenuActionOrigin,
+ RecentProjectEntry,
+} from '@/lib/desktop-bridge-types';
import { hashFromDocName } from '@/lib/doc-hash';
import { runWithToast as runWithToastBase } from '@/lib/error-state';
import { openExternalUrl as openExternalUrlViaHost } from '@/lib/external-link';
@@ -361,7 +366,15 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
const [createDialogKind, setCreateDialogKind] = useState<'file' | 'folder' | null>(null);
const [seedDialogOpen, setSeedDialogOpen] = useState(false);
const [createProjectOpen, setCreateProjectOpen] = useState(false);
- const [reportBugOpen, setReportBugOpen] = useState(false);
+ // The origin IS the open state, matching what `ReportBugMenuTrigger` and
+ // `NavigatorApp` already do at their multi-route mounts. Two routes reach this
+ // one compose dialog and they disagree about `launcherBorne`, so a separate
+ // boolean would need a safe default — and the safe default here is the wrong
+ // one: a third route that forgot the setter would inherit launcher-borne and
+ // silently skip the pointer marker, which is the bug this route exists to fix.
+ // Null-is-closed makes open-without-an-origin unrepresentable instead.
+ const [reportBugOrigin, setReportBugOrigin] = useState<OkMenuActionOrigin | null>(null);
+
const [reportBugHistoryOpen, setReportBugHistoryOpen] = useState(false);
// Defer mounting the (lazy) history dialog until it is first opened, so its
// chunk + the `bugReport.list()` fetch don't run on every palette open.
@@ -897,7 +910,10 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
const viewMenuState = useViewMenuState();
const runMenuAction = (action: OkMenuAction) => {
onOpenChange(false);
- emitLocalMenuAction(action);
+ // The palette is itself the launcher: it closes on dispatch and is still
+ // animating out as the action lands, so anything that screenshots on the
+ // action must wait for it rather than photograph it.
+ emitLocalMenuAction(action, { launcherBorne: true });
};
// Route through the shared opener (scheme gate + caught bridge rejection)
// rather than an inline bridge/window.open fork. Always pass the `okDesktop`
@@ -924,7 +940,7 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
openNewItemDialog: (kind) => setCreateDialogKind(kind),
openSeedDialog: () => setSeedDialogOpen(true),
openCreateProjectDialog: () => setCreateProjectOpen(true),
- openReportBugDialog: () => setReportBugOpen(true),
+ openReportBugDialog: () => setReportBugOrigin({ launcherBorne: true }),
openBugReportHistory: () => {
setHistoryEverOpened(true);
setReportBugHistoryOpen(true);
@@ -1685,7 +1701,15 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
) : null}
{/* Desktop-only — the registry gates the launching "Report a bug" command
on `bridge !== null`, so the dialog only mounts when the bridge exists. */}
- {bridge ? <ReportBugDialog open={reportBugOpen} onOpenChange={setReportBugOpen} /> : null}
+ {bridge ? (
+ <ReportBugDialog
+ open={reportBugOrigin !== null}
+ onOpenChange={(next) => {
+ if (!next) setReportBugOrigin(null);
+ }}
+ launcherBorne={reportBugOrigin?.launcherBorne === true}
+ />
+ ) : null}
{/* Desktop-only — the registry gates the launching "Bug report history"
command on the same bridge presence. Lazy + deferred until first
opened. The empty-state CTA hands off to the compose dialog. */}
@@ -1695,8 +1719,10 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
open={reportBugHistoryOpen}
onOpenChange={setReportBugHistoryOpen}
onReportABug={() => {
+ // Launcher-free: the user read a list and clicked, so the palette
+ // is long gone and there is nothing for the capture to wait on.
setReportBugHistoryOpen(false);
- setReportBugOpen(true);
+ setReportBugOrigin({ launcherBorne: false });
}}
/>
</Suspense>
diff --git a/packages/app/src/components/HelpPopover.dom.test.tsx b/packages/app/src/components/HelpPopover.dom.test.tsx
index 5c036fb99..3602469a4 100644
--- a/packages/app/src/components/HelpPopover.dom.test.tsx
+++ b/packages/app/src/components/HelpPopover.dom.test.tsx
@@ -18,6 +18,17 @@ vi.doMock('@/lib/external-link', () => ({
dispatchExternalLinkClick: () => {},
}));
+// The popover is a Radix popper that closes on select, so the report it opens
+// must declare itself launcher-borne. Stubbing the dialog keeps that assertion
+// off the real capture gate, which has its own tests.
+const reportBugDialogProps: Array<{ open: boolean; launcherBorne?: boolean }> = [];
+vi.doMock('@/components/ReportBugDialog', () => ({
+ ReportBugDialog: (props: { open: boolean; launcherBorne?: boolean }) => {
+ reportBugDialogProps.push(props);
+ return <div data-open={String(props.open)} data-testid="report-bug-dialog" />;
+ },
+}));
+
async function renderOpenHelpPopover() {
const { HelpPopover } = await import('./HelpPopover');
render(
@@ -202,6 +213,21 @@ describe('HelpPopover with the desktop bridge present', () => {
expect(docs.compareDocumentPosition(sendFeedback)).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
});
+ test('the report it opens waits for the popover to clear before shooting', async () => {
+ reportBugDialogProps.length = 0;
+ await renderOpenHelpPopover();
+
+ const nav = screen.getByRole('navigation', { name: 'Resources' });
+ await userEvent.click(within(nav).getByRole('button', { name: 'Report a bug' }));
+
+ await waitFor(() => {
+ expect(screen.getByTestId('report-bug-dialog').getAttribute('data-open')).toBe('true');
+ });
+ // The row closes the popover as it opens the dialog, so the popper is still
+ // animating out and would land in a shot taken on the next frame.
+ expect(reportBugDialogProps.at(-1)?.launcherBorne).toBe(true);
+ });
+
test('keeps the download route available for reinstalling or sharing from desktop', async () => {
await renderOpenHelpPopover();
diff --git a/packages/app/src/components/HelpPopover.tsx b/packages/app/src/components/HelpPopover.tsx
index 450faf1e7..29e5d56fd 100644
--- a/packages/app/src/components/HelpPopover.tsx
+++ b/packages/app/src/components/HelpPopover.tsx
@@ -289,7 +289,9 @@ export const HelpPopover: FC = () => {
{/* Siblings to the Popover so the dialogs survive the menu closing on
select. Report-a-bug is desktop-only — gated on the same bridge as
its trigger row. */}
- {hasDesktopBridge && <ReportBugDialog open={reportBugOpen} onOpenChange={setReportBugOpen} />}
+ {hasDesktopBridge && (
+ <ReportBugDialog open={reportBugOpen} onOpenChange={setReportBugOpen} launcherBorne />
+ )}
<FeedbackFormDialog
open={feedbackOpen}
onOpenChange={setFeedbackOpen}
diff --git a/packages/app/src/components/NavigatorApp.menu-action.dom.test.tsx b/packages/app/src/components/NavigatorApp.menu-action.dom.test.tsx
index f15eb2b03..c32ebb4ca 100644
--- a/packages/app/src/components/NavigatorApp.menu-action.dom.test.tsx
+++ b/packages/app/src/components/NavigatorApp.menu-action.dom.test.tsx
@@ -15,6 +15,7 @@
*/
import { act, cleanup, render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
import type { OkDesktopBridge } from '@/lib/desktop-bridge-types';
@@ -246,6 +247,33 @@ describe('NavigatorApp new-project menu-action subscription', () => {
expect(screen.getByText(/No project is open/)).not.toBeNull();
});
+ test('closing the report leaves it reopenable', async () => {
+ // The open state here IS the dispatch's origin, so the close path has to
+ // null it rather than flip a boolean back. Get that polarity wrong and the
+ // report opens exactly once per window lifetime — and on the Navigator this
+ // is the only report surface the window has.
+ const stub = makeNavigatorBridge();
+ render(
+ <TooltipProvider>
+ <NavigatorApp bridge={stub.bridge} />
+ </TooltipProvider>,
+ );
+ await new Promise((r) => setTimeout(r, 0));
+
+ stub.fire('report-bug');
+ await screen.findByRole('dialog', { name: 'Report a bug' }, { timeout: ASYNC_TIMEOUT_MS });
+
+ await userEvent.keyboard('{Escape}');
+ await waitFor(() => {
+ expect(screen.queryByRole('dialog', { name: 'Report a bug' })).toBeNull();
+ });
+
+ stub.fire('report-bug');
+ expect(
+ await screen.findByRole('dialog', { name: 'Report a bug' }, { timeout: ASYNC_TIMEOUT_MS }),
+ ).not.toBeNull();
+ });
+
test('send-feedback menu action opens the feedback form', async () => {
// The Help menu fires to whichever window is focused, so the Navigator
// owns this path whenever it is the focused window — the editor-window
diff --git a/packages/app/src/components/NavigatorApp.tsx b/packages/app/src/components/NavigatorApp.tsx
index e7bc9109d..c3d52470d 100644
--- a/packages/app/src/components/NavigatorApp.tsx
+++ b/packages/app/src/components/NavigatorApp.tsx
@@ -29,6 +29,7 @@ import { useThemeBridge } from '@/hooks/use-theme-bridge';
import type {
OkDesktopBridge,
OkLocalOpAuthStatusResponse,
+ OkMenuActionOrigin,
OkPackId,
OkProjectEntryPoint,
OkSeedPackInfo,
@@ -113,7 +114,9 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
const [openingLabel, setOpeningLabel] = useState<string | null>(null);
const [cloneDialogOpen, setCloneDialogOpen] = useState(false);
const [createDialogOpen, setCreateDialogOpen] = useState(false);
- const [reportBugOpen, setReportBugOpen] = useState(false);
+ // The dispatch's origin IS the open state: it says whether the surface that
+ // fired the action is a transient launcher the screenshot must wait out.
+ const [reportBugOrigin, setReportBugOrigin] = useState<OkMenuActionOrigin | null>(null);
const [feedbackOpen, setFeedbackOpen] = useState(false);
// Starter pack chosen on the first-run pack line (pill or picker), plus the
// pack list. Threaded into CreateProjectDialog so it can name the pack as
@@ -246,9 +249,11 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
// system-wide (the Navigator has no project), and Help → Send feedback…,
// which opens the same feedback form the editor window opens.
useEffect(() => {
- return subscribeLocalMenuAction((action) => {
+ return subscribeLocalMenuAction((action, origin) => {
if (action === 'new-project') setCreateDialogOpen(true);
- if (action === 'report-bug') setReportBugOpen(true);
+ // A second dispatch while the dialog is already open keeps the first
+ // origin: the capture it describes has already been taken.
+ if (action === 'report-bug') setReportBugOrigin((current) => current ?? origin);
if (action === 'send-feedback') setFeedbackOpen(true);
if (action === 'close-active-tab-or-window') window.close();
});
@@ -540,7 +545,14 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
packs={createPacks}
/>
- <ReportBugDialog open={reportBugOpen} onOpenChange={setReportBugOpen} systemWide />
+ <ReportBugDialog
+ open={reportBugOrigin !== null}
+ onOpenChange={(next) => {
+ if (!next) setReportBugOrigin(null);
+ }}
+ launcherBorne={reportBugOrigin?.launcherBorne === true}
+ systemWide
+ />
<FeedbackFormDialog open={feedbackOpen} onOpenChange={setFeedbackOpen} source="help_menu" />
diff --git a/packages/app/src/components/ReportBugDialog.dom.test.tsx b/packages/app/src/components/ReportBugDialog.dom.test.tsx
index 9f3abe715..78bedaa53 100644
--- a/packages/app/src/components/ReportBugDialog.dom.test.tsx
+++ b/packages/app/src/components/ReportBugDialog.dom.test.tsx
@@ -28,6 +28,7 @@ import { useEffect, useState } from 'react';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
import { bugReportSendManager } from '@/lib/bug-report-send-manager';
+import { installPointerPositionTracker } from '@/lib/pointer-position';
import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
vi.doMock('@lingui/react/macro', () => ({
@@ -189,6 +190,25 @@ function clearBridge() {
}
}
+/**
+ * Let `count` animation frames elapse. The capture gate schedules on rAF, so a
+ * test that only flushes microtasks cannot tell a gate that waits from one that
+ * does not — it asserts before the first frame either way.
+ */
+async function waitFrames(count: number): Promise<void> {
+ for (let i = 0; i < count; i += 1) {
+ await act(async () => {
+ await new Promise<void>((resolve) => {
+ requestAnimationFrame(() => resolve());
+ });
+ });
+ }
+}
+
+function movePointerTo(x: number, y: number): void {
+ window.dispatchEvent(new PointerEvent('pointermove', { clientX: x, clientY: y, bubbles: true }));
+}
+
function deferred<T>() {
let resolve!: (value: T) => void;
const promise = new Promise<T>((r) => {
@@ -257,8 +277,19 @@ async function createReport(note?: string) {
}
describe('ReportBugDialog', () => {
+ let stopPointerTracking: (() => void) | undefined;
+
afterEach(async () => {
cleanup();
+ // Restore any global a test replaced. Neither vitest config sets
+ // `restoreMocks`, and this file's whole subject is rAF-scheduled capture
+ // timing — a stub that survives one failing assertion turns a single real
+ // failure into a dozen whose blast radius points away from the cause.
+ vi.restoreAllMocks();
+ // Uninstalling also forgets the recorded position, so one test's pointer
+ // cannot draw a marker into the next test's capture.
+ stopPointerTracking?.();
+ stopPointerTracking = undefined;
// The send manager is a module singleton every test in this file shares.
// An operation left mid-flight keeps its progress interval ticking and
// makes the next start for the same zip join the stale one instead of
@@ -932,6 +963,304 @@ describe('ReportBugDialog', () => {
expect(log.sendCalls[0]?.includeScreenshot).toBe(true);
});
+ test('a trigger with no launcher captures at once, overlay still on screen', async () => {
+ // The case the shortcut exists for: the Radix popper on screen IS the bug.
+ // Waiting for it to unmount photographs the app after the defect went away.
+ const popper = document.createElement('div');
+ popper.setAttribute('data-radix-popper-content-wrapper', '');
+ document.body.appendChild(popper);
+
+ let popperAtCapture: boolean | null = null;
+ let capturedAfterMs = Number.POSITIVE_INFINITY;
+ let openedAt = Number.NaN;
+ const log = installBridge({
+ captureScreenshot: () => {
+ popperAtCapture = document.querySelector('[data-radix-popper-content-wrapper]') !== null;
+ capturedAfterMs = performance.now() - openedAt;
+ return Promise.resolve(SCREENSHOT);
+ },
+ });
+ const { ReportBugDialog } = await import('./ReportBugDialog');
+ // Sampled after the dynamic import: on the first test to load the module a
+ // cold transform would otherwise land inside the measured window and race
+ // the 200ms assertion below.
+ openedAt = performance.now();
+ render(
+ <TooltipProvider>
+ <ReportBugDialog open onOpenChange={() => {}} />
+ </TooltipProvider>,
+ );
+
+ await screen.findByRole('dialog');
+ expect(log.screenshotCalls).toBe(1);
+ // The whole point: the overlay was in the frame rather than waited out.
+ expect(popperAtCapture).toBe(true);
+ // A capture that waited out the settle deadline would ALSO find the popper
+ // present (it never unmounts here), so the two cases are told apart by the
+ // clock: the deadline is 500ms, and this path must not consult it at all.
+ // The bound sits well above the handful of milliseconds this path actually
+ // takes — it measures real wall-clock across two real rAF ticks, so a
+ // contended runner needs headroom — while staying under the deadline a
+ // waiting gate would hit.
+ expect(capturedAfterMs).toBeLessThan(400);
+ expect(screen.getByRole('checkbox', { name: 'Screenshot' })).not.toBeNull();
+ });
+
+ test('a known pointer position is in the frame that gets captured, and gone once it settles', async () => {
+ // `capturePage()` omits the cursor, so a hover-state report would otherwise
+ // show a highlighted row and nothing explaining what highlighted it.
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(420, 260);
+
+ let markerAtCapture: { left: string; top: string } | null = null;
+ const log = installBridge({
+ captureScreenshot: () => {
+ const marker = document.querySelector<HTMLElement>('.ok-pointer-marker');
+ markerAtCapture = marker && { left: marker.style.left, top: marker.style.top };
+ return Promise.resolve(SCREENSHOT);
+ },
+ });
+ const { ReportBugDialog } = await import('./ReportBugDialog');
+ render(
+ <TooltipProvider>
+ <ReportBugDialog open onOpenChange={() => {}} />
+ </TooltipProvider>,
+ );
+
+ await screen.findByRole('dialog');
+ expect(log.screenshotCalls).toBe(1);
+ // The marker is centred on the pointer by CSS, so these are the pointer's
+ // own viewport coordinates rather than a corner offset.
+ expect(markerAtCapture).toEqual({ left: '420px', top: '260px' });
+ // It belongs to the shot, not to the app: nothing is left behind for the
+ // user to see once the dialog reveals.
+ expect(document.querySelector('.ok-pointer-marker')).toBeNull();
+ });
+
+ test('with the pointer never moved, the capture runs with no marker and nothing else changes', async () => {
+ // A window reached by keyboard: there is no position to draw, and the spec
+ // is to omit the ring rather than guess one.
+ stopPointerTracking = installPointerPositionTracker();
+
+ let markersAtCapture = -1;
+ const log = installBridge({
+ captureScreenshot: () => {
+ markersAtCapture = document.querySelectorAll('.ok-pointer-marker').length;
+ return Promise.resolve(SCREENSHOT);
+ },
+ });
+ await renderDialog();
+
+ expect(markersAtCapture).toBe(0);
+ expect(log.screenshotCalls).toBe(1);
+ expect(screen.getByRole('checkbox', { name: 'Screenshot' })).not.toBeNull();
+ });
+
+ test('the screenshot hint promises a pointer marker only when one was drawn', async () => {
+ // The hint describes the image the user is deciding whether to share, so it
+ // has to track what the image actually carries. Three of the seven triggers
+ // never draw a ring; a blanket promise sends them looking for one.
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(120, 140);
+ installBridge({ captureScreenshot: () => Promise.resolve(SCREENSHOT) });
+ await renderDialog();
+
+ expect(screen.getByText(/with a marker showing where your pointer was/)).not.toBeNull();
+ });
+
+ test('with no marker drawn, the hint does not mention one', async () => {
+ // Same launcher-free path, but the pointer never moved, so
+ // `markPointerPosition` draws nothing and the copy must drop the clause.
+ stopPointerTracking = installPointerPositionTracker();
+ installBridge({ captureScreenshot: () => Promise.resolve(SCREENSHOT) });
+ await renderDialog();
+
+ expect(screen.getByRole('checkbox', { name: 'Screenshot' })).not.toBeNull();
+ expect(screen.queryByText(/with a marker showing where your pointer was/)).toBeNull();
+ expect(
+ screen.getByText(/A picture of the app from just before you opened this\./),
+ ).not.toBeNull();
+ });
+
+ test('a rejected capture still takes the marker off the screen', async () => {
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(80, 90);
+
+ let markersAtCapture = -1;
+ installBridge({
+ captureScreenshot: () => {
+ markersAtCapture = document.querySelectorAll('.ok-pointer-marker').length;
+ return Promise.reject(new Error('capture failed'));
+ },
+ });
+ await renderDialog();
+
+ expect(markersAtCapture).toBe(1);
+ // Past the shot the ring is not in a screenshot, it is on the user's screen.
+ expect(document.querySelector('.ok-pointer-marker')).toBeNull();
+ });
+
+ test('closing before the capture resolves takes the marker with it', async () => {
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(80, 90);
+
+ const pending = deferred<OkBugReportScreenshot>();
+ installBridge({ captureScreenshot: () => pending.promise });
+ const { ReportBugDialog } = await import('./ReportBugDialog');
+ const { rerender } = render(
+ <TooltipProvider>
+ <ReportBugDialog open onOpenChange={() => {}} />
+ </TooltipProvider>,
+ );
+
+ await waitFrames(3);
+ expect(document.querySelectorAll('.ok-pointer-marker')).toHaveLength(1);
+
+ rerender(
+ <TooltipProvider>
+ <ReportBugDialog open={false} onOpenChange={() => {}} />
+ </TooltipProvider>,
+ );
+ expect(document.querySelector('.ok-pointer-marker')).toBeNull();
+
+ // Let the abandoned capture land so it can't settle into the next test.
+ pending.resolve(SCREENSHOT);
+ await waitFrames(1);
+ });
+
+ test('a capture that lands after the reveal timeout is discarded, not offered', async () => {
+ // The marker is taken off screen when the reveal timer fires, so a capture
+ // still sampling at that moment comes back without the ring in it. Nothing
+ // bad ships only because `settled` latches first and drops the late result.
+ // That guard is the whole safety here, so pin it: a change that let a
+ // post-timeout capture through would offer a screenshot whose pointer
+ // marker is silently missing.
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(140, 200);
+
+ const pending = deferred<OkBugReportScreenshot>();
+ const log = installBridge({ captureScreenshot: () => pending.promise });
+ const { ReportBugDialog } = await import('./ReportBugDialog');
+ render(
+ <TooltipProvider>
+ <ReportBugDialog open onOpenChange={() => {}} />
+ </TooltipProvider>,
+ );
+
+ // The timer wins the race, so the dialog reveals with nothing to offer.
+ // Comfortably past the gate's 1200ms reveal timeout.
+ await screen.findByRole('dialog', {}, { timeout: 3000 });
+ expect(screen.queryByRole('checkbox', { name: 'Screenshot' })).toBeNull();
+ expect(document.querySelector('.ok-pointer-marker')).toBeNull();
+
+ // The late capture must not retroactively become the offered screenshot.
+ pending.resolve(SCREENSHOT);
+ await waitFrames(3);
+ expect(screen.queryByRole('checkbox', { name: 'Screenshot' })).toBeNull();
+ expect(log.screenshotCalls).toBe(1);
+ });
+
+ test('a frame that lands after the reveal timeout draws no marker to strand on screen', async () => {
+ // The reveal timer and the capture's animation frame run off independent
+ // clocks: a window that stops compositing suspends its frames while its
+ // timers keep firing, so the gate can reveal before the frame it queued
+ // ever runs. A ring drawn past that point is not in a screenshot — it is
+ // welded over the whole app at the top of the z-order with nothing left
+ // to take it down until the dialog closes.
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(310, 190);
+
+ const queued: FrameRequestCallback[] = [];
+ const rafSpy = vi
+ .spyOn(window, 'requestAnimationFrame')
+ .mockImplementation((cb: FrameRequestCallback) => queued.push(cb));
+
+ const log = installBridge({ captureScreenshot: () => Promise.resolve(SCREENSHOT) });
+ const { ReportBugDialog } = await import('./ReportBugDialog');
+ render(
+ <TooltipProvider>
+ <ReportBugDialog open onOpenChange={() => {}} />
+ </TooltipProvider>,
+ );
+
+ try {
+ // No frame has run, so the reveal timeout is the only thing that can end
+ // the wait. Wait on its observable outcome — the dialog appearing — rather
+ // than on a fixed sleep longer than the 1200ms budget: a sleep only has to
+ // out-race a starved event loop, and losing that race would look like a
+ // regression rather than the flake it is.
+ await vi.waitFor(() => expect(queued.length).toBeGreaterThan(0), { timeout: 5000 });
+ await screen.findByRole('dialog', {}, { timeout: 5000 });
+ expect(log.screenshotCalls).toBe(0);
+ } finally {
+ // Frames resume. Restored in `finally` because everything above can
+ // throw, and leaving rAF stubbed would strand every later test in this
+ // file — all of which schedule their capture on it.
+ rafSpy.mockRestore();
+ }
+
+ // Whatever the gate queued before it settled must find the wait already
+ // over and do nothing.
+ await act(async () => {
+ for (let i = 0; i < 4 && queued.length > 0; i += 1) {
+ for (const cb of queued.splice(0)) cb(performance.now());
+ await Promise.resolve();
+ }
+ });
+
+ expect(document.querySelector('.ok-pointer-marker')).toBeNull();
+ // And no capture was paid for either: main would encode a full PNG whose
+ // result `settled` drops on arrival.
+ expect(log.screenshotCalls).toBe(0);
+ });
+
+ test('a crash invite draws no marker — it takes no screenshot to draw one into', async () => {
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(80, 90);
+
+ const log = installBridge({ captureScreenshot: () => Promise.resolve(SCREENSHOT) });
+ await renderDialog({ crashInvite: BOOT_INVITE });
+
+ expect(log.screenshotCalls).toBe(0);
+ expect(document.querySelector('.ok-pointer-marker')).toBeNull();
+ });
+
+ test('a launcher-borne capture draws no marker — the row it would mark is gone', async () => {
+ // The launcher-borne shot is deliberately taken AFTER the surface the user
+ // clicked has unmounted, so the last recorded pointer position is a row
+ // that no longer exists. Drawing there rings whatever slid underneath and
+ // claims a hover nobody is making — the same thing the tracker refuses to
+ // do once the pointer leaves the viewport.
+ stopPointerTracking = installPointerPositionTracker();
+ movePointerTo(500, 300);
+
+ const launcher = document.createElement('div');
+ launcher.setAttribute('cmdk-root', '');
+ document.body.appendChild(launcher);
+
+ let markersAtCapture = -1;
+ const log = installBridge({
+ captureScreenshot: () => {
+ markersAtCapture = document.querySelectorAll('.ok-pointer-marker').length;
+ return Promise.resolve(SCREENSHOT);
+ },
+ });
+ const { ReportBugDialog } = await import('./ReportBugDialog');
+ render(
+ <TooltipProvider>
+ <ReportBugDialog open onOpenChange={() => {}} launcherBorne />
+ </TooltipProvider>,
+ );
+
+ await waitFrames(3);
+ launcher.remove();
+ await screen.findByRole('dialog');
+
+ expect(log.screenshotCalls).toBe(1);
+ expect(markersAtCapture).toBe(0);
+ expect(document.querySelector('.ok-pointer-marker')).toBeNull();
+ });
+
test('the capture waits for the launcher (⌘K palette) to clear before revealing', async () => {
// Stand in for the command palette still animating out as the dialog opens
// (the reported leak: the palette was opened only to reach Report a bug).
@@ -939,17 +1268,23 @@ describe('ReportBugDialog', () => {
launcher.setAttribute('cmdk-root', '');
document.body.appendChild(launcher);
- const log = installBridge({ captureScreenshot: () => Promise.resolve(SCREENSHOT) });
+ let launcherAtCapture: boolean | null = null;
+ const log = installBridge({
+ captureScreenshot: () => {
+ launcherAtCapture = document.querySelector('[cmdk-root]') !== null;
+ return Promise.resolve(SCREENSHOT);
+ },
+ });
const { ReportBugDialog } = await import('./ReportBugDialog');
render(
<TooltipProvider>
- <ReportBugDialog open onOpenChange={() => {}} />
+ <ReportBugDialog open onOpenChange={() => {}} launcherBorne />
</TooltipProvider>,
);
- // While the launcher is on screen the shot is held back: nothing captured
- // and the dialog stays hidden.
- await Promise.resolve();
+ // Hold the launcher on screen well past the frame a launcher-free trigger
+ // would have shot on: nothing is captured and the dialog stays hidden.
+ await waitFrames(6);
expect(log.screenshotCalls).toBe(0);
expect(screen.queryByRole('dialog')).toBeNull();
@@ -957,6 +1292,7 @@ describe('ReportBugDialog', () => {
launcher.remove();
await screen.findByRole('dialog');
expect(log.screenshotCalls).toBe(1);
+ expect(launcherAtCapture).toBe(false);
expect(screen.getByRole('checkbox', { name: 'Screenshot' })).not.toBeNull();
});
diff --git a/packages/app/src/components/ReportBugDialog.tsx b/packages/app/src/components/ReportBugDialog.tsx
index 01568d0b1..a8b0067a5 100644
--- a/packages/app/src/components/ReportBugDialog.tsx
+++ b/packages/app/src/components/ReportBugDialog.tsx
@@ -18,6 +18,7 @@
import type { OkBugReportScreenshot } from '@inkeep/open-knowledge-core';
import { lazy, Suspense, useEffect, useRef, useState } from 'react';
+import { getLastPointerPosition } from '@/lib/pointer-position';
import type { ReportBugDialogProps } from './ReportBugDialogBody';
const ReportBugDialogBody = lazy(() => import('./ReportBugDialogBody'));
@@ -31,23 +32,84 @@ const ReportBugDialogBody = lazy(() => import('./ReportBugDialogBody'));
const CAPTURE_REVEAL_TIMEOUT_MS = 1200;
/**
- * A launcher surface opened only to REACH this dialog — the ⌘K command palette
- * (a cmdk root) or a help popover/menu (a Radix popper) — is still animating out
- * when the dialog opens, and would leak into the screenshot if captured too
- * soon. The capture waits for these to unmount; persistent context the user was
- * genuinely in (a Settings dialog, an error-boundary card) is neither a cmdk
- * root nor a popper, so it is captured, not waited on.
+ * The overlay shapes a launcher can take: the ⌘K command palette (a cmdk root)
+ * or a help popover/menu (a Radix popper). Consulted only for a trigger that
+ * declared itself launcher-borne — the surface it was reached from is still
+ * animating out and would leak into a shot taken too soon.
+ *
+ * It deliberately cannot tell that launcher apart from an overlay the user was
+ * genuinely in, which is why the wait is opt-in rather than selector-driven: an
+ * overlay on screen when a report is started is usually the thing being
+ * reported, and waiting for it to unmount photographs the app after the defect
+ * went away.
*/
const LAUNCHER_SELECTOR = '[cmdk-root],[data-radix-popper-content-wrapper]';
/**
* Ceiling on how long the capture waits for a launcher to clear before shooting
- * anyway. Comfortably outlasts a Radix exit animation (~150-200ms), so a launcher
- * that never unmounts (or a missing animation event) still can't stall the shot.
+ * anyway, so a launcher that never unmounts (or a missing animation event) still
+ * can't stall the shot.
+ *
+ * Every surface `LAUNCHER_SELECTOR` matches exits in 100ms — measured, not
+ * assumed:
+ * grep -ho "duration-[0-9]*" src/components/ui/{popover,dropdown-menu,menubar,command}.tsx
+ * yields only `duration-100` and `duration-0`. 500ms is 5x that, which is the
+ * headroom the deadline is buying; re-run the grep if a launcher surface ever
+ * animates slower.
*/
const CAPTURE_SETTLE_DEADLINE_MS = 500;
-export function ReportBugDialog(props: ReportBugDialogProps) {
+/**
+ * Put the pointer in the picture, and hand back the eraser.
+ *
+ * `capturePage()` never includes the cursor, so a report about a hover state
+ * would otherwise arrive as a highlighted row with nothing to explain what
+ * highlighted it. The ring is drawn into the DOM a frame before the shot
+ * rather than composited into the PNG afterwards, because the gate already
+ * owns the frame the shot is taken on while main holds raw PNG bytes and no
+ * drawing primitive — and because whatever is in the viewport lands in the
+ * full-resolution image, not just the preview.
+ *
+ * Draws nothing when the pointer has not moved since the page loaded or has
+ * since left the window: a ring in a position nobody is pointing at is worse
+ * than no ring.
+ */
+function markPointerPosition(): (() => void) | null {
+ const position = getLastPointerPosition();
+ if (position === null) return null;
+ const marker = document.createElement('div');
+ marker.className = 'ok-pointer-marker';
+ marker.setAttribute('aria-hidden', 'true');
+ // Centred on these by the class's own transform, so they are the pointer's
+ // viewport coordinates rather than a corner.
+ marker.style.left = `${position.x}px`;
+ marker.style.top = `${position.y}px`;
+ document.body.append(marker);
+ return () => marker.remove();
+}
+
+interface ReportBugDialogGateProps extends ReportBugDialogProps {
+ /**
+ * The surface that opened this dialog is a transient launcher the user went
+ * through only to REACH it (the ⌘K palette, a help popover, the in-app
+ * menubar), so the screenshot must wait for it to unmount. Default off: most
+ * triggers are launcher-free, and for them the overlay on screen is the
+ * report's subject rather than an artifact of filing it.
+ *
+ * Not derivable from the DOM — three surfaces share one mount point and only
+ * some of them are launcher-borne, so the opener has to say.
+ *
+ * Must stay constant for the lifetime of an open cycle. The capture effect
+ * keys on it, so a flip while `open` stays true re-runs the whole capture
+ * without resetting `ready` — over an already-revealed dialog, whose own
+ * picture would then replace the one the report is about. Every opener holds
+ * it fixed: the two menu-action triggers pin the first origin they see, and
+ * the rest pass a literal.
+ */
+ launcherBorne?: boolean;
+}
+
+export function ReportBugDialog({ launcherBorne = false, ...props }: ReportBugDialogGateProps) {
// Pull the heavy chunk only once first opened — a ~1-frame delay on first
// open is worth keeping it out of first paint for a rarely-used surface.
// Once opened, the body stays mounted so Radix's close animation and
@@ -57,6 +119,11 @@ export function ReportBugDialog(props: ReportBugDialogProps) {
// dialog paints over the app; `screenshot` is the captured preview (or null).
const [ready, setReady] = useState(false);
const [screenshot, setScreenshot] = useState<OkBugReportScreenshot | null>(null);
+ // Whether the shot actually carries a pointer ring. False on every
+ // launcher-borne open, and on a launcher-free one where the pointer has not
+ // moved since load — so the dialog's own description of the image stays true
+ // rather than promising a marker the user will not find.
+ const [pointerMarked, setPointerMarked] = useState(false);
// Whether main is holding a crash dump this report could carry. Only asked
// for a report the user opened themselves — a crash invite already carries
// main's answer for its own crash on the event.
@@ -112,31 +179,74 @@ export function ReportBugDialog(props: ReportBugDialogProps) {
// First of the timeout / capture-resolve to fire reveals the dialog; the
// other is ignored. Guarded on the cycle so a stale close can't reveal.
let settled = false;
+ // Assigned when the shot is set up, and called by whatever ends the wait —
+ // a resolved or rejected capture, the reveal timeout, or teardown. The ring
+ // is on screen for the whole round trip main needs to answer, bounded by
+ // that timeout, and must not outlive it: once the wait is over it is no
+ // longer in a screenshot, it is on the user's screen.
+ let removePointerMarker = () => {};
+ let marked = false;
const settle = (shot: OkBugReportScreenshot | null) => {
if (settled || openCycleRef.current !== cycle) return;
settled = true;
+ removePointerMarker();
setScreenshot(shot);
+ setPointerMarked(shot !== null && marked);
setReady(true);
};
- const revealTimer = setTimeout(() => settle(null), CAPTURE_REVEAL_TIMEOUT_MS);
- // Hold the capture until the launcher that was opened to reach this dialog
- // has finished animating out and unmounted, then take the shot one frame
- // later (so the removal has painted). Bounded by a deadline so a launcher
- // that never clears can't block the shot.
+ const revealTimer = setTimeout(() => {
+ // Nothing to report to main, but leave a breadcrumb: past this point the
+ // dialog offers no screenshot, and "we could not get one in time" is
+ // otherwise indistinguishable from "we chose not to take one".
+ console.warn(
+ `[bug-report] screenshot capture did not settle within ${CAPTURE_REVEAL_TIMEOUT_MS}ms; revealing without one`,
+ );
+ settle(null);
+ }, CAPTURE_REVEAL_TIMEOUT_MS);
+ // A launcher-borne trigger holds the capture until the surface it was
+ // reached from has finished animating out and unmounted, bounded by a
+ // deadline so a launcher that never clears can't block the shot. Every
+ // other trigger shoots with whatever is on screen still on screen. Either
+ // way the shot is taken a frame after the decision, so a removal has
+ // painted.
const startedAt = performance.now();
let rafId = 0;
const settleThenCapture = () => {
- if (openCycleRef.current !== cycle) return;
+ // `settled` as well as the cycle: the reveal timeout is a timer and this
+ // is a frame, and a window that stops compositing suspends frames while
+ // its timers keep firing. A frame that arrives after the wait is over
+ // would draw a ring nothing is left to remove, and pay for a capture
+ // whose result `settle` drops on arrival.
+ if (settled || openCycleRef.current !== cycle) return;
const pastDeadline = performance.now() - startedAt >= CAPTURE_SETTLE_DEADLINE_MS;
- if (document.querySelector(LAUNCHER_SELECTOR) !== null && !pastDeadline) {
+ if (launcherBorne && document.querySelector(LAUNCHER_SELECTOR) !== null && !pastDeadline) {
rafId = requestAnimationFrame(settleThenCapture);
return;
}
+ // Only on a launcher-free open. A launcher-borne shot is deliberately
+ // taken after the surface the user clicked has unmounted, so the last
+ // recorded position is a row that is no longer there — a ring drawn
+ // over whatever moved under it claims a hover nobody is making, which
+ // is the same thing the tracker refuses to do at the viewport edge.
+ if (!launcherBorne) {
+ const remove = markPointerPosition();
+ if (remove !== null) {
+ removePointerMarker = remove;
+ marked = true;
+ }
+ }
rafId = requestAnimationFrame(() => {
- if (openCycleRef.current !== cycle) return;
+ if (settled || openCycleRef.current !== cycle) return;
capture()
.then(settle)
- .catch(() => settle(null));
+ .catch((err: unknown) => {
+ // Same reasoning as the crash-dump probe above: a capture that
+ // keeps rejecting presents as "no screenshot offered", which the
+ // user cannot tell from "we chose not to take one" and which main
+ // has no way to log, because the failure is the IPC round trip.
+ console.warn('[bug-report] screenshot capture failed:', err);
+ settle(null);
+ });
});
};
rafId = requestAnimationFrame(settleThenCapture);
@@ -144,8 +254,11 @@ export function ReportBugDialog(props: ReportBugDialogProps) {
openCycleRef.current += 1;
clearTimeout(revealTimer);
cancelAnimationFrame(rafId);
+ // Covers every path that never reaches `settle`: a close between the
+ // draw and the shot, and a capture whose cycle has been superseded.
+ removePointerMarker();
};
- }, [props.open, props.crashInvite]);
+ }, [props.open, props.crashInvite, launcherBorne]);
if (!everOpened) {
return null;
@@ -156,6 +269,7 @@ export function ReportBugDialog(props: ReportBugDialogProps) {
{...props}
open={props.open && ready}
screenshot={screenshot}
+ pointerMarked={pointerMarked}
crashDumpAvailable={crashDumpAvailable}
/>
</Suspense>
diff --git a/packages/app/src/components/ReportBugDialogBody.tsx b/packages/app/src/components/ReportBugDialogBody.tsx
index 65d7cf411..8187a2545 100644
--- a/packages/app/src/components/ReportBugDialogBody.tsx
+++ b/packages/app/src/components/ReportBugDialogBody.tsx
@@ -216,6 +216,13 @@ export interface ReportBugDialogProps {
* threading it through each mount site.
*/
screenshot?: OkBugReportScreenshot | null;
+ /**
+ * The captured image carries a ring drawn at the pointer's last position.
+ * Only the immediate-capture triggers draw one, and only when the pointer has
+ * moved since load, so the hint below has to say which image the user is
+ * actually looking at rather than promise a marker on all of them.
+ */
+ pointerMarked?: boolean;
/**
* Whether main is holding a crash dump this report could carry, as probed by
* the gate for a report the user opened themselves. Ignored under
@@ -231,6 +238,7 @@ function ReportBugDialog({
crashContext,
crashInvite,
screenshot = null,
+ pointerMarked = false,
crashDumpAvailable: probedCrashDumpAvailable = false,
}: ReportBugDialogProps) {
const { t } = useLingui();
@@ -545,10 +553,19 @@ function ReportBugDialog({
<Trans>Screenshot</Trans>
</label>
<p id={screenshotHintId} className="text-1sm text-muted-foreground">
- <Trans>
- A picture of the app from just before you opened this. It isn't redacted,
- so check the preview and uncheck it if anything shouldn't be shared.
- </Trans>
+ {pointerMarked ? (
+ <Trans>
+ A picture of the app from just before you opened this, with a marker
+ showing where your pointer was. It isn't redacted, so check the preview
+ and uncheck it if anything shouldn't be shared.
+ </Trans>
+ ) : (
+ <Trans>
+ A picture of the app from just before you opened this. It isn't
+ redacted, so check the preview and uncheck it if anything shouldn't be
+ shared.
+ </Trans>
+ )}
</p>
{/* Preview dims when excluded so the checkbox state reads
at a glance; the label above already names it. */}
diff --git a/packages/app/src/components/ReportBugMenuTrigger.dom.test.tsx b/packages/app/src/components/ReportBugMenuTrigger.dom.test.tsx
index 8fb4262bc..6c4f09a1b 100644
--- a/packages/app/src/components/ReportBugMenuTrigger.dom.test.tsx
+++ b/packages/app/src/components/ReportBugMenuTrigger.dom.test.tsx
@@ -11,17 +11,27 @@
* Invocation: `bun run test:dom` from `packages/app/`.
*/
-import { act, cleanup, render, screen, waitFor } from '@testing-library/react';
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { afterEach, describe, expect, test, vi } from 'vitest';
+import { KEYBOARD_SHORTCUTS } from '@/lib/keyboard-shortcuts';
import {
__resetLocalMenuActionBusForTests,
emitLocalMenuAction,
} from '@/lib/local-menu-action-bus';
import { ReportBugMenuTrigger } from './ReportBugMenuTrigger';
+// Surfaces the launcher-borne bit the trigger derives from the dispatch, so
+// the origin's trip from the bus to the capture gate is assertable here. What
+// the gate then DOES with it is the dialog's own test's business.
vi.mock('./ReportBugDialog', () => ({
- ReportBugDialog: ({ open }: { open: boolean }) =>
- open ? <div aria-label="Report a bug" role="dialog" /> : null,
+ ReportBugDialog: ({ open, launcherBorne }: { open: boolean; launcherBorne?: boolean }) =>
+ open ? (
+ <div
+ aria-label="Report a bug"
+ data-launcher-borne={String(launcherBorne === true)}
+ role="dialog"
+ />
+ ) : null,
}));
// Radix UI primitives (shadcn Dialog) reach for DOM globals at mount. The
@@ -50,10 +60,13 @@ if (globalWithDomShims.ResizeObserver === undefined) {
const ASYNC_TIMEOUT_MS = 2000;
-// Wrap the bus emit in act so the resulting setOpen state flush is applied
-// before assertions run (mirrors fireEvent's internal act wrapping).
-function fireMenuAction(action: Parameters<typeof emitLocalMenuAction>[0]): void {
- act(() => emitLocalMenuAction(action));
+// Wrap the bus emit in act so the resulting state flush is applied before
+// assertions run (mirrors fireEvent's internal act wrapping).
+function fireMenuAction(
+ action: Parameters<typeof emitLocalMenuAction>[0],
+ origin?: Parameters<typeof emitLocalMenuAction>[1],
+): void {
+ act(() => emitLocalMenuAction(action, origin));
}
describe('ReportBugMenuTrigger', () => {
@@ -94,6 +107,70 @@ describe('ReportBugMenuTrigger', () => {
expect(screen.queryByRole('dialog')).toBeNull();
});
+ test('pressing the chord in the renderer does not open the dialog', async () => {
+ render(<ReportBugMenuTrigger />);
+
+ // The chord reaches this trigger only as a menu action main dispatched
+ // after the OS consumed the accelerator — never as a renderer keydown. A
+ // listener added here would fire a second time on desktop AND would be
+ // subject to the app-global overlay gate, which is the one thing the chord
+ // must not be.
+ //
+ // Read off the binding rather than restated, so a rebind cannot leave this
+ // probing a retired chord and passing for the wrong reason.
+ const binding = KEYBOARD_SHORTCUTS.find((shortcut) => shortcut.id === 'report-bug')
+ ?.bindings[0];
+ const key = binding?.mac.trim().slice(-1).toLowerCase() as string;
+ expect(key).toMatch(/^[a-z]$/);
+ const code = `Key${key.toUpperCase()}`;
+ fireEvent.keyDown(window, { key, code, metaKey: true, shiftKey: true });
+ fireEvent.keyDown(window, { key, code, ctrlKey: true, shiftKey: true });
+
+ // Give any erroneous open a chance to render before asserting absence.
+ await new Promise((r) => setTimeout(r, 50));
+ expect(screen.queryByRole('dialog')).toBeNull();
+ });
+
+ test('a native-menu dispatch opens a report that captures without waiting', async () => {
+ render(<ReportBugMenuTrigger />);
+
+ // The native Help menu and the keyboard accelerator both reach main with no
+ // renderer sender, so nothing on screen was opened to get here.
+ fireMenuAction('report-bug');
+
+ const dialog = await screen.findByRole('dialog');
+ expect(dialog.dataset.launcherBorne).toBe('false');
+ });
+
+ test('an in-app menubar dispatch opens a report that waits out the menu', async () => {
+ render(<ReportBugMenuTrigger />);
+
+ // The in-app menubar is a Radix popper — the primary menu surface on
+ // Windows and Linux, where the native bar is hidden — so it is still
+ // animating out as the report opens and must not land in the screenshot.
+ fireMenuAction('report-bug', { launcherBorne: true });
+
+ const dialog = await screen.findByRole('dialog');
+ expect(dialog.dataset.launcherBorne).toBe('true');
+ });
+
+ test('a second dispatch while open keeps the origin the capture was taken for', async () => {
+ render(<ReportBugMenuTrigger />);
+
+ fireMenuAction('report-bug');
+ await screen.findByRole('dialog');
+ fireMenuAction('report-bug', { launcherBorne: true });
+
+ // The screenshot for this open cycle is already taken; re-marking it would
+ // describe a capture that never happened.
+ await waitFor(
+ () => {
+ expect(screen.getByRole('dialog').dataset.launcherBorne).toBe('false');
+ },
+ { timeout: ASYNC_TIMEOUT_MS },
+ );
+ });
+
test('unsubscribes from the bus on unmount', async () => {
const { unmount } = render(<ReportBugMenuTrigger />);
unmount();
diff --git a/packages/app/src/components/ReportBugMenuTrigger.tsx b/packages/app/src/components/ReportBugMenuTrigger.tsx
index d1f5728ee..37a03010b 100644
--- a/packages/app/src/components/ReportBugMenuTrigger.tsx
+++ b/packages/app/src/components/ReportBugMenuTrigger.tsx
@@ -7,20 +7,51 @@
* Desktop-only: App.tsx renders it only when the desktop bridge is present
* (the `report-bug` menu action never fires in the web host). The Navigator
* window subscribes separately in `NavigatorApp` with a system-wide scope.
+ *
+ * Every window root that can hold focus needs one of these. Main dispatches a
+ * menu action to the focused window and nothing else, and an unhandled
+ * dispatch is silent, so a root without a subscriber makes the Help item and
+ * its accelerator do nothing at all from that window.
*/
import { useEffect, useState } from 'react';
import { ReportBugDialog } from '@/components/ReportBugDialog';
+import type { OkMenuActionOrigin } from '@/lib/desktop-bridge-types';
import { subscribeLocalMenuAction } from '@/lib/local-menu-action-bus';
-export function ReportBugMenuTrigger() {
- const [open, setOpen] = useState(false);
+interface ReportBugMenuTriggerProps {
+ /**
+ * No project is open in this window, so the report carries app logs only.
+ * Set by the terminal window when it was opened without one; the editor
+ * window always has a project and the Navigator uses its own mount.
+ */
+ readonly systemWide?: boolean;
+}
+
+export function ReportBugMenuTrigger({ systemWide }: ReportBugMenuTriggerProps) {
+ // The dispatch's origin IS the open state. Several surfaces land on this one
+ // mount — the native Help menu, the in-app menubar — and only some of them
+ // are a transient overlay the screenshot has to wait out, so the bit cannot
+ // be a constant on the mount.
+ const [origin, setOrigin] = useState<OkMenuActionOrigin | null>(null);
useEffect(() => {
- return subscribeLocalMenuAction((action) => {
- if (action === 'report-bug') setOpen(true);
+ return subscribeLocalMenuAction((action, dispatchOrigin) => {
+ if (action !== 'report-bug') return;
+ // A second dispatch while the dialog is already open keeps the first
+ // origin: the capture it describes has already been taken.
+ setOrigin((current) => current ?? dispatchOrigin);
});
}, []);
- return <ReportBugDialog open={open} onOpenChange={setOpen} />;
+ return (
+ <ReportBugDialog
+ open={origin !== null}
+ onOpenChange={(next) => {
+ if (!next) setOrigin(null);
+ }}
+ launcherBorne={origin?.launcherBorne === true}
+ systemWide={systemWide}
+ />
+ );
}
diff --git a/packages/app/src/components/TerminalWindowApp.config-provider.dom.test.tsx b/packages/app/src/components/TerminalWindowApp.config-provider.dom.test.tsx
index 6a298ff29..2c9fcf320 100644
--- a/packages/app/src/components/TerminalWindowApp.config-provider.dom.test.tsx
+++ b/packages/app/src/components/TerminalWindowApp.config-provider.dom.test.tsx
@@ -35,6 +35,17 @@ vi.doMock('./TerminalGate', () => ({
},
}));
+// Capture what the report trigger is told about this window rather than mounting
+// the real dialog host: `systemWide` is the only thing this root decides for it,
+// and it is what tells the reporter whether there are project logs to collect.
+const reportTriggerProps: { systemWide?: boolean }[] = [];
+vi.doMock('./ReportBugMenuTrigger', () => ({
+ ReportBugMenuTrigger: (props: { systemWide?: boolean }) => {
+ reportTriggerProps.push(props);
+ return null;
+ },
+}));
+
const { TerminalWindowApp } = await import('./TerminalWindowApp');
function bridgeWithCollabUrl(collabUrl: string): OkDesktopBridge {
@@ -72,4 +83,25 @@ describe('TerminalWindowApp ConfigProvider wiring', () => {
);
expect(screen.getByTestId('config-consumer')).toBeTruthy();
});
+
+ test('a project-less terminal window reports system-wide', () => {
+ render(
+ <TooltipProvider>
+ <TerminalWindowApp bridge={bridgeWithCollabUrl('')} />
+ </TooltipProvider>,
+ );
+ expect(reportTriggerProps.at(-1)?.systemWide).toBe(true);
+ });
+
+ test('a project-bound terminal window reports scoped to that project', () => {
+ // The branch the sibling assertions never reached: with a collabUrl there
+ // ARE project logs to collect, so a report filed from this window must not
+ // claim to be system-wide or it collects the wrong thing.
+ render(
+ <TooltipProvider>
+ <TerminalWindowApp bridge={bridgeWithCollabUrl('ws://localhost:5200/collab')} />
+ </TooltipProvider>,
+ );
+ expect(reportTriggerProps.at(-1)?.systemWide).toBe(false);
+ });
});
diff --git a/packages/app/src/components/TerminalWindowApp.dom.test.tsx b/packages/app/src/components/TerminalWindowApp.dom.test.tsx
index 187f6e693..bfee0bb5d 100644
--- a/packages/app/src/components/TerminalWindowApp.dom.test.tsx
+++ b/packages/app/src/components/TerminalWindowApp.dom.test.tsx
@@ -124,6 +124,27 @@ describe('TerminalWindowApp', () => {
__resetLocalMenuActionBusForTests();
});
+ test('Help -> Report a bug reaches this window too', async () => {
+ // The application menu (and the accelerator on it) fires at whichever
+ // window is focused, and main dispatches to that window only. Without a
+ // subscriber here the action crosses IPC, fans out, and nothing handles it
+ // — silently, because report-bug is additive in the buffer policy so it
+ // never even trips the never-buffer debug log. A stuck terminal or a hung
+ // agent session is exactly when someone reaches for the chord.
+ const { bridge } = makeBridge();
+ render(
+ <TooltipProvider>
+ <TerminalWindowApp bridge={bridge} />
+ </TooltipProvider>,
+ );
+
+ act(() => {
+ emitLocalMenuAction('report-bug');
+ });
+
+ expect(await screen.findByRole('dialog', {}, { timeout: 15_000 })).not.toBeNull();
+ });
+
test('opens with exactly one shell tab on mount', () => {
const { bridge, create } = makeBridge();
render(
diff --git a/packages/app/src/components/TerminalWindowApp.tsx b/packages/app/src/components/TerminalWindowApp.tsx
index 21e28bb41..8116e0a43 100644
--- a/packages/app/src/components/TerminalWindowApp.tsx
+++ b/packages/app/src/components/TerminalWindowApp.tsx
@@ -1,5 +1,6 @@
import { useTheme } from 'next-themes';
import { useState } from 'react';
+import { ReportBugMenuTrigger } from '@/components/ReportBugMenuTrigger';
import { useInstalledClis } from '@/hooks/use-installed-clis';
import { ConfigProvider } from '@/lib/config-provider';
import type { OkDesktopBridge } from '@/lib/desktop-bridge-types';
@@ -35,6 +36,12 @@ export function TerminalWindowApp({ bridge }: TerminalWindowAppProps) {
return (
<ConfigProvider collabUrl={collabUrl}>
<TerminalWindowBody bridge={bridge} />
+ {/* Help → Report a bug… lands on whichever window is focused, so this
+ root needs its own subscriber or the item and its accelerator do
+ nothing from here — silently, since nothing records an unhandled
+ dispatch. A project-less terminal window has no project logs to
+ collect, which is what `systemWide` tells the reporter. */}
+ <ReportBugMenuTrigger systemWide={collabUrl === null} />
</ConfigProvider>
);
}
diff --git a/packages/app/src/components/settings/HotkeysSection.dom.test.tsx b/packages/app/src/components/settings/HotkeysSection.dom.test.tsx
new file mode 100644
index 000000000..4e63e4ded
--- /dev/null
+++ b/packages/app/src/components/settings/HotkeysSection.dom.test.tsx
@@ -0,0 +1,111 @@
+/**
+ * Settings -> Hotkeys is host-aware: a chord that only a native menu
+ * accelerator can deliver is not advertised to a browser that has no menu bar.
+ *
+ * The load-bearing assertion is the one that pins what STAYS on web. Several
+ * rows carry an `OK Desktop` scope and are listed on web anyway, so every
+ * derivable host filter would have deleted them; `web list === desktop list
+ * minus the declared rows` is what makes that a red test instead of a quiet
+ * regression.
+ *
+ * Deliberately does NOT mock `@lingui/react/macro`, unlike most sibling suites
+ * here — the config-wide macro shim renders every message in English, so these
+ * assertions read the same copy a user sees.
+ *
+ * Substrate: jsdom via `pnpm run test:dom`.
+ */
+import { cleanup, render, screen } from '@testing-library/react';
+import { afterEach, describe, expect, test } from 'vitest';
+import { formatShortcut, KEYBOARD_SHORTCUTS } from '@/lib/keyboard-shortcuts';
+import { HotkeysSection } from './HotkeysSection';
+
+function setDesktopHost(present: boolean): void {
+ (globalThis as unknown as { window: { okDesktop?: unknown } }).window.okDesktop = present
+ ? {}
+ : undefined;
+}
+
+/** Shortcut ids in the order the list renders them. */
+function renderedShortcutIds(): string[] {
+ return Array.from(document.querySelectorAll('[data-testid^="settings-hotkey-"]')).map((row) =>
+ (row.getAttribute('data-testid') ?? '').replace('settings-hotkey-', ''),
+ );
+}
+
+/** Category headings in the order the list renders them. */
+function renderedCategoryLabels(): string[] {
+ return Array.from(document.querySelectorAll('h4[id^="settings-hotkeys-"]')).map(
+ (heading) => heading.textContent ?? '',
+ );
+}
+
+function renderUnderHost(desktop: boolean): void {
+ setDesktopHost(desktop);
+ render(<HotkeysSection />);
+}
+
+afterEach(() => {
+ cleanup();
+ setDesktopHost(false);
+});
+
+describe('HotkeysSection host awareness', () => {
+ test('lists the Report a bug chord under General on the desktop host', () => {
+ renderUnderHost(true);
+
+ const row = screen.getByTestId('settings-hotkey-report-bug');
+ expect(row.closest('section')?.getAttribute('aria-labelledby')).toBe(
+ 'settings-hotkeys-general',
+ );
+ expect(row.textContent).toContain('Report a bug');
+ // The chord the rest of the app formats for this id, not a literal: the
+ // glyphs themselves are pinned in `keyboard-shortcuts.test.ts`, and jsdom
+ // reports a non-mac platform so a literal here would encode that.
+ expect(row.querySelector('[data-slot="kbd"]')?.textContent).toBe(formatShortcut('report-bug'));
+ });
+
+ test('omits the Report a bug shortcut on the web host', () => {
+ renderUnderHost(false);
+
+ expect(screen.queryByTestId('settings-hotkey-report-bug')).toBeNull();
+ });
+
+ test('keeps every other row on web, including the OK Desktop-scoped ones', () => {
+ // All three carry an `OK Desktop` scope; two (`new-folder`, `navigate-back`)
+ // declare no renderer `match` and also set `shortcutDesktopOnly` on their
+ // command identity, while `toggle-terminal-panel` declares two matches. A
+ // filter derived from any of those incidental signals rather than from the
+ // shortcut's own declared flag would drop at least one of them here, which
+ // is the regression this pins.
+ renderUnderHost(false);
+
+ for (const id of ['new-folder', 'toggle-terminal-panel', 'navigate-back']) {
+ expect(screen.queryByTestId(`settings-hotkey-${id}`)).not.toBeNull();
+ }
+ });
+
+ test('the web list is the desktop list minus exactly the desktop-only rows', () => {
+ renderUnderHost(true);
+ const desktopIds = renderedShortcutIds();
+ cleanup();
+ renderUnderHost(false);
+ const webIds = renderedShortcutIds();
+
+ const declaredDesktopOnly = new Set(
+ KEYBOARD_SHORTCUTS.filter((shortcut) => shortcut.desktopOnly === true).map(
+ (shortcut) => shortcut.id,
+ ),
+ );
+ expect(declaredDesktopOnly.size).toBeGreaterThan(0);
+ expect(webIds).toEqual(desktopIds.filter((id) => !declaredDesktopOnly.has(id)));
+ });
+
+ test('renders the same categories in the same order on both hosts', () => {
+ renderUnderHost(true);
+ const desktopCategories = renderedCategoryLabels();
+ cleanup();
+ renderUnderHost(false);
+
+ expect(renderedCategoryLabels()).toEqual(desktopCategories);
+ });
+});
diff --git a/packages/app/src/components/settings/HotkeysSection.tsx b/packages/app/src/components/settings/HotkeysSection.tsx
index ba050686f..842da5a86 100644
--- a/packages/app/src/components/settings/HotkeysSection.tsx
+++ b/packages/app/src/components/settings/HotkeysSection.tsx
@@ -16,6 +16,7 @@ import {
} from '@/lib/keyboard-shortcuts';
import { cn } from '@/lib/utils';
import { SettingsSectionHeader } from './SettingsSectionHeader';
+import { isOkDesktopHost } from './settings-host-gates';
function ShortcutBindingChips({ binding }: { binding: ShortcutBinding }) {
return formatShortcutBinding(binding)
@@ -39,6 +40,7 @@ function ShortcutBindingChips({ binding }: { binding: ShortcutBinding }) {
export function HotkeysSection() {
const { t } = useLingui();
+ const desktopHost = isOkDesktopHost();
const titleId = 'settings-hotkeys-title';
return (
<section aria-labelledby={titleId} className="space-y-5" data-testid="settings-hotkeys">
@@ -48,7 +50,10 @@ export function HotkeysSection() {
<div className="space-y-6" data-testid="settings-hotkeys-list">
{SHORTCUT_CATEGORY_ORDER.map((category) => {
- const shortcuts = KEYBOARD_SHORTCUTS.filter((shortcut) => shortcut.category === category);
+ const shortcuts = KEYBOARD_SHORTCUTS.filter(
+ (shortcut) =>
+ shortcut.category === category && (desktopHost || shortcut.desktopOnly !== true),
+ );
if (shortcuts.length === 0) return null;
return (
diff --git a/packages/app/src/editor/extensions/shared.dom.test.tsx b/packages/app/src/editor/extensions/shared.dom.test.tsx
index a19cf35a8..e01b449e1 100644
--- a/packages/app/src/editor/extensions/shared.dom.test.tsx
+++ b/packages/app/src/editor/extensions/shared.dom.test.tsx
@@ -1,3 +1,4 @@
+import { COMMAND_IDENTITIES } from '@inkeep/open-knowledge-core';
import { cleanup } from '@testing-library/react';
import { Editor } from '@tiptap/core';
import { NodeSelection } from '@tiptap/pm/state';
@@ -5,6 +6,28 @@ import { afterEach, describe, expect, test } from 'vitest';
import { pressEditorKey } from '../editor-rig.test-helper';
import { sharedExtensions } from './shared';
+/**
+ * Electron accelerator syntax ("CmdOrCtrl+Shift+D") to the `Mod-Shift-d` form
+ * `pressEditorKey` speaks. Returns null for accelerators whose final token is
+ * not a plain character (F-keys, named keys), which the editor keymap does not
+ * bind and `shortcutToKeydownEvent` would encode wrongly anyway.
+ */
+function acceleratorToTiptapShortcut(accelerator: string): string | null {
+ const parts = accelerator.split('+');
+ const key = parts[parts.length - 1];
+ if (key === undefined || key.length !== 1) return null;
+ const modifiers: string[] = [];
+ for (const part of parts.slice(0, -1)) {
+ if (part === 'CmdOrCtrl' || part === 'CommandOrControl') modifiers.push('Mod');
+ else if (part === 'Cmd' || part === 'Command' || part === 'Super') modifiers.push('Cmd');
+ else if (part === 'Ctrl' || part === 'Control') modifiers.push('Ctrl');
+ else if (part === 'Alt' || part === 'Option') modifiers.push('Alt');
+ else if (part === 'Shift') modifiers.push('Shift');
+ else return null;
+ }
+ return [...modifiers, key.toLowerCase()].join('-');
+}
+
describe('sharedExtensions module graph', () => {
afterEach(() => {
cleanup();
@@ -187,4 +210,64 @@ describe('sharedExtensions module graph', () => {
container.remove();
}
});
+ test('no menu accelerator is claimed by the editor keymap', () => {
+ // The surface that let a shipped chord through. Menu accelerators are
+ // checked against this app's shortcut registry, its own menu template and
+ // Electron's role defaults — three lists we author. The editor's bindings
+ // are the fourth, and they are not in this repo at all: TipTap extensions
+ // carry their own defaults, so a chord can grep clean everywhere we look
+ // and still be taken. Shift+Mod+B reached QA that way, where it wrapped
+ // the caret's paragraph in a blockquote and persisted that to disk instead
+ // of running the command.
+ //
+ // Accelerators are read off COMMAND_IDENTITIES rather than listed, so a
+ // rebind is re-checked here instead of re-trusted, and a dependency bump
+ // that newly claims a live chord turns this red.
+ const accelerators = COMMAND_IDENTITIES.flatMap((identity) =>
+ (identity.menu ?? []).flatMap((placement) =>
+ placement.accelerator === undefined
+ ? []
+ : [{ id: identity.id, accelerator: placement.accelerator }],
+ ),
+ );
+ expect(accelerators.length).toBeGreaterThan(0);
+
+ const container = document.createElement('div');
+ document.body.appendChild(container);
+ const editor = new Editor({
+ element: container,
+ content: '<p>alpha</p>',
+ extensions: sharedExtensions,
+ editable: true,
+ });
+
+ const claimed: { id: string; accelerator: string; handled: boolean; docMoved: boolean }[] = [];
+ // An accelerator the mapper cannot express must stay visible. Skipping it
+ // silently is how a chord passes a sweep that never actually pressed it —
+ // the same blind spot that let a chord ship on top of the editor's
+ // blockquote binding. Named keys are exempt because `pressEditorKey` would
+ // encode them wrongly, not because they are safe: TipTap's base keymap does
+ // bind Mod-Delete and Mod-Backspace, so a future named-key accelerator has
+ // to be a decision someone makes here.
+ const unmappable: string[] = [];
+ try {
+ for (const entry of accelerators) {
+ const shortcut = acceleratorToTiptapShortcut(entry.accelerator);
+ if (shortcut === null) {
+ unmappable.push(entry.accelerator);
+ continue;
+ }
+ editor.commands.setContent('<p>alpha</p>');
+ editor.commands.setTextSelection({ from: 1, to: 1 });
+ const { handled, docMoved } = pressEditorKey(editor, shortcut);
+ if (handled || docMoved) claimed.push({ ...entry, handled, docMoved });
+ }
+ } finally {
+ editor.destroy();
+ container.remove();
+ }
+
+ expect(claimed).toEqual([]);
+ expect(unmappable.sort()).toEqual(['Alt+Left', 'Alt+Right', 'CmdOrCtrl+Delete']);
+ });
});
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index 9b813c37a..fcf660fb2 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -6319,3 +6319,42 @@ html.electron-mode [data-slot="sidebar-inner"] {
[data-comment-reveal]::-moz-selection {
background-color: var(--comment-reveal-fill);
}
+
+/* Pointer marker drawn into the frame a bug-report screenshot is taken on.
+ *
+ * `capturePage()` omits the cursor, so without this a report about a hover
+ * state shows a highlighted row and nothing explaining what highlighted it.
+ * The ring is drawn one frame before the shot and taken down as soon as the
+ * capture settles or the reveal timeout fires, so it is on screen only for the
+ * round trip main needs to answer — during which the dialog is still held
+ * closed. It is never part of the app's own UI.
+ *
+ * Deliberately unthemed and deliberately unanimated. It has to read as an
+ * annotation on top of whatever it lands on in either colour scheme, so it
+ * carries its own white piping rather than a token that could match the
+ * surface underneath; and a fade-in would risk the shot catching it
+ * half-transparent. The centre stays hollow so the pixel being pointed at is
+ * still visible. */
+.ok-pointer-marker {
+ position: fixed;
+ /* Above every layer in the app, including any that sets its own — an overlay
+ the user is reporting is exactly what this has to sit on top of. */
+ z-index: 2147483647;
+ width: 22px;
+ height: 22px;
+ border: 2px solid rgb(220 38 38);
+ border-radius: 50%;
+ background: transparent;
+ box-shadow:
+ 0 0 0 1.5px rgb(255 255 255 / 0.95),
+ inset 0 0 0 1.5px rgb(255 255 255 / 0.95);
+ pointer-events: none;
+ transform: translate(-50%, -50%);
+ /* Forced colors would force the border to a system colour and strip the
+ box-shadow, collapsing both channels this ring is made of and leaving it
+ the same colour as every border underneath it — the one outcome the
+ comment above exists to prevent. Here the colours ARE the meaning, not
+ theming, so opt the element out rather than restate them as system
+ colours: the app it annotates is entirely system-coloured in this mode. */
+ forced-color-adjust: none;
+}
diff --git a/packages/app/src/globals.pointer-marker.test.ts b/packages/app/src/globals.pointer-marker.test.ts
new file mode 100644
index 000000000..2e75da31c
--- /dev/null
+++ b/packages/app/src/globals.pointer-marker.test.ts
@@ -0,0 +1,91 @@
+/**
+ * globals.css `.ok-pointer-marker` visual-contract guard.
+ *
+ * The ring the bug-report gate draws at the last known pointer position is the
+ * only explanation a reader of a hover-state report gets for why a row in the
+ * screenshot is highlighted — `capturePage()` omits the cursor. Its entire
+ * geometry lives in this one CSS rule, and the code that injects it depends on
+ * three of the declarations directly: `markPointerPosition` sets only inline
+ * `left` / `top`, which are the pointer's viewport coordinates and are wrong
+ * unless `position: fixed` and the centring `transform` are both present, and
+ * the ring exists specifically to annotate reports filed ABOUT an overlay, so
+ * it has to out-stack every layer in the app.
+ *
+ * Source-level regex guards by necessity, in the shape the sibling
+ * `globals.*.test.ts` files established: jsdom applies no stylesheet, so a DOM
+ * test can only see that an element with the class exists carrying the right
+ * inline coordinates — true with or without this rule. The one tier that sees
+ * real pixels (`packages/desktop/tests/smoke/report-bug.e2e.ts`) parks the
+ * pointer identically for both of its captures on purpose, which cancels the
+ * marker out of its diff by construction. So nothing anywhere reds if a
+ * declaration here is dropped, and the failure it would ship is a ring at the
+ * document origin, off by half its size, or hidden under the very overlay the
+ * report is about.
+ */
+
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { describe, expect, test } from 'vitest';
+
+const RAW_CSS = readFileSync(join(__dirname, 'globals.css'), 'utf8');
+/** Comments stripped so the rule's own prose cannot satisfy a match. */
+const CSS = RAW_CSS.replace(/\/\*[\s\S]*?\*\//g, '');
+
+/**
+ * The `.ok-pointer-marker` declaration body, bounded to that block. Bounding
+ * matters: a whole-file `toMatch` would pass on any rule in 6000 lines that
+ * happens to carry the declaration, which is the shape that asserts nothing.
+ */
+function markerDeclarations(): string {
+ const block = CSS.match(/(?:^|[}\s])\.ok-pointer-marker\s*\{([^{}]*)\}/);
+ return block?.[1] ?? '';
+}
+
+describe('globals.css — .ok-pointer-marker', () => {
+ test('the rule exists (guard is not vacuous)', () => {
+ expect(markerDeclarations().trim().length).toBeGreaterThan(0);
+ });
+
+ test('is viewport-positioned, so the injected inline left/top are pointer coordinates', () => {
+ // `markPointerPosition` writes `event.clientX/clientY` straight into
+ // `style.left/top`. Anything but `fixed` re-anchors those to the nearest
+ // positioned ancestor or the document, putting the ring somewhere the
+ // pointer never was — worse than the null the tracker returns when it has
+ // no position at all.
+ expect(markerDeclarations()).toMatch(/position\s*:\s*fixed/);
+ });
+
+ test('centres itself on those coordinates', () => {
+ // Without this the ring hangs down-right of the pointer by half its size,
+ // which on a 22px ring is enough to annotate the neighbouring row.
+ expect(markerDeclarations()).toMatch(/transform\s*:\s*translate\(\s*-50%\s*,\s*-50%\s*\)/);
+ });
+
+ test('out-stacks every layer in the app', () => {
+ // The motivating report is one filed ABOUT an open overlay, so the ring
+ // has to sit on top of a Radix layer that sets its own z-index.
+ const zIndex = markerDeclarations().match(/z-index\s*:\s*(\d+)/);
+ expect(zIndex, 'z-index declaration must be present').not.toBeNull();
+ expect(Number(zIndex?.[1])).toBe(2147483647);
+ });
+
+ test('keeps both of its visual channels under forced colors', () => {
+ // Forced-colors mode forces `border-color` to a system colour and strips
+ // `box-shadow`, which would collapse the ring to the same colour as every
+ // border underneath it. The colours here are meaning rather than theming,
+ // so the element opts out.
+ expect(markerDeclarations()).toMatch(/forced-color-adjust\s*:\s*none/);
+ });
+
+ test('does not intercept input while it is on screen', () => {
+ // It is drawn over a live app for the length of the capture round trip.
+ expect(markerDeclarations()).toMatch(/pointer-events\s*:\s*none/);
+ });
+
+ test('draws a hollow ring rather than a filled dot', () => {
+ // The pixel being pointed at has to stay visible in the screenshot.
+ expect(markerDeclarations()).toMatch(/border\s*:\s*[^;]*solid/);
+ expect(markerDeclarations()).toMatch(/border-radius\s*:\s*50%/);
+ expect(markerDeclarations()).toMatch(/background\s*:\s*transparent/);
+ });
+});
diff --git a/packages/app/src/lib/command-menu-parity.test.ts b/packages/app/src/lib/command-menu-parity.test.ts
index 8ec19fc91..a91955d52 100644
--- a/packages/app/src/lib/command-menu-parity.test.ts
+++ b/packages/app/src/lib/command-menu-parity.test.ts
@@ -23,6 +23,7 @@ import { PALETTE_COMMANDS } from '@/components/command-palette-commands';
import { APP_RESERVED_IDS, PALETTE_COMMAND_IDS } from '@/lib/command-menu-parity.test-helper';
import {
formatShortcut,
+ KEYBOARD_SHORTCUTS,
type KeyboardShortcutId,
type ShortcutPlatform,
} from '@/lib/keyboard-shortcuts';
@@ -362,8 +363,17 @@ describe('command-menu parity ratchet', () => {
{ menuLabel: 'Forward', shortcutId: 'navigate-forward' },
];
+ // A single `CmdOrCtrl+…` accelerator has to resolve on BOTH platforms, so
+ // these pairs are swept twice. The navigation pairs above cannot join them:
+ // they declare a platform-SPLIT accelerator (Cmd+[ vs Alt+Left), so each
+ // platform's leaf carries a different chord.
+ const CROSS_PLATFORM_SHORTCUT_PAIRS: readonly MenuShortcutPair[] = [
+ { menuLabel: 'Report a bug', shortcutId: 'report-bug' },
+ ];
+
const MENU_SHORTCUT_PAIRS: readonly MenuShortcutPair[] = [
...NAVIGATION_HISTORY_SHORTCUT_PAIRS,
+ ...CROSS_PLATFORM_SHORTCUT_PAIRS,
{ menuLabel: 'New file', shortcutId: 'new-item' },
{ menuLabel: 'New folder', shortcutId: 'new-folder' },
{ menuLabel: 'Switch project', shortcutId: 'switch-project' },
@@ -429,6 +439,29 @@ describe('command-menu parity ratchet', () => {
expectMenuShortcutParity(NAVIGATION_HISTORY_SHORTCUT_PAIRS, 'win32', 'windowsLinux');
});
+ test('Ratchet D: cross-platform accelerators agree on Windows/Linux as well', () => {
+ expectMenuShortcutParity(CROSS_PLATFORM_SHORTCUT_PAIRS, 'win32', 'windowsLinux');
+ });
+
+ test('Ratchet D: cross-platform accelerators declare a platform-neutral modifier', () => {
+ // `chordTokens` folds Cmd / Ctrl / CmdOrCtrl into one MOD token, so a
+ // placement that declares a bare `Cmd+…` with no `platform` gate satisfies
+ // both sweeps above while binding nothing at all on Windows and Linux. Pin
+ // the literal string, which is the only thing that distinguishes them.
+ for (const platform of ['darwin', 'win32'] as const) {
+ const leaves = collectLeavesForPlatform(platform);
+ const accelerators = CROSS_PLATFORM_SHORTCUT_PAIRS.map((pair) => ({
+ menuLabel: pair.menuLabel,
+ accelerator: leaves.find((leaf) => normalizeLabel(leaf.label) === pair.menuLabel)
+ ?.accelerator,
+ }));
+ expect({ platform, accelerators }).toEqual({
+ platform,
+ accelerators: [{ menuLabel: 'Report a bug', accelerator: 'CmdOrCtrl+Shift+D' }],
+ });
+ }
+ });
+
// Exactly one bridge.onMenuAction listener (the bus forwarder) — no subscriber
// may double-fire alongside it.
test('FR3: the bus forwarder is the only bridge.onMenuAction listener', () => {
@@ -530,6 +563,28 @@ describe('command identity registry (Phase 2b)', () => {
]);
});
+ test('a shortcut hidden from the web hotkeys list is chordless in the web palette too', () => {
+ // Two surfaces read two flags: Settings drops a `desktopOnly` shortcut's
+ // whole row on web, the palette drops a `shortcutDesktopOnly` command's
+ // chord glyphs there. Declaring one without the other hides the row in one
+ // place while still printing the chord in the other.
+ const desktopOnlyShortcutIds = KEYBOARD_SHORTCUTS.filter(
+ (shortcut) => shortcut.desktopOnly === true,
+ ).map((shortcut) => shortcut.id);
+
+ // Pinned rather than merely counted: a new desktop-only shortcut has to be
+ // classified here, which is where the pairing below gets checked.
+ expect(desktopOnlyShortcutIds.sort()).toEqual(['report-bug']);
+
+ const chordShownOnWeb = COMMAND_IDENTITIES.filter(
+ (command) =>
+ command.shortcutId !== undefined &&
+ desktopOnlyShortcutIds.includes(command.shortcutId) &&
+ command.shortcutDesktopOnly !== true,
+ ).map((command) => command.id);
+ expect(chordShownOnWeb).toEqual([]);
+ });
+
test('every registry menuActionId is a real OkMenuAction', () => {
const bad = COMMAND_IDENTITIES.flatMap((cmd) =>
cmd.menuActionId && !OK_MENU_ACTION_SET.has(cmd.menuActionId) ? [cmd.id] : [],
diff --git a/packages/app/src/lib/keyboard-shortcuts.test.ts b/packages/app/src/lib/keyboard-shortcuts.test.ts
index da2eadf9a..7d5333ed1 100644
--- a/packages/app/src/lib/keyboard-shortcuts.test.ts
+++ b/packages/app/src/lib/keyboard-shortcuts.test.ts
@@ -1,3 +1,6 @@
+import { readFileSync } from 'node:fs';
+import { createRequire } from 'node:module';
+import { dirname, join } from 'node:path';
import { describe, expect, test } from 'vitest';
import {
formatShortcut,
@@ -853,6 +856,129 @@ describe('keyboard shortcut registry', () => {
}
});
+ test('formats the report-bug shortcut as Shift+Cmd / Ctrl+Shift + D', () => {
+ expect(formatShortcut('report-bug', 'mac')).toBe('⇧⌘ D');
+ expect(formatShortcut('report-bug', 'windowsLinux')).toBe('Ctrl Shift D');
+ });
+
+ test('registers report-bug under the General shortcut-help category', () => {
+ const byId = new Map(KEYBOARD_SHORTCUTS.map((shortcut) => [shortcut.id, shortcut]));
+ expect(byId.get('report-bug')?.category).toBe('general');
+ });
+
+ test('the traced xterm version stays pinned', () => {
+ // The chord's immunity inside a focused terminal pane is a TRACED property of
+ // one xterm release, not a guarantee: @xterm/xterm 6.0.0 ships no
+ // modifyOtherKeys / CSI-u encoding, so its keydown path finds nothing to
+ // encode for Ctrl+Shift+<letter> and returns before the call that would
+ // `preventDefault()`. A release that adds one starts encoding exactly this
+ // shape and silently claims the chord — the terminal would swallow it and
+ // the reporter would stop opening from the surface a user is most likely to
+ // be reporting about.
+ //
+ // EQUALITY, not a floor, unlike the sibling guard in
+ // `editor/extensions/raw-mdx-nested-copy-version-pin.test.ts`: there the
+ // hazard is drifting BELOW a verified version, so forward drift is safe.
+ // Here forward drift is the hazard itself, so any move re-opens the question
+ // and has to trip this.
+ //
+ // BOTH halves, because they catch different edits. The declared string
+ // catches the manifest being loosened (`^6.0.0` is not `6.0.0`, so it trips
+ // the moment the pin stops being exact). The resolved version catches the
+ // installed package moving underneath a pin that still looks right — a
+ // lockfile edit, a stale store, a patched copy. Asserting only the manifest
+ // would miss the second; asserting only the resolved version would let a
+ // caret range through for as long as it happened to resolve to 6.0.0, and
+ // trip later on an unrelated `pnpm update` with no obvious cause.
+ //
+ // Resolution follows the sibling guard's shape in
+ // `editor/extensions/raw-mdx-nested-copy-version-pin.test.ts`.
+ //
+ // When this trips: re-run the trace in `keyboard-shortcuts.ts` against the
+ // new release before moving the pin.
+ const require_ = createRequire(import.meta.url);
+ // Node's strict exports resolver rejects a bare `<pkg>/package.json` subpath
+ // unless the package lists it, so resolve the main entry and walk up.
+ let dir = dirname(require_.resolve('@xterm/xterm'));
+ let resolved: string | undefined;
+ for (;;) {
+ try {
+ const parsed = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as {
+ name?: string;
+ version?: string;
+ };
+ if (parsed.name === '@xterm/xterm' && parsed.version) {
+ resolved = parsed.version;
+ break;
+ }
+ } catch {
+ // no package.json here, or a nested one with a different name — walk up
+ }
+ const parent = dirname(dir);
+ if (parent === dir) break;
+ dir = parent;
+ }
+ expect(resolved).toBe('6.0.0');
+ const manifest = JSON.parse(
+ readFileSync(new URL('../../package.json', import.meta.url), 'utf8'),
+ ) as { dependencies?: Record<string, string> };
+ expect(manifest.dependencies?.['@xterm/xterm']).toBe('6.0.0');
+ });
+
+ test('the report-bug chord is display-only and matches no shortcut in the registry', () => {
+ // A native menu accelerator delivers this chord, so no renderer listener may
+ // claim it — not even the report-bug row itself. A `match` added to that
+ // binding would put the chord back behind the app-global overlay gate, which
+ // is the one place it must not be.
+ //
+ // The probe is READ OFF the binding rather than restated. A literal here
+ // survives a rebind by silently probing the retired chord, which leaves the
+ // sweep passing while testing a key nothing is bound to — coverage that
+ // reads as protection and is not.
+ const binding = KEYBOARD_SHORTCUTS.find((shortcut) => shortcut.id === 'report-bug')
+ ?.bindings[0];
+ const letter = binding?.mac.trim().slice(-1).toLowerCase();
+ // Guards the derivation itself: a binding whose trailing token stops being
+ // a single letter would silently probe something meaningless.
+ expect(letter).toMatch(/^[a-z]$/);
+ expect(binding?.windowsLinux.trim().slice(-1).toLowerCase()).toBe(letter);
+ const code = `Key${letter?.toUpperCase()}`;
+ const macEvent = {
+ metaKey: true,
+ ctrlKey: false,
+ altKey: false,
+ shiftKey: true,
+ key: letter as string,
+ code,
+ };
+ const winEvent = {
+ metaKey: false,
+ ctrlKey: true,
+ altKey: false,
+ shiftKey: true,
+ key: letter as string,
+ code,
+ };
+ const claimedBy: string[] = [];
+ for (const shortcut of KEYBOARD_SHORTCUTS) {
+ // The public array widens `id` to `string`; every runtime value is a
+ // registered id, so narrowing it back for the matcher lookup is sound.
+ const id = shortcut.id as KeyboardShortcutId;
+ if (matchesKeyboardShortcut(macEvent, id, 'mac')) claimedBy.push(`mac:${id}`);
+ if (matchesKeyboardShortcut(winEvent, id, 'windowsLinux')) claimedBy.push(`win:${id}`);
+ // Both hosts: a native menu bar is present on desktop, absent on web.
+ for (const hasNativeMenu of [true, false]) {
+ if (matchesRendererShortcut(macEvent, id, hasNativeMenu, 'mac')) {
+ claimedBy.push(`mac-renderer:${id}`);
+ }
+ if (matchesRendererShortcut(winEvent, id, hasNativeMenu, 'windowsLinux')) {
+ claimedBy.push(`win-renderer:${id}`);
+ }
+ }
+ }
+ expect(claimedBy).toEqual([]);
+ });
+
test('the mode toggle requires its Alt modifier so it never steals Cmd+M', () => {
// Cmd+M (no Alt) is the macOS "minimize window" chord — the toggle must not
// fire on it, nor on a bare M keypress.
diff --git a/packages/app/src/lib/keyboard-shortcuts.ts b/packages/app/src/lib/keyboard-shortcuts.ts
index 611efd56d..93f9b0fac 100644
--- a/packages/app/src/lib/keyboard-shortcuts.ts
+++ b/packages/app/src/lib/keyboard-shortcuts.ts
@@ -66,6 +66,18 @@ export interface KeyboardShortcutDefinition {
description: MessageDescriptor;
scope: MessageDescriptor;
bindings: ShortcutBinding[];
+ /**
+ * Keep this shortcut out of the Settings hotkeys list on a web host, where
+ * nothing can fire it.
+ *
+ * Opt-in per shortcut rather than derived, and that is the load-bearing part:
+ * every derivation available here — the `OK Desktop` scope string, the
+ * command identity's `shortcutDesktopOnly`, "no binding declares a renderer
+ * `match`" — is equally true of `new-folder`, `navigate-back`, and
+ * `navigate-forward`, which are listed on web today. A derived filter would
+ * silently drop those three rows, so each omission is declared instead.
+ */
+ desktopOnly?: boolean;
}
type ShortcutTargetLike =
@@ -322,6 +334,51 @@ const KEYBOARD_SHORTCUT_DEFINITIONS = [
},
],
},
+ {
+ // Accelerator-only by design: the native Help-menu item delivers this
+ // chord, so there is deliberately no `match` here and no renderer keydown
+ // listener. Adding a `match` would put it back behind the app-global
+ // overlay gate that every renderer listener honors, which is the one place
+ // this chord must not be — a bug reporter is reached from exactly the
+ // states that gate refuses.
+ //
+ // How far that buys immunity is platform-specific, and only macOS gets it
+ // for free. There AppKit resolves the main menu's key equivalents before
+ // the event reaches the web view, so a focused Radix layer never sees the
+ // keystroke. On Windows and Linux the menu is a per-window top menu and
+ // Electron resolves its accelerators on the browser side of the renderer's
+ // input path, so a focused surface calling `preventDefault()` on the chord
+ // cancels the menu item too — `TerminalPanel`'s xterm handler relies on
+ // precisely that to keep Ctrl+C/V away from the hidden Edit menu on Linux.
+ // Nothing in the app claims Shift+Mod+D today; if something ever does, it
+ // has to exempt this chord rather than assume the OS got there first.
+ //
+ // A focused terminal is the sharpest case, since the terminal window mounts
+ // its own report trigger and xterm sees the keydown first there. Traced
+ // against @xterm/xterm 6.0.0 and it survives: `TerminalPanel`'s custom
+ // handler falls through for this chord, and xterm's own keydown then finds
+ // nothing to encode — its ctrl-letter branch requires `!shiftKey`, and the
+ // `key && ctrlKey` fallback below it covers only `_` and `@` — so it
+ // returns at its `if (!result.key)` early exit, ahead of the one call that
+ // would `preventDefault()`. That version ships no modifyOtherKeys / CSI-u
+ // encoding; a bump that adds one would start encoding Ctrl+Shift+<letter>
+ // and silently claim this chord inside a terminal pane.
+ //
+ // NOT ⇧⌘B, however obvious "B for bug" looks: TipTap's blockquote extension
+ // binds Mod-Shift-B, so with the editor focused that chord wraps the caret's
+ // paragraph in a blockquote and persists it instead of opening a report.
+ // ⇧⌘H and ⇧⌘S are spoken for the same way (highlight, strike). Those
+ // bindings live in the editor dependency's own defaults, not in this
+ // registry, so a chord that greps clean here can still be taken — check
+ // the extension defaults before adding one.
+ id: 'report-bug',
+ category: 'general',
+ title: msg`Report a bug`,
+ description: msg`Start a bug report with a screenshot of the screen as it looks right now.`,
+ scope: msg`OK Desktop`,
+ desktopOnly: true,
+ bindings: [{ mac: '⇧⌘ D', windowsLinux: 'Ctrl Shift D' }],
+ },
{
id: 'navigate-back',
category: 'navigation',
diff --git a/packages/app/src/lib/local-menu-action-bus.test.ts b/packages/app/src/lib/local-menu-action-bus.test.ts
index 959ff6b42..aba9c51f4 100644
--- a/packages/app/src/lib/local-menu-action-bus.test.ts
+++ b/packages/app/src/lib/local-menu-action-bus.test.ts
@@ -1,5 +1,7 @@
+import { readdirSync, readFileSync } from 'node:fs';
+import { join, relative } from 'node:path';
import { afterEach, describe, expect, test, vi } from 'vitest';
-import type { OkMenuAction } from './desktop-bridge-types';
+import type { OkMenuAction, OkMenuActionOrigin } from './desktop-bridge-types';
import {
__resetLocalMenuActionBusForTests,
emitLocalMenuAction,
@@ -21,8 +23,8 @@ describe('local menu-action bus', () => {
expect(a).toHaveBeenCalledTimes(1);
expect(b).toHaveBeenCalledTimes(1);
- expect(a).toHaveBeenLastCalledWith('toggle-sidebar');
- expect(b).toHaveBeenLastCalledWith('toggle-sidebar');
+ expect(a).toHaveBeenLastCalledWith('toggle-sidebar', { launcherBorne: false });
+ expect(b).toHaveBeenLastCalledWith('toggle-sidebar', { launcherBorne: false });
});
test('the same handler subscribed once fires once per emit', () => {
@@ -92,11 +94,35 @@ describe('local menu-action bus', () => {
test('emitting with no subscribers is a no-op', () => {
expect(() => emitLocalMenuAction('report-bug')).not.toThrow();
});
+
+ test('an emitter that declares itself launcher-borne delivers that origin', () => {
+ const handler = vi.fn(() => {});
+ subscribeLocalMenuAction(handler);
+
+ emitLocalMenuAction('report-bug', { launcherBorne: true });
+
+ expect(handler).toHaveBeenLastCalledWith('report-bug', { launcherBorne: true });
+ });
+
+ test('an emitter that declares nothing is launcher-free, not unclassified', () => {
+ let seen: OkMenuActionOrigin | undefined;
+ subscribeLocalMenuAction((_action, origin) => {
+ seen = origin;
+ });
+
+ emitLocalMenuAction('report-bug');
+
+ // A subscriber may read `origin.launcherBorne` without a null check, so the
+ // default has to be a real origin rather than an absent second argument.
+ expect(seen).toEqual({ launcherBorne: false });
+ });
});
// The forwarder path reads `window.okDesktop`, absent in this non-DOM unit env.
// These tests stub it and MUST restore `globalThis.window` afterward — a leaked
// stub breaks unrelated non-DOM tests on Linux CI.
+type InboundMenuAction = (action: OkMenuAction, origin: OkMenuActionOrigin) => void;
+
describe('local menu-action bus — bridge forwarder', () => {
const originalWindow = globalThis.window;
@@ -114,9 +140,9 @@ describe('local menu-action bus — bridge forwarder', () => {
});
test('a single inbound native menu action fires each handler exactly once', () => {
- let inbound: ((action: OkMenuAction) => void) | null = null;
+ let inbound: InboundMenuAction | null = null;
setDesktop({
- onMenuAction: (cb: (action: OkMenuAction) => void) => {
+ onMenuAction: (cb: InboundMenuAction) => {
inbound = cb;
return () => {};
},
@@ -127,9 +153,26 @@ describe('local menu-action bus — bridge forwarder', () => {
// The forwarder installed exactly one bridge listener.
expect(inbound).not.toBeNull();
// One inbound native action → exactly one handler invocation (no double-fire).
- inbound?.('toggle-sidebar');
+ inbound?.('toggle-sidebar', { launcherBorne: false });
expect(handler).toHaveBeenCalledTimes(1);
- expect(handler).toHaveBeenLastCalledWith('toggle-sidebar');
+ expect(handler).toHaveBeenLastCalledWith('toggle-sidebar', { launcherBorne: false });
+ });
+
+ test('the forwarder hands subscribers the origin main stamped, not a default', () => {
+ let inbound: InboundMenuAction | null = null;
+ setDesktop({
+ onMenuAction: (cb: InboundMenuAction) => {
+ inbound = cb;
+ return () => {};
+ },
+ });
+
+ const handler = vi.fn(() => {});
+ subscribeLocalMenuAction(handler);
+ // Main classifies the dispatching surface; the forwarder must not re-decide.
+ inbound?.('report-bug', { launcherBorne: true });
+
+ expect(handler).toHaveBeenLastCalledWith('report-bug', { launcherBorne: true });
});
test('the forwarder installs once (ref-counted) and tears down when the last subscriber leaves', () => {
@@ -160,3 +203,110 @@ describe('local menu-action bus — bridge forwarder', () => {
expect(handler).toHaveBeenCalledTimes(1);
});
});
+
+/**
+ * Every production emitter, with the origin it declares.
+ *
+ * `emitLocalMenuAction`'s origin parameter defaults to launcher-free, and that
+ * default is deliberate — a persistent chrome button IS launcher-free, and
+ * spelling it out at twenty call sites would add noise for no information. The
+ * exposure is one-directional and lands on this changeset's own subject: an
+ * emitter that IS a transient overlay and forgets to say so compiles clean and
+ * ships a bug report whose screenshot is a picture of the launcher the user
+ * opened only in order to file it.
+ *
+ * Making the parameter required would enforce it in the type system at the cost
+ * of ~22 argument edits across eleven unrelated test files. This is the same
+ * enforcement for the cost of one list: a new emitter cannot land without
+ * appearing here, so its provenance is a decision someone made rather than one
+ * the default made for them.
+ */
+const EXPECTED_EMITTERS = [
+ { file: 'components/CommandPalette.tsx', origins: ['{ launcherBorne: true }'] },
+ {
+ file: 'components/NavigationHistoryControls.tsx',
+ origins: ['<default: launcher-free>', '<default: launcher-free>'],
+ },
+];
+
+/** Argument text of each `emitLocalMenuAction(...)` call, paren-balanced. */
+function emitCallArguments(source: string): string[] {
+ const calls: string[] = [];
+ const needle = 'emitLocalMenuAction(';
+ let from = 0;
+ for (;;) {
+ const at = source.indexOf(needle, from);
+ if (at === -1) return calls;
+ let depth = 0;
+ let end = at + needle.length - 1;
+ for (let i = end; i < source.length; i += 1) {
+ const ch = source[i];
+ if (ch === '(') depth += 1;
+ else if (ch === ')') {
+ depth -= 1;
+ if (depth === 0) {
+ end = i;
+ break;
+ }
+ }
+ }
+ calls.push(source.slice(at + needle.length, end));
+ from = end + 1;
+ }
+}
+
+/** The origin argument as written, or the marker for "took the default". */
+function declaredOrigin(args: string): string {
+ let depth = 0;
+ for (let i = 0; i < args.length; i += 1) {
+ const ch = args[i];
+ if (ch === '{' || ch === '(' || ch === '[') depth += 1;
+ else if (ch === '}' || ch === ')' || ch === ']') depth -= 1;
+ else if (ch === ',' && depth === 0) {
+ const rest = args.slice(i + 1).trim();
+ return rest.length > 0 ? rest : '<default: launcher-free>';
+ }
+ }
+ return '<default: launcher-free>';
+}
+
+describe('local menu-action bus — production emitters declare their provenance', () => {
+ test('the set of emitters and their declared origins is exactly the reviewed one', () => {
+ const appSrc = join(import.meta.dir, '..');
+ const isTestLike = (name: string) => /\.(test|dom\.test|test-helper)\.[cm]?tsx?$/.test(name);
+ const found: { file: string; origins: string[] }[] = [];
+ // A file that imports the emitter but whose calls this census cannot parse
+ // — an aliased import, say — would otherwise fall through the `continue`
+ // below and never reach `found`, leaving the exact-equality assertion to
+ // pass with an unclassified emitter in the tree. That is the one outcome
+ // this census exists to rule out, so make it loud instead.
+ const importsButUnparsed: string[] = [];
+ const walk = (dir: string): void => {
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
+ const full = join(dir, entry.name);
+ if (entry.isDirectory()) {
+ walk(full);
+ continue;
+ }
+ if (!/\.[cm]?tsx?$/.test(entry.name) || isTestLike(entry.name)) continue;
+ const source = readFileSync(full, 'utf8');
+ // The bus declares the function; it does not call it.
+ if (full.endsWith('local-menu-action-bus.ts')) continue;
+ const calls = emitCallArguments(source);
+ if (calls.length === 0) {
+ if (source.includes('emitLocalMenuAction'))
+ importsButUnparsed.push(relative(appSrc, full));
+ continue;
+ }
+ found.push({
+ file: relative(appSrc, full),
+ origins: calls.map(declaredOrigin),
+ });
+ }
+ };
+ walk(appSrc);
+
+ expect(importsButUnparsed).toEqual([]);
+ expect(found.sort((a, b) => a.file.localeCompare(b.file))).toEqual(EXPECTED_EMITTERS);
+ });
+});
diff --git a/packages/app/src/lib/local-menu-action-bus.ts b/packages/app/src/lib/local-menu-action-bus.ts
index b60c482e9..ff955ee1f 100644
--- a/packages/app/src/lib/local-menu-action-bus.ts
+++ b/packages/app/src/lib/local-menu-action-bus.ts
@@ -1,4 +1,4 @@
-import type { OkMenuAction } from './desktop-bridge-types';
+import type { OkMenuAction, OkMenuActionOrigin } from './desktop-bridge-types';
/**
* Renderer-local fan-out for menu actions, so both invocation surfaces converge
@@ -20,7 +20,14 @@ import type { OkMenuAction } from './desktop-bridge-types';
* real menu click fires each handler exactly once (no double-fire).
*/
-type Listener = (action: OkMenuAction) => void;
+type Listener = (action: OkMenuAction, origin: OkMenuActionOrigin) => void;
+
+/**
+ * What a producer that is not itself a transient overlay dispatches: a native
+ * menu item, a keyboard accelerator, a persistent chrome button. Frozen and
+ * shared because it is the common case and subscribers only read it.
+ */
+const LAUNCHER_FREE_ORIGIN: OkMenuActionOrigin = Object.freeze({ launcherBorne: false });
const listeners = new Set<Listener>();
@@ -38,8 +45,8 @@ function ensureBridgeForwarder(): void {
// `onMenuAction` — guard so the forwarder never throws on a truthy-but-thin
// `window.okDesktop`; direct palette emits still reach every subscriber.
if (bridge == null || typeof bridge.onMenuAction !== 'function') return;
- bridgeForwarderUnsubscribe = bridge.onMenuAction((action) => {
- emitLocalMenuAction(action);
+ bridgeForwarderUnsubscribe = bridge.onMenuAction((action, origin) => {
+ emitLocalMenuAction(action, origin);
});
}
@@ -70,14 +77,22 @@ export function subscribeLocalMenuAction(cb: Listener): () => void {
* native menu clicks. Iterates the live subscriber set — JS Set iteration
* tolerates a subscriber that unsubscribes itself mid-dispatch; a subscriber
* must not synchronously unsubscribe a sibling from within its handler.
+ *
+ * A direct emitter that IS a transient overlay — the Cmd+K palette — must pass
+ * its own origin; the forwarder passes through whatever main stamped. Omitting
+ * it declares the dispatch launcher-free, which is right for chrome buttons and
+ * wrong for anything that dismisses itself on dispatch.
*/
-export function emitLocalMenuAction(action: OkMenuAction): void {
+export function emitLocalMenuAction(
+ action: OkMenuAction,
+ origin: OkMenuActionOrigin = LAUNCHER_FREE_ORIGIN,
+): void {
// Iterate the live set: JS Set iteration tolerates a subscriber that
// unsubscribes itself mid-dispatch. Subscribers must not synchronously
// unsubscribe a sibling during their handler.
for (const cb of listeners) {
try {
- cb(action);
+ cb(action, origin);
} catch (err) {
// Isolate subscriber faults: this bus is the single dispatch path for
// native menu clicks AND palette commands, so one throwing handler must
diff --git a/packages/app/src/lib/pointer-position.dom.test.ts b/packages/app/src/lib/pointer-position.dom.test.ts
new file mode 100644
index 000000000..fe0c0991f
--- /dev/null
+++ b/packages/app/src/lib/pointer-position.dom.test.ts
@@ -0,0 +1,78 @@
+/**
+ * Substrate: jsdom via `pnpm run test:dom`. No component renders here — the
+ * tracker is plain window listeners over module state.
+ */
+
+import { afterEach, describe, expect, test } from 'vitest';
+import { getLastPointerPosition, installPointerPositionTracker } from './pointer-position';
+
+let uninstall: (() => void) | undefined;
+
+afterEach(() => {
+ uninstall?.();
+ uninstall = undefined;
+});
+
+function movePointerTo(x: number, y: number): void {
+ window.dispatchEvent(new PointerEvent('pointermove', { clientX: x, clientY: y, bubbles: true }));
+}
+
+describe('last-known pointer position', () => {
+ test('reports nothing until the pointer moves, then where it moved to', () => {
+ uninstall = installPointerPositionTracker();
+
+ expect(getLastPointerPosition()).toBeNull();
+
+ movePointerTo(120, 48);
+ expect(getLastPointerPosition()).toEqual({ x: 120, y: 48 });
+
+ movePointerTo(640, 300);
+ expect(getLastPointerPosition()).toEqual({ x: 640, y: 300 });
+ });
+
+ test('forgets the position once the pointer leaves the window', () => {
+ uninstall = installPointerPositionTracker();
+ movePointerTo(120, 48);
+
+ // Crossing between two elements inside the window is not leaving it.
+ window.dispatchEvent(
+ new PointerEvent('pointerout', { bubbles: true, relatedTarget: document.body }),
+ );
+ expect(getLastPointerPosition()).toEqual({ x: 120, y: 48 });
+
+ window.dispatchEvent(new PointerEvent('pointerout', { bubbles: true, relatedTarget: null }));
+ expect(getLastPointerPosition()).toBeNull();
+ });
+
+ test('a second install does not let the first disposer blind the second', () => {
+ // Two listener pairs on one module-global position: disposing the first
+ // would forget the position while the second pair is still recording into
+ // it, so the tracker reads as installed and answers null forever.
+ const stop = installPointerPositionTracker();
+ const stopAgain = installPointerPositionTracker();
+ movePointerTo(200, 90);
+
+ expect(stopAgain).toBe(stop);
+ expect(getLastPointerPosition()).toEqual({ x: 200, y: 90 });
+
+ stop();
+ expect(getLastPointerPosition()).toBeNull();
+
+ // And the module is installable again afterwards, not latched shut.
+ const restart = installPointerPositionTracker();
+ movePointerTo(15, 25);
+ expect(getLastPointerPosition()).toEqual({ x: 15, y: 25 });
+ restart();
+ });
+
+ test('reports nothing once uninstalled, and stops recording', () => {
+ const stop = installPointerPositionTracker();
+ movePointerTo(120, 48);
+
+ stop();
+ expect(getLastPointerPosition()).toBeNull();
+
+ movePointerTo(640, 300);
+ expect(getLastPointerPosition()).toBeNull();
+ });
+});
diff --git a/packages/app/src/lib/pointer-position.ts b/packages/app/src/lib/pointer-position.ts
new file mode 100644
index 000000000..7871b3676
--- /dev/null
+++ b/packages/app/src/lib/pointer-position.ts
@@ -0,0 +1,81 @@
+/**
+ * Last-known pointer position, so a bug-report screenshot can show where the
+ * cursor was.
+ *
+ * `capturePage()` never includes the cursor, so a report filed about a hover
+ * state arrives as a highlighted row with nothing in the picture to explain
+ * what highlighted it. The report gate reads this position a frame before it
+ * shoots and draws a marker there.
+ *
+ * The answer is deliberately absent rather than approximated in the two cases
+ * where the app has none: before the pointer has moved at all (a window
+ * reached by keyboard), and once it has left the viewport — a marker pinned to
+ * the edge the pointer exited would claim a hover the user is not making.
+ */
+
+export interface PointerPosition {
+ /** Viewport coordinates, matching `PointerEvent.clientX` / `clientY`. */
+ readonly x: number;
+ readonly y: number;
+}
+
+// Held as primitives, and boxed only on read: `pointermove` fires up to a
+// hundred times a second whenever the pointer is in motion, and this listener
+// is app-global, while a read happens once per bug report.
+let lastX = 0;
+let lastY = 0;
+let known = false;
+/** The live tracker's disposer, or null when nothing is listening. */
+let installed: (() => void) | null = null;
+
+/**
+ * Start tracking. Returns a disposer that also forgets the position: with no
+ * listener running, what is held is not a last-known position but a stale one.
+ *
+ * No-op off the browser, matching `overlay-layers.ts` — the node-env test tiers
+ * and any SSR pass import this module without a `window` to listen on.
+ */
+export function installPointerPositionTracker(): () => void {
+ if (typeof window === 'undefined') return () => {};
+ // A second install would leave two listener pairs live, and the FIRST
+ // disposer would then clear the position out from under the second — so the
+ // tracker would look installed and report nothing. Same guard the sibling
+ // module-global installers carry (`relaunch-store`, `receive-store`).
+ if (installed !== null) return installed;
+ const controller = new AbortController();
+ const listenerOptions = { passive: true, signal: controller.signal };
+ window.addEventListener(
+ 'pointermove',
+ (event: PointerEvent) => {
+ lastX = event.clientX;
+ lastY = event.clientY;
+ known = true;
+ },
+ listenerOptions,
+ );
+ window.addEventListener(
+ 'pointerout',
+ (event: PointerEvent) => {
+ // A non-null `relatedTarget` is the pointer crossing between two
+ // elements inside the window, which changes nothing about where it is.
+ // Null is the predicate for "there is no element it went to", which is
+ // how leaving the window presents — and also, per the Pointer Events
+ // event list, how a `pointerup` on a device without hover and a
+ // resolved removal of the element underneath present. Those degrade to
+ // a marker that is absent rather than one drawn somewhere wrong, which
+ // is the direction this module errs in everywhere else.
+ if (event.relatedTarget === null) known = false;
+ },
+ listenerOptions,
+ );
+ installed = () => {
+ controller.abort();
+ known = false;
+ installed = null;
+ };
+ return installed;
+}
+
+export function getLastPointerPosition(): PointerPosition | null {
+ return known ? { x: lastX, y: lastY } : null;
+}
diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.json
index 5e5431310..1e8696f5b 100644
--- a/packages/app/src/locales/ar/messages.json
+++ b/packages/app/src/locales/ar/messages.json
@@ -1114,6 +1114,7 @@
"CFnavk": ["هذا المشروع ليس مستودع git، لذا أشجار العمل غير متاحة."],
"CGj3gX": ["خطأ في التحليل"],
"CHfFN_": ["إزالة OpenKnowledge من ", ["0"]],
+ "CJpuc1": ["ابدأ تقرير علة مع لقطة شاشة كما تبدو في هذه اللحظة."],
"CKyk7Q": ["رجوع"],
"CMd-g-": [
"عنوان URL البعيد لديك يشير إلى ",
@@ -4671,6 +4672,9 @@
"pMPnZv": ["تم حذف ", ["deleted"], " مهارات"],
"pOo4Aa": ["نص عادي"],
"pPiV8s": ["تفعيل تلقائي (سحب ودفع)"],
+ "pRq670": [
+ "صورة للتطبيق من قبل فتحك هذا مباشرةً، مع علامة تُبيّن موضع المؤشر. لم يجرِ إخفاء محتواها، لذا تحقق من المعاينة وألغِ تحديدها إن كان فيها ما لا ينبغي مشاركته."
+ ],
"pSimwP": ["اسم جديد لنسخة ", ["editor"]],
"pTPqMK": ["بدّل كتلة الكود المحصورة."],
"pTyA_t": ["وسوم"],
diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.po
index c0a7f5657..98adf2efe 100644
--- a/packages/app/src/locales/ar/messages.po
+++ b/packages/app/src/locales/ar/messages.po
@@ -1233,6 +1233,10 @@ msgstr "مسار داخل المهارة — أي مجلد يصلح (مثل refe
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "منتقي سمة ألوان شخصي — غير مشترك مع مشروعك. عند تفعيله يظهر ضمن «الإضافات» في الشريط الجانبي."
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "صورة للتطبيق من قبل فتحك هذا مباشرةً، مع علامة تُبيّن موضع المؤشر. لم يجرِ إخفاء محتواها، لذا تحقق من المعاينة وألغِ تحديدها إن كان فيها ما لا ينبغي مشاركته."
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "صورة للتطبيق من قبل فتحك هذا مباشرةً. لم يجرِ إخفاء محتواها، لذا تحقق من المعاينة وألغِ تحديدها إن كان فيها ما لا ينبغي مشاركته."
@@ -10899,6 +10903,7 @@ msgstr "يستبدل إدخال OpenKnowledge الموجود لدى كل منه
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "الإبلاغ عن علة"
@@ -12484,6 +12489,10 @@ msgstr "تجهيز المقطع المحدد في لوحة الوكلاء، جا
msgid "Star us on GitHub"
msgstr "امنحنا نجمة على GitHub"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "ابدأ تقرير علة مع لقطة شاشة كما تبدو في هذه اللحظة."
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "ابدأ محادثة بزر +، أو شغّل وكيلاً من صفحة."
diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.json
index 62edafd30..f813ef97b 100644
--- a/packages/app/src/locales/bn/messages.json
+++ b/packages/app/src/locales/bn/messages.json
@@ -915,6 +915,7 @@
"CFnavk": ["এই প্রকল্পটি একটি git রিপোজিটরি নয়, তাই ওয়ার্কট্রি পাওয়া যায় না।"],
"CGj3gX": ["পার্স ত্রুটি"],
"CHfFN_": [["0"], " থেকে OpenKnowledge সরান"],
+ "CJpuc1": ["স্ক্রিন এখন যেমন দেখাচ্ছে তার স্ক্রিনশট নিয়ে একটি বাগ রিপোর্ট শুরু করুন।"],
"CKyk7Q": ["ফিরে যান"],
"CMd-g-": [
"আপনার রিমোট URL-এ ",
@@ -4009,6 +4010,9 @@
"pMPnZv": [["deleted"], "টি স্কিল মুছে ফেলা হয়েছে"],
"pOo4Aa": ["সাধারণ টেক্সট"],
"pPiV8s": ["স্বয়ংক্রিয় (টানুন ও পাঠান) চালু করুন"],
+ "pRq670": [
+ "আপনি এটি খোলার ঠিক আগের অ্যাপের একটি ছবি, সঙ্গে আপনার পয়েন্টার কোথায় ছিল তা দেখানো একটি চিহ্ন। এ থেকে গোপন তথ্য সরানো হয় না, তাই প্রাকদর্শন দেখে নিন এবং কিছু ভাগ করা উচিত না হলে এটি অচিহ্নিত করে দিন।"
+ ],
"pSimwP": [["editor"], " সংস্করণের জন্য নতুন নাম"],
"pTPqMK": ["বেড়া দেওয়া কোড ব্লক চালু বা বন্ধ করুন।"],
"pTyA_t": ["ট্যাগ"],
diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.po
index 3037e49df..19fc111df 100644
--- a/packages/app/src/locales/bn/messages.po
+++ b/packages/app/src/locales/bn/messages.po
@@ -1229,6 +1229,10 @@ msgstr "স্কিলের ভেতরের একটি পথ — যে
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "একটি ব্যক্তিগত রঙ-থিম নির্বাচক — আপনার প্রকল্পের সঙ্গে ভাগ করা হয় না। চালু থাকলে এটি সাইডবারে Plugins-এর নিচে দেখা যায়।"
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "আপনি এটি খোলার ঠিক আগের অ্যাপের একটি ছবি, সঙ্গে আপনার পয়েন্টার কোথায় ছিল তা দেখানো একটি চিহ্ন। এ থেকে গোপন তথ্য সরানো হয় না, তাই প্রাকদর্শন দেখে নিন এবং কিছু ভাগ করা উচিত না হলে এটি অচিহ্নিত করে দিন।"
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "আপনি এটি খোলার ঠিক আগের অ্যাপের একটি ছবি। এ থেকে গোপন তথ্য সরানো হয় না, তাই প্রাকদর্শন দেখে নিন এবং কিছু ভাগ করা উচিত না হলে এটি অচিহ্নিত করে দিন।"
@@ -10895,6 +10899,7 @@ msgstr "প্রত্যেকটিতে আগে থেকে থাকা
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "একটি বাগ জানান"
@@ -12480,6 +12485,10 @@ msgstr "নির্বাচিত অংশ এজেন্ট প্যান
msgid "Star us on GitHub"
msgstr "GitHub-এ আমাদের স্টার দিন"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "স্ক্রিন এখন যেমন দেখাচ্ছে তার স্ক্রিনশট নিয়ে একটি বাগ রিপোর্ট শুরু করুন।"
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "+ বোতাম দিয়ে চ্যাট শুরু করুন, বা কোনো পৃষ্ঠা থেকে এজেন্ট চালু করুন।"
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 2860e57d6..c079a10d5 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -945,6 +945,7 @@
"CFnavk": ["This project isn't a git repository, so worktrees aren't available."],
"CGj3gX": ["parse error"],
"CHfFN_": ["Remove OpenKnowledge from ", ["0"]],
+ "CJpuc1": ["Start a bug report with a screenshot of the screen as it looks right now."],
"CKyk7Q": ["Go back"],
"CMd-g-": [
"Your remote URL names ",
@@ -4130,6 +4131,9 @@
"pMPnZv": ["Deleted ", ["deleted"], " skills"],
"pOo4Aa": ["Plain text"],
"pPiV8s": ["Enable Auto (Pull and Push)"],
+ "pRq670": [
+ "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+ ],
"pSimwP": ["New name for the ", ["editor"], " version"],
"pTPqMK": ["Toggle a fenced code block."],
"pTyA_t": ["tags"],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 94db289e3..80ab24d92 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -1233,6 +1233,10 @@ msgstr "A path inside the skill — any folder works (e.g. references/notes.md).
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
@@ -10899,6 +10903,7 @@ msgstr "Replaces the OpenKnowledge entry each of them already has."
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "Report a bug"
@@ -12484,6 +12489,10 @@ msgstr "Stage the selected passage in the agents panel, ready to extend and send
msgid "Star us on GitHub"
msgstr "Star us on GitHub"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "Start a bug report with a screenshot of the screen as it looks right now."
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "Start a chat with the + button, or launch an agent from a page."
diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.json
index 8522672d8..831287dbc 100644
--- a/packages/app/src/locales/es/messages.json
+++ b/packages/app/src/locales/es/messages.json
@@ -1120,6 +1120,9 @@
],
"CGj3gX": ["error de análisis"],
"CHfFN_": ["Quitar OpenKnowledge de ", ["0"]],
+ "CJpuc1": [
+ "Inicia un informe de error con una captura de pantalla tal como se ve ahora mismo."
+ ],
"CKyk7Q": ["Volver"],
"CMd-g-": [
"Tu URL remota indica ",
@@ -4769,6 +4772,9 @@
"pMPnZv": [["deleted"], " habilidades eliminadas"],
"pOo4Aa": ["Texto sin formato"],
"pPiV8s": ["Activar Automático (Pull y Push)"],
+ "pRq670": [
+ "Una imagen de la aplicación justo antes de que abrieras esto, con una marca que indica dónde estaba tu puntero. No está censurada, así que revisa la vista previa y desmárcala si hay algo que no deba compartirse."
+ ],
"pSimwP": ["Nombre nuevo para la versión de ", ["editor"]],
"pTPqMK": ["Activa o desactiva un bloque de código delimitado."],
"pTyA_t": ["etiquetas"],
diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.po
index b1751797e..96ad77254 100644
--- a/packages/app/src/locales/es/messages.po
+++ b/packages/app/src/locales/es/messages.po
@@ -1233,6 +1233,10 @@ msgstr "Una ruta dentro de la habilidad; cualquier carpeta sirve (p. ej. referen
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "Un selector de tema de color personal, no compartido con tu proyecto. Al activarlo aparece en Complementos, en la barra lateral."
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "Una imagen de la aplicación justo antes de que abrieras esto, con una marca que indica dónde estaba tu puntero. No está censurada, así que revisa la vista previa y desmárcala si hay algo que no deba compartirse."
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "Una imagen de la aplicación justo antes de que abrieras esto. No está censurada, así que revisa la vista previa y desmárcala si hay algo que no deba compartirse."
@@ -10899,6 +10903,7 @@ msgstr "Reemplaza la entrada de OpenKnowledge que cada uno ya tiene."
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "Informar de un error"
@@ -12484,6 +12489,10 @@ msgstr "Prepara el fragmento seleccionado en el panel de agentes, listo para amp
msgid "Star us on GitHub"
msgstr "Danos una estrella en GitHub"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "Inicia un informe de error con una captura de pantalla tal como se ve ahora mismo."
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "Inicia un chat con el botón + o lanza un agente desde una página."
diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.json
index 53163c081..ddeea6fb6 100644
--- a/packages/app/src/locales/fr/messages.json
+++ b/packages/app/src/locales/fr/messages.json
@@ -1140,6 +1140,9 @@
"CFnavk": ["Ce projet n'est pas un dépôt git, les worktrees ne sont donc pas disponibles."],
"CGj3gX": ["erreur d'analyse"],
"CHfFN_": ["Retirer OpenKnowledge de ", ["0"]],
+ "CJpuc1": [
+ "Démarre un rapport de bug avec une capture d'écran de ce qui est affiché à cet instant."
+ ],
"CKyk7Q": ["Retour"],
"CMd-g-": [
"Votre URL distante indique ",
@@ -4803,6 +4806,9 @@
"pMPnZv": [["deleted"], " compétences supprimées"],
"pOo4Aa": ["Texte brut"],
"pPiV8s": ["Activer Auto (Tirer et Pousser)"],
+ "pRq670": [
+ "Une image de l'application juste avant que vous n'ouvriez ceci, avec un repère indiquant où se trouvait votre pointeur. Elle n'est pas masquée, alors vérifiez l'aperçu et décochez-la si quelque chose ne doit pas être partagé."
+ ],
"pSimwP": ["Nouveau nom pour la version ", ["editor"]],
"pTPqMK": ["Bascule un bloc de code délimité."],
"pTyA_t": ["étiquettes"],
diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.po
index ed4c884d2..e9e829ccd 100644
--- a/packages/app/src/locales/fr/messages.po
+++ b/packages/app/src/locales/fr/messages.po
@@ -1233,6 +1233,10 @@ msgstr "Un chemin à l'intérieur de la compétence — n'importe quel dossier c
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "Un sélecteur de thème de couleurs personnel — non partagé avec votre projet. Une fois activé, il apparaît sous Plugins dans la barre latérale."
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "Une image de l'application juste avant que vous n'ouvriez ceci, avec un repère indiquant où se trouvait votre pointeur. Elle n'est pas masquée, alors vérifiez l'aperçu et décochez-la si quelque chose ne doit pas être partagé."
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "Une image de l'application juste avant que vous n'ouvriez ceci. Elle n'est pas masquée, alors vérifiez l'aperçu et décochez-la si quelque chose ne doit pas être partagé."
@@ -10899,6 +10903,7 @@ msgstr "Remplace l'entrée OpenKnowledge que chacun possède déjà."
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "Signaler un bug"
@@ -12484,6 +12489,10 @@ msgstr "Prépare le passage sélectionné dans le panneau des agents, prêt à
msgid "Star us on GitHub"
msgstr "Mettez-nous une étoile sur GitHub"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "Démarre un rapport de bug avec une capture d'écran de ce qui est affiché à cet instant."
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "Démarrez un chat avec le bouton + ou lancez un agent depuis une page."
diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.json
index 531446aa7..50106f99c 100644
--- a/packages/app/src/locales/hi/messages.json
+++ b/packages/app/src/locales/hi/messages.json
@@ -919,6 +919,7 @@
"CFnavk": ["यह प्रोजेक्ट एक git रिपॉज़िटरी नहीं है, इसलिए वर्कट्री उपलब्ध नहीं हैं।"],
"CGj3gX": ["पार्स त्रुटि"],
"CHfFN_": [["0"], " से OpenKnowledge हटाएँ"],
+ "CJpuc1": ["स्क्रीन अभी जैसी दिख रही है उसका स्क्रीनशॉट लेकर बग रिपोर्ट शुरू करें।"],
"CKyk7Q": ["वापस जाएँ"],
"CMd-g-": [
"आपके रिमोट URL में ",
@@ -4000,6 +4001,9 @@
"pMPnZv": [["deleted"], " स्किलें हटाई गईं"],
"pOo4Aa": ["सादा टेक्स्ट"],
"pPiV8s": ["स्वचालित (खींचें और भेजें) चालू करें"],
+ "pRq670": [
+ "इसे खोलने से ठीक पहले के ऐप का एक चित्र, जिसमें एक निशान बताता है कि आपका पॉइंटर कहाँ था। इससे गोपनीय जानकारी नहीं हटाई जाती, इसलिए पूर्वावलोकन जाँच लें और यदि कुछ साझा नहीं करना है तो इसे अनचेक कर दें।"
+ ],
"pSimwP": [["editor"], " संस्करण के लिए नया नाम"],
"pTPqMK": ["बाड़बंद कोड ब्लॉक चालू या बंद करें।"],
"pTyA_t": ["टैग"],
diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.po
index f0e6312ed..2a9da4380 100644
--- a/packages/app/src/locales/hi/messages.po
+++ b/packages/app/src/locales/hi/messages.po
@@ -1229,6 +1229,10 @@ msgstr "स्किल के भीतर का एक पथ — कोई
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "एक निजी रंग-थीम चयनकर्ता — आपके प्रोजेक्ट के साथ साझा नहीं। चालू होने पर यह साइडबार में Plugins के नीचे दिखता है।"
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "इसे खोलने से ठीक पहले के ऐप का एक चित्र, जिसमें एक निशान बताता है कि आपका पॉइंटर कहाँ था। इससे गोपनीय जानकारी नहीं हटाई जाती, इसलिए पूर्वावलोकन जाँच लें और यदि कुछ साझा नहीं करना है तो इसे अनचेक कर दें।"
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "इसे खोलने से ठीक पहले के ऐप का एक चित्र। इससे गोपनीय जानकारी नहीं हटाई जाती, इसलिए पूर्वावलोकन जाँच लें और यदि कुछ साझा नहीं करना है तो इसे अनचेक कर दें।"
@@ -10895,6 +10899,7 @@ msgstr "हर एक में पहले से मौजूद OpenKnowledg
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "बग की रिपोर्ट करें"
@@ -12480,6 +12485,10 @@ msgstr "चयनित अंश को एजेंट पैनल में
msgid "Star us on GitHub"
msgstr "GitHub पर हमें स्टार दें"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "स्क्रीन अभी जैसी दिख रही है उसका स्क्रीनशॉट लेकर बग रिपोर्ट शुरू करें।"
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "+ बटन से चैट शुरू करें, या किसी पेज से एजेंट लॉन्च करें।"
diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.json
index 1b4f5fccf..c38f71afa 100644
--- a/packages/app/src/locales/id/messages.json
+++ b/packages/app/src/locales/id/messages.json
@@ -932,6 +932,7 @@
"CFnavk": ["Proyek ini bukan repositori git, jadi worktree tidak tersedia."],
"CGj3gX": ["galat penguraian"],
"CHfFN_": ["Hapus OpenKnowledge dari ", ["0"]],
+ "CJpuc1": ["Memulai laporan bug dengan tangkapan layar persis seperti tampilannya saat ini."],
"CKyk7Q": ["Kembali"],
"CMd-g-": [
"URL remote Anda menyebut ",
@@ -4155,6 +4156,9 @@
"pMPnZv": [["deleted"], " keterampilan dihapus"],
"pOo4Aa": ["Teks biasa"],
"pPiV8s": ["Aktifkan Otomatis (Pull dan Push)"],
+ "pRq670": [
+ "Gambar aplikasi tepat sebelum Anda membuka ini, dengan penanda yang menunjukkan posisi penunjuk Anda. Isinya tidak disunting, jadi periksa pratinjaunya dan hapus centangnya jika ada yang tidak boleh dibagikan."
+ ],
"pSimwP": ["Nama baru untuk versi ", ["editor"]],
"pTPqMK": ["Menyalakan atau mematikan blok kode berpagar."],
"pTyA_t": ["tag"],
diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.po
index 41cfbea22..9e8d5fda9 100644
--- a/packages/app/src/locales/id/messages.po
+++ b/packages/app/src/locales/id/messages.po
@@ -1229,6 +1229,10 @@ msgstr "Sebuah jalur di dalam keterampilan — folder apa pun bisa (mis. referen
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "Pemilih tema warna pribadi — tidak dibagikan dengan proyek Anda. Saat aktif, ia muncul di bawah Plugin pada bilah sisi."
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "Gambar aplikasi tepat sebelum Anda membuka ini, dengan penanda yang menunjukkan posisi penunjuk Anda. Isinya tidak disunting, jadi periksa pratinjaunya dan hapus centangnya jika ada yang tidak boleh dibagikan."
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "Gambar aplikasi tepat sebelum Anda membuka ini. Isinya tidak disunting, jadi periksa pratinjaunya dan hapus centangnya jika ada yang tidak boleh dibagikan."
@@ -10895,6 +10899,7 @@ msgstr "Mengganti entri OpenKnowledge yang sudah dimiliki masing-masing."
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "Laporkan bug"
@@ -12480,6 +12485,10 @@ msgstr "Siapkan bagian yang dipilih di panel agen, siap dilengkapi dan dikirim."
msgid "Star us on GitHub"
msgstr "Beri kami bintang di GitHub"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "Memulai laporan bug dengan tangkapan layar persis seperti tampilannya saat ini."
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "Mulai obrolan dengan tombol +, atau luncurkan agen dari halaman."
diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.json
index 447e38c61..85a76ad43 100644
--- a/packages/app/src/locales/ko/messages.json
+++ b/packages/app/src/locales/ko/messages.json
@@ -905,6 +905,7 @@
"CFnavk": ["이 프로젝트는 git 저장소가 아니므로 워크트리를 사용할 수 없습니다."],
"CGj3gX": ["구문 분석 오류"],
"CHfFN_": [["0"], "에서 OpenKnowledge 제거"],
+ "CJpuc1": ["지금 화면에 보이는 그대로의 스크린샷과 함께 버그 신고를 시작합니다."],
"CKyk7Q": ["뒤로 가기"],
"CMd-g-": [
"원격 URL에는 ",
@@ -3983,6 +3984,9 @@
"pMPnZv": ["스킬 ", ["deleted"], "개 삭제됨"],
"pOo4Aa": ["일반 텍스트"],
"pPiV8s": ["자동(풀 및 푸시) 활성화"],
+ "pRq670": [
+ "앱을 열기 직전의 모습이며, 포인터가 있던 위치에 표시가 그려집니다. 비공개 처리되지 않았으므로 미리보기를 확인하고 공유하면 안 되는 내용이 있으면 선택을 해제하세요."
+ ],
"pSimwP": [["editor"], " 버전의 새 이름"],
"pTPqMK": ["펜스 코드 블록을 전환합니다."],
"pTyA_t": ["태그"],
diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.po
index 3337cd32c..b68d31a84 100644
--- a/packages/app/src/locales/ko/messages.po
+++ b/packages/app/src/locales/ko/messages.po
@@ -1233,6 +1233,10 @@ msgstr "스킬 내부 경로입니다. 모든 폴더를 사용할 수 있습니
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "개인 색상 테마 선택기입니다. 프로젝트와 공유되지 않으며, 켜면 사이드바의 플러그인 아래에 나타납니다."
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "앱을 열기 직전의 모습이며, 포인터가 있던 위치에 표시가 그려집니다. 비공개 처리되지 않았으므로 미리보기를 확인하고 공유하면 안 되는 내용이 있으면 선택을 해제하세요."
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "앱을 열기 직전의 모습입니다. 비공개 처리되지 않았으므로 미리보기를 확인하고 공유하면 안 되는 내용이 있으면 선택을 해제하세요."
@@ -10899,6 +10903,7 @@ msgstr "각각에 이미 있는 OpenKnowledge 항목을 교체합니다."
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "버그 신고"
@@ -12484,6 +12489,10 @@ msgstr "선택한 구절을 에이전트 패널에 올려 이어서 작성하고
msgid "Star us on GitHub"
msgstr "GitHub에서 별표를 눌러 주세요"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "지금 화면에 보이는 그대로의 스크린샷과 함께 버그 신고를 시작합니다."
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "+ 버튼으로 채팅 시작하거나 페이지에서 에이전트 실행하세요."
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 2d01af973..306f5ba9b 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -945,6 +945,7 @@
"CFnavk": ["Ţĥĩś ƥŕōĴēćţ ĩśń'ţ à ĝĩţ ŕēƥōśĩţōŕŷ, śō ŵōŕķţŕēēś àŕēń'ţ àvàĩĺàƀĺē."],
"CGj3gX": ["ƥàŕśē ēŕŕōŕ"],
"CHfFN_": ["Ŕēḿōvē ŌƥēńĶńōŵĺēďĝē ƒŕōḿ ", ["0"]],
+ "CJpuc1": ["Śţàŕţ à ƀũĝ ŕēƥōŕţ ŵĩţĥ à śćŕēēńśĥōţ ōƒ ţĥē śćŕēēń àś ĩţ ĺōōķś ŕĩĝĥţ ńōŵ."],
"CKyk7Q": ["Ĝō ƀàćķ"],
"CMd-g-": [
"Ŷōũŕ ŕēḿōţē ŨŔĹ ńàḿēś ",
@@ -4130,6 +4131,9 @@
"pMPnZv": ["Ďēĺēţēď ", ["deleted"], " śķĩĺĺś"],
"pOo4Aa": ["Ƥĺàĩń ţēxţ"],
"pPiV8s": ["Ēńàƀĺē Àũţō (Ƥũĺĺ àńď Ƥũśĥ)"],
+ "pRq670": [
+ "À ƥĩćţũŕē ōƒ ţĥē àƥƥ ƒŕōḿ Ĵũśţ ƀēƒōŕē ŷōũ ōƥēńēď ţĥĩś, ŵĩţĥ à ḿàŕķēŕ śĥōŵĩńĝ ŵĥēŕē ŷōũŕ ƥōĩńţēŕ ŵàś. Ĩţ ĩśń'ţ ŕēďàćţēď, śō ćĥēćķ ţĥē ƥŕēvĩēŵ àńď ũńćĥēćķ ĩţ ĩƒ àńŷţĥĩńĝ śĥōũĺďń'ţ ƀē śĥàŕēď."
+ ],
"pSimwP": ["Ńēŵ ńàḿē ƒōŕ ţĥē ", ["editor"], " vēŕśĩōń"],
"pTPqMK": ["Ţōĝĝĺē à ƒēńćēď ćōďē ƀĺōćķ."],
"pTyA_t": ["ţàĝś"],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 1e7f0df2b..a3d8a967c 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -1229,6 +1229,10 @@ msgstr ""
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr ""
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr ""
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr ""
@@ -10895,6 +10899,7 @@ msgstr ""
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr ""
@@ -12480,6 +12485,10 @@ msgstr ""
msgid "Star us on GitHub"
msgstr ""
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr ""
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr ""
diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.json
index d9bac5ec3..edf29f880 100644
--- a/packages/app/src/locales/pt-BR/messages.json
+++ b/packages/app/src/locales/pt-BR/messages.json
@@ -1096,6 +1096,9 @@
"CFnavk": ["Este projeto não é um repositório git, então worktrees não estão disponíveis."],
"CGj3gX": ["erro de análise"],
"CHfFN_": ["Remover o OpenKnowledge de ", ["0"]],
+ "CJpuc1": [
+ "Inicia um relatório de erro com uma captura de tela exatamente como ela está agora."
+ ],
"CKyk7Q": ["Voltar"],
"CMd-g-": [
"Sua URL remota indica ",
@@ -4667,6 +4670,9 @@
"pMPnZv": [["deleted"], " habilidades excluídas"],
"pOo4Aa": ["Texto simples"],
"pPiV8s": ["Ativar Automático (Pull e Push)"],
+ "pRq670": [
+ "Uma imagem do app pouco antes de você abrir isto, com uma marca mostrando onde estava o seu ponteiro. Ela não é ocultada, então revise a pré-visualização e desmarque se houver algo que não deva ser compartilhado."
+ ],
"pSimwP": ["Novo nome para a versão do ", ["editor"]],
"pTPqMK": ["Liga ou desliga um bloco de código delimitado."],
"pTyA_t": ["tags"],
diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.po
index 3fc1ae752..514615263 100644
--- a/packages/app/src/locales/pt-BR/messages.po
+++ b/packages/app/src/locales/pt-BR/messages.po
@@ -1229,6 +1229,10 @@ msgstr "Um caminho dentro da habilidade — qualquer pasta serve (ex.: reference
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "Um seletor de tema de cores pessoal — não compartilhado com seu projeto. Quando ativado, aparece em Plugins na barra lateral."
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "Uma imagem do app pouco antes de você abrir isto, com uma marca mostrando onde estava o seu ponteiro. Ela não é ocultada, então revise a pré-visualização e desmarque se houver algo que não deva ser compartilhado."
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "Uma imagem do app pouco antes de você abrir isto. Ela não é ocultada, então revise a pré-visualização e desmarque se houver algo que não deva ser compartilhado."
@@ -10895,6 +10899,7 @@ msgstr "Substitui a entrada do OpenKnowledge que cada um já tem."
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "Relatar um erro"
@@ -12480,6 +12485,10 @@ msgstr "Prepara o trecho selecionado no painel de agentes, pronto para complemen
msgid "Star us on GitHub"
msgstr "Dê uma estrela no GitHub"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "Inicia um relatório de erro com uma captura de tela exatamente como ela está agora."
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "Inicie um chat com o botão + ou inicie um agente a partir de uma página."
diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.json
index 9955b9f5f..5bef3c6bc 100644
--- a/packages/app/src/locales/ur/messages.json
+++ b/packages/app/src/locales/ur/messages.json
@@ -959,6 +959,7 @@
"CFnavk": ["یہ پروجیکٹ git ریپازٹری نہیں ہے، اس لیے ورک ٹریز دستیاب نہیں۔"],
"CGj3gX": ["پارس کی خرابی"],
"CHfFN_": ["OpenKnowledge کو ", ["0"], " سے ہٹائیں"],
+ "CJpuc1": ["اسکرین اس وقت جیسی دکھ رہی ہے اس کا اسکرین شاٹ لے کر بگ رپورٹ شروع کریں۔"],
"CKyk7Q": ["واپس جائیں"],
"CMd-g-": [
"آپ کے ریموٹ URL میں ",
@@ -4227,6 +4228,9 @@
"pMPnZv": [["deleted"], " مہارتیں حذف ہو گئیں"],
"pOo4Aa": ["سادہ متن"],
"pPiV8s": ["خودکار (کھینچیں اور پُش) فعال کریں"],
+ "pRq670": [
+ "ایپ کی ایک تصویر، عین اس سے پہلے کی جب آپ نے یہ کھولا، جس پر ایک نشان بتاتا ہے کہ آپ کا پوائنٹر کہاں تھا۔ اسے چھپایا نہیں گیا، اس لیے پیش منظر دیکھیں اور اگر کچھ شیئر نہیں کرنا تو نشان ہٹا دیں۔"
+ ],
"pSimwP": [["editor"], " ورژن کے لیے نیا نام"],
"pTPqMK": ["باڑ والا کوڈ بلاک بدلیں۔"],
"pTyA_t": ["ٹیگز"],
diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.po
index 2cd145f3a..e4eb764df 100644
--- a/packages/app/src/locales/ur/messages.po
+++ b/packages/app/src/locales/ur/messages.po
@@ -1233,6 +1233,10 @@ msgstr "مہارت کے اندر کا راستہ — کوئی بھی فولڈر
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "ذاتی رنگ تھیم منتخب کنندہ — آپ کے پروجیکٹ کے ساتھ شیئر نہیں ہوتا۔ فعال ہونے پر یہ سائیڈ بار میں پلگ اِنز کے تحت ظاہر ہوتا ہے۔"
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "ایپ کی ایک تصویر، عین اس سے پہلے کی جب آپ نے یہ کھولا، جس پر ایک نشان بتاتا ہے کہ آپ کا پوائنٹر کہاں تھا۔ اسے چھپایا نہیں گیا، اس لیے پیش منظر دیکھیں اور اگر کچھ شیئر نہیں کرنا تو نشان ہٹا دیں۔"
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "ایپ کی ایک تصویر، عین اس سے پہلے کی جب آپ نے یہ کھولا۔ اسے چھپایا نہیں گیا، اس لیے پیش منظر دیکھیں اور اگر کچھ شیئر نہیں کرنا تو نشان ہٹا دیں۔"
@@ -10899,6 +10903,7 @@ msgstr "ہر ایک میں پہلے سے موجود OpenKnowledge اندراج
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "بگ رپورٹ کریں"
@@ -12484,6 +12489,10 @@ msgstr "منتخب اقتباس کو ایجنٹ پینل میں تیار رکھ
msgid "Star us on GitHub"
msgstr "GitHub پر ہمیں ستارہ دیں"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "اسکرین اس وقت جیسی دکھ رہی ہے اس کا اسکرین شاٹ لے کر بگ رپورٹ شروع کریں۔"
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "+ بٹن سے چیٹ شروع کریں، یا کسی صفحے سے ایجنٹ شروع کریں۔"
diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.json
index 3286d5dea..3daa7897c 100644
--- a/packages/app/src/locales/zh-Hans/messages.json
+++ b/packages/app/src/locales/zh-Hans/messages.json
@@ -838,6 +838,7 @@
"CFnavk": ["这个项目不是 git 仓库,因此无法使用 worktree。"],
"CGj3gX": ["解析错误"],
"CHfFN_": ["把 OpenKnowledge 从 ", ["0"], " 中移除"],
+ "CJpuc1": ["发起一份错误报告,并附上此刻画面的截图。"],
"CKyk7Q": ["返回"],
"CMd-g-": ["你的远程 URL 中指定了 ", ["declaredLogin"], ",但无法使用该账户的凭据。"],
"CMyafZ": [["slot"], " 十六进制值"],
@@ -3628,6 +3629,9 @@
"pMPnZv": ["已删除 ", ["deleted"], " 个技能"],
"pOo4Aa": ["纯文本"],
"pPiV8s": ["启用自动(拉取和推送)"],
+ "pRq670": [
+ "你打开这个界面之前的应用截图,上面有一个标记显示指针当时的位置。它没有做隐去处理,请查看预览;如果有不该分享的内容,请取消勾选。"
+ ],
"pSimwP": [["editor"], " 版本的新名称"],
"pTPqMK": ["切换围栏代码块。"],
"pTyA_t": ["标签"],
diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.po
index 115ea2128..735cece1b 100644
--- a/packages/app/src/locales/zh-Hans/messages.po
+++ b/packages/app/src/locales/zh-Hans/messages.po
@@ -1233,6 +1233,10 @@ msgstr "技能内部的一个路径——任何文件夹都可以(例如 refer
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "个人配色主题选择器——不与你的项目共享。开启后会出现在侧边栏的「插件」下。"
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "你打开这个界面之前的应用截图,上面有一个标记显示指针当时的位置。它没有做隐去处理,请查看预览;如果有不该分享的内容,请取消勾选。"
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "你打开这个界面之前的应用截图。它没有做隐去处理,请查看预览;如果有不该分享的内容,请取消勾选。"
@@ -10899,6 +10903,7 @@ msgstr "替换它们各自已有的 OpenKnowledge 条目。"
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "报告问题"
@@ -12484,6 +12489,10 @@ msgstr "把选中的内容放入智能体面板,随时可以补充并发送。
msgid "Star us on GitHub"
msgstr "在 GitHub 上给我们点个星"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "发起一份错误报告,并附上此刻画面的截图。"
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "使用 + 按钮开始对话,或从页面启动智能体。"
diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.json
index 99549a505..c13cf7639 100644
--- a/packages/app/src/locales/zh-Hant/messages.json
+++ b/packages/app/src/locales/zh-Hant/messages.json
@@ -842,6 +842,7 @@
"CFnavk": ["這個專案不是 git 儲存庫,所以無法使用 worktree。"],
"CGj3gX": ["解析錯誤"],
"CHfFN_": ["把 OpenKnowledge 從 ", ["0"], " 中移除"],
+ "CJpuc1": ["發起一份錯誤回報,並附上此刻畫面的螢幕擷圖。"],
"CKyk7Q": ["返回"],
"CMd-g-": ["你的遠端 URL 中指定了 ", ["declaredLogin"], ",但無法使用該帳戶的憑證。"],
"CMyafZ": [["slot"], " 十六進位值"],
@@ -3656,6 +3657,9 @@
"pMPnZv": ["已刪除 ", ["deleted"], " 個技能"],
"pOo4Aa": ["純文字"],
"pPiV8s": ["啟用自動(拉取與推送)"],
+ "pRq670": [
+ "你打開這個畫面之前的應用程式截圖,上面有一個標記顯示指標當時的位置。它沒有做遮蔽處理,請看一下預覽;如果有不該分享的內容,請取消勾選。"
+ ],
"pSimwP": [["editor"], " 版本的新名稱"],
"pTPqMK": ["切換圍欄程式碼區塊。"],
"pTyA_t": ["標籤"],
diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.po
index 14a1f49f1..050af682f 100644
--- a/packages/app/src/locales/zh-Hant/messages.po
+++ b/packages/app/src/locales/zh-Hant/messages.po
@@ -1233,6 +1233,10 @@ msgstr "技能內部的一個路徑——任何資料夾都可以(例如 refer
msgid "A personal color-theme picker — not shared with your project. When on, it appears under Plugins in the sidebar."
msgstr "個人配色主題選擇器——不會和你的專案共享。開啟後會出現在側邊欄的「外掛」下。"
+#: src/components/ReportBugDialogBody.tsx
+msgid "A picture of the app from just before you opened this, with a marker showing where your pointer was. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
+msgstr "你打開這個畫面之前的應用程式截圖,上面有一個標記顯示指標當時的位置。它沒有做遮蔽處理,請看一下預覽;如果有不該分享的內容,請取消勾選。"
+
#: src/components/ReportBugDialogBody.tsx
msgid "A picture of the app from just before you opened this. It isn't redacted, so check the preview and uncheck it if anything shouldn't be shared."
msgstr "你打開這個畫面之前的應用程式截圖。它沒有做遮蔽處理,請看一下預覽;如果有不該分享的內容,請取消勾選。"
@@ -10899,6 +10903,7 @@ msgstr "取代它們各自已有的 OpenKnowledge 項目。"
#: src/components/command-palette-commands.ts
#: src/components/HelpPopover.tsx
#: src/components/ReportBugDialogBody.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Report a bug"
msgstr "回報問題"
@@ -12484,6 +12489,10 @@ msgstr "把選取的內容放入代理面板,隨時可以補充並傳送。"
msgid "Star us on GitHub"
msgstr "在 GitHub 上給我們一顆星"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Start a bug report with a screenshot of the screen as it looks right now."
+msgstr "發起一份錯誤回報,並附上此刻畫面的螢幕擷圖。"
+
#: src/components/SessionsHost.tsx
msgid "Start a chat with the + button, or launch an agent from a page."
msgstr "使用 + 按鈕開始對話,或從頁面啟動智慧代理。"
diff --git a/packages/app/src/main.tsx b/packages/app/src/main.tsx
index be891cdd9..b07b0fa8a 100644
--- a/packages/app/src/main.tsx
+++ b/packages/app/src/main.tsx
@@ -54,6 +54,7 @@ import {
installColdMountInstrumentation,
shouldInstallColdMountInstrumentation,
} from '@/lib/perf/cold-mount-instrumentation';
+import { installPointerPositionTracker } from '@/lib/pointer-position';
import { installRelaunchStateBridge } from '@/lib/relaunch-store';
import { requestStoragePersistence } from '@/lib/request-storage-persistence';
import { installShareReceivedListener } from '@/lib/share/receive-store';
@@ -135,6 +136,17 @@ installSubscribeCardStore();
// so it must be readable before the controller mounts and stamps it.
installFeedbackNudgeStore();
+// Record where the pointer is so a bug report can show it: `capturePage()`
+// omits the cursor, and the report gate has no way to recover a position after
+// the fact. Passive and app-global, at module-init so a hover the user is
+// about to report is already recorded by the time they reach for the chord.
+// Desktop-only, and deliberately gated here rather than inside the installer:
+// the one consumer sits behind the capture bridge, so on web this would be a
+// listener on the hot input path whose value nothing can ever read.
+if (typeof window !== 'undefined' && window.okDesktop !== undefined) {
+ installPointerPositionTracker();
+}
+
// Desktop-only: track whether an auto-update relaunch is in flight (the same
// `ok:update:relaunching` / `ok:update:relaunch-failed` events the notice
// bridge consumes) so connectivity-sensitive panels can show a calm
diff --git a/packages/app/tests/integration/origin-undoability-sweep.test.ts b/packages/app/tests/integration/origin-undoability-sweep.test.ts
index b630175c2..0409288d3 100644
--- a/packages/app/tests/integration/origin-undoability-sweep.test.ts
+++ b/packages/app/tests/integration/origin-undoability-sweep.test.ts
@@ -156,6 +156,8 @@ const NON_CONTENT_ORIGINS: Record<string, string> = {
'A ProseMirror selection transaction-meta key, not a Y.Doc transaction origin.',
DEFAULT_INTAKE_ORIGIN:
'The uninstall-feedback submission source label, not a CRDT transaction origin.',
+ LAUNCHER_FREE_ORIGIN:
+ 'The default provenance stamp on a menu-action dispatch, describing whether the surface that dispatched dismisses itself. It rides the menu-action bus, never a Y.Doc transaction.',
};
const HERE = import.meta.dirname;
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index d7a845280..dfd95ef49 100644
--- a/packages/core/src/bridge/bind-frontmatter-doc.ts
+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts
@@ -1,3 +1,4 @@
+
import type * as Y from 'yjs';
import type { Err, Ok, Result } from '../config/result.ts';
import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';
diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.ts
index 005627195..8bfdb40cd 100644
--- a/packages/core/src/bridge/bridge-invariant.ts
+++ b/packages/core/src/bridge/bridge-invariant.ts
@@ -1,3 +1,4 @@
+
import { fnv1aDigest } from './hash-util.ts';
export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index f4cc8a286..2a597ec3d 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,3 +1,4 @@
+
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/divergence-locate.ts b/packages/core/src/bridge/divergence-locate.ts
index 6b505314d..d979f4b39 100644
--- a/packages/core/src/bridge/divergence-locate.ts
+++ b/packages/core/src/bridge/divergence-locate.ts
@@ -1,3 +1,4 @@
+
import { findFirstDivergenceIndex } from './tolerance-telemetry.ts';
export const BRIDGE_LINE_KINDS = [
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 8fb428b90..01ef76a9f 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,3 +1,4 @@
+
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/bridge/growth-detect.ts b/packages/core/src/bridge/growth-detect.ts
index 9d9c244b0..463e89595 100644
--- a/packages/core/src/bridge/growth-detect.ts
+++ b/packages/core/src/bridge/growth-detect.ts
@@ -1,3 +1,4 @@
+
const DEFAULT_MIN_SUBSTANTIVE_LINE_LENGTH = 16;
export const DUPLICATION_GATE_MIN_LINE_LENGTH = 8;
diff --git a/packages/core/src/bridge/intraline-predicate.ts b/packages/core/src/bridge/intraline-predicate.ts
index c43fdd7e7..0939885bb 100644
--- a/packages/core/src/bridge/intraline-predicate.ts
+++ b/packages/core/src/bridge/intraline-predicate.ts
@@ -1,3 +1,4 @@
+
export function rawLineCounts(doc: string): Map<string, number> {
const counts = new Map<string, number>();
for (const line of doc.split('\n')) {
diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.ts
index 251560a35..c0dc65705 100644
--- a/packages/core/src/bridge/merge-three-way.ts
+++ b/packages/core/src/bridge/merge-three-way.ts
@@ -65,6 +65,7 @@ export function tryLineLevelCombine(
return { clean: true, merged };
}
+
export type BridgeMergeContentLossSide = 'user' | 'agent';
export type BridgeMergeContentLossWhich = 'substring' | 'order' | 'growth';
diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.ts
index 01ac80099..dcc5b0690 100644
--- a/packages/core/src/bridge/normalize.ts
+++ b/packages/core/src/bridge/normalize.ts
@@ -1,3 +1,4 @@
+
import { stripFrontmatter } from '../extensions/frontmatter.ts';
import { bodyEdgeEmpties } from './doc-boundary-space.ts';
diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.ts
index bb53e7c7c..4f7b79587 100644
--- a/packages/core/src/bridge/pm-structural-equivalence.ts
+++ b/packages/core/src/bridge/pm-structural-equivalence.ts
@@ -32,6 +32,7 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };
const BR_LITERAL_RE = /^<br\s*\/?>$/i;
+
interface DegradeEntry {
readonly label: string;
readonly severity: ToleranceClassSeverity;
@@ -128,6 +129,7 @@ export interface ComparePmStructuralOptions {
rawSourceSide?: 'expected';
}
+
/** Rebuild a node with `fn` applied to each child; identity when childless.
* Shared by the degrade canonicalizers so none re-implements the walk. */
function mapChildren(
@@ -253,6 +255,7 @@ function applyDegrades(tree: PmStructuralNode): {
return { normalized: current, fired };
}
+
export function comparePmStructural(
expected: PmStructuralNode,
actual: PmStructuralNode,
diff --git a/packages/core/src/bridge/subsequence.ts b/packages/core/src/bridge/subsequence.ts
index af20de1e2..dca644141 100644
--- a/packages/core/src/bridge/subsequence.ts
+++ b/packages/core/src/bridge/subsequence.ts
@@ -1,3 +1,4 @@
+
/** True when `needle` is a subsequence of `haystack` (two-pointer, O(n+m)):
* insertions in `haystack` are free; any dropped or substituted `needle` byte
* fails. */
diff --git a/packages/core/src/commands/command-identity.ts b/packages/core/src/commands/command-identity.ts
index 1e8db0ef3..e059d2f12 100644
--- a/packages/core/src/commands/command-identity.ts
+++ b/packages/core/src/commands/command-identity.ts
@@ -462,9 +462,19 @@ export const COMMAND_IDENTITIES: readonly CommandIdentity[] = [
menuActionId: 'report-bug',
labelKey: 'reportBug',
keywords: ['bug report issue feedback problem', 'file'],
+ shortcutId: 'report-bug',
+ // The chord reaches this command ONLY through the native accelerator below
+ // — the app's shortcut registry declares it for display but wires no
+ // keydown listener, so nothing in the renderer gates it on the app-global
+ // overlay check the way every keydown listener does. On macOS that is the
+ // whole story: AppKit resolves menu key equivalents ahead of the web view.
+ // On Windows and Linux the accelerator still travels the renderer's input
+ // path first, so a focused surface that cancels the chord cancels the menu
+ // item with it.
+ shortcutDesktopOnly: true,
availability: { host: 'desktop' },
palette: { group: 'project', visibility: 'always' },
- menu: [{ section: 'help-links', order: 1, ellipsis: true }],
+ menu: [{ section: 'help-links', order: 1, ellipsis: true, accelerator: 'CmdOrCtrl+Shift+D' }],
},
{
// Palette-only sibling of report-bug (no `menu` placement): the persisted
diff --git a/packages/core/src/desktop-bridge.ts b/packages/core/src/desktop-bridge.ts
index ae1b843ca..07d87fdd9 100644
--- a/packages/core/src/desktop-bridge.ts
+++ b/packages/core/src/desktop-bridge.ts
@@ -234,6 +234,49 @@ export type OkMenuAction =
// the Resources menu and the Cmd+K palette open. Both window types subscribe.
| 'send-feedback';
+/**
+ * Where a menu action was dispatched from, for the few subscribers whose
+ * behavior depends on the dispatching SURFACE rather than on the action.
+ *
+ * `launcherBorne` means the surface the user reached the command through is a
+ * transient overlay that is still on screen at dispatch time and is about to
+ * dismiss itself — the Cmd+K palette, the renderer-drawn menu bar, a popover.
+ * A native menu bar item, a keyboard accelerator, and a persistent chrome
+ * button are all launcher-free: nothing is on screen that the command's own
+ * arrival will take away.
+ *
+ * The bug-report dialog is the motivating consumer: it screenshots the page
+ * beneath itself before revealing, and a launcher-borne open must let its
+ * launcher unmount first (or the report is a picture of the palette the user
+ * only opened to file it), while a launcher-free open must shoot immediately
+ * (or the report is a picture of the app after the defect went away).
+ *
+ * An object rather than a bare boolean so call sites read as prose and so a
+ * second provenance fact can be added without changing every signature.
+ *
+ * Electron already supplies one candidate for that second fact: the
+ * `KeyboardEvent` handed to a `MenuItem` click carries `triggeredByAccelerator`,
+ * separating a chord press from a click on the same item. This type deliberately
+ * collapses both into launcher-free, because a native menu is OS chrome that no
+ * renderer capture can see at any timing — but whoever adds the second fact
+ * should know the platform is already offering one, and that every menu callback
+ * in main currently discards the argument that carries it.
+ */
+export interface OkMenuActionOrigin {
+ readonly launcherBorne: boolean;
+}
+
+/**
+ * The `ok:menu-action` wire payload: the action plus where it came from. The
+ * origin is REQUIRED so main cannot forget to classify a new dispatch site —
+ * a bare action would silently default to launcher-free and leak its launcher
+ * into the next screenshot.
+ */
+export interface OkMenuActionDispatch {
+ readonly action: OkMenuAction;
+ readonly origin: OkMenuActionOrigin;
+}
+
/**
* Unsubscribe closure returned from `onProjectSwitched` / `onMenuAction`.
* Calling it removes the listener. Per-electron#33328, the bridge's
@@ -1305,8 +1348,12 @@ export interface OkDesktopBridge {
/** Subscribe to project-switch events. Returns unsubscribe. */
onProjectSwitched(cb: (next: OkDesktopConfig) => void): OkUnsubscribe;
- /** Subscribe to menu-bar actions. Returns unsubscribe. */
- onMenuAction(cb: (action: OkMenuAction) => void): OkUnsubscribe;
+ /**
+ * Subscribe to menu-bar actions. Returns unsubscribe. The second argument
+ * carries the dispatching surface — subscribers that only branch on the
+ * action may keep a one-parameter callback.
+ */
+ onMenuAction(cb: (action: OkMenuAction, origin: OkMenuActionOrigin) => void): OkUnsubscribe;
/**
* Subscribe to `autoUpdater` `update-downloaded` events. Fires once per
* pending-update version (gated in main by `AppState.versionPendingInstall`).
diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.ts
index 83d47404a..a363dfd54 100644
--- a/packages/core/src/markdown/callout-transformer.ts
+++ b/packages/core/src/markdown/callout-transformer.ts
@@ -1,3 +1,4 @@
+
import type { Blockquote, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/code-fence.ts b/packages/core/src/markdown/code-fence.ts
index 9807a7e82..4499dbc92 100644
--- a/packages/core/src/markdown/code-fence.ts
+++ b/packages/core/src/markdown/code-fence.ts
@@ -1,3 +1,4 @@
+
export function selectFenceChar(info: string): '`' | '~' {
return info.includes('`') ? '~' : '`';
}
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 7415c474a..34704165b 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.ts
index ece5c02a1..b6299a948 100644
--- a/packages/core/src/markdown/dedent-block-jsx-close.ts
+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts
@@ -1,3 +1,4 @@
+
import { findFencedRegions, isInsideFence } from './fence-regions.ts';
const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;
diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.ts
index 54774764a..acd398aa6 100644
--- a/packages/core/src/markdown/details-accordion-promoter.ts
+++ b/packages/core/src/markdown/details-accordion-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/div-align-promoter.ts b/packages/core/src/markdown/div-align-promoter.ts
index 43ecdc709..ba9b56384 100644
--- a/packages/core/src/markdown/div-align-promoter.ts
+++ b/packages/core/src/markdown/div-align-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.ts
index 6d3f3643e..4513da9bb 100644
--- a/packages/core/src/markdown/fence-regions.ts
+++ b/packages/core/src/markdown/fence-regions.ts
@@ -1,3 +1,4 @@
+
const FENCE_RE = /^(`{3,}|~{3,})/gm;
export function findFencedRegions(src: string): Array<[number, number]> {
diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.ts
index 00f5771ee..6931623c7 100644
--- a/packages/core/src/markdown/fixtures/index.ts
+++ b/packages/core/src/markdown/fixtures/index.ts
@@ -1,3 +1,4 @@
+
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -8,6 +9,7 @@ function fixturePath(...segments: string[]): string {
return resolve(FIXTURES_DIR, ...segments);
}
+
interface GfmExample {
section: string;
markdown: string;
@@ -17,6 +19,7 @@ export function loadGfmExamples(): GfmExample[] {
return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];
}
+
interface MdxCrashEntry {
id: string;
input: string;
@@ -68,6 +71,7 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {
) as LargeEmbedFixture[];
}
+
export function loadPrd6955Before(): string {
return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');
}
@@ -76,6 +80,7 @@ export function loadPrd6955CorruptedTriplicated(): string {
return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');
}
+
export interface NgPinnedCase {
id: string;
name: string;
@@ -92,6 +97,7 @@ export function loadNgPinnedCases(): NgPinnedCase[] {
) as NgPinnedCase[];
}
+
export function loadLargeRealistic(): string {
return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');
}
diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.ts
index 8b1eb8519..daa3ef82b 100644
--- a/packages/core/src/markdown/fixtures/perf/generate.ts
+++ b/packages/core/src/markdown/fixtures/perf/generate.ts
@@ -1,3 +1,4 @@
+
import { writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -10,6 +11,7 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;
const SEED = 0xf1de1117;
+
function mulberry32(seed: number): () => number {
let a = seed >>> 0;
return () => {
@@ -36,6 +38,7 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {
return items[items.length - 1][0];
}
+
const WORDS = [
'lorem',
'ipsum',
@@ -153,6 +156,7 @@ function mdxBlock(rand: () => number): string {
return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;
}
+
type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';
const MIX: readonly [BlockKind, number][] = [
@@ -191,6 +195,7 @@ function generateDocument(blockCount: number, seed: number): string {
return `${blocks.join('\n\n')}\n`;
}
+
function main(): void {
for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {
const doc = generateDocument(count, SEED);
diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.ts
index 420dc0fe5..32c055c5b 100644
--- a/packages/core/src/markdown/guard-flanking-matrix.ts
+++ b/packages/core/src/markdown/guard-flanking-matrix.ts
@@ -7,6 +7,7 @@ import {
import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';
import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';
+
export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;
export type FlankClass = 'whitespace' | 'punctuation' | 'other';
diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.ts
index 2653473da..283913255 100644
--- a/packages/core/src/markdown/handler-shadow-audit.ts
+++ b/packages/core/src/markdown/handler-shadow-audit.ts
@@ -1,3 +1,4 @@
+
export interface HandlerShadowWitness {
input: string;
expect: 'byte' | 'byte-and-reparse-type';
diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.ts
index da0a81d23..5d1000cc4 100644
--- a/packages/core/src/markdown/highlight-promoter.ts
+++ b/packages/core/src/markdown/highlight-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.ts
index 787315157..9681c0056 100644
--- a/packages/core/src/markdown/html-to-mdast.ts
+++ b/packages/core/src/markdown/html-to-mdast.ts
@@ -1,3 +1,4 @@
+
import type { Element as HastElement, Root as HastRoot } from 'hast';
import type { List, Nodes as MdastNodes, Root as MdastRoot } from 'mdast';
import rehypeParse from 'rehype-parse';
@@ -128,7 +129,8 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRo
throw new HtmlPayloadTooLargeError(html.length, maxBytes);
}
- const processor = unified().use(rehypeParse, { fragment: true });
+ const processor = unified()
+ .use(rehypeParse, { fragment: true });
for (const plugin of cleanupPlugins) {
processor.use(plugin);
diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.ts
index 706fa9afb..994eb6917 100644
--- a/packages/core/src/markdown/image-promoter.ts
+++ b/packages/core/src/markdown/image-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Image, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.ts
index 779e27500..ec1ac1b7e 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,3 +1,4 @@
+
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -206,6 +207,7 @@ export class MarkdownManager {
}
}
+
const registry = createRegistry();
function destructureAttrs(
@@ -254,6 +256,7 @@ function destructureAttrs(
return result;
}
+
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -276,6 +279,7 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChec
return freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;
}
+
function isEmptyMdastParagraph(node: MdastNodes): boolean {
if (node.type !== 'paragraph') return false;
const children = node.children ?? [];
@@ -344,6 +348,7 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
+
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -596,6 +601,7 @@ function buildMdastToPmHandlers(
}));
}
+
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -676,6 +682,7 @@ function buildMdastToPmHandlers(
}));
}
+
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -973,6 +980,7 @@ function buildMdastToPmHandlers(
};
}
+
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1098,6 +1106,7 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
+
function buildPmToMdastHandlers(
schema: Schema,
freshness: FreshnessCheckerHolder,
diff --git a/packages/core/src/markdown/lint/applies-to.ts b/packages/core/src/markdown/lint/applies-to.ts
index fa0be9e86..b79e9aef7 100644
--- a/packages/core/src/markdown/lint/applies-to.ts
+++ b/packages/core/src/markdown/lint/applies-to.ts
@@ -1,3 +1,4 @@
+
import picomatch from 'picomatch';
import { SUPPORTED_DOC_EXTENSIONS } from '../../constants/doc-extensions.ts';
diff --git a/packages/core/src/markdown/lint/config-files.ts b/packages/core/src/markdown/lint/config-files.ts
index 312c9c74b..94b34dee1 100644
--- a/packages/core/src/markdown/lint/config-files.ts
+++ b/packages/core/src/markdown/lint/config-files.ts
@@ -1,3 +1,4 @@
+
const MARKDOWNLINT_JSON_CONFIG_FILES: ReadonlySet<string> = new Set([
'.markdownlint.json',
'.markdownlint.jsonc',
diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.ts
index cc667b93e..7c54c0a73 100644
--- a/packages/core/src/markdown/lint/config-schemas.ts
+++ b/packages/core/src/markdown/lint/config-schemas.ts
@@ -52,6 +52,7 @@ const fullPluginShape = Object.fromEntries(
LINT_PLUGINS.map((plugin) => [plugin.id, plugin.sliceSchema]),
) as z.ZodRawShape;
+
export const LinterConfigSchema = z.object({
enabled: z.boolean(),
plugins: z.object(fullPluginShape),
diff --git a/packages/core/src/markdown/lint/default-config.ts b/packages/core/src/markdown/lint/default-config.ts
index d48eea5e4..a51f2ffb0 100644
--- a/packages/core/src/markdown/lint/default-config.ts
+++ b/packages/core/src/markdown/lint/default-config.ts
@@ -6,6 +6,7 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSetting
MD013: false,
};
+
export function resolveMarkdownlintConfig(
rules: Record<string, MarkdownlintRuleSetting> | undefined,
): Configuration {
diff --git a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
index ef478e268..9c9542661 100644
--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
@@ -1,3 +1,4 @@
+
import { CANONICAL_SCHEMA_DIALECT_URIS, DEFAULT_SCHEMA_DIALECT } from './frontmatter-validate.ts';
export interface FrontmatterFieldConstraint {
diff --git a/packages/core/src/markdown/lint/frontmatter-validate.ts b/packages/core/src/markdown/lint/frontmatter-validate.ts
index 5f953d667..b0e7833fd 100644
--- a/packages/core/src/markdown/lint/frontmatter-validate.ts
+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts
@@ -1,3 +1,4 @@
+
import Ajv, { type ValidateFunction } from 'ajv';
import Ajv2019 from 'ajv/dist/2019.js';
import Ajv2020 from 'ajv/dist/2020.js';
diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.ts
index 781226a5d..26fbc2b22 100644
--- a/packages/core/src/markdown/lint/index.ts
+++ b/packages/core/src/markdown/lint/index.ts
@@ -1,3 +1,4 @@
+
import type { LintPluginFailureReporter } from './plugin-failure.ts';
import { isLintPluginSelected, LINT_PLUGINS, type LinterConfig } from './plugins.ts';
import type { LintDiagnostic } from './types.ts';
@@ -79,7 +80,8 @@ function renderErrorMessage(error: unknown, depth = 0): string {
try {
const json = JSON.stringify(error);
if (json !== undefined) return json;
- } catch {}
+ } catch {
+ }
}
return String(error);
}
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
index 7a5af097e..f438f1b16 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
@@ -1,3 +1,4 @@
+
import type { OkfRuleId } from '../okf-rule-meta.ts';
import { fileNameFor, OKF_SCHEMA_DIR, okfSchemaPathFor } from './paths.ts';
import { OKF_FRONTMATTER_REGISTRY } from './registry.ts';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
index 1ee913527..c290b6878 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
@@ -1,3 +1,4 @@
+
import type { OkfRuleId } from '../okf-rule-meta.ts';
export const OKF_SCHEMA_DIR = '.ok/okf';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
index f325fbbb4..53ecb619d 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
@@ -1,3 +1,4 @@
+
import { compileAppliesTo } from '../applies-to.ts';
import { validateFrontmatterSource } from '../frontmatter-validate.ts';
import {
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
index f1c37671b..89845d3d5 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
@@ -1,3 +1,4 @@
+
// file-level form is deliberate: the sibling `biome-ignore` must sit on the line
// oxlint-disable unicorn/no-thenable
diff --git a/packages/core/src/markdown/lint/okf-project/rules.ts b/packages/core/src/markdown/lint/okf-project/rules.ts
index 6d691ae2b..8b476332e 100644
--- a/packages/core/src/markdown/lint/okf-project/rules.ts
+++ b/packages/core/src/markdown/lint/okf-project/rules.ts
@@ -1,3 +1,4 @@
+
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from '../okf-rule-meta.ts';
diff --git a/packages/core/src/markdown/lint/okf-rule-meta.ts b/packages/core/src/markdown/lint/okf-rule-meta.ts
index 4de50d79f..44913a9dc 100644
--- a/packages/core/src/markdown/lint/okf-rule-meta.ts
+++ b/packages/core/src/markdown/lint/okf-rule-meta.ts
@@ -1,3 +1,4 @@
+
export const OKF_RULE_IDS = [
'no-wiki-links',
'log-shape',
diff --git a/packages/core/src/markdown/lint/okf-rules.ts b/packages/core/src/markdown/lint/okf-rules.ts
index 1d5538421..d0999b62e 100644
--- a/packages/core/src/markdown/lint/okf-rules.ts
+++ b/packages/core/src/markdown/lint/okf-rules.ts
@@ -1,3 +1,4 @@
+
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from './okf-rule-meta.ts';
import type { OkfRule } from './okf-runner.ts';
import { indexShape } from './rules/index-shape.ts';
diff --git a/packages/core/src/markdown/lint/okf-runner.ts b/packages/core/src/markdown/lint/okf-runner.ts
index de130e3f4..fabb08d6e 100644
--- a/packages/core/src/markdown/lint/okf-runner.ts
+++ b/packages/core/src/markdown/lint/okf-runner.ts
@@ -1,3 +1,4 @@
+
import type { Root } from 'mdast';
import remarkFrontmatter from 'remark-frontmatter';
import remarkGfm from 'remark-gfm';
diff --git a/packages/core/src/markdown/lint/plugin-failure.ts b/packages/core/src/markdown/lint/plugin-failure.ts
index e7d694890..1cd0d2543 100644
--- a/packages/core/src/markdown/lint/plugin-failure.ts
+++ b/packages/core/src/markdown/lint/plugin-failure.ts
@@ -1,3 +1,4 @@
+
import type { LintPluginId } from './types.ts';
export interface LintPluginFailure {
diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.ts
index e7455ccf7..1dae8316d 100644
--- a/packages/core/src/markdown/lint/plugins.ts
+++ b/packages/core/src/markdown/lint/plugins.ts
@@ -1,3 +1,4 @@
+
import { z } from 'zod';
import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';
import {
@@ -23,6 +24,7 @@ import {
type OkfSlice,
} from './types.ts';
+
const MarkdownlintRuleSettingSchema = z.union([
z.boolean(),
z.enum(MARKDOWNLINT_RULE_SEVERITIES),
diff --git a/packages/core/src/markdown/lint/rules/index-shape.ts b/packages/core/src/markdown/lint/rules/index-shape.ts
index 59fe9b87d..fcbb1b56c 100644
--- a/packages/core/src/markdown/lint/rules/index-shape.ts
+++ b/packages/core/src/markdown/lint/rules/index-shape.ts
@@ -1,3 +1,4 @@
+
import type { List, ListItem } from 'mdast';
import { EXIT, visit } from 'unist-util-visit';
import { defineScopedOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/log-shape.ts b/packages/core/src/markdown/lint/rules/log-shape.ts
index e0159519f..431e4e9c8 100644
--- a/packages/core/src/markdown/lint/rules/log-shape.ts
+++ b/packages/core/src/markdown/lint/rules/log-shape.ts
@@ -1,3 +1,4 @@
+
import type { Heading } from 'mdast';
import { toString as headingText } from 'mdast-util-to-string';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/lint/rules/no-wiki-links.ts b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
index 2123e977f..f75a04d15 100644
--- a/packages/core/src/markdown/lint/rules/no-wiki-links.ts
+++ b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
@@ -1,3 +1,4 @@
+
import type { Point } from 'unist';
import { visit } from 'unist-util-visit';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/reserved-casing.ts b/packages/core/src/markdown/lint/rules/reserved-casing.ts
index 89ef3e4a9..c8b4d8f28 100644
--- a/packages/core/src/markdown/lint/rules/reserved-casing.ts
+++ b/packages/core/src/markdown/lint/rules/reserved-casing.ts
@@ -1,3 +1,4 @@
+
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.ts
index 2cffecae6..594830b88 100644
--- a/packages/core/src/markdown/lint/types.ts
+++ b/packages/core/src/markdown/lint/types.ts
@@ -1,3 +1,4 @@
+
import type { BrokenLinkReason } from '../../schemas/api/agent-write.ts';
import type { OkfRuleId } from './okf-rule-meta.ts';
@@ -112,6 +113,7 @@ export interface OkfSlice {
generate?: { index?: boolean };
}
+
interface RuleOptionSpecBase {
key: string;
description: string;
diff --git a/packages/core/src/markdown/lint/validation-counts.ts b/packages/core/src/markdown/lint/validation-counts.ts
index 98238656e..437cc539a 100644
--- a/packages/core/src/markdown/lint/validation-counts.ts
+++ b/packages/core/src/markdown/lint/validation-counts.ts
@@ -1,3 +1,4 @@
+
export interface ValidationSourceCounts {
errorCount: number;
warningCount: number;
diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.ts
index a5b511f25..bd79424c7 100644
--- a/packages/core/src/markdown/math-promoter.ts
+++ b/packages/core/src/markdown/math-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Code, Root } from 'mdast';
import type { Math as MdastMath } from 'mdast-util-math';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.ts
index ed89371d0..00fbc0035 100644
--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts
+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, ElementContent, Properties } from 'hast';
import type { FootnoteDefinition, FootnoteReference } from 'mdast';
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.ts
index 8ce2b2492..df788a80d 100644
--- a/packages/core/src/markdown/mdast-to-html.ts
+++ b/packages/core/src/markdown/mdast-to-html.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root as HastRoot, Text as HastText } from 'hast';
import type { Root as MdastRoot, Text as MdastText } from 'mdast';
import type { Handler } from 'mdast-util-to-hast';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index bfd7e3109..fa3cfcd86 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.ts
index 1a897fca8..17ed2b829 100644
--- a/packages/core/src/markdown/mermaid-promoter.ts
+++ b/packages/core/src/markdown/mermaid-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Code, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.ts
index d988f4b8b..4aa0490c4 100644
--- a/packages/core/src/markdown/parse-with-fallback.ts
+++ b/packages/core/src/markdown/parse-with-fallback.ts
@@ -168,6 +168,7 @@ export function parseRecursive(
}
}
+
interface VFilePlace {
offset?: number;
start?: { offset?: number };
@@ -186,6 +187,7 @@ function extractErrorOffset(err: unknown): number | undefined {
return undefined;
}
+
interface Region {
start: number;
end: number;
@@ -209,6 +211,7 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {
return null;
}
+
export interface TagEvent {
kind: 'open' | 'close' | 'self-close';
name: string;
@@ -355,6 +358,7 @@ function findFallbackRegion(src: string, errorOffset: number): Region {
return { start: blockStart, end: blockEnd };
}
+
interface SourceBlock {
src: string;
start: number;
@@ -452,6 +456,7 @@ function tryPerBlockFallback(
};
}
+
function wholeDocRawText(source: string): JSONContent {
return {
type: 'doc',
diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.ts
index e6ab4fd57..43d420187 100644
--- a/packages/core/src/markdown/parser-drop-closure.ts
+++ b/packages/core/src/markdown/parser-drop-closure.ts
@@ -1,3 +1,4 @@
+
export type DroppedTokenAdjudication =
| {
kind: 'format-dof-axis';
diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.ts
index 0e3224206..55736041c 100644
--- a/packages/core/src/markdown/pipeline.ts
+++ b/packages/core/src/markdown/pipeline.ts
@@ -1,3 +1,4 @@
+
import {
type FromProseMirrorOptions,
fromProseMirror,
diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.ts
index 91cdf658f..ccf06e94d 100644
--- a/packages/core/src/markdown/position-aware-join.ts
+++ b/packages/core/src/markdown/position-aware-join.ts
@@ -1,3 +1,4 @@
+
import type { Join } from 'mdast-util-to-markdown';
import type { Position } from 'unist';
import { isBlankLineParagraph } from './zero-emission-blocks.ts';
diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.ts
index 0f399d34c..e5b4c9eba 100644
--- a/packages/core/src/markdown/position-slice.ts
+++ b/packages/core/src/markdown/position-slice.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Root } from 'mdast';
import { visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
@@ -476,7 +477,8 @@ export function applyPositionSliceToNode(
const first = source[startOff];
if (first !== '[' && first !== '<' && !node.title) {
node.data.sourceStyle = 'gfm-autolink';
- } else if (first === '[') {
+ }
+ else if (first === '[') {
const slice = source.slice(startOff, endOff);
const closeBracketIdx = slice.lastIndexOf('](');
if (closeBracketIdx !== -1) {
diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
index db10fa54b..ca225ce9b 100644
--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, Root, Text } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
index 34068d103..3a2524a9a 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
index 93151d43b..2279a0189 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
index 188f02d83..a0f467c42 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
index 4ba2c3418..4e8542a21 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
index 1a74b1272..a3c96b24a 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
index de35e7b79..e95cf43d6 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
index b4be1b2ea..ffdb4d5b5 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
index 3c8d88b7c..e2a96d1a7 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.ts
index cf2c9da8e..0389575ac 100644
--- a/packages/core/src/markdown/resolve-image-url.ts
+++ b/packages/core/src/markdown/resolve-image-url.ts
@@ -1,3 +1,4 @@
+
import { isRelativeUrl } from './safe-url.ts';
function isDevDiagnosticContext(): boolean {
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 4d3250d3a..8be632ba4 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,3 +1,4 @@
+
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');
diff --git a/packages/core/src/markdown/serialize-fidelity.test-helper.ts b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
index 0dd54070e..96304e7a5 100644
--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts
+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
@@ -1,3 +1,4 @@
+
import type { JSONContent } from '@tiptap/core';
import type { Nodes } from 'mdast';
import { expect } from 'vitest';
diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.ts
index 7cac5b042..93798cf83 100644
--- a/packages/core/src/markdown/serialize-helpers.ts
+++ b/packages/core/src/markdown/serialize-helpers.ts
@@ -1,3 +1,4 @@
+
import type { Node as PmNode } from '@tiptap/pm/model';
import type {
MdxJsxAttribute,
diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.ts
index b012a5aff..8c08b7a04 100644
--- a/packages/core/src/markdown/single-dollar-math-promoter.ts
+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts
@@ -1,3 +1,4 @@
+
import type { PhrasingContent, Root, Text } from 'mdast';
import type { InlineMath } from 'mdast-util-math';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.ts
index b50bea5ec..83d4af672 100644
--- a/packages/core/src/markdown/to-markdown-handlers.ts
+++ b/packages/core/src/markdown/to-markdown-handlers.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parents } from 'mdast';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { Handle, Info, State } from 'mdast-util-to-markdown';
diff --git a/packages/core/src/markdown/underline-promoter.ts b/packages/core/src/markdown/underline-promoter.ts
index 0f1b0f27d..6e6d73400 100644
--- a/packages/core/src/markdown/underline-promoter.ts
+++ b/packages/core/src/markdown/underline-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.ts
index 1a082bda7..932d7d2a8 100644
--- a/packages/core/src/markdown/unknown-mdast-guard.ts
+++ b/packages/core/src/markdown/unknown-mdast-guard.ts
@@ -1,3 +1,4 @@
+
import type { Root as MdastRoot } from 'mdast';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.ts
index d578476a7..ac9f5239b 100644
--- a/packages/core/src/markdown/whitespace-char-ref.ts
+++ b/packages/core/src/markdown/whitespace-char-ref.ts
@@ -1,3 +1,4 @@
+
const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([
[0x20, ' '],
[0x09, '\t'],
diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.ts
index 6dad26200..afd9936fe 100644
--- a/packages/core/src/markdown/wiki-link-micromark.ts
+++ b/packages/core/src/markdown/wiki-link-micromark.ts
@@ -17,6 +17,7 @@ declare module 'micromark-util-types' {
}
}
+
const CODE_BANG = 33; // !
const CODE_LBRACKET = 91; // [
const CODE_RBRACKET = 93; // ]
@@ -260,6 +261,7 @@ export function wikiLinkSyntax(): Extension {
};
}
+
function enterWikiLink(this: CompileContext, token: Token) {
this.enter(
{
@@ -385,6 +387,7 @@ export const wikiLinkToMarkdown: {
unsafe: [{ character: '[', inConstruct: ['phrasing'] }],
};
+
const MICROMARK_EXT = wikiLinkSyntax();
export function remarkWikiLink(this: Processor) {
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index 64b6e9797..cb61d21e1 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -154,6 +154,7 @@ import type {
CliReadiness,
OkChromeColors,
OkMenuAction,
+ OkMenuActionOrigin,
} from '../shared/bridge-contract.ts';
import { type EntryPoint, isEntryPoint } from '../shared/entry-point.ts';
import type {
@@ -331,7 +332,11 @@ import {
runMcpWiringOnFirstLaunch,
} from './mcp-wiring.ts';
import { installApplicationMenu } from './menu.ts';
-import { resolveMenuActionTarget } from './menu-action-target.ts';
+import {
+ LAUNCHER_FREE_ORIGIN,
+ originForMenuDispatch,
+ resolveMenuActionTarget,
+} from './menu-action-target.ts';
import type { MenuTranslator } from './menu-translator.ts';
import { beginNavigatorHandoff, createNavigatorWindow } from './navigator-window.ts';
import {
@@ -1128,7 +1133,13 @@ function attachSpellcheckMenuToWindow(win: BrowserWindow): void {
// the menu click fires async, and a send on a destroyed webContents throws
// and crashes main (no userland uncaughtException handler).
if (win.isDestroyed()) return;
- sendToRenderer(win.webContents, 'ok:menu-action', 'toggle-source');
+ // Launcher-free even though a menu is open: this one is a native
+ // `Menu.popup()`, so it is OS chrome rather than a DOM layer — nothing a
+ // renderer-side capture could see, and nothing worth waiting on.
+ sendToRenderer(win.webContents, 'ok:menu-action', {
+ action: 'toggle-source',
+ origin: { launcherBorne: false },
+ });
},
popMenu: (input) => {
popSpellcheckMenu({ Menu, window: win }, { ...input, translate: currentMenuTranslator() });
@@ -4284,16 +4295,24 @@ async function runDesktopUninstallUiPreview(mode: DesktopUninstallFlowPreviewMod
* BrowserWindow (for a menu click from the Dock).
* Silent no-op when no windows are open (e.g. last project closed but app
* still running on macOS via the Dock).
+ *
+ * `sender` picks the target window and nothing else; `origin` states the
+ * dispatching surface separately, so a caller that threads a sender purely to
+ * choose a window does not accidentally claim to be a launcher.
*/
-function sendMenuAction(action: OkMenuAction, sender: WebContents | null = null): void {
+function sendMenuAction(
+ action: OkMenuAction,
+ sender: WebContents | null = null,
+ origin: OkMenuActionOrigin = LAUNCHER_FREE_ORIGIN,
+): void {
const target = resolveMenuActionTarget(sender, {
fromWebContents: (contents) => BrowserWindow.fromWebContents(contents),
getFocusedWindow: () => BrowserWindow.getFocusedWindow(),
getAllWindows: () => BrowserWindow.getAllWindows(),
});
if (!target) return;
- sendToRenderer(target.webContents, 'ok:menu-action', action);
+ sendToRenderer(target.webContents, 'ok:menu-action', { action, origin });
}
/**
@@ -5956,7 +5975,7 @@ function registerIpcHandlers() {
})(),
};
case 'menu-action':
- sendMenuAction(request.action, event.sender);
+ sendMenuAction(request.action, event.sender, originForMenuDispatch(request.kind));
return undefined;
case 'open-recent-project':
await openProjectOrFallbackToNavigator(request.path, 'recents');
@@ -5967,6 +5986,15 @@ function registerIpcHandlers() {
case 'role':
applyMenuDispatchRole(request.role, event.sender);
return undefined;
+ default: {
+ // The roster's `satisfies` forces a new dispatch kind to be CLASSIFIED;
+ // this forces it to be HANDLED. Without both, a sixth kind compiles
+ // clean and then silently no-ops here — noticed on first manual use,
+ // unlike a misclassified origin, but still a compile error we can have
+ // for four lines.
+ const _exhaustive: never = request;
+ return _exhaustive;
+ }
}
});
diff --git a/packages/desktop/src/main/menu-action-target.test.ts b/packages/desktop/src/main/menu-action-target.test.ts
index 16a6eeae0..c15bfee73 100644
--- a/packages/desktop/src/main/menu-action-target.test.ts
+++ b/packages/desktop/src/main/menu-action-target.test.ts
@@ -1,6 +1,12 @@
import { describe, expect, test, vi } from 'vitest';
-import { resolveMenuActionTarget } from './menu-action-target';
+import {
+ LAUNCHER_BORNE_ORIGIN,
+ LAUNCHER_FREE_ORIGIN,
+ MENU_DISPATCH_KINDS,
+ originForMenuDispatch,
+ resolveMenuActionTarget,
+} from './menu-action-target';
describe('resolveMenuActionTarget', () => {
test('renderer menu actions target the dispatching window before focus fallbacks', () => {
@@ -36,3 +42,34 @@ describe('resolveMenuActionTarget', () => {
expect(resolveMenuActionTarget(null, deps)).toBe(fallbackWindow);
});
});
+
+describe('menu action origins', () => {
+ test('the two origins carry the bit the capture path reads', () => {
+ expect(LAUNCHER_FREE_ORIGIN).toEqual({ launcherBorne: false });
+ expect(LAUNCHER_BORNE_ORIGIN).toEqual({ launcherBorne: true });
+ });
+
+ test('both are frozen, so one dispatch cannot poison every later one', () => {
+ // Module-level singletons shared by every dispatch: a mutation here would
+ // silently reclassify unrelated actions rather than fail near its cause.
+ expect(Object.isFrozen(LAUNCHER_FREE_ORIGIN)).toBe(true);
+ expect(Object.isFrozen(LAUNCHER_BORNE_ORIGIN)).toBe(true);
+ expect(() => {
+ (LAUNCHER_FREE_ORIGIN as { launcherBorne: boolean }).launcherBorne = true;
+ }).toThrow();
+ expect(LAUNCHER_FREE_ORIGIN.launcherBorne).toBe(false);
+ });
+});
+
+describe('originForMenuDispatch', () => {
+ test('only menu-action is launcher-borne', () => {
+ // Pins the mapping against inversion. Exhaustiveness is NOT this test's job
+ // and cannot be: a roster listed here would be a copy of the union, free to
+ // drift from it. `ORIGIN_BY_DISPATCH_KIND`'s `satisfies` is what forces a new
+ // kind to be classified, and it fails at typecheck rather than here.
+ expect(originForMenuDispatch('menu-action')).toBe(LAUNCHER_BORNE_ORIGIN);
+ for (const kind of MENU_DISPATCH_KINDS.filter((k) => k !== 'menu-action')) {
+ expect(originForMenuDispatch(kind)).toBe(LAUNCHER_FREE_ORIGIN);
+ }
+ });
+});
diff --git a/packages/desktop/src/main/menu-action-target.ts b/packages/desktop/src/main/menu-action-target.ts
index 360daaf63..c1e69be8a 100644
--- a/packages/desktop/src/main/menu-action-target.ts
+++ b/packages/desktop/src/main/menu-action-target.ts
@@ -1,3 +1,5 @@
+import type { OkMenuActionOrigin, OkMenuDispatchRequest } from '../shared/bridge-contract.ts';
+
interface MenuActionTargetDeps<TSender, TWindow> {
fromWebContents: (sender: TSender) => TWindow | null;
getFocusedWindow: () => TWindow | null;
@@ -14,3 +16,68 @@ export function resolveMenuActionTarget<TSender, TWindow>(
}
return deps.getFocusedWindow() ?? deps.getAllWindows()[0] ?? null;
}
+
+/**
+ * How a menu action reached the renderer. Stated EXPLICITLY by whoever dispatches
+ * it, never inferred from the `sender` argument.
+ *
+ * `sender` exists to pick the target window. It used to double as the provenance
+ * bit, which fused two unrelated questions and defaulted the wrong way: anything
+ * that passed a sender to choose a window was stamped launcher-borne, so a future
+ * main-side forwarder would have delayed its screenshot waiting for a launcher
+ * that was never on screen. With an explicit argument the safe value is the
+ * default and opting in is deliberate.
+ */
+export const LAUNCHER_FREE_ORIGIN: OkMenuActionOrigin = Object.freeze({ launcherBorne: false });
+
+/**
+ * The dispatching surface is transient and the user went through it only to REACH
+ * the action, so it is an artifact of filing rather than the report's subject and
+ * the screenshot must wait for it to unmount.
+ *
+ * Used for renderer-originated `ok:menu:dispatch` traffic. In the product that is
+ * the renderer-drawn Windows and Linux menu bar (a Radix popper on screen when the
+ * action fires). The smoke tier borrows the same channel to drive terminal actions
+ * — those are stamped launcher-borne too, harmlessly, because no terminal action
+ * reads the origin. Only the report-bug path does.
+ */
+export const LAUNCHER_BORNE_ORIGIN: OkMenuActionOrigin = Object.freeze({ launcherBorne: true });
+
+/**
+ * Origin for every kind of renderer-initiated `ok:menu:dispatch`, as data.
+ *
+ * Adding a kind to `OkMenuDispatchRequest` fails to compile here (the
+ * `satisfies`), so a new renderer entry point cannot inherit a classification by
+ * omission — it has to be decided. Same shape as the intent roster in
+ * `uninstall-ipc.ts`.
+ *
+ * `menu-action` is the only launcher-borne one: in the product it is the
+ * renderer-drawn Windows and Linux menu bar, the one platform where that bar is
+ * the only menu route to the reporter. Getting it wrong there means a bug report
+ * screenshotting its own open dropdown instead of the screen the user meant to
+ * report.
+ *
+ * What this does NOT cover: `sendMenuAction`'s `origin` parameter still defaults
+ * to launcher-free, so a caller that drops the argument entirely gets the wrong
+ * answer here just as silently as a bare literal would have. The map makes the
+ * mapping total and testable; it does not make passing it mandatory. Keeping the
+ * safe value in the default position is still right for every other caller —
+ * this one kind is the exception, and it is the reason the call site threads an
+ * explicit origin rather than relying on the default.
+ */
+const ORIGIN_BY_DISPATCH_KIND = {
+ query: LAUNCHER_FREE_ORIGIN,
+ 'menu-action': LAUNCHER_BORNE_ORIGIN,
+ command: LAUNCHER_FREE_ORIGIN,
+ 'open-recent-project': LAUNCHER_FREE_ORIGIN,
+ role: LAUNCHER_FREE_ORIGIN,
+} satisfies Record<OkMenuDispatchRequest['kind'], OkMenuActionOrigin>;
+
+/** The classified kinds, so a test derives its roster instead of duplicating it. */
+export const MENU_DISPATCH_KINDS = Object.keys(
+ ORIGIN_BY_DISPATCH_KIND,
+) as OkMenuDispatchRequest['kind'][];
+
+export function originForMenuDispatch(kind: OkMenuDispatchRequest['kind']): OkMenuActionOrigin {
+ return ORIGIN_BY_DISPATCH_KIND[kind];
+}
diff --git a/packages/desktop/src/preload/index.ts b/packages/desktop/src/preload/index.ts
index 282d73203..70d13abb8 100644
--- a/packages/desktop/src/preload/index.ts
+++ b/packages/desktop/src/preload/index.ts
@@ -52,6 +52,8 @@ import type {
OkLocalOpStream,
OkMcpWiringShowPayload,
OkMenuAction,
+ OkMenuActionDispatch,
+ OkMenuActionOrigin,
OkMenuDispatchRequest,
OkNoteWindowMainAction,
OkNoteWindowMainActionResult,
@@ -411,7 +413,7 @@ const MENU_ACTION_BUFFER_POLICY: Record<OkMenuAction, MenuActionBufferPolicy> =
'send-feedback': 'additive',
};
-const menuActionListeners = new Set<(action: OkMenuAction) => void>();
+const menuActionListeners = new Set<(action: OkMenuAction, origin: OkMenuActionOrigin) => void>();
/**
* Fan one action out, isolating subscriber faults. A throwing listener must not
* starve the ones after it, and in the replay path it must not take the rest of
@@ -419,35 +421,43 @@ const menuActionListeners = new Set<(action: OkMenuAction) => void>();
* escaping throw would silently discard intents the buffer promised to deliver.
* Same contract the renderer-side bus keeps for its own subscribers.
*/
-function deliverMenuAction(action: OkMenuAction): void {
+function deliverMenuAction(dispatch: OkMenuActionDispatch): void {
for (const listener of menuActionListeners) {
try {
- listener(action);
+ listener(dispatch.action, dispatch.origin);
} catch (err) {
console.error('[preload:menu-action] listener threw during dispatch:', err);
}
}
}
-const bufferedMenuActions: OkMenuAction[] = [];
+// Whole dispatches, not bare actions: a buffered action replayed without its
+// origin would arrive looking launcher-free, and the one subscriber that reads
+// the origin decides whether to screenshot the launcher that is still on screen.
+const bufferedMenuActions: OkMenuActionDispatch[] = [];
// biome-ignore lint/plugin/no-loosely-typed-webcontents-ipc: preload-side subscription wrapper (precedent #14)
-ipcRenderer.on('ok:menu-action', (_event, action: OkMenuAction) => {
+ipcRenderer.on('ok:menu-action', (_event, dispatch: OkMenuActionDispatch) => {
if (menuActionListeners.size > 0) {
- deliverMenuAction(action);
+ deliverMenuAction(dispatch);
return;
}
- const policy = MENU_ACTION_BUFFER_POLICY[action];
+ const policy = MENU_ACTION_BUFFER_POLICY[dispatch.action];
if (policy === 'never-buffer') {
// The one drop worth a trace: a user who pressed it saw nothing happen and
// may well report that. The parity collapse below is the designed common
// path and would log on every repeated keypress, so it stays quiet.
- console.debug('[preload:menu-action] destructive action dropped, nothing listening:', action);
+ console.debug(
+ '[preload:menu-action] destructive action dropped, nothing listening:',
+ dispatch.action,
+ );
return;
}
- if (policy === 'parity' && bufferedMenuActions.at(-1) === action) return;
+ // Collapse on the action alone. A repeat is the same intent restated, so the
+ // queued dispatch — origin included — is the one that stands.
+ if (policy === 'parity' && bufferedMenuActions.at(-1)?.action === dispatch.action) return;
if (bufferedMenuActions.length >= MAX_BUFFERED_MENU_ACTIONS) bufferedMenuActions.shift();
- bufferedMenuActions.push(action);
+ bufferedMenuActions.push(dispatch);
});
const bridge: OkDesktopBridge = {
@@ -462,7 +472,7 @@ const bridge: OkDesktopBridge = {
return () => ipcRenderer.removeListener('ok:project:switched', listener);
},
- onMenuAction(cb: (action: OkMenuAction) => void) {
+ onMenuAction(cb: (action: OkMenuAction, origin: OkMenuActionOrigin) => void) {
// The `ipcRenderer.on` for this channel is permanent and lives at module
// scope (see the buffering block above), so subscribing is set membership.
const wasUnlistened = menuActionListeners.size === 0;
@@ -482,7 +492,7 @@ const bridge: OkDesktopBridge = {
bufferedMenuActions.unshift(...replay);
return;
}
- for (const action of replay) deliverMenuAction(action);
+ for (const dispatch of replay) deliverMenuAction(dispatch);
});
}
return () => {
diff --git a/packages/desktop/src/preload/menu-action-buffer.test.ts b/packages/desktop/src/preload/menu-action-buffer.test.ts
index f32ac2a7e..7d18814ea 100644
--- a/packages/desktop/src/preload/menu-action-buffer.test.ts
+++ b/packages/desktop/src/preload/menu-action-buffer.test.ts
@@ -47,8 +47,10 @@ vi.mock('electron', () => ({
webUtils: { getPathForFile: () => '' },
}));
+type MenuOrigin = { launcherBorne: boolean };
+
type MenuBridge = {
- onMenuAction(cb: (action: string) => void): () => void;
+ onMenuAction(cb: (action: string, origin: MenuOrigin) => void): () => void;
};
async function loadBridge(): Promise<MenuBridge> {
@@ -61,15 +63,19 @@ async function loadBridge(): Promise<MenuBridge> {
return bridge as unknown as MenuBridge;
}
-/** Push one `ok:menu-action` exactly as main does. */
-function pushMenuAction(action: string): void {
+/**
+ * Push one `ok:menu-action` exactly as main does — a whole dispatch envelope,
+ * not a bare action. Defaults to the launcher-free origin main stamps for a
+ * native menu item or a keyboard accelerator.
+ */
+function pushMenuAction(action: string, origin: MenuOrigin = { launcherBorne: false }): void {
const listeners = channelListeners.get('ok:menu-action');
if (listeners === undefined || listeners.size === 0) {
throw new Error(
'the preload registered no ok:menu-action listener at load — a menu action arriving before the renderer subscribes would be dropped',
);
}
- for (const listener of listeners) listener({}, action);
+ for (const listener of listeners) listener({}, { action, origin });
}
/** Let the replay microtask run. */
@@ -272,3 +278,59 @@ describe('preload menu-action delivery', () => {
expect(seen.at(-1)).toBe('action-39');
});
});
+
+/**
+ * The dispatching surface travels with the action, and the buffer is the place
+ * it is easiest to lose: replaying a queued action without its origin would
+ * hand the renderer a launcher-borne dispatch dressed as a native one.
+ */
+describe('preload menu-action origin', () => {
+ it('hands a live subscriber the origin main stamped', async () => {
+ const bridge = await loadBridge();
+ const seen: Array<[string, MenuOrigin]> = [];
+ bridge.onMenuAction((action, origin) => seen.push([action, origin]));
+
+ pushMenuAction('report-bug', { launcherBorne: true });
+
+ expect(seen).toEqual([['report-bug', { launcherBorne: true }]]);
+ });
+
+ it('replays a buffered action with the origin it was dispatched with', async () => {
+ const bridge = await loadBridge();
+ pushMenuAction('report-bug', { launcherBorne: true });
+
+ const seen: Array<[string, MenuOrigin]> = [];
+ bridge.onMenuAction((action, origin) => seen.push([action, origin]));
+ await settle();
+
+ expect(seen).toEqual([['report-bug', { launcherBorne: true }]]);
+ });
+
+ it('keeps distinct origins apart across a replayed batch', async () => {
+ const bridge = await loadBridge();
+ pushMenuAction('report-bug', { launcherBorne: true });
+ pushMenuAction('report-bug', { launcherBorne: false });
+
+ const seen: MenuOrigin[] = [];
+ bridge.onMenuAction((_action, origin) => seen.push(origin));
+ await settle();
+
+ // `report-bug` is additive, so both survive — and neither inherits the
+ // other's origin.
+ expect(seen).toEqual([{ launcherBorne: true }, { launcherBorne: false }]);
+ });
+
+ it('collapses a repeated parity action on the action alone, keeping the queued origin', async () => {
+ const bridge = await loadBridge();
+ pushMenuAction('toggle-terminal', { launcherBorne: false });
+ pushMenuAction('toggle-terminal', { launcherBorne: true });
+
+ const seen: Array<[string, MenuOrigin]> = [];
+ bridge.onMenuAction((action, origin) => seen.push([action, origin]));
+ await settle();
+
+ // A repeat with nothing on screen is the same intent restated, so the
+ // queued dispatch stands whole — origin included.
+ expect(seen).toEqual([['toggle-terminal', { launcherBorne: false }]]);
+ });
+});
diff --git a/packages/desktop/src/shared/ipc-events.ts b/packages/desktop/src/shared/ipc-events.ts
index e58e782d8..9497e598d 100644
--- a/packages/desktop/src/shared/ipc-events.ts
+++ b/packages/desktop/src/shared/ipc-events.ts
@@ -20,7 +20,7 @@ import type {
OkDesktopConfig,
OkLocalOpAuthEvent,
OkLocalOpCloneEvent,
- OkMenuAction,
+ OkMenuActionDispatch,
OkPtyData,
OkPtyExit,
OkRecentRemovedMissingInfo,
@@ -48,8 +48,12 @@ export interface EventChannels {
* (boot restore, native File → Open Recent) prune silently and never send.
*/
'ok:project:recent-removed-missing': { payload: OkRecentRemovedMissingInfo };
- /** Main → renderer menu-action dispatch (File → New Doc, Edit → Toggle Sidebar, etc.). */
- 'ok:menu-action': { payload: OkMenuAction };
+ /**
+ * Main → renderer menu-action dispatch (File → New Doc, Edit → Toggle
+ * Sidebar, etc.), stamped with the dispatching surface. Each dispatcher states
+ * its own origin explicitly — see `sendMenuAction`.
+ */
+ 'ok:menu-action': { payload: OkMenuActionDispatch };
/**
* A popped-out note window handed a conversation/comments intent to its
* owning project window. Main focuses that window before sending.
diff --git a/packages/desktop/tests/smoke/_helpers/parse-timeouts.ts b/packages/desktop/tests/smoke/_helpers/parse-timeouts.ts
index 47c679b80..393cf9312 100644
--- a/packages/desktop/tests/smoke/_helpers/parse-timeouts.ts
+++ b/packages/desktop/tests/smoke/_helpers/parse-timeouts.ts
@@ -85,6 +85,8 @@ export interface TestEntry {
cumulativeMs: number;
/** `toPass({ timeout: N })` budgets specifically — for the Invariant-B check on Apple-Event / IPC roundtrip latency. */
toPassBudgetsMs: number[];
+ /** Source offsets of the test body's opening and closing brace. */
+ bodyRange: readonly [number, number];
}
/** Per-file calibration analysis. */
@@ -92,6 +94,20 @@ export interface FileAnalysis {
filePath: string;
helpers: HelperBudget[];
tests: TestEntry[];
+ /**
+ * `test.setTimeout(...)` calls that sit OUTSIDE any test body — at
+ * `test.describe` scope or module top level.
+ *
+ * Playwright honours those (they set the enclosing suite's timeout), but
+ * `perTestTimeoutMs` cannot see them, because a test's budget is read from
+ * its own arrow-function body. A file that declares its budget that way runs
+ * under a ceiling the calibration guard never compares against, and if the
+ * declared budget is TIGHTER than the config's the guard is looser than
+ * reality — which is the direction that lets an over-budget addition through
+ * to an unattributable runtime timeout. Reported so the guard can reject the
+ * placement instead of silently mis-scoring it.
+ */
+ looseSetTimeoutLines: number[];
}
/** Outer per-test timeout extracted from `playwright.config.ts`. */
@@ -399,6 +415,7 @@ export function extractTestEntries(src: string, helpers: HelperBudget[]): TestEn
tracedHelperBudgetsMs,
cumulativeMs,
toPassBudgetsMs,
+ bodyRange: [bodyOpenIdx, bodyCloseIdx],
});
}
return entries;
@@ -409,7 +426,24 @@ export function parseTestFile(filePath: string): FileAnalysis {
const src = readFileSync(filePath, 'utf8');
const helpers = extractHelperBudgets(src);
const tests = extractTestEntries(src, helpers);
- return { filePath, helpers, tests };
+ return { filePath, helpers, tests, looseSetTimeoutLines: findLooseSetTimeouts(src, tests) };
+}
+
+/**
+ * Lines carrying a `test.setTimeout(...)` that no test body encloses. Compares
+ * whole-file occurrences against the ranges `extractTestEntries` already
+ * sliced, so it stays correct as the body-finding logic evolves.
+ */
+function findLooseSetTimeouts(src: string, tests: TestEntry[]): number[] {
+ const stripped = stripCommentsAndStrings(src);
+ const bodies = tests.map((t) => t.bodyRange);
+ const lines: number[] = [];
+ for (const m of stripped.matchAll(TEST_SET_TIMEOUT_RE)) {
+ const at = m.index ?? 0;
+ if (bodies.some(([open, close]) => at > open && at < close)) continue;
+ lines.push(lineNumberAt(src, at));
+ }
+ return lines;
}
/**
diff --git a/packages/desktop/tests/smoke/_helpers/platform-gate.test.ts b/packages/desktop/tests/smoke/_helpers/platform-gate.test.ts
index 37693e75e..68dea7d85 100644
--- a/packages/desktop/tests/smoke/_helpers/platform-gate.test.ts
+++ b/packages/desktop/tests/smoke/_helpers/platform-gate.test.ts
@@ -108,6 +108,11 @@ const PLATFORM_IRRELEVANT_PREDICATES = new Set([
'BUILD_EXISTS',
'ENABLED',
'appIsRunning',
+ // Whether this host composited a readable surface for `capturePage()` at all.
+ // A headless or display-less runner returns an empty image on every platform,
+ // so the spec that reads it is skipped for want of pixels rather than for
+ // where it is running.
+ 'preview',
]);
/** Parse-only: no lib files, no dependency resolution, nothing on disk. */
diff --git a/packages/desktop/tests/smoke/report-bug.e2e.ts b/packages/desktop/tests/smoke/report-bug.e2e.ts
index 37924c005..462bcdd23 100644
--- a/packages/desktop/tests/smoke/report-bug.e2e.ts
+++ b/packages/desktop/tests/smoke/report-bug.e2e.ts
@@ -4,7 +4,7 @@
* ReportBugDialog, then through compose → create → review against the real
* main-process bundling pipeline.
*
- * This is the live-wire complement to the bun tiers, which mock at the
+ * This is the live-wire complement to the in-process tiers, which mock at the
* `window.okDesktop` bridge seam on the renderer side and at injected deps
* on the main side. Here the whole chain is real: native menu click handler
* → `ok:menu-action` push → preload bridge → dialog mount, and the dialog's
@@ -19,6 +19,21 @@
* simulated. The lookup walks every submenu rather than assuming a
* placement, so the per-platform template shape does not matter.
*
+ * The second spec is the only rung in this repo that can look at real capture
+ * pixels. Every tier below it fakes `capturePage()`, so they can pin WHEN the
+ * capture fires (while an overlay is still mounted) but never that the overlay
+ * is IN the resulting picture. Here two captures are taken from the same
+ * window — one with a Radix context menu open, one without — and compared as
+ * decoded bitmaps.
+ *
+ * Two things it deliberately does not claim. It is NOT a regression test for
+ * the gate's settle default: a context menu has nothing to dismiss it, so even
+ * a gate that waits for every popper shoots at its deadline with the menu still
+ * on screen and this spec stays green. Timing belongs to the dialog's dom
+ * tier. And it cannot say the difference IS the menu rather than some other
+ * repaint — the floor is derived from the menu's own measured footprint to make
+ * that the overwhelmingly likely reading, and one human look closes the rest.
+ *
* Send and Reveal stay unexercised here by design: Send needs the intake
* endpoint (ships separately; absent here), and Reveal opens a real Finder
* window on the host running the suite.
@@ -37,7 +52,7 @@ import {
} from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
-import type { Page } from '@playwright/test';
+import type { ElectronApplication, Locator, Page } from '@playwright/test';
import { _electron as electron } from '@playwright/test';
import { desktopLaunchOptions, resolveDesktopTarget } from './_helpers/launch-desktop';
import {
@@ -46,10 +61,145 @@ import {
PLATFORM_SUPPORTED,
SMOKE_ENABLED,
} from './_helpers/platform-gate';
-import { expect, test } from './_helpers/smoke-test';
+import { expect, type SmokeFixtures, test } from './_helpers/smoke-test';
const TARGET = resolveDesktopTarget();
+/**
+ * Seed an already-consented project, launch against it, and hand back the
+ * editor window once its UI is stable enough to drive.
+ *
+ * Both specs need their own isolated HOME (the create handler resolves
+ * `~/.ok/bug-reports/` per call, so a shared one would let the specs read
+ * each other's zips), which is why this boots a fresh app rather than
+ * sharing one across the file.
+ */
+async function bootEditorWindow(
+ captureStderrFor: SmokeFixtures['captureStderrFor'],
+): Promise<{ app: ElectronApplication; page: Page; tmpHome: string }> {
+ // Isolated HOME: the create handler writes to `~/.ok/bug-reports/` via a
+ // call-time homedir() lookup, so launching with HOME pointed at a tmpdir
+ // keeps the real `~/.ok` untouched. Realpath per the consent-dialog
+ // precedent (macOS tmpdir() is a symlink into /private/var/folders).
+ const tmpHome = realpathSync(mkdtempSync(join(tmpdir(), 'ok-report-bug-home-')));
+ const projectDir = realpathSync(mkdtempSync(join(tmpdir(), 'ok-report-bug-project-')));
+ mkdirSync(join(projectDir, '.ok'), { recursive: true });
+ writeFileSync(join(projectDir, '.ok', 'config.yml'), "content:\n dir: '.'\n");
+ writeFileSync(join(projectDir, 'start.md'), '# Start\n\nSeed document.\n');
+
+ // Already-consented project restored via lastOpenedProject → the app
+ // boots straight into an editor window (no Navigator/consent detour).
+ const userDataDir = join(tmpHome, 'electron-userdata');
+ mkdirSync(userDataDir, { recursive: true });
+ writeFileSync(
+ join(userDataDir, 'state.json'),
+ JSON.stringify({
+ recentProjects: [
+ { path: projectDir, name: 'Report Bug Smoke', lastOpenedAt: new Date().toISOString() },
+ ],
+ lastOpenedProject: projectDir,
+ versionPendingInstall: null,
+ lastSeenVersion: null,
+ lastSuccessfulCheckAt: null,
+ stuckHintShown: false,
+ }),
+ );
+
+ const app = await electron.launch(
+ desktopLaunchOptions({
+ target: TARGET,
+ args: [`--user-data-dir=${userDataDir}`],
+ timeout: 30_000,
+ env: {
+ ...process.env,
+ ...homeEnv(tmpHome),
+ OK_DESKTOP_E2E_SMOKE: '1',
+ },
+ }),
+ );
+ captureStderrFor(app, { cleanupDirs: [tmpHome, projectDir] });
+
+ let editorPage: Page | undefined;
+ await expect(async () => {
+ for (const page of app.windows()) {
+ const mode = await page.evaluate(() => window.okDesktop?.config?.mode).catch(() => undefined);
+ if (mode === 'editor') {
+ editorPage = page;
+ return;
+ }
+ }
+ throw new Error('editor window not ready yet');
+ }).toPass({ timeout: 30_000 });
+ if (!editorPage) throw new Error('editor window vanished after readiness poll');
+ const page = editorPage;
+
+ // App-mounted gate: menu actions delivered before the renderer attaches
+ // its onMenuAction subscription are dropped, so wait for stable App UI
+ // (the sidebar toolbar) before driving the menu. Scoped to the toolbar
+ // because `name` matches a substring: the empty-state "or create a new
+ // file" button also carries "new file" in its accessible name.
+ await expect(
+ page.getByTestId('sidebar-toolbar').getByRole('button', { name: 'New file' }),
+ ).toBeVisible({ timeout: 30_000 });
+
+ return { app, page, tmpHome };
+}
+
+/**
+ * Fire the Help-menu leaf. This is the launcher-free entry: the click handler
+ * reaches `sendMenuAction` with no renderer sender, so the gate underneath
+ * captures on the first frame instead of waiting for open poppers to unmount.
+ */
+async function clickReportBugMenuItem(app: ElectronApplication): Promise<void> {
+ await app.evaluate(({ Menu }) => {
+ const appMenu = Menu.getApplicationMenu();
+ for (const top of appMenu?.items ?? []) {
+ const item = top.submenu?.items.find((candidate) => candidate.label === 'Report a bug…');
+ if (item) {
+ item.click();
+ return;
+ }
+ }
+ throw new Error('Report a bug… menu item not found in any submenu');
+ });
+}
+
+/**
+ * The captured picture as the renderer received it, or null when main
+ * returned none. `handleBugReportCaptureScreenshot` resolves null for a
+ * zero-byte capture, and the dialog then renders no screenshot section at
+ * all — which is how a host with no readable compositing surface reports
+ * itself. Callers turn that null into a skip rather than a failure.
+ */
+async function readScreenshotPreview(dialog: Locator): Promise<string | null> {
+ const img = dialog.getByRole('img', { name: 'Preview of the screenshot' });
+ if ((await img.count()) === 0) return null;
+ return await img.getAttribute('src');
+}
+
+/**
+ * A host that composites no readable surface hands `capturePage()` an empty
+ * image, so there are never any pixels to compare there. Skip rather than fail
+ * — and rather than quietly asserting something weaker under the same test
+ * name. Declared as an assertion so the narrowing the skip performs at runtime
+ * is visible to the type checker too.
+ *
+ * Whether the `desktop-smoke` runner is such a host is UNMEASURED. It is a real
+ * macOS VM rather than a headless container, so it may well composite — but
+ * nobody has read the skip count out of a run. Until someone does, treat this
+ * spec as proven on developer machines and UNKNOWN on CI, and do not read the
+ * required aggregate as covering the pixel claim. Verified locally on macOS
+ * with a display: menu open changes 4.767% of the preview against a 4.893%
+ * menu footprint, and a planted negative that dismisses the menu first changes
+ * 0.687% and reds.
+ */
+function skipWhenHostCannotCapture(preview: string | null): asserts preview is string {
+ test.skip(
+ preview === null,
+ 'This host composites no readable surface for capturePage(), so main returns an empty image and the dialog offers no screenshot — there are no pixels to compare.',
+ );
+}
+
test.describe('Report-a-bug entry points', () => {
test.skip(!SMOKE_ENABLED, 'Set OK_DESKTOP_E2E_SMOKE=1 to run Electron smoke tests.');
test.skip(!PLATFORM_SUPPORTED, PLATFORM_SKIP_REASON);
@@ -58,86 +208,18 @@ test.describe('Report-a-bug entry points', () => {
test('Help menu and palette open the dialog; create lands a zip shown in review', async ({
captureStderrFor,
}) => {
- // Isolated HOME: the create handler writes to `~/.ok/bug-reports/` via a
- // call-time homedir() lookup, so launching with HOME pointed at a tmpdir
- // keeps the real `~/.ok` untouched. Realpath per the consent-dialog
- // precedent (macOS tmpdir() is a symlink into /private/var/folders).
- const tmpHome = realpathSync(mkdtempSync(join(tmpdir(), 'ok-report-bug-home-')));
- const projectDir = realpathSync(mkdtempSync(join(tmpdir(), 'ok-report-bug-project-')));
- mkdirSync(join(projectDir, '.ok'), { recursive: true });
- writeFileSync(join(projectDir, '.ok', 'config.yml'), "content:\n dir: '.'\n");
- writeFileSync(join(projectDir, 'start.md'), '# Start\n\nSeed document.\n');
-
- // Already-consented project restored via lastOpenedProject → the app
- // boots straight into an editor window (no Navigator/consent detour).
- const userDataDir = join(tmpHome, 'electron-userdata');
- mkdirSync(userDataDir, { recursive: true });
- writeFileSync(
- join(userDataDir, 'state.json'),
- JSON.stringify({
- recentProjects: [
- { path: projectDir, name: 'Report Bug Smoke', lastOpenedAt: new Date().toISOString() },
- ],
- lastOpenedProject: projectDir,
- versionPendingInstall: null,
- lastSeenVersion: null,
- lastSuccessfulCheckAt: null,
- stuckHintShown: false,
- }),
- );
+ // Inside the body on purpose: the calibration parser reads
+ // `test.setTimeout` out of a test's own arrow-function body, so a
+ // describe-scope call is invisible to it and the guard silently falls back
+ // to the config's looser CI ceiling while Playwright runs the file under
+ // this one. `bootEditorWindow` also hides three sequential 30s waits
+ // (launch, window poll, toolbar visible) the parser does not trace, so the
+ // budget is declared rather than inferred.
+ test.setTimeout(140_000);
+ const { app, page, tmpHome } = await bootEditorWindow(captureStderrFor);
- const app = await electron.launch(
- desktopLaunchOptions({
- target: TARGET,
- args: [`--user-data-dir=${userDataDir}`],
- timeout: 30_000,
- env: {
- ...process.env,
- ...homeEnv(tmpHome),
- OK_DESKTOP_E2E_SMOKE: '1',
- },
- }),
- );
- captureStderrFor(app, { cleanupDirs: [tmpHome, projectDir] });
-
- let editorPage: Page | undefined;
- await expect(async () => {
- for (const page of app.windows()) {
- const mode = await page
- .evaluate(() => window.okDesktop?.config?.mode)
- .catch(() => undefined);
- if (mode === 'editor') {
- editorPage = page;
- return;
- }
- }
- throw new Error('editor window not ready yet');
- }).toPass({ timeout: 30_000 });
- if (!editorPage) throw new Error('editor window vanished after readiness poll');
- const page = editorPage;
-
- // App-mounted gate: menu actions delivered before the renderer attaches
- // its onMenuAction subscription are dropped, so wait for stable App UI
- // (the sidebar toolbar) before driving the menu. Scoped to the toolbar
- // because `name` matches a substring: the empty-state "or create a new
- // file" button also carries "new file" in its accessible name.
- await expect(
- page.getByTestId('sidebar-toolbar').getByRole('button', { name: 'New file' }),
- ).toBeVisible({ timeout: 30_000 });
-
- // Entry point 1 — Help menu. Label lookup walks every top-level submenu
- // rather than assuming the Help menu's resolved label/role shape.
- await app.evaluate(({ Menu }) => {
- const appMenu = Menu.getApplicationMenu();
- for (const top of appMenu?.items ?? []) {
- const item = top.submenu?.items.find((candidate) => candidate.label === 'Report a bug…');
- if (item) {
- item.click();
- return;
- }
- }
- throw new Error('Report a bug… menu item not found in any submenu');
- });
+ // Entry point 1 — Help menu.
+ await clickReportBugMenuItem(app);
const composeDialog = page.getByRole('dialog', { name: 'Report a bug' });
await expect(composeDialog).toBeVisible({ timeout: 10_000 });
await page.keyboard.press('Escape');
@@ -152,14 +234,12 @@ test.describe('Report-a-bug entry points', () => {
await paletteRow.click();
await expect(composeDialog).toBeVisible({ timeout: 10_000 });
- // The include-a-screenshot option is deliberately NOT asserted here:
- // `webContents.capturePage()` returns an empty image on the headless CI
- // runner (the window is never composited to a readable surface), so the
- // gate offers no screenshot and the checkbox/preview never appear. That
- // path is covered where it can run deterministically — the bun unit tier
- // (byte-identical staging at `extra/screenshot.png`) and the app DOM tier
- // (preview, default-on checkbox, opt-out, launcher-wait) — with mocked
- // capture. This smoke test stays scoped to the entry points + bundle flow.
+ // The include-a-screenshot option is deliberately NOT asserted here: this
+ // is the palette path, which holds the capture until the launcher unmounts,
+ // and a host whose `capturePage()` returns an empty image offers no
+ // screenshot at all. The spec below owns that surface and carries the skip
+ // for hosts that cannot composite; this one stays scoped to the entry
+ // points + bundle flow.
// Compose → create. The note rides into the bundle; typing it here
// exercises the same field the crash variants relabel.
@@ -186,4 +266,96 @@ test.describe('Report-a-bug entry points', () => {
expect(statSync(zipPath).size).toBeGreaterThan(0);
await expect(reviewDialog.getByTitle(zipName)).toBeVisible();
});
+
+ test('a report filed with a context menu open captures the menu', async ({
+ captureStderrFor,
+ }) => {
+ // Same budget, same reason as the spec above — declared in the body so the
+ // calibration guard scores this test against what it actually runs under.
+ test.setTimeout(140_000);
+ const { app, page } = await bootEditorWindow(captureStderrFor);
+
+ const composeDialog = page.getByRole('dialog', { name: 'Report a bug' });
+
+ // Park the pointer on the row both passes use and never move it again.
+ // The gate draws a marker at the last known pointer position, so a fixed
+ // pointer makes that marker identical in the two captures and leaves the
+ // menu as the difference between them.
+ const row = page.getByRole('treeitem', { name: /start\.md/ });
+ await expect(row).toBeVisible({ timeout: 15_000 });
+ const rowBox = await row.boundingBox();
+ if (!rowBox) throw new Error('start.md tree row reported no bounding box');
+ const pointerX = rowBox.x + rowBox.width / 2;
+ const pointerY = rowBox.y + rowBox.height / 2;
+ await page.mouse.move(pointerX, pointerY);
+
+ // Control pass — nothing open but the app itself.
+ await clickReportBugMenuItem(app);
+ await expect(composeDialog).toBeVisible({ timeout: 10_000 });
+ const withoutMenu = await readScreenshotPreview(composeDialog);
+ await page.keyboard.press('Escape');
+ await expect(composeDialog).not.toBeVisible();
+
+ skipWhenHostCannotCapture(withoutMenu);
+
+ // Second pass — same window, same pointer, context menu open. A native
+ // menu click steals no focus from the renderer and dispatches no pointer
+ // event, so the menu is still mounted when the gate shoots.
+ await page.mouse.click(pointerX, pointerY, { button: 'right' });
+ const contextMenu = page
+ .getByRole('menu')
+ .filter({ has: page.getByRole('menuitem', { name: /rename/i }) });
+ await expect(contextMenu).toBeVisible({ timeout: 10_000 });
+ const menuBox = await contextMenu.boundingBox();
+ if (!menuBox) throw new Error('context menu reported no bounding box');
+
+ await clickReportBugMenuItem(app);
+ await expect(composeDialog).toBeVisible({ timeout: 10_000 });
+ const withMenu = await readScreenshotPreview(composeDialog);
+ // Not a skip: the control pass already proved this host captures, so a
+ // second pass that captures nothing is a regression, not an unsupported
+ // host. The throw narrows the type as well.
+ if (withMenu === null) throw new Error('the second pass captured nothing while the first did');
+ expect(withMenu).not.toEqual(withoutMenu);
+
+ // Decode in main, where `nativeImage` lives. Comparing decoded pixels
+ // rather than the encoded PNGs is what makes "non-trivial" mean anything:
+ // PNG is compressed, so a single changed pixel already rewrites most of
+ // the byte stream and any byte-level difference count would read huge.
+ const diff = await app.evaluate(
+ ({ nativeImage }, images) => {
+ const a = nativeImage.createFromDataURL(images.a).toBitmap();
+ const b = nativeImage.createFromDataURL(images.b).toBitmap();
+ if (a.length !== b.length || a.length === 0) {
+ return { comparable: false, changedPixels: 0, totalPixels: 0 };
+ }
+ let changedPixels = 0;
+ for (let i = 0; i < a.length; i += 4) {
+ if (a[i] !== b[i] || a[i + 1] !== b[i + 1] || a[i + 2] !== b[i + 2]) changedPixels += 1;
+ }
+ return { comparable: true, changedPixels, totalPixels: a.length / 4 };
+ },
+ { a: withoutMenu, b: withMenu },
+ );
+ expect(diff.comparable, 'the two previews did not decode to comparable bitmaps').toBe(true);
+
+ // Floor derived from the menu's own measured footprint rather than picked:
+ // the preview is a downscale of the whole viewport, so the menu covers the
+ // same FRACTION of it that it covers of the window. A quarter of that
+ // fraction separates the two regimes with margin on both sides — a run
+ // with the menu dismissed just before the shot lands under the floor
+ // (ambient repaint is the row's own hover/selection state and the caret),
+ // while a run with it open changes nearly the menu's whole footprint.
+ const viewport = await page.evaluate(() => ({
+ width: window.innerWidth,
+ height: window.innerHeight,
+ }));
+ const menuFraction = (menuBox.width * menuBox.height) / (viewport.width * viewport.height);
+ const changedFraction = diff.changedPixels / diff.totalPixels;
+ expect(
+ changedFraction,
+ `changed ${(changedFraction * 100).toFixed(3)}% of the preview; the menu covers ` +
+ `${(menuFraction * 100).toFixed(3)}% of the viewport`,
+ ).toBeGreaterThan(menuFraction * 0.25);
+ });
});