Files
openclaw/src/gateway/session-utils-contracts.ts
T
Peter Steinberger ab0b749017 perf(gateway): stop per-row store and registry rediscovery in sessions.list (#114659)
* perf(gateway): stop per-row store and registry rediscovery in sessions.list

* fix(gateway): satisfy kysely guardrail and knip on sessions.list rediscovery fix

* refactor(state): split registered agent database listing from the registry

* chore(state): allowlist the split registry listing module for raw sqlite probes
2026-07-27 15:04:24 -04:00

47 lines
1.7 KiB
TypeScript

import {
normalizeLowercaseStringOrEmpty,
normalizeOptionalString,
} from "@openclaw/normalization-core/string-coerce";
import type { resolveSessionModelRef } from "../agents/session-model-ref.js";
import type { buildSubagentRunReadIndex } from "../agents/subagent-registry-read.js";
import type { ThinkLevel, listThinkingLevelOptions } from "../auto-reply/thinking.js";
import type { SessionAcpMeta, SessionEntry } from "../config/sessions.js";
import type { ModelCostConfig } from "../utils/usage-format.js";
export type SessionListRowContext = {
subagentRuns: ReturnType<typeof buildSubagentRunReadIndex>;
storeChildSessionsByKey: Map<string, string[]>;
selectedModelByOverrideRef: Map<string, ReturnType<typeof resolveSessionModelRef>>;
thinkingMetadataByModelRef: Map<
string,
{
levels: ReturnType<typeof listThinkingLevelOptions>;
defaultLevel: ThinkLevel;
}
>;
displayModelIdentityByKey: Map<string, { provider?: string; model?: string }>;
modelCostConfigByModelRef: Map<string, ModelCostConfig | undefined>;
userProfileLabelById: Map<string, string | undefined>;
acpSessionMetaByEntry: Map<SessionEntry, SessionAcpMeta | undefined>;
};
export type SessionListRowContextProvider = () => SessionListRowContext;
export type GatewaySessionStoreTarget = {
agentId: string;
storePath: string;
canonicalKey: string;
storeKeys: string[];
};
export type GatewaySessionStoreTargetWithStore = GatewaySessionStoreTarget & {
store: Record<string, SessionEntry>;
};
export function createSessionRowModelCacheKey(
provider: string | undefined,
model: string | undefined,
) {
return `${normalizeLowercaseStringOrEmpty(provider)}\0${normalizeOptionalString(model) ?? ""}`;
}