@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
35 lines • 1.58 kB
TypeScript
import type { MovedBreadcrumb } from "./breadcrumb.ts";
import { type MovedPath } from "./breadcrumb-trust.ts";
import { type PathPlatform } from "./path-match.ts";
/** One filesystem question the walk asks; the sync and async resolvers answer it with their own I/O. */
export type ResolverStep = {
readonly op: "canonical";
readonly path: string;
} | {
readonly op: "json";
readonly file: string;
} | {
readonly op: "exists";
readonly path: string;
} | {
readonly op: "folder";
readonly path: string;
readonly follow: boolean;
} | {
readonly op: "home";
};
/**
* The answer to a step whose I/O failed or timed out. A path whose own canonicalization fails is walked by its
* spelling instead, so a moved prefix is still recognized through its breadcrumb and an unrelated path still is not.
*/
export declare function failedReply(_step: ResolverStep): unknown;
type Walk<T> = Generator<ResolverStep, T, unknown>;
type OnReused = (oldRoot: string, breadcrumb: MovedBreadcrumb, prefix: readonly string[]) => void;
/**
* The single decision both resolvers drive (senpi#2898): canonicalize the path, walk its ancestors for a breadcrumb
* listing it, trust that breadcrumb only when its home's marker matches, and follow up to `MAX_HOPS` moves. Every I/O
* is a yielded step, so the sync and async resolvers cannot disagree on order or on what a failure means.
*/
export declare function movedPathWalk(path: string, platform: PathPlatform, onReused?: OnReused): Walk<MovedPath | undefined>;
export {};
//# sourceMappingURL=walk.d.ts.map