import type { ProjectId, TenantId } from '../../types/ids/index.js'; import { type ResidentLearningCycleEvent, type ResidentLearningCycleOptions, type ResidentLearningCycleResult } from './learning-cycle.js'; import { type ResidentLearningObservation, type ResidentLearningObservationRecord, type ResidentLearningTarget } from './learning-observation.js'; /** * The schema this store writes and reads. Versions 1 and 2 keyed observations * and receipts by a turn id; a database at either (or any other version) is * refused, never migrated — its rows name executions that no longer exist. */ export declare const RESIDENT_LEARNING_STORE_VERSION = 3; /** A learning database this version of the store does not read. */ export declare class ResidentLearningStoreVersionError extends Error { readonly name = "ResidentLearningStoreVersionError"; readonly found: number; readonly expected: number; constructor(databasePath: string, found: number); } /** @experimental Private parent directories and backup policy remain host responsibilities. */ export interface SqliteResidentLearningStoreOptions { readonly databasePath: string; readonly artifactsPath: string; readonly scope: { readonly tenantId: TenantId; readonly projectId: ProjectId; readonly agentKey: string; }; readonly readOnly?: boolean; } /** @experimental A content-addressed immutable JSON artifact, scoped through its owning cycle. */ export interface ResidentLearningArtifact { readonly name: string; readonly hash: string; readonly bytes: number; } /** @experimental Recorded lower bounds; absence of a final result means completeness is unknown. */ export interface ResidentLearningRecordedUsage { readonly tokens: number; readonly costUsd: number; readonly receipts: number; readonly unknownTokens: number; readonly unknownCosts: number; } /** @experimental Running/pending records require inspection; neither implies a live executor. */ export interface ResidentLearningCycleSummary { readonly cycleId: string; readonly ordinal: number; readonly parentCycleId: string | null; readonly skillName: string | null; readonly status: ResidentLearningCycleResult['status'] | 'running' | 'activation-pending'; readonly sequence: number; readonly startedAt: number; readonly updatedAt: number; readonly candidateRevision: string | null; readonly result: ResidentLearningCycleResult | null; readonly recordedUsage: ResidentLearningRecordedUsage; } /** * @experimental Authoritative experiment journal and query index in one transaction. * Large JSON artifacts are published completely before their SQLite references. * No database transaction spans an await, model request or artifact write. JSONL * exports are observations, never a second writable authority or a replay queue. */ export declare class SqliteResidentLearningStore { readonly databasePath: string; readonly artifactsPath: string; private readonly scope; private readonly readOnly; constructor(options: SqliteResidentLearningStoreOptions); private use; private owned; /** Immutable, idempotent observations. Regrading requires a different evaluator revision. */ observe(input: ResidentLearningObservation): Promise; private observationsQuery; private observationRecord; /** Ordered inspection; summaries are host observations, not inferred task completion. */ observations(options?: { readonly after?: number; readonly limit?: number; }): Promise; /** Oldest eligible unattempted task across current targets; no model call or claim is made. */ selectObservation(input: readonly ResidentLearningTarget[]): Promise; private claimObservation; /** Identical event retries are idempotent. Different content at the same sequence is refused. */ append(input: ResidentLearningCycleEvent): Promise; get(cycleId: string): Promise; list(options?: { readonly before?: number; readonly limit?: number; }): Promise; events(cycleId: string, options?: { readonly after?: number; readonly limit?: number; }): Promise; artifacts(cycleId: string): Promise; /** Complete immutable bytes precede the reference; an interrupted publication may leave an unreferenced blob. */ putArtifact(cycleId: string, name: string, value: unknown): Promise; readArtifact(cycleId: string, name: string): Promise; } /** @experimental Supply normal host callbacks; the store retains journal events and full paired batches. */ export declare function runStoredResidentLearningCycle(store: SqliteResidentLearningStore, options: Omit): Promise; /** @experimental Host authorizes evaluators; the SDK selects a retained failure against the active skill. */ export interface ResidentLearningDiscoveryOptions extends Omit { readonly evaluators: readonly { readonly skillName: string; readonly evaluatorRevision: string; }[]; } /** @experimental Null cycle means no eligible work. A failed claimed cycle is never silently replayed. */ export interface ResidentLearningDiscoveryResult { readonly observation: ResidentLearningObservationRecord | null; readonly cycle: ResidentLearningCycleResult | null; } /** * @experimental Admit at most one experiment from host-scored observations. * Selection is local FIFO fairness, not an estimated probability of improvement. * Claim and start are one SQLite transaction; concurrent selectors cannot run * the same task/evaluator/baseline twice, even after a crash or reopened process. */ export declare function runStoredResidentLearningFromObservations(store: SqliteResidentLearningStore, options: ResidentLearningDiscoveryOptions): Promise; //# sourceMappingURL=learning-store.d.ts.map