From 4fb315297c5f7b41877df6333660033f29f36acd Mon Sep 17 00:00:00 2001 From: Simon Klee Date: Tue, 7 Apr 2026 12:08:16 +0200 Subject: [PATCH] tighten up splash screen --- .../src/cli/cmd/run/runtime.lifecycle.ts | 19 ++++++++++++++++--- packages/opencode/src/cli/cmd/run/runtime.ts | 10 ++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/opencode/src/cli/cmd/run/runtime.lifecycle.ts b/packages/opencode/src/cli/cmd/run/runtime.lifecycle.ts index 41d15077b2..d43b04c2ba 100644 --- a/packages/opencode/src/cli/cmd/run/runtime.lifecycle.ts +++ b/packages/opencode/src/cli/cmd/run/runtime.lifecycle.ts @@ -60,7 +60,7 @@ export type LifecycleInput = { export type Lifecycle = { footer: FooterApi - close(input: { showExit: boolean }): Promise + close(input: { showExit: boolean; sessionTitle?: string }): Promise } // Gracefully tears down the renderer. Order matters: switch external output @@ -93,6 +93,14 @@ function splashTitle(title: string | undefined, history: string[]): string | und return next ?? title } +function splashSession(title: string | undefined, history: string[]): boolean { + if (title && !DEFAULT_TITLE.test(title)) { + return true + } + + return !!history.find((item) => item.trim().length > 0) +} + function footerLabels(input: Pick): FooterLabels { const agentLabel = Locale.titlecase(input.agent ?? "build") @@ -155,6 +163,7 @@ export async function createRuntimeLifecycle(input: LifecycleInput): Promise {}) @@ -198,7 +208,7 @@ export async function createRuntimeLifecycle(input: LifecycleInput): Promise { + const close = async (next: { showExit: boolean; sessionTitle?: string }) => { if (closed) { return } @@ -214,7 +224,10 @@ export async function createRuntimeLifecycle(input: LifecycleInput): Promise { await stream.close() } } finally { + const title = shown + ? await ctx.sdk.session + .get({ + sessionID: ctx.sessionID, + }) + .then((x) => x.data?.title) + .catch(() => undefined) + : undefined + await shell.close({ showExit: shown, + sessionTitle: title, }) } }