mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 20:20:42 +00:00
* feat(tui): add local embedded TUI mode with terminal/chat aliases Adds a gateway-free local TUI path so users can run openclaw in their terminal without needing a running gateway process. - TuiBackend interface abstraction (tui-backend.ts) with EmbeddedTuiBackend implementation that drives the agent loop in-process - openclaw tui --local flag for local embedded mode - openclaw terminal / openclaw chat aliases that imply --local - /auth slash command with codex CLI delegation to avoid prolite plan issue - Default model display fallback on startup - Local-aware status text and log suppression - Concise auth error hints, raw HTML 403 suppression - Onboarding hatch flow launches local TUI (no gateway required) - Commander alias bug fix in run-main.ts (.aliases() check) - All new and updated tests passing (145/145) * TUI: fix alias detection, cross-platform codex lookup, and history byte-budget safeguards * TUI: remove RuntimeEnv type annotation to fix CI oxlint error * TUI: filter gateway-dependent tools and auto-approve plugin hooks in embedded mode * TUI: suppress console noise and add embedded mode system prompt note * TUI: reduce embedded-mode tool filtering from 15 to 7, add local session tools * TUI: fix remaining PR review comments * TUI: address latest review feedback and CI drift * Core: align prompt helper with latest base * Core: match prompt helper formatting with base * Core: restore prompt helper from latest base * fix(tui): preserve local auth fallback in source checkouts * fix(tts): guard telephony provider invocation * fix(tui): support Windows codex auth shim * fix(tui): harden local auth flow * fix: preserve embedded tool-first run events * fix(tui): keep embedded plugin approvals gated * fix(tui): restore embedded attempt import * fix(tui): resolve sessions in embedded stub * fix: add embedded TUI changelog entry (#66767) (thanks @fuller-stack-dev) * fix: pass setup TUI local mode through relaunch (#66767) (thanks @fuller-stack-dev) --------- Co-authored-by: Ayaan Zaidi <hi@obviy.us>
105 lines
3.1 KiB
TypeScript
105 lines
3.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
resolveModelDisplayName,
|
|
resolveModelDisplayRef,
|
|
resolveSessionInfoModelSelection,
|
|
} from "./model-selection-display.js";
|
|
|
|
describe("model-selection-display", () => {
|
|
describe("resolveModelDisplayRef", () => {
|
|
it("keeps explicit runtime slash-bearing ids unchanged for display", () => {
|
|
expect(
|
|
resolveModelDisplayRef({
|
|
runtimeModel: "anthropic/claude-haiku-4.5",
|
|
}),
|
|
).toBe("anthropic/claude-haiku-4.5");
|
|
});
|
|
|
|
it("combines separate runtime provider and model ids", () => {
|
|
expect(
|
|
resolveModelDisplayRef({
|
|
runtimeProvider: "openai",
|
|
runtimeModel: "gpt-5.4",
|
|
}),
|
|
).toBe("openai/gpt-5.4");
|
|
});
|
|
|
|
it("falls back to override values when runtime values are absent", () => {
|
|
expect(
|
|
resolveModelDisplayRef({
|
|
overrideProvider: "openrouter",
|
|
overrideModel: "anthropic/claude-sonnet-4-6",
|
|
}),
|
|
).toBe("anthropic/claude-sonnet-4-6");
|
|
});
|
|
});
|
|
|
|
describe("resolveModelDisplayName", () => {
|
|
it("renders the trailing model segment for compact UI labels", () => {
|
|
expect(
|
|
resolveModelDisplayName({
|
|
runtimeProvider: "openrouter",
|
|
runtimeModel: "anthropic/claude-sonnet-4-6",
|
|
}),
|
|
).toBe("claude-sonnet-4-6");
|
|
});
|
|
|
|
it("returns a stable empty-state label", () => {
|
|
expect(resolveModelDisplayName({})).toBe("model n/a");
|
|
});
|
|
});
|
|
|
|
describe("resolveSessionInfoModelSelection", () => {
|
|
it("keeps partial runtime patches merged with current state", () => {
|
|
expect(
|
|
resolveSessionInfoModelSelection({
|
|
currentProvider: "anthropic",
|
|
currentModel: "claude-sonnet-4-6",
|
|
entryModel: "claude-opus-4-6",
|
|
}),
|
|
).toEqual({
|
|
modelProvider: "anthropic",
|
|
model: "claude-opus-4-6",
|
|
});
|
|
});
|
|
|
|
it("keeps override ids attached to the current provider when no override provider is stored", () => {
|
|
expect(
|
|
resolveSessionInfoModelSelection({
|
|
currentProvider: "anthropic",
|
|
currentModel: "claude-sonnet-4-6",
|
|
overrideModel: "ollama-beelink2/qwen2.5-coder:7b",
|
|
}),
|
|
).toEqual({
|
|
modelProvider: "anthropic",
|
|
model: "ollama-beelink2/qwen2.5-coder:7b",
|
|
});
|
|
});
|
|
|
|
it("keeps the current provider for slash-bearing override ids when provider is already known", () => {
|
|
expect(
|
|
resolveSessionInfoModelSelection({
|
|
currentProvider: "openrouter",
|
|
currentModel: "openrouter/auto",
|
|
overrideModel: "anthropic/claude-haiku-4.5",
|
|
}),
|
|
).toEqual({
|
|
modelProvider: "openrouter",
|
|
model: "anthropic/claude-haiku-4.5",
|
|
});
|
|
});
|
|
|
|
it("falls back to configured defaults when runtime session state is empty", () => {
|
|
expect(
|
|
resolveSessionInfoModelSelection({
|
|
defaultProvider: "openai",
|
|
defaultModel: "gpt-5.4",
|
|
}),
|
|
).toEqual({
|
|
modelProvider: "openai",
|
|
model: "gpt-5.4",
|
|
});
|
|
});
|
|
});
|
|
});
|