mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-08 07:41:08 +00:00
refactor: trim cron session startup imports
This commit is contained in:
22
src/agents/live-model-switch-error.ts
Normal file
22
src/agents/live-model-switch-error.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export type LiveSessionModelSelection = {
|
||||
provider: string;
|
||||
model: string;
|
||||
authProfileId?: string;
|
||||
authProfileIdSource?: "auto" | "user";
|
||||
};
|
||||
|
||||
export class LiveSessionModelSwitchError extends Error {
|
||||
provider: string;
|
||||
model: string;
|
||||
authProfileId?: string;
|
||||
authProfileIdSource?: "auto" | "user";
|
||||
|
||||
constructor(selection: LiveSessionModelSelection) {
|
||||
super(`Live session model switch requested: ${selection.provider}/${selection.model}`);
|
||||
this.name = "LiveSessionModelSwitchError";
|
||||
this.provider = selection.provider;
|
||||
this.model = selection.model;
|
||||
this.authProfileId = selection.authProfileId;
|
||||
this.authProfileIdSource = selection.authProfileIdSource;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
import { loadSessionStore, resolveStorePath, type SessionEntry } from "../config/sessions.js";
|
||||
import { resolveStorePath } from "../config/sessions/paths.js";
|
||||
import { loadSessionStore } from "../config/sessions/store.js";
|
||||
import type { SessionEntry } from "../config/sessions/types.js";
|
||||
import { LiveSessionModelSwitchError } from "./live-model-switch-error.js";
|
||||
import { resolveDefaultModelForAgent, resolvePersistedModelRef } from "./model-selection.js";
|
||||
import {
|
||||
consumeEmbeddedRunModelSwitch,
|
||||
@@ -6,25 +9,9 @@ import {
|
||||
type EmbeddedRunModelSwitchRequest,
|
||||
} from "./pi-embedded-runner/runs.js";
|
||||
import { abortEmbeddedPiRun } from "./pi-embedded.js";
|
||||
|
||||
export { LiveSessionModelSwitchError } from "./live-model-switch-error.js";
|
||||
export type LiveSessionModelSelection = EmbeddedRunModelSwitchRequest;
|
||||
|
||||
export class LiveSessionModelSwitchError extends Error {
|
||||
provider: string;
|
||||
model: string;
|
||||
authProfileId?: string;
|
||||
authProfileIdSource?: "auto" | "user";
|
||||
|
||||
constructor(selection: LiveSessionModelSelection) {
|
||||
super(`Live session model switch requested: ${selection.provider}/${selection.model}`);
|
||||
this.name = "LiveSessionModelSwitchError";
|
||||
this.provider = selection.provider;
|
||||
this.model = selection.model;
|
||||
this.authProfileId = selection.authProfileId;
|
||||
this.authProfileIdSource = selection.authProfileIdSource;
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveLiveSessionModelSelection(params: {
|
||||
cfg?: { session?: { store?: string } } | undefined;
|
||||
sessionKey?: string;
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { AuthProfileStore } from "./auth-profiles.js";
|
||||
import { saveAuthProfileStore } from "./auth-profiles.js";
|
||||
import { AUTH_STORE_VERSION } from "./auth-profiles/constants.js";
|
||||
import { isAnthropicBillingError } from "./live-auth-keys.js";
|
||||
import { LiveSessionModelSwitchError } from "./live-model-switch.js";
|
||||
import { LiveSessionModelSwitchError } from "./live-model-switch-error.js";
|
||||
import { runWithImageModelFallback, runWithModelFallback } from "./model-fallback.js";
|
||||
import { makeModelFallbackCfg } from "./test-helpers/model-fallback-config-fixture.js";
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
shouldPreserveTransientCooldownProbeSlot,
|
||||
shouldUseTransientCooldownProbeSlot,
|
||||
} from "./failover-policy.js";
|
||||
import { LiveSessionModelSwitchError } from "./live-model-switch.js";
|
||||
import { LiveSessionModelSwitchError } from "./live-model-switch-error.js";
|
||||
import { logModelFallbackDecision } from "./model-fallback-observation.js";
|
||||
import type { FallbackAttempt, ModelCandidate } from "./model-fallback.types.js";
|
||||
import {
|
||||
|
||||
@@ -25,9 +25,9 @@ import {
|
||||
FailoverError,
|
||||
resolveFailoverStatus,
|
||||
} from "../failover-error.js";
|
||||
import { LiveSessionModelSwitchError } from "../live-model-switch-error.js";
|
||||
import {
|
||||
hasDifferentLiveSessionModelSelection,
|
||||
LiveSessionModelSwitchError,
|
||||
consumeLiveSessionModelSwitch,
|
||||
} from "../live-model-switch.js";
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user