2026-02-18 01:29:02 +00:00
|
|
|
import { createSessionManagerRuntimeRegistry } from "../session-manager-runtime-registry.js";
|
2026-02-18 01:34:35 +00:00
|
|
|
import type { EffectiveContextPruningSettings } from "./settings.js";
|
2026-01-07 12:02:46 +01:00
|
|
|
|
|
|
|
|
export type ContextPruningRuntimeValue = {
|
|
|
|
|
settings: EffectiveContextPruningSettings;
|
|
|
|
|
contextWindowTokens?: number | null;
|
|
|
|
|
isToolPrunable: (toolName: string) => boolean;
|
2026-01-21 19:44:20 +00:00
|
|
|
lastCacheTouchAt?: number | null;
|
2026-01-07 12:02:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Important: this relies on Pi passing the same SessionManager object instance into
|
|
|
|
|
// ExtensionContext (ctx.sessionManager) that we used when calling setContextPruningRuntime.
|
2026-02-15 17:39:10 +00:00
|
|
|
const registry = createSessionManagerRuntimeRegistry<ContextPruningRuntimeValue>();
|
2026-01-07 12:02:46 +01:00
|
|
|
|
2026-02-15 17:39:10 +00:00
|
|
|
export const setContextPruningRuntime = registry.set;
|
2026-01-07 12:02:46 +01:00
|
|
|
|
2026-02-15 17:39:10 +00:00
|
|
|
export const getContextPruningRuntime = registry.get;
|