fix: normalize imports for lint
This commit is contained in:
@@ -4,6 +4,21 @@ import path from "node:path";
|
|||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
import { loadModelCatalog } from "../agents/model-catalog.js";
|
||||||
|
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
||||||
|
import {
|
||||||
|
loadSessionStore,
|
||||||
|
resolveSessionKey,
|
||||||
|
saveSessionStore,
|
||||||
|
} from "../config/sessions.js";
|
||||||
|
import { drainSystemEvents } from "../infra/system-events.js";
|
||||||
|
import {
|
||||||
|
extractQueueDirective,
|
||||||
|
extractThinkDirective,
|
||||||
|
extractVerboseDirective,
|
||||||
|
getReplyFromConfig,
|
||||||
|
} from "./reply.js";
|
||||||
|
|
||||||
vi.mock("../agents/pi-embedded.js", () => ({
|
vi.mock("../agents/pi-embedded.js", () => ({
|
||||||
abortEmbeddedPiRun: vi.fn().mockReturnValue(false),
|
abortEmbeddedPiRun: vi.fn().mockReturnValue(false),
|
||||||
runEmbeddedPiAgent: vi.fn(),
|
runEmbeddedPiAgent: vi.fn(),
|
||||||
@@ -15,21 +30,6 @@ vi.mock("../agents/model-catalog.js", () => ({
|
|||||||
loadModelCatalog: vi.fn(),
|
loadModelCatalog: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
import { loadModelCatalog } from "../agents/model-catalog.js";
|
|
||||||
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
|
||||||
import {
|
|
||||||
loadSessionStore,
|
|
||||||
resolveSessionKey,
|
|
||||||
saveSessionStore,
|
|
||||||
} from "../config/sessions.js";
|
|
||||||
import {
|
|
||||||
extractQueueDirective,
|
|
||||||
extractThinkDirective,
|
|
||||||
extractVerboseDirective,
|
|
||||||
getReplyFromConfig,
|
|
||||||
} from "./reply.js";
|
|
||||||
import { drainSystemEvents } from "../infra/system-events.js";
|
|
||||||
|
|
||||||
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
|
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
|
||||||
const base = await fs.mkdtemp(path.join(os.tmpdir(), "clawdis-reply-"));
|
const base = await fs.mkdtemp(path.join(os.tmpdir(), "clawdis-reply-"));
|
||||||
const previousHome = process.env.HOME;
|
const previousHome = process.env.HOME;
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ import {
|
|||||||
import { logVerbose } from "../globals.js";
|
import { logVerbose } from "../globals.js";
|
||||||
import { buildProviderSummary } from "../infra/provider-summary.js";
|
import { buildProviderSummary } from "../infra/provider-summary.js";
|
||||||
import { triggerClawdisRestart } from "../infra/restart.js";
|
import { triggerClawdisRestart } from "../infra/restart.js";
|
||||||
import { enqueueSystemEvent } from "../infra/system-events.js";
|
import {
|
||||||
import { drainSystemEvents } from "../infra/system-events.js";
|
drainSystemEvents,
|
||||||
|
enqueueSystemEvent,
|
||||||
|
} from "../infra/system-events.js";
|
||||||
import { clearCommandLane, getQueueSize } from "../process/command-queue.js";
|
import { clearCommandLane, getQueueSize } from "../process/command-queue.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
import { normalizeE164 } from "../utils.js";
|
import { normalizeE164 } from "../utils.js";
|
||||||
@@ -549,7 +551,9 @@ export async function getReplyFromConfig(
|
|||||||
|
|
||||||
const initialModelLabel = `${provider}/${model}`;
|
const initialModelLabel = `${provider}/${model}`;
|
||||||
const formatModelSwitchEvent = (label: string, alias?: string) =>
|
const formatModelSwitchEvent = (label: string, alias?: string) =>
|
||||||
alias ? `Model switched to ${alias} (${label}).` : `Model switched to ${label}.`;
|
alias
|
||||||
|
? `Model switched to ${alias} (${label}).`
|
||||||
|
: `Model switched to ${label}.`;
|
||||||
|
|
||||||
const directiveOnly = (() => {
|
const directiveOnly = (() => {
|
||||||
if (
|
if (
|
||||||
@@ -646,9 +650,12 @@ export async function getReplyFromConfig(
|
|||||||
};
|
};
|
||||||
const nextLabel = `${modelSelection.provider}/${modelSelection.model}`;
|
const nextLabel = `${modelSelection.provider}/${modelSelection.model}`;
|
||||||
if (nextLabel !== initialModelLabel) {
|
if (nextLabel !== initialModelLabel) {
|
||||||
enqueueSystemEvent(formatModelSwitchEvent(nextLabel, modelSelection.alias), {
|
enqueueSystemEvent(
|
||||||
|
formatModelSwitchEvent(nextLabel, modelSelection.alias),
|
||||||
|
{
|
||||||
contextKey: `model:${nextLabel}`,
|
contextKey: `model:${nextLabel}`,
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user