histoire
Version:
A fast story book powered by Vite
43 lines • 1.82 kB
TypeScript
import type { UiAgentCommand } from '@histoire/shared';
/**
* Last slash commands each agent announced, kept beside the user's agent settings so they survive dev server restarts.
* @param dataFile User-level `agents.json`; the cache sits in the same folder.
* @param root Project root scoping the cached commands.
*/
export declare function createAgentCommandsCache(dataFile: string, root: string): {
/** Commands of this project's agents. */
load(): Promise<Record<string, UiAgentCommand[]>>;
/**
* Replace one agent's commands; writes are serialized, atomic and skipped when unchanged.
* @param agentId Agent preset id.
* @param commands Newest commands.
*/
save(agentId: string, commands: UiAgentCommand[]): Promise<void>;
/** Settles once every queued write finished. */
flush: () => Promise<void>;
};
/**
* In-memory commands per agent, seeded from and saved to the user cache.
* @param dataFile User-level `agents.json`.
* @param root Project root.
* @param changed Publishes a new agents snapshot.
*/
export declare function createAgentCommands(dataFile: string, root: string, changed: () => void): {
map: Map<string, UiAgentCommand[]>;
/** Seed agents not yet announced in this process. */
load(): Promise<void>;
/**
* Publish and persist an agent's newest commands; an unchanged list does nothing.
* @param agentId Agent preset id.
* @param list Newest commands.
*/
remember(agentId: string, list: UiAgentCommand[]): void;
/**
* Names of an agent's last announced or cached commands.
* @param agentId Agent preset id.
*/
names: (agentId: string) => string[];
/** Settles once pending cache writes finished. */
flush: () => Promise<void>;
};
//# sourceMappingURL=commands-cache.d.ts.map