feat: massive chat reliability + UX pass (web/desktop/mobile/vscode) (#593)
## Added Features - Add VS Code save-as-image flow for assistant messages via webview bridge + native save dialog. - Add hourly desktop update checks after startup. - Add new tool output display mode: `Changes` (auto-expand edit/write/patch only; keep activity expanded; mode guidance text). - Add GitHub PR attachment flow in chat input with PR picker + attached PR chip/details. - Add mobile overlay presentation for GitHub Issue and PR pickers (shared with desktop picker content). ## Fixes - Save-gate project icon updates until explicit Save; allow icon removal with same save-gated behavior. - Restore clickable chat action buttons in sticky header mode (desktop + Firefox hit-target issue). - Clamp sticky user messages to bounded chat height and allow internal scrolling. - Prevent drawer context crash during iPad/tablet orientation switching. - Improve text-selection action menu placement on narrow screens. - Move assistant message time into clock tooltip; keep duration display clean. - Hide `Link GitHub Issue` row in VS Code chat input area (GitHub flow is not yet ready there). - Remove laggy close animation in text-selection popover; keep open motion/positioning behavior. - Fetch branches when picker opens and cache empty; show loading state instead of false “No branches found”. - Fix share-image export metadata rendering (theme background resolution, timestamp rendering, footer alignment). - Scope MCP services status/toggles to active directory to avoid cross-project leakage. - Improve long user-message clamp behavior (40% cap variant, hidden scrollbar, scroll shadows, expansion detection). - Fix desktop `Check for Updates` menu handler; prevent duplicate checks; show clear success/error toasts. - Stabilize long user-message scrolling behavior (follow-up hardening). - Avoid premature web update failure on slower servers. - Restore user message image previews + fullscreen gallery navigation payload. - Repair desktop chat drag-and-drop image attachments when native drop coords are missing. - Move GitHub issue linking entry into Add attachment menu. - Align header context usage percentage visuals with context panel. - Align `@` file search with active project in all runtimes. - Route `@` file discovery through OpenCode SDK `find.files`; remove legacy `/api/fs/search` reliance. - Make chat `@` mention behavior consistent with files-style behavior. - Keep status-row todos in stable order after status changes; add compact status icons; replace noisy priority labels. ## Refactors / UX Consistency - Simplify chat attachment model and remove project file picker path. - Keep composer focused on `@` mention file flow. - Use direct `Attach files` action in VS Code instead of attachment dropdown path. - Unify issue/PR picker behavior between desktop and mobile overlays.
This commit is contained in:
committed by
GitHub
parent
ca18b8be0f
commit
79143bff4c
@@ -2054,91 +2054,43 @@ class OpencodeService {
|
||||
limit?: number;
|
||||
includeHidden?: boolean;
|
||||
respectGitignore?: boolean;
|
||||
dirs?: boolean;
|
||||
type?: 'file' | 'directory';
|
||||
}
|
||||
): Promise<ProjectFileSearchHit[]> {
|
||||
const desktopFiles = getDesktopFilesApi();
|
||||
const directory = typeof options?.directory === 'string' && options.directory.trim().length > 0
|
||||
? options.directory.trim()
|
||||
: this.currentDirectory;
|
||||
const normalizedDirectory = directory ? normalizeFsPath(directory) : null;
|
||||
const scopedClient = directory ? this.getScopedApiClient(directory) : this.client;
|
||||
|
||||
if (desktopFiles) {
|
||||
try {
|
||||
const results = await desktopFiles.search({
|
||||
directory: directory || '',
|
||||
query,
|
||||
maxResults: options?.limit,
|
||||
includeHidden: options?.includeHidden,
|
||||
respectGitignore: options?.respectGitignore,
|
||||
});
|
||||
try {
|
||||
const response = await scopedClient.find.files({
|
||||
query,
|
||||
limit: typeof options?.limit === 'number' && Number.isFinite(options.limit) ? options.limit : undefined,
|
||||
dirs: options?.dirs === false || options?.type === 'file' ? 'false' : 'true',
|
||||
type: options?.type,
|
||||
});
|
||||
|
||||
if (!Array.isArray(results)) {
|
||||
return [];
|
||||
}
|
||||
const items = Array.isArray(response?.data) ? response.data : [];
|
||||
return items.map<ProjectFileSearchHit>((item) => {
|
||||
const normalizedRelativePath = normalizeFsPath(item);
|
||||
const name = normalizedRelativePath.split('/').filter(Boolean).pop() || normalizedRelativePath;
|
||||
const normalizedPath = normalizedDirectory
|
||||
? normalizeFsPath(`${normalizedDirectory}/${normalizedRelativePath}`)
|
||||
: normalizeFsPath(normalizedRelativePath);
|
||||
|
||||
return results.map<ProjectFileSearchHit>((file) => {
|
||||
const normalizedPath = normalizeFsPath(file.path);
|
||||
const name = normalizedPath.split('/').filter(Boolean).pop() || normalizedPath;
|
||||
const relativePath = (() => {
|
||||
if (file.preview && file.preview.length > 0 && typeof file.preview[0] === 'string') {
|
||||
return normalizeFsPath(file.preview[0]);
|
||||
}
|
||||
if (normalizedDirectory && normalizedPath.startsWith(normalizedDirectory)) {
|
||||
const suffix = normalizedPath.slice(normalizedDirectory.length).replace(/^\/+/, '');
|
||||
return suffix || name;
|
||||
}
|
||||
return name;
|
||||
})();
|
||||
|
||||
return {
|
||||
name,
|
||||
path: normalizedPath,
|
||||
relativePath,
|
||||
extension: name.includes('.') ? name.split('.').pop()?.toLowerCase() : undefined,
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to search files:', error);
|
||||
throw error;
|
||||
}
|
||||
return {
|
||||
name,
|
||||
path: normalizedPath,
|
||||
relativePath: normalizedRelativePath,
|
||||
extension: name.includes('.') ? name.split('.').pop()?.toLowerCase() : undefined,
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to search files:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
const params = new URLSearchParams();
|
||||
if (directory && directory.length > 0) {
|
||||
params.set('directory', directory);
|
||||
}
|
||||
if (typeof query === 'string') {
|
||||
params.set('q', query);
|
||||
}
|
||||
if (typeof options?.limit === 'number' && Number.isFinite(options.limit)) {
|
||||
params.set('limit', String(options.limit));
|
||||
}
|
||||
if (options?.includeHidden) {
|
||||
params.set('includeHidden', 'true');
|
||||
}
|
||||
if (options?.respectGitignore === false) {
|
||||
params.set('respectGitignore', 'false');
|
||||
}
|
||||
|
||||
const searchUrl = `${this.baseUrl}/fs/search${params.toString() ? `?${params.toString()}` : ''}`;
|
||||
const response = await fetch(searchUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({}));
|
||||
const message = typeof error.error === 'string' ? error.error : 'Failed to search files';
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
if (!result || !Array.isArray(result.files)) {
|
||||
return [];
|
||||
}
|
||||
return result.files as ProjectFileSearchHit[];
|
||||
}
|
||||
|
||||
async getFilesystemHome(): Promise<string | null> {
|
||||
|
||||
Reference in New Issue
Block a user