import type { SessionContextUsage } from '../core/types/agent-types.js'; import { type CompactAgentRequest } from '../domain/agents/facade.js'; import type { AgentCompactResult } from '../agent-adapter/types.js'; export type CompactSessionOutcome = { ok: true; status: 'compacted' | 'not-needed'; contextUsage: SessionContextUsage | null; } | { ok: false; reason: 'not-found' | 'unsupported' | 'running'; }; export type CompactActiveSessionOutcome = CompactSessionOutcome | { ok: false; reason: 'no-session'; }; interface CompactSessionRecord { name: string; sessionId: string; backendSessionId?: string | null; projectId: string; channel: string; backend: string; profileName: string | null; contextUsage?: SessionContextUsage; } export interface CompactSessionDeps { sessions: { getById(sessionId: string): Promise; updateContextUsage(sessionId: string, usage: SessionContextUsage | null): Promise; }; running: { hasChannel(channel: string): boolean; }; background: { has(sessionId: string): boolean; }; queue: { has(channel: string): boolean; run(channel: string, fn: () => Promise): Promise; }; supports(session: { backend: string; profileName: string | null; }): boolean; compactAgent(request: CompactAgentRequest): Promise; publish(event: { sessionId: string; channel: string; status: 'compacted'; contextUsage: SessionContextUsage | null; }): void; now(): string; } export declare function compactActiveSessionContext(opts: { channel: string; }): Promise; export declare function compactSessionContext(sessionId: string, deps?: CompactSessionDeps): Promise; export {};