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
@@ -63,8 +63,6 @@ const OPENCHAMBER_VERSION = (() => {
|
||||
return 'unknown';
|
||||
})();
|
||||
const fsPromises = fs.promises;
|
||||
const DEFAULT_FILE_SEARCH_LIMIT = 60;
|
||||
const MAX_FILE_SEARCH_LIMIT = 400;
|
||||
const FILE_SEARCH_MAX_CONCURRENCY = 5;
|
||||
const FILE_SEARCH_EXCLUDED_DIRS = new Set([
|
||||
'node_modules',
|
||||
@@ -1997,7 +1995,7 @@ const sanitizeSettingsUpdate = (payload) => {
|
||||
}
|
||||
if (typeof candidate.toolCallExpansion === 'string') {
|
||||
const mode = candidate.toolCallExpansion.trim();
|
||||
if (mode === 'collapsed' || mode === 'activity' || mode === 'detailed') {
|
||||
if (mode === 'collapsed' || mode === 'activity' || mode === 'detailed' || mode === 'changes') {
|
||||
result.toolCallExpansion = mode;
|
||||
}
|
||||
}
|
||||
@@ -12364,53 +12362,6 @@ async function main(options = {}) {
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/fs/search', async (req, res) => {
|
||||
const rawRoot = typeof req.query.root === 'string' && req.query.root.trim().length > 0
|
||||
? req.query.root.trim()
|
||||
: typeof req.query.directory === 'string' && req.query.directory.trim().length > 0
|
||||
? req.query.directory.trim()
|
||||
: os.homedir();
|
||||
const rawQuery = typeof req.query.q === 'string' ? req.query.q : '';
|
||||
const includeHidden = req.query.includeHidden === 'true';
|
||||
const respectGitignore = req.query.respectGitignore !== 'false';
|
||||
const limitParam = typeof req.query.limit === 'string' ? Number.parseInt(req.query.limit, 10) : undefined;
|
||||
const parsedLimit = Number.isFinite(limitParam) ? Number(limitParam) : DEFAULT_FILE_SEARCH_LIMIT;
|
||||
const limit = Math.max(1, Math.min(parsedLimit, MAX_FILE_SEARCH_LIMIT));
|
||||
|
||||
try {
|
||||
const resolvedRoot = path.resolve(normalizeDirectoryPath(rawRoot));
|
||||
const stats = await fsPromises.stat(resolvedRoot);
|
||||
if (!stats.isDirectory()) {
|
||||
return res.status(400).json({ error: 'Specified root is not a directory' });
|
||||
}
|
||||
|
||||
const files = await searchFilesystemFiles(resolvedRoot, {
|
||||
limit,
|
||||
query: rawQuery || '',
|
||||
includeHidden,
|
||||
respectGitignore,
|
||||
});
|
||||
res.json({
|
||||
root: resolvedRoot,
|
||||
count: files.length,
|
||||
files
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to search filesystem:', error);
|
||||
const err = error;
|
||||
if (err && typeof err === 'object' && 'code' in err) {
|
||||
const code = err.code;
|
||||
if (code === 'ENOENT') {
|
||||
return res.status(404).json({ error: 'Directory not found' });
|
||||
}
|
||||
if (code === 'EACCES') {
|
||||
return res.status(403).json({ error: 'Access to directory denied' });
|
||||
}
|
||||
}
|
||||
res.status(500).json({ error: (error && error.message) || 'Failed to search files' });
|
||||
}
|
||||
});
|
||||
|
||||
let ptyProviderPromise = null;
|
||||
const getPtyProvider = async () => {
|
||||
if (ptyProviderPromise) {
|
||||
|
||||
@@ -21,18 +21,6 @@ type WebDirectoryListResponse = {
|
||||
entries?: WebDirectoryEntry[];
|
||||
};
|
||||
|
||||
type WebFileSearchResponse = {
|
||||
root?: string;
|
||||
directory?: string;
|
||||
count?: number;
|
||||
files?: Array<{
|
||||
name?: string;
|
||||
path?: string;
|
||||
relativePath?: string;
|
||||
extension?: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
const toDirectoryListResult = (fallbackDirectory: string, payload: WebDirectoryListResponse): DirectoryListResult => {
|
||||
const directory = normalizePath(payload?.directory || payload?.path || fallbackDirectory);
|
||||
const entries = Array.isArray(payload?.entries) ? payload.entries : [];
|
||||
@@ -78,35 +66,28 @@ export const createWebFilesAPI = (): FilesAPI => ({
|
||||
params.set('directory', directory);
|
||||
}
|
||||
|
||||
params.set('q', payload.query);
|
||||
params.set('query', payload.query);
|
||||
params.set('dirs', 'false');
|
||||
params.set('type', 'file');
|
||||
|
||||
if (typeof payload.maxResults === 'number' && Number.isFinite(payload.maxResults)) {
|
||||
params.set('limit', String(payload.maxResults));
|
||||
}
|
||||
if (payload.includeHidden) {
|
||||
params.set('includeHidden', 'true');
|
||||
}
|
||||
|
||||
const response = await fetch(`/api/fs/search?${params.toString()}`);
|
||||
const response = await fetch(`/api/find/file?${params.toString()}`);
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({ error: response.statusText }));
|
||||
throw new Error((error as { error?: string }).error || 'Failed to search files');
|
||||
}
|
||||
|
||||
const result = (await response.json()) as WebFileSearchResponse;
|
||||
const files = Array.isArray(result?.files) ? result.files : [];
|
||||
const result = (await response.json()) as string[];
|
||||
const files = Array.isArray(result) ? result : [];
|
||||
|
||||
return files
|
||||
.filter((file): file is { path: string; relativePath?: string } =>
|
||||
Boolean(file && typeof file.path === 'string')
|
||||
)
|
||||
.map((file) => ({
|
||||
path: normalizePath(file.path),
|
||||
preview: typeof file.relativePath === 'string' && file.relativePath.length > 0
|
||||
? [normalizePath(file.relativePath)]
|
||||
: undefined,
|
||||
}));
|
||||
return files.map((relativePath) => ({
|
||||
path: normalizePath(`${directory}/${relativePath}`),
|
||||
preview: [normalizePath(relativePath)],
|
||||
}));
|
||||
},
|
||||
|
||||
async createDirectory(path: string): Promise<{ success: boolean; path: string }> {
|
||||
|
||||
Reference in New Issue
Block a user