/** * Session lineage helper for the PI adapter. * * PI exposes a `ReadonlySessionManager` with `getHeader()` that returns the * header for the current session. The header carries `parentSession` which is * the path to the parent session's file (not a session id). Because the core * `HostAdapter` only asks for the root session id reachable from a starting * id, we walk best-effort: when the current request matches the session * manager's current session we return its ultimate parent-less ancestor's id * (falling back to the current id when the lineage chain cannot be resolved). * * This is intentionally conservative. PI's read-only API does not expose a * way to look up arbitrary session headers by id, so for any sessionId that * isn't the currently-active one we return the input id unchanged. That keeps * the `runIn: "main"` semantics sane: the current session resolves to its * root, everything else resolves to itself. */ import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; /** Test-only: clear the resolution cache so each case starts fresh. */ export declare function resetSessionLineageCacheForTests(): void; /** * P3-2: same justification as in `adapter.ts` — use the SDK's * `ReadonlySessionManager` shape by indexing `ExtensionContext["sessionManager"]` * (its only public surface) rather than a structural mirror. */ type ReadonlySessionManager = ExtensionContext["sessionManager"]; /** * Return the root session id reachable from `currentSessionId`. * * Walks `sessionManager.getHeader().parentSession` when it points to a file * path we can read; otherwise returns the starting id. Best-effort by design. */ export declare function getRootSessionId(currentSessionId: string, sessionManager: ReadonlySessionManager | undefined): string; export {};