feat(agents): reference chips, quote blocks and a richer completion in the composer (#3091)

The agent composer is now a CodeMirror editor: the text stays plain and is what's sent, while @ file references are drawn as chips (icon, name, lines) that move and delete as one piece, open on click and preview on hover; Backspace after a chip opens it as text. Quotes show as blocks, and sent messages get the same chips and quote blocks. The @ completion lists open editors first, highlights matches and shows the folder; the focused editor's file is offered above the text, a pasted project path becomes a reference, and dropping files shows a hint. Lines copied from an editor paste as a reference, terminal output as a terminal block, and code blocks show as cards. The reference trimming regex avoids lookbehind for WebKit before 16.4.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-13 22:29:59 +08:00
1 джерело 834f9e172c
коміт 89f00a29f9
35 files changed
+3407 -745

No files matched your search

+22
Переглянути файл
@@ -188,3 +188,25 @@ export function installProblemsEvents(): () => void {
offProfile();
};
}
/**
* Errors and warnings as `rel:line:col: severity: message (source)` lines, errors first, at most
* `max`; null when there are none. For an agent's context.
*/
export function problemsReport(map: ProblemsMap, root: string, max = 60): string | null {
const rows: { severity: Severity; text: string }[] = [];
for (const path of map.keys()) {
const rel = path.startsWith(`${root}/`) ? path.slice(root.length + 1) : path;
for (const d of fileDiagnostics(map, path)) {
if (d.severity !== "error" && d.severity !== "warning") continue;
const at = `${rel}:${d.range.start.line + 1}:${d.range.start.col + 1}`;
const source = d.source ? ` (${d.source})` : "";
rows.push({ severity: d.severity, text: `${at}: ${d.severity}: ${d.message.split("\n")[0]}${source}` });
}
}
if (!rows.length) return null;
rows.sort((a, b) => Number(a.severity !== "error") - Number(b.severity !== "error"));
const shown = rows.slice(0, max).map((r) => r.text);
if (rows.length > max) shown.push(`… ${rows.length - max} more`);
return shown.join("\n");
}