import { z } from 'zod'; import type { MessageTargetId } from '../onebot/types.js'; import type { HandlerContext } from '../router.js'; import type { QqControlActionHandler } from './control.js'; export type CustomMemoryRecordStatus = 'pending' | 'fired' | 'failed'; export interface CustomMemoryTarget { scope: 'private' | 'group'; targetId: MessageTargetId; } export interface CustomMemoryTimerRecord { uuid: string; time: string; content: string; sourceSessionKey: string; scope: 'private' | 'group'; targetId: MessageTargetId; status: CustomMemoryRecordStatus; createdAt: string; updatedAt?: string; firedAt?: string; error?: string; } export interface CustomMemoryMemoRecord { uuid: string; key: string; content: string; sourceSessionKey: string; scope: 'private' | 'group'; targetId: MessageTargetId; createdAt: string; updatedAt?: string; } export interface CustomMemoryStore { saveTimer(record: CustomMemoryTimerRecord): Promise; listTimers(): Promise; updateTimer(record: CustomMemoryTimerRecord): Promise; deleteTimer(uuid: string): Promise; saveMemo(record: CustomMemoryMemoRecord): Promise; listMemos(): Promise; close?(): Promise; } export interface DshStorageDomainRuntime { open(spec: unknown): Promise; } export interface DshStorageDomain { table(name: string): DshKvTable; close(): Promise; } export interface DshKvTable { get(key: string): V | undefined; entries(): IterableIterator<[string, V]>; put(key: string, value: V): Promise; delete(key: string): Promise; update(key: string, fn: (current: V) => V): Promise; } export declare const customMemoryTimerSchema: z.ZodType; export declare const customMemoryMemoSchema: z.ZodType; export declare const customMemoryDomainSpec: { name: string; version: number; tables: { timers: { valueSchema: z.ZodType; }; memos: { valueSchema: z.ZodType; }; }; }; export declare class InMemoryCustomMemoryStore implements CustomMemoryStore { private readonly timers; private readonly memos; saveTimer(record: CustomMemoryTimerRecord): Promise; listTimers(): Promise; updateTimer(record: CustomMemoryTimerRecord): Promise; deleteTimer(uuid: string): Promise; saveMemo(record: CustomMemoryMemoRecord): Promise; listMemos(): Promise; } export declare class StorageDomainCustomMemoryStore implements CustomMemoryStore { private readonly domain; private readonly timers; private readonly memos; private constructor(); static open(storageDomain: DshStorageDomainRuntime): Promise; saveTimer(record: CustomMemoryTimerRecord): Promise; listTimers(): Promise; updateTimer(record: CustomMemoryTimerRecord): Promise; deleteTimer(uuid: string): Promise; saveMemo(record: CustomMemoryMemoRecord): Promise; listMemos(): Promise; close(): Promise; } export declare class LazyCustomMemoryStore implements CustomMemoryStore { private readonly storageDomain?; private readonly memory; private persistent?; private opening?; private warned; constructor(storageDomain?: (() => DshStorageDomainRuntime | undefined) | undefined); saveTimer(record: CustomMemoryTimerRecord): Promise; listTimers(): Promise; updateTimer(record: CustomMemoryTimerRecord): Promise; deleteTimer(uuid: string): Promise; saveMemo(record: CustomMemoryMemoRecord): Promise; listMemos(): Promise; close(): Promise; private active; private openPersistent; } export declare function createSaveMemoControlHandler(store: CustomMemoryStore): QqControlActionHandler; export declare function createTimerRecord(input: { source: HandlerContext; sourceSessionKey: string; time: string; content: string; now?: () => number; }): CustomMemoryTimerRecord; export declare function createMemoRecord(input: { source: HandlerContext; sourceSessionKey: string; key: string; content: string; now?: () => number; }): CustomMemoryMemoRecord; export declare function targetFromSource(source: HandlerContext): CustomMemoryTarget;