Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/cli/src/mini/splash.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Entry and exit splash banners for direct interactive mode scrollback.
//
// Renders the full opencode entry logo and a compact [O] exit badge, plus
// Renders the full shuvcode entry logo and a compact exit badge, plus
// session metadata and the resume command. These are scrollback snapshots, so
// they become immutable terminal history once committed.
//
Expand Down Expand Up @@ -40,6 +40,10 @@ export type SplashMeta = {
session_id: string
}

export function splashResumeCommand(sessionID: string) {
return `shuvcode mini -s ${sessionID}`
}

type Cell = {
char: string
mark: "text" | "full" | "mix" | "top"
Expand Down Expand Up @@ -234,7 +238,7 @@ function build(input: SplashWriterInput, kind: "entry" | "exit", ctx: Scrollback
lines,
body_left + label.length,
top + 1,
`opencode mini -s ${meta.session_id}`,
splashResumeCommand(meta.session_id),
right,
undefined,
TextAttributes.BOLD,
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/test/mini/splash.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, test } from "bun:test"
import { splashResumeCommand } from "../../src/mini/splash"

test("uses the shuvcode executable in the session resume command", () => {
expect(splashResumeCommand("ses_123")).toBe("shuvcode mini -s ses_123")
})
17 changes: 14 additions & 3 deletions packages/tui/src/context/local.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ export function recentModels(
.map((item) => ({ providerID: item.providerID, modelID: item.modelID }))
}

export function configuredAgentModelWarning(
agent: { id: string; model?: { providerID: string; id: string } },
models: { providerID: string; id: string }[] | undefined,
) {
if (!agent.model) return
if (!models) return
if (models.some((item) => item.providerID === agent.model?.providerID && item.id === agent.model.id)) return
return `Agent ${agent.id}'s configured model ${agent.model.providerID}/${agent.model.id} is not valid`
}

export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
name: "Local",
init: () => {
Expand Down Expand Up @@ -495,11 +505,12 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({

createEffect(() => {
const value = agent.current()
if (!value?.model) return
if (isModelValid({ providerID: value.model.providerID, modelID: value.model.id })) return
if (!value) return
const message = configuredAgentModelWarning(value, data.location.model.list())
if (!message) return
toast.show({
variant: "warning",
message: `Agent ${value.id}'s configured model ${value.model.providerID}/${value.model.id} is not valid`,
message,
duration: 3000,
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/tui/src/util/presentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function sessionEpilogue(input: { title: string; sessionID?: string }) {
...wordmark(" "),
"",
` ${weak("Session")}${bold}${input.title}${reset}`,
` ${weak("Continue")}${bold}opencode -s ${input.sessionID}${reset}`,
` ${weak("Continue")}${bold}shuvcode -s ${input.sessionID}${reset}`,
"",
].join("\n")
}
2 changes: 1 addition & 1 deletion packages/tui/test/app-lifecycle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test("session lifecycle updates the terminal title and prints the epilogue after
await task

expect(stdout).toContain("Renamed session")
expect(stdout).toContain("opencode -s dummy")
expect(stdout).toContain("shuvcode -s dummy")
} finally {
process.stdout.write = originalWrite
if (!setup.renderer.isDestroyed) setup.renderer.destroy()
Expand Down
32 changes: 31 additions & 1 deletion packages/tui/test/context/local.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from "bun:test"
import { parseModel, recentModels } from "../../src/context/local"
import { configuredAgentModelWarning, parseModel, recentModels } from "../../src/context/local"

test("parses model IDs containing slashes", () => {
expect(parseModel("provider/family/model")).toEqual({
Expand All @@ -20,3 +20,33 @@ test("moves a model to the front, deduplicates, and limits recents", () => {
...recent.slice(6, 10),
])
})

test("does not reject an agent model before the model catalog loads", () => {
expect(
configuredAgentModelWarning(
{
id: "build",
model: {
providerID: "anthropic",
id: "claude-opus-4-8",
},
},
undefined,
),
).toBeUndefined()
})

test("rejects an agent model missing from a loaded model catalog", () => {
expect(
configuredAgentModelWarning(
{
id: "build",
model: {
providerID: "anthropic",
id: "claude-opus-4-8",
},
},
[],
),
).toBe("Agent build's configured model anthropic/claude-opus-4-8 is not valid")
})
3 changes: 2 additions & 1 deletion packages/tui/test/util/presentation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import { sessionEpilogue } from "../../src/util/presentation"
test("formats session continuation summary", () => {
const epilogue = sessionEpilogue({ title: "A session", sessionID: "ses_123" })
expect(epilogue).toContain("A session")
expect(epilogue).toContain("opencode -s ses_123")
expect(epilogue).toContain("shuvcode -s ses_123")
expect(epilogue).not.toContain("opencode -s")
})
Loading