mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
ab0b749017
* 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
47 lines
1.7 KiB
TypeScript
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) ?? ""}`;
|
|
}
|