interface SoulMessage { role: "system" | "user" | "assistant"; content: string; } type SoulCompletion = (messages: SoulMessage[]) => Promise; type EpisodeOutcome = "success" | "failure" | "partial"; interface Episode { id: string; task: string; outcome: EpisodeOutcome; summary: string; steps?: string[]; tags?: string[]; createdAt: string; signature?: string; } interface Skill { id: string; name: string; trigger: string; procedure: string; tags?: string[]; version: number; createdAt: string; sourceEpisodeId?: string; signature?: string; } interface RecalledEpisode { episode: Episode; score: number; } interface RecalledSkill { skill: Skill; score: number; } interface EpisodicStoreOptions { maxEpisodes?: number; } declare class EpisodicStore { private readonly index; private readonly byId; constructor(options?: EpisodicStoreOptions); add(episode: Episode): Promise; recall(query: string, topK?: number, minScore?: number): Promise; get(id: string): Episode | undefined; all(): Episode[]; get size(): number; toJSON(): Episode[]; static fromEpisodes(episodes: Episode[], options?: EpisodicStoreOptions): Promise; } interface SkillStoreOptions { maxSkills?: number; } declare class SkillStore { private readonly index; private readonly byId; constructor(options?: SkillStoreOptions); add(skill: Skill): Promise; recall(query: string, topK?: number, minScore?: number): Promise; nextVersion(name: string): number; get(id: string): Skill | undefined; all(): Skill[]; get size(): number; toJSON(): Skill[]; static fromSkills(skills: Skill[], options?: SkillStoreOptions): Promise; } interface SynthesizeSkillInput { task: string; transcript: string; complete: SoulCompletion; sourceEpisodeId?: string; now?: () => Date; idGen?: () => string; } declare function synthesizeSkill(input: SynthesizeSkillInput): Promise; declare function extractJsonObject(text: string): Record | null; declare function canonicalPayload(record: Record): string; interface SoulSigner { sign(payload: string): string; readonly publicKeyPem: string; } interface ExportableSoulSigner extends SoulSigner { readonly privateKeyPem: string; } declare function createEd25519Signer(privateKeyPem?: string): ExportableSoulSigner; declare function verifySignature(payload: string, signatureB64: string, publicKeyPem: string): boolean; declare function verifySoulRecord(record: Record & { signature?: string; }, publicKeyPem: string): boolean; interface SoulEngineOptions { dir?: string; complete?: SoulCompletion; signer?: SoulSigner; minStepsForSkill?: number; maxEpisodes?: number; maxSkills?: number; now?: () => Date; idGen?: () => string; } interface OnTaskCompleteInput { task: string; transcript: string; outcome: EpisodeOutcome; steps?: string[]; tags?: string[]; summary?: string; synthesizeSkill?: boolean; } interface OnTaskCompleteResult { episode: Episode; skill: Skill | null; } interface AugmentContextOptions { maxSkills?: number; maxEpisodes?: number; minScore?: number; } declare class SoulEngine { readonly episodes: EpisodicStore; readonly skills: SkillStore; private readonly dir?; private readonly complete?; private readonly signer?; private readonly minStepsForSkill; private readonly now; private readonly idGen; private constructor(); static create(options?: SoulEngineOptions): Promise; onTaskComplete(input: OnTaskCompleteInput): Promise; augmentContext(query: string, options?: AugmentContextOptions): Promise; save(): Promise; getPublicKeyPem(): string | undefined; private shouldSynthesize; private deriveSummary; private heuristicSummary; private maybeSign; } export { type AugmentContextOptions, type Episode, type EpisodeOutcome, EpisodicStore, type EpisodicStoreOptions, type ExportableSoulSigner, type OnTaskCompleteInput, type OnTaskCompleteResult, type RecalledEpisode, type RecalledSkill, type Skill, SkillStore, type SkillStoreOptions, type SoulCompletion, SoulEngine, type SoulEngineOptions, type SoulMessage, type SoulSigner, type SynthesizeSkillInput, canonicalPayload, createEd25519Signer, extractJsonObject, synthesizeSkill, verifySignature, verifySoulRecord };