Files
openclaw/src/agents/pi-extensions/context-pruning/runtime.ts
2026-02-15 17:39:21 +00:00

18 lines
753 B
TypeScript

import type { EffectiveContextPruningSettings } from "./settings.js";
import { createSessionManagerRuntimeRegistry } from "../session-manager-runtime-registry.js";
export type ContextPruningRuntimeValue = {
settings: EffectiveContextPruningSettings;
contextWindowTokens?: number | null;
isToolPrunable: (toolName: string) => boolean;
lastCacheTouchAt?: number | null;
};
// Important: this relies on Pi passing the same SessionManager object instance into
// ExtensionContext (ctx.sessionManager) that we used when calling setContextPruningRuntime.
const registry = createSessionManagerRuntimeRegistry<ContextPruningRuntimeValue>();
export const setContextPruningRuntime = registry.set;
export const getContextPruningRuntime = registry.get;