Skip to content

Commit 1d029c9

Browse files
committed
fix: lazy-load tui plugin to prevent server crash when tui deps are missing
1 parent 54f25a3 commit 1d029c9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Logger } from "./lib/logger"
44
import { createSessionState } from "./lib/state"
55
import { createCompressTool } from "./lib/tools"
66
import { PromptStore } from "./lib/prompts/store"
7-
import tuiPlugin from "./tui/index"
87
import {
98
createChatMessageTransformHandler,
109
createCommandExecuteHandler,
@@ -13,6 +12,11 @@ import {
1312
} from "./lib/hooks"
1413
import { configureClientAuth, isSecureMode } from "./lib/auth"
1514

15+
let tuiPlugin: Record<string, unknown> = {}
16+
try {
17+
tuiPlugin = (await import("./tui/index")).default
18+
} catch {}
19+
1620
const server: Plugin = (async (ctx) => {
1721
const config = getConfig(ctx)
1822

0 commit comments

Comments
 (0)