fix(electrobun): address all 20 Codex review findings
CRITICAL: - PTY leak: Terminal.svelte now calls pty.close on destroy, not just unsubscribe - Agent session cleanup: clearSession() removes done/error sessions, backend deletes after 60s grace period HIGH: - Clone branch passthrough: user's branch name flows through callback - Circular imports: extracted rpc.ts singleton, broke main.ts ↔ App.svelte cycle - Settings wired to runtime: Terminal reads cursor/scrollback from settings - Security disclaimer: added "prototype — not system keyring" notice - ThemeEditor: fixed basePalette → initialPalette reference MEDIUM: - Clone race: UUID suffix instead of count-based index - Silent failures: structured error returns from PTY handlers - WebKitGTK mount: only current + previous group mounted - Debug listeners: gated behind DEBUG, cleanup on destroy - NDJSON residual buffer parsed on process exit - Codex adapter: deduplicated tool_call/tool_result - extraEnv: rejects CLAUDE*/CODEX*/OLLAMA* keys - settings-db: runMigrations() with version tracking - active_group: persisted via settings.set LOW: - Removed dead demo code, unused variables - color-mix() fallbacks added
This commit is contained in:
parent
ef0183de7f
commit
29a3370e79
18 changed files with 331 additions and 114 deletions
34
ui-electrobun/src/mainview/rpc.ts
Normal file
34
ui-electrobun/src/mainview/rpc.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* RPC singleton — breaks the circular import chain.
|
||||
*
|
||||
* main.ts creates the Electroview and RPC, then sets it here.
|
||||
* All other modules import from this file instead of main.ts.
|
||||
*/
|
||||
|
||||
import type { PtyRPCSchema } from '../shared/pty-rpc-schema.ts';
|
||||
|
||||
// Placeholder type — matches the shape Electroview.defineRPC returns.
|
||||
// Uses `any` for the internal Electrobun RPC wrapper type since it is
|
||||
// not exported from the electrobun package.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type ElectrobunRpc = any;
|
||||
|
||||
let _rpc: ElectrobunRpc | null = null;
|
||||
|
||||
/** Called once from main.ts after Electroview.defineRPC(). */
|
||||
export function setAppRpc(rpc: ElectrobunRpc): void {
|
||||
_rpc = rpc;
|
||||
}
|
||||
|
||||
/**
|
||||
* The app-wide RPC handle.
|
||||
* Safe to call after main.ts has executed (Svelte components mount after).
|
||||
*/
|
||||
export const appRpc: ElectrobunRpc = new Proxy({} as ElectrobunRpc, {
|
||||
get(_target, prop) {
|
||||
if (!_rpc) {
|
||||
throw new Error(`[rpc] accessed before init — property "${String(prop)}"`);
|
||||
}
|
||||
return (_rpc as Record<string | symbol, unknown>)[prop];
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue