Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): agent panel polish - settings row labels, skill blurbs (PRD-8026, PRD-8017) (#4785)

Abrahamd7c128517d2c
diff --git a/.changeset/prd-8017-skill-blurbs.md b/.changeset/prd-8017-skill-blurbs.md
new file mode 100644
index 000000000..43e9bfc8c
--- /dev/null
+++ b/.changeset/prd-8017-skill-blurbs.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Skills in the editor's slash menu now show what they do under their name.
diff --git a/.changeset/prd-8026-settings-row-label.md b/.changeset/prd-8026-settings-row-label.md
new file mode 100644
index 000000000..1b4bfe1ba
--- /dev/null
+++ b/.changeset/prd-8026-settings-row-label.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Agent settings rows no longer cut their label down to "M.." when the chosen value is long. The value truncates instead, and the label and value both show in full on hover.
diff --git a/packages/app/src/components/acp/ThreadView.tsx b/packages/app/src/components/acp/ThreadView.tsx
index 2b952ae15..9951de9de 100644
--- a/packages/app/src/components/acp/ThreadView.tsx
+++ b/packages/app/src/components/acp/ThreadView.tsx
@@ -1729,11 +1729,19 @@ function ContextWindowSub({
const { t } = useLingui();
if (choices.length < 2) return null;
const summary = currentTokens === null ? t`Default` : formatContextTokens(currentTokens);
+ const contextWindowLabel = t`Context window`;
return (
<DropdownMenuSub>
<DropdownMenuSubTrigger className="gap-2" data-testid="agent-thread-context-window">
- <span className="min-w-0 flex-1 truncate">{t`Context window`}</span>
- <span className="max-w-[11rem] truncate text-1sm text-muted-foreground">{summary}</span>
+ <span className="min-w-0 truncate" title={contextWindowLabel}>
+ {contextWindowLabel}
+ </span>
+ <span
+ className="min-w-16 flex-1 truncate text-end text-1sm text-muted-foreground"
+ title={summary}
+ >
+ {summary}
+ </span>
</DropdownMenuSubTrigger>
<DropdownMenuSubContent className="max-w-72 overscroll-contain">
<DropdownMenuLabel>{t`Context window`}</DropdownMenuLabel>
@@ -1807,8 +1815,13 @@ function ConfigSelectSub({
return (
<DropdownMenuSub>
<DropdownMenuSubTrigger className="gap-2" data-testid={`agent-thread-config-${option.id}`}>
- <span className="min-w-0 flex-1 truncate">{option.name}</span>
- <span className="max-w-[11rem] truncate text-1sm text-muted-foreground">
+ <span className="min-w-0 truncate" title={option.name}>
+ {option.name}
+ </span>
+ <span
+ className="min-w-16 flex-1 truncate text-end text-1sm text-muted-foreground"
+ title={selectOptionSummary(agentId, option)}
+ >
{selectOptionSummary(agentId, option)}
</span>
</DropdownMenuSubTrigger>
diff --git a/packages/app/src/editor/slash-command/SlashCommandMenu.dom.test.tsx b/packages/app/src/editor/slash-command/SlashCommandMenu.dom.test.tsx
new file mode 100644
index 000000000..37d937db5
--- /dev/null
+++ b/packages/app/src/editor/slash-command/SlashCommandMenu.dom.test.tsx
@@ -0,0 +1,89 @@
+import { i18n } from '@lingui/core';
+import { cleanup, render, screen, within } from '@testing-library/react';
+import { FileText, Sparkles } from 'lucide-react';
+import { afterEach, describe, expect, test, vi } from 'vitest';
+import { getComponentItems } from './component-items';
+import type { SlashCommandItem } from './items';
+import { SlashCommandMenu } from './SlashCommandMenu';
+
+i18n.load('en', {});
+i18n.activate('en');
+
+afterEach(cleanup);
+
+function item(overrides: Partial<SlashCommandItem> & { name: string }): SlashCommandItem {
+ return {
+ label: overrides.name,
+ icon: Sparkles,
+ category: 'skills',
+ command: () => {},
+ ...overrides,
+ };
+}
+
+function show(items: SlashCommandItem[]) {
+ render(
+ <SlashCommandMenu
+ items={items}
+ selectedIndex={0}
+ onSelect={vi.fn()}
+ onHoverIndex={vi.fn()}
+ categoryLabels={{ skills: 'Skills', components: 'Components', basic: 'Basic blocks' }}
+ />,
+ );
+}
+
+describe('SlashCommandMenu second line', () => {
+ test('a skill shows what it does under its name', () => {
+ show([item({ name: 'bug-triage', description: 'Triage an Open Knowledge ticket.' })]);
+
+ const row = screen.getByRole('option');
+ expect(within(row).getByText('bug-triage')).toBeTruthy();
+ expect(within(row).getByText('Triage an Open Knowledge ticket.')).toBeTruthy();
+ });
+
+ test('a non-skill row keeps its registry description out of the menu', () => {
+ show([
+ item({
+ name: 'HtmlAlignBlock',
+ category: 'components',
+ icon: FileText,
+ description: 'GitHub-style `<div align>` wrapper.',
+ }),
+ ]);
+
+ const row = screen.getByRole('option');
+ expect(within(row).getByText('HtmlAlignBlock')).toBeTruthy();
+ expect(row.textContent).toBe('HtmlAlignBlock');
+ });
+
+ test('no real component row prints its registry description, however it is built', () => {
+ const built = getComponentItems();
+ expect(built.length).toBeGreaterThan(0);
+ expect(built.some((i) => i.description !== undefined)).toBe(true);
+
+ show(built);
+
+ const labels = new Set(built.map((i) => i.label));
+ const printedMore = screen
+ .getAllByRole('option')
+ .map((row) => row.textContent ?? '')
+ .filter((text) => !labels.has(text));
+
+ expect(printedMore).toEqual([]);
+ });
+
+ test('the blurb on screen is the blurb announced', () => {
+ show([item({ name: 'bug-triage', description: 'Triage an Open Knowledge ticket.' })]);
+
+ const live = document.querySelector('[aria-live="polite"]');
+ expect(live?.textContent).toBe('bug-triage. Triage an Open Knowledge ticket.');
+ });
+
+ test('an item with no description of its own stays a single line', () => {
+ show([item({ name: 'Heading 1', category: 'basic' })]);
+
+ const row = screen.getByRole('option');
+ expect(row.textContent).toBe('Heading 1');
+ });
+});
diff --git a/packages/app/src/editor/slash-command/SlashCommandMenu.tsx b/packages/app/src/editor/slash-command/SlashCommandMenu.tsx
index 6b2f0f63f..e0db500c1 100644
--- a/packages/app/src/editor/slash-command/SlashCommandMenu.tsx
+++ b/packages/app/src/editor/slash-command/SlashCommandMenu.tsx
@@ -10,6 +10,15 @@ interface SlashCommandMenuProps {
onHoverIndex?: (index: number) => void;
}
+function skillBlurb(item: SlashCommandItem): string | undefined {
+ return item.category === 'skills' ? item.description : undefined;
+}
+
+function secondLine(item: SlashCommandItem): string {
+ const spoken = item.preview?.description ?? skillBlurb(item);
+ return spoken === undefined ? '' : `. ${spoken}`;
+}
+
export function SlashCommandMenu({
items,
selectedIndex,
@@ -84,9 +93,7 @@ export function SlashCommandMenu({
>
{}
<span className="sr-only" aria-live="polite" aria-atomic="true">
- {selectedItem
- ? `${selectedItem.label}${selectedItem.preview ? `. ${selectedItem.preview.description}` : ''}`
- : ''}
+ {selectedItem ? `${selectedItem.label}${secondLine(selectedItem)}` : ''}
</span>
{categories.map((cat) => (
// biome-ignore lint/a11y/useSemanticElements: WAI-ARIA listbox pattern requires role="group" for option groups — <fieldset> is non-standard inside role="listbox"
@@ -121,6 +128,11 @@ export function SlashCommandMenu({
<Icon className="size-4 shrink-0 text-muted-foreground" />
<div className="flex flex-col min-w-0">
<span className="truncate">{item.label}</span>
+ {skillBlurb(item) === undefined ? null : (
+ <span className="line-clamp-2 text-xs text-muted-foreground">
+ {skillBlurb(item)}
+ </span>
+ )}
</div>
</button>
);
diff --git a/packages/app/src/editor/slash-command/skill-reference-items.test.ts b/packages/app/src/editor/slash-command/skill-reference-items.test.ts
new file mode 100644
index 000000000..3372bf6fb
--- /dev/null
+++ b/packages/app/src/editor/slash-command/skill-reference-items.test.ts
@@ -0,0 +1,135 @@
+import type { Editor } from '@tiptap/core';
+import { describe, expect, test, vi } from 'vitest';
+
+const LONG =
+ 'Use when triaging an Open Knowledge ticket in Linear, whatever its shape or origin. ' +
+ 'Owns every kind of ticket: defect, feature request, question, sentiment.';
+
+const SHORT_FIRST =
+ 'Answer questions about the AI SDK. ' +
+ 'Then help build AI-powered features across the whole application surface and beyond.';
+
+const ABBREVIATED =
+ 'Use the CLI (e.g. ok start) before anything else. Then open the editor and begin.';
+
+const STRADDLING =
+ 'Use when triaging a ticket in Linear that arrives as a linear.app/inkeep/issue/PRD-8017 URL. ' +
+ 'More follows.';
+
+const TRAILING_COMMA =
+ 'Produce an ambitious, verification-grounded, deeply-considered plan for reviewers, ' +
+ 'then stop. More follows.';
+
+const HUGE_TOKEN = `Read ${'x'.repeat(140)} then stop. More follows.`;
+
+const SINGLE_LETTER =
+ 'First do A. Then do the rest of the work described further down in this paragraph.';
+
+const UNBROKEN =
+ 'Read when the user asks what OpenKnowledge is and wants to install it on a repository ' +
+ 'they already have checked out somewhere on disk';
+
+const skills = new Map<string, { scope: 'project'; path: string; description?: string }>([
+ ['bug-triage', { scope: 'project', path: 'a/SKILL.md', description: 'Triage a ticket.' }],
+ ['no-blurb', { scope: 'project', path: 'b/SKILL.md' }],
+ ['wordy', { scope: 'project', path: 'c/SKILL.md', description: LONG }],
+ ['short-first', { scope: 'project', path: 'd/SKILL.md', description: SHORT_FIRST }],
+ ['abbreviated', { scope: 'project', path: 'e/SKILL.md', description: ABBREVIATED }],
+ ['unbroken', { scope: 'project', path: 'f/SKILL.md', description: UNBROKEN }],
+ ['straddling', { scope: 'project', path: 'g/SKILL.md', description: STRADDLING }],
+ ['trailing-comma', { scope: 'project', path: 'j/SKILL.md', description: TRAILING_COMMA }],
+ ['huge-token', { scope: 'project', path: 'h/SKILL.md', description: HUGE_TOKEN }],
+ ['single-letter', { scope: 'project', path: 'i/SKILL.md', description: SINGLE_LETTER }],
+]);
+
+vi.mock('@/lib/skill-name-set', () => ({ getSkillNamesForScope: () => skills }));
+
+const { getSkillReferenceItems } = await import('./skill-reference-items');
+
+const editor = {
+ extensionManager: {
+ extensions: [
+ { name: 'skillPathLinks', options: { docName: '.agents/skills/bug-triage/SKILL' } },
+ ],
+ },
+} as unknown as Editor;
+
+describe('getSkillReferenceItems', () => {
+ const blurbOf = (label: string) =>
+ getSkillReferenceItems({ editor }).find((i) => i.label === label)?.description;
+
+ test("carries each skill's own description, and leaves it off when there is none", () => {
+ const items = getSkillReferenceItems({ editor });
+
+ expect(items.map((i) => i.label)).toEqual([
+ 'abbreviated',
+ 'bug-triage',
+ 'huge-token',
+ 'no-blurb',
+ 'short-first',
+ 'single-letter',
+ 'straddling',
+ 'trailing-comma',
+ 'unbroken',
+ 'wordy',
+ ]);
+ expect(blurbOf('bug-triage')).toBe('Triage a ticket.');
+ expect(blurbOf('no-blurb')).toBeUndefined();
+ });
+
+ test('a short opening sentence is kept whole, not capped at the raw character count', () => {
+ expect(blurbOf('short-first')).toBe('Answer questions about the AI SDK…');
+ });
+
+ test('an abbreviation period does not end the sentence', () => {
+ expect(blurbOf('abbreviated')).toBe('Use the CLI (e.g. ok start) before anything else…');
+ });
+
+ test('a sentence with no terminator is cut on a word boundary', () => {
+ const cut = blurbOf('unbroken');
+
+ const core = cut?.slice(0, -1) ?? '';
+
+ expect(cut?.endsWith('…')).toBe(true);
+ expect(UNBROKEN.startsWith(core)).toBe(true);
+ expect(UNBROKEN.charAt(core.length)).toBe(' ');
+ });
+
+ test('a token straddling the cap is kept whole rather than dropped', () => {
+ expect(blurbOf('straddling')).toBe(
+ 'Use when triaging a ticket in Linear that arrives as a linear.app/inkeep/issue/PRD-8017…',
+ );
+ });
+
+ test('a cut landing on punctuation does not keep the dangling mark', () => {
+ expect(blurbOf('trailing-comma')).toBe(
+ 'Produce an ambitious, verification-grounded, deeply-considered plan for reviewers…',
+ );
+ });
+
+ test('a token too long to keep whole is cut at the cap rather than discarded', () => {
+ expect(blurbOf('huge-token')).toBe(`Read ${'x'.repeat(75)}…`);
+ });
+
+ test('a standalone capital does not read as an abbreviation', () => {
+ expect(blurbOf('single-letter')).toBe('First do A…');
+ });
+
+ test('a routing paragraph is cut to its first sentence and capped', () => {
+ const wordy = getSkillReferenceItems({ editor }).find((i) => i.label === 'wordy');
+
+ expect(wordy?.description?.length).toBeLessThanOrEqual(105);
+ expect(wordy?.description).not.toContain('Owns every kind of ticket');
+ expect(wordy?.description?.startsWith('Use when triaging an Open Knowledge ticket')).toBe(true);
+ });
+
+ test('a doc that is not a skill bundle offers no skill references', () => {
+ const plain = {
+ extensionManager: {
+ extensions: [{ name: 'skillPathLinks', options: { docName: 'notes/today' } }],
+ },
+ } as unknown as Editor;
+
+ expect(getSkillReferenceItems({ editor: plain })).toEqual([]);
+ });
+});
diff --git a/packages/app/src/editor/slash-command/skill-reference-items.tsx b/packages/app/src/editor/slash-command/skill-reference-items.tsx
index 8f2dad3cd..0beac9488 100644
--- a/packages/app/src/editor/slash-command/skill-reference-items.tsx
+++ b/packages/app/src/editor/slash-command/skill-reference-items.tsx
@@ -4,6 +4,37 @@ import { getSkillNamesForScope } from '@/lib/skill-name-set';
import { skillDocTarget } from '../extensions/skill-path-links';
import type { SlashCommandItem } from './items';
+const BLURB_MAX = 80;
+const BLURB_OVERFLOW = 24;
+
+const ABBREVIATION = /(?:^|[\s(])(?:e\.g|i\.e|etc|vs|approx|cf|al|Dr|Mr|Ms|Mrs|St|No|Fig)\.$/;
+
+function firstSentence(text: string): string {
+ const terminator = /[.!?](?=\s)/g;
+ for (let hit = terminator.exec(text); hit !== null; hit = terminator.exec(text)) {
+ const candidate = text.slice(0, hit.index + 1);
+ if (!ABBREVIATION.test(candidate)) return candidate;
+ }
+ return text;
+}
+
+function capAtWord(text: string, max: number): string {
+ if (text.length <= max) return text;
+ const nextSpace = text.indexOf(' ', max);
+ const tokenEnd = nextSpace === -1 ? text.length : nextSpace;
+ if (tokenEnd <= max + BLURB_OVERFLOW) return text.slice(0, tokenEnd).trimEnd();
+ return text.slice(0, max).trimEnd();
+}
+
+function blurb(description: string | undefined): string | undefined {
+ if (description === undefined) return undefined;
+ const collapsed = description.replace(/\s+/g, ' ').trim();
+ if (collapsed === '') return undefined;
+ const shortened = capAtWord(firstSentence(collapsed), BLURB_MAX);
+ if (shortened.length >= collapsed.length) return shortened;
+ return `${shortened.replace(/[.!?,;:]+$/, '')}…`;
+}
+
function editorDocName(editor: Editor | undefined): string | null {
if (!editor) return null;
const ext = editor.extensionManager.extensions.find((e) => e.name === 'skillPathLinks');
@@ -19,12 +50,13 @@ export function getSkillReferenceItems(ctx?: { editor?: Editor }): SlashCommandI
if (known === null) return [];
const items: SlashCommandItem[] = [];
for (const [name, info] of known) {
+ const text = blurb(info.description);
items.push({
name: `skill-ref-${name}`,
label: name,
icon: Sparkles,
category: 'skills',
- description: info.scope,
+ ...(text === undefined ? {} : { description: text }),
command: (editor) => {
editor.chain().focus().insertContent(`/${name} `).run();
},
diff --git a/packages/app/src/lib/skill-name-set.ts b/packages/app/src/lib/skill-name-set.ts
index 8e468b642..bbe015790 100644
--- a/packages/app/src/lib/skill-name-set.ts
+++ b/packages/app/src/lib/skill-name-set.ts
@@ -7,6 +7,7 @@ import { listSkills } from '@/lib/skills-api';
interface SkillNameInfo {
scope: SkillScope;
path: string;
+ description?: string;
managed?: boolean;
absolutePath?: string;
}
@@ -31,6 +32,9 @@ async function refresh(): Promise<void> {
const info: SkillNameInfo = {
scope: sk.scope,
path: sk.path,
+ ...(sk.description !== undefined && sk.description.trim() !== ''
+ ? { description: sk.description }
+ : {}),
...(sk.managed === true ? { managed: true } : {}),
...(sk.absolutePath !== undefined ? { absolutePath: sk.absolutePath } : {}),
};