refactor: rombak jadi full CLI/TUI only — hapus semua interface server (api/ws/grpc/web/daemon) + wire TUI ke agent beneran
- Hapus total interfaces: api (REST), ws (WebSocket), grpc, web, daemon (IPC) - Hapus infra server-only yang jadi dead code: infrastructure/ipc + seluruh stack auth (domain/auth, application/auth, persistence/iam, infrastructure/auth jwt/password/oauth_loopback) - TUI (OpenTUI) jadi interface utama: wire ke runSingleProcess() real runtime, ganti mock '(no LLM configured)' dengan turnService.runTurn asli + streaming stream_token/reasoning/tool_result/system_note/error ke transcript - Tampilkan model asli di header (mis. claude-opus-5), abort turn via Ctrl+C - CLI jadi mode headless tambahan: zesdex --headless '<prompt>' one-shot turn - Bersihkan package.json (script tui/headless), tsconfig paths, docker-compose, AGENTS.md; hapus StartOAuth/login stub - verified: tsc 0 err, 70 test pass, build dist/zesdex; headless 'pong' real; TUI interactive render + real turn 'say pong in one word' -> assistant 'pong'
This commit is contained in:
@@ -7,7 +7,18 @@
|
||||
* unit-testable in Bun.
|
||||
*/
|
||||
|
||||
import { Roles, type Role } from "@zesdex/domain";
|
||||
import { Roles, type Role, type TurnEvent } from "@zesdex/domain";
|
||||
|
||||
/**
|
||||
* Driver for executing a single agent turn in the TUI. Implemented by the
|
||||
* composition root (`run.ts` → `runSingleProcess`), keeping the TUI logic
|
||||
* layer free of direct wiring. Returns a promise that resolves when the turn
|
||||
* (including all tool calls) finishes or is aborted.
|
||||
*/
|
||||
export type TurnRunner = (
|
||||
text: string,
|
||||
onEvent: (ev: TurnEvent) => void,
|
||||
) => Promise<void>;
|
||||
|
||||
/* ── Input state ──────────────────────────────────────────────────── */
|
||||
|
||||
@@ -23,9 +34,6 @@ export const COMMANDS: string[] = [
|
||||
"/help",
|
||||
"/quit",
|
||||
"/clear",
|
||||
"/login",
|
||||
"/login zen",
|
||||
"/login openai",
|
||||
"/edit",
|
||||
"/mcp add",
|
||||
"/model",
|
||||
@@ -390,6 +398,10 @@ export interface AppStateRest {
|
||||
renderWidthAtCache: number;
|
||||
mentionFiles: string[];
|
||||
pendingSubmit: string | null; // set when a turn should be spawned
|
||||
/** Real agent turn driver (wired by the composition root). */
|
||||
turnRunner: TurnRunner | null;
|
||||
/** Abort controller for the in-flight turn (driven by AbortTurn). */
|
||||
turnAbort: AbortController | null;
|
||||
}
|
||||
|
||||
export const DEFAULT_HELP_TEXT = ` Zesdex TUI — Keyboard Shortcuts
|
||||
@@ -459,6 +471,8 @@ export function createTuiState(
|
||||
renderWidthAtCache: 0,
|
||||
mentionFiles: [],
|
||||
pendingSubmit: null,
|
||||
turnRunner: null,
|
||||
turnAbort: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user