refactor: codebase audit cleanup — dead code, dedup, module splits

Multi-agent audit + aggressive cleanup across server/web/coder/booterm,
delivered behind a DEFER discipline so none of the in-flight files were
touched. Removes dead code/deps/columns, dedups server + coder helpers,
and splits the oversized modules (tools.ts, opencode-server.ts,
sentinel-summaries, turn.ts, TerminalPane.tsx) behind stable contracts.
Adds 78 parity/unit tests (server 587, coder 323); fixes two latent bugs
(ChatPane queue keys, FileViewerOverlay blank-line parity).

Intended tag: v2.7.12-audit-cleanup.
This commit is contained in:
2026-06-02 21:10:06 +00:00
parent 6560398285
commit abe1a311d0
143 changed files with 6729 additions and 6087 deletions

View File

@@ -0,0 +1,26 @@
import { useState } from 'react';
import { toast } from 'sonner';
import { api } from '@/api/client';
export function useArtifactDownload(chatId: string, messageId: string, format: 'md' | 'html') {
const [downloading, setDownloading] = useState(false);
async function download() {
if (downloading) return;
setDownloading(true);
try {
const { url, path } = await api.messages.downloadArtifact(chatId, messageId, format);
const a = document.createElement('a');
a.href = url;
a.rel = 'noopener';
a.click();
toast.success(`Saved to ${path}`);
} catch (err) {
toast.error(err instanceof Error ? err.message : 'download failed');
} finally {
setDownloading(false);
}
}
return { downloading, download };
}