@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
76 lines • 3.36 kB
TypeScript
/**
* In-process wire contract for config-watch extensions.
*
* Event emitters are intentionally untyped, so consumers must use these guards
* before accepting a payload from `pi.events`.
*/
export declare const configWatchChannels: {
readonly register: "config-watch:register";
readonly unregister: "config-watch:unregister";
readonly ready: "config-watch:ready";
readonly changed: "config-watch:changed";
readonly reloaded: "config-watch:reloaded";
readonly rejected: "config-watch:rejected";
};
export declare const CONFIG_WATCH_REGISTER: "config-watch:register";
export declare const CONFIG_WATCH_UNREGISTER: "config-watch:unregister";
export declare const CONFIG_WATCH_READY: "config-watch:ready";
export declare const CONFIG_WATCH_CHANGED: "config-watch:changed";
export declare const CONFIG_WATCH_RELOADED: "config-watch:reloaded";
export declare const CONFIG_WATCH_REJECTED: "config-watch:rejected";
export type ConfigWatchTargetKind = "file" | "dir";
export interface ConfigWatchTarget {
path: string;
kind: ConfigWatchTargetKind;
filterGlobs?: string[];
}
export type ConfigWatchValidation = {
ok: true;
} | {
ok: false;
errors: string[];
};
export interface ConfigWatchRegistration {
/** Registration IDs are unique; a later registration with the same ID replaces this one. */
id: string;
displayName: string;
targets: ConfigWatchTarget[];
validate?: (changedPaths: readonly string[]) => Promise<ConfigWatchValidation> | ConfigWatchValidation;
}
export interface ConfigWatchUnregistration {
id: string;
}
export interface ConfigWatchChanged {
registrationId: string;
paths: string[];
deferred: boolean;
}
export interface ConfigWatchReloaded {
registrationId: string;
paths: string[];
}
export interface ConfigWatchRejected {
registrationId: string;
paths: string[];
errors: string[];
}
export declare function isConfigWatchTarget(value: unknown): value is ConfigWatchTarget;
export declare function isConfigWatchRegistration(value: unknown): value is ConfigWatchRegistration;
export declare function isConfigWatchValidation(value: unknown): value is ConfigWatchValidation;
export declare function isConfigWatchUnregistration(value: unknown): value is ConfigWatchUnregistration;
export declare function isConfigWatchChanged(value: unknown): value is ConfigWatchChanged;
export declare function isConfigWatchReloaded(value: unknown): value is ConfigWatchReloaded;
export declare function isConfigWatchRejected(value: unknown): value is ConfigWatchRejected;
/**
* Matches plain file names, path suffixes, and a leading-star suffix pattern.
* This intentionally does not implement a full glob language.
*
* A leading `/` anchors the glob to the watch root, which is the only way to
* express "this immediate child" for a recursive target. Without it a bare
* `.omo` glob on an ancestor watch matches every `.omo` directory in the whole
* subtree.
*/
export declare function matchesConfigWatchFilter(path: string, filterGlobs: readonly string[] | undefined): boolean;
/** Returns registrations keyed by ID, with later duplicate registrations taking precedence. */
export declare function resolveConfigWatchRegistrations(registrations: Iterable<ConfigWatchRegistration>): ConfigWatchRegistration[];
//# sourceMappingURL=protocol.d.ts.map