@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
35 lines • 1.78 kB
TypeScript
/**
* Host-scoped memo for package resolution.
*
* A shared host opens many sessions in one agent dir, and every open ran the
* same package discovery: ~68 ms of loop CPU per open on the daemon, repeated
* N-way for N concurrent opens (senpi#1844). The product depends only on the
* agent dir, the cwd, the project trust state, the settings content and the
* CLI-supplied extension sources - never on the session - so it is memoized on
* exactly those inputs. Trust is its own input: resolution reads it directly, and
* with no project settings file an untrusted and a trusted pass share every other
* input (senpi#2371).
*
* The memo stores the PROMISE, not the value: N concurrent opens with one key
* await a single resolution instead of racing N of them.
*
* The key covers settings, not disk: resolution also reads each package's own
* manifest, which a settings digest cannot see. A RE-load of a loader is the
* existing signal that disk may have changed (it is where the extension cache
* is cleared too), so a re-load bypasses the memo and refreshes the entry;
* only a fresh loader - a new session on a shared host - reads through it.
*/
export interface ResolvedPathsMemoKeyInput {
readonly agentDir: string;
readonly cwd: string;
readonly projectTrusted: boolean;
readonly globalSettings: unknown;
readonly projectSettings: unknown;
readonly additionalExtensionPaths: readonly string[];
}
export declare function resolvedPathsMemoKey(input: ResolvedPathsMemoKeyInput): string;
export declare function memoizeResolvedPaths<T>(key: string, compute: () => Promise<T>, options?: {
readonly refresh?: boolean;
}): Promise<T>;
export declare function clearResolvedPathsMemo(): void;
//# sourceMappingURL=resolved-paths-memo.d.ts.map