Status: lazy-load summary session helpers

This commit is contained in:
Vincent Koc
2026-03-15 23:23:50 -07:00
parent 4ab016a9bd
commit a608d09552
2 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,2 @@
export { resolveContextTokensForModel } from "../agents/context.js";
export { classifySessionKey, resolveSessionModelRef } from "../gateway/session-utils.js";

View File

@@ -1,4 +1,3 @@
import { resolveContextTokensForModel } from "../agents/context.js";
import { DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
import { hasPotentialConfiguredChannels } from "../channels/config-presence.js";
@@ -12,7 +11,6 @@ import {
type SessionEntry,
} from "../config/sessions.js";
import { listGatewayAgentsBasic } from "../gateway/agent-list.js";
import { classifySessionKey, resolveSessionModelRef } from "../gateway/session-utils.js";
import { resolveHeartbeatSummaryForAgent } from "../infra/heartbeat-summary.js";
import { peekSystemEvents } from "../infra/system-events.js";
import { parseAgentSessionKey } from "../routing/session-key.js";
@@ -21,6 +19,9 @@ import type { HeartbeatStatus, SessionStatus, StatusSummary } from "./status.typ
let channelSummaryModulePromise: Promise<typeof import("../infra/channel-summary.js")> | undefined;
let linkChannelModulePromise: Promise<typeof import("./status.link-channel.js")> | undefined;
let statusSummaryRuntimeModulePromise:
| Promise<typeof import("./status.summary.runtime.js")>
| undefined;
function loadChannelSummaryModule() {
channelSummaryModulePromise ??= import("../infra/channel-summary.js");
@@ -32,6 +33,11 @@ function loadLinkChannelModule() {
return linkChannelModulePromise;
}
function loadStatusSummaryRuntimeModule() {
statusSummaryRuntimeModulePromise ??= import("./status.summary.runtime.js");
return statusSummaryRuntimeModulePromise;
}
const buildFlags = (entry?: SessionEntry): string[] => {
if (!entry) {
return [];
@@ -97,6 +103,8 @@ export async function getStatusSummary(
} = {},
): Promise<StatusSummary> {
const { includeSensitive = true } = options;
const { classifySessionKey, resolveContextTokensForModel, resolveSessionModelRef } =
await loadStatusSummaryRuntimeModule();
const cfg = options.config ?? loadConfig();
const needsChannelPlugins = hasPotentialConfiguredChannels(cfg);
const linkContext = needsChannelPlugins