Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): keep the document pane in the rail at all times (PRD-8042) (#3589)

sarah7d29f3f8dc55
diff --git a/.changeset/agent-panel-zero-width-new-tab.md b/.changeset/agent-panel-zero-width-new-tab.md
new file mode 100644
index 000000000..377a7418c
--- /dev/null
+++ b/.changeset/agent-panel-zero-width-new-tab.md
@@ -0,0 +1,7 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Opening a new tab with the agent panel up no longer leaves the panel stuck at zero width. The panel looked like it had closed, but the app still considered it open, so the edge tab that reopens it stayed hidden and the chat could not be brought back without a reload. The editor's row of side columns remembers a set of widths for each combination of columns on screen, and a new tab took the document side pane out of that combination, which swapped in the widths that arrangement last had. Those were usually from a session with the agent panel closed. The document side pane now stays in the row at all times, empty and zero width on views that have nothing to put in it, so the combination never changes and no swap happens on any view.
+
+The agent activity view opened from a folder now shares that same pane rather than a second one of its own. It picks up the pane's width and can be dragged closed, where before it could only be dismissed by clicking the agent's avatar again.
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/EditorArea.dom.test.tsx b/packages/app/src/components/EditorArea.dom.test.tsx
index 2e4e0e456..70d1f5bfe 100644
--- a/packages/app/src/components/EditorArea.dom.test.tsx
+++ b/packages/app/src/components/EditorArea.dom.test.tsx
@@ -83,6 +83,13 @@ const ASSET_DOC_CTX = {
// branch, so a later provider-null render counts as a mid-session navigation
// rather than a cold start.
const FOLDER_LIVE_CTX = { ...FOLDER_DOC_CTX, activeProvider: {} as never };
+// A folder view drilled into an agent's activity — the case that used to render
+// its own `agent-panel` and now fills the shared document slot.
+const FOLDER_AGENT_CTX = {
+ ...FOLDER_DOC_CTX,
+ docPanelMode: 'agent',
+ docPanelAgentId: 'conn-1',
+};
const DOC_LIVE_CTX = {
...FOLDER_LIVE_CTX,
activeDocName: 'docs/notes',
@@ -104,6 +111,7 @@ const DOC_COLD_CTX = {
let docCtx:
| typeof FOLDER_DOC_CTX
| typeof FOLDER_LIVE_CTX
+ | typeof FOLDER_AGENT_CTX
| typeof DOC_LIVE_CTX
| typeof EMPTY_DOC_CTX
| typeof LARGE_FILE_DOC_CTX
@@ -284,6 +292,15 @@ vi.doMock('./BottomComposer', () => ({
),
}));
+// The agent-activity view reaches for PageList/workspace context this layout
+// harness does not stand up. It is lazy, so before an `await act()` anywhere in
+// the file it stayed suspended and never rendered; once resolved it renders
+// synchronously in every later test. Stub it for the same reason the other heavy
+// children here are stubbed — these tests are about the rail, not its contents.
+vi.doMock('@/components/ActivityModeContent', () => ({
+ ActivityModeContent: () => <div data-testid="activity-mode-content" />,
+}));
+
vi.doMock('@/components/AssetPreview', () => ({
AssetPreview: ({ assetPath }: { assetPath: string }) => (
<div data-testid="asset-preview">{assetPath}</div>
@@ -473,6 +490,10 @@ describe('EditorArea right-rail layout assert on column mount/unmount', () => {
toastInfoMessages = [];
});
+ /** Rail panel ids currently in the group, in render order. */
+ const renderedPanelIds = () =>
+ [...screen.getByTestId('resizable-group').children].map((el) => el.id).filter(Boolean);
+
test('moving the terminal right at a narrow width closes agents without moving focus', async () => {
setViewportWidth(650);
mockGroupPx = 650;
@@ -729,8 +750,11 @@ describe('EditorArea right-rail layout assert on column mount/unmount', () => {
test('hiding the agents panel re-asserts the collapsed doc panel over the stale panel-set restore', async () => {
// Below 1280px the doc panel starts collapsed (no pin), so the intended
// post-hide state is "collapsed" even though the cached two-panel layout
- // (mimicked) says expanded.
+ // (mimicked) says expanded. Needs a live document: the slot is a permanent
+ // member on every view, so only a view that HAS a document pane exercises
+ // the collapsed-vs-open intent rather than the empty-slot pin.
setViewportWidth(1024);
+ docCtx = DOC_LIVE_CTX;
const view = render(<EditorArea {...baseProps} agentsVisible />);
expect(groupSetLayoutCalls).toHaveLength(0);
// The stale two-panel layout the library restores on unmount: doc panel
@@ -750,6 +774,7 @@ describe('EditorArea right-rail layout assert on column mount/unmount', () => {
// could say anything; the assert must restore the pre-reveal state (open)
// at the persisted width, with the agents column at its own persisted width.
setViewportWidth(1400);
+ docCtx = DOC_LIVE_CTX;
const view = render(<EditorArea {...baseProps} agentsVisible={false} />);
groupLayout = { 'editor-main': 45, 'doc-panel': 25, 'agents-column': 30 };
view.rerender(<EditorArea {...baseProps} agentsVisible />);
@@ -764,6 +789,168 @@ describe('EditorArea right-rail layout assert on column mount/unmount', () => {
expect(corrected?.['editor-main']).toBeCloseTo(100 - pctOf(320) - pctOf(480), 3);
});
+ // react-resizable-panels caches one layout per panel-ID set and
+ // restores it whenever the set changes, so any rail member that mounted and
+ // unmounted would drag the whole rail back to the widths its absence was last
+ // paired with — which stranded the agents column at zero width while the app
+ // still believed it was open. These pin the fix at its root: the set never
+ // changes, whatever the view.
+ test('the rail keeps one panel-ID set from a document to a new tab', () => {
+ setViewportWidth(1400);
+ docCtx = DOC_LIVE_CTX;
+ const view = render(<EditorArea {...baseProps} agentsVisible />);
+ const withDocument = renderedPanelIds();
+ expect(withDocument).toEqual(['doc-panel', 'terminal-column', 'agents-column']);
+
+ docCtx = EMPTY_DOC_CTX;
+ view.rerender(<EditorArea {...baseProps} agentsVisible />);
+
+ expect(renderedPanelIds()).toEqual(withDocument);
+ // Present, but holding nothing — a zero-width member, not an absent one.
+ expect(document.getElementById('doc-panel')?.childElementCount).toBe(0);
+ });
+
+ test('the rail keeps one panel-ID set across every view kind', () => {
+ setViewportWidth(1400);
+ const expected = ['doc-panel', 'terminal-column', 'agents-column'];
+ for (const ctx of [
+ DOC_LIVE_CTX,
+ EMPTY_DOC_CTX,
+ FOLDER_DOC_CTX,
+ FOLDER_AGENT_CTX,
+ ASSET_DOC_CTX,
+ LARGE_FILE_DOC_CTX,
+ ]) {
+ cleanup();
+ docCtx = ctx;
+ render(<EditorArea {...baseProps} agentsVisible />);
+ expect(renderedPanelIds()).toEqual(expected);
+ }
+ });
+
+ test('an empty slot is clamped out of flex flow, like every hidden rail column', () => {
+ // A permanent member that holds nothing must not be able to take a flex
+ // share, or it paints a gap the editor should own. RRP applies
+ // `Math.min(maxSize, size)` last, so `maxSize: 0px` is what enforces it —
+ // the handle's `display: none` covers the separator's own width.
+ setViewportWidth(1400);
+ docCtx = ASSET_DOC_CTX;
+ const view = render(<EditorArea {...baseProps} agentsVisible />);
+ expect(document.getElementById('doc-panel')?.dataset.maxSize).toBe('0px');
+
+ // Filled again, the ceiling goes back to the pane's real drag limit.
+ docCtx = DOC_LIVE_CTX;
+ view.rerender(<EditorArea {...baseProps} agentsVisible />);
+ expect(document.getElementById('doc-panel')?.dataset.maxSize).toBe('600px');
+ });
+
+ test('the mid-session load gap keeps the panel-ID set and fills the slot', () => {
+ // The load-gap branch is the one that replaced the deleted placeholder
+ // panel, so it is the single most important view to pin — and it is not
+ // reachable by fixture alone. It needs a hash naming the incoming doc AND a
+ // latched `everHadProvider`, so render a live provider first and re-render
+ // (no cleanup) to keep the same component instance and its latch.
+ setViewportWidth(1400);
+ docCtx = FOLDER_LIVE_CTX;
+ const view = render(<EditorArea {...baseProps} agentsVisible />);
+ window.location.hash = '#/incoming-doc';
+ docCtx = DOC_COLD_CTX;
+ view.rerender(<EditorArea {...baseProps} agentsVisible />);
+
+ // Guard the fixture itself: without the skeleton this test would silently
+ // re-cover the empty state, which is what it did before.
+ expect(screen.getByTestId('editor-skeleton')).toBeTruthy();
+ expect(renderedPanelIds()).toEqual(['doc-panel', 'terminal-column', 'agents-column']);
+ // Filled with the visual-only filler, so the slot holds its width across the
+ // gap rather than collapsing and reopening when the doc lands.
+ expect(document.getElementById('doc-panel')?.childElementCount).toBe(1);
+ window.location.hash = '';
+ });
+
+ test('emptying the slot hands its width to the editor; refilling takes it back', async () => {
+ // No visibility flag moves on a view switch, so the flag-keyed sync sits it
+ // out. Without its own re-pin the emptied pane keeps the width the document
+ // view left behind.
+ setViewportWidth(1400);
+ docCtx = DOC_LIVE_CTX;
+ const view = render(<EditorArea {...baseProps} />);
+ groupLayout = {
+ 'editor-main': 60,
+ 'doc-panel': 40,
+ 'terminal-column': 0,
+ 'agents-column': 0,
+ };
+ groupSetLayoutCalls = [];
+
+ docCtx = ASSET_DOC_CTX;
+ view.rerender(<EditorArea {...baseProps} />);
+ await act(async () => {});
+ const emptied = groupSetLayoutCalls.at(-1);
+ expect(emptied?.['doc-panel']).toBe(0);
+ expect(emptied?.['editor-main']).toBe(100);
+
+ groupLayout = { ...groupLayout, 'editor-main': 100, 'doc-panel': 0 };
+ docCtx = DOC_LIVE_CTX;
+ view.rerender(<EditorArea {...baseProps} />);
+ await act(async () => {});
+ const refilled = groupSetLayoutCalls.at(-1);
+ expect(refilled?.['doc-panel']).toBeCloseTo(pctOf(320), 3);
+ expect(refilled?.['editor-main']).toBeCloseTo(100 - pctOf(320), 3);
+ });
+
+ test('folder-view agent activity fills the shared slot, not a panel of its own', () => {
+ setViewportWidth(1400);
+ docCtx = FOLDER_AGENT_CTX;
+ render(<EditorArea {...baseProps} />);
+
+ expect(document.getElementById('agent-panel')).toBeNull();
+ expect(document.getElementById('doc-panel')?.childElementCount).toBe(1);
+ });
+
+ test('a folder-view avatar click opens the slot even when the pane was collapsed', async () => {
+ // The merged slot answers to `isCollapsed`, which the separate agent panel
+ // never did. `openActivityPanel` bumps the expand signal on every path into
+ // agent mode, so the drill-in still opens against a collapsed pane — if it
+ // did not, clicking an avatar would silently do nothing.
+ setViewportWidth(1024); // below the threshold: the pane starts collapsed
+ docCtx = FOLDER_DOC_CTX;
+ const view = render(<EditorArea {...baseProps} />);
+ groupLayout = {
+ 'editor-main': 100,
+ 'doc-panel': 0,
+ 'terminal-column': 0,
+ 'agents-column': 0,
+ };
+ groupSetLayoutCalls = [];
+
+ docCtx = { ...FOLDER_AGENT_CTX, docPanelExpandSignal: 1 };
+ view.rerender(<EditorArea {...baseProps} />);
+ await act(async () => {});
+
+ const opened = groupSetLayoutCalls.at(-1);
+ expect(opened?.['doc-panel']).toBeCloseTo(pctOf(320), 3);
+ });
+
+ test('a view with no document pane pins the slot shut and ignores the toggle', async () => {
+ // The slot is a permanent member everywhere, so the chord must key off
+ // whether this view HAS a document pane — not off the panel existing.
+ setViewportWidth(1400);
+ docCtx = ASSET_DOC_CTX;
+ render(<EditorArea {...baseProps} agentsVisible />);
+ groupSetLayoutCalls = [];
+ groupLayout = {
+ 'editor-main': 45,
+ 'doc-panel': 25,
+ 'terminal-column': 0,
+ 'agents-column': 30,
+ };
+
+ act(() => emitLocalMenuAction('toggle-doc-panel'));
+ await act(async () => {});
+
+ expect(groupSetLayoutCalls).toHaveLength(0);
+ });
+
test('releasing an agents-handle drag with the column snapped shut hides the panel', async () => {
// Drag-to-close: the pointerup handler checks the agents panel's
// isCollapsed() and turns a snapped-shut column into a real hide.
@@ -1214,10 +1401,9 @@ describe('EditorArea terminal persists across view-kind switches', () => {
// Locks the fix for the COLD-START path: on first load (no provider has
// ever been active), a hash-driven doc load renders the skeleton as a standalone
-// early-return, NOT inside the shared panel group. Routing it through the group
-// renders one panel and then adds the doc panel when the doc lands — a 1→3
-// panel-count transition that corrupts react-resizable-panels' doc-panel
-// sticky-width restore. (The e2e qa-sidebar also covers this; this is the
+// early-return, NOT inside the shared panel group. There is no group state to
+// preserve and nothing docked to keep alive on this path, so mounting a group to
+// hold a skeleton buys nothing. (The e2e qa-sidebar also covers this; this is the
// fast guard.) The MID-SESSION counterpart — where the dock must persist — is
// the next describe block.
describe('EditorArea hash-load skeleton renders outside the panel group (cold start)', () => {
@@ -1307,9 +1493,8 @@ describe('EditorArea terminal persists across a mid-session cold navigation', ()
expect(terminalDockMounts).toBe(mountsAfterInitial);
// Mid-session skeleton routes THROUGH the shared group (not a bare
// early-return) — the symmetric guard to the cold-start group-absent
- // assertion. Pins that the placeholder holds the panel count inside the
- // group, so a future refactor that lifts the dock outside the group can't
- // silently revert the 1→3 invariant while keeping the dock mounted.
+ // assertion. Pins that the docked terminal's PTY survives the load gap: a
+ // refactor that lifted the dock outside the group would unmount it here.
expect(screen.getByTestId('resizable-group')).toBeTruthy();
});
diff --git a/packages/app/src/components/EditorArea.tsx b/packages/app/src/components/EditorArea.tsx
index 1ee9c2e3a..9067847e7 100644
--- a/packages/app/src/components/EditorArea.tsx
+++ b/packages/app/src/components/EditorArea.tsx
@@ -98,7 +98,6 @@ import {
} from './EditorWorkspace';
import { shouldPaintOverlay } from './editor-area-overlay';
import {
- AGENT_PANEL_ID,
AGENTS_COLUMN_ID,
accountRailLayout,
DOC_PANEL_ID,
@@ -234,9 +233,8 @@ const LazyAgentDiffPane = lazy(async () => {
return { default: mod.AgentDiffPane };
});
-// Shared doc-panel sizing — referenced by both the live doc panel and the
-// hash-load placeholder that mirrors it, so the two stay structurally linked and
-// their min/max can't drift apart.
+// Sizing for the permanent document slot. Its content varies by view; these
+// bounds do not.
const DOC_PANEL_MIN_WIDTH_PX = 300;
const DOC_PANEL_MIN_SIZE = `${DOC_PANEL_MIN_WIDTH_PX}px`;
const DOC_PANEL_MAX_SIZE = '600px';
@@ -285,7 +283,7 @@ interface EditorAreaProps {
onTerminalVisibleChange?: (visible: boolean) => void;
onTerminalRightWidthChange?: (width: number) => void;
/** Agents-panel visibility. Its own resizable column to the right of the
- * doc/agent panel. Independent of the terminal. */
+ * document side pane. Independent of the terminal. */
agentsVisible?: boolean;
onAgentsVisibleChange?: (visible: boolean) => void;
/** Report both panels' attach points to the session hosts owned by EditorPane. */
@@ -618,10 +616,6 @@ function EditorAreaInner({
RIGHT_TERMINAL_PANEL_MIN_WIDTH_PX,
),
);
- const terminalDefaultWidthPx = Math.max(
- terminalRightWidth ?? initialTerminalWidthPx,
- RIGHT_TERMINAL_PANEL_MIN_WIDTH_PX,
- );
const terminalWidthPxRef = useRef(initialTerminalWidthPx);
const [isDraggingTerminalHandle, setIsDraggingTerminalHandle] = useState(false);
const isDraggingTerminalHandleRef = useRef(false);
@@ -673,6 +667,17 @@ function EditorAreaInner({
return () => observer.disconnect();
}, [workspaceHeaderContainer, workspaceColumnEl]);
+ // Whether the active view has a right document pane at all. The slot itself is
+ // a permanent rail member; this is whether it has anything to show. Written by
+ // an effect declared after the branch chain that decides it (see the note
+ // there); declared up here because the rail functions below read it, and the
+ // compiler rejects a reference that sits above its declaration.
+ const docSlotPresentRef = useRef(false);
+ // Pending-frame handle for the presence re-pin's bounded retry (declared with
+ // the presence ref for the same declaration-order reason; the retry itself
+ // lives in the presence effect below).
+ const presenceRepinFrameRef = useRef(0);
+
// Group-level imperative handle. Layout corrections MUST go through
// `setLayout` (the whole layout in one shot): the per-panel imperative APIs
// (`resize`/`collapse`/`expand`) always exchange space with the panel's flex
@@ -709,9 +714,9 @@ function EditorAreaInner({
try {
const workspaceWidthPx = resolveGroupPxWidth();
if (workspaceWidthPx == null) return null;
- const layout = group.getLayout();
- const otherRailPresent = DOC_PANEL_ID in layout || AGENT_PANEL_ID in layout;
- if (!otherRailPresent) {
+ // The slot is in every layout now, so membership says nothing about
+ // whether this view HAS a document pane — read the content predicate.
+ if (!docSlotPresentRef.current) {
return { workspaceWidthPx, otherRailWidthPx: 0 };
}
// A collapsed document pane still counts, at its floor. It measures zero
@@ -857,11 +862,12 @@ function EditorAreaInner({
const buildPins = (atFloor: boolean): Record<string, number> => {
const pins: Record<string, number> = {};
if (DOC_PANEL_ID in layout) {
- pins[DOC_PANEL_ID] = docCollapsed
- ? 0
- : atFloor
- ? DOC_PANEL_MIN_WIDTH_PX
- : docPanelWidthPxRef.current;
+ pins[DOC_PANEL_ID] =
+ !docSlotPresentRef.current || docCollapsed
+ ? 0
+ : atFloor
+ ? DOC_PANEL_MIN_WIDTH_PX
+ : docPanelWidthPxRef.current;
}
if (TERMINAL_COLUMN_ID in layout) {
pins[TERMINAL_COLUMN_ID] = !admissionVisibilityRef.current.terminalRightVisible
@@ -880,13 +886,13 @@ function EditorAreaInner({
return pins;
};
- const pinnedPx = buildPins(false);
- if (Object.keys(pinnedPx).length === 0) return false;
+ let pins = buildPins(false);
+ if (Object.keys(pins).length === 0) return false;
let next = computeStickyRepinLayout({
currentLayout: layout,
containerPx,
- pinnedPx,
+ pinnedPx: pins,
residualId,
});
// The preferred widths did not fit. Retry with every open column at its
@@ -894,10 +900,11 @@ function EditorAreaInner({
// opened a column the app believes is visible at zero width, with a live
// handle that can move nothing.
if (next === layout) {
+ pins = buildPins(true);
next = computeStickyRepinLayout({
currentLayout: layout,
containerPx,
- pinnedPx: buildPins(true),
+ pinnedPx: pins,
residualId,
});
}
@@ -908,6 +915,29 @@ function EditorAreaInner({
reportUnexpectedPanelGroupFailure('apply-rail-layout-write-failed', error);
return false;
}
+ // `setLayout` validates against the store's derived panel constraints, and
+ // those refresh only when the GROUP next re-renders after a Panel
+ // re-registers — a constraint prop that changed in this very commit
+ // (`maxSize` flipping off its '0px' clamp, `defaultSize` moving) is not
+ // visible to a write issued from this commit's layout effects. The library
+ // then clamps the write against the stale constraints and reports nothing:
+ // the call "succeeds" while the rail keeps its old widths. Read the layout
+ // back and compare each pinned column so callers with a retry loop can see
+ // the rejection and re-apply once the group has settled. The 1px tolerance
+ // absorbs basis drift between our px→% conversion and the library's own
+ // group-size basis.
+ let readBack: Record<string, number>;
+ try {
+ readBack = group.getLayout();
+ } catch (error) {
+ reportUnexpectedPanelGroupFailure('apply-rail-layout-verify-failed', error);
+ return false;
+ }
+ for (const [id, px] of Object.entries(pins)) {
+ const pct = readBack[id];
+ if (pct == null) continue;
+ if (Math.abs((pct / 100) * containerPx - px) > 1) return false;
+ }
return true;
}
@@ -955,19 +985,23 @@ function EditorAreaInner({
});
}
- function assertRightRailLayout(docCollapsed: boolean) {
+ // Returns whether the rail verifiably holds the asserted layout — false when
+ // the write was rejected (see the read-back check in `applyRailLayout`) so
+ // callers with a retry loop can re-apply. A live drag returns true: the drag
+ // owns the layout and retrying against it would fight the pointer.
+ function assertRightRailLayout(docCollapsed: boolean): boolean {
if (
isDraggingDocHandleRef.current ||
isDraggingTerminalHandleRef.current ||
isDraggingAgentsHandleRef.current
)
- return;
+ return true;
// Record the intent before applying it. The write changes panel widths,
// which fires the ResizeObserver below synchronously — and that re-asserts
// from this ref, which React's own state effect has not caught up to yet.
// Without this the correction would immediately undo itself.
isCollapsedRef.current = docCollapsed;
- applyRailLayout(docCollapsed);
+ return applyRailLayout(docCollapsed);
}
// Latest-ref mirror of the assert for effects that must NOT re-run on render
@@ -1081,20 +1115,22 @@ function EditorAreaInner({
}, [terminalColumnPresent, agentsColumnPresent]);
// Expand the doc panel from a non-toggle path (tab request, avatar click,
- // width-threshold crossing). The terminal and agents columns are permanent
- // group members even while hidden at zero width, so the panel API would try
- // to trade with a zero-width neighbor and silently do nothing. Route every
- // transition through the full-group layout instead.
+ // width-threshold crossing). Every rail column is a permanent group member
+ // even while hidden at zero width, so the panel API would try to trade with a
+ // zero-width neighbor and silently do nothing. Route every transition through
+ // the full-group layout instead.
function expandDocPanel() {
- if (panelRef.current == null) return;
+ if (!docSlotPresentRef.current) return;
assertRightRailLayout(false);
}
function togglePanel() {
- // Folder / asset views render a different tree with no doc panel, so
- // panelRef is unbound there. Bail before applyToggle so the global ⌥⌘B
- // handler doesn't write a spurious 'right' pin for a panel that can't move.
- if (panelRef.current == null) return;
+ // Asset / skill / empty views have nothing to put in the slot, and the slot
+ // is a permanent member whether or not they do — so presence, not the ref,
+ // is what says the toggle has something to move. Bail before applyToggle so
+ // the global ⌥⌘B handler doesn't write a spurious 'right' pin, and so the
+ // chord can't open an empty pane on a view that has no document.
+ if (!docSlotPresentRef.current) return;
// Read partition from the ref (live value) — `rightPartition` captured by
// the closure at render time goes stale if the user crosses the 1280px
// threshold and immediately invokes the toggle before React commits the
@@ -1197,28 +1233,6 @@ function EditorAreaInner({
expandDocPanel,
]);
- // react-resizable-panels caches layouts keyed by the panel-ID set and
- // restores the cached layout whenever the set changes — so mounting or
- // unmounting the agents column would resurrect whatever doc-panel state the
- // OTHER panel set last saw (e.g. hiding the panel re-opened a doc panel
- // the user had closed while it was up). Re-assert the intended layout on
- // every panel-set change: the doc panel keeps its pre-change collapsed state,
- // both rail widths stay pinned, and the editor absorbs the difference. The
- // library's restore runs synchronously in the re-registration render that a
- // panel-set change triggers, so the correction is deferred one microtask to
- // land after it (still ahead of paint — `setLayout` notifies the panels'
- // external stores synchronously).
- const panelSetKey = `${terminalColumnPresent}:${agentsColumnPresent}`;
- const previousPanelSetKeyRef = useRef(panelSetKey);
- useLayoutEffect(() => {
- if (previousPanelSetKeyRef.current === panelSetKey) return;
- previousPanelSetKeyRef.current = panelSetKey;
- const docCollapsed = isCollapsed;
- queueMicrotask(() => {
- assertRightRailLayoutRef.current(docCollapsed);
- });
- }, [panelSetKey, isCollapsed]);
-
useLayoutEffect(() => {
if (!isCollapsed) return;
const panelEl = document.getElementById(DOC_PANEL_ID);
@@ -1312,19 +1326,30 @@ function EditorAreaInner({
}
}
- // Resolve the active view's content (the left/primary column) and any
- // right-side panel (doc panel for docs, agent panel for a folder + agent
- // view). The docked terminal lives in the left column BELOW `viewContent`, so
- // it sits beside the right panel rather than spanning under it, and stays at
- // one stable React position across view kinds so the PTY survives tab switches
- // and view-kind changes.
+ // Resolve the active view's content (the left/primary column) and what goes in
+ // the right document slot (the document side pane, or agent activity on a
+ // folder view). The docked terminal lives in the left column BELOW
+ // `viewContent`, so it sits beside the slot rather than spanning under it, and
+ // stays at one stable React position across view kinds so the PTY survives tab
+ // switches and view-kind changes.
+ //
+ // Branches choose the slot's CONTENT, never whether the slot exists: the panel
+ // is rendered once at the group level below and is a permanent member of the
+ // rail (see RIGHT_RAIL_PANEL_ORDER). Null content means a zero-width slot, not
+ // an absent one. A branch that unmounted it would change the group's id set,
+ // and react-resizable-panels would answer by restoring the widths that set was
+ // last paired with — which is how the agents column ended up stranded at zero
+ // width, open as far as the app knew, with no way to reopen it.
let viewContent: ReactNode;
- let rightPanel: ReactNode = null;
+ let docSlotContent: ReactNode = null;
let renderFocusedDocument: ((activityMount: ReactNode) => ReactNode) | null = null;
+ // Cold start with no group to preserve: render the bare skeleton and nothing
+ // else. Set here, acted on at the single exit below.
+ let coldStartSkeleton = false;
- // The agents column (when visible) is rendered once at the
- // panel-group level below, to the right of `rightPanel`, so the branches here
- // only resolve the view content and its own doc/agent panel.
+ // The terminal and agents columns are rendered once at the panel-group level
+ // below, to the right of the slot, so the branches here only resolve the view
+ // content and the slot's content.
if (activeTarget?.kind === 'large-file') {
viewContent = (
<LargeFileEditorState
@@ -1367,34 +1392,27 @@ function EditorAreaInner({
{showFolderComposer ? <BottomComposer folderPath={activeTarget.folderPath} /> : null}
</div>
);
- const showAgentPanel = docPanelMode === 'agent' && docPanelAgentId !== null;
- if (showAgentPanel) {
- rightPanel = (
- <>
- <ResizableHandle withHandle />
- {/* Non-collapsible — folder view has no toolbar toggle; dismiss via avatar re-click. */}
- <ResizablePanel
- id={AGENT_PANEL_ID}
- defaultSize="25%"
- minSize="300px"
- maxSize="40%"
- className="flex flex-col bg-muted/20"
- >
- <Suspense
- fallback={
- <div
- role="status"
- aria-busy="true"
- className="flex h-full items-center justify-center text-sm text-muted-foreground"
- >
- <Trans>Loading agent activity</Trans>
- </div>
- }
+ // A folder has no document side pane, but an agent avatar click still drills
+ // into that agent's activity — the same view `DocPanel` shows in agent mode,
+ // so it fills the same slot rather than a panel of its own. Dismissal is the
+ // avatar re-click (`closeActivityPanel`), which empties the slot; the slot's
+ // own drag-to-close works here too, unlike the separate panel this replaced.
+ const showAgentActivity = docPanelMode === 'agent' && docPanelAgentId !== null;
+ if (showAgentActivity) {
+ docSlotContent = (
+ <Suspense
+ fallback={
+ <div
+ role="status"
+ aria-busy="true"
+ className="flex h-full items-center justify-center text-sm text-muted-foreground"
>
- <LazyActivityModeContent showBackButton={false} />
- </Suspense>
- </ResizablePanel>
- </>
+ <Trans>Loading agent activity</Trans>
+ </div>
+ }
+ >
+ <LazyActivityModeContent showBackButton={false} />
+ </Suspense>
);
}
} else if (
@@ -1484,48 +1502,28 @@ function EditorAreaInner({
// already names the next doc. Render the load skeleton THROUGH the shared
// group (not a bare early return) so the persistent left column, and the
// docked TerminalDock + its live PTY inside it, stay mounted across the
- // gap instead of unmounting and resetting the terminal. The doc-panel
- // sibling holds the panel count at 3 (we only reach this branch in doc
- // context; folder/asset/large-file are handled above), so the
- // sticky-width restore is not corrupted by a 1→3 transition.
+ // gap instead of unmounting and resetting the terminal.
viewContent = <EditorSkeleton />;
- // A ref-free placeholder that mirrors the doc-panel's id + sizing so
- // react-resizable-panels treats it as the same doc-panel element
- // across skeleton → doc and preserves its pixel width. It carries no
- // panelRef/onResize/drag handlers — those read refs and the load window
- // is brief and non-interactive — which also keeps this off the React
- // Compiler's "ref passed to a render-time function" path.
- rightPanel = (
- <>
- <ResizableHandle withHandle disabled />
- <ResizablePanel
- id={DOC_PANEL_ID}
- defaultSize={initialRightCollapsed ? 0 : `${initialDocPanelWidthPx}px`}
- minSize={DOC_PANEL_MIN_SIZE}
- maxSize={DOC_PANEL_MAX_SIZE}
- collapsible
- collapsedSize={0}
- inert
- className="flex flex-col bg-muted/20"
- >
- {/* Visual-only filler. `inert` removes this subtree from the a11y
- tree + focus order, so a live-region role/aria-busy here would
- be dead ARIA — the skeleton in the left column is the announced
- loading state. Mirrors the real doc-panel (no ARIA on children
- under its own `inert`). */}
- <div className="min-h-0 flex-1" />
- </ResizablePanel>
- </>
- );
+ // Visual-only filler, so the slot keeps its width across the load gap
+ // instead of collapsing and reopening. Content-only: the slot's own
+ // panel is permanent, so nothing here has to reproduce its id or sizing
+ // the way a placeholder panel once did. No ARIA — the slot goes `inert`
+ // on empty content, and the skeleton in the left column is the announced
+ // loading state.
+ docSlotContent = <div className="min-h-0 flex-1" />;
} else {
// Genuine cold start (group never mounted; no docked terminal alive yet)
- // or the web host (no dock to preserve): keep the standalone early return
- // OUTSIDE the shared horizontal panel group, so when the doc lands its
- // group mounts fresh with the doc panel already present. Routing it
- // through the group here would render one panel and then ADD the doc
- // panel — a 1→3 panel-count transition that corrupts react-resizable-
- // panels' doc-panel pixel-width sticky restore.
- return <EditorSkeleton />;
+ // or the web host (no dock to preserve): render the bare skeleton
+ // OUTSIDE the shared horizontal panel group. There is no group state to
+ // preserve on this path and nothing docked to keep alive, so mounting
+ // one to hold a skeleton buys nothing; when the doc lands, the group
+ // mounts fresh with the slot already in it.
+ //
+ // Flagged rather than returned on the spot: a hook is declared after
+ // this chain (the doc-slot publish), and returning from inside the chain
+ // would skip it on this path alone. The bare skeleton still renders,
+ // outside the group, just from the single exit below.
+ coldStartSkeleton = true;
}
} else if (isBlobRunnerNewTabId(activeNewTabId)) {
// Checked before the Skills arm: a blob-runner tab must win even when the
@@ -1708,79 +1706,78 @@ function EditorAreaInner({
viewContent = null;
renderFocusedDocument = renderEditorContent;
- // While the agents column is open and the doc panel is closed, the
- // collapsed doc panel sits as a zero-width flex neighbor between the editor
- // and the agents column. Its own handle is disabled whenever it is collapsed
- // (see the ResizableHandle below), but drags on the TERMINAL's handle still
- // route through the collapsed panel: the library snap-expands it once the
- // drag crosses half its min size, instead of returning the space to the
- // editor. Neutralize the panel itself: `disabled` makes drag redistribution
- // skip it (deltas flow through to the editor) and `minSize 0` disarms the
- // snap-expand threshold. Imperative paths (`setLayout`, `expand`) still
- // move it, so the toolbar toggle keeps working. Scoped to a resizable rail
- // being present: without one no drag can reach the collapsed panel at all.
- // A collapsed panel stays a NORMAL member of the group. Disabling it (the
- // previous behaviour) is what turned a collapsed interior panel into a dead
- // neighbour: the handle beside it had nothing to trade against and moved
- // nothing. Left enabled, the library snap-expands it instead — visible
- // movement rather than a frozen rail.
- rightPanel = (
- <>
- <ResizableHandle
- data-doc-panel-handle=""
- // No visible grip while collapsed — there is nothing to drag.
- withHandle={!isCollapsed}
- // A collapsed panel is not drag-resizable: the toolbar toggle and
- // ⌥⌘B are its single open mechanism (mirrors TerminalDock's
- // hidden-dock handle and the agents column, which unmounts its
- // handle entirely when hidden). Disabling while collapsed also
- // keeps this handle from overlapping the agents column's
- // handle at the same pixel seam, and from being a misclick target
- // under embedded AI-editor hosts whose own container chrome sits at
- // the iframe edge.
- disabled={isCollapsed}
- onPointerDown={(event) => {
- trackHandleDrag(event.pointerId, setIsDraggingDocHandle, isDraggingDocHandleRef);
- }}
- />
- <ResizablePanel
- id={DOC_PANEL_ID}
- panelRef={panelRef}
- defaultSize={initialRightCollapsed ? 0 : `${initialDocPanelWidthPx}px`}
- minSize={DOC_PANEL_MIN_SIZE}
- maxSize={DOC_PANEL_MAX_SIZE}
- collapsible
- collapsedSize={0}
- onResize={(size) => {
- setIsCollapsed(size.asPercentage === 0);
- // Persist only when this resize came from a user drag — RO-driven
- // recomputes (sticky width restoration) also fire onResize, but
- // they're replaying the persisted value and must NOT overwrite it.
- if (size.inPixels > 0 && isDraggingDocHandleRef.current) {
- docPanelWidthPxRef.current = size.inPixels;
- debouncedWriteDocPanelWidth(size.inPixels);
- }
- }}
- // react-resizable-panels does NOT apply inert/aria-hidden/display:none when
- // a panel collapses (verified against the installed runtime) — children stay
- // in DOM, in Tab order, and announced by screen readers. `inert` removes the
- // collapsed subtree from the a11y tree and focus order without remounting.
- inert={isCollapsed}
- className="flex flex-col bg-muted/20"
- >
- <DocPanel
- docName={activeDocName}
- isSourceMode={isSourceMode}
- activeTab={activeTab}
- onActiveTabChange={onActiveTabChange}
- mode={docPanelMode}
- isCollapsed={isCollapsed}
- />
- </ResizablePanel>
- </>
+ docSlotContent = (
+ <DocPanel
+ docName={activeDocName}
+ isSourceMode={isSourceMode}
+ activeTab={activeTab}
+ onActiveTabChange={onActiveTabChange}
+ mode={docPanelMode}
+ isCollapsed={isCollapsed}
+ />
);
}
+ // A popped-out note window carries no document side pane. Emptied here rather
+ // than in each branch: every branch that fills the slot is equally out of
+ // scope, and one exit keeps the presence read below honest. The slot itself
+ // still renders — permanent membership is what keeps the group's id set
+ // constant — it just holds nothing and sits at zero width.
+ if (noteWindow) docSlotContent = null;
+
+ // Read presence into a const, and let the effect below close over THAT rather
+ // than over `docSlotContent`. The slot's content is a `let` the branch chain
+ // reassigns, and React Compiler treats any value an effect observes as
+ // immutable — an effect capturing it directly turns every branch assignment
+ // above into a compile error. Both this const and the effect must also sit
+ // after the chain, since a reader declared above it cannot update when a
+ // later-declared binding changes (the compiler rejects that too).
+ const docSlotPresent = docSlotContent != null;
+
+ // Filling or emptying the slot changes what the rail owes each column, and no
+ // visibility flag moves when it happens — `syncRailColumns` is keyed on the
+ // terminal/agents flags and would sit this one out. An emptied slot has to
+ // hand its width back to the editor, and a filled one has to take its width
+ // back, or the pane arrives at whatever width the last view left behind.
+ //
+ // Applied through a bounded by-frame retry (mirrors the visibility-flag
+ // effect above): the same render that flips presence also flips the panel's
+ // constraint props, so a write from this commit's layout effect is validated
+ // against the PREVIOUS constraints and silently clamped — the slot stays at
+ // zero, `onResize(0)` reads as a user collapse, and the pane never comes
+ // back until a reload. Retrying on the next frame lands after the group has
+ // re-registered the constraints.
+ //
+ // The collapse intent is captured ONCE, at flip time. The clamped write's
+ // zero-width report flips `isCollapsed` state before the first retry runs;
+ // re-reading the ref inside the loop would launder that artifact into "the
+ // user collapsed it" and pin the slot shut.
+ useLayoutEffect(() => {
+ const docSlotPresenceChanged = docSlotPresentRef.current !== docSlotPresent;
+ docSlotPresentRef.current = docSlotPresent;
+ if (!docSlotPresenceChanged) return;
+ // A new flip supersedes a retry still in flight from the previous one.
+ if (presenceRepinFrameRef.current !== 0) {
+ cancelAnimationFrame(presenceRepinFrameRef.current);
+ presenceRepinFrameRef.current = 0;
+ }
+ const docCollapsed = isCollapsedRef.current;
+ const attempt = (attemptsLeft: number) => {
+ presenceRepinFrameRef.current = 0;
+ if (assertRightRailLayoutRef.current(docCollapsed) || attemptsLeft <= 0) return;
+ presenceRepinFrameRef.current = requestAnimationFrame(() => attempt(attemptsLeft - 1));
+ };
+ attempt(30);
+ });
+ useEffect(
+ () => () => {
+ if (presenceRepinFrameRef.current !== 0) {
+ cancelAnimationFrame(presenceRepinFrameRef.current);
+ }
+ },
+ [],
+ );
+
function renderUnfocusedPane({
activityMount,
pane,
@@ -1931,6 +1928,85 @@ function EditorAreaInner({
</TerminalDock>
);
+ // The document side pane: `docSlotContent` decides what it holds, never
+ // whether it is here. A view with nothing to put in it gets a zero-width slot,
+ // the same way a hidden terminal or agents column is a zero-width member.
+ //
+ // While the agents column is open and this slot is closed, it sits as a
+ // zero-width flex neighbor between the editor and the agents column. Its own
+ // handle is disabled whenever it is collapsed, but drags on the TERMINAL's
+ // handle still route through it: the library snap-expands it once the drag
+ // crosses half its min size, instead of returning the space to the editor.
+ // That is deliberate — a collapsed panel stays a NORMAL member of the group.
+ // Disabling it is what turned a collapsed interior panel into a dead
+ // neighbour: the handle beside it had nothing to trade against and moved
+ // nothing. Left enabled, the library snap-expands it — visible movement
+ // rather than a frozen rail.
+ const docSlot = (
+ <>
+ <ResizableHandle
+ data-doc-panel-handle=""
+ // No visible grip while collapsed or empty — there is nothing to drag.
+ withHandle={docSlotPresent && !isCollapsed}
+ // A collapsed pane is not drag-resizable: the toolbar toggle and ⌥⌘B are
+ // its single open mechanism (mirrors TerminalDock's hidden-dock handle).
+ // Disabling while collapsed also keeps this handle from overlapping the
+ // terminal column's handle at the same pixel seam, and from being a
+ // misclick target under embedded AI-editor hosts whose own container
+ // chrome sits at the iframe edge.
+ disabled={!docSlotPresent || isCollapsed}
+ className={docSlotPresent ? undefined : 'pointer-events-none'}
+ // Out of flex flow entirely while the slot holds nothing, matching the
+ // sibling rail handles — a separator for a column that is not there
+ // still paints its own width.
+ style={docSlotPresent ? undefined : { display: 'none' }}
+ onPointerDown={(event) => {
+ trackHandleDrag(event.pointerId, setIsDraggingDocHandle, isDraggingDocHandleRef);
+ }}
+ />
+ <ResizablePanel
+ id={DOC_PANEL_ID}
+ panelRef={panelRef}
+ defaultSize={!docSlotPresent || initialRightCollapsed ? 0 : `${initialDocPanelWidthPx}px`}
+ minSize={DOC_PANEL_MIN_SIZE}
+ // While filled this is the pane's drag ceiling. While empty the same
+ // knob is the flex-flow clamp every hidden rail column carries: RRP
+ // applies `Math.min(maxSize, size)` last in its layout validator, so
+ // `0px` holds the outer flex item at zero share through every
+ // redistribution pass. Without it an empty slot can take a share for a
+ // frame and paint a gap the editor should own.
+ maxSize={docSlotPresent ? DOC_PANEL_MAX_SIZE : '0px'}
+ collapsible
+ collapsedSize={0}
+ onResize={(size) => {
+ // A view with no document pane pins the slot to zero, and that zero is
+ // about the VIEW, not about the user having closed anything. Reading it
+ // as a collapse would silently rewrite their open/closed preference
+ // every time they opened an image or a skill file.
+ if (docSlotPresent) {
+ setIsCollapsed(size.asPercentage === 0);
+ }
+ // Persist only when this resize came from a user drag — RO-driven
+ // recomputes (sticky width restoration) also fire onResize, but
+ // they're replaying the persisted value and must NOT overwrite it.
+ if (size.inPixels > 0 && isDraggingDocHandleRef.current) {
+ docPanelWidthPxRef.current = size.inPixels;
+ debouncedWriteDocPanelWidth(size.inPixels);
+ }
+ reclaimHiddenRailColumn(DOC_PANEL_ID, docSlotPresent, size.inPixels);
+ }}
+ // react-resizable-panels does NOT apply inert/aria-hidden/display:none when
+ // a panel collapses (verified against the installed runtime) — children stay
+ // in DOM, in Tab order, and announced by screen readers. `inert` removes the
+ // collapsed subtree from the a11y tree and focus order without remounting.
+ inert={!docSlotPresent || isCollapsed}
+ className="flex flex-col bg-muted/20"
+ >
+ {docSlotContent}
+ </ResizablePanel>
+ </>
+ );
+
// The rail's panel set is FIXED: this column is always a member of the group
// and represents "hidden" as collapsed, never as unmounted.
//
@@ -1965,7 +2041,18 @@ function EditorAreaInner({
<ResizablePanel
id={TERMINAL_COLUMN_ID}
panelRef={terminalColumnPanelRef}
- defaultSize={terminalColumnPresent ? `${terminalDefaultWidthPx}px` : 0}
+ // Frozen at the mount-time width on purpose. `defaultSize` is a
+ // registration input: a live value re-registers the panel with the
+ // library each time the persisted width changes, which the debounced
+ // width write does moments after every drag on this column's handle.
+ // Re-registration makes the group re-resolve its layout from a cache
+ // keyed by panel ORDER — and permanently-mounted zero-width columns
+ // tie in that ordering (same offsetLeft, same offsetWidth), so the
+ // resolve can land on a stale permutation entry such as the launch-era
+ // all-collapsed rail, zeroing every column the app believes is open.
+ // Width restores don't need this to be live: every reopen routes
+ // through the rail re-pin, which reads the live width ref above.
+ defaultSize={terminalColumnPresent ? `${initialTerminalWidthPx}px` : 0}
minSize={`${RIGHT_TERMINAL_PANEL_MIN_WIDTH_PX}px`}
// Clamp the outer flex item to zero while hidden. RRP's own layout
// validator applies `Math.min(maxSize, size)` last (after the collapsible
@@ -2061,24 +2148,23 @@ function EditorAreaInner({
</>
);
- // A popped-out note window carries no doc-panel rail, so the editor takes the
- // window's full width. Cleared after the branches above rather than guarding
- // each one: every branch that builds a rail is equally out of scope here, and
- // one exit keeps the layout arithmetic below honest (`rightPanel == null`
- // feeds `editorAbsorbsResidual`).
- if (noteWindow) rightPanel = null;
+ // Cold start with no group to preserve: the bare skeleton, outside the panel
+ // group. Every hook above has run by now, so this exit is safe.
+ if (coldStartSkeleton) return <EditorSkeleton />;
// The editor absorbs the residual width whenever something on the right claims
- // space — the doc panel (when present and not collapsed) or a resizable rail.
+ // space — the document side pane (when filled and not collapsed) or a
+ // resizable rail.
const editorAbsorbsResidual =
- (rightPanel != null && !initialRightCollapsed) || resizableRailColumnPresent;
+ (docSlotPresent && !initialRightCollapsed) || resizableRailColumnPresent;
// The agents reveal tab pins to the far-right column edge here; the terminal's
// tab lives inside TerminalDock, pinned to the bottom of the editor column.
// (Each gated by its own predicate above; both can be up at once.)
- // Order: EDITOR | doc/agent panel | agents column. The agents panel is the
- // far-right column, so it renders AFTER `rightPanel`.
+ // Order: EDITOR | document side pane | terminal column | agents column. Every
+ // member is permanent and always in this order, so the group's panel-ID set is
+ // the same on every view and the library never swaps in a cached layout.
return (
<div className="flex min-h-0 flex-1 flex-col">
<div
@@ -2123,7 +2209,7 @@ function EditorAreaInner({
{leftColumn}
</div>
</ResizablePanel>
- {rightPanel}
+ {docSlot}
{terminalColumn}
{agentsColumn}
</ResizablePanelGroup>
diff --git a/packages/app/src/components/editor-area-rail-registry.test.ts b/packages/app/src/components/editor-area-rail-registry.test.ts
index c79e22352..7ea272f4f 100644
--- a/packages/app/src/components/editor-area-rail-registry.test.ts
+++ b/packages/app/src/components/editor-area-rail-registry.test.ts
@@ -1,6 +1,5 @@
import { describe, expect, test } from 'vitest';
import {
- AGENT_PANEL_ID,
AGENTS_COLUMN_ID,
accountRailLayout,
DOC_PANEL_ID,
@@ -33,10 +32,9 @@ describe('right-rail panel registry', () => {
// Pins membership AND order. Dropping a peer (e.g. the terminal column) or
// reordering fails here — a rendered column that is not registered would be
// mistaken for the residual editor and silently consume its width.
- test('registers exactly the four rail peers in canonical order', () => {
+ test('registers exactly the three rail peers in canonical order', () => {
expect([...RIGHT_RAIL_PANEL_ORDER]).toEqual([
DOC_PANEL_ID,
- AGENT_PANEL_ID,
TERMINAL_COLUMN_ID,
AGENTS_COLUMN_ID,
]);
@@ -68,7 +66,7 @@ describe('residual editor discovery across reachable layouts', () => {
}
});
- test('accounts cleanly for the four-peer wide rail', () => {
+ test('accounts cleanly for the full rail', () => {
const layout = [EDITOR, DOC_PANEL_ID, TERMINAL_COLUMN_ID, AGENTS_COLUMN_ID];
const accounting = accountRailLayout(layout);
expect(accounting.ok).toBe(true);
@@ -76,7 +74,7 @@ describe('residual editor discovery across reachable layouts', () => {
expect(accounting.presentPeers).toEqual([DOC_PANEL_ID, TERMINAL_COLUMN_ID, AGENTS_COLUMN_ID]);
});
- test('accounts cleanly for the narrow three-peer rail (agents closed)', () => {
+ test('accounts cleanly for a narrow rail (agents closed)', () => {
const layout = [EDITOR, DOC_PANEL_ID, TERMINAL_COLUMN_ID];
const accounting = accountRailLayout(layout);
expect(accounting.ok).toBe(true);
diff --git a/packages/app/src/components/editor-area-rail-registry.ts b/packages/app/src/components/editor-area-rail-registry.ts
index a341928fa..6c5777334 100644
--- a/packages/app/src/components/editor-area-rail-registry.ts
+++ b/packages/app/src/components/editor-area-rail-registry.ts
@@ -15,21 +15,22 @@
// of a string literal already narrows to its literal type, which the ordered
// tuple below relies on for `RightRailPanelId`.
export const DOC_PANEL_ID = 'doc-panel';
-export const AGENT_PANEL_ID = 'agent-panel';
export const TERMINAL_COLUMN_ID = 'terminal-column';
export const AGENTS_COLUMN_ID = 'agents-column';
/**
- * Left-to-right order of the rail peers, after the residual editor column.
- * `doc-panel` and `agent-panel` share the rightPanel slot (never both present);
- * the terminal column sits between the document side pane and the agents column.
+ * Left-to-right order of the rail peers, after the residual editor column. The
+ * terminal column sits between the document side pane and the agents column.
+ *
+ * Every peer is a PERMANENT member of the group: the set of ids is the same on
+ * every view, and a peer with nothing to show is a zero-width member rather than
+ * an unmounted one. react-resizable-panels caches one layout per id set and
+ * restores it whenever the set changes, so a peer that came and went would drag
+ * the whole rail back to whatever widths its absence was last paired with.
+ * `doc-panel` is one slot whose CONTENT varies (document side pane, agent
+ * activity, or nothing); it is not one id per kind of content.
*/
-export const RIGHT_RAIL_PANEL_ORDER = [
- DOC_PANEL_ID,
- AGENT_PANEL_ID,
- TERMINAL_COLUMN_ID,
- AGENTS_COLUMN_ID,
-] as const;
+export const RIGHT_RAIL_PANEL_ORDER = [DOC_PANEL_ID, TERMINAL_COLUMN_ID, AGENTS_COLUMN_ID] as const;
export type RightRailPanelId = (typeof RIGHT_RAIL_PANEL_ORDER)[number];
diff --git a/packages/app/src/components/editor-area-sticky-repin.test.ts b/packages/app/src/components/editor-area-sticky-repin.test.ts
index 3d0c48975..b5cb349e9 100644
--- a/packages/app/src/components/editor-area-sticky-repin.test.ts
+++ b/packages/app/src/components/editor-area-sticky-repin.test.ts
@@ -42,8 +42,8 @@ describe('computeStickyRepinLayout', () => {
expect(next.editor).toBeCloseTo(60, 6);
});
- test('preserves a non-pinned, non-residual panel (agent-panel) in the layout', () => {
- // The folder view mounts an agent panel that is neither pinned nor the
+ test('preserves a non-pinned, non-residual panel in the layout', () => {
+ // A layout can carry a member that is neither pinned nor the
// residual — its share must pass through untouched while the residual
// absorbs only what the pins leave.
const next = computeStickyRepinLayout({
@@ -71,7 +71,7 @@ describe('computeStickyRepinLayout', () => {
expect(next.editor).toBeCloseTo(100, 6);
});
- test('preserves peer key order and passes an unpinned peer through (four-peer rail)', () => {
+ test('preserves peer key order and passes an unpinned peer through', () => {
// editor | doc-panel | terminal-column | agents-column, with the terminal
// column unpinned. The returned layout must keep the same key order (the
// library has no ordering prop — source/DOM order is the contract) and pass
diff --git a/packages/app/src/components/editor-area-sticky-repin.ts b/packages/app/src/components/editor-area-sticky-repin.ts
index 822c5bed9..189377a2d 100644
--- a/packages/app/src/components/editor-area-sticky-repin.ts
+++ b/packages/app/src/components/editor-area-sticky-repin.ts
@@ -26,8 +26,8 @@ interface StickyRepinParams {
* (editor) panel takes exactly what the pins leave, whatever the topology.
*
* Returns a new `panelId -> percentage` map summing to 100. Pinned panels take
- * `px / containerPx`; other panels (e.g. the folder view's agent panel) keep
- * their current percentage; the residual panel takes the rest. Falls back to
+ * `px / containerPx`; any panel the caller does not pin keeps its current
+ * percentage; the residual panel takes the rest. Falls back to
* the input layout — same reference, so callers can skip `setLayout` on
* identity — when it can't compute a valid result: a non-positive container,
* an absent residual panel, or pins that don't fit (a negative residual).
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 754dc5cc2..0be5203e4 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;
@@ -127,6 +128,7 @@ export interface ComparePmStructuralOptions {
ignoreAttrs?: (attrKey: string) => boolean;
}
+
/** 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(
@@ -248,6 +250,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/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 1a81aa524..fbbd309df 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 11b5abdfd..ffd277a90 100644
--- a/packages/core/src/markdown/lint/index.ts
+++ b/packages/core/src/markdown/lint/index.ts
@@ -1,3 +1,4 @@
+
import { LINT_PLUGINS, type LinterConfig } from './plugins.ts';
import type { LintDiagnostic } from './types.ts';
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/plugins.ts b/packages/core/src/markdown/lint/plugins.ts
index 09c8450ee..0a089990e 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 6836b962d..c04fa4de0 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 3e79f8cb6..959cc0bd2 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) {