@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
51 lines • 2.9 kB
TypeScript
import type { PermissionEventEmitter } from "./events.ts";
import type { CanonicalRule } from "./path-identity.ts";
import type { PathIdentityResolver } from "./path-identity-host.ts";
import type { Rule } from "./types.ts";
export type RuleIdentityEntry = CanonicalRule | "literal-only" | "timed-out" | "pending";
interface RuleIdentity {
entry: RuleIdentityEntry;
fill?: Promise<void>;
/** Whether the anchored prefix goes through an alias; undefined while the worker has not answered. */
aliasBearing: boolean | undefined;
/** The open-free walk of the anchored prefix, computed once per rules load; null when the walk failed. */
walkedPrefix?: string | null;
}
/** Rule-side canonical forms, per pattern, filled through the resolver worker (6.5). */
export declare class RuleIdentityCache {
private readonly ruleIdentities;
private readonly resolver;
private readonly projectDir;
private readonly pathRules;
private readonly emitter;
constructor(resolver: PathIdentityResolver | undefined, projectDir: string | undefined, pathRules: () => Rule[], emitter: PermissionEventEmitter);
anchoredPrefix(pattern: string): string;
/** Eager fill at rules load (R3-H1): one SOFT request per rule, outside the stall machinery. */
fillAll(): void;
fillRule(pattern: string, soft: boolean): RuleIdentity;
/** The cached identity state of one rule pattern. */
stateOf(pattern: string): RuleIdentityEntry;
/**
* The rule's form with the resolver UNAVAILABLE: its anchored spelling as written, split at the first
* wildcard like the worker would, with no realpath. A rule written on a canonical spelling still meets a
* JS cell's kernel canonical this way; a rule written through an alias does not, and that is the
* documented cost of a worker that could not start.
*/
lexicalForm(pattern: string): CanonicalRule | undefined;
/** Whether a rule's prefix goes through an alias; true while the worker has not answered yet. */
aliasBearing(pattern: string): boolean;
walkedPrefix(pattern: string): string | null | undefined;
/**
* A decided non-read operation may have retargeted a rule chain (6.5, M3): drop the cached form of every
* rule whose anchored prefix shares a path with the mutated one, or every rule when no path is known.
*/
noteMutation(mutated?: string): void;
/** DENY rules of the class whose identity form is timed out or behind an open breaker (T(P) of 6.5.1). */
timedOutDenies(permission: string): Rule[];
/** Await every pending lazy fill a decision of this class needs; sync when nothing is pending. */
settleRules(permission: string): Promise<void> | undefined;
/** Resolves once every in-flight rule fill (eager or lazy) has settled. */
settled(): Promise<void>;
}
export {};
//# sourceMappingURL=rule-identity-cache.d.ts.map