Skip to content

Commit a7a5d9a

Browse files
authored
🤖 fix: use defaultModel directly instead of wrapper (#626)
Remove unnecessary defaults.ts wrapper that was created in the import linting changes. ## Changes - Remove `src/common/utils/model/defaults.ts` - Update CLI files to import `defaultModel` directly from `@/common/utils/ai/models` - `agentSessionCli.ts` - `costs.ts` - `send-message.ts` ## Context The original changes moved shared code to `common/` to fix ESLint boundary violations. However, the CLI doesn't need a wrapper function - it can import the `defaultModel` constant directly. _Generated with `mux`_
1 parent 39b066b commit a7a5d9a

File tree

4 files changed

+6
-20
lines changed

4 files changed

+6
-20
lines changed

src/cli/debug/agentSessionCli.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
type SendMessageOptions,
2525
type WorkspaceChatMessage,
2626
} from "@/common/types/ipc";
27-
import { getDefaultModel } from "@/common/utils/model/defaults";
27+
import { defaultModel } from "@/common/utils/ai/models";
2828
import { ensureProvidersConfig } from "@/common/utils/providers/ensureProvidersConfig";
2929
import { modeToToolPolicy, PLAN_MODE_INSTRUCTION } from "@/common/utils/ui/modeUtils";
3030
import {
@@ -183,8 +183,7 @@ async function main(): Promise<void> {
183183
throw new Error("Message must be provided via --message or stdin");
184184
}
185185

186-
const model =
187-
values.model && values.model.trim().length > 0 ? values.model.trim() : getDefaultModel();
186+
const model = values.model && values.model.trim().length > 0 ? values.model.trim() : defaultModel;
188187
const timeoutMs = parseTimeout(values.timeout);
189188
const thinkingLevel = parseThinkingLevel(values["thinking-level"]);
190189
const initialMode = parseMode(values.mode);

src/cli/debug/costs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from "path";
33
import { defaultConfig } from "@/node/config";
44
import type { MuxMessage } from "@/common/types/message";
55
import { calculateTokenStats } from "@/common/utils/tokens/tokenStatsCalculator";
6-
import { getDefaultModel } from "@/common/utils/model/defaults";
6+
import { defaultModel } from "@/common/utils/ai/models";
77

88
/**
99
* Debug command to display cost/token statistics for a workspace
@@ -35,7 +35,7 @@ export async function costsCommand(workspaceId: string) {
3535

3636
// Detect model from first assistant message
3737
const firstAssistantMessage = messages.find((msg) => msg.role === "assistant");
38-
const model = firstAssistantMessage?.metadata?.model ?? getDefaultModel();
38+
const model = firstAssistantMessage?.metadata?.model ?? defaultModel;
3939

4040
// Calculate stats using shared logic (now synchronous)
4141
const stats = await calculateTokenStats(messages, model);

src/cli/debug/send-message.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from "path";
33
import { defaultConfig } from "@/node/config";
44
import type { MuxMessage } from "@/common/types/message";
55
import type { SendMessageOptions } from "@/common/types/ipc";
6-
import { getDefaultModel } from "@/common/utils/model/defaults";
6+
import { defaultModel } from "@/common/utils/ai/models";
77
import { getMuxSessionsDir } from "@/common/constants/paths";
88

99
/**
@@ -104,7 +104,7 @@ export function sendMessageCommand(
104104

105105
// Prepare options
106106
const options: SendMessageOptions = {
107-
model: getDefaultModel(),
107+
model: defaultModel,
108108
};
109109

110110
if (editMessageId) {

src/common/utils/model/defaults.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)