refactor(opencode): improve startup time by 38% (#30453)

Co-authored-by: starptech <starptech@starptechs-MBP.fritz.box>
This commit is contained in:
Dustin Deus
2026-06-02 21:20:25 +02:00
committed by GitHub
co-authored by starptech
parent 83c12f334e
commit 7dd2306dad
20 changed files with 1878 additions and 1851 deletions
+1 -1
View File
@@ -1,7 +1,6 @@
import { cmd } from "../cmd"
import { UI } from "@/cli/ui"
import { win32DisableProcessedInput, win32InstallCtrlCGuard } from "./win32"
import { TuiConfig } from "@/cli/cmd/tui/config/tui"
import { errorMessage } from "@/util/error"
import { validateSession } from "./validate-session"
import { ServerAuth } from "@/server/auth"
@@ -45,6 +44,7 @@ export const AttachCommand = cmd({
describe: "basic auth username (defaults to OPENCODE_SERVER_USERNAME or 'opencode')",
}),
handler: async (args) => {
const { TuiConfig } = await import("@/cli/cmd/tui/config/tui")
const unguard = win32InstallCtrlCGuard()
try {
win32DisableProcessedInput()
+1 -1
View File
@@ -13,7 +13,6 @@ import type { GlobalEvent } from "@opencode-ai/sdk/v2"
import type { EventSource } from "./context/sdk"
import { win32DisableProcessedInput, win32InstallCtrlCGuard } from "./win32"
import { writeHeapSnapshot } from "v8"
import { TuiConfig } from "./config/tui"
import {
OPENCODE_PROCESS_ROLE,
OPENCODE_RUN_ID,
@@ -113,6 +112,7 @@ export const TuiThreadCommand = cmd({
describe: "agent to use",
}),
handler: async (args) => {
const { TuiConfig } = await import("./config/tui")
// Keep ENABLE_PROCESSED_INPUT cleared even if other code flips it.
// (Important when running under `bun run` wrappers on Windows.)
const unguard = win32InstallCtrlCGuard()